vendor: 8,214 bytes, lines 1-17
1(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const l of r.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();function pR(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Vx={exports:{}},Ch={};/** 2 * @license React 3 * react-jsx-runtime.production.js 4 * 5 * Copyright (c) Meta Platforms, Inc. and affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var QA;function NF(){if(QA)return Ch;QA=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(s,i,r){var l=null;if(r!==void 0&&(l=""+r),i.key!==void 0&&(l=""+i.key),"key"in i){r={};for(var u in i)u!=="key"&&(r[u]=i[u])}else r=i;return i=r.ref,{$$typeof:o,type:s,key:l,ref:i!==void 0?i:null,props:r}}return Ch.Fragment=e,Ch.jsx=t,Ch.jsxs=t,Ch}var KA;function wF(){return KA||(KA=1,Vx.exports=NF()),Vx.exports}var k=wF(),Gx={exports:{}},Ge={};/** 10 * @license React 11 * react.production.js 12 * 13 * Copyright (c) Meta Platforms, Inc. and affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var JA;function RF(){if(JA)return Ge;JA=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(G){return G===null||typeof G!="object"?null:(G=y&&G[y]||G["@@iterator"],typeof G=="function"?G:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,M={};function A(G,j,te){this.props=G,this.context=j,this.refs=M,this.updater=te||_}A.prototype.isReactComponent={},A.prototype.setState=function(G,j){if(typeof G!="object"&&typeof G!="function"&&G!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,G,j,"setState")},A.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function C(){}C.prototype=A.prototype;function E(G,j,te){this.props=G,this.context=j,this.refs=M,this.updater=te||_}var F=E.prototype=new C;F.constructor=E,v(F,A.prototype),F.isPureReactComponent=!0;var L=Array.isArray;function U(){}var R={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function $(G,j,te){var pe=te.ref;return{$$typeof:o,type:G,key:j,ref:pe!==void 0?pe:null,props:te}}function ie(G,j){return $(G.type,j,G.props)}function le(G){return typeof G=="object"&&G!==null&&G.$$typeof===o}function ye(G){var j={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(te){return j[te]})}var xe=/\/+/g;function Ne(G,j){return typeof G=="object"&&G!==null&&G.key!=null?ye(""+G.key):j.toString(36)}function ce(G){switch(G.status){case"fulfilled":return G.value;case"rejected":throw G.reason;default:switch(typeof G.status=="string"?G.then(U,U):(G.status="pending",G.then(function(j){G.status==="pending"&&(G.status="fulfilled",G.value=j)},function(j){G.status==="pending"&&(G.status="rejected",G.reason=j)})),G.status){case"fulfilled":return G.value;case"rejected":throw G.reason}}throw G}function X(G,j,te,pe,_e){var Me=typeof G;(Me==="undefined"||Me==="boolean")&&(G=null);var De=!1;if(G===null)De=!0;else switch(Me){case"bigint":case"string":case"number":De=!0;break;case"object":switch(G.$$typeof){case o:case e:De=!0;break;case p:return De=G._init,X(De(G._payload),j,te,pe,_e)}}if(De)return _e=_e(G),De=pe===""?"."+Ne(G,0):pe,L(_e)?(te="",De!=null&&(te=De.replace(xe,"$&/")+"/"),X(_e,j,te,"",function(Ys){return Ys})):_e!=null&&(le(_e)&&(_e=ie(_e,te+(_e.key==null||G&&G.key===_e.key?"":(""+_e.key).replace(xe,"$&/")+"/")+De)),j.push(_e)),1;De=0;var nt=pe===""?".":pe+":";if(L(G))for(var ct=0;ct<G.length;ct++)pe=G[ct],Me=nt+Ne(pe,ct),De+=X(pe,j,te,Me,_e);else if(ct=b(G),typeof ct=="function")for(G=ct.call(G),ct=0;!(pe=G.next()).done;)pe=pe.value,Me=nt+Ne(pe,ct++),De+=X(pe,j,te,Me,_e);else if(Me==="object"){if(typeof G.then=="function")return X(ce(G),j,te,pe,_e);throw j=String(G),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return De}function ne(G,j,te){if(G==null)return G;var pe=[],_e=0;return X(G,pe,"","",function(Me){return j.call(te,Me,_e++)}),pe}function fe(G){if(G._status===-1){var j=G._result;j=j(),j.then(function(te){(G._status===0||G._status===-1)&&(G._status=1,G._result=te)},function(te){(G._status===0||G._status===-1)&&(G._status=2,G._result=te)}),G._status===-1&&(G._status=0,G._result=j)}if(G._status===1)return G._result.default;throw G._result}var Be=typeof reportError=="function"?reportError:function(G){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var j=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof G=="object"&&G!==null&&typeof G.message=="string"?String(G.message):String(G),error:G});if(!window.dispatchEvent(j))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",G);return}console.error(G)},Ce={map:ne,forEach:function(G,j,te){ne(G,function(){j.apply(this,arguments)},te)},count:function(G){var j=0;return ne(G,function(){j++}),j},toArray:function(G){return ne(G,function(j){return j})||[]},only:function(G){if(!le(G))throw Error("React.Children.only expected to receive a single React element child.");return G}};return Ge.Activity=m,Ge.Children=Ce,Ge.Component=A,Ge.Fragment=t,Ge.Profiler=i,Ge.PureComponent=E,Ge.StrictMode=s,Ge.Suspense=h,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(G){return R.H.useMemoCache(G)}},Ge.cache=function(G){return function(){return G.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(G,j,te){if(G==null)throw Error("The argument must be a React element, but you passed "+G+".");var pe=v({},G.props),_e=G.key;if(j!=null)for(Me in j.key!==void 0&&(_e=""+j.key),j)!V.call(j,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&j.ref===void 0||(pe[Me]=j[Me]);var Me=arguments.length-2;if(Me===1)pe.children=te;else if(1<Me){for(var De=Array(Me),nt=0;nt<Me;nt++)De[nt]=arguments[nt+2];pe.children=De}return $(G.type,_e,pe)},Ge.createContext=function(G){return G={$$typeof:l,_currentValue:G,_currentValue2:G,_threadCount:0,Provider:null,Consumer:null},G.Provider=G,G.Consumer={$$typeof:r,_context:G},G},Ge.createElement=function(G,j,te){var pe,_e={},Me=null;if(j!=null)for(pe in j.key!==void 0&&(Me=""+j.key),j)V.call(j,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(_e[pe]=j[pe]);var De=arguments.length-2;if(De===1)_e.children=te;else if(1<De){for(var nt=Array(De),ct=0;ct<De;ct++)nt[ct]=arguments[ct+2];_e.children=nt}if(G&&G.defaultProps)for(pe in De=G.defaultProps,De)_e[pe]===void 0&&(_e[pe]=De[pe]);return $(G,Me,_e)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(G){return{$$typeof:u,render:G}},Ge.isValidElement=le,Ge.lazy=function(G){return{$$typeof:p,_payload:{_status:-1,_result:G},_init:fe}},Ge.memo=function(G,j){return{$$typeof:d,type:G,compare:j===void 0?null:j}},Ge.startTransition=function(G){var j=R.T,te={};R.T=te;try{var pe=G(),_e=R.S;
vendor: 13,225 bytes, lines 17-41
17_e!==null&&_e(te,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(U,Be)}catch(Me){Be(Me)}finally{j!==null&&te.types!==null&&(j.types=te.types),R.T=j}},Ge.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Ge.use=function(G){return R.H.use(G)},Ge.useActionState=function(G,j,te){return R.H.useActionState(G,j,te)},Ge.useCallback=function(G,j){return R.H.useCallback(G,j)},Ge.useContext=function(G){return R.H.useContext(G)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(G,j){return R.H.useDeferredValue(G,j)},Ge.useEffect=function(G,j){return R.H.useEffect(G,j)},Ge.useEffectEvent=function(G){return R.H.useEffectEvent(G)},Ge.useId=function(){return R.H.useId()},Ge.useImperativeHandle=function(G,j,te){return R.H.useImperativeHandle(G,j,te)},Ge.useInsertionEffect=function(G,j){return R.H.useInsertionEffect(G,j)},Ge.useLayoutEffect=function(G,j){return R.H.useLayoutEffect(G,j)},Ge.useMemo=function(G,j){return R.H.useMemo(G,j)},Ge.useOptimistic=function(G,j){return R.H.useOptimistic(G,j)},Ge.useReducer=function(G,j,te){return R.H.useReducer(G,j,te)},Ge.useRef=function(G){return R.H.useRef(G)},Ge.useState=function(G){return R.H.useState(G)},Ge.useSyncExternalStore=function(G,j,te){return R.H.useSyncExternalStore(G,j,te)},Ge.useTransition=function(){return R.H.useTransition()},Ge.version="19.2.0",Ge}var eN;function G_(){return eN||(eN=1,Gx.exports=RF()),Gx.exports}var je=G_();const mR=pR(je);var Ix={exports:{}},Bh={},kx={exports:{}},Hx={};/** 18 * @license React 19 * scheduler.production.js 20 * 21 * Copyright (c) Meta Platforms, Inc. and affiliates. 22 * 23 * This source code is licensed under the MIT license found in the 24 * LICENSE file in the root directory of this source tree. 25 */var tN;function EF(){return tN||(tN=1,(function(o){function e(X,ne){var fe=X.length;X.push(ne);e:for(;0<fe;){var Be=fe-1>>>1,Ce=X[Be];if(0<i(Ce,ne))X[Be]=ne,X[fe]=Ce,fe=Be;else break e}}function t(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var ne=X[0],fe=X.pop();if(fe!==ne){X[0]=fe;e:for(var Be=0,Ce=X.length,G=Ce>>>1;Be<G;){var j=2*(Be+1)-1,te=X[j],pe=j+1,_e=X[pe];if(0>i(te,fe))pe<Ce&&0>i(_e,te)?(X[Be]=_e,X[pe]=fe,Be=pe):(X[Be]=te,X[j]=fe,Be=j);else if(pe<Ce&&0>i(_e,fe))X[Be]=_e,X[pe]=fe,Be=pe;else break e}}return ne}function i(X,ne){var fe=X.sortIndex-ne.sortIndex;return fe!==0?fe:X.id-ne.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;o.unstable_now=function(){return r.now()}}else{var l=Date,u=l.now();o.unstable_now=function(){return l.now()-u}}var h=[],d=[],p=1,m=null,y=3,b=!1,_=!1,v=!1,M=!1,A=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function F(X){for(var ne=t(d);ne!==null;){if(ne.callback===null)s(d);else if(ne.startTime<=X)s(d),ne.sortIndex=ne.expirationTime,e(h,ne);else break;ne=t(d)}}function L(X){if(v=!1,F(X),!_)if(t(h)!==null)_=!0,U||(U=!0,ye());else{var ne=t(d);ne!==null&&ce(L,ne.startTime-X)}}var U=!1,R=-1,V=5,$=-1;function ie(){return M?!0:!(o.unstable_now()-$<V)}function le(){if(M=!1,U){var X=o.unstable_now();$=X;var ne=!0;try{e:{_=!1,v&&(v=!1,C(R),R=-1),b=!0;var fe=y;try{t:{for(F(X),m=t(h);m!==null&&!(m.expirationTime>X&&ie());){var Be=m.callback;if(typeof Be=="function"){m.callback=null,y=m.priorityLevel;var Ce=Be(m.expirationTime<=X);if(X=o.unstable_now(),typeof Ce=="function"){m.callback=Ce,F(X),ne=!0;break t}m===t(h)&&s(h),F(X)}else s(h);m=t(h)}if(m!==null)ne=!0;else{var G=t(d);G!==null&&ce(L,G.startTime-X),ne=!1}}break e}finally{m=null,y=fe,b=!1}ne=void 0}}finally{ne?ye():U=!1}}}var ye;if(typeof E=="function")ye=function(){E(le)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,Ne=xe.port2;xe.port1.onmessage=le,ye=function(){Ne.postMessage(null)}}else ye=function(){A(le,0)};function ce(X,ne){R=A(function(){X(o.unstable_now())},ne)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(X){X.callback=null},o.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<X?Math.floor(1e3/X):5},o.unstable_getCurrentPriorityLevel=function(){return y},o.unstable_next=function(X){switch(y){case 1:case 2:case 3:var ne=3;break;default:ne=y}var fe=y;y=ne;try{return X()}finally{y=fe}},o.unstable_requestPaint=function(){M=!0},o.unstable_runWithPriority=function(X,ne){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var fe=y;y=X;try{return ne()}finally{y=fe}},o.unstable_scheduleCallback=function(X,ne,fe){var Be=o.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?Be+fe:Be):fe=Be,X){case 1:var Ce=-1;break;case 2:Ce=250;break;case 5:Ce=1073741823;break;case 4:Ce=1e4;break;default:Ce=5e3}return Ce=fe+Ce,X={id:p++,callback:ne,priorityLevel:X,startTime:fe,expirationTime:Ce,sortIndex:-1},fe>Be?(X.sortIndex=fe,e(d,X),t(h)===null&&X===t(d)&&(v?(C(R),R=-1):v=!0,ce(L,fe-Be))):(X.sortIndex=Ce,e(h,X),_||b||(_=!0,U||(U=!0,ye()))),X},o.unstable_shouldYield=ie,o.unstable_wrapCallback=function(X){var ne=y;return function(){var fe=y;y=ne;try{return X.apply(this,arguments)}finally{y=fe}}}})(Hx)),Hx}var sN;function CF(){return sN||(sN=1,kx.exports=EF()),kx.exports}var qx={exports:{}},Ls={};/** 26 * @license React 27 * react-dom.production.js 28 * 29 * Copyright (c) Meta Platforms, Inc. and affiliates. 30 * 31 * This source code is licensed under the MIT license found in the 32 * LICENSE file in the root directory of this source tree. 33 */var iN;function BF(){if(iN)return Ls;iN=1;var o=G_();function e(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var s={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},i=Symbol.for("react.portal");function r(h,d,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:h,containerInfo:d,implementation:p}}var l=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ls.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Ls.createPortal=function(h,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return r(h,d,null,p)},Ls.flushSync=function(h){var d=l.T,p=s.p;try{if(l.T=null,s.p=2,h)return h()}finally{l.T=d,s.p=p,s.d.f()}},Ls.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,s.d.C(h,d))},Ls.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Ls.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var p=d.as,m=u(p,d.crossOrigin),y=typeof d.integrity=="string"?d.integrity:void 0,b=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?s.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):p==="script"&&s.d.X(h,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ls.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=u(d.as,d.crossOrigin);s.d.M(h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&s.d.M(h)},Ls.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,m=u(p,d.crossOrigin);s.d.L(h,p,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Ls.preloadModule=function(h,d){if(typeof h=="string")if(d){var p=u(d.as,d.crossOrigin);s.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(h)},Ls.requestFormReset=function(h){s.d.r(h)},Ls.unstable_batchedUpdates=function(h,d){return h(d)},Ls.useFormState=function(h,d,p){return l.H.useFormState(h,d,p)},Ls.useFormStatus=function(){return l.H.useHostTransitionStatus()},Ls.version="19.2.0",Ls}var nN;function DF(){if(nN)return qx.exports;nN=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),qx.exports=BF(),qx.exports}/** 34 * @license React 35 * react-dom-client.production.js 36 * 37 * Copyright (c) Meta Platforms, Inc. and affiliates. 38 * 39 * This source code is licensed under the MIT license found in the 40 * LICENSE file in the root directory of this source tree. 41 */var rN;function UF(){if(rN)return Bh;rN=1;var o=CF(),e=G_(),t=DF();function s(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function r(n){var a=n,c=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(c=a.return),n=a.return;while(n)}return a.tag===3?c:null}function l(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function u(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function h(n){if(r(n)!==n)throw Error(s(188))}function d(n){var a=n.alternate;if(!a){if(a=r(n),a===null)throw Error(s(188));return a!==n?null:n}for(var c=n,f=a;;){var g=c.return;if(g===null)break;var x=g.alternate;if(x===null){if(f=g.return,f!==null){c=f;continue}break}if(g.child===x.child){for(x=g.child;x;){if(x===c)return h(g),n;if(x===f)return h(g),a;x=x.sibling}throw Error(s(188))}if(c.return!==f.return)c=g,f=x;else{for(var S=!1,N=g.child;N;){if(N===c){S=!0,c=g,f=x;break}if(N===f){S=!0,f=g,c=x;break}N=N.sibling}if(!S){for(N=x.child;N;){if(N===c){S=!0,c=x,f=g;break}if(N===f){S=!0,f=x,c=g;break}N=N.sibling}if(!S)throw Error(s(189))}}if(c.alternate!==f)throw Error(s(190))}if(c.tag!==3)throw Error(s(188));return c.stateNode.current===c?n:a}function p(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=p(n),a!==null)return a;n=n.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function ye(n){return n===null||typeof n!="object"?null:(n=le&&n[le]||n["@@iterator"],typeof n=="function"?n:null)}var xe=Symbol.for("react.client.reference");function Ne(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===xe?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case v:return"Fragment";case A:return"Profiler";case M:return"StrictMode";case L:return"Suspense";case U:return"SuspenseList";case $:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case _:return"Portal";case E:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case F:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case R:return a=n.displayName||null,a!==null?a:Ne(n.type)||"Memo";case V:a=n._payload,n=n._init;try{return Ne(n(a))}catch{}}return null}var ce=Array.isArray,X=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},Be=[],Ce=-1;function G(n){return{current:n}}function j(n){0>Ce||(n.current=Be[Ce],Be[Ce]=null,Ce--)}function te(n,a){Ce++,Be[Ce]=n.current,n.current=a}
vendor: 7,108 bytes, lines 41-48
41var pe=G(null),_e=G(null),Me=G(null),De=G(null);function nt(n,a){switch(te(Me,a),te(_e,n),te(pe,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?_A(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=_A(a),n=TA(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}j(pe),te(pe,n)}function ct(){j(pe),j(_e),j(Me)}function Ys(n){n.memoizedState!==null&&te(De,n);var a=pe.current,c=TA(a,n.type);a!==c&&(te(_e,n),te(pe,c))}function Rn(n){_e.current===n&&(j(pe),j(_e)),De.current===n&&(j(De),Nh._currentValue=fe)}var Fl,qd;function _i(n){if(Fl===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Fl=a&&a[1]||"",qd=-1<c.stack.indexOf(` 42 at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return` 43`+Fl+n+qd}var Fc=!1;function Xn(n,a){if(!n||Fc)return"";Fc=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(J){var Q=J}Reflect.construct(n,[],oe)}else{try{oe.call()}catch(J){Q=J}n.call(oe.prototype)}}else{try{throw Error()}catch(J){Q=J}(oe=n())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(J){if(J&&Q&&typeof J.stack=="string")return[J.stack,Q.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),S=x[0],N=x[1];if(S&&N){var P=S.split(` 44`),Z=N.split(` 45`);for(g=f=0;f<P.length&&!P[f].includes("DetermineComponentFrameRoot");)f++;for(;g<Z.length&&!Z[g].includes("DetermineComponentFrameRoot");)g++;if(f===P.length||g===Z.length)for(f=P.length-1,g=Z.length-1;1<=f&&0<=g&&P[f]!==Z[g];)g--;for(;1<=f&&0<=g;f--,g--)if(P[f]!==Z[g]){if(f!==1||g!==1)do if(f--,g--,0>g||P[f]!==Z[g]){var se=` 46`+P[f].replace(" at new "," at ");return n.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",n.displayName)),se}while(1<=f&&0<=g);break}}}finally{Fc=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?_i(c):""}function $d(n,a){switch(n.tag){case 26:case 27:case 5:return _i(n.type);case 16:return _i("Lazy");case 13:return n.child!==a&&a!==null?_i("Suspense Fallback"):_i("Suspense");case 19:return _i("SuspenseList");case 0:case 15:return Xn(n.type,!1);case 11:return Xn(n.type.render,!1);case 1:return Xn(n.type,!0);case 31:return _i("Activity");default:return""}}function Wd(n){try{var a="",c=null;do a+=$d(n,c),c=n,n=n.return;while(n);return a}catch(f){return` 47Error generating stack: `+f.message+` 48`+f.stack}}var Lc=Object.prototype.hasOwnProperty,Oc=o.unstable_scheduleCallback,zc=o.unstable_cancelCallback,Ay=o.unstable_shouldYield,Ny=o.unstable_requestPaint,Ti=o.unstable_now,aD=o.unstable_getCurrentPriorityLevel,Kv=o.unstable_ImmediatePriority,Jv=o.unstable_UserBlockingPriority,Xd=o.unstable_NormalPriority,oD=o.unstable_LowPriority,eS=o.unstable_IdlePriority,lD=o.log,uD=o.unstable_setDisableYieldValue,Pc=null,vi=null;function _a(n){if(typeof lD=="function"&&uD(n),vi&&typeof vi.setStrictMode=="function")try{vi.setStrictMode(Pc,n)}catch{}}var Si=Math.clz32?Math.clz32:dD,cD=Math.log,hD=Math.LN2;function dD(n){return n>>>=0,n===0?32:31-(cD(n)/hD|0)|0}var jd=256,Yd=262144,Zd=4194304;function Co(n){var a=n&42;if(a!==0)return a;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Qd(n,a,c){var f=n.pendingLanes;if(f===0)return 0;var g=0,x=n.suspendedLanes,S=n.pingedLanes;n=n.warmLanes;var N=f&134217727;return N!==0?(f=N&~x,f!==0?g=Co(f):(S&=N,S!==0?g=Co(S):c||(c=N&~n,c!==0&&(g=Co(c))))):(N=f&~x,N!==0?g=Co(N):S!==0?g=Co(S):c||(c=f&~n,c!==0&&(g=Co(c)))),g===0?0:a!==0&&a!==g&&(a&x)===0&&(x=g&-g,c=a&-a,x>=c||x===32&&(c&4194048)!==0)?a:g}function Vc(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function fD(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tS(){var n=Zd;return Zd<<=1,(Zd&62914560)===0&&(Zd=4194304),n}function wy(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Gc(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function pD(n,a,c,f,g,x){var S=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var N=n.entanglements,P=n.expirationTimes,Z=n.hiddenUpdates;for(c=S&~c;0<c;){var se=31-Si(c),oe=1<<se;N[se]=0,P[se]=-1;var Q=Z[se];if(Q!==null)for(Z[se]=null,se=0;se<Q.length;se++){var J=Q[se];J!==null&&(J.lane&=-536870913)}c&=~oe}f!==0&&sS(n,f,0),x!==0&&g===0&&n.tag!==0&&(n.suspendedLanes|=x&~(S&~a))}function sS(n,a,c){n.pendingLanes|=a,n.suspendedLanes&=~a;var f=31-Si(a);n.entangledLanes|=a,n.entanglements[f]=n.entanglements[f]|1073741824|c&261930}function iS(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var f=31-Si(c),g=1<<f;g&a|n[f]&a&&(n[f]|=a),c&=~g}}function nS(n,a){var c=a&-a;return c=(c&42)!==0?1:Ry(c),(c&(n.suspendedLanes|a))!==0?0:c}function Ry(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Ey(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function rS(){var n=ne.p;return n!==0?n:(n=window.event,n===void 0?32:qA(n.type))}function aS(n,a){var c=ne.p;try{return ne.p=n,a()}finally{ne.p=c}}var Ta=Math.random().toString(36).slice(2),Ms="__reactFiber$"+Ta,oi="__reactProps$"+Ta,Ll="__reactContainer$"+Ta,Cy="__reactEvents$"+Ta,mD="__reactListeners$"+Ta,gD="__reactHandles$"+Ta,oS="__reactResources$"+Ta,Ic="__reactMarker$"+Ta;function By(n){delete n[Ms],delete n[oi],delete n[Cy],delete n[mD],delete n[gD]}function Ol(n){var a=n[Ms];if(a)return a;for(var c=n.parentNode;c;
vendor: 7,484 bytes, line 48
48){if(a=c[Ll]||c[Ms]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(n=RA(n);n!==null;){if(c=n[Ms])return c;n=RA(n)}return a}n=c,c=n.parentNode}return null}function zl(n){if(n=n[Ms]||n[Ll]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function kc(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(s(33))}function Pl(n){var a=n[oS];return a||(a=n[oS]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function gs(n){n[Ic]=!0}var lS=new Set,uS={};function Bo(n,a){Vl(n,a),Vl(n+"Capture",a)}function Vl(n,a){for(uS[n]=a,n=0;n<a.length;n++)lS.add(a[n])}var yD=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),cS={},hS={};function xD(n){return Lc.call(hS,n)?!0:Lc.call(cS,n)?!1:yD.test(n)?hS[n]=!0:(cS[n]=!0,!1)}function Kd(n,a,c){if(xD(a))if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+c)}}function Jd(n,a,c){if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+c)}}function wr(n,a,c,f){if(f===null)n.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(a,c,""+f)}}function Ki(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function dS(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function bD(n,a,c){var f=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var g=f.get,x=f.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return g.call(this)},set:function(S){c=""+S,x.call(this,S)}}),Object.defineProperty(n,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function Dy(n){if(!n._valueTracker){var a=dS(n)?"checked":"value";n._valueTracker=bD(n,a,""+n[a])}}function fS(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return n&&(f=dS(n)?n.checked?"true":"false":n.value),n=f,n!==c?(a.setValue(n),!0):!1}function ef(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var _D=/[\n"\\]/g;function Ji(n){return n.replace(_D,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Uy(n,a,c,f,g,x,S,N){n.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?n.type=S:n.removeAttribute("type"),a!=null?S==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Ki(a)):n.value!==""+Ki(a)&&(n.value=""+Ki(a)):S!=="submit"&&S!=="reset"||n.removeAttribute("value"),a!=null?Fy(n,S,Ki(a)):c!=null?Fy(n,S,Ki(c)):f!=null&&n.removeAttribute("value"),g==null&&x!=null&&(n.defaultChecked=!!x),g!=null&&(n.checked=g&&typeof g!="function"&&typeof g!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?n.name=""+Ki(N):n.removeAttribute("name")}function pS(n,a,c,f,g,x,S,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.type=x),a!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Dy(n);return}c=c!=null?""+Ki(c):"",a=a!=null?""+Ki(a):c,N||a===n.value||(n.value=a),n.defaultValue=a}f=f??g,f=typeof f!="function"&&typeof f!="symbol"&&!!f,n.checked=N?n.checked:!!f,n.defaultChecked=!!f,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(n.name=S),Dy(n)}function Fy(n,a,c){a==="number"&&ef(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function Gl(n,a,c,f){if(n=n.options,a){a={};for(var g=0;g<c.length;g++)a["$"+c[g]]=!0;for(c=0;c<n.length;c++)g=a.hasOwnProperty("$"+n[c].value),n[c].selected!==g&&(n[c].selected=g),g&&f&&(n[c].defaultSelected=!0)}else{for(c=""+Ki(c),a=null,g=0;g<n.length;g++){if(n[g].value===c){n[g].selected=!0,f&&(n[g].defaultSelected=!0);return}a!==null||n[g].disabled||(a=n[g])}a!==null&&(a.selected=!0)}}function mS(n,a,c){if(a!=null&&(a=""+Ki(a),a!==n.value&&(n.value=a),c==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=c!=null?""+Ki(c):""}function gS(n,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(s(92));if(ce(f)){if(1<f.length)throw Error(s(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=Ki(a),n.defaultValue=c,f=n.textContent,f===c&&f!==""&&f!==null&&(n.value=f),Dy(n)}function Il(n,a){if(a){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=a;return}}n.textContent=a}var TD=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function yS(n,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":f?n.setProperty(a,c):typeof c!="number"||c===0||TD.has(a)?a==="float"?n.cssFloat=c:n[a]=(""+c).trim():n[a]=c+"px"}function xS(n,a,c){if(a!=null&&typeof a!="object")throw Error(s(62));if(n=n.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?n.setProperty(f,""):f==="float"?n.cssFloat="":n[f]="");for(var g in a)f=a[g],a.hasOwnProperty(g)&&c[g]!==f&&yS(n,g,f)}else for(var x in a)a.hasOwnProperty(x)&&yS(n,x,a[x])}function Ly(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vD=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
48dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),SD=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function tf(n){return SD.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Rr(){}var Oy=null;function zy(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var kl=null,Hl=null;function bS(n){var a=zl(n);if(a&&(n=a.stateNode)){var c=n[oi]||null;e:switch(n=a.stateNode,a.type){case"input":if(Uy(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Ji(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==n&&f.form===n.form){var g=f[oi]||null;if(!g)throw Error(s(90));Uy(f,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===n.form&&fS(f)}break e;case"textarea":mS(n,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Gl(n,!!c.multiple,a,!1)}}}var Py=!1;function _S(n,a,c){if(Py)return n(a,c);Py=!0;try{var f=n(a);return f}finally{if(Py=!1,(kl!==null||Hl!==null)&&(Hf(),kl&&(a=kl,n=Hl,Hl=kl=null,bS(a),n)))for(a=0;a<n.length;a++)bS(n[a])}}function Hc(n,a){var c=n.stateNode;if(c===null)return null;var f=c[oi]||null;if(f===null)return null;c=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(n=n.type,f=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!f;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(s(231,a,typeof c));return c}var Er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vy=!1;if(Er)try{var qc={};Object.defineProperty(qc,"passive",{get:function(){Vy=!0}}),window.addEventListener("test",qc,qc),window.removeEventListener("test",qc,qc)}catch{Vy=!1}
vendor: 3,180 bytes, line 48
48var va=null,Gy=null,sf=null;function TS(){if(sf)return sf;var n,a=Gy,c=a.length,f,g="value"in va?va.value:va.textContent,x=g.length;for(n=0;n<c&&a[n]===g[n];n++);var S=c-n;for(f=1;f<=S&&a[c-f]===g[x-f];f++);return sf=g.slice(n,1<f?1-f:void 0)}function nf(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function rf(){return!0}function vS(){return!1}function li(n){function a(c,f,g,x,S){this._reactName=c,this._targetInst=g,this.type=f,this.nativeEvent=x,this.target=S,this.currentTarget=null;for(var N in n)n.hasOwnProperty(N)&&(c=n[N],this[N]=c?c(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?rf:vS,this.isPropagationStopped=vS,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=rf)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=rf)},persist:function(){},isPersistent:rf}),a}var Do={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},af=li(Do),$c=m({},Do,{view:0,detail:0}),MD=li($c),Iy,ky,Wc,of=m({},$c,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qy,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Wc&&(Wc&&n.type==="mousemove"?(Iy=n.screenX-Wc.screenX,ky=n.screenY-Wc.screenY):ky=Iy=0,Wc=n),Iy)},movementY:function(n){return"movementY"in n?n.movementY:ky}}),SS=li(of),AD=m({},of,{dataTransfer:0}),ND=li(AD),wD=m({},$c,{relatedTarget:0}),Hy=li(wD),RD=m({},Do,{animationName:0,elapsedTime:0,pseudoElement:0}),ED=li(RD),CD=m({},Do,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),BD=li(CD),DD=m({},Do,{data:0}),MS=li(DD),UD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},FD={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},LD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function OD(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=LD[n])?!!a[n]:!1}function qy(){return OD}var zD=m({},$c,{key:function(n){if(n.key){var a=UD[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=nf(n),n===13?"Enter":String.fromCharCode(n)):n.type==="
48keydown"||n.type==="keyup"?FD[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qy,charCode:function(n){return n.type==="keypress"?nf(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?nf(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),PD=li(zD),VD=m({},of,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),AS=li(VD),GD=m({},$c,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qy}),ID=li(GD),kD=m({},Do,{propertyName:0,elapsedTime:0,pseudoElement:0}),HD=li(kD),qD=m({},of,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),$D=li(qD),WD=m({},Do,{newState:0,oldState:0}),XD=li(WD),jD=[9,13,27,32],$y=Er&&"CompositionEvent"in window,Xc=null;Er&&"documentMode"in document&&(Xc=document.documentMode);var YD=Er&&"TextEvent"in window&&!Xc,NS=Er&&(!$y||Xc&&8<Xc&&11>=Xc),wS=" ",RS=!1;function ES(n,a){switch(n){case"keyup":return jD.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function CS(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ql=!1;function ZD(n,a){switch(n){case"compositionend":return CS(a);case"keypress":return a.which!==32?null:(RS=!0,wS);case"textInput":return n=a.data,n===wS&&RS?null:n;default:return null}}function QD(n,a){if(ql)return n==="compositionend"||!$y&&ES(n,a)?(n=TS(),sf=Gy=va=null,ql=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return NS&&a.locale!=="ko"?null:a.data;default:return null}}var KD={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function BS(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!KD[n.type]:a==="textarea"}function DS(n,a,c,f){kl?Hl?Hl.push(f):Hl=[f]:kl=f,a=Zf(a,"onChange"),0<a.length&&(c=new af("onChange","change",null,c,f),n.push({event:c,listeners:a}))}var jc=null,Yc=null;function JD(n){pA(n,0)}function lf(n){var a=kc(n);if(fS(a))return n}function US(n,a){if(n==="change")return a}var FS=!1;if(Er){var Wy;if(Er){var Xy="oninput"in document;if(!Xy){var LS=document.createElement("div");LS.setAttribute("oninput","return;"),Xy=typeof LS.oninput=="function"}Wy=Xy}else Wy=!1;FS=Wy&&(!document.documentMode||9<document.documentMode)}function OS(){jc&&(jc.detachEvent("onpropertychange",zS),Yc=jc=null)}function zS(n){if(n.propertyName==="value"&&lf(Yc)){var a=[];DS(a,Yc,n,zy(n)),_S(JD,a)}}function eU(n,a,c){n==="focusin"?(OS(),jc=a,Yc=c,jc.attachEvent("onpropertychange",zS)):n==="focusout"&&OS()}function tU(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return lf(Yc)}function sU(n,a){if(n==="click")return lf(a)}function iU(n,a){if(n==="input"||n==="change")return lf(a)}function nU(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Mi=typeof Object.is=="function"?Object.is:nU;function Zc(n,a){if(Mi(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var g=c[f];if(!Lc.call(a,g)||!Mi(n[g],a[g]))return!1}return!0}function PS(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function VS(n,a){var c=PS(n);n=0;for(var f;c;){if(c.nodeType===3){if(f=n+c.textContent.length,n<=a&&f>=a)return{node:c,offset:a-n};n=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=PS(c)}}function GS(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?GS(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function IS(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=ef(n.document);a instanceof n.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)n=a.contentWindow;else break;a=ef(n.document)}return a}function jy(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var rU=Er&&"documentMode"in document&&11>=document.documentMode,$l=null,Yy=null,Qc=null,Zy=!1;function kS(n,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;
vendor: 22,550 bytes, line 48
48Zy||$l==null||$l!==ef(f)||(f=$l,"selectionStart"in f&&jy(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Qc&&Zc(Qc,f)||(Qc=f,f=Zf(Yy,"onSelect"),0<f.length&&(a=new af("onSelect","select",null,a,c),n.push({event:a,listeners:f}),a.target=$l)))}function Uo(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var Wl={animationend:Uo("Animation","AnimationEnd"),animationiteration:Uo("Animation","AnimationIteration"),animationstart:Uo("Animation","AnimationStart"),transitionrun:Uo("Transition","TransitionRun"),transitionstart:Uo("Transition","TransitionStart"),transitioncancel:Uo("Transition","TransitionCancel"),transitionend:Uo("Transition","TransitionEnd")},Qy={},HS={};Er&&(HS=document.createElement("div").style,"AnimationEvent"in window||(delete Wl.animationend.animation,delete Wl.animationiteration.animation,delete Wl.animationstart.animation),"TransitionEvent"in window||delete Wl.transitionend.transition);function Fo(n){if(Qy[n])return Qy[n];if(!Wl[n])return n;var a=Wl[n],c;for(c in a)if(a.hasOwnProperty(c)&&c in HS)return Qy[n]=a[c];return n}var qS=Fo("animationend"),$S=Fo("animationiteration"),WS=Fo("animationstart"),aU=Fo("transitionrun"),oU=Fo("transitionstart"),lU=Fo("transitioncancel"),XS=Fo("transitionend"),jS=new Map,Ky="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ky.push("scrollEnd");function En(n,a){jS.set(n,a),Bo(a,[n])}var uf=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},en=[],Xl=0,Jy=0;function cf(){for(var n=Xl,a=Jy=Xl=0;a<n;){var c=en[a];en[a++]=null;var f=en[a];en[a++]=null;var g=en[a];en[a++]=null;var x=en[a];if(en[a++]=null,f!==null&&g!==null){var S=f.pending;S===null?g.next=g:(g.next=S.next,S.next=g),f.pending=g}x!==0&&YS(c,g,x)}}function hf(n,a,c,f){en[Xl++]=n,en[Xl++]=a,en[Xl++]=c,en[Xl++]=f,Jy|=f,n.lanes|=f,n=n.alternate,n!==null&&(n.lanes|=f)}function e0(n,a,c,f){return hf(n,a,c,f),df(n)}function Lo(n,a){return hf(n,null,null,a),df(n)}function YS(n,a,c){n.lanes|=c;var f=n.alternate;f!==null&&(f.lanes|=c);for(var g=!1,x=n.return;x!==null;)x.childLanes|=c,f=x.alternate,f!==null&&(f.childLanes|=c),x.tag===22&&(n=x.stateNode,n===null||n._visibility&1||(g=!0)),n=x,x=x.return;return n.tag===3?(x=n.stateNode,g&&a!==null&&(g=31-Si(c),n=x.hiddenUpdates,f=n[g],f===null?n[g]=[a]:f.push(a),a.lane=c|536870912),x):null}function df(n){if(50<bh)throw bh=0,ux=null,Error(s(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var jl={};function uU(n,a,c,f){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ai(n,a,c,f){return new uU(n,a,c,f)}function t0(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Cr(n,a){var c=n.alternate;return c===null?(c=Ai(n.tag,a,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=a,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,a=n.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function ZS(n,a){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,a=c.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function ff(n,a,c,f,g,x){var S=0;if(f=n,typeof n=="function")t0(n)&&(S=1);else if(typeof n=="string")S=pF(n,c,pe.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case $:return n=Ai(31,c,a,g),n.elementType=$,n.lanes=x,n;case v:return Oo(c.children,g,x,a);case M:S=8,g|=24;break;case A:return n=Ai(12,c,a,g|2),n.elementType=A,n.lanes=x,n;case L:return n=Ai(13,c,a,g),n.elementType=L,n.lanes=x,n;case U:return n=Ai(19,c,a,g),n.elementType=U,n.lanes=x,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case E:S=10;break e;case C:S=9;break e;case F:S=11;break e;case R:S=14;break e;case V:S=16,f=null;break e}S=29,c=Error(s(130,n===null?"null":typeof n,"")),f=null}return a=Ai(S,c,a,g),a.elementType=n,a.type=f,a.lanes=x,a}function Oo(n,a,c,f){return n=Ai(7,n,f,a),n.lanes=c,n}function s0(n,a,c){return n=Ai(6,n,null,a),n.lanes=c,n}function QS(n){var a=Ai(18,null,null,0);return a.stateNode=n,a}function i0(n,a,c){return a=Ai(4,n.children!==null?n.children:[],n.key,a),a.lanes=c,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var KS=new WeakMap;function tn(n,a){if(typeof n=="object"&&n!==null){var c=KS.get(n);return c!==void 0?c:(a={value:n,source:a,stack:Wd(a)},KS.set(n,a),a)}return{value:n,source:a,stack:Wd(a)}}var Yl=[],Zl=0,pf=null,Kc=0,sn=[],nn=0,Sa=null,jn=1,Yn="";function Br(n,a){Yl[Zl++]=Kc,Yl[Zl++]=pf,pf=n,Kc=a}function JS(n,a,c){sn[nn++]=jn,sn[nn++]=Yn,sn[nn++]=Sa,Sa=n;var f=jn;n=Yn;var g=32-Si(f)-1;f&=~(1<<g),c+=1;var x=32-Si(a)+g;if(30<x){var S=g-g%5;x=(f&(1<<S)-1).toString(32),f>>=S,g-=S,jn=1<<32-Si(a)+g|c<<g|f,Yn=x+n}else jn=1<<x|c<<g|f,Yn=n}function n0(n){n.return!==null&&(Br(n,1),JS(n,1,0))}function r0(n){for(;n===pf;)pf=Yl[--Zl],Yl[Zl]=null,Kc=Yl[--Zl],Yl[Zl]=null;for(;n===Sa;)Sa=sn[--nn],sn[nn]=null,Yn=sn[--nn],sn[nn]=null,jn=sn[--nn],sn[nn]=null}function e1(n,a){sn[nn++]=jn,sn[nn++]=Yn,sn[nn++]=Sa,jn=a.id,Yn=a.overflow,Sa=n}var As=null,Ft=null,ot=!1,Ma=null,rn=!1,a0=Error(s(519));function Aa(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jc(tn(a,n)),a0}function t1(n){var a=n.stateNode,c=n.type,f=n.memoizedProps;switch(a[Ms]=n,a[oi]=f,c){case"dialog":et("cancel",a),et("close",a);break;case"iframe":case"object":case"embed":et("load",a);break;case"video":case"audio":for(c=0;c<Th.length;c++)et(Th[c],a);break;case"source":et("error",a);break;case"img":case"image":case"link":et("error",a),et("load",a);break;case"details":et("toggle",a);break;case"input":et("invalid",a),pS(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":et("invalid",a);break;case"textarea":et("invalid",a),gS(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||xA(a.textContent,c)?(f.popover!=null&&(et("beforetoggle",a),et("toggle",a)),f.onScroll!=null&&et("scroll",a),f.onScrollEnd!=null&&et("scrollend",a),f.onClick!=null&&(a.onclick=Rr),a=!0):a=!1,a||Aa(n,!0)}function s1(n){for(As=n.return;As;)switch(As.tag){case 5:case 31:case 13:rn=!1;return;case 27:case 3:rn=!0;return;default:As=As.return}}function Ql(n){if(n!==As)return!1;if(!ot)return s1(n),ot=!0,!1;var a=n.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||Mx(n.type,n.memoizedProps)),c=!c),c&&Ft&&Aa(n),s1(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ft=wA(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ft=wA(n)}else a===27?(a=Ft,Va(n.type)?(n=Ex,Ex=null,Ft=n):Ft=a):Ft=As?on(n.stateNode.nextSibling):null;return!0}function zo(){Ft=As=null,ot=!1}function o0(){var n=Ma;return n!==null&&(di===null?di=n:di.push.apply(di,n),Ma=null),n}function Jc(n){Ma===null?Ma=[n]:Ma.push(n)}var l0=G(null),Po=null,Dr=null;function Na(n,a,c){te(l0,a._currentValue),a._currentValue=c}function Ur(n){n._currentValue=l0.current,j(l0)}function u0(n,a,c){for(;n!==null;){var f=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),n===c)break;n=n.return}}function c0(n,a,c,f){var g=n.child;for(g!==null&&(g.return=n);g!==null;){var x=g.dependencies;if(x!==null){var S=g.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=g;for(var P=0;P<a.length;P++)if(N.context===a[P]){x.lanes|=c,N=x.alternate,N!==null&&(N.lanes|=c),u0(x.return,c,n),f||(S=null);break e}x=N.next}}else if(g.tag===18){if(S=g.return,S===null)throw Error(s(341));S.lanes|=c,x=S.alternate,x!==null&&(x.lanes|=c),u0(S,c,n),S=null}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===n){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}}function Kl(n,a,c,f){n=null;for(var g=a,x=!1;g!==null;){if(!x){if((g.flags&524288)!==0)x=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var S=g.alternate;if(S===null)throw Error(s(387));if(S=S.memoizedProps,S!==null){var N=g.type;Mi(g.pendingProps.value,S.value)||(n!==null?n.push(N):n=[N])}}else if(g===De.current){if(S=g.alternate,S===null)throw Error(s(387));S.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(n!==null?n.push(Nh):n=[Nh])}g=g.return}n!==null&&c0(a,n,c,f),a.flags|=262144}function mf(n){for(n=n.firstContext;n!==null;){if(!Mi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Vo(n){Po=n,Dr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Ns(n){return i1(Po,n)}function gf(n,a){return Po===null&&Vo(n),i1(n,a)}function i1(n,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Dr===null){if(n===null)throw Error(s(308));Dr=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Dr=Dr.next=a;return c}var cU=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(c,f){n.push(f)}};this.abort=function(){a.aborted=!0,n.forEach(function(c){return c()})}},hU=o.unstable_scheduleCallback,dU=o.unstable_NormalPriority,is={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function h0(){return{controller:new cU,data:new Map,refCount:0}}function eh(n){n.refCount--,n.refCount===0&&hU(dU,function(){n.controller.abort()})}var th=null,d0=0,Jl=0,eu=null;function fU(n,a){if(th===null){var c=th=[];d0=0,Jl=mx(),eu={status:"pending",value:void 0,then:function(f){c.push(f)}}}return d0++,a.then(n1,n1),a}function n1(){if(--d0===0&&th!==null){eu!==null&&(eu.status="fulfilled");var n=th;th=null,Jl=0,eu=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function pU(n,a){var c=[],f={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return n.then(function(){f.status="fulfilled",f.value=a;for(var g=0;g<c.length;g++)(0,c[g])(a)},function(g){for(f.status="rejected",f.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),f}var r1=X.S;X.S=function(n,a){kM=Ti(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&fU(n,a),r1!==null&&r1(n,a)};var Go=G(null);function f0(){var n=Go.current;return n!==null?n:Rt.pooledCache}function yf(n,a){a===null?te(Go,Go.current):te(Go,a.pool)}function a1(){var n=f0();return n===null?null:{parent:is._currentValue,pool:n}}var tu=Error(s(460)),p0=Error(s(474)),xf=Error(s(542)),bf={then:function(){}};function o1(n){return n=n.status,n==="fulfilled"||n==="rejected"}function l1(n,a,c){switch(c=n[c],c===void 0?n.push(a):c!==a&&(a.then(Rr,Rr),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,c1(n),n;default:if(typeof a.status=="string")a.then(Rr,Rr);else{if(n=Rt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=a,n.status="pending",n.then(function(f){if(a.status==="pending"){var g=a;g.status="fulfilled",g.value=f}},function(f){if(a.status==="pending"){var g=a;g.status="rejected",g.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,c1(n),n}throw ko=a,tu}}function Io(n){try{var a=n._init;return a(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(ko=c,tu):c}}var ko=null;function u1(){if(ko===null)throw Error(s(459));var n=ko;return ko=null,n}function c1(n){if(n===tu||n===xf)throw Error(s(483))}var su=null,sh=0;function _f(n){var a=sh;return sh+=1,su===null&&(su=[]),l1(su,n,a)}function ih(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Tf(n,a){throw a.$$typeof===y?Error(s(525)):(n=Object.prototype.toString.call(a),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function h1(n){function a(W,I){if(n){var Y=W.deletions;Y===null?(W.deletions=[I],W.flags|=16):Y.push(I)}}function c(W,I){if(!n)return null;for(;I!==null;)a(W,I),I=I.sibling;return null}function f(W){for(var I=new Map;W!==null;)W.key!==null?I.set(W.key,W):I.set(W.index,W),W=W.sibling;return I}function g(W,I){return W=Cr(W,I),W.index=0,W.sibling=null,W}function x(W,I,Y){return W.index=Y,n?(Y=W.alternate,Y!==null?(Y=Y.index,Y<I?(W.flags|=67108866,I):Y):(W.flags|=67108866,I)):(W.flags|=1048576,I)}function S(W){return n&&W.alternate===null&&(W.flags|=67108866),W}function N(W,I,Y,re){return I===null||I.tag!==6?(I=s0(Y,W.mode,re),I.return=W,I):(I=g(I,Y),I.return=W,I)}function P(W,I,Y,re){var Oe=Y.type;return Oe===v?se(W,I,Y.props.children,re,Y.key):I!==null&&(I.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===V&&Io(Oe)===I.type)?(I=g(I,Y.props),ih(I,Y),I.return=W,I):(I=ff(Y.type,Y.key,Y.props,null,W.mode,re),ih(I,Y),I.return=W,I)}function Z(W,I,Y,re){return I===null||I.tag!==4||I.stateNode.containerInfo!==Y.containerInfo||I.stateNode.implementation!==Y.implementation?(I=i0(Y,W.mode,re),I.return=W,I):(I=g(I,Y.children||[]),I.return=W,I)}function se(W,I,Y,re,Oe){return I===null||I.tag!==7?(I=Oo(Y,W.mode,re,Oe),I.return=W,I):(I=g(I,Y),I.return=W,I)}function oe(W,I,Y){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=s0(""+I,W.mode,Y),I.return=W,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case b:return Y=ff(I.type,I.key,I.props,null,W.mode,Y),ih(Y,I),Y.return=W,Y;case _:return I=i0(I,W.mode,Y),I.return=W,I;case V:return I=Io(I),oe(W,I,Y)}if(ce(I)||ye(I))return I=Oo(I,W.mode,Y,null),I.return=W,I;if(typeof I.then=="function")return oe(W,_f(I),Y);if(I.$$typeof===E)return oe(W,gf(W,I),Y);Tf(W,I)}return null}function Q(W,I,Y,re){var Oe=I!==null?I.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Oe!==null?null:N(W,I,""+Y,re);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case b:return Y.key===Oe?P(W,I,Y,re):null;case _:return Y.key===Oe?Z(W,I,Y,re):null;case V:return Y=Io(Y),Q(W,I,Y,re)}if(ce(Y)||ye(Y))return Oe!==null?null:se(W,I,Y,re,null);if(typeof Y.then=="function")return Q(W,I,_f(Y),re);if(Y.$$typeof===E)return Q(W,I,gf(W,Y),re);Tf(W,Y)}return null}function J(W,I,Y,re,Oe){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return W=W.get(Y)||null,N(I,W,""+re,Oe);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case b:return W=W.get(re.key===null?Y:re.key)||null,P(I,W,re,Oe);case _:return W=W.get(re.key===null?Y:re.key)||null,Z(I,W,re,Oe);case V:return re=Io(re),J(W,I,Y,re,Oe)}if(ce(re)||ye(re))return W=W.get(Y)||null,se(I,W,re,Oe,null);if(typeof re.then=="function")return J(W,I,Y,_f(re),Oe);if(re.$$typeof===E)return J(W,I,Y,gf(I,re),Oe);Tf(I,re)}return null}function Ee(W,I,Y,re){for(var Oe=null,dt=null,Ue=I,qe=I=0,at=null;Ue!==null&&qe<Y.length;qe++){Ue.index>qe?(at=Ue,Ue=null):at=Ue.sibling;var ft=Q(W,Ue,Y[qe],re);if(ft===null){Ue===null&&(Ue=at);break}n&&Ue&&ft.alternate===null&&a(W,Ue),I=x(ft,I,qe),dt===null?Oe=ft:dt.sibling=ft,dt=ft,Ue=at}if(qe===Y.length)return c(W,Ue),ot&&Br(W,qe),Oe;if(Ue===null){for(;qe<Y.length;qe++)Ue=oe(W,Y[qe],re),Ue!==null&&(I=x(Ue,I,qe),dt===null?Oe=Ue:dt.sibling=Ue,dt=Ue);return ot&&Br(W,qe),Oe}for(Ue=f(Ue);qe<Y.length;qe++)at=J(Ue,W,qe,Y[qe],re),at!==null&&(n&&at.alternate!==null&&Ue.delete(at.key===null?qe:at.key),I=x(at,I,qe),dt===null?Oe=at:dt.sibling=at,dt=at);return n&&Ue.forEach(function(qa){return a(W,qa)}),ot&&Br(W,qe),Oe}function Pe(W,I,Y,re){if(Y==null)throw Error(s(151));for(var Oe=null,dt=null,Ue=I,qe=I=0,at=null,ft=Y.next();Ue!==null&&!ft.done;qe++,ft=Y.next()){Ue.index>qe?(at=Ue,Ue=null):at=Ue.sibling;var qa=Q(W,Ue,ft.value,re);if(qa===null){Ue===null&&(Ue=at);break}n&&Ue&&qa.alternate===null&&a(W,Ue),I=x(qa,I,qe),dt===null?Oe=qa:dt.sibling=qa,dt=qa,Ue=at}if(ft.done)return c(W,Ue),ot&&Br(W,qe),Oe;if(Ue===null){for(;!ft.done;qe++,ft=Y.next())ft=oe(W,ft.value,re),ft!==null&&(I=x(ft,I,qe),dt===null?Oe=ft:dt.sibling=ft,dt=ft);return ot&&Br(W,qe),Oe}for(Ue=f(Ue);!ft.done;qe++,ft=Y.next())ft=J(Ue,W,qe,ft.value,re),ft!==null&&(n&&ft.alternate!==null&&Ue.delete(ft.key===null?qe:ft.key),I=x(ft,I,qe),dt===null?Oe=ft:dt.sibling=ft,dt=ft);return n&&Ue.forEach(function(AF){return a(W,AF)}),ot&&Br(W,qe),Oe}function At(W,I,Y,re){if(typeof Y=="object"&&Y!==null&&Y.type===v&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case b:e:{for(var Oe=Y.key;I!==null;){if(I.key===Oe){if(Oe=Y.type,Oe===v){if(I.tag===7){c(W,I.sibling),re=g(I,Y.props.children),re.return=W,W=re;break e}}else if(I.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===V&&Io(Oe)===I.type){c(W,I.sibling),re=g(I,Y.props),ih(re,Y),re.return=W,W=re;break e}c(W,I);break}else a(W,I);I=I.sibling}Y.type===v?(re=Oo(Y.props.children,W.mode,re,Y.key),re.return=W,W=re):(re=ff(Y.type,Y.key,Y.props,null,W.mode,re),ih(re,Y),re.return=W,W=re)}return S(W);case _:e:{for(Oe=Y.key;I!==null;){if(I.key===Oe)if(I.tag===4&&I.stateNode.containerInfo===Y.containerInfo&&I.stateNode.implementation===Y.implementation){c(W,I.sibling),re=g(I,Y.children||[]),re.return=W,W=re;break e}else{c(W,I);break}else a(W,I);I=I.sibling}re=i0(Y,W.mode,re),re.return=W,W=re}return S(W);case V:return Y=Io(Y),At(W,I,Y,re)}if(ce(Y))return Ee(W,I,Y,re);if(ye(Y)){if(Oe=ye(Y),typeof Oe!="function")throw Error(s(150));return Y=Oe.call(Y),Pe(W,I,Y,re)}if(typeof Y.then=="function")return At(W,I,_f(Y),re);if(Y.$$typeof===E)return At(W,I,gf(W,Y),re);Tf(W,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,I!==null&&I.tag===6?(c(W,I.sibling),re=g(I,Y),re.return=W,W=re):(c(W,I),re=s0(Y,W.mode,re),re.return=W,W=re),S(W)):c(W,I)}return function(W,I,Y,re){try{sh=0;var Oe=At(W,I,Y,re);return su=null,Oe}catch(Ue){if(Ue===tu||Ue===xf)throw Ue;var dt=Ai(29,Ue,null,W.mode);return dt.lanes=re,dt.return=W,dt}finally{}}}var Ho=h1(!0),d1=h1(!1),wa=!1;function m0(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function g0(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Ra(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ea(n,a,c){var f=n.updateQueue;if(f===null)return null;if(f=f.shared,(pt&2)!==0){var g=f.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),f.pending=a,a=df(n),YS(n,null,c),a}return hf(n,f,a,c),df(n)}function nh(n,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,iS(n,c)}}function y0(n,a){var c=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var g=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var S={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?g=x=S:x=x.next=S,c=c.next}while(c!==null);x===null?g=x=a:x=x.next=a}else g=x=a;c={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:f.shared,callbacks:f.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=a:n.next=a,c.lastBaseUpdate=a}var x0=!1;function rh(){if(x0){var n=eu;if(n!==null)throw n}}function ah(n,a,c,f){x0=!1;var g=n.updateQueue;wa=!1;var x=g.firstBaseUpdate,S=g.lastBaseUpdate,N=g.shared.pending;if(N!==null){g.shared.pending=null;var P=N,Z=P.next;P.next=null,S===null?x=Z:S.next=Z,S=P;var se=n.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==S&&(N===null?se.firstBaseUpdate=Z:N.next=Z,se.lastBaseUpdate=P))}if(x!==null){var oe=g.baseState;S=0,se=Z=P=null,N=x;do{var Q=N.lane&-536870913,J=Q!==N.lane;if(J?(rt&Q)===Q:(f&Q)===Q){Q!==0&&Q===Jl&&(x0=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ee=n,Pe=N;Q=a;var At=c;switch(Pe.tag){case 1:if(Ee=Pe.payload,typeof Ee=="function"){oe=Ee.call(At,oe,Q);break e}oe=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Pe.payload,Q=typeof Ee=="function"?Ee.call(At,oe,Q):Ee,Q==null)break e;oe=m({},oe,Q);break e;case 2:wa=!0}}Q=N.callback,Q!==null&&(n.flags|=64,J&&(n.flags|=8192),J=g.callbacks,J===null?g.callbacks=[Q]:J.push(Q))}else J={lane:Q,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(Z=se=J,P=oe):se=se.next=J,S|=Q;if(N=N.next,N===null){if(N=g.shared.pending,N===null)break;J=N,N=J.next,J.next=null,g.lastBaseUpdate=J,g.shared.pending=null}}while(!0);se===null&&(P=oe),g.baseState=P,g.firstBaseUpdate=Z,g.lastBaseUpdate=se,x===null&&(g.shared.lanes=0),Fa|=S,n.lanes=S,n.memoizedState=oe}}function f1(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function p1(n,a){var c=n.callbacks;
vendor: 6,246 bytes, line 48
48if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)f1(c[n],a)}var iu=G(null),vf=G(0);function m1(n,a){n=kr,te(vf,n),te(iu,a),kr=n|a.baseLanes}function b0(){te(vf,kr),te(iu,iu.current)}function _0(){kr=vf.current,j(iu),j(vf)}var Ni=G(null),an=null;function Ca(n){var a=n.alternate;te(Qt,Qt.current&1),te(Ni,n),an===null&&(a===null||iu.current!==null||a.memoizedState!==null)&&(an=n)}function T0(n){te(Qt,Qt.current),te(Ni,n),an===null&&(an=n)}function g1(n){n.tag===22?(te(Qt,Qt.current),te(Ni,n),an===null&&(an=n)):Ba()}function Ba(){te(Qt,Qt.current),te(Ni,Ni.current)}function wi(n){j(Ni),an===n&&(an=null),j(Qt)}var Qt=G(0);function Sf(n){for(var a=n;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||wx(c)||Rx(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Fr=0,ke=null,St=null,ns=null,Mf=!1,nu=!1,qo=!1,Af=0,oh=0,ru=null,mU=0;function Wt(){throw Error(s(321))}function v0(n,a){if(a===null)return!1;for(var c=0;c<a.length&&c<n.length;c++)if(!Mi(n[c],a[c]))return!1;return!0}function S0(n,a,c,f,g,x){return Fr=x,ke=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,X.H=n===null||n.memoizedState===null?J1:P0,qo=!1,x=c(f,g),qo=!1,nu&&(x=x1(a,c,f,g)),y1(n),x}function y1(n){X.H=ch;var a=St!==null&&St.next!==null;if(Fr=0,ns=St=ke=null,Mf=!1,oh=0,ru=null,a)throw Error(s(300));n===null||rs||(n=n.dependencies,n!==null&&mf(n)&&(rs=!0))}function x1(n,a,c,f){ke=n;var g=0;do{if(nu&&(ru=null),oh=0,nu=!1,25<=g)throw Error(s(301));if(g+=1,ns=St=null,n.updateQueue!=null){var x=n.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}X.H=eM,x=a(c,f)}while(nu);return x}function gU(){var n=X.H,a=n.useState()[0];return a=typeof a.then=="function"?lh(a):a,n=n.useState()[0],(St!==null?St.memoizedState:null)!==n&&(ke.flags|=1024),a}function M0(){var n=Af!==0;return Af=0,n}function A0(n,a,c){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~c}function N0(n){if(Mf){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Mf=!1}Fr=0,ns=St=ke=null,nu=!1,oh=Af=0,ru=null}function Zs(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ns===null?ke.memoizedState=ns=n:ns=ns.next=n,ns}function Kt(){if(St===null){var n=ke.alternate;n=n!==null?n.memoizedState:null}else n=St.next;var a=ns===null?ke.memoizedState:ns.next;if(a!==null)ns=a,St=n;else{if(n===null)throw ke.alternate===null?Error(s(467)):Error(s(310));St=n,n={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},ns===null?ke.memoizedState=ns=n:ns=ns.next=n}return ns}function Nf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lh(n){var a=oh;return oh+=1,ru===null&&(ru=[]),n=l1(ru,n,a),a=ke,(ns===null?a.memoizedState:ns.next)===null&&(a=a.alternate,X.H=a===null||a.memoizedState===null?J1:P0),n}function wf(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return lh(n);if(n.$$typeof===E)return Ns(n)}throw Error(s(438,String(n)))}function w0(n){var a=null,c=ke.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=ke.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Nf(),ke.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(n),f=0;f<n;f++)c[f]=ie;return a.index++,c}function Lr(n,a){return typeof a=="function"?a(n):a}function Rf(n){var a=Kt();return R0(a,St,n)}function R0(n,a,c){var f=n.queue;if(f===null)throw Error(s(311));f.lastRenderedReducer=c;var g=n.baseQueue,x=f.pending;if(x!==null){if(g!==null){var S=g.next;g.next=x.next,x.next=S}a.baseQueue=g=x,f.pending=null}if(x=n.baseState,g===null)n.memoizedState=x;else{a=g.next;var N=S=null,P=null,Z=a,se=!1;do{var oe=Z.lane&-536870913;if(oe!==Z.lane?(rt&oe)===oe:(Fr&oe)===oe){var Q=Z.revertLane;if(Q===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),oe===Jl&&(se=!0);else if((Fr&Q)===Q){Z=Z.next,Q===Jl&&(se=!0);continue}else oe={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(N=P=oe,S=x):P=P.next=oe,ke.lanes|=Q,Fa|=Q;oe=Z.action,qo&&c(x,oe),x=Z.hasEagerState?Z.eagerState:c(x,oe)}else Q={lane:oe,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(N=P=Q,S=x):P=P.next=Q,ke.lanes|=oe,Fa|=oe;Z=Z.next}while(Z!==null&&Z!==a);if(P===null?S=x:P.next=N,!Mi(x,n.memoizedState)&&(rs=!0,se&&(c=eu,c!==null)))throw c;n.memoizedState=x,n.baseState=S,n.baseQueue=P,f.lastRenderedState=x}return g===null&&(f.lanes=0),[n.memoizedState,f.dispatch]}function E0(n){var a=Kt(),c=a.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=n;var f=c.dispatch,g=c.pending,x=a.memoizedState;if(g!==null){c.pending=null;var S=g=g.next;do x=n(x,S.action),S=S.next;while(S!==g);Mi(x,a.memoizedState)||(rs=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),c.lastRenderedState=x}return[x,f]}function b1(n,a,c){var f=ke,g=Kt(),x=ot;if(x){if(c===void 0)throw Error(s(407));c=c()}else c=a();var S=!Mi((St||g).memoizedState,c);if(S&&(g.memoizedState=c,rs=!0),g=g.queue,D0(v1.bind(null,f,g,n),[n]),g.getSnapshot!==a||S||ns!==null&&ns.memoizedState.tag&1){if(f.flags|=2048,au(9,{destroy:void 0},T1.bind(null,f,g,c,a),null),Rt===null)throw Error(s(349));x||(Fr&127)!==0||_1(f,a,c)}return c}function _1(n,a,c){n.flags|=16384,n={getSnapshot:a,value:c},a=ke.updateQueue,a===null?(a=Nf(),ke.updateQueue=a,a.stores=[n]):(c=a.stores,c===null?a.stores=[n]:c.push(n))}function T1(n,a,c,f){a.value=c,a.getSnapshot=f,S1(a)&&M1(n)}function v1(n,a,c){return c(function(){S1(a)&&M1(n)})}
vendor: 16,171 bytes, line 48
48function S1(n){var a=n.getSnapshot;n=n.value;try{var c=a();return!Mi(n,c)}catch{return!0}}function M1(n){var a=Lo(n,2);a!==null&&fi(a,n,2)}function C0(n){var a=Zs();if(typeof n=="function"){var c=n;if(n=c(),qo){_a(!0);try{c()}finally{_a(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:n},a}function A1(n,a,c,f){return n.baseState=c,R0(n,St,typeof f=="function"?f:Lr)}function yU(n,a,c,f,g){if(Bf(n))throw Error(s(485));if(n=a.action,n!==null){var x={payload:g,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){x.listeners.push(S)}};X.T!==null?c(!0):x.isTransition=!1,f(x),c=a.pending,c===null?(x.next=a.pending=x,N1(a,x)):(x.next=c.next,a.pending=c.next=x)}}function N1(n,a){var c=a.action,f=a.payload,g=n.state;if(a.isTransition){var x=X.T,S={};X.T=S;try{var N=c(g,f),P=X.S;P!==null&&P(S,N),w1(n,a,N)}catch(Z){B0(n,a,Z)}finally{x!==null&&S.types!==null&&(x.types=S.types),X.T=x}}else try{x=c(g,f),w1(n,a,x)}catch(Z){B0(n,a,Z)}}function w1(n,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){R1(n,a,f)},function(f){return B0(n,a,f)}):R1(n,a,c)}function R1(n,a,c){a.status="fulfilled",a.value=c,E1(a),n.state=c,a=n.pending,a!==null&&(c=a.next,c===a?n.pending=null:(c=c.next,a.next=c,N1(n,c)))}function B0(n,a,c){var f=n.pending;if(n.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,E1(a),a=a.next;while(a!==f)}n.action=null}function E1(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function C1(n,a){return a}function B1(n,a){if(ot){var c=Rt.formState;if(c!==null){e:{var f=ke;if(ot){if(Ft){t:{for(var g=Ft,x=rn;g.nodeType!==8;){if(!x){g=null;break t}if(g=on(g.nextSibling),g===null){g=null;break t}}x=g.data,g=x==="F!"||x==="F"?g:null}if(g){Ft=on(g.nextSibling),f=g.data==="F!";break e}}Aa(f)}f=!1}f&&(a=c[0])}}return c=Zs(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:C1,lastRenderedState:a},c.queue=f,c=Z1.bind(null,ke,f),f.dispatch=c,f=C0(!1),x=z0.bind(null,ke,!1,f.queue),f=Zs(),g={state:a,dispatch:null,action:n,pending:null},f.queue=g,c=yU.bind(null,ke,g,x,c),g.dispatch=c,f.memoizedState=n,[a,c,!1]}function D1(n){var a=Kt();return U1(a,St,n)}function U1(n,a,c){if(a=R0(n,a,C1)[0],n=Rf(Lr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=lh(a)}catch(S){throw S===tu?xf:S}else f=a;a=Kt();var g=a.queue,x=g.dispatch;return c!==a.memoizedState&&(ke.flags|=2048,au(9,{destroy:void 0},xU.bind(null,g,c),null)),[f,x,n]}function xU(n,a){n.action=a}function F1(n){var a=Kt(),c=St;if(c!==null)return U1(a,c,n);Kt(),a=a.memoizedState,c=Kt();var f=c.queue.dispatch;return c.memoizedState=n,[a,f,!1]}function au(n,a,c,f){return n={tag:n,create:c,deps:f,inst:a,next:null},a=ke.updateQueue,a===null&&(a=Nf(),ke.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=n.next=n:(f=c.next,c.next=n,n.next=f,a.lastEffect=n),n}function L1(){return Kt().memoizedState}function Ef(n,a,c,f){var g=Zs();ke.flags|=n,g.memoizedState=au(1|a,{destroy:void 0},c,f===void 0?null:f)}function Cf(n,a,c,f){var g=Kt();f=f===void 0?null:f;var x=g.memoizedState.inst;St!==null&&f!==null&&v0(f,St.memoizedState.deps)?g.memoizedState=au(a,x,c,f):(ke.flags|=n,g.memoizedState=au(1|a,x,c,f))}function O1(n,a){Ef(8390656,8,n,a)}function D0(n,a){Cf(2048,8,n,a)}function bU(n){ke.flags|=4;var a=ke.updateQueue;if(a===null)a=Nf(),ke.updateQueue=a,a.events=[n];else{var c=a.events;c===null?a.events=[n]:c.push(n)}}function z1(n){var a=Kt().memoizedState;return bU({ref:a,nextImpl:n}),function(){if((pt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function P1(n,a){return Cf(4,2,n,a)}function V1(n,a){return Cf(4,4,n,a)}function G1(n,a){if(typeof a=="function"){n=n();var c=a(n);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function I1(n,a,c){c=c!=null?c.concat([n]):null,Cf(4,4,G1.bind(null,a,n),c)}function U0(){}function k1(n,a){var c=Kt();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&v0(a,f[1])?f[0]:(c.memoizedState=[n,a],n)}function H1(n,a){var c=Kt();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&v0(a,f[1]))return f[0];if(f=n(),qo){_a(!0);try{n()}finally{_a(!1)}}return c.memoizedState=[f,a],f}function F0(n,a,c){return c===void 0||(Fr&1073741824)!==0&&(rt&261930)===0?n.memoizedState=a:(n.memoizedState=c,n=qM(),ke.lanes|=n,Fa|=n,c)}function q1(n,a,c,f){return Mi(c,a)?c:iu.current!==null?(n=F0(n,c,f),Mi(n,a)||(rs=!0),n):(Fr&42)===0||(Fr&1073741824)!==0&&(rt&261930)===0?(rs=!0,n.memoizedState=c):(n=qM(),ke.lanes|=n,Fa|=n,a)}function $1(n,a,c,f,g){var x=ne.p;ne.p=x!==0&&8>x?x:8;var S=X.T,N={};X.T=N,z0(n,!1,a,c);try{var P=g(),Z=X.S;if(Z!==null&&Z(N,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var se=pU(P,f);uh(n,a,se,Ci(n))}else uh(n,a,f,Ci(n))}catch(oe){uh(n,a,{then:function(){},status:"rejected",reason:oe},Ci())}finally{ne.p=x,S!==null&&N.types!==null&&(S.types=N.types),X.T=S}}function _U(){}function L0(n,a,c,f){if(n.tag!==5)throw Error(s(476));var g=W1(n).queue;$1(n,g,a,fe,c===null?_U:function(){return X1(n),c(f)})}function W1(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:fe},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:c},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function X1(n){var a=W1(n);a.next===null&&(a=n.alternate.memoizedState),uh(n,a.next.queue,{},Ci())}function O0(){return Ns(Nh)}function j1(){return Kt().memoizedState}function Y1(){return Kt().memoizedState}function TU(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var c=Ci();n=Ra(c);var f=Ea(a,n,c);f!==null&&(fi(f,a,c),nh(f,a,c)),a={cache:h0()},n.payload=a;return}a=a.return}}function vU(n,a,c){var f=Ci();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Bf(n)?Q1(a,c):(c=e0(n,a,c,f),c!==null&&(fi(c,n,f),K1(c,a,f)))}function Z1(n,a,c){var f=Ci();uh(n,a,c,f)}function uh(n,a,c,f){var g={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Bf(n))Q1(a,g);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var S=a.lastRenderedState,N=x(S,c);if(g.hasEagerState=!0,g.eagerState=N,Mi(N,S))return hf(n,a,g,0),Rt===null&&cf(),!1}catch{}finally{}if(c=e0(n,a,g,f),c!==null)return fi(c,n,f),K1(c,a,f),!0}return!1}function z0(n,a,c,f){if(f={lane:2,revertLane:mx(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Bf(n)){if(a)throw Error(s(479))}else a=e0(n,c,f,2),a!==null&&fi(a,n,2)}function Bf(n){var a=n.alternate;return n===ke||a!==null&&a===ke}function Q1(n,a){nu=Mf=!0;var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}function K1(n,a,c){if((c&4194048)!==0){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,iS(n,c)}}var ch={readContext:Ns,use:wf,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};ch.useEffectEvent=Wt;var J1={readContext:Ns,use:wf,useCallback:function(n,a){return Zs().memoizedState=[n,a===void 0?null:a],n},useContext:Ns,useEffect:O1,useImperativeHandle:function(n,a,c){c=c!=null?c.concat([n]):null,Ef(4194308,4,G1.bind(null,a,n),c)},useLayoutEffect:function(n,a){return Ef(4194308,4,n,a)},useInsertionEffect:function(n,a){Ef(4,2,n,a)},useMemo:function(n,a){var c=Zs();a=a===void 0?null:a;var f=n();if(qo){_a(!0);try{n()}finally{_a(!1)}}return c.memoizedState=[f,a],f},useReducer:function(n,a,c){var f=Zs();if(c!==void 0){var g=c(a);if(qo){_a(!0);try{c(a)}finally{_a(!1)}}}else g=a;return f.memoizedState=f.baseState=g,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:g},f.queue=n,n=n.dispatch=vU.bind(null,ke,n),[f.memoizedState,n]},useRef:function(n){var a=Zs();return n={current:n},a.memoizedState=n},useState:function(n){n=C0(n);var a=n.queue,c=Z1.bind(null,ke,a);return a.dispatch=c,[n.memoizedState,c]},useDebugValue:U0,useDeferredValue:function(n,a){var c=Zs();return F0(c,n,a)},useTransition:function(){var n=C0(!1);return n=$1.bind(null,ke,n.queue,!0,!1),Zs().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,c){var f=ke,g=Zs();if(ot){if(c===void 0)throw Error(s(407));c=c()}else{if(c=a(),Rt===null)throw Error(s(349));(rt&127)!==0||_1(f,a,c)}g.memoizedState=c;var x={value:c,getSnapshot:a};return g.queue=x,O1(v1.bind(null,f,x,n),[n]),f.flags|=2048,au(9,{destroy:void 0},T1.bind(null,f,x,c,a),null),c},useId:function(){var n=Zs(),a=Rt.identifierPrefix;if(ot){var c=Yn,f=jn;c=(f&~(1<<32-Si(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Af++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=mU++,a="_"+a+"r_"+c.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:O0,useFormState:B1,useActionState:B1,useOptimistic:function(n){var a=Zs();a.memoizedState=a.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=z0.bind(null,ke,!0,c),c.dispatch=a,[n,a]},useMemoCache:w0,useCacheRefresh:function(){return Zs().memoizedState=TU.bind(null,ke)},useEffectEvent:function(n){var a=Zs(),c={impl:n};return a.memoizedState=c,function(){if((pt&2)!==0)throw Error(s(440));return c.impl.apply(void 0,arguments)}}},P0={readContext:Ns,use:wf,useCallback:k1,useContext:Ns,useEffect:D0,useImperativeHandle:I1,useInsertionEffect:P1,useLayoutEffect:V1,useMemo:H1,useReducer:Rf,useRef:L1,useState:function(){return Rf(Lr)},useDebugValue:U0,useDeferredValue:function(n,a){var c=Kt();return q1(c,St.memoizedState,n,a)},useTransition:function(){var n=Rf(Lr)[0],a=Kt().memoizedState;return[typeof n=="boolean"?n:lh(n),a]},useSyncExternalStore:b1,useId:j1,useHostTransitionStatus:O0,useFormState:D1,useActionState:D1,useOptimistic:function(n,a){var c=Kt();return A1(c,St,n,a)},useMemoCache:w0,useCacheRefresh:Y1};P0.useEffectEvent=z1;var eM={readContext:Ns,use:wf,useCallback:k1,useContext:Ns,useEffect:D0,useImperativeHandle:I1,useInsertionEffect:P1,useLayoutEffect:V1,useMemo:H1,useReducer:E0,useRef:L1,useState:function(){return E0(Lr)},useDebugValue:U0,useDeferredValue:function(n,a){var c=Kt();return St===null?F0(c,n,a):q1(c,St.memoizedState,n,a)},useTransition:function(){var n=E0(Lr)[0],a=Kt().memoizedState;return[typeof n=="boolean"?n:lh(n),a]},useSyncExternalStore:b1,useId:j1,useHostTransitionStatus:O0,useFormState:F1,useActionState:F1,useOptimistic:function(n,a){var c=Kt();return St!==null?A1(c,St,n,a):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:w0,useCacheRefresh:Y1};eM.useEffectEvent=z1;function V0(n,a,c,f){a=n.memoizedState,c=c(f,a),c=c==null?a:m({},a,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var G0={enqueueSetState:function(n,a,c){n=n._reactInternals;var f=Ci(),g=Ra(f);g.payload=a,c!=null&&(g.callback=c),a=Ea(n,g,f),a!==null&&(fi(a,n,f),nh(a,n,f))},enqueueReplaceState:function(n,a,c){n=n._reactInternals;var f=Ci(),g=Ra(f);g.tag=1,g.payload=a,c!=null&&(g.callback=c),a=Ea(n,g,f),a!==null&&(fi(a,n,f),nh(a,n,f))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var c=Ci(),f=Ra(c);f.tag=2,a!=null&&(f.callback=a),a=Ea(n,f,c),a!==null&&(fi(a,n,c),nh(a,n,c))}};function tM(n,a,c,f,g,x,S){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,x,S):a.prototype&&a.prototype.isPureReactComponent?!Zc(c,f)||!Zc(g,x):!0}function sM(n,a,c,f){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==n&&G0.enqueueReplaceState(a,a.state,null)}function $o(n,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(n=n.defaultProps){c===a&&(c=m({},c));for(var g in n)c[g]===void 0&&(c[g]=n[g])}return c}function iM(n){uf(n)}function nM(n){console.error(n)}function rM(n){uf(n)}function Df(n,a){try{var c=n.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function aM(n,a,c){try{var f=n.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function I0(n,a,c){return c=Ra(c),c.tag=3,c.payload={element:null},c.callback=function(){Df(n,a)},c}function oM(n){return n=Ra(n),n.tag=3,n}function lM(n,a,c,f){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var x=f.value;n.payload=function(){return g(x)},n.callback=function(){aM(a,c,f)}}var S=c.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(n.callback=function(){aM(a,c,f),typeof g!="function"&&(La===null?La=new Set([this]):La.add(this));var N=f.stack;this.componentDidCatch(f.value,{componentStack:N!==null?N:""})})}function SU(n,a,c,f,g){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&Kl(a,c,g,!0),c=Ni.current,c!==null){switch(c.tag){case 31:case 13:return an===null?qf():c.alternate===null&&Xt===0&&(Xt=3),c.flags&=-257,c.flags|=65536,c.lanes=g,f===bf?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),dx(n,f,g)),!1;case 22:return c.flags|=65536,f===bf?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),dx(n,f,g)),!1}throw Error(s(435,c.tag))}return dx(n,f,g),qf(),!1}if(ot)return a=Ni.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,f!==a0&&(n=Error(s(422),{cause:f}),Jc(tn(n,c)))):(f!==a0&&(a=Error(s(423),{cause:f}),Jc(tn(a,c))),n=n.current.alternate,n.flags|=65536,g&=-g,n.lanes|=g,f=tn(f,c),g=I0(n.stateNode,f,g),y0(n,g),Xt!==4&&(Xt=2)),!1;var x=Error(s(520),{cause:f});if(x=tn(x,c),xh===null?xh=[x]:xh.push(x),Xt!==4&&(Xt=2),a===null)return!0;f=tn(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,n=g&-g,c.lanes|=n,n=I0(c.stateNode,f,n),y0(c,n),!1;case 1:if(a=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(La===null||!La.has(x))))return c.flags|=65536,g&=-g,c.lanes|=g,g=oM(g),lM(g,n,c,f),y0(c,g),!1}c=c.return}while(c!==null);return!1}var k0=Error(s(461)),rs=!1;function ws(n,a,c,f){a.child=n===null?d1(a,null,c,f):Ho(a,n.child,c,f)}function uM(n,a,c,f,g){c=c.render;var x=a.ref;if("ref"in f){var S={};for(var N in f)N!=="ref"&&(S[N]=f[N])}else S=f;return Vo(a),f=S0(n,a,c,S,x,g),N=M0(),n!==null&&!rs?(A0(n,a,g),Or(n,a,g)):(ot&&N&&n0(a),a.flags|=1,ws(n,a,f,g),a.child)}function cM(n,a,c,f,g){if(n===null){var x=c.type;return typeof x=="function"&&!t0(x)&&x.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=x,hM(n,a,x,f,g)):(n=ff(c.type,null,f,a,a.mode,g),n.ref=a.ref,n.return=a,a.child=n)}if(x=n.child,!Z0(n,g)){var S=x.memoizedProps;if(c=c.compare,c=c!==null?c:Zc,c(S,f)&&n.ref===a.ref)return Or(n,a,g)}return a.flags|=1,n=Cr(x,f),n.ref=a.ref,n.return=a,a.child=n}function hM(n,a,c,f,g){if(n!==null){var x=n.memoizedProps;if(Zc(x,f)&&n.ref===a.ref)if(rs=!1,a.pendingProps=f=x,Z0(n,g))(n.flags&131072)!==0&&(rs=!0);else return a.lanes=n.lanes,Or(n,a,g)}return H0(n,a,c,f,g)}function dM(n,a,c,f){var g=f.children,x=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,n!==null){for(f=a.child=n.child,g=0;f!==null;)g=g|f.lanes|f.childLanes,f=f.sibling;f=g&~x}else f=0,a.child=null;return fM(n,a,x,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&yf(a,x!==null?x.cachePool:null),x!==null?m1(a,x):b0(),g1(a);else return f=a.lanes=536870912,fM(n,a,x!==null?x.baseLanes|c:c,c,f)}
vendor: 8,730 bytes, line 48
48else x!==null?(yf(a,x.cachePool),m1(a,x),Ba(),a.memoizedState=null):(n!==null&&yf(a,null),b0(),Ba());return ws(n,a,g,c),a.child}function hh(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function fM(n,a,c,f,g){var x=f0();return x=x===null?null:{parent:is._currentValue,pool:x},a.memoizedState={baseLanes:c,cachePool:x},n!==null&&yf(a,null),b0(),g1(a),n!==null&&Kl(n,a,f,!0),a.childLanes=g,null}function Uf(n,a){return a=Lf({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function pM(n,a,c){return Ho(a,n.child,null,c),n=Uf(a,a.pendingProps),n.flags|=2,wi(a),a.memoizedState=null,n}function MU(n,a,c){var f=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(ot){if(f.mode==="hidden")return n=Uf(a,f),a.lanes=536870912,hh(null,n);if(T0(a),(n=Ft)?(n=NA(n,rn),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Sa!==null?{id:jn,overflow:Yn}:null,retryLane:536870912,hydrationErrors:null},c=QS(n),c.return=a,a.child=c,As=a,Ft=null)):n=null,n===null)throw Aa(a);return a.lanes=536870912,null}return Uf(a,f)}var x=n.memoizedState;if(x!==null){var S=x.dehydrated;if(T0(a),g)if(a.flags&256)a.flags&=-257,a=pM(n,a,c);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(s(558));else if(rs||Kl(n,a,c,!1),g=(c&n.childLanes)!==0,rs||g){if(f=Rt,f!==null&&(S=nS(f,c),S!==0&&S!==x.retryLane))throw x.retryLane=S,Lo(n,S),fi(f,n,S),k0;qf(),a=pM(n,a,c)}else n=x.treeContext,Ft=on(S.nextSibling),As=a,ot=!0,Ma=null,rn=!1,n!==null&&e1(a,n),a=Uf(a,f),a.flags|=4096;return a}return n=Cr(n.child,{mode:f.mode,children:f.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Ff(n,a){var c=a.ref;if(c===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(s(284));(n===null||n.ref!==c)&&(a.flags|=4194816)}}function H0(n,a,c,f,g){return Vo(a),c=S0(n,a,c,f,void 0,g),f=M0(),n!==null&&!rs?(A0(n,a,g),Or(n,a,g)):(ot&&f&&n0(a),a.flags|=1,ws(n,a,c,g),a.child)}function mM(n,a,c,f,g,x){return Vo(a),a.updateQueue=null,c=x1(a,f,c,g),y1(n),f=M0(),n!==null&&!rs?(A0(n,a,x),Or(n,a,x)):(ot&&f&&n0(a),a.flags|=1,ws(n,a,c,x),a.child)}function gM(n,a,c,f,g){if(Vo(a),a.stateNode===null){var x=jl,S=c.contextType;typeof S=="object"&&S!==null&&(x=Ns(S)),x=new c(f,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=G0,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=f,x.state=a.memoizedState,x.refs={},m0(a),S=c.contextType,x.context=typeof S=="object"&&S!==null?Ns(S):jl,x.state=a.memoizedState,S=c.getDerivedStateFromProps,typeof S=="function"&&(V0(a,c,S,f),x.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(S=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),S!==x.state&&G0.enqueueReplaceState(x,x.state,null),ah(a,f,x,g),rh(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(n===null){x=a.stateNode;var N=a.memoizedProps,P=$o(c,N);x.props=P;var Z=x.context,se=c.contextType;S=jl,typeof se=="object"&&se!==null&&(S=Ns(se));var oe=c.getDerivedStateFromProps;se=typeof oe=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=a.pendingProps!==N,se||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||Z!==S)&&sM(a,x,f,S),wa=!1;var Q=a.memoizedState;x.state=Q,ah(a,f,x,g),rh(),Z=a.memoizedState,N||Q!==Z||wa?(typeof oe=="function"&&(V0(a,c,oe,f),Z=a.memoizedState),(P=wa||tM(a,c,P,f,Q,Z,S))?(se||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=Z),x.props=f,x.state=Z,x.context=S,f=P):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{x=a.stateNode,g0(n,a),S=a.memoizedProps,se=$o(c,S),x.props=se,oe=a.pendingProps,Q=x.context,Z=c.contextType,P=jl,typeof Z=="object"&&Z!==null&&(P=Ns(Z)),N=c.getDerivedStateFromProps,(Z=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(S!==oe||Q!==P)&&sM(a,x,f,P),wa=!1,Q=a.memoizedState,x.state=Q,ah(a,f,x,g),rh();var J=a.memoizedState;S!==oe||Q!==J||wa||n!==null&&n.dependencies!==null&&mf(n.dependencies)?(typeof N=="function"&&(V0(a,c,N,f),J=a.memoizedState),(se=wa||tM(a,c,se,f,Q,J,P)||n!==null&&n.dependencies!==null&&mf(n.dependencies))?(Z||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,J,P),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,J,P)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=J),x.props=f,x.state=J,x.context=P,f=se):(typeof x.componentDidUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=1024),f=!1)}return x=f,Ff(n,a),f=(a.flags&128)!==0,x||f?(x=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,n!==null&&f?(a.child=Ho(a,n.child,null,g),a.child=Ho(a,null,c,g)):ws(n,a,c,g),a.memoizedState=x.state,n=a.child):n=Or(n,a,g),n}function yM(n,a,c,f){return zo(),a.flags|=256,ws(n,a,c,f),a.child}var q0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $0(n){return{baseLanes:n,cachePool:a1()}}function W0(n,a,c){return n=n!==null?n.childLanes&~c:0,a&&(n|=Ei),n}function xM(n,a,c){var f=a.pendingProps,g=!1,x=(a.flags&128)!==0,S;if((S=x)||(S=n!==null&&n.memoizedState===null?!1:(Qt.current&2)!==0),S&&(g=!0,a.flags&=-129),S=(a.flags&32)!==0,a.flags&=-33,n===null){if(ot){if(g?Ca(a):Ba(),(n=Ft)?(n=NA(n,rn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Sa!==null?{id:jn,overflow:Yn}:null,retryLane:536870912,hydrationErrors:null},c=QS(n),c.return=a,a.child=c,As=a,Ft=null)):n=null,n===null)throw Aa(a);return Rx(n)?a.lanes=32:a.lanes=536870912,null}var N=f.children;return f=f.fallback,g?(Ba(),g=a.mode,N=Lf({mode:"hidden",children:N},g),f=Oo(f,g,c,null),N.return=a,f.return=a,N.sibling=f,a.child=N,f=a.child,f.memoizedState=$0(c),f.childLanes=W0(n,S,c),a.memoizedState=q0,hh(null,f)):(Ca(a),X0(a,N))}var P=n.memoizedState;if(P!==null&&(N=P.dehydrated,N!==null)){if(x)a.flags&256?(Ca(a),a.flags&=-257,a=j0(n,a,c)):a.memoizedState!==null?(Ba(),a.child=n.child,a.flags|=128,a=null):(Ba(),N=f.fallback,g=a.mode,f=Lf({mode:"visible",children:f.children},g),N=Oo(N,g,c,null),N.flags|=2,f.return=a,N.return=a,f.sibling=N,a.child=f,Ho(a,n.child,null,c),f=a.child,f.memoizedState=$0(c),f.childLanes=W0(n,S,c),a.memoizedState=q0,a=hh(null,f));else if(Ca(a),Rx(N)){if(S=N.nextSibling&&N.nextSibling.dataset,S)var Z=S.dgst;S=Z,f=Error(s(419)),f.stack="",f.digest=S,Jc({value:f,source:null,stack:null}),a=j0(n,a,c)}else if(rs||Kl(n,a,c,!1),S=(c&n.childLanes)!==0,rs||S){if(S=Rt,S!==null&&(f=nS(S,c),f!==0&&f!==P.retryLane))throw P.retryLane=f,Lo(n,f),fi(S,n,f),k0;wx(N)||qf(),a=j0(n,a,c)}else wx(N)?(a.flags|=192,a.child=n.child,a=null):(n=P.treeContext,Ft=on(N.nextSibling),As=a,ot=!0,Ma=null,rn=!1,n!==null&&e1(a,n),a=X0(a,f.children),a.flags|=4096);return a}return g?(Ba(),N=f.fallback,g=a.mode,P=n.child,Z=P.sibling,f=Cr(P,{mode:"hidden",children:f.children}),f.subtreeFlags=P.subtreeFlags&65011712,Z!==null?N=Cr(Z,N):(N=Oo(N,g,c,null),N.flags|=2),N.return=a,f.return=a,f.sibling=N,a.child=f,hh(null,f),f=a.child,N=n.child.memoizedState,N===null?N=$0(c):(g=N.cachePool,g!==null?(P=is._currentValue,g=g.parent!==P?{parent:P,pool:P}:g):g=a1(),N={baseLanes:N.baseLanes|c,cachePool:g}),f.memoizedState=N,f.childLanes=W0(n,S,c),a.memoizedState=q0,hh(n.child,f)):(Ca(a),c=n.child,n=c.sibling,c=Cr(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,n!==null&&(S=a.deletions,S===null?(a.deleti
vendor: 5,139 bytes, line 48
48ons=[n],a.flags|=16):S.push(n)),a.child=c,a.memoizedState=null,c)}function X0(n,a){return a=Lf({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Lf(n,a){return n=Ai(22,n,null,a),n.lanes=0,n}function j0(n,a,c){return Ho(a,n.child,null,c),n=X0(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function bM(n,a,c){n.lanes|=a;var f=n.alternate;f!==null&&(f.lanes|=a),u0(n.return,a,c)}function Y0(n,a,c,f,g,x){var S=n.memoizedState;S===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:g,treeForkCount:x}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=f,S.tail=c,S.tailMode=g,S.treeForkCount=x)}function _M(n,a,c){var f=a.pendingProps,g=f.revealOrder,x=f.tail;f=f.children;var S=Qt.current,N=(S&2)!==0;if(N?(S=S&1|2,a.flags|=128):S&=1,te(Qt,S),ws(n,a,f,c),f=ot?Kc:0,!N&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&bM(n,c,a);else if(n.tag===19)bM(n,c,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(g){case"forwards":for(c=a.child,g=null;c!==null;)n=c.alternate,n!==null&&Sf(n)===null&&(g=c),c=c.sibling;c=g,c===null?(g=a.child,a.child=null):(g=c.sibling,c.sibling=null),Y0(a,!1,g,c,x,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=a.child,a.child=null;g!==null;){if(n=g.alternate,n!==null&&Sf(n)===null){a.child=g;break}n=g.sibling,g.sibling=c,c=g,g=n}Y0(a,!0,c,null,x,f);break;case"together":Y0(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function Or(n,a,c){if(n!==null&&(a.dependencies=n.dependencies),Fa|=a.lanes,(c&a.childLanes)===0)if(n!==null){if(Kl(n,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(s(153));if(a.child!==null){for(n=a.child,c=Cr(n,n.pendingProps),a.child=c,c.return=a;n.sibling!==null;)n=n.sibling,c=c.sibling=Cr(n,n.pendingProps),c.return=a;c.sibling=null}return a.child}function Z0(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&mf(n)))}function AU(n,a,c){switch(a.tag){case 3:nt(a,a.stateNode.containerInfo),Na(a,is,n.memoizedState.cache),zo();break;case 27:case 5:Ys(a);break;case 4:nt(a,a.stateNode.containerInfo);break;case 10:Na(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,T0(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Ca(a),a.flags|=128,null):(c&a.child.childLanes)!==0?xM(n,a,c):(Ca(a),n=Or(n,a,c),n!==null?n.sibling:null);Ca(a);break;case 19:var g=(n.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(Kl(n,a,c,!1),f=(c&a.childLanes)!==0),g){if(f)return _M(n,a,c);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),te(Qt,Qt.current),f)break;return null;case 22:return a.lanes=0,dM(n,a,c,a.pendingProps);case 24:Na(a,is,n.memoizedState.cache)}return Or(n,a,c)}function TM(n,a,c){if(n!==null)if(n.memoizedProps!==a.pendingProps)rs=!0;else{if(!Z0(n,c)&&(a.flags&128)===0)return rs=!1,AU(n,a,c);rs=(n.flags&131072)!==0}else rs=!1,ot&&(a.flags&1048576)!==0&&JS(a,Kc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(n=Io(a.elementType),a.type=n,typeof n=="function")t0(n)?(f=$o(n,f),a.tag=1,a=gM(null,a,n,f,c)):(a.tag=0,a=H0(null,a,n,f,c));else{if(n!=null){var g=n.$$typeof;if(g===F){a.tag=11,a=uM(null,a,n,f,c);break e}else if(g===R){a.tag=14,a=cM(null,a,n,f,c);break e}}throw a=Ne(n)||n,Error(s(306,a,""))}}return a;case 0:return H0(n,a,a.type,a.pendingProps,c);case 1:return f=a.type,g=$o(f,a.pendingProps),gM(n,a,f,g,c);case 3:e:{if(nt(a,a.stateNode.containerInfo),n===null)throw Error(s(387));f=a.pendingProps;var x=a.memoizedState;g=x.element,g0(n,a),ah(a,f,null,c);var S=a.memoizedState;if(f=S.cache,Na(a,is,f),f!==x.cache&&c0(a,[is],c,!0),rh(),f=S.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:S.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=yM(n,a,f,c);break e}else if(f!==g){g=tn(Error(s(424)),a),Jc(g),a=yM(n,a,f,c);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Ft=on(n.firstChild),As=a,ot=!0,Ma=null,rn=!0,c=d1(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(zo(),f===g){a=Or(n,a,c);break e}ws(n,a,f,c)}a=a.child}return a;case 26:return Ff(n,a),n===null?(c=DA(a.type,null,a.pendingProps,null))?a.memoizedState=c:ot||(c=a.type,n=a.pendingProps,f=Qf(Me.current).createElement(c),f[Ms]=a,f[oi]=n,Rs(f,c,n),gs(f),a.stateNode=f):a.memoizedState=DA(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Ys(a),n===null&&ot&&(f=a.stateNode=EA(a.type,a.pendingProps,Me.current),As=a,rn=!0,g=Ft,Va(a.type)?(Ex=g,Ft=on(f.firstChild)):Ft=g),ws(n,a,a.pendingProps.children,c),Ff(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&ot&&((g=f=Ft)&&(f=tF(f,a.type,a.pendingProps,rn),f!==null?(a.stateNode=f,As=a,Ft=on(f.firstChild),rn=!1,g=!0):g=!1),g||Aa(a)),Ys(a),g=a.type,x=a.pe
vendor: 4,390 bytes, line 48
48ndingProps,S=n!==null?n.memoizedProps:null,f=x.children,Mx(g,x)?f=null:S!==null&&Mx(g,S)&&(a.flags|=32),a.memoizedState!==null&&(g=S0(n,a,gU,null,null,c),Nh._currentValue=g),Ff(n,a),ws(n,a,f,c),a.child;case 6:return n===null&&ot&&((n=c=Ft)&&(c=sF(c,a.pendingProps,rn),c!==null?(a.stateNode=c,As=a,Ft=null,n=!0):n=!1),n||Aa(a)),null;case 13:return xM(n,a,c);case 4:return nt(a,a.stateNode.containerInfo),f=a.pendingProps,n===null?a.child=Ho(a,null,f,c):ws(n,a,f,c),a.child;case 11:return uM(n,a,a.type,a.pendingProps,c);case 7:return ws(n,a,a.pendingProps,c),a.child;case 8:return ws(n,a,a.pendingProps.children,c),a.child;case 12:return ws(n,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,Na(a,a.type,f.value),ws(n,a,f.children,c),a.child;case 9:return g=a.type._context,f=a.pendingProps.children,Vo(a),g=Ns(g),f=f(g),a.flags|=1,ws(n,a,f,c),a.child;case 14:return cM(n,a,a.type,a.pendingProps,c);case 15:return hM(n,a,a.type,a.pendingProps,c);case 19:return _M(n,a,c);case 31:return MU(n,a,c);case 22:return dM(n,a,c,a.pendingProps);case 24:return Vo(a),f=Ns(is),n===null?(g=f0(),g===null&&(g=Rt,x=h0(),g.pooledCache=x,x.refCount++,x!==null&&(g.pooledCacheLanes|=c),g=x),a.memoizedState={parent:f,cache:g},m0(a),Na(a,is,g)):((n.lanes&c)!==0&&(g0(n,a),ah(a,null,null,c),rh()),g=n.memoizedState,x=a.memoizedState,g.parent!==f?(g={parent:f,cache:f},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),Na(a,is,f)):(f=x.cache,Na(a,is,f),f!==g.cache&&c0(a,[is],c,!0))),ws(n,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function zr(n){n.flags|=4}function Q0(n,a,c,f,g){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(g&335544128)===g)if(n.stateNode.complete)n.flags|=8192;else if(jM())n.flags|=8192;else throw ko=bf,p0}else n.flags&=-16777217}function vM(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!zA(a))if(jM())n.flags|=8192;else throw ko=bf,p0}function Of(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?tS():536870912,n.lanes|=a,cu|=a)}function dh(n,a){if(!ot)switch(n.tailMode){case"hidden":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function Lt(n){var a=n.alternate!==null&&n.alternate.child===n.child,c=0,f=0;if(a)for(var g=n.child;g!==null;)c|=g.lanes|g.childLanes,f|=g.subtreeFlags&65011712,f|=g.flags&65011712,g.return=n,g=g.sibling;else for(g=n.child;g!==null;)c|=g.lanes|g.childLanes,f|=g.subtreeFlags,f|=g.flags,g.return=n,g=g.sibling;return n.subtreeFlags|=f,n.childLanes=c,a}function NU(n,a,c){var f=a.pendingProps;switch(r0(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(a),null;case 1:return Lt(a),null;case 3:return c=a.stateNode,f=null,n!==null&&(f=n.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),Ur(is),ct(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(Ql(a)?zr(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,o0())),Lt(a),null;case 26:var g=a.type,x=a.memoizedState;return n===null?(zr(a),x!==null?(Lt(a),vM(a,x)):(Lt(a),Q0(a,g,null,f,c))):x?x!==n.memoizedState?(zr(a),Lt(a),vM(a,x)):(Lt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==f&&zr(a),Lt(a),Q0(a,g,n,f,c)),null;case 27:if(Rn(a),c=Me.current,g=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&zr(a);else{if(!f){if(a.stateNode===null)throw Error(s(166));return Lt(a),null}n=pe.current,Ql(a)?t1(a):(n=EA(g,f,c),a.stateNode=n,zr(a))}return Lt(a),null;case 5:if(Rn(a),g=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&zr(a);else{if(!f){if(a.stateNode===null)throw Error(s(166));return Lt(a),null}if(x=pe.current,Ql(a))t1(a);else{var S=Qf(Me.current);switch(x){case 1:x=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:x=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":x=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":x=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":x=S.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;
vendor: 22,872 bytes, line 48
48case"select":x=typeof f.is=="string"?S.createElement("select",{is:f.is}):S.createElement("select"),f.multiple?x.multiple=!0:f.size&&(x.size=f.size);break;default:x=typeof f.is=="string"?S.createElement(g,{is:f.is}):S.createElement(g)}}x[Ms]=a,x[oi]=f;e:for(S=a.child;S!==null;){if(S.tag===5||S.tag===6)x.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===a)break e;for(;S.sibling===null;){if(S.return===null||S.return===a)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}a.stateNode=x;e:switch(Rs(x,g,f),g){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&zr(a)}}return Lt(a),Q0(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,c),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==f&&zr(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(s(166));if(n=Me.current,Ql(a)){if(n=a.stateNode,c=a.memoizedProps,f=null,g=As,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}n[Ms]=a,n=!!(n.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||xA(n.nodeValue,c)),n||Aa(a,!0)}else n=Qf(n).createTextNode(f),n[Ms]=a,a.stateNode=n}return Lt(a),null;case 31:if(c=a.memoizedState,n===null||n.memoizedState!==null){if(f=Ql(a),c!==null){if(n===null){if(!f)throw Error(s(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[Ms]=a}else zo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Lt(a),n=!1}else c=o0(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return a.flags&256?(wi(a),a):(wi(a),null);if((a.flags&128)!==0)throw Error(s(558))}return Lt(a),null;case 13:if(f=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(g=Ql(a),f!==null&&f.dehydrated!==null){if(n===null){if(!g)throw Error(s(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(s(317));g[Ms]=a}else zo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Lt(a),g=!1}else g=o0(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(wi(a),a):(wi(a),null)}return wi(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,n=n!==null&&n.memoizedState!==null,c&&(f=a.child,g=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(g=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==g&&(f.flags|=2048)),c!==n&&c&&(a.child.flags|=8192),Of(a,a.updateQueue),Lt(a),null);case 4:return ct(),n===null&&bx(a.stateNode.containerInfo),Lt(a),null;case 10:return Ur(a.type),Lt(a),null;case 19:if(j(Qt),f=a.memoizedState,f===null)return Lt(a),null;if(g=(a.flags&128)!==0,x=f.rendering,x===null)if(g)dh(f,!1);else{if(Xt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(x=Sf(n),x!==null){for(a.flags|=128,dh(f,!1),n=x.updateQueue,a.updateQueue=n,Of(a,n),a.subtreeFlags=0,n=c,c=a.child;c!==null;)ZS(c,n),c=c.sibling;return te(Qt,Qt.current&1|2),ot&&Br(a,f.treeForkCount),a.child}n=n.sibling}f.tail!==null&&Ti()>If&&(a.flags|=128,g=!0,dh(f,!1),a.lanes=4194304)}else{if(!g)if(n=Sf(x),n!==null){if(a.flags|=128,g=!0,n=n.updateQueue,a.updateQueue=n,Of(a,n),dh(f,!0),f.tail===null&&f.tailMode==="hidden"&&!x.alternate&&!ot)return Lt(a),null}else 2*Ti()-f.renderingStartTime>If&&c!==536870912&&(a.flags|=128,g=!0,dh(f,!1),a.lanes=4194304);f.isBackwards?(x.sibling=a.child,a.child=x):(n=f.last,n!==null?n.sibling=x:a.child=x,f.last=x)}return f.tail!==null?(n=f.tail,f.rendering=n,f.tail=n.sibling,f.renderingStartTime=Ti(),n.sibling=null,c=Qt.current,te(Qt,g?c&1|2:c&1),ot&&Br(a,f.treeForkCount),n):(Lt(a),null);case 22:case 23:return wi(a),_0(),f=a.memoizedState!==null,n!==null?n.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(Lt(a),a.subtreeFlags&6&&(a.flags|=8192)):Lt(a),c=a.updateQueue,c!==null&&Of(a,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),n!==null&&j(Go),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Ur(is),Lt(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function wU(n,a){switch(r0(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Ur(is),ct(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Rn(a),null;case 31:if(a.memoizedState!==null){if(wi(a),a.alternate===null)throw Error(s(340));zo()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(wi(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(s(340));zo()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return j(Qt),null;case 4:return ct(),null;case 10:return Ur(a.type),null;case 22:case 23:return wi(a),_0(),n!==null&&j(Go),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Ur(is),null;case 25:return null;default:return null}}function SM(n,a){switch(r0(a),a.tag){case 3:Ur(is),ct();break;case 26:case 27:case 5:Rn(a);break;case 4:ct();break;case 31:a.memoizedState!==null&&wi(a);break;case 13:wi(a);break;case 19:j(Qt);break;case 10:Ur(a.type);break;case 22:case 23:wi(a),_0(),n!==null&&j(Go);break;case 24:Ur(is)}}function fh(n,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var g=f.next;c=g;do{if((c.tag&n)===n){f=void 0;var x=c.create,S=c.inst;f=x(),S.destroy=f}c=c.next}while(c!==g)}}catch(N){Tt(a,a.return,N)}}function Da(n,a,c){try{var f=a.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var x=g.next;f=x;do{if((f.tag&n)===n){var S=f.inst,N=S.destroy;if(N!==void 0){S.destroy=void 0,g=a;var P=c,Z=N;try{Z()}catch(se){Tt(g,P,se)}}}f=f.next}while(f!==x)}}catch(se){Tt(a,a.return,se)}}function MM(n){var a=n.updateQueue;if(a!==null){var c=n.stateNode;try{p1(a,c)}catch(f){Tt(n,n.return,f)}}}function AM(n,a,c){c.props=$o(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(f){Tt(n,a,f)}}function ph(n,a){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var f=n.stateNode;break;case 30:f=n.stateNode;break;default:f=n.stateNode}typeof c=="function"?n.refCleanup=c(f):c.current=f}}catch(g){Tt(n,a,g)}}function Zn(n,a){var c=n.ref,f=n.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(g){Tt(n,a,g)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){Tt(n,a,g)}else c.current=null}function NM(n){var a=n.type,c=n.memoizedProps,f=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(g){Tt(n,n.return,g)}}function K0(n,a,c){try{var f=n.stateNode;YU(f,n.type,c,a),f[oi]=a}catch(g){Tt(n,n.return,g)}}function wM(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Va(n.type)||n.tag===4}function J0(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||wM(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Va(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function ex(n,a,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(n),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Rr));else if(f!==4&&(f===27&&Va(n.type)&&(c=n.stateNode,a=null),n=n.child,n!==null))for(ex(n,a,c),n=n.sibling;n!==null;)ex(n,a,c),n=n.sibling}function zf(n,a,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,a?c.insertBefore(n,a):c.appendChild(n);else if(f!==4&&(f===27&&Va(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(zf(n,a,c),n=n.sibling;n!==null;)zf(n,a,c),n=n.sibling}function RM(n){var a=n.stateNode,c=n.memoizedProps;try{for(var f=n.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);Rs(a,f,c),a[Ms]=n,a[oi]=c}catch(x){Tt(n,n.return,x)}}var Pr=!1,as=!1,tx=!1,EM=typeof WeakSet=="function"?WeakSet:Set,ys=null;function RU(n,a){if(n=n.containerInfo,vx=np,n=IS(n),jy(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var g=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var S=0,N=-1,P=-1,Z=0,se=0,oe=n,Q=null;t:for(;;){for(var J;oe!==c||g!==0&&oe.nodeType!==3||(N=S+g),oe!==x||f!==0&&oe.nodeType!==3||(P=S+f),oe.nodeType===3&&(S+=oe.nodeValue.length),(J=oe.firstChild)!==null;)Q=oe,oe=J;for(;;){if(oe===n)break t;if(Q===c&&++Z===g&&(N=S),Q===x&&++se===f&&(P=S),(J=oe.nextSibling)!==null)break;oe=Q,Q=oe.parentNode}oe=J}c=N===-1||P===-1?null:{start:N,end:P}}else c=null}c=c||{start:0,end:0}}else c=null;for(Sx={focusedElem:n,selectionRange:c},np=!1,ys=a;ys!==null;)if(a=ys,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,ys=n;else for(;ys!==null;){switch(a=ys,x=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)g=n[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&x!==null){n=void 0,c=a,g=x.memoizedProps,x=x.memoizedState,f=c.stateNode;try{var Ee=$o(c.type,g);n=f.getSnapshotBeforeUpdate(Ee,x),f.__reactInternalSnapshotBeforeUpdate=n}catch(Pe){Tt(c,c.return,Pe)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,c=n.nodeType,c===9)Nx(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Nx(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=a.sibling,n!==null){n.return=a.return,ys=n;break}ys=a.return}}function CM(n,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:Gr(n,c),f&4&&fh(5,c);break;case 1:if(Gr(n,c),f&4)if(n=c.stateNode,a===null)try{n.componentDidMount()}catch(S){Tt(c,c.return,S)}else{var g=$o(c.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(g,a,n.__reactInternalSnapshotBeforeUpdate)}catch(S){Tt(c,c.return,S)}}f&64&&MM(c),f&512&&ph(c,c.return);break;case 3:if(Gr(n,c),f&64&&(n=c.updateQueue,n!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{p1(n,a)}catch(S){Tt(c,c.return,S)}}break;case 27:a===null&&f&4&&RM(c);case 26:case 5:Gr(n,c),a===null&&f&4&&NM(c),f&512&&ph(c,c.return);break;case 12:Gr(n,c);break;case 31:Gr(n,c),f&4&&UM(n,c);break;case 13:Gr(n,c),f&4&&FM(n,c),f&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=zU.bind(null,c),iF(n,c))));break;case 22:if(f=c.memoizedState!==null||Pr,!f){a=a!==null&&a.memoizedState!==null||as,g=Pr;var x=as;Pr=f,(as=a)&&!x?Ir(n,c,(c.subtreeFlags&8772)!==0):Gr(n,c),Pr=g,as=x}break;case 30:break;default:Gr(n,c)}}function BM(n){var a=n.alternate;a!==null&&(n.alternate=null,BM(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&By(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Gt=null,ui=!1;function Vr(n,a,c){for(c=c.child;c!==null;)DM(n,a,c),c=c.sibling}function DM(n,a,c){if(vi&&typeof vi.onCommitFiberUnmount=="function")try{vi.onCommitFiberUnmount(Pc,c)}catch{}switch(c.tag){case 26:as||Zn(c,a),Vr(n,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:as||Zn(c,a);var f=Gt,g=ui;Va(c.type)&&(Gt=c.stateNode,ui=!1),Vr(n,a,c),Sh(c.stateNode),Gt=f,ui=g;break;case 5:as||Zn(c,a);case 6:if(f=Gt,g=ui,Gt=null,Vr(n,a,c),Gt=f,ui=g,Gt!==null)if(ui)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(c.stateNode)}catch(x){Tt(c,a,x)}else try{Gt.removeChild(c.stateNode)}catch(x){Tt(c,a,x)}break;case 18:Gt!==null&&(ui?(n=Gt,MA(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),xu(n)):MA(Gt,c.stateNode));break;case 4:f=Gt,g=ui,Gt=c.stateNode.containerInfo,ui=!0,Vr(n,a,c),Gt=f,ui=g;break;case 0:case 11:case 14:case 15:Da(2,c,a),as||Da(4,c,a),Vr(n,a,c);break;case 1:as||(Zn(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&AM(c,a,f)),Vr(n,a,c);break;case 21:Vr(n,a,c);break;case 22:as=(f=as)||c.memoizedState!==null,Vr(n,a,c),as=f;break;default:Vr(n,a,c)}}function UM(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{xu(n)}catch(c){Tt(a,a.return,c)}}}function FM(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{xu(n)}catch(c){Tt(a,a.return,c)}}function EU(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new EM),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new EM),a;default:throw Error(s(435,n.tag))}}function Pf(n,a){var c=EU(n);a.forEach(function(f){if(!c.has(f)){c.add(f);var g=PU.bind(null,n,f);f.then(g,g)}})}function ci(n,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var g=c[f],x=n,S=a,N=S;e:for(;N!==null;){switch(N.tag){case 27:if(Va(N.type)){Gt=N.stateNode,ui=!1;break e}break;case 5:Gt=N.stateNode,ui=!1;break e;case 3:case 4:Gt=N.stateNode.containerInfo,ui=!0;break e}N=N.return}if(Gt===null)throw Error(s(160));DM(x,S,g),Gt=null,ui=!1,x=g.alternate,x!==null&&(x.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)LM(a,n),a=a.sibling}var Cn=null;function LM(n,a){var c=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ci(a,n),hi(n),f&4&&(Da(3,n,n.return),fh(3,n),Da(5,n,n.return));break;case 1:ci(a,n),hi(n),f&512&&(as||c===null||Zn(c,c.return)),f&64&&Pr&&(n=n.updateQueue,n!==null&&(f=n.callbacks,f!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var g=Cn;if(ci(a,n),hi(n),f&512&&(as||c===null||Zn(c,c.return)),f&4){var x=c!==null?c.memoizedState:null;if(f=n.memoizedState,c===null)if(f===null)if(n.stateNode===null){e:{f=n.type,c=n.memoizedProps,g=g.ownerDocument||g;t:switch(f){case"title":x=g.getElementsByTagName("title")[0],(!x||x[Ic]||x[Ms]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=g.createElement(f),g.head.insertBefore(x,g.querySelector("head > title"))),Rs(x,f,c),x[Ms]=n,gs(x),f=x;break e;case"link":var S=LA("link","href",g).get(f+(c.href||""));if(S){for(var N=0;N<S.length;N++)if(x=S[N],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){S.splice(N,1);break t}}x=g.createElement(f),Rs(x,f,c),g.head.appendChild(x);break;case"meta":if(S=LA("meta","content",g).get(f+(c.content||""))){for(N=0;N<S.length;N++)if(x=S[N],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){S.splice(N,1);break t}}x=g.createElement(f),Rs(x,f,c),g.head.appendChild(x);break;default:throw Error(s(468,f))}x[Ms]=n,gs(x),f=x}n.stateNode=f}else OA(g,n.type,n.stateNode);else n.stateNode=FA(g,f,n.memoizedProps);else x!==f?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,f===null?OA(g,n.type,n.stateNode):FA(g,f,n.memoizedProps)):f===null&&n.stateNode!==null&&K0(n,n.memoizedProps,c.memoizedProps)}break;case 27:ci(a,n),hi(n),f&512&&(as||c===null||Zn(c,c.return)),c!==null&&f&4&&K0(n,n.memoizedProps,c.memoizedProps);break;case 5:if(ci(a,n),hi(n),f&512&&(as||c===null||Zn(c,c.return)),n.flags&32){g=n.stateNode;try{Il(g,"")}catch(Ee){Tt(n,n.return,Ee)}}f&4&&n.stateNode!=null&&(g=n.memoizedProps,K0(n,g,c!==null?c.memoizedProps:g)),f&1024&&(tx=!0);break;case 6:if(ci(a,n),hi(n),f&4){if(n.stateNode===null)throw Error(s(162));f=n.memoizedProps,c=n.stateNode;try{c.nodeValue=f}catch(Ee){Tt(n,n.return,Ee)}}break;case 3:if(ep=null,g=Cn,Cn=Kf(a.containerInfo),ci(a,n),Cn=g,hi(n),f&4&&c!==null&&c.memoizedState.isDehydrated)try{xu(a.containerInfo)}catch(Ee){Tt(n,n.return,Ee)}tx&&(tx=!1,OM(n));break;case 4:f=Cn,Cn=Kf(n.stateNode.containerInfo),ci(a,n),hi(n),Cn=f;break;case 12:ci(a,n),hi(n);break;case 31:ci(a,n),hi(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,Pf(n,f)));break;case 13:ci(a,n),hi(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Gf=Ti()),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,Pf(n,f)));break;case 22:g=n.memoizedState!==null;var P=c!==null&&c.memoizedState!==null,Z=Pr,se=as;if(Pr=Z||g,as=se||P,ci(a,n),as=se,Pr=Z,hi(n),f&8192)e:for(a=n.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(c===null||P||Pr||as||Wo(n)),c=null,a=n;;){if(a.tag===5||a.tag===26){if(c===null){P=c=a;try{if(x=P.stateNode,g)S=x.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{N=P.stateNode;var oe=P.memoizedProps.style,Q=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;N.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Ee){Tt(P,P.return,Ee)}}}else if(a.tag===6){if(c===null){P=a;try{P.stateNode.nodeValue=g?"":P.memoizedProps}catch(Ee){Tt(P,P.return,Ee)}}}else if(a.tag===18){if(c===null){P=a;try{var J=P.stateNode;g?AA(J,!0):AA(P.stateNode,!1)}catch(Ee){Tt(P,P.return,Ee)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=n.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,Pf(n,c))));break;case 19:ci(a,n),hi(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,Pf(n,f)));break;case 30:break;case 21:break;default:ci(a,n),hi(n)}}function hi(n){var a=n.flags;if(a&2){try{for(var c,f=n.return;f!==null;){if(wM(f)){c=f;break}f=f.return}if(c==null)throw Error(s(160));switch(c.tag){case 27:var g=c.stateNode,x=J0(n);zf(n,x,g);break;case 5:var S=c.stateNode;c.flags&32&&(Il(S,""),c.flags&=-33);var N=J0(n);zf(n,N,S);break;case 3:case 4:var P=c.stateNode.containerInfo,Z=J0(n);ex(n,Z,P);break;default:throw Error(s(161))}}catch(se){Tt(n,n.return,se)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function OM(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;OM(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function Gr(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)CM(n,a.alternate,a),a=a.sibling}function Wo(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:Da(4,a,a.return),Wo(a);break;case 1:Zn(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&AM(a,a.return,c),Wo(a);break;case 27:Sh(a.stateNode);case 26:case 5:Zn(a,a.return),Wo(a);break;case 22:a.memoizedState===null&&Wo(a);break;case 30:Wo(a);break;default:Wo(a)}n=n.sibling}}function Ir(n,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,g=n,x=a,S=x.flags;switch(x.tag){case 0:case 11:case 15:Ir(g,x,c),fh(4,x);break;case 1:if(Ir(g,x,c),f=x,g=f.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(Z){Tt(f,f.return,Z)}if(f=x,g=f.updateQueue,g!==null){var N=f.stateNode;try{var P=g.shared.hiddenCallbacks;if(P!==null)for(g.shared.hiddenCallbacks=null,g=0;g<P.length;g++)f1(P[g],N)}catch(Z){Tt(f,f.return,Z)}}c&&S&64&&MM(x),ph(x,x.return);break;case 27:RM(x);case 26:case 5:Ir(g,x,c),c&&f===null&&S&4&&NM(x),ph(x,x.return);break;case 12:Ir(g,x,c);break;case 31:Ir(g,x,c),c&&S&4&&UM(g,x);break;case 13:Ir(g,x,c),c&&S&4&&FM(g,x);break;case 22:x.memoizedState===null&&Ir(g,x,c),ph(x,x.return);break;case 30:break;default:Ir(g,x,c)}a=a.sibling}}function sx(n,a){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&eh(c))}function ix(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&eh(n))}function Bn(n,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)zM(n,a,c,f),a=a.sibling}function zM(n,a,c,f){var g=a.flags;switch(a.tag){case 0:case 11:case 15:Bn(n,a,c,f),g&2048&&fh(9,a);break;case 1:Bn(n,a,c,f);break;case 3:Bn(n,a,c,f),g&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&eh(n)));break;case 12:if(g&2048){Bn(n,a,c,f),n=a.stateNode;try{var x=a.memoizedProps,S=x.id,N=x.onPostCommit;typeof N=="function"&&N(S,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(P){Tt(a,a.return,P)}}else Bn(n,a,c,f);break;case 31:Bn(n,a,c,f);break;case 13:Bn(n,a,c,f);break;case 23:break;case 22:x=a.stateNode,S=a.alternate,a.memoizedState!==null?x._visibility&2?Bn(n,a,c,f):mh(n,a):x._visibility&2?Bn(n,a,c,f):(x._visibility|=2,ou(n,a,c,f,(a.subtreeFlags&10256)!==0||!1)),g&2048&&sx(S,a);break;case 24:Bn(n,a,c,f),g&2048&&ix(a.alternate,a);break;default:Bn(n,a,c,f)}}function ou(n,a,c,f,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=n,S=a,N=c,P=f,Z=S.flags;switch(S.tag){case 0:case 11:case 15:ou(x,S,N,P,g),fh(8,S);break;case 23:break;case 22:var se=S.stateNode;S.memoizedState!==null?se._visibility&2?ou(x,S,N,P,g):mh(x,S):(se._visibility|=2,ou(x,S,N,P,g)),g&&Z&2048&&sx(S.alternate,S);break;case 24:ou(x,S,N,P,g),g&&Z&2048&&ix(S.alternate,S);break;default:ou(x,S,N,P,g)}a=a.sibling}}function mh(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=n,f=a,g=f.flags;switch(f.tag){case 22:mh(c,f),g&2048&&sx(f.alternate,f);break;case 24:mh(c,f),g&2048&&ix(f.alternate,f);break;default:mh(c,f)}a=a.sibling}}var gh=8192;function lu(n,a,c){if(n.subtreeFlags&gh)for(n=n.child;n!==null;)PM(n,a,c),n=n.sibling}function PM(n,a,c){switch(n.tag){case 26:lu(n,a,c),n.flags&gh&&n.memoizedState!==null&&mF(c,Cn,n.memoizedState,n.memoizedProps);break;case 5:lu(n,a,c);break;case 3:case 4:var f=Cn;Cn=Kf(n.stateNode.containerInfo),lu(n,a,c),Cn=f;break;case 22:n.memoizedState===null&&(f=n.alternate,f!==null&&f.memoizedState!==null?(f=gh,gh=16777216,lu(n,a,c),gh=f):lu(n,a,c));break;default:lu(n,a,c)}}
vendor: 4,462 bytes, line 48
48function VM(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function yh(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];ys=f,IM(f,n)}VM(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)GM(n),n=n.sibling}function GM(n){switch(n.tag){case 0:case 11:case 15:yh(n),n.flags&2048&&Da(9,n,n.return);break;case 3:yh(n);break;case 12:yh(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Vf(n)):yh(n);break;default:yh(n)}}function Vf(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];ys=f,IM(f,n)}VM(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:Da(8,a,a.return),Vf(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Vf(a));break;default:Vf(a)}n=n.sibling}}function IM(n,a){for(;ys!==null;){var c=ys;switch(c.tag){case 0:case 11:case 15:Da(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:eh(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,ys=f;else e:for(c=n;ys!==null;){f=ys;var g=f.sibling,x=f.return;if(BM(f),f===c){ys=null;break e}if(g!==null){g.return=x,ys=g;break e}ys=x}}}var CU={getCacheForType:function(n){var a=Ns(is),c=a.data.get(n);return c===void 0&&(c=n(),a.data.set(n,c)),c},cacheSignal:function(){return Ns(is).controller.signal}},BU=typeof WeakMap=="function"?WeakMap:Map,pt=0,Rt=null,Je=null,rt=0,_t=0,Ri=null,Ua=!1,uu=!1,nx=!1,kr=0,Xt=0,Fa=0,Xo=0,rx=0,Ei=0,cu=0,xh=null,di=null,ax=!1,Gf=0,kM=0,If=1/0,kf=null,La=null,hs=0,Oa=null,hu=null,Hr=0,ox=0,lx=null,HM=null,bh=0,ux=null;function Ci(){return(pt&2)!==0&&rt!==0?rt&-rt:X.T!==null?mx():rS()}function qM(){if(Ei===0)if((rt&536870912)===0||ot){var n=Yd;Yd<<=1,(Yd&3932160)===0&&(Yd=262144),Ei=n}else Ei=536870912;return n=Ni.current,n!==null&&(n.flags|=32),Ei}function fi(n,a,c){(n===Rt&&(_t===2||_t===9)||n.cancelPendingCommit!==null)&&(du(n,0),za(n,rt,Ei,!1)),Gc(n,c),((pt&2)===0||n!==Rt)&&(n===Rt&&((pt&2)===0&&(Xo|=c),Xt===4&&za(n,rt,Ei,!1)),Qn(n))}function $M(n,a,c){if((pt&6)!==0)throw Error(s(327));var f=!c&&(a&127)===0&&(a&n.expiredLanes)===0||Vc(n,a),g=f?FU(n,a):hx(n,a,!0),x=f;do{if(g===0){uu&&!f&&za(n,a,0,!1);break}else{if(c=n.current.alternate,x&&!DU(c)){g=hx(n,a,!1),x=!1;continue}if(g===2){if(x=a,n.errorRecoveryDisabledLanes&x)var S=0;else S=n.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){a=S;e:{var N=n;g=xh;var P=N.current.memoizedState.isDehydrated;if(P&&(du(N,S).flags|=256),S=hx(N,S,!1),S!==2){if(nx&&!P){N.errorRecoveryDisabledLanes|=x,Xo|=x,g=4;break e}x=di,di=g,x!==null&&(di===null?di=x:di.push.apply(di,x))}g=S}if(x=!1,g!==2)continue}}if(g===1){du(n,0),za(n,a,0,!0);break}e:{switch(f=n,x=g,x){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:za(f,a,Ei,!Ua);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(g=Gf+300-Ti(),10<g)){if(za(f,a,Ei,!Ua),Qd(f,0,!0)!==0)break e;Hr=a,f.timeoutHandle=vA(WM.bind(null,f,c,di,kf,ax,a,Ei,Xo,cu,Ua,x,"Throttled",-0,0),g);break e}WM(f,c,di,kf,ax,a,Ei,Xo,cu,Ua,x,null,-0,0)}}break}while(!0);Qn(n)}function WM(n,a,c,f,g,x,S,N,P,Z,se,oe,Q,J){if(n.timeoutHandle=-1,oe=a.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Rr},PM(a,x,oe);var Ee=(x&62914560)===x?Gf-Ti():(x&4194048)===x?kM-Ti():0;if(Ee=gF(oe,Ee),Ee!==null){Hr=x,n.cancelPendingCommit=Ee(eA.bind(null,n,a,x,c,f,g,S,N,P,se,oe,null,Q,J)),za(n,x,S,!Z);return}}eA(n,a,x,c,f,g,S,N,P)}function DU(n){for(var a=n;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var g=c[f],x=g.getSnapshot;g=g.value;try{if(!Mi(x(),g))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function za(n,a,c,f){a&=~rx,a&=~Xo,n.suspendedLanes|=a,n.pingedLanes&=~a,f&&(n.warmLanes|=a),f=n.expirationTimes;for(var g=a;0<g;){var x=31-Si(g),S=1<<x;f[x]=-1,g&=~S}c!==0&&sS(n,c,a)}function Hf(){return(pt&6)===0?(_h(0),!1):!0}
vendor: 3,651 bytes, line 48
48function cx(){if(Je!==null){if(_t===0)var n=Je.return;else n=Je,Dr=Po=null,N0(n),su=null,sh=0,n=Je;for(;n!==null;)SM(n.alternate,n),n=n.return;Je=null}}function du(n,a){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,KU(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),Hr=0,cx(),Rt=n,Je=c=Cr(n.current,null),rt=a,_t=0,Ri=null,Ua=!1,uu=Vc(n,a),nx=!1,cu=Ei=rx=Xo=Fa=Xt=0,di=xh=null,ax=!1,(a&8)!==0&&(a|=a&32);var f=n.entangledLanes;if(f!==0)for(n=n.entanglements,f&=a;0<f;){var g=31-Si(f),x=1<<g;a|=n[g],f&=~x}return kr=a,cf(),c}function XM(n,a){ke=null,X.H=ch,a===tu||a===xf?(a=u1(),_t=3):a===p0?(a=u1(),_t=4):_t=a===k0?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ri=a,Je===null&&(Xt=1,Df(n,tn(a,n.current)))}function jM(){var n=Ni.current;return n===null?!0:(rt&4194048)===rt?an===null:(rt&62914560)===rt||(rt&536870912)!==0?n===an:!1}function YM(){var n=X.H;return X.H=ch,n===null?ch:n}function ZM(){var n=X.A;return X.A=CU,n}function qf(){Xt=4,Ua||(rt&4194048)!==rt&&Ni.current!==null||(uu=!0),(Fa&134217727)===0&&(Xo&134217727)===0||Rt===null||za(Rt,rt,Ei,!1)}function hx(n,a,c){var f=pt;pt|=2;var g=YM(),x=ZM();(Rt!==n||rt!==a)&&(kf=null,du(n,a)),a=!1;var S=Xt;e:do try{if(_t!==0&&Je!==null){var N=Je,P=Ri;switch(_t){case 8:cx(),S=6;break e;case 3:case 2:case 9:case 6:Ni.current===null&&(a=!0);var Z=_t;if(_t=0,Ri=null,fu(n,N,P,Z),c&&uu){S=0;break e}break;default:Z=_t,_t=0,Ri=null,fu(n,N,P,Z)}}UU(),S=Xt;break}catch(se){XM(n,se)}while(!0);return a&&n.shellSuspendCounter++,Dr=Po=null,pt=f,X.H=g,X.A=x,Je===null&&(Rt=null,rt=0,cf()),S}function UU(){for(;Je!==null;)QM(Je)}function FU(n,a){var c=pt;pt|=2;var f=YM(),g=ZM();Rt!==n||rt!==a?(kf=null,If=Ti()+500,du(n,a)):uu=Vc(n,a);e:do try{if(_t!==0&&Je!==null){a=Je;var x=Ri;t:switch(_t){case 1:_t=0,Ri=null,fu(n,a,x,1);break;case 2:case 9:if(o1(x)){_t=0,Ri=null,KM(a);break}a=function(){_t!==2&&_t!==9||Rt!==n||(_t=7),Qn(n)},x.then(a,a);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:o1(x)?(_t=0,Ri=null,KM(a)):(_t=0,Ri=null,fu(n,a,x,7));break;case 5:var S=null;switch(Je.tag){case 26:S=Je.memoizedState;case 5:case 27:var N=Je;if(S?zA(S):N.stateNode.complete){_t=0,Ri=null;var P=N.sibling;if(P!==null)Je=P;else{var Z=N.return;Z!==null?(Je=Z,$f(Z)):Je=null}break t}}_t=0,Ri=null,fu(n,a,x,5);break;case 6:_t=0,Ri=null,fu(n,a,x,6);break;case 8:cx(),Xt=6;break e;default:throw Error(s(462))}}LU();break}catch(se){XM(n,se)}while(!0);return Dr=Po=null,X.H=f,X.A=g,pt=c,Je!==null?0:(Rt=null,rt=0,cf(),Xt)}function LU(){for(;Je!==null&&!Ay();)QM(Je)}function QM(n){var a=TM(n.alternate,n,kr);n.memoizedProps=n.pendingProps,a===null?$f(n):Je=a}function KM(n){var a=n,c=a.alternate;switch(a.tag){case 15:case 0:a=mM(c,a,a.pendingProps,a.type,void 0,rt);break;case 11:a=mM(c,a,a.pendingProps,a.type.render,a.ref,rt);break;case 5:N0(a);default:SM(c,a),a=Je=ZS(a,kr),a=TM(c,a,kr)}n.memoizedProps=n.pendingProps,a===null?$f(n):Je=a}function fu(n,a,c,f){Dr=Po=null,N0(a),su=null,sh=0;var g=a.return;try{if(SU(n,g,a,c,rt)){Xt=1,Df(n,tn(c,n.current)),Je=null;return}}catch(x){if(g!==null)throw Je=g,x;Xt=1,Df(n,tn(c,n.current)),Je=null;return}a.flags&32768?(ot||f===1?n=!0:uu||(rt&536870912)!==0?n=!1:(Ua=n=!0,(f===2||f===9||f===3||f===6)&&(f=Ni.current,f!==null&&f.tag===13&&(f.flags|=16384))),JM(a,n)):$f(a)}function $f(n){var a=n;do{if((a.flags&32768)!==0){JM(a,Ua);return}n=a.return;var c=NU(a.alternate,a,kr);if(c!==null){Je=c;return}if(a=a.sibling,a!==null){Je=a;return}Je=a=n}while(a!==null);Xt===0&&(Xt=5)}function JM(n,a){do{var c=wU(n.alternate,n);if(c!==null){c.flags&=32767,Je=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deleti
vendor: 14,153 bytes, line 48
48ons=null),!a&&(n=n.sibling,n!==null)){Je=n;return}Je=n=c}while(n!==null);Xt=6,Je=null}function eA(n,a,c,f,g,x,S,N,P){n.cancelPendingCommit=null;do Wf();while(hs!==0);if((pt&6)!==0)throw Error(s(327));if(a!==null){if(a===n.current)throw Error(s(177));if(x=a.lanes|a.childLanes,x|=Jy,pD(n,c,x,S,N,P),n===Rt&&(Je=Rt=null,rt=0),hu=a,Oa=n,Hr=c,ox=x,lx=g,HM=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,VU(Xd,function(){return rA(),null})):(n.callbackNode=null,n.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=X.T,X.T=null,g=ne.p,ne.p=2,S=pt,pt|=4;try{RU(n,a,c)}finally{pt=S,ne.p=g,X.T=f}}hs=1,tA(),sA(),iA()}}function tA(){if(hs===1){hs=0;var n=Oa,a=hu,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=X.T,X.T=null;var f=ne.p;ne.p=2;var g=pt;pt|=4;try{LM(a,n);var x=Sx,S=IS(n.containerInfo),N=x.focusedElem,P=x.selectionRange;if(S!==N&&N&&N.ownerDocument&&GS(N.ownerDocument.documentElement,N)){if(P!==null&&jy(N)){var Z=P.start,se=P.end;if(se===void 0&&(se=Z),"selectionStart"in N)N.selectionStart=Z,N.selectionEnd=Math.min(se,N.value.length);else{var oe=N.ownerDocument||document,Q=oe&&oe.defaultView||window;if(Q.getSelection){var J=Q.getSelection(),Ee=N.textContent.length,Pe=Math.min(P.start,Ee),At=P.end===void 0?Pe:Math.min(P.end,Ee);!J.extend&&Pe>At&&(S=At,At=Pe,Pe=S);var W=VS(N,Pe),I=VS(N,At);if(W&&I&&(J.rangeCount!==1||J.anchorNode!==W.node||J.anchorOffset!==W.offset||J.focusNode!==I.node||J.focusOffset!==I.offset)){var Y=oe.createRange();Y.setStart(W.node,W.offset),J.removeAllRanges(),Pe>At?(J.addRange(Y),J.extend(I.node,I.offset)):(Y.setEnd(I.node,I.offset),J.addRange(Y))}}}}for(oe=[],J=N;J=J.parentNode;)J.nodeType===1&&oe.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<oe.length;N++){var re=oe[N];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}np=!!vx,Sx=vx=null}finally{pt=g,ne.p=f,X.T=c}}n.current=a,hs=2}}function sA(){if(hs===2){hs=0;var n=Oa,a=hu,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=X.T,X.T=null;var f=ne.p;ne.p=2;var g=pt;pt|=4;try{CM(n,a.alternate,a)}finally{pt=g,ne.p=f,X.T=c}}hs=3}}function iA(){if(hs===4||hs===3){hs=0,Ny();var n=Oa,a=hu,c=Hr,f=HM;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?hs=5:(hs=0,hu=Oa=null,nA(n,n.pendingLanes));var g=n.pendingLanes;if(g===0&&(La=null),Ey(c),a=a.stateNode,vi&&typeof vi.onCommitFiberRoot=="function")try{vi.onCommitFiberRoot(Pc,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=X.T,g=ne.p,ne.p=2,X.T=null;try{for(var x=n.onRecoverableError,S=0;S<f.length;S++){var N=f[S];x(N.value,{componentStack:N.stack})}}finally{X.T=a,ne.p=g}}(Hr&3)!==0&&Wf(),Qn(n),g=n.pendingLanes,(c&261930)!==0&&(g&42)!==0?n===ux?bh++:(bh=0,ux=n):bh=0,_h(0)}}function nA(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,eh(a)))}function Wf(){return tA(),sA(),iA(),rA()}function rA(){if(hs!==5)return!1;var n=Oa,a=ox;ox=0;var c=Ey(Hr),f=X.T,g=ne.p;try{ne.p=32>c?32:c,X.T=null,c=lx,lx=null;var x=Oa,S=Hr;if(hs=0,hu=Oa=null,Hr=0,(pt&6)!==0)throw Error(s(331));var N=pt;if(pt|=4,GM(x.current),zM(x,x.current,S,c),pt=N,_h(0,!1),vi&&typeof vi.onPostCommitFiberRoot=="function")try{vi.onPostCommitFiberRoot(Pc,x)}catch{}return!0}finally{ne.p=g,X.T=f,nA(n,a)}}function aA(n,a,c){a=tn(c,a),a=I0(n.stateNode,a,2),n=Ea(n,a,2),n!==null&&(Gc(n,2),Qn(n))}function Tt(n,a,c){if(n.tag===3)aA(n,n,c);else for(;a!==null;){if(a.tag===3){aA(a,n,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(La===null||!La.has(f))){n=tn(c,n),c=oM(2),f=Ea(a,c,2),f!==null&&(lM(c,f,a,n),Gc(f,2),Qn(f));break}}a=a.return}}function dx(n,a,c){var f=n.pingCache;if(f===null){f=n.pingCache=new BU;var g=new Set;f.set(a,g)}else g=f.get(a),g===void 0&&(g=new Set,f.set(a,g));g.has(c)||(nx=!0,g.add(c),n=OU.bind(null,n,a,c),a.then(n,n))}function OU(n,a,c){var f=n.pingCache;f!==null&&f.delete(a),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,Rt===n&&(rt&c)===c&&(Xt===4||Xt===3&&(rt&62914560)===rt&&300>Ti()-Gf?(pt&2)===0&&du(n,0):rx|=c,cu===rt&&(cu=0)),Qn(n)}function oA(n,a){a===0&&(a=tS()),n=Lo(n,a),n!==null&&(Gc(n,a),Qn(n))}function zU(n){var a=n.memoizedState,c=0;a!==null&&(c=a.retryLane),oA(n,c)}function PU(n,a){var c=0;switch(n.tag){case 31:case 13:var f=n.stateNode,g=n.memoizedState;g!==null&&(c=g.retryLane);break;case 19:f=n.stateNode;break;case 22:f=n.stateNode._retryCache;break;default:throw Error(s(314))}f!==null&&f.delete(a),oA(n,c)}function VU(n,a){return Oc(n,a)}var Xf=null,pu=null,fx=!1,jf=!1,px=!1,Pa=0;function Qn(n){n!==pu&&n.next===null&&(pu===null?Xf=pu=n:pu=pu.next=n),jf=!0,fx||(fx=!0,IU())}function _h(n,a){if(!px&&jf){px=!0;do for(var c=!1,f=Xf;f!==null;){if(n!==0){var g=f.pendingLanes;if(g===0)var x=0;else{var S=f.suspendedLanes,N=f.pingedLanes;x=(1<<31-Si(42|n)+1)-1,x&=g&~(S&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,hA(f,x))}else x=rt,x=Qd(f,f===Rt?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(x&3)===0||Vc(f,x)||(c=!0,hA(f,x));f=f.next}while(c);px=!1}}function GU(){lA()}function lA(){jf=fx=!1;var n=0;Pa!==0&&QU()&&(n=Pa);for(var a=Ti(),c=null,f=Xf;f!==null;){var g=f.next,x=uA(f,a);x===0?(f.next=null,c===null?Xf=g:c.next=g,g===null&&(pu=c)):(c=f,(n!==0||(x&3)!==0)&&(jf=!0)),f=g}hs!==0&&hs!==5||_h(n),Pa!==0&&(Pa=0)}function uA(n,a){for(var c=n.suspendedLanes,f=n.pingedLanes,g=n.expirationTimes,x=n.pendingLanes&-62914561;0<x;){var S=31-Si(x),N=1<<S,P=g[S];P===-1?((N&c)===0||(N&f)!==0)&&(g[S]=fD(N,a)):P<=a&&(n.expiredLanes|=N),x&=~N}if(a=Rt,c=rt,c=Qd(n,n===a?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f=n.callbackNode,c===0||n===a&&(_t===2||_t===9)||n.cancelPendingCommit!==null)return f!==null&&f!==null&&zc(f),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||Vc(n,c)){if(a=c&-c,a===n.callbackPriority)return a;switch(f!==null&&zc(f),Ey(c)){case 2:case 8:c=Jv;break;case 32:c=Xd;break;case 268435456:c=eS;break;default:c=Xd}return f=cA.bind(null,n),c=Oc(c,f),n.callbackPriority=a,n.callbackNode=c,a}return f!==null&&f!==null&&zc(f),n.callbackPriority=2,n.callbackNode=null,2}function cA(n,a){if(hs!==0&&hs!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(Wf()&&n.callbackNode!==c)return null;var f=rt;return f=Qd(n,n===Rt?f:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f===0?null:($M(n,f,a),uA(n,Ti()),n.callbackNode!=null&&n.callbackNode===c?cA.bind(null,n):null)}function hA(n,a){if(Wf())return null;$M(n,a,!0)}function IU(){JU(function(){(pt&6)!==0?Oc(Kv,GU):lA()})}function mx(){if(Pa===0){var n=Jl;n===0&&(n=jd,jd<<=1,(jd&261888)===0&&(jd=256)),Pa=n}return Pa}function dA(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:tf(""+n)}function fA(n,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,n.id&&c.setAttribute("form",n.id),a.parentNode.insertBefore(c,a),n=new FormData(n),c.parentNode.removeChild(c),n}function kU(n,a,c,f,g){if(a==="submit"&&c&&c.stateNode===g){var x=dA((g[oi]||null).action),S=f.submitter;S&&(a=(a=S[oi]||null)?dA(a.formAction):S.getAttribute("formAction"),a!==null&&(x=a,S=null));var N=new af("action","action",null,f,g);n.push({event:N,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Pa!==0){var P=S?fA(g,S):new FormData(g);L0(c,{pending:!0,data:P,method:g.method,action:x},null,P)}}else typeof x=="function"&&(N.preventDefault(),P=S?fA(g,S):new FormData(g),L0(c,{pending:!0,data:P,method:g.method,action:x},x,P))},currentTarget:g}]})}}for(var gx=0;gx<Ky.length;gx++){var yx=Ky[gx],HU=yx.toLowerCase(),qU=yx[0].toUpperCase()+yx.slice(1);En(HU,"on"+qU)}En(qS,"onAnimationEnd"),En($S,"onAnimationIteration"),En(WS,"onAnimationStart"),En("dblclick","onDoubleClick"),En("focusin","onFocus"),En("focusout","onBlur"),En(aU,"onTransitionRun"),En(oU,"onTransitionStart"),En(lU,"onTransitionCancel"),En(XS,"onTransitionEnd"),Vl("onMouseEnter",["mouseout","mouseover"]),Vl("onMouseLeave",["mouseout","mouseover"]),Vl("onPointerEnter",["pointerout","pointerover"]),Vl("onPointerLeave",["pointerout","pointerover"]),Bo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Th="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),$U=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Th));function pA(n,a){a=(a&4)!==0;for(var c=0;c<n.length;c++){var f=n[c],g=f.event;f=f.listeners;e:{var x=void 0;if(a)for(var S=f.length-1;0<=S;S--){var N=f[S],P=N.instance,Z=N.currentTarget;if(N=N.listener,P!==x&&g.isPropagationStopped())break e;x=N,g.currentTarget=Z;try{x(g)}catch(se){uf(se)}g.currentTarget=null,x=P}else for(S=0;S<f.length;S++){if(N=f[S],P=N.instance,Z=N.currentTarget,N=N.listener,P!==x&&g.isPropagationStopped())break e;x=N,g.currentTarget=Z;try{x(g)}catch(se){uf(se)}g.currentTarget=null,x=P}}}}function et(n,a){var c=a[Cy];c===void 0&&(c=a[Cy]=new Set);var f=n+"__bubble";c.has(f)||(mA(a,n,2,!1),c.add(f))}function xx(n,a,c){var f=0;a&&(f|=4),mA(c,n,f,a)}var Yf="_reactListening"+Math.random().toString(36).slice(2);function bx(n){if(!n[Yf]){n[Yf]=!0,lS.forEach(function(c){c!=="selectionchange"&&($U.has(c)||xx(c,!1,n),xx(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Yf]||(a[Yf]=!0,xx("selectionchange",!1,a))}}function mA(n,a,c,f){switch(qA(a)){case 2:var g=bF;break;case 8:g=_F;break;default:g=Fx}c=g.bind(null,a,c,n),g=void 0,!Vy||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),f?g!==void 0?n.addEventListener(a,c,{capture:!0,passive:g}):n.addEventListener(a,c,!0):g!==void 0?n.addEventListener(a,c,{passive:g}):n.addEventListener(a,c,!1)}function _x(n,a,c,f,g){var x=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var S=f.tag;if(S===3||S===4){var N=f.stateNode.containerInfo;if(N===g)break;if(S===4)for(S=f.return;S!==null;){var P=S.tag;if((P===3||P===4)&&S.stateNode.containerInfo===g)return;S=S.return}for(;N!==null;){if(S=Ol(N),S===null)return;if(P=S.tag,P===5||P===6||P===26||P===27){f=x=S;continue e}N=N.parentNode}}f=f.return}_S(function(){var Z=x,se=zy(c),oe=[];e:{var Q=jS.get(n);if(Q!==void 0){var J=af,Ee=n;switch(n){case"keypress":if(nf(c)===0)break e;case"keydown":case"keyup":J=PD;break;case"focusin":Ee="focus",J=Hy;break;case"focusout":Ee="blur",J=Hy;break;case"beforeblur":case"afterblur":J=Hy;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=SS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=ND;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=ID;break;case qS:case $S:case WS:J=ED;break;case XS:J=HD;break;case"scroll":case"scrollend":J=MD;break;case"wheel":J=$D;break;case"copy":case"cut":case"paste":J=BD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=AS;break;case"toggle":case"beforetoggle":J=XD}var Pe=(a&4)!==0,At=!Pe&&(n==="scroll"||n==="scrollend"),W=Pe?Q!==null?Q+"Capture":null:Q;Pe=[];for(var I=Z,Y;I!==null;){var re=I;if(Y=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||Y===null||W===null||(re=Hc(I,W),re!=null&&Pe.push(vh(I,re,Y))),At)break;I=I.return}0<Pe.length&&(Q=new J(Q,Ee,null,c,se),oe.push({event:Q,listeners:Pe}))}}if((a&7)===0){e:{if(Q=n==="mouseover"||n==="pointerover",J=n==="mouseout"||n==="pointerout",Q&&c!==Oy&&(Ee=c.relatedTarget||c.fromElement)&&(Ol(Ee)||Ee[Ll]))break e;if((J||Q)&&(Q=se.window===se?se:(Q=se.ownerDocument)?Q.defaultView||Q.parentWindow:window,J?(Ee=c.relatedTarget||c.toElement,J=Z,Ee=Ee?Ol(Ee):null,Ee!==null&&(At=r(Ee),Pe=Ee.tag,Ee!==At||Pe!==5&&Pe!==27&&Pe!==6)&&(Ee=null)):(J=null,Ee=Z),J!==Ee)){if(Pe=SS,re="onMouseLeave",W="onMouseEnter",I="mouse",(n==="pointerout"||n==="pointerover")&&(Pe=AS,re="onPointerLeave",W="onPointerEnter",I="pointer"),At=J==null?Q:kc(J),Y=Ee==null?Q:kc(Ee),Q=new Pe(re,I+"leave",J,c,se),Q.target=At,Q.relatedTarget=Y,re=null,Ol(se)===Z&&(Pe=new Pe(W,I+"enter",Ee,c,se),Pe.target=Y,Pe.relatedTarget=At,re=Pe),At=re,J&&Ee)t:{for(Pe=WU,W=J,I=Ee,Y=0,re=W;re;re=Pe(re))Y++;re=0;for(var Oe=I;Oe;Oe=Pe(Oe))re++;for(;0<Y-re;)W=Pe(W),Y--;for(;0<re-Y;)I=Pe(I),re--;for(;Y--;){if(W===I||I!==null&&W===I.alternate){Pe=W;break t}W=Pe(W),I=Pe(I)}Pe=null}else Pe=null;J!==null&&gA(oe,Q,J,Pe,!1),Ee!==null&&At!==null&&gA(oe,At,Ee,Pe,!0)}}e:{if(Q=Z?kc(Z):window,J=Q.nodeName&&Q.nodeName.toLowerCase(),J==="select"||J==="input"&&Q.type==="file")var dt=US;else if(BS(Q))if(FS)dt=iU;else{dt=tU;var Ue=eU}else J=Q.nodeName,!J||J.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?Z&&Ly(Z.elementType)&&(dt=US):dt=sU;if(dt&&(dt=dt(n,Z))){DS(oe,dt,c,se);break e}Ue&&Ue(n,Q,Z),n==="focusout"&&Z&&Q.type==="number"&&Z.memoizedProps.value!=null&&Fy(Q,"number",Q.value)}switch(Ue=Z?kc(Z):window,n){case"focusin":(BS(Ue)||Ue.contentEditable==="true")&&($l=Ue,Yy=Z,Qc=null);break;case"focusout":Qc=Yy=$l=null;break;case"mousedown":Zy=!0;break;case"contextmenu":case"mouseup":case"dragend":Zy=!1,kS(oe,c,se);break;case"selectionchange":if(rU)break;case"keydown":case"keyup":kS(oe,c,se)}var qe;if($y)e:{switch(n){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}
vendor: 4,254 bytes, lines 48-49
48else ql?ES(n,c)&&(at="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(at="onCompositionStart");at&&(NS&&c.locale!=="ko"&&(ql||at!=="onCompositionStart"?at==="onCompositionEnd"&&ql&&(qe=TS()):(va=se,Gy="value"in va?va.value:va.textContent,ql=!0)),Ue=Zf(Z,at),0<Ue.length&&(at=new MS(at,n,null,c,se),oe.push({event:at,listeners:Ue}),qe?at.data=qe:(qe=CS(c),qe!==null&&(at.data=qe)))),(qe=YD?ZD(n,c):QD(n,c))&&(at=Zf(Z,"onBeforeInput"),0<at.length&&(Ue=new MS("onBeforeInput","beforeinput",null,c,se),oe.push({event:Ue,listeners:at}),Ue.data=qe)),kU(oe,n,Z,c,se)}pA(oe,a)})}function vh(n,a,c){return{instance:n,listener:a,currentTarget:c}}function Zf(n,a){for(var c=a+"Capture",f=[];n!==null;){var g=n,x=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||x===null||(g=Hc(n,c),g!=null&&f.unshift(vh(n,g,x)),g=Hc(n,a),g!=null&&f.push(vh(n,g,x))),n.tag===3)return f;n=n.return}return[]}function WU(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function gA(n,a,c,f,g){for(var x=a._reactName,S=[];c!==null&&c!==f;){var N=c,P=N.alternate,Z=N.stateNode;if(N=N.tag,P!==null&&P===f)break;N!==5&&N!==26&&N!==27||Z===null||(P=Z,g?(Z=Hc(c,x),Z!=null&&S.unshift(vh(c,Z,P))):g||(Z=Hc(c,x),Z!=null&&S.push(vh(c,Z,P)))),c=c.return}S.length!==0&&n.push({event:a,listeners:S})}var XU=/\r\n?/g,jU=/\u0000|\uFFFD/g;function yA(n){return(typeof n=="string"?n:""+n).replace(XU,` 49`).replace(jU,"")}function xA(n,a){return a=yA(a),yA(n)===a}function Mt(n,a,c,f,g,x){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||Il(n,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&Il(n,""+f);break;case"className":Jd(n,"class",f);break;case"tabIndex":Jd(n,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Jd(n,c,f);break;case"style":xS(n,f,x);break;case"data":if(a!=="object"){Jd(n,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){n.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=tf(""+f),n.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){n.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(a!=="input"&&Mt(n,a,"name",g.name,g,null),Mt(n,a,"formEncType",g.formEncType,g,null),Mt(n,a,"formMethod",g.formMethod,g,null),Mt(n,a,"formTarget",g.formTarget,g,null)):(Mt(n,a,"encType",g.encType,g,null),Mt(n,a,"method",g.method,g,null),Mt(n,a,"target",g.target,g,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=tf(""+f),n.setAttribute(c,f);break;case"onClick":f!=null&&(n.onclick=Rr);break;case"onScroll":f!=null&&et("scroll",n);break;case"onScrollEnd":f!=null&&et("scrollend",n);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(s(61));if(c=f.__html,c!=null){if(g.children!=null)throw Error(s(60));n.innerHTML=c}}break;case"multiple":n.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":n.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){n.removeAttribute("xlink:href");break}c=tf(""+f),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""+f):n.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInl
49ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":f===!0?n.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,f):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?n.setAttribute(c,f):n.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?n.removeAttribute(c):n.setAttribute(c,f);break;case"popover":et("beforetoggle",n),et("toggle",n),Kd(n,"popover",f);break;case"xlinkActuate":wr(n,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":wr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":wr(n,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":wr(n,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":wr(n,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":wr(n,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":wr(n,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":wr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":wr(n,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Kd(n,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=vD.get(c)||c,Kd(n,c,f))}}function Tx(n,a,c,f,g,x){switch(c){case"style":xS(n,f,x);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(s(61));if(c=f.__html,c!=null){if(g.children!=null)throw Error(s(60));n.innerHTML=c}}break;case"children":typeof f=="string"?Il(n,f):(typeof f=="number"||typeof f=="bigint")&&Il(n,""+f);break;case"onScroll":f!=null&&et("scroll",n);break;case"onScrollEnd":f!=null&&et("scrollend",n);break;case"onClick":f!=null&&(n.onclick=Rr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!uS.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),a=c.slice(2,g?c.length-7:void 0),x=n[oi]||null,x=x!=null?x[c]:null,typeof x=="function"&&n.removeEventListener(a,x,g),typeof f=="function")){typeof x!="function"&&x!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(a,f,g);break e}c in n?n[c]=f:f===!0?n.setAttribute(c,""):Kd(n,c,f)}}}function Rs(n,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",n),et("load",n);var f=!1,g=!1,x;for(x in c)if(c.hasOwnProperty(x)){var S=c[x];if(S!=null)switch(x){case"src":f=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Mt(n,a,x,S,c,null)}}g&&Mt(n,a,"srcSet",c.srcSet,c,null),f&&Mt(n,a,"src",c.src,c,null);return;case"input":et("invalid",n);var N=x=S=g=null,P=null,Z=null;for(f in c)if(c.hasOwnProperty(f)){var se=c[f];if(se!=null)switch(f){case"name":g=se;break;case"type":S=se;break;case"checked":P=se;break;case"defaultChecked":Z=se;break;case"value":x=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(s(137,a));break;default:Mt(n,a,f,se,c,null)}}pS(n,x,N,P,Z,S,g,!1);return;case"select":et("invalid",n),f=S=x=null;for(g in c)if(c.hasOwnProperty(g)&&(N=c[g],N!=null))switch(g){case"value":x=N;break;case"defaultValue":S=N;break;case"multiple":f=N;default:Mt(n,a,g,N,c,null)}a=x,c=S,n.multiple=!!f,a!=null?Gl(n,!!f,a,!1):c!=null&&Gl(n,!!f,c,!0);return;case"textarea":et("invalid",n),x=g=f=null;for(S in c)if(c.hasOwnProperty(S)&&(N=c[S],N!=null))switch(S){case"value":f=N;break;case"defaultValue":g=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(s(91));break;default:Mt(n,a,S,N,c,null)}gS(n,f,g,x);return;case"option":for(P in c)if(c.hasOwnProperty(P)&&(f=c[P],f!=null))switch(P){case"selected":n.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Mt(n,a,P,f,c,null)}return;case"dialog":et("beforetoggle",n),et("toggle",n),et("cancel",n),et("close",n);break;case"iframe":case"object":et("load",n);break;case"video":case"audio":for(f=0;f<Th.length;f++)et(Th[f],n);break;case"image":et("error",n),et("load",n);break;case"details":et("toggle",n);break;case"embed":case"source":case"link":et("error",n),et("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in c)if(c.hasOwnProperty(Z)&&(f=c[Z],f!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Mt(n,a,Z,f,c,null)}return;default:if(Ly(a)){for(se in c)c.hasOwnProperty(se)&&(f=c[se],f!==void 0&&Tx(n,a,se,f,c,void 0));return}}for(N in c)c.hasOwnProperty(N)&&(f=c[N],f!=null&&Mt(n,a,N,f,c,null))}function YU(n,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,x=null,S=null,N=null,P=null,Z=null,se=null;for(J in c){var oe=c[J];if(c.hasOwnProperty(J)&&oe!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":P=oe;default:f.hasOwnProperty(J)||Mt(n,a,J,null,f,oe)}}for(var Q in f){var J=f[Q];if(oe=c[Q],f.hasOwnProperty(Q)&&(J!=null||oe!=null))switch(Q){case"type":x=J;break;case"name":g=J;break;case"checked":Z=J;break;case"defaultChecked":se=J;break;case"value":S=J;break;case"defaultValue":N=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,a));break;default:J!==oe&&Mt(n,a,Q,J,f,oe)}}Uy(n,S,N,P,Z,se,x,g);return;case"select":J=S=N=Q=null;for(x in c)if(P=c[x],c.hasOwnProperty(x)&&P!=null)switch(x){case"value":break;case"multiple":J=P;default:f.hasOwnProperty(x)||Mt(n,a,x,null,f,P)}for(g in f)if(x=f[g],P=c[g],f.hasOwnProperty(g)&&(x!=null||P!=null))switch(g){case"value":Q=x;break;case"defaultValue":N=x;break;case"multiple":S=x;default:x!==P&&Mt(n,a,g,x,f,P)}a=N,c=S,f=J,Q!=null?Gl(n,!!c,Q,!1):!!f!=!!c&&(a!=null?Gl(n,!!c,a,!0):Gl(n,!!c,c?[]:"",!1));return;case"textarea":J=Q=null;for(N in c)if(g=c[N],c.hasOwnProperty(N)&&g!=null&&!f.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Mt(n,a,N,null,f,g)}for(S in f)if(g=f[S],x=c[S],f.hasOwnProperty(S)&&(g!=null||x!=null))switch(S){case"value":Q=g;break;case"defaultValue":J=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(s(91));break;default:g!==x&&Mt(n,a,S,g,f,x)}mS(n,Q,J);return;case"option":for(var Ee in c)if(Q=c[Ee],c.hasOwnProperty(Ee)&&Q!=null&&!f.hasOwnProperty(Ee))switch(Ee){case"selected":n.selected=!1;break;default:Mt(n,a,Ee,null,f,Q)}for(P in f)if(Q=f[P],J=c[P],f.hasOwnProperty(P)&&Q!==J&&(Q!=null||J!=null))switch(P){case"selected":n.selected=Q&&typeof Q!="function"&&typeof Q!="symbol";break;default:Mt(n,a,P,Q,f,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Pe in c)Q=c[Pe],c.hasOwnProperty(Pe)&&Q!=null&&!f.hasOwnProperty(Pe)&&Mt(n,a,Pe,null,f,Q);for(Z in f)if(Q=f[Z],J=c[Z],f.hasOwnProperty(Z)&&Q!==J&&(Q!=null||J!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(s(137,a));break;default:Mt(n,a,Z,Q,f,J)}return;default:if(Ly(a)){for(var At in c)Q=c[At],c.hasOwnProperty(At)&&Q!==void 0&&!f.hasOwnProperty(At)&&Tx(n,a,At,void 0,f,Q);for(se in f)Q=f[se],J=c[se],!f.hasOwnProperty(se)||Q===J||Q===void 0&&J===void 0||Tx(n,a,se,Q,f,J);return}}for(var W in c)Q=c[W],c.hasOwnProperty(W)&&Q!=null&&!f.hasOwnProperty(W)&&Mt(n,a,W,null,f,Q);for(oe in f)Q=f[oe],J=c[oe],!f.hasOwnProperty(oe)||Q===J||Q==null&&J==null||Mt(n,a,oe,Q,f,J)}function bA(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ZU(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var g=c[f],x=g.transferSize,S=g.initiatorType,N=g.duration;if(x&&N&&bA(S)){for(S=0,N=g.responseEnd,f+=1;f<c.length;f++){var P=c[f],Z=P.startTime;if(Z>N)break;var se=P.transferSize,oe=P.initiatorType;se&&bA(oe)&&(P=P.responseEnd,S+=se*(P<N?1:(N-Z)/(P-Z)))}if(--f,a+=8*(x+S)/(g.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?
vendor: 16,241 bytes, line 49
49n:5}var vx=null,Sx=null;function Qf(n){return n.nodeType===9?n:n.ownerDocument}function _A(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function TA(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Mx(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Ax=null;function QU(){var n=window.event;return n&&n.type==="popstate"?n===Ax?!1:(Ax=n,!0):(Ax=null,!1)}var vA=typeof setTimeout=="function"?setTimeout:void 0,KU=typeof clearTimeout=="function"?clearTimeout:void 0,SA=typeof Promise=="function"?Promise:void 0,JU=typeof queueMicrotask=="function"?queueMicrotask:typeof SA<"u"?function(n){return SA.resolve(null).then(n).catch(eF)}:vA;function eF(n){setTimeout(function(){throw n})}function Va(n){return n==="head"}function MA(n,a){var c=a,f=0;do{var g=c.nextSibling;if(n.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(f===0){n.removeChild(g),xu(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Sh(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,Sh(c);for(var x=c.firstChild;x;){var S=x.nextSibling,N=x.nodeName;x[Ic]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=S}}else c==="body"&&Sh(n.ownerDocument.body);c=g}while(c);xu(a)}function AA(n,a){var c=n;n=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=f}while(c)}function Nx(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Nx(c),By(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function tF(n,a,c,f){for(;n.nodeType===1;){var g=c;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(f){if(!n[Ic])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(x=n.getAttribute("rel"),x==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(x!==g.rel||n.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||n.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||n.getAttribute("title")!==(g.title==null?null:g.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(x=n.getAttribute("src"),(x!==(g.src==null?null:g.src)||n.getAttribute("type")!==(g.type==null?null:g.type)||n.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&x&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var x=g.name==null?null:""+g.name;if(g.type==="hidden"&&n.getAttribute("name")===x)return n}else return n;if(n=on(n.nextSibling),n===null)break}return null}function sF(n,a,c){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=on(n.nextSibling),n===null))return null;return n}function NA(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=on(n.nextSibling),n===null))return null;return n}function wx(n){return n.data==="$?"||n.data==="$~"}function Rx(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function iF(n,a){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),n._reactRetry=f}}function on(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Ex=null;function wA(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(a===0)return on(n.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}n=n.nextSibling}return null}function RA(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return n;a--}else c!=="/$"&&c!=="/&"||a++}n=n.previousSibling}return null}function EA(n,a,c){switch(a=Qf(c),n){case"html":if(n=a.documentElement,!n)throw Error(s(452));return n;case"head":if(n=a.head,!n)throw Error(s(453));return n;case"body":if(n=a.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function Sh(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);By(n)}var ln=new Map,CA=new Set;function Kf(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var qr=ne.d;ne.d={f:nF,r:rF,D:aF,C:oF,L:lF,m:uF,X:hF,S:cF,M:dF};function nF(){var n=qr.f(),a=Hf();return n||a}function rF(n){var a=zl(n);a!==null&&a.tag===5&&a.type==="form"?X1(a):qr.r(n)}var mu=typeof document>"u"?null:document;function BA(n,a,c){var f=mu;if(f&&typeof a=="string"&&a){var g=Ji(a);g='link[rel="'+n+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),CA.has(g)||(CA.add(g),n={rel:n,crossOrigin:c,href:a},f.querySelector(g)===null&&(a=f.createElement("link"),Rs(a,"link",n),gs(a),f.head.appendChild(a)))}}function aF(n){qr.D(n),BA("dns-prefetch",n,null)}function oF(n,a){qr.C(n,a),BA("preconnect",n,a)}function lF(n,a,c){qr.L(n,a,c);var f=mu;if(f&&n&&a){var g='link[rel="preload"][as="'+Ji(a)+'"]';a==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+Ji(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+Ji(c.imageSizes)+'"]')):g+='[href="'+Ji(n)+'"]';var x=g;switch(a){case"style":x=gu(n);break;case"script":x=yu(n)}ln.has(x)||(n=m({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:n,as:a},c),ln.set(x,n),f.querySelector(g)!==null||a==="style"&&f.querySelector(Mh(x))||a==="script"&&f.querySelector(Ah(x))||(a=f.createElement("link"),Rs(a,"link",n),gs(a),f.head.appendChild(a)))}}function uF(n,a){qr.m(n,a);var c=mu;if(c&&n){var f=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+Ji(f)+'"][href="'+Ji(n)+'"]',x=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=yu(n)}if(!ln.has(x)&&(n=m({rel:"modulepreload",href:n},a),ln.set(x,n),c.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ah(x)))return}f=c.createElement("link"),Rs(f,"link",n),gs(f),c.head.appendChild(f)}}}function cF(n,a,c){qr.S(n,a,c);var f=mu;if(f&&n){var g=Pl(f).hoistableStyles,x=gu(n);a=a||"default";var S=g.get(x);if(!S){var N={loading:0,preload:null};if(S=f.querySelector(Mh(x)))N.loading=5;else{n=m({rel:"stylesheet",href:n,"data-precedence":a},c),(c=ln.get(x))&&Cx(n,c);var P=S=f.createElement("link");gs(P),Rs(P,"link",n),P._p=new Promise(function(Z,se){P.onload=Z,P.onerror=se}),P.addEventListener("load",function(){N.loading|=1}),P.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Jf(S,a,f)}S={type:"stylesheet",instance:S,count:1,state:N},g.set(x,S)}}}function hF(n,a){qr.X(n,a);var c=mu;if(c&&n){var f=Pl(c).hoistableScripts,g=yu(n),x=f.get(g);x||(x=c.querySelector(Ah(g)),x||(n=m({src:n,async:!0},a),(a=ln.get(g))&&Bx(n,a),x=c.createElement("script"),gs(x),Rs(x,"link",n),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(g,x))}}function dF(n,a){qr.M(n,a);var c=mu;if(c&&n){var f=Pl(c).hoistableScripts,g=yu(n),x=f.get(g);x||(x=c.querySelector(Ah(g)),x||(n=m({src:n,async:!0,type:"module"},a),(a=ln.get(g))&&Bx(n,a),x=c.createElement("script"),gs(x),Rs(x,"link",n),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(g,x))}}function DA(n,a,c,f){var g=(g=Me.current)?Kf(g):null;if(!g)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=gu(c.href),c=Pl(g).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=gu(c.href);var x=Pl(g).hoistableStyles,S=x.get(n);if(S||(g=g.ownerDocument||g,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(n,S),(x=g.querySelector(Mh(n)))&&!x._p&&(S.instance=x,S.state.loading=5),ln.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},ln.set(n,c),x||fF(g,n,c,S.state))),a&&f===null)throw Error(s(528,""));return S}if(a&&f!==null)throw Error(s(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=yu(c),c=Pl(g).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function gu(n){return'href="'+Ji(n)+'"'}function Mh(n){return'link[rel="stylesheet"]['+n+"]"}function UA(n){return m({},n,{"data-precedence":n.precedence,precedence:null})}function fF(n,a,c,f){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=n.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Rs(a,"link",c),gs(a),n.head.appendChild(a))}function yu(n){return'[src="'+Ji(n)+'"]'}function Ah(n){return"script[async]"+n}function FA(n,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=n.querySelector('style[data-href~="'+Ji(c.href)+'"]');if(f)return a.instance=f,gs(f),f;var g=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(n.ownerDocument||n).createElement("style"),gs(f),Rs(f,"style",g),Jf(f,c.precedence,n),a.instance=f;case"stylesheet":g=gu(c.href);var x=n.querySelector(Mh(g));if(x)return a.state.loading|=4,a.instance=x,gs(x),x;f=UA(c),(g=ln.get(g))&&Cx(f,g),x=(n.ownerDocument||n).createElement("link"),gs(x);var S=x;return S._p=new Promise(function(N,P){S.onload=N,S.onerror=P}),Rs(x,"link",f),a.state.loading|=4,Jf(x,c.precedence,n),a.instance=x;case"script":return x=yu(c.src),(g=n.querySelector(Ah(x)))?(a.instance=g,gs(g),g):(f=c,(g=ln.get(x))&&(f=m({},c),Bx(f,g)),n=n.ownerDocument||n,g=n.createElement("script"),gs(g),Rs(g,"link",f),n.head.appendChild(g),a.instance=g);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,Jf(f,c.precedence,n));return a.instance}function Jf(n,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=f.length?f[f.length-1]:null,x=g,S=0;S<f.length;S++){var N=f[S];if(N.dataset.precedence===a)x=N;else if(x!==g)break}x?x.parentNode.insertBefore(n,x.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(n,a.firstChild))}function Cx(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Bx(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var ep=null;function LA(n,a,c){if(ep===null){var f=new Map,g=ep=new Map;g.set(c,f)}else g=ep,f=g.get(c),f||(f=new Map,g.set(c,f));if(f.has(n))return f;for(f.set(n,null),c=c.getElementsByTagName(n),g=0;g<c.length;g++){var x=c[g];if(!(x[Ic]||x[Ms]||n==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var S=x.getAttribute(a)||"";S=n+S;var N=f.get(S);N?N.push(x):f.set(S,[x])}}return f}function OA(n,a,c){n=n.ownerDocument||n,n.head.insertBefore(c,a==="title"?n.querySelector("head > title"):null)}function pF(n,a,c){if(c===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function zA(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function mF(n,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=gu(f.href),x=a.querySelector(Mh(g));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=tp.bind(n),a.then(n,n)),c.state.loading|=4,c.instance=x,gs(x);return}x=a.ownerDocument||a,f=UA(f),(g=ln.get(g))&&Cx(f,g),x=x.createElement("link"),gs(x);var S=x;S._p=new Promise(function(N,P){S.onload=N,S.onerror=P}),Rs(x,"link",f),c.instance=x}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=tp.bind(n),a.addEventListener("load",c),a.addEventListener("error",c))}}var Dx=0;function gF(n,a){return n.stylesheets&&n.count===0&&ip(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var f=setTimeout(function(){if(n.stylesheets&&ip(n,n.stylesheets),n.unsuspend){var x=n.unsuspend;n.unsuspend=null,x()}},6e4+a);0<n.imgBytes&&Dx===0&&(Dx=62500*ZU());var g=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&ip(n,n.stylesheets),n.unsuspend)){var x=n.unsuspend;n.unsuspend=null,x()}},(n.imgBytes>Dx?50:800)+a);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function tp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var sp=null;function ip(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,sp=new Map,a.forEach(yF,n),sp=null,tp.call(n))}function yF(n,a){if(!(a.state.loading&4)){var c=sp.get(n);if(c)var f=c.get(null);else{c=new Map,sp.set(n,c);for(var g=n.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<g.length;x++){var S=g[x];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(c.set(S.dataset.precedence,S),f=S)}f&&c.set(null,f)}g=a.instance,S=g.getAttribute("data-precedence"),x=c.get(S)||f,x===f&&c.set(null,g),c.set(S,g),this.count++,f=tp.bind(this),g.addEventListener("load",f),g.addEventListener("error",f),x?x.parentNode.insertBefore(g,x.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(g,n.firstChild)),a.state.loading|=4}}var Nh={$$typeof:E,Provider:null,Consumer:null,_currentValue:fe,_currentValue2:fe,_threadCount:0};function xF(n,a,c,f,g,x,S,N,P){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=wy(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wy(0),this.hiddenUpdates=wy(null),this.identifierPrefix=f,this.onUncaughtError=g,this.onCaughtError=x,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function PA(n,a,c,f,g,x,S,N,P,Z,se,oe){return n=new xF(n,a,c,S,P,Z,se,oe,
vendor: 4,385 bytes, line 49
49N),a=1,x===!0&&(a|=24),x=Ai(3,null,null,a),n.current=x,x.stateNode=n,a=h0(),a.refCount++,n.pooledCache=a,a.refCount++,x.memoizedState={element:f,isDehydrated:c,cache:a},m0(x),n}function VA(n){return n?(n=jl,n):jl}function GA(n,a,c,f,g,x){g=VA(g),f.context===null?f.context=g:f.pendingContext=g,f=Ra(a),f.payload={element:c},x=x===void 0?null:x,x!==null&&(f.callback=x),c=Ea(n,f,a),c!==null&&(fi(c,n,a),nh(c,n,a))}function IA(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<a?c:a}}function Ux(n,a){IA(n,a),(n=n.alternate)&&IA(n,a)}function kA(n){if(n.tag===13||n.tag===31){var a=Lo(n,67108864);a!==null&&fi(a,n,67108864),Ux(n,67108864)}}function HA(n){if(n.tag===13||n.tag===31){var a=Ci();a=Ry(a);var c=Lo(n,a);c!==null&&fi(c,n,a),Ux(n,a)}}var np=!0;function bF(n,a,c,f){var g=X.T;X.T=null;var x=ne.p;try{ne.p=2,Fx(n,a,c,f)}finally{ne.p=x,X.T=g}}function _F(n,a,c,f){var g=X.T;X.T=null;var x=ne.p;try{ne.p=8,Fx(n,a,c,f)}finally{ne.p=x,X.T=g}}function Fx(n,a,c,f){if(np){var g=Lx(f);if(g===null)_x(n,a,f,rp,c),$A(n,f);else if(vF(g,n,a,c,f))f.stopPropagation();else if($A(n,f),a&4&&-1<TF.indexOf(n)){for(;g!==null;){var x=zl(g);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var S=Co(x.pendingLanes);if(S!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;S;){var P=1<<31-Si(S);N.entanglements[1]|=P,S&=~P}Qn(x),(pt&6)===0&&(If=Ti()+500,_h(0))}}break;case 31:case 13:N=Lo(x,2),N!==null&&fi(N,x,2),Hf(),Ux(x,2)}if(x=Lx(f),x===null&&_x(n,a,f,rp,c),x===g)break;g=x}g!==null&&f.stopPropagation()}else _x(n,a,f,null,c)}}function Lx(n){return n=zy(n),Ox(n)}var rp=null;function Ox(n){if(rp=null,n=Ol(n),n!==null){var a=r(n);if(a===null)n=null;else{var c=a.tag;if(c===13){if(n=l(a),n!==null)return n;n=null}else if(c===31){if(n=u(a),n!==null)return n;n=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return rp=n,null}function qA(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(aD()){case Kv:return 2;case Jv:return 8;case Xd:case oD:return 32;case eS:return 268435456;default:return 32}default:return 32}}var zx=!1,Ga=null,Ia=null,ka=null,wh=new Map,Rh=new Map,Ha=[],TF="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function $A(n,a){switch(n){case"focusin":case"focusout":Ga=null;break;case"dragenter":case"dragleave":Ia=null;break;case"mouseover":case"mouseout":ka=null;break;case"pointerover":case"pointerout":wh.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rh.delete(a.pointerId)}}function Eh(n,a,c,f,g,x){return n===null||n.nativeEvent!==x?(n={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:x,targetContainers:[g]},a!==null&&(a=zl(a),a!==null&&kA(a)),n):(n.eventSystemFlags|=f,a=n.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),n)}function vF(n,a,c,f,g){switch(a){case"focusin":return Ga=Eh(Ga,n,a,c,f,g),!0;case"dragenter":return Ia=Eh(Ia,n,a,c,f,g),!0;case"mouseover":return ka=Eh(ka,n,a,c,f,g),!0;case"pointerover":var x=g.pointerId;
vendor: 5,713 bytes, line 49
49return wh.set(x,Eh(wh.get(x)||null,n,a,c,f,g)),!0;case"gotpointercapture":return x=g.pointerId,Rh.set(x,Eh(Rh.get(x)||null,n,a,c,f,g)),!0}return!1}function WA(n){var a=Ol(n.target);if(a!==null){var c=r(a);if(c!==null){if(a=c.tag,a===13){if(a=l(c),a!==null){n.blockedOn=a,aS(n.priority,function(){HA(c)});return}}else if(a===31){if(a=u(c),a!==null){n.blockedOn=a,aS(n.priority,function(){HA(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function ap(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var c=Lx(n.nativeEvent);if(c===null){c=n.nativeEvent;var f=new c.constructor(c.type,c);Oy=f,c.target.dispatchEvent(f),Oy=null}else return a=zl(c),a!==null&&kA(a),n.blockedOn=c,!1;a.shift()}return!0}function XA(n,a,c){ap(n)&&c.delete(a)}function SF(){zx=!1,Ga!==null&&ap(Ga)&&(Ga=null),Ia!==null&&ap(Ia)&&(Ia=null),ka!==null&&ap(ka)&&(ka=null),wh.forEach(XA),Rh.forEach(XA)}function op(n,a){n.blockedOn===a&&(n.blockedOn=null,zx||(zx=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,SF)))}var lp=null;function jA(n){lp!==n&&(lp=n,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){lp===n&&(lp=null);for(var a=0;a<n.length;a+=3){var c=n[a],f=n[a+1],g=n[a+2];if(typeof f!="function"){if(Ox(f||c)===null)continue;break}var x=zl(c);x!==null&&(n.splice(a,3),a-=3,L0(x,{pending:!0,data:g,method:c.method,action:f},f,g))}}))}function xu(n){function a(P){return op(P,n)}Ga!==null&&op(Ga,n),Ia!==null&&op(Ia,n),ka!==null&&op(ka,n),wh.forEach(a),Rh.forEach(a);for(var c=0;c<Ha.length;c++){var f=Ha[c];f.blockedOn===n&&(f.blockedOn=null)}for(;0<Ha.length&&(c=Ha[0],c.blockedOn===null);)WA(c),c.blockedOn===null&&Ha.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var g=c[f],x=c[f+1],S=g[oi]||null;if(typeof x=="function")S||jA(c);else if(S){var N=null;if(x&&x.hasAttribute("formAction")){if(g=x,S=x[oi]||null)N=S.formAction;else if(Ox(g)!==null)continue}else N=S.action;typeof N=="function"?c[f+1]=N:(c.splice(f,3),f-=3),jA(c)}}}function YA(){function n(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(S){return g=S})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,g=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),g!==null&&(g(),g=null)}}}function Px(n){this._internalRoot=n}up.prototype.render=Px.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var c=a.current,f=Ci();GA(c,f,n,a,null,null)},up.prototype.unmount=Px.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;GA(n.current,2,null,n,null,null),Hf(),a[Ll]=null}};function up(n){this._internalRoot=n}up.prototype.unstable_scheduleHydration=function(n){if(n){var a=rS();n={blockedOn:null,target:n,priority:a};for(var c=0;c<Ha.length&&a!==0&&a<Ha[c].priority;c++);Ha.splice(c,0,n),c===0&&WA(n)}};var ZA=e.version;if(ZA!=="19.2.0")throw Error(s(527,ZA,"19.2.0"));ne.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=d(a),n=n!==null?p(n):null,n=n===null?null:n.stateNode,n};var MF={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cp.isDisabled&&cp.supportsFiber)try{Pc=cp.inject(MF),vi=cp}catch{}}return Bh.createRoot=function(n,a){if(!i(n))throw Error(s(299));var c=!1,f="",g=iM,x=nM,S=rM;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError)),a=PA(n,1,!1,null,null,c,f,null,g,x,S,YA),n[Ll]=a.current,bx(n),new Px(a)},Bh.hydrateRoot=function(n,a,c){if(!i(n))throw Error(s(299));var f=!1,g="",x=iM,S=nM,N=rM,P=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(N=c.onRecoverableError),c.formState!==void 0&&(P=c.formState)),a=PA(n,1,!0,a,c??null,f,g,P,x,S,N,YA),a.context=VA(null),c=a.current,f=Ci(),f=Ry(f),g=Ra(f),g.callback=null,Ea(c,g,f),c=f,a.current.lanes=c,Gc(a,c),Qn(a),n[Ll]=a.current,bx(n),new up(a)},Bh.version="19.2.0",Bh}var aN;function FF(){if(aN)return Ix.exports;aN=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),Ix.exports=UF(),Ix.exports}var LF=FF();const OF=pR(LF),gR=(o,e)=>{e.forEach(t=>{o.append("images",t)})},zF=(o,e)=>new Promise((t,s)=>{const i=new Image;i.onload=()=>t(i),i.onerror=()=>s(new Error(`Could not load ${e}.`)),i.src=o}),PF=1600,VF=1400,GF=async o=>{const e=URL.createObjectURL(o);try{const t=await zF(e,`${o.name}
49 for corallite crop`);if(Math.max(t.naturalWidth,t.naturalHeight)<VF)return null;const i=Math.round(t.naturalWidth*.5),r=Math.round(t.naturalHeight*.5),l=Math.round((t.naturalWidth-i)/2),u=Math.round((t.naturalHeight-r)/2),h=Math.min(1,PF/Math.max(i,r)),d=document.createElement("canvas");d.width=Math.max(1,Math.round(i*h)),d.height=Math.max(1,Math.round(r*h));const p=d.getContext("2d");if(!p)return null;p.drawImage(t,l,u,i,r,0,0,d.width,d.height);const m=await new Promise(b=>{d.toBlob(b,"image/jpeg",.92)});if(!m)return null;const y=o.name.replace(/\.[^.]+$/,"")||"coral";return new File([m],`${y}-corallite-crop.jpg`,{type:"image/jpeg"})}catch{return null}finally{URL.revokeObjectURL(e)}},IF=async(o,e,t,s,i="fast")=>{const r=new FormData;gR(r,o);let l=!1;if(i==="accurate"&&o[0]){const u=await GF(o[0]);u&&(r.append("images",u),l=!0)}r.append("location",e),r.append("depth",t),r.append("analysisMode",i),l&&r.append("autoCrop","corallite"),r.append("analysisRequestId",s);try{const u=await fetch("/analyze",{method:"POST",body:r});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error(d.error||`Server error: ${u.status}`)}return await u.json()}catch(u){throw console.error("Analysis failed:",u),new Error(u.message||"Failed to connect to the analysis server. Make sure the backend is running.")}},kF=async o=>{const e=URL.createObjectURL(o);try{const t=await new Promise((d,p)=>{const m=new Image;m.onload=()=>d(m),m.onerror=()=>p(new Error(`Could not load ${o.name} for marker downscaling.`)),m.src=e}),i=Math.min(1,1024/Math.max(t.naturalWidth,t.naturalHeight));if(i>=1&&o.type==="image/jpeg")return o;const r=document.createElement("canvas");r.width=Math.max(1,Math.round(t.naturalWidth*i)),r.height=Math.max(1,Math.round(t.naturalHeight*i));const l=r.getContext("2d");if(!l)return o;l.drawImage(t,0,0,r.width,r.height);const u=await new Promise(d=>{r.toBlob(d,"image/jpeg",.8)});if(!u)return o;const h=o.name.replace(/\.[^.]+$/,"")||"marker-image";return new File([u],`${h}-marker.jpg`,{type:"image/jpeg"})}finally{URL.revokeObjectURL(e)}},HF=async(o,e,t,s,i)=>{const r=new FormData,l=await Promise.all(o.map(kF));gR(r,l),r.append("location",e),r.append("depth",t),r.append("analysisRequestId",i),r.append("frozen_analysis",JSON.stringify(s));try{const u=await fetch("/analyze/markers",{method:"POST",body:r}),h=await u.json().catch(()=>({diagnosticMarkers:[],marker_metadata:{schema_status:"failed",failure_reason:`Server returned ${u.status}`,analysis_request_id:i}}));return u.ok?h:{diagnosticMarkers:[],marker_metadata:{schema_status:"failed",failure_reason:h.error||`Server returned ${u.status}`,analysis_request_id:i}}}catch(u){return console.warn("Marker localization failed:",u),{diagnosticMarkers:[],marker_metadata:{schema_status:"failed",failure_reason:u.message||"Marker localization failed.",analysis_request_id:i}}}},qF=({className:o})=>k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:o,children:k.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),$F=({className:o})=>k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:o,children:k.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})}),WF=({className:o})=>k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:o,children:k.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 11.667 0l3.181-3.183m-4.991-2.691v4.992m0 0h-4.992m4.992 0-3.181-3.183a8.25 8.25 0 0 0-11.667 0L2.985 16.953"})}),XF=({className:o})=>k.jsx("div",{className:`relative flex items-center justify-center ${o}`,children:k.jsxs("div",{className:"relative w-40 h-40",children:[k.jsx("div",{className:"absolute inset-4 rounded-full border-4 border-slate-700 overflow-hidden bg-slate-900/50 shadow-[0_0_20px_rgba(14,165,233,0.2)]",children:k.jsxs("div",{className:"absolute bottom-0 left-0 w-full bg-sky-500/80 animate-fill-water",children:[k.jsx("div",{className:"absolute -top-3 left-0 w-[200%] h-6 bg-sky-4
4900/50 rounded-[40%] animate-wave"}),k.jsx("div",{className:"absolute -top-3 left-0 w-[200%] h-6 bg-sky-500/80 rounded-[35%] animate-wave-delayed"})]})}),k.jsx("div",{className:"absolute inset-0 animate-[spin_3s_linear_infinite]",children:k.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 w-3 h-3 bg-white rounded-full shadow-[0_0_10px_rgba(255,255,255,0.8)]"})})]})});/** 50 * @license 51 * Copyright 2010-2026 Three.js Authors 52 * SPDX-License-Identifier: MIT 53 */const Ed="185",sc={ROTATE:0,DOLLY:1,PAN:2},Qu={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},jF=0,YF=1,ZF=2,QF=0,yR=1,KF=2,rd=3,dr=0,Ts=1,la=2,ua=0,gn=1,Ku=2,Ju=3,ec=4,ic=5,I_=6,yn=100,xR=101,bR=102,JF=103,eL=104,no=200,_R=201,TR=202,vR=203,Td=204,vd=205,SR=206,MR=207,AR=208,NR=209,wR=210,wm=0,Rm=1,Em=2,hc=3,Cm=4,Bm=5,Dm=6,Um=7,Fg=0,tL=1,sL=2,fo=0,iL=1,nL=2,rL=3,RR=4,aL=6,oL=7,k_=300,dc=301,Fm=302,H_=303,q_=304,Lm=306,fc=1e3,cr=1001,pc=1002,$t=1003,ER=1004,mc=1005,Ss=1006,n_=1007,ca=1008,lL=1008,Ds=1009,fl=1010,pl=1011,po=1012,ps=1013,Ut=1014,_s=1015,Jt=1016,$_=1017,W_=1018,ha=1020,Lg=35902,Og=35899,X_=1021,Sc=1022,ki=1023,vn=1026,fr=1027,Mc=1028,Ac=1029,xn=1030,Nc=1031,j_=1032,zg=1033,ad=33776,od=33777,ld=33778,ud=33779,r_=35840,a_=35841,o_=35842,l_=35843,Om=36196,zm=37492,Pm=37496,Vm=37488,Gm=37489,Sd=37490,Im=37491,km=37808,Hm=37809,qm=37810,$m=37811,Wm=37812,Xm=37813,jm=37814,Ym=37815,Zm=37816,Qm=37817,Km=37818,Jm=37819,eg=37820,tg=37821,sg=36492,ig=36494,ng=36495,rg=36283,ag=36284,Md=36285,og=36286,da=0,uL=1,bo="",Vi="srgb",lg="srgb-linear",ug="linear",Ve="srgb",$x="",CR="rg",cL="ga",hL=0,al=7680,dL=7681,fL=7682,pL=7683,mL=34055,gL=34056,yL=5386,xL=512,bL=513,_L=514,TL=515,vL=516,SL=517,ML=518,u_=519,BR=512,Y_=513,DR=514,Cd=515,cg=516,UR=517,gc=518,FR=519,yc=35044,Bd=35048,Hi=2e3,An=2001,hr={COMPUTE:"compute",RENDER:"render"},Al={TEXTURE_COMPARE:"depthTextureCompare"};function AL(o){for(let e=o.length-1;e>=0;--e)if(o[e]>=65535)return!0;return!1}function hg(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}function c_(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}function NL(){const o=c_("canvas");return o.style.display="block",o}const oN={};function h_(...o){const e="THREE."+o.shift();console.log(e,...o)}function LR(o){const e=o[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=o[1];t&&t.isStackTrace?o[0]+=" "+t.getLocation():o[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return o}function me(...o){o=LR(o);const e="THREE."+o.shift();{const t=o[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...o)}}function he(...o){o=LR(o);const e="THREE."+o.shift();{const t=o[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...o)}}function Ye(...o){const e=o.join(" ");e in oN||(oN[e]=!0,me(...o))}function OR(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(o=>{requestAnimationFrame(o)})}const zR={[wm]:Rm,[Em]:Dm,[Cm]:Um,[hc]:Bm,[Rm]:wm,[Dm]:Em,[Um]:Cm,[Bm]:hc};class Wn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s===void 0?!1:s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners;if(s===void 0)return;const i=s[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const s=t[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let r=0,l=i.length;r<l;r++)i[r].call(this,e);e.target=null}}}const Os=["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","5
535","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 lN=1234567;const cd=Math.PI/180,xc=180/Math.PI;function fa(){const o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(Os[o&255]+Os[o>>8&255]+Os[o>>16&255]+Os[o>>24&255]+"-"+Os[e&255]+Os[e>>8&255]+"-"+Os[e>>16&15|64]+Os[e>>24&255]+"-"+Os[t&63|128]+Os[t>>8&255]+"-"+Os[t>>16&255]+Os[t>>24&255]+Os[s&255]+Os[s>>8&255]+Os[s>>16&255]+Os[s>>24&255]).toLowerCase()}function We(o,e,t){return Math.max(e,Math.min(t,o))}function Z_(o,e){return(o%e+e)%e}function wL(o,e,t,s,i){return s+(o-e)*(i-s)/(t-e)}function RL(o,e,t){return o!==e?(t-o)/(e-o):0}function hd(o,e,t){return(1-t)*o+t*e}function EL(o,e,t,s){return hd(o,e,1-Math.exp(-t*s))}function CL(o,e=1){return e-Math.abs(Z_(o,e*2)-e)}function BL(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*(3-2*o))}function DL(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*o*(o*(o*6-15)+10))}function UL(o,e){return o+Math.floor(Math.random()*(e-o+1))}function FL(o,e){return o+Math.random()*(e-o)}function LL(o){return o*(.5-Math.random())}function OL(o){o!==void 0&&(lN=o);let e=lN+=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 zL(o){return o*cd}function PL(o){return o*xc}function VL(o){return(o&o-1)===0&&o!==0}function GL(o){return Math.pow(2,Math.ceil(Math.log(o)/Math.LN2))}function IL(o){return Math.pow(2,Math.floor(Math.log(o)/Math.LN2))}function kL(o,e,t,s,i){const r=Math.cos,l=Math.sin,u=r(t/2),h=l(t/2),d=r((e+s)/2),p=l((e+s)/2),m=r((e-s)/2),y=l((e-s)/2),b=r((s-e)/2),_=l((s-e)/2);switch(i){case"XYX":o.set(u*p,h*m,h*y,u*d);break;case"YZY":o.set(h*y,u*p,h*m,u*d);break;case"ZXZ":o.set(h*m,h*y,u*p,u*d);break;case"XZX":o.set(u*p,h*_,h*b,u*d);break;case"YXY":o.set(h*b,u*p,h*_,u*d);break;case"ZYZ":o.set(h*_,h*b,u*p,u*d);break;default:me("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function si(o,e){switch(e.constructor){case Float32Array:return o;case Uint32Array:return o/4294967295;case Uint16Array:return o/65535;case Uint8Array:return o/255;case Int32Array:return Math.max(o/2147483647,-1);case Int16Array:return Math.max(o/32767,-1);case Int8Array:return Math.max(o/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function He(o,e){switch(e.constructor){case Float32Array:return o;case Uint32Array:return Math.round(o*4294967295);case Uint16Array:return Math.round(o*65535);case Uint8Array:return Math.round(o*255);case Int32Array:return Math.round(o*2147483647);case Int16Array:return Math.round(o*32767);case Int8Array:return Math.round(o*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const Q_={DEG2RAD:cd,RAD2DEG:xc,generateUUID:fa,clamp:We,euclideanModulo:Z_,mapLinear:wL,inverseLerp:RL,lerp:hd,damp:EL,pingpong:CL,smoothstep:BL,smootherstep:DL,randInt:UL,randFloat:FL,randFloatSpread:LL,seededRandom:OL,degToRad:zL,radToDeg:PL,isPowerOfTwo:VL,ceilPowerOfTwo:GL,floorPowerOfTwo:IL,setQuaternionFromProperEuler:kL,normalize:He,denormalize:si};class Fe{static{Fe.prototype.isVector2=!0}constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: 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}
vendor: 11,316 bytes, line 53
53sub(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,s=this.y,i=e.elements;return this.x=i[0]*t+i[3]*s+i[6],this.y=i[1]*t+i[4]*s+i[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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(We(s,e,t))}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 s=this.dot(e)/t;return Math.acos(We(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,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 s=Math.cos(t),i=Math.sin(t),r=this.x-e.x,l=this.y-e.y;return this.x=r*s-l*i+e.x,this.y=r*i+l*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ma{constructor(e=0,t=0,s=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=s,this._w=i}static slerpFlat(e,t,s,i,r,l,u){let h=s[i+0],d=s[i+1],p=s[i+2],m=s[i+3],y=r[l+0],b=r[l+1],_=r[l+2],v=r[l+3];if(m!==v||h!==y||d!==b||p!==_){let M=h*y+d*b+p*_+m*v;M<0&&(y=-y,b=-b,_=-_,v=-v,M=-M);let A=1-u;if(M<.9995){const C=Math.acos(M),E=Math.sin(C);A=Math.sin(A*C)/E,u=Math.sin(u*C)/E,h=h*A+y*u,d=d*A+b*u,p=p*A+_*u,m=m*A+v*u}else{h=h*A+y*u,d=d*A+b*u,p=p*A+_*u,m=m*A+v*u;const C=1/Math.sqrt(h*h+d*d+p*p+m*m);h*=C,d*=C,p*=C,m*=C}}e[t]=h,e[t+1]=d,e[t+2]=p,e[t+3]=m}static multiplyQuaternionsFlat(e,t,s,i,r,l){const u=s[i],h=s[i+1],d=s[i+2],p=s[i+3],m=r[l],y=r[l+1],b=r[l+2],_=r[l+3];return e[t]=u*_+p*m+h*b-d*y,e[t+1]=h*_+p*y+d*m-u*b,e[t+2]=d*_+p*b+u*y-h*m,e[t+3]=p*_-u*m-h*y-d*b,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,s,i){return this._x=e,this._y=t,this._z=s,this._w=i,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 s=e._x,i=e._y,r=e._z,l=e._order,u=Math.cos,h=Math.sin,d=u(s/2),p=u(i/2),m=u(r/2),y=h(s/2),b=h(i/2),_=h(r/2);switch(l){case"XYZ":this._x=y*p*m+d*b*_,this._y=d*b*m-y*p*_,this._z=d*p*_+y*b*m,this._w=d*p*m-y*b*_;break;case"YXZ":this._x=y*p*m+d*b*_,this._y=d*b*m-y*p*_,this._z=d*p*_-y*b*m,this._w=d*p*m+y*b*_;break;case"ZXY":this._x=y*p*m-d*b*_,this._y=d*b*m+y*p*_,this._z=d*p*_+y*b*m,this._w=d*p*m-y*b*_;break;case"ZYX":this._x=y*p*m-d*b*_,this._y=d*b*m+y*p*_,this._z=d*p*_-y*b*m,this._w=d*p*m+y*b*_;break;case"YZX":this._x=y*p*m+d*b*_,this._y=d*b*m+y*p*_,this._z=d*p*_-y*b*m,this._w=d*p*m-y*b*_;break;case"XZY":this._x=y*p*m-d*b*_,this._y=d*b*m-y*p*_,this._z=d*p*_+y*b*m,this._w=d*p*m+y*b*_;break;default:me("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,i=Math.sin(s);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],i=t[4],r=t[8],l=t[1],u=t[5],h=t[9],d=t[2],p=t[6],m=t[10],y=s+u+m;if(y>0){const b=.5/Math.sqrt(y+1);this._w=.25/b,this._x=(p-h)*b,this._y=(r-d)*b,this._z=(l-i)*b}else if(s>u&&s>m){const b=2*Math.sqrt(1+s-u-m);this._w=(p-h)/b,this._x=.25*b,this._y=(i+l)/b,this._z=(r+d)/b}else if(u>m){const b=2*Math.sqrt(1+u-s-m);this._w=(r-d)/b,this._x=(i+l)/b,this._y=.25*b,this._z=(h+p)/b}else{const b=2*Math.sqrt(1+m-s-u);this._w=(l-i)/b,this._x=(r+d)/b,this._y=(h+p)/b,this._z=.25*b}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<1e-8?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(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=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(We(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const i=Math.min(1,t/s);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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 s=e._x,i=e._y,r=e._z,l=e._w,u=t._x,h=t._y,d=t._z,p=t._w;return this._x=s*p+l*u+i*d-r*h,this._y=i*p+l*h+r*u-s*d,this._z=r*p+l*d+s*h-i*u,this._w=l*p-s*u-i*h-r*d,this._onChangeCallback(),this}slerp(e,t){let s=e._x,i=e._y,r=e._z,l=e._w,u=this.dot(e);u<0&&(s=-s,i=-i,r=-r,l=-l,u=-u);let h=1-t;if(u<.9995){const d=Math.acos(u),p=Math.sin(d);h=Math.sin(h*d)/p,t=Math.sin(t*d)/p,this._x=this._x*h+s*t,this._y=this._y*h+i*t,this._z=this._z*h+r*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+s*t,this._y=this._y*h+i*t,this._z=this._z*h+r*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*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 H{static{H.prototype.isVector3=!0}constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,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("THREE.Vector3: 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("THREE.Vector3: 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(uN.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(uN.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*s+r[6]*i,this.y=r[1]*t+r[4]*s+r[7]*i,this.z=r[2]*t+r[5]*s+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,s=this.y,i=this.z,r=e.elements,l=1/(r[3]*t+r[7]*s+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*s+r[8]*i+r[12])*l,this.y=(r[1]*t+r[5]*s+r[9]*i+r[13])*l,this.z=(r[2]*t+r[6]*s+r[10]*i+r[14])*l,this}applyQuaternion(e){const t=this.x,s=this.y,i=this.z,r=e.x,l=e.y,u=e.z,h=e.w,d=2*(l*i-u*s),p=2*(u*t-r*i),m=2*(r*s-l*t);return this.x=t+h*d+l*m-u*p,this.y=s+h*p+u*d-r*m,this.z=i+h*m+r*p-l*d,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,s=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*s+r[8]*i,this.y=r[1]*t+r[5]*s+r[9]*i,this.z=r[2]*t+r[6]*s+r[10]*i,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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(We(s,e,t))}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}
vendor: 5,307 bytes, line 53
53round(){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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,i=e.y,r=e.z,l=t.x,u=t.y,h=t.z;return this.x=i*h-r*u,this.y=r*l-s*h,this.z=s*u-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return Wx.copy(this).projectOnVector(e),this.sub(Wx)}reflect(e){return this.sub(Wx.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 s=this.dot(e)/t;return Math.acos(We(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,i=this.z-e.z;return t*t+s*s+i*i}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,s){const i=Math.sin(t)*e;return this.x=i*Math.sin(s),this.y=Math.cos(t)*e,this.z=i*Math.cos(s),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,s){return this.x=e*Math.sin(t),this.y=s,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(),s=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=i,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,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Wx=new H,uN=new ma;class js{static{js.prototype.isMatrix3=!0}constructor(e,t,s,i,r,l,u,h,d){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,s,i,r,l,u,h,d)}set(e,t,s,i,r,l,u,h,d){const p=this.elements;return p[0]=e,p[1]=i,p[2]=u,p[3]=t,p[4]=r,p[5]=h,p[6]=s,p[7]=l,p[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.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 s=e.elements,i=t.elements,r=this.elements,l=s[0],u=s[3],h=s[6],d=s[1],p=s[4],m=s[7],y=s[2],b=s[5],_=s[8],v=i[0],M=i[3],A=i[6],C=i[1],E=i[4],F=i[7],L=i[2],U=i[5],R=i[8];return r[0]=l*v+u*C+h*L,r[3]=l*M+u*E+h*U,r[6]=l*A+u*F+h*R,r[1]=d*v+p*C+m*L,r[4]=d*M+p*E+m*U,r[7]=d*A+p*F+m*R,r[2]=y*v+b*C+_*L,r[5]=y*M+b*E+_*U,r[8]=y*A+b*F+_*R,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],s=e[1],i=e[2],r=e[3],l=e[4],u=e[5],h=e[6],d=e[7],p=e[8];return t*l*p-t*u*d-s*r*p+s*u*h+i*r*d-i*l*h}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],l=e[4],u=e[5],h=e[6],d=e[7],p=e[8],m=p*l-u*d,y=u*h-p*r,b=d*r-l*h,_=t*m+s*y+i*b;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=m*v,e[1]=(i*d-p*s)*v,e[2]=(u*s-i*l)*v,e[3]=y*v,e[4]=(p*t-i*h)*v,e[5]=(i*r-u*t)*v,e[6]=b*v,e[7]=(s*h-d*t)*v,e[8]=(l*t-s*r)*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,s,i,r,l,u){const h=Math.cos(r),d=Math.sin(r);
vendor: 65,954 bytes, line 53
53return this.set(s*h,s*d,-s*(h*l+d*u)+l+e,-i*d,i*h,-i*(-d*l+h*u)+u+t,0,0,1),this}scale(e,t){return Ye("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Xx.makeScale(e,t)),this}rotate(e){return Ye("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Xx.makeRotation(-e)),this}translate(e,t){return Ye("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Xx.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),s=Math.sin(e);return this.set(t,-s,0,s,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,s=e.elements;for(let i=0;i<9;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Xx=new js,cN=new js().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),hN=new js().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function HL(){const o={enabled:!0,workingColorSpace:lg,spaces:{},convert:function(i,r,l){return this.enabled===!1||r===l||!r||!l||(this.spaces[r].transfer===Ve&&(i.r=pa(i.r),i.g=pa(i.g),i.b=pa(i.b)),this.spaces[r].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Ve&&(i.r=nc(i.r),i.g=nc(i.g),i.b=nc(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===bo?ug:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,l){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return Ye("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),o.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return Ye("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),o.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],s=[.3127,.329];return o.define({[lg]:{primaries:e,whitePoint:s,transfer:ug,toXYZ:cN,fromXYZ:hN,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Vi},outputColorSpaceConfig:{drawingBufferColorSpace:Vi}},[Vi]:{primaries:e,whitePoint:s,transfer:Ve,toXYZ:cN,fromXYZ:hN,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Vi}}}),o}const lt=HL();function pa(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function nc(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}let bu;class qL{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let s;if(e instanceof HTMLCanvasElement)s=e;else{bu===void 0&&(bu=c_("canvas")),bu.width=e.width,bu.height=e.height;const i=bu.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),s=bu}return s.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=c_("canvas");t.width=e.width,t.height=e.height;const s=t.getContext("2d");s.drawImage(e,0,0,e.width,e.height);const i=s.getImageData(0,0,e.width,e.height),r=i.data;for(let l=0;l<r.length;l++)r[l]=pa(r[l]/255)*255;return s.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let s=0;s<t.length;s++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[s]=Math.floor(pa(t[s]/255)*255):t[s]=pa(t[s]);return{data:t,width:e.width,height:e.height}}else return me("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let $L=0;class K_{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:$L++}),this.uuid=fa(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}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 s={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let l=0,u=i.length;l<u;l++)i[l].isDataTexture?r.push(jx(i[l].image)):r.push(jx(i[l]))}else r=jx(i);s.url=r}return t||(e.images[this.uuid]=s),s}}function jx(o){return typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap?qL.getDataURL(o):o.data?{data:Array.from(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(me("Texture: Unable to serialize Texture."),{})}let WL=0;const Yx=new H;class qs extends Wn{constructor(e=qs.DEFAULT_IMAGE,t=qs.DEFAULT_MAPPING,s=cr,i=cr,r=Ss,l=ca,u=ki,h=Ds,d=qs.DEFAULT_ANISOTROPY,p=bo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:WL++}),this.uuid=fa(),this.name="",this.source=new K_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=s,this.wrapT=i,this.magFilter=r,this.minFilter=l,this.anisotropy=d,this.format=u,this.internalFormat=null,this.type=h,this.offset=new Fe(0,0),this.repeat=new Fe(1,1),this.center=new Fe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new js,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Yx).x}get height(){return this.source.getSize(Yx).y}get depth(){return this.source.getSize(Yx).z}get image(){return this.source.data}set image(e){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)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.normalized=e.normalized,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.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const s=e[t];if(s===void 0){me(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){me(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&s&&i.isVector2&&s.isVector2||i&&s&&i.isVector3&&s.isVector3||i&&s&&i.isMatrix3&&s.isMatrix3?i.copy(s):this[t]=s}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const s={metadata:{version:4.7,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,normalized:this.normalized,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&&(s.userData=this.userData),t||(e.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==k_)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case fc:e.x=e.x-Math.floor(e.x);break;case cr:e.x=e.x<0?0:1;break;case pc: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 fc:e.y=e.y-Math.floor(e.y);break;case cr:e.y=e.y<0?0:1;break;case pc: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++}}qs.DEFAULT_IMAGE=null;qs.DEFAULT_MAPPING=k_;qs.DEFAULT_ANISOTROPY=1;class ht{static{ht.prototype.isVector4=!0}constructor(e=0,t=0,s=0,i=1){this.x=e,this.y=t,this.z=s,this.w=i}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,s,i){return this.x=e,this.y=t,this.z=s,this.w=i,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("THREE.Vector4: 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("THREE.Vector4: 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,s=this.y,i=this.z,r=this.w,l=e.elements;return this.x=l[0]*t+l[4]*s+l[8]*i+l[12]*r,this.y=l[1]*t+l[5]*s+l[9]*i+l[13]*r,this.z=l[2]*t+l[6]*s+l[10]*i+l[14]*r,this.w=l[3]*t+l[7]*s+l[11]*i+l[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,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,s,i,r;const h=e.elements,d=h[0],p=h[4],m=h[8],y=h[1],b=h[5],_=h[9],v=h[2],M=h[6],A=h[10];if(Math.abs(p-y)<.01&&Math.abs(m-v)<.01&&Math.abs(_-M)<.01){if(Math.abs(p+y)<.1&&Math.abs(m+v)<.1&&Math.abs(_+M)<.1&&Math.abs(d+b+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(d+1)/2,F=(b+1)/2,L=(A+1)/2,U=(p+y)/4,R=(m+v)/4,V=(_+M)/4;return E>F&&E>L?E<.01?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(E),i=U/s,r=R/s):F>L?F<.01?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(F),s=U/i,r=V/i):L<.01?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(L),s=R/r,i=V/r),this.set(s,i,r,t),this}let C=Math.sqrt((M-_)*(M-_)+(m-v)*(m-v)+(y-p)*(y-p));return Math.abs(C)<.001&&(C=1),this.x=(M-_)/C,this.y=(m-v)/C,this.z=(y-p)/C,this.w=Math.acos((d+b+A-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(We(s,e,t))}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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this.w=e.w+(t.w-e.w)*s,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 $i extends Wn{constructor(e=1,t=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ss,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},s),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=s.depth,this.scissor=new ht(0,0,e,t),this.scissorTest=!1,this.viewport=new ht(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:s.depth},r=new qs(i),l=s.count;for(let u=0;u<l;u++)this.textures[u]=r.clone(),this.textures[u].isRenderTargetTexture=!0,this.textures[u].renderTarget=this;this._setTextureOptions(s),this.depthBuffer=s.depthBuffer,this.stencilBuffer=s.stencilBuffer,this.resolveDepthBuffer=s.resolveDepthBuffer,this.resolveStencilBuffer=s.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=s.depthTexture,this.samples=s.samples,this.multiview=s.multiview,this.useArrayDepthTexture=s.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:Ss,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let s=0;s<this.textures.length;s++)this.textures[s].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,s=1){if(this.width!==e||this.height!==t||this.depth!==s){this.width=e,this.height=t,this.depth=s;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=s,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);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 t=0,s=e.textures.length;t<s;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new K_(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class XL extends qs{constructor(e=null,t=1,s=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:s,depth:i},this.magFilter=$t,this.minFilter=$t,this.wrapR=cr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Qe{static{Qe.prototype.isMatrix4=!0}constructor(e,t,s,i,r,l,u,h,d,p,m,y,b,_,v,M){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,s,i,r,l,u,h,d,p,m,y,b,_,v,M)}set(e,t,s,i,r,l,u,h,d,p,m,y,b,_,v,M){const A=this.elements;return A[0]=e,A[4]=t,A[8]=s,A[12]=i,A[1]=r,A[5]=l,A[9]=u,A[13]=h,A[2]=d,A[6]=p,A[10]=m,A[14]=y,A[3]=b,A[7]=_,A[11]=v,A[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 Qe().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[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,s){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),s.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this)}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,s=e.elements,i=1/_u.setFromMatrixColumn(e,0).length(),r=1/_u.setFromMatrixColumn(e,1).length(),l=1/_u.setFromMatrixColumn(e,2).length();return t[0]=s[0]*i,t[1]=s[1]*i,t[2]=s[2]*i,t[3]=0,t[4]=s[4]*r,t[5]=s[5]*r,t[6]=s[6]*r,t[7]=0,t[8]=s[8]*l,t[9]=s[9]*l,t[10]=s[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,s=e.x,i=e.y,r=e.z,l=Math.cos(s),u=Math.sin(s),h=Math.cos(i),d=Math.sin(i),p=Math.cos(r),m=Math.sin(r);if(e.order==="XYZ"){const y=l*p,b=l*m,_=u*p,v=u*m;t[0]=h*p,t[4]=-h*m,t[8]=d,t[1]=b+_*d,t[5]=y-v*d,t[9]=-u*h,t[2]=v-y*d,t[6]=_+b*d,t[10]=l*h}else if(e.order==="YXZ"){const y=h*p,b=h*m,_=d*p,v=d*m;t[0]=y+v*u,t[4]=_*u-b,t[8]=l*d,t[1]=l*m,t[5]=l*p,t[9]=-u,t[2]=b*u-_,t[6]=v+y*u,t[10]=l*h}else if(e.order==="ZXY"){const y=h*p,b=h*m,_=d*p,v=d*m;t[0]=y-v*u,t[4]=-l*m,t[8]=_+b*u,t[1]=b+_*u,t[5]=l*p,t[9]=v-y*u,t[2]=-l*d,t[6]=u,t[10]=l*h}else if(e.order==="ZYX"){const y=l*p,b=l*m,_=u*p,v=u*m;t[0]=h*p,t[4]=_*d-b,t[8]=y*d+v,t[1]=h*m,t[5]=v*d+y,t[9]=b*d-_,t[2]=-d,t[6]=u*h,t[10]=l*h}else if(e.order==="YZX"){const y=l*h,b=l*d,_=u*h,v=u*d;t[0]=h*p,t[4]=v-y*m,t[8]=_*m+b,t[1]=m,t[5]=l*p,t[9]=-u*p,t[2]=-d*p,t[6]=b*m+_,t[10]=y-v*m}else if(e.order==="XZY"){const y=l*h,b=l*d,_=u*h,v=u*d;t[0]=h*p,t[4]=-m,t[8]=d*p,t[1]=y*m+v,t[5]=l*p,t[9]=b*m-_,t[2]=_*m-b,t[6]=u*p,t[10]=v*m+y}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(jL,e,YL)}lookAt(e,t,s){const i=this.elements;return Bi.subVectors(e,t),Bi.lengthSq()===0&&(Bi.z=1),Bi.normalize(),$a.crossVectors(s,Bi),$a.lengthSq()===0&&(Math.abs(s.z)===1?Bi.x+=1e-4:Bi.z+=1e-4,Bi.normalize(),$a.crossVectors(s,Bi)),$a.normalize(),hp.crossVectors(Bi,$a),i[0]=$a.x,i[4]=hp.x,i[8]=Bi.x,i[1]=$a.y,i[5]=hp.y,i[9]=Bi.y,i[2]=$a.z,i[6]=hp.z,i[10]=Bi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,i=t.elements,r=this.elements,l=s[0],u=s[4],h=s[8],d=s[12],p=s[1],m=s[5],y=s[9],b=s[13],_=s[2],v=s[6],M=s[10],A=s[14],C=s[3],E=s[7],F=s[11],L=s[15],U=i[0],R=i[4],V=i[8],$=i[12],ie=i[1],le=i[5],ye=i[9],xe=i[13],Ne=i[2],ce=i[6],X=i[10],ne=i[14],fe=i[3],Be=i[7],Ce=i[11],G=i[15];return r[0]=l*U+u*ie+h*Ne+d*fe,r[4]=l*R+u*le+h*ce+d*Be,r[8]=l*V+u*ye+h*X+d*Ce,r[12]=l*$+u*xe+h*ne+d*G,r[1]=p*U+m*ie+y*Ne+b*fe,r[5]=p*R+m*le+y*ce+b*Be,r[9]=p*V+m*ye+y*X+b*Ce,r[13]=p*$+m*xe+y*ne+b*G,r[2]=_*U+v*ie+M*Ne+A*fe,r[6]=_*R+v*le+M*ce+A*Be,r[10]=_*V+v*ye+M*X+A*Ce,r[14]=_*$+v*xe+M*ne+A*G,r[3]=C*U+E*ie+F*Ne+L*fe,r[7]=C*R+E*le+F*ce+L*Be,r[11]=C*V+E*ye+F*X+L*Ce,r[15]=C*$+E*xe+F*ne+L*G,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],s=e[4],i=e[8],r=e[12],l=e[1],u=e[5],h=e[9],d=e[13],p=e[2],m=e[6],y=e[10],b=e[14],_=e[3],v=e[7],M=e[11],A=e[15],C=h*b-d*y,E=u*b-d*m,F=u*y-h*m,L=l*b-d*p,U=l*y-h*p,R=l*m-u*p;return t*(v*C-M*E+A*F)-s*(_*C-M*L+A*U)+i*(_*E-v*L+A*R)-r*(_*F-v*U+M*R)}determinantAffine(){const e=this.elements,t=e[0],s=e[4],i=e[8],r=e[1],l=e[5],u=e[9],h=e[2],d=e[6],p=e[10];return t*(l*p-u*d)-s*(r*p-u*h)+i*(r*d-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,s){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],l=e[4],u=e[5],h=e[6],d=e[7],p=e[8],m=e[9],y=e[10],b=e[11],_=e[12],v=e[13],M=e[14],A=e[15],C=t*u-s*l,E=t*h-i*l,F=t*d-r*l,L=s*h-i*u,U=s*d-r*u,R=i*d-r*h,V=p*v-m*_,$=p*M-y*_,ie=p*A-b*_,le=m*M-y*v,ye=m*A-b*v,xe=y*A-b*M,Ne=C*xe-E*ye+F*le+L*ie-U*$+R*V;if(Ne===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const ce=1/Ne;return e[0]=(u*xe-h*ye+d*le)*ce,e[1]=(i*ye-s*xe-r*le)*ce,e[2]=(v*R-M*U+A*L)*ce,e[3]=(y*U-m*R-b*L)*ce,e[4]=(h*ie-l*xe-d*$)*ce,e[5]=(t*xe-i*ie+r*$)*ce,e[6]=(M*F-_*R-A*E)*ce,e[7]=(p*R-y*F+b*E)*ce,e[8]=(l*ye-u*ie+d*V)*ce,e[9]=(s*ie-t*ye-r*V)*ce,e[10]=(_*U-v*F+A*C)*ce,e[11]=(m*F-p*U-b*C)*ce,e[12]=(u*$-l*le-h*V)*ce,e[13]=(t*le-s*$+i*V)*ce,e[14]=(v*E-_*L-M*C)*ce,e[15]=(p*L-m*E+y*C)*ce,this}scale(e){const t=this.elements,s=e.x,i=e.y,r=e.z;return t[0]*=s,t[4]*=i,t[8]*=r,t[1]*=s,t[5]*=i,t[9]*=r,t[2]*=s,t[6]*=i,t[10]*=r,t[3]*=s,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,i))}makeTranslation(e,t,s){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,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),i=Math.sin(t),r=1-s,l=e.x,u=e.y,h=e.z,d=r*l,p=r*u;return this.set(d*l+s,d*u-i*h,d*h+i*u,0,d*u+i*h,p*u+s,p*h-i*l,0,d*h-i*u,p*h+i*l,r*h*h+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,i,r,l){return this.set(1,s,r,0,e,1,l,0,t,i,1,0,0,0,0,1),this}compose(e,t,s){const i=this.elements,r=t._x,l=t._y,u=t._z,h=t._w,d=r+r,p=l+l,m=u+u,y=r*d,b=r*p,_=r*m,v=l*p,M=l*m,A=u*m,C=h*d,E=h*p,F=h*m,L=s.x,U=s.y,R=s.z;return i[0]=(1-(v+A))*L,i[1]=(b+F)*L,i[2]=(_-E)*L,i[3]=0,i[4]=(b-F)*U,i[5]=(1-(y+A))*U,i[6]=(M+C)*U,i[7]=0,i[8]=(_+E)*R,i[9]=(M-C)*R,i[10]=(1-(y+v))*R,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,s){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const r=this.determinantAffine();if(r===0)return s.set(1,1,1),t.identity(),this;let l=_u.set(i[0],i[1],i[2]).length();const u=_u.set(i[4],i[5],i[6]).length(),h=_u.set(i[8],i[9],i[10]).length();r<0&&(l=-l),Dn.copy(this);const d=1/l,p=1/u,m=1/h;return Dn.elements[0]*=d,Dn.elements[1]*=d,Dn.elements[2]*=d,Dn.elements[4]*=p,Dn.elements[5]*=p,Dn.elements[6]*=p,Dn.elements[8]*=m,Dn.elements[9]*=m,Dn.elements[10]*=m,t.setFromRotationMatrix(Dn),s.x=l,s.y=u,s.z=h,this}makePerspective(e,t,s,i,r,l,u=Hi,h=!1){const d=this.elements,p=2*r/(t-e),m=2*r/(s-i),y=(t+e)/(t-e),b=(s+i)/(s-i);let _,v;if(h)_=r/(l-r),v=l*r/(l-r);else if(u===Hi)_=-(l+r)/(l-r),v=-2*l*r/(l-r);else if(u===An)_=-l/(l-r),v=-l*r/(l-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+u);return d[0]=p,d[4]=0,d[8]=y,d[12]=0,d[1]=0,d[5]=m,d[9]=b,d[13]=0,d[2]=0,d[6]=0,d[10]=_,d[14]=v,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,t,s,i,r,l,u=Hi,h=!1){const d=this.elements,p=2/(t-e),m=2/(s-i),y=-(t+e)/(t-e),b=-(s+i)/(s-i);let _,v;if(h)_=1/(l-r),v=l/(l-r);else if(u===Hi)_=-2/(l-r),v=-(l+r)/(l-r);else if(u===An)_=-1/(l-r),v=-r/(l-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);return d[0]=p,d[4]=0,d[8]=0,d[12]=y,d[1]=0,d[5]=m,d[9]=0,d[13]=b,d[2]=0,d[6]=0,d[10]=_,d[14]=v,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const t=this.elements,s=e.elements;for(let i=0;i<16;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}}const _u=new H,Dn=new Qe,jL=new H(0,0,0),YL=new H(1,1,1),$a=new H,hp=new H,Bi=new H,dN=new Qe,fN=new ma;class _r{constructor(e=0,t=0,s=0,i=_r.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=s,this._order=i}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,s,i=this._order){return this._x=e,this._y=t,this._z=s,this._order=i,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,s=!0){const i=e.elements,r=i[0],l=i[4],u=i[8],h=i[1],d=i[5],p=i[9],m=i[2],y=i[6],b=i[10];switch(t){case"XYZ":this._y=Math.asin(We(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-p,b),this._z=Math.atan2(-l,r)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-We(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(u,b),this._z=Math.atan2(h,d)):(this._y=Math.atan2(-m,r),this._z=0);break;case"ZXY":this._x=Math.asin(We(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-m,b),this._z=Math.atan2(-l,d)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-We(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(y,b),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-l,d));break;case"YZX":this._z=Math.asin(We(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-p,d),this._y=Math.atan2(-m,r)):(this._x=0,this._y=Math.atan2(u,b));break;case"XZY":this._z=Math.asin(-We(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(u,r)):(this._x=Math.atan2(-p,b),this._y=0);break;default:me("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s){return dN.makeRotationFromQuaternion(e),this.setFromRotationMatrix(dN,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fN.setFromEuler(this),this.setFromQuaternion(fN,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}}_r.DEFAULT_ORDER="XYZ";class ZL{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 QL=0;const pN=new H,Tu=new ma,$r=new Qe,dp=new H,Dh=new H,KL=new H,JL=new ma,mN=new H(1,0,0),gN=new H(0,1,0),yN=new H(0,0,1),xN={type:"added"},eO={type:"removed"},vu={type:"childadded",child:null},Zx={type:"childremoved",child:null};class us extends Wn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:QL++}),this.uuid=fa(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=us.DEFAULT_UP.clone();const e=new H,t=new _r,s=new ma,i=new H(1,1,1);function r(){s.setFromEuler(t,!1)}function l(){t.setFromQuaternion(s,void 0,!1)}t._onChange(r),s._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Qe},normalMatrix:{value:new js}}),this.matrix=new Qe,this.matrixWorld=new Qe,this.matrixAutoUpdate=us.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=us.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ZL,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}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 Tu.setFromAxisAngle(e,t),this.quaternion.multiply(Tu),this}rotateOnWorldAxis(e,t){return Tu.setFromAxisAngle(e,t),this.quaternion.premultiply(Tu),this}rotateX(e){return this.rotateOnAxis(mN,e)}rotateY(e){return this.rotateOnAxis(gN,e)}rotateZ(e){return this.rotateOnAxis(yN,e)}translateOnAxis(e,t){return pN.copy(e).applyQuaternion(this.quaternion),this.position.add(pN.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(mN,e)}translateY(e){return this.translateOnAxis(gN,e)}translateZ(e){return this.translateOnAxis(yN,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4($r.copy(this.matrixWorld).invert())}lookAt(e,t,s){e.isVector3?dp.copy(e):dp.set(e,t,s);const i=this.parent;this.updateWorldMatrix(!0,!1),Dh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$r.lookAt(Dh,dp,this.up):$r.lookAt(dp,Dh,this.up),this.quaternion.setFromRotationMatrix($r),i&&($r.extractRotation(i.matrixWorld),Tu.setFromRotationMatrix($r),this.quaternion.premultiply(Tu.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(he("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(xN),vu.child=e,this.dispatchEvent(vu),vu.child=null):he("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.remove(arguments[s]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(eO),Zx.child=e,this.dispatchEvent(Zx),Zx.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),$r.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),$r.multiply(e.parent.matrixWorld)),e.applyMatrix4($r),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(xN),vu.child=e,this.dispatchEvent(vu),vu.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 s=0,i=this.children.length;s<i;s++){const l=this.children[s].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,s=[]){this[e]===t&&s.push(this);const i=this.children;for(let r=0,l=i.length;r<l;r++)i[r].getObjectsByProperty(e,t,s);return s}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dh,e,KL),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dh,JL,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 s=0,i=t.length;s<i;s++)t[s].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].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);const e=this.pivot;if(e!==null){const t=e.x,s=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*s-r[8]*i,r[13]+=s-r[1]*t-r[5]*s-r[9]*i,r[14]+=i-r[2]*t-r[6]*s-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(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 s=0,i=t.length;s<i;s++)t[s].updateMatrixWorld(e)}updateWorldMatrix(e,t,s=!1){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||s)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,s=!0),t===!0){const r=this.children;for(let l=0,u=r.length;l<u;l++)r[l].updateWorldMatrix(!1,!0,s)}}toJSON(e){const t=e===void 0||typeof e=="string",s={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(u=>({...u,boundingBox:u.boundingBox?u.boundingBox.toJSON():void 0,boundingSphere:u.boundingSphere?u.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(u=>({...u})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(u,h){return u[h.uuid]===void 0&&(u[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const u=this.geometry.parameters;if(u!==void 0&&u.shapes!==void 0){const h=u.shapes;if(Array.isArray(h))for(let d=0,p=h.length;d<p;d++){const m=h[d];r(e.shapes,m)}else r(e.shapes,h)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const u=[];for(let h=0,d=this.material.length;h<d;h++)u.push(r(e.materials,this.material[h]));i.material=u}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let u=0;u<this.children.length;u++)i.children.push(this.children[u].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let u=0;u<this.animations.length;u++){const h=this.animations[u];i.animations.push(r(e.animations,h))}}if(t){const u=l(e.geometries),h=l(e.materials),d=l(e.textures),p=l(e.images),m=l(e.shapes),y=l(e.skeletons),b=l(e.animations),_=l(e.nodes);u.length>0&&(s.geometries=u),h.length>0&&(s.materials=h),d.length>0&&(s.textures=d),p.length>0&&(s.images=p),m.length>0&&(s.shapes=m),y.length>0&&(s.skeletons=y),b.length>0&&(s.animations=b),_.length>0&&(s.nodes=_)}return s.object=i,s;function l(u){const h=[];for(const d in u){const p=u[d];delete p.metadata,h.push(p)}return h}}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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let s=0;s<e.children.length;s++){const i=e.children[s];this.add(i.clone())}return this}}us.DEFAULT_UP=new H(0,1,0);us.DEFAULT_MATRIX_AUTO_UPDATE=!0;us.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class fp extends us{constructor(){super(),this.isGroup=!0,this.type="Group"}}const tO={type:"move"};class sO{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new fp,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 fp,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new fp,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H,this._grip.eventsEnabled=!1),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 s of e.hand.values())this._getHandJoint(t,s)}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,s){let i=null,r=null,l=null;const u=this._targetRay,h=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(d&&e.hand){l=!0;for(const v of e.hand.values()){const M=t.getJointPose(v,s),A=this._getHandJoint(d,v);M!==null&&(A.matrix.fromArray(M.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=M.radius),A.visible=M!==null}const p=d.joints["index-finger-tip"],m=d.joints["thumb-tip"],y=p.position.distanceTo(m.position),b=.02,_=.005;d.inputState.pinching&&y>b+_?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&y<=b-_&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,s),r!==null&&(h.matrix.fromArray(r.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,r.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(r.linearVelocity)):h.hasLinearVelocity=!1,r.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(r.angularVelocity)):h.hasAngularVelocity=!1,h.eventsEnabled&&h.dispatchEvent({type:"gripUpdated",data:e,target:this})));u!==null&&(i=t.getPose(e.targetRaySpace,s),i===null&&r!==null&&(i=r),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(tO)))}return u!==null&&(u.visible=i!==null),h!==null&&(h.visible=r!==null),d!==null&&(d.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const s=new fp;s.matrixAutoUpdate=!1,s.visible=!1,e.joints[t.jointName]=s,e.add(s)}return e.joints[t.jointName]}}const PR={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},Wa={h:0,s:0,l:0},pp={h:0,s:0,l:0};function Qx(o,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?o+(e-o)*6*t:t<1/2?e:t<2/3?o+(e-o)*6*(2/3-t):o}class Xe{constructor(e,t,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,s)}set(e,t,s){if(t===void 0&&s===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Vi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,lt.colorSpaceToWorking(this,t),this}setRGB(e,t,s,i=lt.workingColorSpace){return this.r=e,this.g=t,this.b=s,lt.colorSpaceToWorking(this,i),this}setHSL(e,t,s,i=lt.workingColorSpace){if(e=Z_(e,1),t=We(t,0,1),s=We(s,0,1),t===0)this.r=this.g=this.b=s;else{const r=s<=.5?s*(1+t):s+t-s*t,l=2*s-r;this.r=Qx(l,r,e+1/3),this.g=Qx(l,r,e),this.b=Qx(l,r,e-1/3)}return lt.colorSpaceToWorking(this,i),this}setStyle(e,t=Vi){function s(r){r!==void 0&&parseFloat(r)<1&&me("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const l=i[1],u=i[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:me("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(r,16),t);me("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Vi){const s=PR[e.toLowerCase()];return s!==void 0?this.setHex(s,t):me("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=pa(e.r),this.g=pa(e.g),this.b=pa(e.b),this}copyLinearToSRGB(e){return this.r=nc(e.r),this.g=nc(e.g),this.b=nc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Vi){return lt.workingToColorSpace(zs.copy(this),e),Math.round(We(zs.r*255,0,255))*65536+Math.round(We(zs.g*255,0,255))*256+Math.round(We(zs.b*255,0,255))}getHexString(e=Vi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=lt.workingColorSpace){lt.workingToColorSpace(zs.copy(this),t);const s=zs.r,i=zs.g,r=zs.b,l=Math.max(s,i,r),u=Math.min(s,i,r);let h,d;const p=(u+l)/2;if(u===l)h=0,d=0;else{const m=l-u;switch(d=p<=.5?m/(l+u):m/(2-l-u),l){case s:h=(i-r)/m+(i<r?6:0);break;case i:h=(r-s)/m+2;break;case r:h=(s-i)/m+4;break}h/=6}return e.h=h,e.s=d,e.l=p,e}getRGB(e,t=lt.workingColorSpace){return lt.workingToColorSpace(zs.copy(this),t),e.r=zs.r,e.g=zs.g,e.b=zs.b,e}getStyle(e=Vi){lt.workingToColorSpace(zs.copy(this),e);const t=zs.r,s=zs.g,i=zs.b;return e!==Vi?`color(${e} ${t.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(s*255)},${Math.round(i*255)})`}offsetHSL(e,t,s){return this.getHSL(Wa),this.setHSL(Wa.h+e,Wa.s+t,Wa.l+s)}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,s){return this.r=e.r+(t.r-e.r)*s,this.g=e.g+(t.g-e.g)*s,this.b=e.b+(t.b-e.b)*s,this}lerpHSL(e,t){this.getHSL(Wa),e.getHSL(pp);const s=hd(Wa.h,pp.h,t),i=hd(Wa.s,pp.s,t),r=hd(Wa.l,pp.l,t);return this.setHSL(s,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,s=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*s+r[6]*i,this.g=r[1]*t+r[4]*s+r[7]*i,this.b=r[2]*t+r[5]*s+r[8]*i,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 zs=new Xe;Xe.NAMES=PR;class J_ extends us{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 _r,this.environmentIntensity=1,this.environmentRotation=new _r,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}}const Un=new H,Wr=new H,Kx=new H,Xr=new H,Su=new H,Mu=new H,bN=new H,Jx=new H,eb=new H,tb=new H,sb=new ht,ib=new ht,nb=new ht;class Vn{constructor(e=new H,t=new H,s=new H){this.a=e,this.b=t,this.c=s}static getNormal(e,t,s,i){i.subVectors(s,t),Un.subVectors(e,t),i.cross(Un);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,s,i,r){Un.subVectors(i,t),Wr.subVectors(s,t),Kx.subVectors(e,t);const l=Un.dot(Un),u=Un.dot(Wr),h=Un.dot(Kx),d=Wr.dot(Wr),p=Wr.dot(Kx),m=l*d-u*u;if(m===0)return r.set(0,0,0),null;const y=1/m,b=(d*h-u*p)*y,_=(l*p-u*h)*y;return r.set(1-b-_,_,b)}static containsPoint(e,t,s,i){return this.getBarycoord(e,t,s,i,Xr)===null?!1:Xr.x>=0&&Xr.y>=0&&Xr.x+Xr.y<=1}static getInterpolation(e,t,s,i,r,l,u,h){return this.getBarycoord(e,t,s,i,Xr)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(r,Xr.x),h.addScaledVector(l,Xr.y),h.addScaledVector(u,Xr.z),h)}static getInterpolatedAttribute(e,t,s,i,r,l){return sb.setScalar(0),ib.setScalar(0),nb.setScalar(0),sb.fromBufferAttribute(e,t),ib.fromBufferAttribute(e,s),nb.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(sb,r.x),l.addScaledVector(ib,r.y),l.addScaledVector(nb,r.z),l}static isFrontFacing(e,t,s,i){return Un.subVectors(s,t),Wr.subVectors(e,t),Un.cross(Wr).dot(i)<0}set(e,t,s){return this.a.copy(e),this.b.copy(t),this.c.copy(s),this}setFromPointsAndIndices(e,t,s,i){return this.a.copy(e[t]),this.b.copy(e[s]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,s,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,s),this.c.fromBufferAttribute(e,i),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 Un.subVectors(this.c,this.b),Wr.subVectors(this.a,this.b),Un.cross(Wr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Vn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Vn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,s,i,r){return Vn.getInterpolation(e,this.a,this.b,this.c,t,s,i,r)}containsPoint(e){return Vn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Vn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const s=this.a,i=this.b,r=this.c;let l,u;Su.subVectors(i,s),Mu.subVectors(r,s),Jx.subVectors(e,s);const h=Su.dot(Jx),d=Mu.dot(Jx);if(h<=0&&d<=0)return t.copy(s);eb.subVectors(e,i);const p=Su.dot(eb),m=Mu.dot(eb);if(p>=0&&m<=p)return t.copy(i);const y=h*m-p*d;if(y<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(s).addScaledVector(Su,l);tb.subVectors(e,r);const b=Su.dot(tb),_=Mu.dot(tb);if(_>=0&&b<=_)return t.copy(r);const v=b*d-h*_;if(v<=0&&d>=0&&_<=0)return u=d/(d-_),t.copy(s).addScaledVector(Mu,u);const M=p*_-b*m;if(M<=0&&m-p>=0&&b-_>=0)return bN.subVectors(r,i),u=(m-p)/(m-p+(b-_)),t.copy(i).addScaledVector(bN,u);const A=1/(M+v+y);return l=v*A,u=y*A,t.copy(s).addScaledVector(Su,l).addScaledVector(Mu,u)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Dd{constructor(e=new H(1/0,1/0,1/0),t=new H(-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,s=e.length;t<s;t+=3)this.expandByPoint(Fn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,s=e.count;t<s;t++)this.expandByPoint(Fn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=Fn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),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 s=e.geometry;if(s!==void 0){const r=s.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let l=0,u=r.count;l<u;l++)e.isMesh===!0?e.getVertexPosition(l,Fn):Fn.fromBufferAttribute(r,l),Fn.applyMatrix4(e.matrixWorld),this.expandByPoint(Fn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),mp.copy(e.boundingBox)):(s.boundingBox===null&&s.computeBoundingBox(),mp.copy(s.boundingBox)),mp.applyMatrix4(e.matrixWorld),this.union(mp)}const i=e.children;for(let r=0,l=i.length;r<l;r++)this.expandByObject(i[r],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,Fn),Fn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Uh),gp.subVectors(this.max,Uh),Au.subVectors(e.a,Uh),Nu.subVectors(e.b,Uh),wu.subVectors(e.c,Uh),Xa.subVectors(Nu,Au),ja.subVectors(wu,Nu),jo.subVectors(Au,wu);let t=[0,-Xa.z,Xa.y,0,-ja.z,ja.y,0,-jo.z,jo.y,Xa.z,0,-Xa.x,ja.z,0,-ja.x,jo.z,0,-jo.x,-Xa.y,Xa.x,0,-ja.y,ja.x,0,-jo.y,jo.x,0];return!rb(t,Au,Nu,wu,gp)||(t=[1,0,0,0,1,0,0,0,1],!rb(t,Au,Nu,wu,gp))?!1:(yp.crossVectors(Xa,ja),t=[yp.x,yp.y,yp.z],rb(t,Au,Nu,wu,gp))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Fn).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:(jr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),jr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),jr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),jr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),jr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),jr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),jr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),jr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(jr),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const jr=[new H,new H,new H,new H,new H,new H,new H,new H],Fn=new H,mp=new Dd,Au=new H,Nu=new H,wu=new H,Xa=new H,ja=new H,jo=new H,Uh=new H,gp=new H,yp=new H,Yo=new H;function rb(o,e,t,s,i){for(let r=0,l=o.length-3;r<=l;r+=3){Yo.fromArray(o,r);const u=i.x*Math.abs(Yo.x)+i.y*Math.abs(Yo.y)+i.z*Math.abs(Yo.z),h=e.dot(Yo),d=t.dot(Yo),p=s.dot(Yo);if(Math.max(-Math.max(h,d,p),Math.min(h,d,p))>u)return!1}return!0}const na=iO();function iO(){const o=new ArrayBuffer(4),e=new Float32Array(o),t=new Uint32Array(o),s=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const d=h-127;d<-27?(s[h]=0,s[h|256]=32768,i[h]=24,i[h|256]=24):d<-14?(s[h]=1024>>-d-14,s[h|256]=1024>>-d-14|32768,i[h]=-d-1,i[h|256]=-d-1):d<=15?(s[h]=d+15<<10,s[h|256]=d+15<<10|32768,i[h]=13,i[h|256]=13):d<128?(s[h]=31744,s[h|256]=64512,i[h]=24,i[h|256]=24):(s[h]=31744,s[h|256]=64512,i[h]=13,i[h|256]=13)}const r=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64);for(let h=1;h<1024;++h){let d=h<<13,p=0;for(;(d&8388608)===0;)d<<=1,p-=8388608;d&=-8388609,p+=947912704,r[h]=d|p}for(let h=1024;h<2048;++h)r[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(u[h]=1024);return{floatView:e,uint32View:t,baseTable:s,shiftTable:i,mantissaTable:r,exponentTable:l,offsetTable:u}}function Di(o){Math.abs(o)>65504&&me("DataUtils.toHalfFloat(): Value out of range."),o=We(o,-65504,65504),na.floatView[0]=o;const e=na.uint32View[0],t=e>>23&511;return na.baseTable[t]+((e&8388607)>>na.shiftTable[t])}function xp(o){const e=o>>10;return na.uint32View[0]=na.mantissaTable[na.offsetTable[e]+(o&1023)]+na.exponentTable[e],na.floatView[0]}const os=new H,bp=new Fe;let nO=0;class Wi extends Wn{constructor(e,t,s=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:nO++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=s,this.usage=yc,this.updateRanges=[],this.gpuType=_s,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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,s){e*=this.itemSize,s*=t.itemSize;
vendor: 5,597 bytes, line 53
53for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[s+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,s=this.count;t<s;t++)bp.fromBufferAttribute(this,t),bp.applyMatrix3(e),this.setXY(t,bp.x,bp.y);else if(this.itemSize===3)for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyMatrix3(e),this.setXYZ(t,os.x,os.y,os.z);return this}applyMatrix4(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyMatrix4(e),this.setXYZ(t,os.x,os.y,os.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyNormalMatrix(e),this.setXYZ(t,os.x,os.y,os.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.transformDirection(e),this.setXYZ(t,os.x,os.y,os.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let s=this.array[e*this.itemSize+t];return this.normalized&&(s=si(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=He(s,this.array)),this.array[e*this.itemSize+t]=s,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=si(t,this.array)),t}setX(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=si(t,this.array)),t}setY(e,t){return this.normalized&&(t=He(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=si(t,this.array)),t}setZ(e,t){return this.normalized&&(t=He(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=si(t,this.array)),t}setW(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,s){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),s=He(s,this.array)),this.array[e+0]=t,this.array[e+1]=s,this}setXYZ(e,t,s,i){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),s=He(s,this.array),i=He(i,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,this}setXYZW(e,t,s,i,r){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),s=He(s,this.array),i=He(i,this.array),r=He(r,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,this.array[e+3]=r,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!==yc&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class VR extends Wi{constructor(e,t,s){super(new Uint16Array(e),t,s)}}class GR extends Wi{constructor(e,t,s){super(new Uint32Array(e),t,s)}}class IR extends Wi{constructor(e,t,s){super(new Uint16Array(e),t,s),this.isFloat16BufferAttribute=!0}getX(e){let t=xp(this.array[e*this.itemSize]);return this.normalized&&(t=si(t,this.array)),t}setX(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize]=Di(t),this}getY(e){let t=xp(this.array[e*this.itemSize+1]);return this.normalized&&(t=si(t,this.array)),t}setY(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+1]=Di(t),this}getZ(e){let t=xp(this.array[e*this.itemSize+2]);return this.normalized&&(t=si(t,this.array)),t}setZ(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+2]=Di(t),this}getW(e){let t=xp(this.array[e*this.itemSize+3]);return this.normalized&&(t=si(t,this.array)),t}setW(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+3]=Di(t),this}setXY(e,t,s){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),s=He(s,this.array)),this.array[e+0]=Di(t),this.array[e+1]=Di(s),this}setXYZ(e,t,s,i){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),s=He(s,this.array),i=He(i,this.array)),this.array[e+0]=Di(t),this.array[e+1]=Di(s),this.array[e+2]=Di(i),this}setXYZW(e,t,s,i,r){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),s=He(s,this.array),i=He(i,this.array),r=He(r,this.array)),this.array[e+0]=Di(t),this.array[e+1]=Di(s),this.array[e+2]=Di(i),this.array[e+3]=Di(r),this}}class ri extends Wi{constructor(e,t,s){super(new Float32Array(e),t,s)}}const rO=new Dd,Fh=new H,ab=new H;class Pg{constructor(e=new H,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 s=this.center;t!==void 0?s.copy(t):rO.setFromPoints(e).getCenter(s);let i=0;for(let r=0,l=e.length;r<l;r++)i=Math.max(i,s.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),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 s=this.center.distanceToSquared(e);return t.copy(e),s>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)}
vendor: 18,551 bytes, line 53
53applyMatrix4(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;Fh.subVectors(e,this.center);const t=Fh.lengthSq();if(t>this.radius*this.radius){const s=Math.sqrt(t),i=(s-this.radius)*.5;this.center.addScaledVector(Fh,i/s),this.radius+=i}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):(ab.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fh.copy(e.center).add(ab)),this.expandByPoint(Fh.copy(e.center).sub(ab))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let aO=0;const un=new Qe,ob=new us,Ru=new H,Ui=new Dd,Lh=new Dd,xs=new H;class Mr extends Wn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:aO++}),this.uuid=fa(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(AL(e)?GR:VR)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}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,s=0){this.groups.push({start:e,count:t,materialIndex:s})}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 s=this.attributes.normal;if(s!==void 0){const r=new js().getNormalMatrix(e);s.applyNormalMatrix(r),s.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return un.makeRotationFromQuaternion(e),this.applyMatrix4(un),this}rotateX(e){return un.makeRotationX(e),this.applyMatrix4(un),this}rotateY(e){return un.makeRotationY(e),this.applyMatrix4(un),this}rotateZ(e){return un.makeRotationZ(e),this.applyMatrix4(un),this}translate(e,t,s){return un.makeTranslation(e,t,s),this.applyMatrix4(un),this}scale(e,t,s){return un.makeScale(e,t,s),this.applyMatrix4(un),this}lookAt(e){return ob.lookAt(e),ob.updateMatrix(),this.applyMatrix4(ob.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ru).negate(),this.translate(Ru.x,Ru.y,Ru.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const s=[];for(let i=0,r=e.length;i<r;i++){const l=e[i];s.push(l.x,l.y,l.z||0)}this.setAttribute("position",new ri(s,3))}else{const s=Math.min(e.length,t.count);for(let i=0;i<s;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&me("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Dd);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){he("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new H(-1/0,-1/0,-1/0),new H(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let s=0,i=t.length;s<i;s++){const r=t[s];Ui.setFromBufferAttribute(r),this.morphTargetsRelative?(xs.addVectors(this.boundingBox.min,Ui.min),this.boundingBox.expandByPoint(xs),xs.addVectors(this.boundingBox.max,Ui.max),this.boundingBox.expandByPoint(xs)):(this.boundingBox.expandByPoint(Ui.min),this.boundingBox.expandByPoint(Ui.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&he('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 Pg);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){he("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new H,1/0);return}if(e){const s=this.boundingSphere.center;if(Ui.setFromBufferAttribute(e),t)for(let r=0,l=t.length;r<l;r++){const u=t[r];Lh.setFromBufferAttribute(u),this.morphTargetsRelative?(xs.addVectors(Ui.min,Lh.min),Ui.expandByPoint(xs),xs.addVectors(Ui.max,Lh.max),Ui.expandByPoint(xs)):(Ui.expandByPoint(Lh.min),Ui.expandByPoint(Lh.max))}Ui.getCenter(s);let i=0;for(let r=0,l=e.count;r<l;r++)xs.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(xs));if(t)for(let r=0,l=t.length;r<l;r++){const u=t[r],h=this.morphTargetsRelative;for(let d=0,p=u.count;d<p;d++)xs.fromBufferAttribute(u,d),h&&(Ru.fromBufferAttribute(e,d),xs.add(Ru)),i=Math.max(i,s.distanceToSquared(xs))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&he('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){he("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const s=t.position,i=t.normal,r=t.uv;let l=this.getAttribute("tangent");(l===void 0||l.count!==s.count)&&(l=new Wi(new Float32Array(4*s.count),4),this.setAttribute("tangent",l));const u=[],h=[];for(let V=0;V<s.count;V++)u[V]=new H,h[V]=new H;const d=new H,p=new H,m=new H,y=new Fe,b=new Fe,_=new Fe,v=new H,M=new H;function A(V,$,ie){d.fromBufferAttribute(s,V),p.fromBufferAttribute(s,$),m.fromBufferAttribute(s,ie),y.fromBufferAttribute(r,V),b.fromBufferAttribute(r,$),_.fromBufferAttribute(r,ie),p.sub(d),m.sub(d),b.sub(y),_.sub(y);const le=1/(b.x*_.y-_.x*b.y);isFinite(le)&&(v.copy(p).multiplyScalar(_.y).addScaledVector(m,-b.y).multiplyScalar(le),M.copy(m).multiplyScalar(b.x).addScaledVector(p,-_.x).multiplyScalar(le),u[V].add(v),u[$].add(v),u[ie].add(v),h[V].add(M),h[$].add(M),h[ie].add(M))}let C=this.groups;C.length===0&&(C=[{start:0,count:e.count}]);for(let V=0,$=C.length;V<$;++V){const ie=C[V],le=ie.start,ye=ie.count;for(let xe=le,Ne=le+ye;xe<Ne;xe+=3)A(e.getX(xe+0),e.getX(xe+1),e.getX(xe+2))}const E=new H,F=new H,L=new H,U=new H;function R(V){L.fromBufferAttribute(i,V),U.copy(L);const $=u[V];E.copy($),E.sub(L.multiplyScalar(L.dot($))).normalize(),F.crossVectors(U,$);const le=F.dot(h[V])<0?-1:1;l.setXYZW(V,E.x,E.y,E.z,le)}for(let V=0,$=C.length;V<$;++V){const ie=C[V],le=ie.start,ye=ie.count;for(let xe=le,Ne=le+ye;xe<Ne;xe+=3)R(e.getX(xe+0)),R(e.getX(xe+1)),R(e.getX(xe+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let s=this.getAttribute("normal");if(s===void 0||s.count!==t.count)s=new Wi(new Float32Array(t.count*3),3),this.setAttribute("normal",s);else for(let y=0,b=s.count;y<b;y++)s.setXYZ(y,0,0,0);const i=new H,r=new H,l=new H,u=new H,h=new H,d=new H,p=new H,m=new H;if(e)for(let y=0,b=e.count;y<b;y+=3){const _=e.getX(y+0),v=e.getX(y+1),M=e.getX(y+2);i.fromBufferAttribute(t,_),r.fromBufferAttribute(t,v),l.fromBufferAttribute(t,M),p.subVectors(l,r),m.subVectors(i,r),p.cross(m),u.fromBufferAttribute(s,_),h.fromBufferAttribute(s,v),d.fromBufferAttribute(s,M),u.add(p),h.add(p),d.add(p),s.setXYZ(_,u.x,u.y,u.z),s.setXYZ(v,h.x,h.y,h.z),s.setXYZ(M,d.x,d.y,d.z)}else for(let y=0,b=t.count;y<b;y+=3)i.fromBufferAttribute(t,y+0),r.fromBufferAttribute(t,y+1),l.fromBufferAttribute(t,y+2),p.subVectors(l,r),m.subVectors(i,r),p.cross(m),s.setXYZ(y+0,p.x,p.y,p.z),s.setXYZ(y+1,p.x,p.y,p.z),s.setXYZ(y+2,p.x,p.y,p.z);this.normalizeNormals(),s.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,s=e.count;t<s;t++)xs.fromBufferAttribute(e,t),xs.normalize(),e.setXYZ(t,xs.x,xs.y,xs.z)}toNonIndexed(){function e(u,h){const d=u.array,p=u.itemSize,m=u.normalized,y=new d.constructor(h.length*p);let b=0,_=0;for(let v=0,M=h.length;v<M;v++){u.isInterleavedBufferAttribute?b=h[v]*u.data.stride+u.offset:b=h[v]*p;for(let A=0;A<p;A++)y[_++]=d[b++]}return new Wi(y,p,m)}if(this.index===null)return me("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Mr,s=this.index.array,i=this.attributes;for(const u in i){const h=i[u],d=e(h,s);t.setAttribute(u,d)}const r=this.morphAttributes;for(const u in r){const h=[],d=r[u];for(let p=0,m=d.length;p<m;p++){const y=d[p],b=e(y,s);h.push(b)}t.morphAttributes[u]=h}t.morphTargetsRelative=this.morphTargetsRelative;const l=this.groups;for(let u=0,h=l.length;u<h;u++){const d=l[u];t.addGroup(d.start,d.count,d.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const h=this.parameters;for(const d in h)h[d]!==void 0&&(e[d]=h[d]);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 s=this.attributes;for(const h in s){const d=s[h];e.data.attributes[h]=d.toJSON(e.data)}const i={};let r=!1;for(const h in this.morphAttributes){const d=this.morphAttributes[h],p=[];for(let m=0,y=d.length;m<y;m++){const b=d[m];p.push(b.toJSON(e.data))}p.length>0&&(i[h]=p,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const u=this.boundingSphere;return u!==null&&(e.data.boundingSphere=u.toJSON()),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 s=e.index;s!==null&&this.setIndex(s.clone());const i=e.attributes;for(const d in i){const p=i[d];this.setAttribute(d,p.clone(t))}const r=e.morphAttributes;for(const d in r){const p=[],m=r[d];for(let y=0,b=m.length;y<b;y++)p.push(m[y].clone(t));this.morphAttributes[d]=p}this.morphTargetsRelative=e.morphTargetsRelative;const l=e.groups;for(let d=0,p=l.length;d<p;d++){const m=l[d];this.addGroup(m.start,m.count,m.materialIndex)}const u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());const h=e.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class kR{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=yc,this.updateRanges=[],this.version=0,this.uuid=fa()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,s){e*=this.stride,s*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[s+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fa()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),s=new this.constructor(t,this.stride);return s.setUsage(this.usage),s}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fa()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Qs=new H;class eT{constructor(e,t,s,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=s,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,s=this.data.count;t<s;t++)Qs.fromBufferAttribute(this,t),Qs.applyMatrix4(e),this.setXYZ(t,Qs.x,Qs.y,Qs.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)Qs.fromBufferAttribute(this,t),Qs.applyNormalMatrix(e),this.setXYZ(t,Qs.x,Qs.y,Qs.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)Qs.fromBufferAttribute(this,t),Qs.transformDirection(e),this.setXYZ(t,Qs.x,Qs.y,Qs.z);return this}getComponent(e,t){let s=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(s=si(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=He(s,this.array)),this.data.array[e*this.data.stride+this.offset+t]=s,this}setX(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=si(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=si(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=si(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=si(t,this.array)),t}setXY(e,t,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=He(t,this.array),s=He(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this}setXYZ(e,t,s,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=He(t,this.array),s=He(s,this.array),i=He(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this}setXYZW(e,t,s,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=He(t,this.array),s=He(s,this.array),i=He(i,this.array),r=He(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){h_("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Wi(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new eT(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){h_("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let oO=0;class ji extends Wn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:oO++}),this.uuid=fa(),this.name="",this.type="Material",this.blending=gn,this.side=dr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Td,this.blendDst=vd,this.blendEquation=yn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xe(0,0,0),this.blendAlpha=0,this.depthFunc=hc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=u_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=al,this.stencilZFail=al,this.stencilZPass=al,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.allowOverride=!0,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}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const s=e[t];if(s===void 0){me(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){me(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(s):i&&i.isVector2&&s&&s.isVector2||i&&i.isEuler&&s&&s.isEuler||i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[t]=s}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 16,661 bytes, line 53
53s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),this.roughness!==void 0&&(s.roughness=this.roughness),this.metalness!==void 0&&(s.metalness=this.metalness),this.sheen!==void 0&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(s.shininess=this.shininess),this.clearcoat!==void 0&&(s.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(s.dispersion=this.dispersion),this.iridescence!==void 0&&(s.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(s.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(s.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(e).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(e).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(e).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(e).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(e).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(s.combine=this.combine)),this.envMapRotation!==void 0&&(s.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(s.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(s.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(s.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(s.size=this.size),this.shadowSide!==null&&(s.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==gn&&(s.blending=this.blending),this.side!==dr&&(s.side=this.side),this.vertexColors===!0&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),this.transparent===!0&&(s.transparent=!0),this.blendSrc!==Td&&(s.blendSrc=this.blendSrc),this.blendDst!==vd&&(s.blendDst=this.blendDst),this.blendEquation!==yn&&(s.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(s.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(s.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==hc&&(s.depthFunc=this.depthFunc),this.depthTest===!1&&(s.depthTest=this.depthTest),this.depthWrite===!1&&(s.depthWrite=this.depthWrite),this.colorWrite===!1&&(s.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==u_&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==al&&(s.stencilFail=this.stencilFail),this.stencilZFail!==al&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==al&&(s.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(s.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(s.rotation=this.rotation),this.polygonOffset===!0&&(s.polygonOffset=!0),this.polygonOffsetFactor!==0&&(s.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(s.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(s.linewidth=this.linewidth),this.dashSize!==void 0&&(s.dashSize=this.dashSize),this.gapSize!==void 0&&(s.gapSize=this.gapSize),this.scale!==void 0&&(s.scale=this.scale),this.dithering===!0&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),this.alphaHash===!0&&(s.alphaHash=!0),this.alphaToCoverage===!0&&(s.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(s.premultipliedAlpha=!0),this.forceSinglePass===!0&&(s.forceSinglePass=!0),this.allowOverride===!1&&(s.allowOverride=!1),this.wireframe===!0&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(s.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(s.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(s.flatShading=!0),this.visible===!1&&(s.visible=!1),this.toneMapped===!1&&(s.toneMapped=!1),this.fog===!1&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData);function i(r){const l=[];for(const u in r){const h=r[u];delete h.metadata,l.push(h)}return l}if(t){const r=i(e.textures),l=i(e.images);r.length>0&&(s.textures=r),l.length>0&&(s.images=l)}return s}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Xe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),this.normalScale=new Fe().fromArray(s)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Fe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}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 s=null;if(t!==null){const i=t.length;s=new Array(i);for(let r=0;r!==i;++r)s[r]=t[r].clone()}return this.clippingPlanes=s,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 9,002 bytes, line 53
53adows,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.allowOverride=e.allowOverride,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 lO extends ji{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Yr=new H,lb=new H,_p=new H,Ya=new H,ub=new H,Tp=new H,cb=new H;class HR{constructor(e=new H,t=new H(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,Yr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const s=t.dot(this.direction);return s<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Yr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yr.copy(this.origin).addScaledVector(this.direction,t),Yr.distanceToSquared(e))}distanceSqToSegment(e,t,s,i){lb.copy(e).add(t).multiplyScalar(.5),_p.copy(t).sub(e).normalize(),Ya.copy(this.origin).sub(lb);const r=e.distanceTo(t)*.5,l=-this.direction.dot(_p),u=Ya.dot(this.direction),h=-Ya.dot(_p),d=Ya.lengthSq(),p=Math.abs(1-l*l);let m,y,b,_;if(p>0)if(m=l*h-u,y=l*u-h,_=r*p,m>=0)if(y>=-_)if(y<=_){const v=1/p;m*=v,y*=v,b=m*(m+l*y+2*u)+y*(l*m+y+2*h)+d}else y=r,m=Math.max(0,-(l*y+u)),b=-m*m+y*(y+2*h)+d;else y=-r,m=Math.max(0,-(l*y+u)),b=-m*m+y*(y+2*h)+d;else y<=-_?(m=Math.max(0,-(-l*r+u)),y=m>0?-r:Math.min(Math.max(-r,-h),r),b=-m*m+y*(y+2*h)+d):y<=_?(m=0,y=Math.min(Math.max(-r,-h),r),b=y*(y+2*h)+d):(m=Math.max(0,-(l*r+u)),y=m>0?r:Math.min(Math.max(-r,-h),r),b=-m*m+y*(y+2*h)+d);else y=l>0?-r:r,m=Math.max(0,-(l*y+u)),b=-m*m+y*(y+2*h)+d;return s&&s.copy(this.origin).addScaledVector(this.direction,m),i&&i.copy(lb).addScaledVector(_p,y),b}intersectSphere(e,t){Yr.subVectors(e.center,this.origin);const s=Yr.dot(this.direction),i=Yr.dot(Yr)-s*s,r=e.radius*e.radius;if(i>r)return null;const l=Math.sqrt(r-i),u=s-l,h=s+l;return h<0?null:u<0?this.at(h,t):this.at(u,t)}intersectsSphere(e){return e.radius<0?!1: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 s=-(this.origin.dot(e.normal)+e.constant)/t;return s>=0?s:null}intersectPlane(e,t){const s=this.distanceToPlane(e);return s===null?null:this.at(s,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let s,i,r,l,u,h;const d=1/this.direction.x,p=1/this.direction.y,m=1/this.direction.z,y=this.origin;return d>=0?(s=(e.min.x-y.x)*d,i=(e.max.x-y.x)*d):(s=(e.max.x-y.x)*d,i=(e.min.x-y.x)*d),p>=0?(r=(e.min.y-y.y)*p,l=(e.max.y-y.y)*p):(r=(e.max.y-y.y)*p,l=(e.min.y-y.y)*p),s>l||r>i||((r>s||isNaN(s))&&(s=r),(l<i||isNaN(i))&&(i=l),m>=0?(u=(e.min.z-y.z)*m,h=(e.max.z-y.z)*m):(u=(e.max.z-y.z)*m,h=(e.min.z-y.z)*m),s>h||u>i)||((u>s||s!==s)&&(s=u),(h<i||i!==i)&&(i=h),i<0)?null:this.at(s>=0?s:i,t)}intersectsBox(e){return this.intersectBox(e,Yr)!==null}intersectTriangle(e,t,s,i,r){ub.subVectors(t,e),Tp.subVectors(s,e),cb.crossVectors(ub,Tp);let l=this.direction.dot(cb),u;if(l>0){if(i)return null;u=1}else if(l<0)u=-1,l=-l;else return null;Ya.subVectors(this.origin,e);const h=u*this.direction.dot(Tp.crossVectors(Ya,Tp));if(h<0)return null;const d=u*this.direction.dot(ub.cross(Ya));if(d<0||h+d>l)return null;const p=-u*Ya.dot(cb);return p<0?null:this.at(p/l,r)}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 ao extends ji{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(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 _r,this.combine=Fg,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 _N=new Qe,Zo=new HR,vp=new Pg,TN=new H,Sp=new H,Mp=new H,Ap=new H,hb=new H,Np=new H,vN=new H,wp=new H;class Tr extends us{constructor(e=new Mr,t=new ao){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,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,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=i.length;r<l;r++){const u=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[u]=r}}}}getVertexPosition(e,t){const s=this.geometry,i=s.attributes.position,r=s.morphAttributes.position,l=s.morphTargetsRelative;t.fromBufferAttribute(i,e);const u=this.morphTargetInfluences;if(r&&u){Np.set(0,0,0);for(let h=0,d=r.length;h<d;h++){const p=u[h],m=r[h];p!==0&&(hb.fromBufferAttribute(m,e),l?Np.addScaledVector(hb,p):Np.addScaledVector(hb.sub(t),p))}t.add(Np)}return t}raycast(e,t){const s=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(s.boundingSphere===null&&s.computeBoundingSphere(),vp.copy(s.boundingSphere),vp.applyMatrix4(r),Zo.copy(e.ray).recast(e.near),!(vp.containsPoint(Zo.origin)===!1&&(Zo.intersectSphere(vp,TN)===null||Zo.origin.distanceToSquared(TN)>(e.far-e.near)**2))&&(_N.copy(r).invert(),Zo.copy(e.ray).applyMatrix4(_N),!(s.boundingBox!==null&&Zo.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,t,Zo)))}_computeIntersections(e,t,s){let i;const r=this.geometry,l=this.material,u=r.index,h=r.attributes.position,d=r.attributes.uv,p=r.attributes.uv1,m=r.attributes.normal,y=r.groups,b=r.drawRange;if(u!==null)if(Array.isArray(l))for(let _=0,v=y.length;_<v;_++){const M=y[_],A=l[M.materialIndex],C=Math.max(M.start,b.start),E=Math.min(u.count,Math.min(M.start+M.count,b.start+b.count));for(let F=C,L=E;F<L;F+=3){const U=u.getX(F),R=u.getX(F+1),V=u.getX(F+2);i=Rp(this,A,e,s,d,p,m,U,R,V),i&&(i.faceIndex=Math.floor(F/3),i.face.materialIndex=M.materialIndex,t.push(i))}}else{const _=Math.max(0,b.start),v=Math.min(u.count,b.start+b.count);for(let M=_,A=v;M<A;M+=3){const C=u.getX(M),E=u.getX(M+1),F=u.getX(M+2);i=Rp(this,l,e,s,d,p,m,C,E,F),i&&(i.faceIndex=Math.floor(M/3),t.push(i))}}else if(h!==void 0)if(Array.isArray(l))for(let _=0,v=y.length;_<v;_++){const M=y[_],A=l[M.materialIndex],C=Math.max(M.start,b.start),E=Math.min(h.count,Math.min(M.start+M.count,b.start+b.count));for(let F=C,L=E;F<L;F+=3){const U=F,R=F+1,V=F+2;i=Rp(this,A,e,s,d,p,m,U,R,V),i&&(i.faceIndex=Math.floor(F/3),i.face.materialIndex=M.materialIndex,t.push(i))}}else{const _=Math.max(0,b.start),v=Math.min(h.count,b.start+b.count);for(let M=_,A=v;M<A;M+=3){const C=M,E=M+1,F=M+2;i=Rp(this,l,e,s,d,p,m,C,E,F),i&&(i.faceIndex=Math.floor(M/3),t.pu
vendor: 13,412 bytes, line 53
53sh(i))}}}}function uO(o,e,t,s,i,r,l,u){let h;if(e.side===Ts?h=s.intersectTriangle(l,r,i,!0,u):h=s.intersectTriangle(i,r,l,e.side===dr,u),h===null)return null;wp.copy(u),wp.applyMatrix4(o.matrixWorld);const d=t.ray.origin.distanceTo(wp);return d<t.near||d>t.far?null:{distance:d,point:wp.clone(),object:o}}function Rp(o,e,t,s,i,r,l,u,h,d){o.getVertexPosition(u,Sp),o.getVertexPosition(h,Mp),o.getVertexPosition(d,Ap);const p=uO(o,e,t,s,Sp,Mp,Ap,vN);if(p){const m=new H;Vn.getBarycoord(vN,Sp,Mp,Ap,m),i&&(p.uv=Vn.getInterpolatedAttribute(i,u,h,d,m,new Fe)),r&&(p.uv1=Vn.getInterpolatedAttribute(r,u,h,d,m,new Fe)),l&&(p.normal=Vn.getInterpolatedAttribute(l,u,h,d,m,new H),p.normal.dot(s.direction)>0&&p.normal.multiplyScalar(-1));const y={a:u,b:h,c:d,normal:new H,materialIndex:0};Vn.getNormal(Sp,Mp,Ap,y.normal),p.face=y,p.barycoord=m}return p}class qR extends qs{constructor(e=null,t=1,s=1,i,r,l,u,h,d=$t,p=$t,m,y){super(null,l,u,h,d,p,i,r,m,y),this.isDataTexture=!0,this.image={data:e,width:t,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rc extends Wi{constructor(e,t,s,i=1){super(e,t,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const db=new H,cO=new H,hO=new js;class ta{constructor(e=new H(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,s,i){return this.normal.set(e,t,s),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const i=db.subVectors(s,t).cross(cO.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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,s=!0){const i=e.delta(db),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const l=-(e.start.dot(this.normal)+this.constant)/r;return s===!0&&(l<0||l>1)?null:t.copy(e.start).addScaledVector(i,l)}intersectsLine(e){const t=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return t<0&&s>0||s<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 s=t||hO.getNormalMatrix(e),i=this.coplanarPoint(db).applyMatrix4(e),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(r),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 Qo=new Pg,dO=new Fe(.5,.5),Ep=new H;class dg{constructor(e=new ta,t=new ta,s=new ta,i=new ta,r=new ta,l=new ta){this.planes=[e,t,s,i,r,l]}set(e,t,s,i,r,l){const u=this.planes;return u[0].copy(e),u[1].copy(t),u[2].copy(s),u[3].copy(i),u[4].copy(r),u[5].copy(l),this}copy(e){const t=this.planes;for(let s=0;s<6;s++)t[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,t=Hi,s=!1){const i=this.planes,r=e.elements,l=r[0],u=r[1],h=r[2],d=r[3],p=r[4],m=r[5],y=r[6],b=r[7],_=r[8],v=r[9],M=r[10],A=r[11],C=r[12],E=r[13],F=r[14],L=r[15];if(i[0].setComponents(d-l,b-p,A-_,L-C).normalize(),i[1].setComponents(d+l,b+p,A+_,L+C).normalize(),i[2].setComponents(d+u,b+m,A+v,L+E).normalize(),i[3].setComponents(d-u,b-m,A-v,L-E).normalize(),s)i[4].setComponents(h,y,M,F).normalize(),i[5].setComponents(d-h,b-y,A-M,L-F).normalize();else if(i[4].setComponents(d-h,b-y,A-M,L-F).normalize(),t===Hi)i[5].setComponents(d+h,b+y,A+M,L+F).normalize();else if(t===An)i[5].setComponents(h,y,M,F).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(),Qo.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qo)}intersectsSprite(e){Qo.center.set(0,0,0);const t=dO.distanceTo(e.center);return Qo.radius=.7071067811865476+t,Qo.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qo)}intersectsSphere(e){const t=this.planes,s=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(s)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let s=0;s<6;s++){const i=t[s];if(Ep.x=i.normal.x>0?e.max.x:e.min.x,Ep.y=i.normal.y>0?e.max.y:e.min.y,Ep.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ep)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let s=0;s<6;s++)if(t[s].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const SN=new Qe;class tT{constructor(){this.coordinateSystem=Hi,this._frustums=[],this._count=0}setFromArrayCamera(e){const t=e.cameras,s=this._frustums;for(let i=0;i<t.length;i++){const r=t[i];SN.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),s[i]===void 0&&(s[i]=new dg),s[i].setFromProjectionMatrix(SN,r.coordinateSystem,r.reversedDepth)}return this._count=t.length,this}intersectsObject(e){const t=this._frustums;for(let s=0;s<this._count;s++)if(t[s].intersectsObject(e))return!0;return!1}intersectsSprite(e){const t=this._frustums;for(let s=0;s<this._count;s++)if(t[s].intersectsSprite(e))return!0;return!1}intersectsSphere(e){const t=this._frustums;for(let s=0;s<this._count;s++)if(t[s].intersectsSphere(e))return!0;return!1}intersectsBox(e){const t=this._frustums;for(let s=0;s<this._count;s++)if(t[s].intersectsBox(e))return!0;return!1}containsPoint(e){const t=this._frustums;for(let s=0;s<this._count;s++)if(t[s].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;const t=this._frustums,s=e._frustums;for(let i=0;i<e._count;i++)t[i]===void 0&&(t[i]=new dg),t[i].copy(s[i]);return this._count=e._count,this}clone(){return new tT().copy(this)}}class $R extends ji{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xe(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}}class fO extends ji{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Xe(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}}class sT extends qs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=$t,this.minFilter=$t,this.generateMipmaps=!1,this.needsUpdate=!0}}class Vg extends qs{constructor(e=[],t=dc,s,i,r,l,u,h,d,p){super(e,t,s,i,r,l,u,h,d,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Sn extends qs{constructor(e,t,s=Ut,i,r,l,u=$t,h=$t,d,p=vn,m=1){if(p!==vn&&p!==fr)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const y={width:e,height:t,depth:m};super(y,i,r,l,u,h,p,s,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new K_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class pO extends Sn{constructor(e,t=Ut,s=dc,i,r,l=$t,u=$t,h,d=vn){const p={width:e,height:e,depth:1},m=[p,p,p,p,p,p];super(e,e,t,s,i,r,l,u,h,d),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Gg extends Mr{constructor(e=1,t=1,s=1,i=1,r=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:s,widthSegments:i,heightSegments:r,depthSegments:l};const u=this;i=Math.floor(i),r=Math.floor(r),l=Math.floor(l);const h=[],d=[],p=[],m=[];let y=0,b=0;_("z","y","x",-1,-1,s,t,e,l,r,0),_("z","y","x",1,-1,s,t,-e,l,r,1),_("x","z","y",1,1,e,s,t,i,l,2),_("x","z","y",1,-1,e,s,-t,i,l,3),_("x","y","z",1,-1,e,t,s,i,r,4),_("x","y","z",-1,-1,e,t,-s,i,r,5),this.setIndex(h),this.setAttribute("position",new ri(d,3)),this.setAttribute("normal",new ri(p,3)),this.setAttribute("uv",new ri(m,2));function _(v,M,A,C,E,F,L,U,R,V,$){const ie=F/R,le=L/V,ye=F/2,xe=L/2,Ne=U/2,ce=R+1,X=V+1;let ne=0,fe=0;const Be=new H;for(let Ce=0;Ce<X;Ce++){const G=Ce*le-xe;for(let j=0;j<ce;j++){const te=j*ie-ye;Be[v]=te*C,Be[M]=G*E,Be[A]=Ne,d.push(Be.x,Be.y,Be.z),Be[v]=0,Be[M]=0,Be[A]=U>0?1:-1,p.push(Be.x,Be.y,Be.z),m.push(j/R),m.push(1-Ce/V),ne+=1}}for(let Ce=0;Ce<V;Ce++)for(let G=0;G<R;G++){const j=y+G+ce*Ce,te=y+G+ce*(Ce+1),pe=y+(G+1)+ce*(Ce+1),_e=y+(G+1)+ce*Ce;h.push(j,te,_e),h.push(te,pe,_e),fe+=6}u.addGroup(b,fe,$),b+=fe,y+=ne}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gg(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class iT extends Mr{constructor(e=1,t=1,s=1,i=32,r=1,l=!1,u=0,h=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:s,radialSegments:i,heightSegments:r,openEnded:l,thetaStart:u,thetaLength:h};const d=this;i=Math.floor(i),r=Math.floor(r);const p=[],m=[],y=[],b=[];let _=0;const v=[],M=s/2;let A=0;C(),l===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(p),this.setAttribute("position",new ri(m,3)),this.setAttribute("normal",new ri(y,3)),this.setAttribute("uv",new ri(b,2));function C(){const F=new H,L=new H;let U=0;const R=(t-e)/s;for(let V=0;V<=r;V++){const $=[],ie=V/r,le=ie*(t-e)+e;for(let ye=0;ye<=i;ye++){const xe=ye/i,Ne=xe*h+u,ce=Math.sin(Ne),X=Math.cos(Ne);L.x=le*ce,L.y=-ie*s+M,L.z=le*X,m.push(L.x,L.y,L.z),F.set(ce,R,X).normalize(),y.push(F.x,F.y,F.z),b.push(xe,1-ie),$.push(_++)}v.push($)}for(let V=0;V<i;V++)for(let $=0;$<r;$++){const ie=v[$][V],le=v[$+1][V],ye=v[$+1][V+1],xe=v[$][V+1];(e>0||$!==0)&&(p.push(ie,le,xe),U+=3),(t>0||$!==r-1)&&(p.push(le,ye,xe),U+=3)}d.addGroup(A,U,0),A+=U}function E(F){const L=_,U=new Fe,R=new H;let V=0;const $=F===!0?e:t,ie=F===!0?1:-1;for(let ye=1;ye<=i;ye++)m.push(0,M*ie,0),y.push(0,ie,0),b.push(.5,.5),_++;const le=_;for(let ye=0;ye<=i;ye++){const Ne=ye/i*h+u,ce=Math.cos(Ne),X=Math.sin(Ne);R.x=$*X,R.y=M*ie,R.z=$*ce,m.push(R.x,R.y,R.z),y.push(0,ie,0),U.x=ce*.5+.5,U.y=X*.5*ie+.5,b.push(U.x,U.y),_++}for(let ye=0;ye<i;ye++){const xe=L+ye,Ne=le+ye;F===!0?p.push(Ne,Ne+1,xe):p.push(Ne+1,Ne,xe),V+=3}d.addGroup(A,V,F===!0?1:2),A+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iT(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ig extends Mr{constructor(e=1,t=1,s=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:s,heightSegments:i};const r=e/2,l=t/2,u=Math.floor(s),h=Math.floor(i),d=u+1,p=h+1,m=e/u,y=t/h,b=[],_=[],v=[],M=[];for(let A=0;A<p;A++){const C=A*y-l;for(let E=0;E<d;E++){const F=E*m-r;_.push(F,-C,0),v.push(0,0,1),M.push(E/u),M.push(1-A/h)}}for(let A=0;A<h;A++)for(let C=0;C<u;C++){const E=C+d*A,F=C+d*(A+1),L=C+1+d*(A+1),U=C+1+d*A;b.push(E,F,U),b.push(F,L,U)}this.setIndex(b),this.setAttribute("position",new ri(_,3)),this.setAttribute("normal",new ri(v,3)),this.setAttribute("uv",new ri(M,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ig(e.width,e.height,e.widthSegments,e.heightSegments)}}class kg extends Mr{constructor(e=1,t=32,s=16,i=0,r=Math.PI*2,l=0,u=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:s,phiStart:i,phiLength:r,thetaStart:l,thetaLength:u},t=Math.max(3,Math.floor(t)),s=Math.max(2,Math.floor(s));const h=Math.min(l+u,Math.PI);let d=0;const p=[],m=new H,y=new H,b=[],_=[],v=[],M=[];for(let A=0;A<=s;A++){const C=[],E=A/s,F=l+E*u,L=e*Math.cos(F),U=Math.sqrt(e*e-L*L);let R=0;A===0&&l===0?R=.5/t:A===s&&h===Math.PI&&(R=-.5/t);for(let V=0;V<=t;V++){const $=V/t,ie=i+$*r;m.x=-U*Math.cos(ie),m.y=L,m.z=U*Math.sin(ie),_.push(m.x,m.y,m.z),y.copy(m).normalize(),v.push(y.x,y.y,y.z),M.push($+R,1-E),C.push(d++)}p.push(C)}for(let A=0;A<s;A++)for(let C=0;C<t;C++){const E=p[A][C+1],F=p[A][C],L=p[A+1][C],U=p[A+1][C+1];(A!==0||l>0)&&b.push(E,F,U),(A!==s-1||h<Math.PI)&&b.push(F,L,U)}this.setIndex(b),this.setAttribute("position",new ri(_,3)),this.setAttribute("normal",new ri(v,3)),this.setAttribute("uv",new ri(M,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}
vendor: 11,357 bytes, line 53
53static fromJSON(e){return new kg(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class mO extends ji{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Xe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class WR extends ji{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _r,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class gO extends WR{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Fe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return We(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class yO extends ji{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _r,this.combine=Fg,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,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.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class xO extends ji{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class bO extends ji{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class _O extends ji{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _r,this.combine=Fg,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,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.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}
vendor: 5,703 bytes, line 53
53class TO extends ji{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vO extends $R{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}class Nl extends us{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Xe(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class SO extends Nl{constructor(e,t,s){super(e,s),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(us.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Xe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const fb=new Qe,MN=new H,AN=new H;class nT{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Fe(512,512),this.mapType=Ds,this.map=null,this.mapPass=null,this.matrix=new Qe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new dg,this._frameExtents=new Fe(1,1),this._viewportCount=1,this._viewports=[new ht(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,s=this.matrix;MN.setFromMatrixPosition(e.matrixWorld),t.position.copy(MN),AN.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(AN),t.updateMatrixWorld(),fb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fb,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===An||t.reversedDepth?s.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(fb)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Cp=new H,Bp=new ma,Kn=new H;class XR extends us{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Qe,this.projectionMatrix=new Qe,this.projectionMatrixInverse=new Qe,this.coordinateSystem=Hi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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.matrixWorld.decompose(Cp,Bp,Kn),Kn.x===1&&Kn.y===1&&Kn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Cp,Bp,Kn.set(1,1,1)).invert()}updateWorldMatrix(e,t,s=!1){super.updateWorldMatrix(e,t,s),this.matrixWorld.decompose(Cp,Bp,Kn),Kn.x===1&&Kn.y===1&&Kn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Cp,Bp,Kn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Za=new H,NN=new Fe,wN=new Fe;class yi extends XR{constructor(e=50,t=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,this.far=i,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=xc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(cd*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,977 bytes, line 53
53getEffectiveFOV(){return xc*2*Math.atan(Math.tan(cd*.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,s){Za.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Za.x,Za.y).multiplyScalar(-e/Za.z),Za.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(Za.x,Za.y).multiplyScalar(-e/Za.z)}getViewSize(e,t){return this.getViewBounds(e,NN,wN),t.subVectors(wN,NN)}setViewOffset(e,t,s,i,r,l){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=s,this.view.offsetY=i,this.view.width=r,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(cd*.5*this.fov)/this.zoom,s=2*t,i=this.aspect*s,r=-.5*i;const l=this.view;if(this.view!==null&&this.view.enabled){const h=l.fullWidth,d=l.fullHeight;r+=l.offsetX*i/h,t-=l.offsetY*s/d,i*=l.width/h,s*=l.height/d}const u=this.filmOffset;u!==0&&(r+=e*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-s,e,this.far,this.coordinateSystem,this.reversedDepth),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}}class MO extends nT{constructor(){super(new yi(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,s=xc*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(s!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=s,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class rT extends Nl{constructor(e,t,s=0,i=Math.PI/3,r=0,l=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(us.DEFAULT_UP),this.updateMatrix(),this.target=new us,this.distance=s,this.angle=i,this.penumbra=r,this.decay=l,this.map=null,this.shadow=new MO}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class AO extends nT{constructor(){super(new yi(90,1,.5,500)),this.isPointLightShadow=!0}}class NO extends Nl{constructor(e,t,s=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=s,this.decay=i,this.shadow=new AO}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class aT extends XR{constructor(e=-1,t=1,s=1,i=-1,r=.1,l=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=s,this.bottom=i,this.near=r,this.far=l,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,s,i,r,l){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=s,this.view.offsetY=i,this.view.width=r,this.view.height=l,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),s=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=s-e,l=s+e,u=i+t,h=i-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=d*this.view.offsetX,l=r+d*this.view.width,u-=p*this.view.offsetY,h=u-p*this.view.height}
vendor: 4,398 bytes, line 53
53this.projectionMatrix.makeOrthographic(r,l,u,h,this.near,this.far,this.coordinateSystem,this.reversedDepth),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}}class wO extends nT{constructor(){super(new aT(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class RO extends Nl{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(us.DEFAULT_UP),this.updateMatrix(),this.target=new us,this.shadow=new wO}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class EO extends Nl{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class CO extends Nl{constructor(e,t,s=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=s,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class BO{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new H)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const s=e.x,i=e.y,r=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.282095),t.addScaledVector(l[1],.488603*i),t.addScaledVector(l[2],.488603*r),t.addScaledVector(l[3],.488603*s),t.addScaledVector(l[4],1.092548*(s*i)),t.addScaledVector(l[5],1.092548*(i*r)),t.addScaledVector(l[6],.315392*(3*r*r-1)),t.addScaledVector(l[7],1.092548*(s*r)),t.addScaledVector(l[8],.546274*(s*s-i*i)),t}getIrradianceAt(e,t){const s=e.x,i=e.y,r=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.886227),t.addScaledVector(l[1],2*.511664*i),t.addScaledVector(l[2],2*.511664*r),t.addScaledVector(l[3],2*.511664*s),t.addScaledVector(l[4],2*.429043*s*i),t.addScaledVector(l[5],2*.429043*i*r),t.addScaledVector(l[6],.743125*r*r-.247708),t.addScaledVector(l[7],2*.429043*s*r),t.addScaledVector(l[8],.429043*(s*s-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let s=0;s<9;s++)this.coefficients[s].addScaledVector(e.coefficients[s],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let s=0;s<9;s++)this.coefficients[s].lerp(e.coefficients[s],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const s=this.coefficients;for(let i=0;i<9;i++)s[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const s=this.coefficients;for(let i=0;i<9;i++)s[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const s=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*s,t[4]=1.092548*s*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*s*r,t[8]=.546274*(s*s-i*i)}}class DO extends Nl{constructor(e=new BO,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}const Eu=-90,Cu=1;class UO extends us{constructor(e,t,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new yi(Eu,Cu,e,t);i.layers=this.layers,this.add(i);const r=new yi(Eu,Cu,e,t);r.layers=this.layers,this.add(r);const l=new yi(Eu,Cu,e,t);l.layers=this.layers,this.add(l);const u=new yi(Eu,Cu,e,t);u.layers=this.layers,this.add(u);const h=new yi(Eu,Cu,e,t);h.layers=this.layers,this.add(h);const d=new yi(Eu,Cu,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[s,i,r,l,u,h]=t;
vendor: 4,396 bytes, line 53
53for(const d of t)this.remove(d);if(e===Hi)s.up.set(0,1,0),s.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===An)s.up.set(0,-1,0),s.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of t)this.add(d),d.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,l,u,h,d,p]=this.children,m=e.getRenderTarget(),y=e.getActiveCubeFace(),b=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const v=s.texture.generateMipmaps;s.texture.generateMipmaps=!1;let M=!1;e.isWebGLRenderer===!0?M=e.state.buffers.depth.getReversed():M=e.reversedDepthBuffer,e.setRenderTarget(s,0,i),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(s,1,i),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(s,2,i),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(s,3,i),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(s,4,i),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),s.texture.generateMipmaps=v,e.setRenderTarget(s,5,i),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(m,y,b),e.xr.enabled=_,s.texture.needsPMREMUpdate=!0}}class FO extends yi{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class LO extends kR{constructor(e,t,s=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class RN{constructor(e=1,t=0,s=0){this.radius=e,this.phi=t,this.theta=s}set(e,t,s){return this.radius=e,this.phi=t,this.theta=s,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=We(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,s){return this.radius=Math.sqrt(e*e+t*t+s*s),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,s),this.phi=Math.acos(We(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Hg{static{Hg.prototype.isMatrix2=!0}constructor(e,t,s,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,s,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let s=0;s<4;s++)this.elements[s]=e[s+t];return this}set(e,t,s,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=s,r[3]=i,this}}class OO extends Wn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){me("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function zO(o,e,t,s){const i=PO(s);switch(t){case X_:return o*e;case Mc:return o*e/i.components*i.byteLength;case Ac:return o*e/i.components*i.byteLength;case xn:return o*e*2/i.components*i.byteLength;case Nc:return o*e*2/i.components*i.byteLength;case Sc:return o*e*3/i.components*i.byteLength;case ki:return o*e*4/i.components*i.byteLength;case zg:return o*e*4/i.components*i.byteLength;case ad:case od:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*8;case ld:case ud:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*16;case a_:case l_:return Math.max(o,16)*Math.max(e,8)/4;case r_:case o_:return Math.max(o,8)*Math.max(e,8)/2;case Om:case zm:case Vm:case Gm:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*8;case Pm:case Sd:case Im:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*16;case km:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*16;case Hm:return Math.floor((o+4)/5)*Math.floor((e+3)/4)*16;case qm:return Math.floor((o+4)/5)*Math.floor((e+4)/5)*16;
53case $m:return Math.floor((o+5)/6)*Math.floor((e+4)/5)*16;case Wm:return Math.floor((o+5)/6)*Math.floor((e+5)/6)*16;case Xm:return Math.floor((o+7)/8)*Math.floor((e+4)/5)*16;case jm:return Math.floor((o+7)/8)*Math.floor((e+5)/6)*16;case Ym:return Math.floor((o+7)/8)*Math.floor((e+7)/8)*16;case Zm:return Math.floor((o+9)/10)*Math.floor((e+4)/5)*16;case Qm:return Math.floor((o+9)/10)*Math.floor((e+5)/6)*16;case Km:return Math.floor((o+9)/10)*Math.floor((e+7)/8)*16;case Jm:return Math.floor((o+9)/10)*Math.floor((e+9)/10)*16;case eg:return Math.floor((o+11)/12)*Math.floor((e+9)/10)*16;case tg:return Math.floor((o+11)/12)*Math.floor((e+11)/12)*16;case sg:case ig:case ng:return Math.ceil(o/4)*Math.ceil(e/4)*16;case rg:case ag:return Math.ceil(o/4)*Math.ceil(e/4)*8;case Md:case og:return Math.ceil(o/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function PO(o){switch(o){case Ds:case fl:return{byteLength:1,components:1};case po:case pl:case Jt:return{byteLength:2,components:1};case $_:case W_:return{byteLength:2,components:4};case Ut:case ps:case _s:return{byteLength:4,components:1};case Lg:case Og:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${o}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ed}}));typeof window<"u"&&(window.__THREE__?me("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ed);/** 54 * @license 55 * Copyright 2010-2026 Three.js Authors 56 * SPDX-License-Identifier: MIT 57 */const VO=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],EN=new WeakMap,CN=new WeakMap,BN=new WeakMap;class GO{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=VO,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){const t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:s,object:i}=e;if(t={geometryId:s.id,worldMatrix:i.matrixWorld.clone()},i.center&&(t.center=i.center.clone()),i.morphTargetInfluences&&(t.morphTargetInfluences=i.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){const{width:u,height:h}=e.context;t.bufferWidth=u,t.bufferHeight=h}const{environmentIntensity:r,environmentRotation:l}=e.scene;t.environmentIntensity=r,t.environmentRotation=l.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const s in e){const i=e[s];t[s]={id:i.isInterleavedBufferAttribute?i.data.uuid:i.id,version:i.isInterleavedBufferAttribute?i.data.version:i.version}}return t}containsNode(e){const t=e.material;for(const s in t)if(t[s]&&t[s].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=BN.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},BN.set(e,t)),t}getMaterialData(e){let t=CN.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(const s of this.refreshUniforms){const i=e[s];i!=null&&(typeof i=="object"&&i.clone!==void 0?i.isTexture===!0?t[s]={id:i.id,version:0}:t[s]=i.clone():t[s]=i)}CN.set(e,t)}return t}equals(e,t,s){const{object:i,material:r,geometry:l}=e,u=this.getRenderObjectData(e);if(u.worldMatrix.equals(i.matrixWorld)!==!0)return u.worldMatrix.copy(i.matrixWorld),!1;const h=this.getMaterialData(e.material);
57if(h._renderId!==s){h._renderId=s;for(const m in h){const y=h[m],b=r[m];if(m!=="_renderId"&&m!=="_equal"){if(y.equals!==void 0){if(y.equals(b)===!1)return y.copy(b),h._equal=!1,!1}else if(b.isTexture===!0){if(y.id!==b.id||y.version!==b.version)return y.id=b.id,y.version=b.version,h._equal=!1,!1}else if(y!==b)return h[m]=b,h._equal=!1,!1}}if(h.transmission>0){const{width:m,height:y}=e.context;if(u.bufferWidth!==m||u.bufferHeight!==y)return u.bufferWidth=m,u.bufferHeight=y,h._equal=!1,!1}h._equal=!0}else if(h._equal===!1)return!1;if(u.geometryId!==l.id)return u.geometryId=l.id,!1;const d=this.getGeometryData(e.geometry);if(d._renderId!==s){d._renderId=s;const m=l.attributes,y=d.attributes;let b=0,_=0;for(const F in m)b++;for(const F in y){_++;const L=y[F],U=m[F];if(U===void 0)return delete y[F],d._equal=!1,!1;const R=U.isInterleavedBufferAttribute?U.data.uuid:U.id,V=U.isInterleavedBufferAttribute?U.data.version:U.version;if(L.id!==R||L.version!==V)return L.id=R,L.version=V,d._equal=!1,!1}if(_!==b)return d.attributes=this.getAttributesData(m),d._equal=!1,!1;const v=l.index,M=d.indexId,A=d.indexVersion,C=v?v.id:null,E=v?v.version:null;if(M!==C||A!==E)return d.indexId=C,d.indexVersion=E,d._equal=!1,!1;if(d.drawRange.start!==l.drawRange.start||d.drawRange.count!==l.drawRange.count)return d.drawRange.start=l.drawRange.start,d.drawRange.count=l.drawRange.count,d._equal=!1,!1;d._equal=!0}else if(d._equal===!1)return!1;if(u.morphTargetInfluences){let m=!1;for(let y=0;y<u.morphTargetInfluences.length;y++)u.morphTargetInfluences[y]!==i.morphTargetInfluences[y]&&(u.morphTargetInfluences[y]=i.morphTargetInfluences[y],m=!0);if(m)return!1}if(u.lights){for(let m=0;m<t.length;m++)if(u.lights[m].map!==t[m].map)return!1}const p=e.scene;return p.environment!==null&&r.envMap===null&&(u.environmentIntensity!==p.environmentIntensity||u.environmentRotation.equals(p.environmentRotation)===!1)?(u.environmentIntensity=p.environmentIntensity,u.environmentRotation.copy(p.environmentRotation),!1):u.center&&u.center.equals(i.center)===!1?(u.center.copy(i.center),!1):(e.bundle!==null&&(u.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(const s of e)s.isSpotLight===!0&&s.map!==null&&t.push({map:s.map.version});return t}getLights(e,t){let s=EN.get(e);return s===void 0&&(s={renderId:-1,lightsData:[]},EN.set(e,s)),s.renderId===t||(s.renderId=t,this.getLightsData(e.getLights(),s.lightsData)),s.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;const{renderId:s}=t;if(this.renderId!==s)return this.renderId=s,!0;const i=e.object.static===!0,r=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(i||r)return!1;const l=this.getLights(e.lightsNode,s);return this.equals(e,l,s)!==!0}}const IO=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function kO(o){const e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return o.split(` 58`).map(t=>{const s=t.match(e);if(!s)return null;const i=s[1]||s[2]||"",r=s[3].split("?")[0],l=parseInt(s[4],10),u=parseInt(s[5],10),h=r.split("/").pop();return{fn:i,file:h,line:l,column:u}}).filter(t=>t&&!IO.some(s=>s.test(t.file)))}class ts{constructor(e=null){this.isStackTrace=!0,this.stack=kO(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";const e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;const t=this.stack.map(s=>{const i=`${s.file}:${s.line}:${s.column}`;return s.fn?` at ${s.fn} (${i})`:` at ${i}`}).join(` 59`);return`${e} 60${t}`}}function oT(o,e=0){let t=3735928559^e,s=1103547991^e;if(Array.isArray(o))for(let i=0,r;i<o.length;i++)r=o[i],t=Math.imul(t^r,2654435761),s=Math.imul(s^r,1597334677);else for(let i=0,r;i<o.length;i++)r=o.charCodeAt(i),t=Math.imul(t^r,2654435761),s=Math.imul(s^r,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&s)+(t>>>0)}const wc=o=>oT(o),Ud=o=>oT(o),dd=(...o)=>oT(o),HO=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),DN=new WeakMap;function jR(o){return HO.get(o)}function fg(o){if(/[iu]?vec\d/.test(o))return o.startsWith("ivec")?Int32Array:o.startsWith("uvec")?Uint32Array:Float32Array;
60if(/mat\d/.test(o)||/float/.test(o))return Float32Array;if(/uint/.test(o))return Uint32Array;if(/int/.test(o))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${o}`)}function YR(o){if(/float|int|uint|bool/.test(o))return 1;if(/vec2/.test(o))return 2;if(/vec3/.test(o))return 3;if(/vec4/.test(o)||/mat2/.test(o))return 4;if(/mat3/.test(o))return 9;if(/mat4/.test(o))return 16;he(`TSL: Unsupported type: ${o}`,new ts)}function qO(o){if(/float|int|uint|bool/.test(o))return 1;if(/vec2/.test(o))return 2;if(/vec3/.test(o))return 3;if(/vec4/.test(o)||/mat2/.test(o))return 4;if(/mat3/.test(o))return 12;if(/mat4/.test(o))return 16;he(`TSL: Unsupported type: ${o}`,new ts)}function $O(o){if(/float|int|uint|bool/.test(o))return 1;if(/vec2/.test(o))return 2;if(/vec3/.test(o)||/vec4/.test(o))return 4;if(/mat2/.test(o))return 2;if(/mat3/.test(o)||/mat4/.test(o))return 4;he(`TSL: Unsupported type: ${o}`,new ts)}function mo(o){if(o==null)return null;const e=typeof o;return o.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":o.isVector2===!0?"vec2":o.isVector3===!0?"vec3":o.isVector4===!0?"vec4":o.isMatrix2===!0?"mat2":o.isMatrix3===!0?"mat3":o.isMatrix4===!0?"mat4":o.isColor===!0?"color":o instanceof ArrayBuffer?"ArrayBuffer":null}function lT(o,...e){const t=o?o.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),o==="color"?new Xe(...e):t==="vec2"?new Fe(...e):t==="vec3"?new H(...e):t==="vec4"?new ht(...e):t==="mat2"?new Hg(...e):t==="mat3"?new js(...e):t==="mat4"?new Qe(...e):o==="bool"?e[0]||!1:o==="float"||o==="int"||o==="uint"?e[0]||0:o==="string"?e[0]||"":o==="ArrayBuffer"?XO(e[0]):null}function ZR(o){let e=DN.get(o);return e===void 0&&(e={},DN.set(o,e)),e}function WO(o){let e="";const t=new Uint8Array(o);for(let s=0;s<t.length;s++)e+=String.fromCharCode(t[s]);return btoa(e)}function XO(o){return Uint8Array.from(atob(o),e=>e.charCodeAt(0)).buffer}const ju={VERTEX:"vertex",FRAGMENT:"fragment"},Le={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},jO={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Us={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},QR=["fragment","vertex"],bm=["setup","analyze","generate"],_m=[...QR,"compute"],wl=["x","y","z","w"],YO={analyze:"setup",generate:"analyze"};let ZO=0;class we extends Wn{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Le.NONE,this.updateBeforeType=Le.NONE,this.updateAfterType=Le.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=ZO++,this.stackTrace=null,we.captureStackTrace===!0&&(this.stackTrace=new ts)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Q_.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,Le.FRAME)}onRenderUpdate(e){return this.onUpdate(e,Le.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Le.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const s of Object.getOwnPropertyNames(this)){const i=this[s];if(!(s.startsWith("_")===!0||e.has(i))){if(Array.isArray(i)===!0)for(let r=0;r<i.length;r++){const l=i[r];l&&l.isNode===!0&&t.push({property:s,index:r,childNode:l})}else if(i&&i.isNode===!0)t.push({property:s,childNode:i});else if(i&&Object.getPrototypeOf(i)===Object.prototype)for(const r in i){if(r.startsWith("_")===!0)continue;const l=i[r];l&&l.isNode===!0&&t.push({property:s,index:r,childNode:l})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);const s=[];for(const{property:i,childNode:r}of this._getChildren(t))s.push(wc(i.slice(0,-4)),r.getCacheKey(e,t));this._cacheKey=dd(Ud(s),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}
60getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){const s=e.getDataFromNode(this);let i;return t!==null?(s.typeFromOutput=s.typeFromOutput||{},i=s.typeFromOutput[t],i===void 0&&(i=this.generateNodeType(e,t),s.typeFromOutput[t]=i)):(i=s.type,i===void 0&&(i=this.generateNodeType(e),s.type=i)),i}generateNodeType(e,t=null){const s=e.getNodeProperties(this);return s.outputNode?s.outputNode.getNodeType(e,t):this.nodeType}getShared(e){const t=this.getHash(e),s=e.getNodeFromHash(t);let i=null;if(s&&s!==this)i=s;else if(e.context.overrideNodes){const r=e.context.overrideNodes.get(this);if(r){const l=e.getDataFromNode(this);l.isOverwritten!==!0?(l.isOverwritten=!0,i=r(e).overrideNode(this,null),l.sharedNode=i):i=l.sharedNode}}return i||this}getArrayCount(){return null}setup(e){const t=e.getNodeProperties(this);let s=0;for(const i of this.getChildren())t["node"+s++]=i;return t.outputNode||null}analyze(e,t=null){const s=e.increaseUsage(this);if(this.parents===!0){const i=e.getDataFromNode(this,"any");
60i.stages=i.stages||{},i.stages[e.shaderStage]=i.stages[e.shaderStage]||[],i.stages[e.shaderStage].push(t)}if(s===1){const i=e.getNodeProperties(this);for(const r of Object.values(i))r&&r.isNode===!0&&r.build(e,this)}}generate(e,t){const{outputNode:s}=e.getNodeProperties(this);if(s&&s.isNode===!0)return s.build(e,t)}updateBefore(){me("Abstract function.")}updateAfter(){me("Abstract function.")}update(){me("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){const s=this.getShared(e);if(this!==s)return s.build(e,t);if(this._beforeNodes!==null){const h=this._beforeNodes;this._beforeNodes=null;for(const d of h)d.build(e,t);this._beforeNodes=h}const i=e.getDataFromNode(this);i.buildStages=i.buildStages||{},i.buildStages[e.buildStage]=!0;const r=YO[e.buildStage];if(r&&i.buildStages[r]!==!0){const h=e.getBuildStage();e.setBuildStage(r),this.build(e),e.setBuildStage(h)}e.addChain(this);let l=null;const u=e.getBuildStage();if(u==="setup"){e.addNode(this),this.updateReference(e);const h=e.getNodeProperties(this);if(h.initialized!==!0){h.initialized=!0,h.outputNode=this.setup(e)||h.outputNode||null;for(const d of Object.values(h))if(d&&d.isNode===!0){if(d.parents===!0){const p=e.getNodeProperties(d);p.parents=p.parents||[],p.parents.push(this)}d.build(e)}e.addSequentialNode(this)}l=h.outputNode}else if(u==="analyze")this.analyze(e,t);else if(u==="generate"){if(this.generate.length<2){const d=this.getNodeType(e),p=e.getDataFromNode(this);l=p.snippet,l===void 0?p.generated===void 0?(p.generated=!0,l=this.generate(e)||"",p.snippet=l):(me("Node: Recursion detected.",this),l="/* Recursion detected. */"):p.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),l=e.format(l,d,t)}else l=this.generate(e,t)||"";l===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(he(`TSL: Invalid generated code, expected a "${t}".`),l=e.generateConst(t))}return e.removeChain(this),l}getSerializeChildren(){return this._getChildren()}serialize(e){const t=this.getSerializeChildren(),s={};for(const{property:i,index:r,childNode:l}of t)r!==void 0?(s[i]===void 0&&(s[i]=Number.isInteger(r)?[]:{}),s[i][r]=l.toJSON(e.meta).uuid):s[i]=l.toJSON(e.meta).uuid;Object.keys(s).length>0&&(e.inputNodes=s)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const s in e.inputNodes)if(Array.isArray(e.inputNodes[s])){const i=[];for(const r of e.inputNodes[s])i.push(t[r]);this[s]=i}else if(typeof e.inputNodes[s]=="object"){const i={};for(const r in e.inputNodes[s]){const l=e.inputNodes[s][r];i[r]=t[l]}this[s]=i}else{const i=e.inputNodes[s];this[s]=t[i]}}}toJSON(e){const{uuid:t,type:s}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:s,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function l(u){const h=[];for(const d in u){const p=u[d];delete p.metadata,h.push(p)}return h}if(i){const u=l(e.textures),h=l(e.images),d=l(e.nodes);u.length>0&&(r.textures=u),h.length>0&&(r.images=h),d.length>0&&(r.nodes=d)}return r}}we.captureStackTrace=!1;class Rl extends we{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){const t=this.indexNode.getNodeType(e),s=this.node.build(e),i=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${s}[ ${i} ]`}}class KR extends we{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){const t=this.node.getNodeType(e);let s=null;for(const i of this.convertTo.split("|"))(s===null||e.getTypeLength(t)===e.getTypeLength(i))&&(s=i);return s}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const s=this.node,i=this.getNodeType(e),r=s.build(e,i);return e.format(r,i,t)}}class qt extends we{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const i=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const l=super.build(e,i),u=e.getVarFromNode(this,null,i),h=e.getPropertyName(u);return e.addLineFlowCode(`${h} = ${l}`,this),r.snippet=l,r.propertyName=h,e.format(r.propertyName,i,t)}}return super.build(e,t)}}class QO extends qt{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,s)=>t+e.getTypeLength(s.getNodeType(e)),0))}generate(e,t){const s=this.getNodeType(e),i=e.getTypeLength(s),r=this.nodes,l=e.getComponentType(s),u=[];let h=0;for(const p of r){if(h>=i){he(`TSL: Length of parameters exceeds maximum length of function '${s}()' type.`,this.stackTrace);break}let m=p.getNodeType(e),y=e.getTypeLength(m),b;if(h+y>i&&(he(`TSL: Length of '${s}()' data exceeds maximum length of output type.`,this.stackTrace),y=i-h,m=e.getTypeFromLength(y)),h+=y,b=p.build(e,m),e.getComponentType(m)!==l){const v=e.getTypeFromLength(y,l);b=e.format(b,m,v)}u.push(b)}const d=`${e.getType(s)}( ${u.join(", ")} )`;return e.format(d,s,t)}}const KO=wl.join("");class JR extends we{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(wl.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const s=this.node,i=e.getTypeLength(s.getNodeType(e));let r=null;if(i>1){let l=null;this.getVectorLength()>=i&&(l=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const h=s.build(e,l);
60this.components.length===i&&this.components===KO.slice(0,this.components.length)?r=e.format(h,l,t):r=e.format(`${h}.${this.components}`,this.getNodeType(e),t)}else r=s.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class JO extends qt{static get type(){return"SetNode"}constructor(e,t,s){super(),this.sourceNode=e,this.components=t,this.targetNode=s}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:s,targetNode:i}=this,r=this.getNodeType(e),l=e.getComponentType(i.getNodeType(e)),u=e.getTypeFromLength(s.length,l),h=i.build(e,u),d=t.build(e,r),p=e.getTypeLength(r),m=[];for(let y=0;y<p;y++){const b=wl[y];b===s[0]?(m.push(h),y+=s.length-1):m.push(d+"."+b)}return`${e.getType(r)}( ${m.join(", ")} )`}}class ez extends qt{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:s}=this,i=this.getNodeType(e),r=s.build(e),l=e.getVarFromNode(this),u=e.getPropertyName(l);e.addLineFlowCode(u+" = "+r,this);const h=e.getTypeLength(i),d=[];let p=0;for(let m=0;m<h;m++){const y=wl[m];y===t[p]?(d.push("1.0 - "+(u+"."+y)),p++):d.push(u+"."+y)}return`${e.getType(i)}( ${d.join(", ")} )`}}class uT extends we{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?mo(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=mo(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=WO(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?lT(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){me("Abstract function.")}}const UN=/float|u?int/;class Ar extends uT{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const s=this.getNodeType(e);return UN.test(s)&&UN.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),s,t)}}class tz extends we{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";const s=this.getNodeType(e);return e.getStructTypeNode(s).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){me(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);const s=this.getNodeType(e);return e.generateConst(s)}return this.structNode.build(e)+"."+this.property}}let _o=null;const d_=new Map;function K(o,e){if(d_.has(o)){me(`TSL: Redefinition of method chaining '${o}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${o} is not a function`);d_.set(o,e),o!=="assign"&&(we.prototype[o]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},we.prototype[o+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}const sz=o=>o.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),FN=o=>sz(o).split("").sort().join("");we.prototype.assign=function(...o){if(this.isStackNode!==!0)return _o!==null?_o.assign(this,...o):he("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new ts),this;{const e=d_.get("assign");return this.addToStack(e(...o))}};we.prototype.toVarIntent=function(){return this};we.prototype.get=function(o){return new tz(this,o)};const fd={};function Dp(o,e,t){fd[o]=fd[e]=fd[t]={get(){this._cache=this._cache||{};let l=this._cache[o];return l===void 0&&(l=new JR(this,o),this._cache[o]=l),l},set(l){this[o].assign(ve(l))}};const s=o.toUpperCase(),i=e.toUpperCase(),r=t.toUpperCase();we.prototype["set"+s]=we.prototype["set"+i]=we.prototype["set"+r]=function(l){const u=FN(o);return new JO(this,u,ve(l))},we.prototype["flip"+s]=we.prototype["flip"+i]=we.prototype["flip"+r]=function(){const l=FN(o);return new ez(this,l)}}const Jn=["x","y","z","w"],er=["r","g","b","a"],tr=["s","t","p","q"];for(let o=0;o<4;o++){let e=Jn[o],t=er[o],s=tr[o];Dp(e,t,s);for(let i=0;i<4;i++){e=Jn[o]+Jn[i],t=er[o]+er[i],s=tr[o]+tr[i],Dp(e,t,s);for(let r=0;r<4;r++){e=Jn[o]+Jn[i]+Jn[r],t=er[o]+er[i]+er[r],s=tr[o]+tr[i]+tr[r],Dp(e,t,s);for(let l=0;l<4;l++)e=Jn[o]+Jn[i]+Jn[r]+Jn[l],t=er[o]+er[i]+er[r]+er[l],s=tr[o]+tr[i]+tr[r]+tr[l],Dp(e,t,s)}}}for(let o=0;o<32;o++)fd[o]={get(){this._cache=this._cache||{};let e=this._cache[o];return e===void 0&&(e=new Rl(this,new Ar(o,"uint")),this._cache[o]=e),e},set(e){this[o].assign(ve(e))}};Object.defineProperties(we.prototype,fd);const iz=function(o,e=null){const t=mo(o);return t==="node"?o:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?ve(f_(o,e)):t==="shader"?o.isFn?o:z(o):o},nz=function(o,e=null){for(const t in o)o[t]=ve(o[t],e);return o},rz=function(o,e=null){const t=o.length;for(let s=0;s<t;s++)o[s]=ve(o[s],e);return o},eE=function(o,e=null,t=null,s=null){function i(p){return s!==null?(p=ve(Object.assign(p,s)),s.intent===!0&&(p=p.toVarIntent
60())):p=ve(p),p}let r,l=e,u,h;function d(p){let m;return l?m=/[a-z]/i.test(l)?l+"()":l:m=o.type,u!==void 0&&p.length<u?(he(`TSL: "${m}" parameter length is less than minimum required.`,new ts),p.concat(new Array(u-p.length).fill(0))):h!==void 0&&p.length>h?(he(`TSL: "${m}" parameter length exceeds limit.`,new ts),p.slice(0,h)):p}return e===null?r=(...p)=>i(new o(...ml(d(p)))):t!==null?(t=ve(t),r=(...p)=>i(new o(e,...ml(d(p)),t))):r=(...p)=>i(new o(e,...ml(d(p)))),r.setParameterLength=(...p)=>(p.length===1?u=h=p[0]:p.length===2&&([u,h]=p),r),r.setName=p=>(l=p,r),r},az=function(o,...e){return new o(...ml(e))};class oz extends we{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:s}=this,i=e.getNodeProperties(t),r=e.getClosestSubBuild(t.subBuilds)||"",l=r||"default";if(i[l])return i[l];const u=e.subBuildFn,h=e.fnCall;e.subBuildFn=r,e.fnCall=this;let d=null;if(t.layout){if(s){const y=t.layout.inputs;if(tE(s)){const b=s;for(let _=0;_<y.length;_++){const v=b[_];v&&v.isNode&&v.build(e)}}else{const b=s[0];for(const _ of y){const v=b[_.name];v&&v.isNode&&v.build(e)}}}const p=e.buildFunctionNode(t);e.addInclude(p);const m=s?lz(s):null;d=p.call(m)}else{const p=new Proxy(e,{get:(v,M,A)=>{let C;return Symbol.iterator===M?C=function*(){yield void 0}:C=Reflect.get(v,M,A),C}}),m=s?uz(s):null,y=Array.isArray(s)?s.length>0:s!==null,b=t.jsFunc,_=y||b.length>1?b(m,p):b(p);d=ve(_)}return e.subBuildFn=u,e.fnCall=h,t.once&&(i[l]=d),d}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),s=e.getSubBuildOutput(this);return t[s]=t[s]||this.setupOutput(e),t[s].subBuild=e.getClosestSubBuild(this),t[s]}build(e,t=null){let s=null;const i=e.getBuildStage(),r=e.getNodeProperties(this),l=e.getSubBuildOutput(this),u=this.getOutputNode(e),h=e.fnCall;if(e.fnCall=this,i==="setup"){const d=e.getSubBuildProperty("initialized",this);if(r[d]!==!0&&(r[d]=!0,r[l]=this.getOutputNode(e),r[l].build(e),this.shaderNode.subBuilds))for(const p of e.chaining){const m=e.getDataFromNode(p,"any");m.subBuilds=m.subBuilds||new Set;for(const y of this.shaderNode.subBuilds)m.subBuilds.add(y)}s=r[l]}else i==="analyze"?u.build(e,t):i==="generate"&&(s=u.build(e,t)||"");return e.fnCall=h,s}}function tE(o){return o[0]&&(o[0].isNode||Object.getPrototypeOf(o[0])!==Object.prototype)}function lz(o){let e;return Wg(o),tE(o)?e=[...o]:e=o[0],e}function uz(o){let e=0;return Wg(o),new Proxy(o,{get:(t,s,i)=>{let r;if(s==="length")return r=o.length,r;if(Symbol.iterator===s)r=function*(){for(const l of o)yield ve(l)};else{if(o.length>0)if(Object.getPrototypeOf(o[0])===Object.prototype){const l=o[0];l[s]===void 0?r=l[e++]:r=Reflect.get(l,s,i)}else o[0]instanceof we&&(o[s]===void 0?r=o[e++]:r=Reflect.get(o,s,i));else r=Reflect.get(t,s,i);r=ve(r)}return r}})}class cz extends we{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new oz(this,e)}setup(){return this.call()}}const hz=[!1,!0],dz=[0,1,2,3],fz=[-1,-2],sE=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],cT=new Map;for(const o of hz)cT.set(o,new Ar(o));const hT=new Map;for(const o of dz)hT.set(o,new Ar(o,"uint"));const dT=new Map([...hT].map(o=>new Ar(o.value,"int")));for(const o of fz)dT.set(o,new Ar(o,"int"));const qg=new Map([...dT].map(o=>new Ar(o.value)));for(const o of sE)qg.set(o,new Ar(o));for(const o of sE)qg.set(-o,new Ar(-o));const $g={bool:cT,uint:hT,ints:dT,float:qg},LN=new Map([...cT,...qg]),f_=(o,e)=>LN.has(o)?LN.get(o):o.isNode===!0?o:new Ar(o,e),cs=function(o,e=null){return(...t)=>{for(const i of t)if(i===void 0)return he(`TSL: Invalid parameter for the type "${o}".`,new ts),new Ar(0,o);if((t.length===0||!["bool","float","int","uint"].includes(o)&&t.every(i=>{const r=typeof i;return r!=="object"&&r!=="function"}))&&(t=[lT(o,...t)]),t.length===1&&e!==null&&e.has(t[0]))return sd(e.get(t[0]));if(t.length===1){const i=f_(t[0],o);return i.nodeType===o?sd(i):sd(new KR(i,o))}const s=t.map(i=>f_(i));return sd(new QO(s,o))}};function bc(o){return o&&o.isNode&&o.traverse(e=>{e.isConstNode&&(o=e.value)}),!!o}const iE=o=>
60o!=null?o.nodeType||o.convertTo||(typeof o=="string"?o:null):null;function tc(o,e){return new cz(o,e)}const ve=(o,e=null)=>iz(o,e),sd=(o,e=null)=>ve(o,e).toVarIntent(),Wg=(o,e=null)=>new nz(o,e),ml=(o,e=null)=>new rz(o,e),Ie=(o,e=null,t=null,s=null)=>new eE(o,e,t,s),ge=(o,...e)=>new az(o,...e),ue=(o,e=null,t=null,s={})=>new eE(o,e,t,{...s,intent:!0}),fT=(o,e)=>new Proxy(o,{get(t,s,i){return Reflect.get(e,s,i)},set(t,s,i){return Reflect.set(e,s,i)}});let pz=0;class mz extends we{constructor(e,t=null){super();let s=null;t!==null&&(typeof t=="object"?s=t.return:(typeof t=="string"?s=t:he("TSL: Invalid layout type.",new ts),t=null)),this.shaderNode=new tc(e,s),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){const s={name:"fn"+pz++,type:t,inputs:[]};for(const i in e)i!=="return"&&s.inputs.push({name:i,type:e[i]});e=s}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return he('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}}function z(o,e=null){const t=new mz(o,e);return new Proxy(()=>{},{apply(s,i,r){return t.call(...r)},get(s,i,r){return Reflect.get(t,i,r)},set(s,i,r,l){return Reflect.set(t,i,r,l)}})}const Ad=o=>{_o=o},pT=()=>_o,Ae=(...o)=>_o.If(...o),gz=(...o)=>_o.Switch(...o);function Xg(o){return _o&&_o.addToStack(o),o}K("toStack",Xg);const nE=new cs("color"),w=new cs("float",$g.float),D=new cs("int",$g.ints),ae=new cs("uint",$g.uint),Yi=new cs("bool",$g.bool),de=new cs("vec2"),It=new cs("ivec2"),mT=new cs("uvec2"),rE=new cs("bvec2"),O=new cs("vec3"),gT=new cs("ivec3"),El=new cs("uvec3"),yT=new cs("bvec3"),Te=new cs("vec4"),xT=new cs("ivec4"),bT=new cs("uvec4"),aE=new cs("bvec4"),jg=new cs("mat2"),vs=new cs("mat3"),yo=new cs("mat4");K("toColor",nE);K("toFloat",w);K("toInt",D);K("toUint",ae);K("toBool",Yi);K("toVec2",de);K("toIVec2",It);K("toUVec2",mT);K("toBVec2",rE);K("toVec3",O);K("toIVec3",gT);K("toUVec3",El);K("toBVec3",yT);K("toVec4",Te);K("toIVec4",xT);K("toUVec4",bT);K("toBVec4",aE);K("toMat2",jg);K("toMat3",vs);K("toMat4",yo);const oE=Ie(Rl).setParameterLength(2),lE=(o,e)=>new KR(ve(o),e),yz=(o,e)=>new JR(ve(o),e);K("element",oE);K("convert",lE);const xz=o=>(me("TSL: append() has been renamed to Stack().",new ts),Xg(o));K("append",o=>(me("TSL: .append() has been renamed to .toStack().",new ts),Xg(o)));class ut extends we{static get type(){return"PropertyNode"}constructor(e,t=null,s=!1,i=null){super(e),this.name=t,this.varying=s,this.placeholderNode=ve(i),this.isPropertyNode=!0,this.global=!0}getNodeType(e){const t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return wc(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){const s=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${s}`,this)}return e.getPropertyName(t)}}const ya=(o,e,t=null)=>new ut(o,e,!1,t),Cl=(o,e,t=null)=>new ut(o,e,!0,t),gt=ge(ut,"vec4","DiffuseColor"),ll=ge(ut,"vec3","DiffuseContribution"),p_=ge(ut,"vec3","EmissiveColor"),lr=ge(ut,"float","Roughness"),oa=ge(ut,"float","Metalness"),pg=ge(ut,"float","Clearcoat"),ac=ge(ut,"float","ClearcoatRoughness"),Pi=ge(ut,"vec3","Sheen"),oo=ge(ut,"float","SheenRoughness"),Yg=ge(ut,"float","Iridescence"),mg=ge(ut,"float","IridescenceIOR"),gg=ge(ut,"float","IridescenceThickness"),yg=ge(ut,"float","AlphaT"),ro=ge(ut,"float","Anisotropy"),pd=ge(ut,"vec3","AnisotropyT"),gl=ge(ut,"vec3","AnisotropyB"),To=ge(ut,"color","SpecularColor"),cl=ge(ut,"color","SpecularColorBlended"),hl=ge(ut,"float","SpecularF90"),xg=ge(ut,"float","Shininess"),oc=ge(ut,"output","Output"),yl=ge(ut,"float","dashSize"),Nd=ge(ut,"float","gapSize"),bz=ge(ut,"float","pointWidth"),md=ge(ut,"float","IOR"),bg=ge(ut,"float","Transmission"),_T=ge(ut,"float","Thickness"),TT=ge(ut,"float","AttenuationDistance"),vT=ge(ut,"color","AttenuationColor"),ST=ge(ut,"float","Dispersion"),m_=ge(ut,"float","AmbientOcclusion",!1,1);class uE extends we{static get type(){return"UniformGroupNode"}constructor(e,t=!1,s=1,i=null){super("string"),this.name=e,this.shared=t,this.order=s,this.updateType=i,this.isUniformGroup=!0}
60update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const cE=(o,e=1,t=null)=>new uE(o,!1,e,t),Zg=(o,e=0,t=null)=>new uE(o,!0,e,t),_z=Zg("frame",0,Le.FRAME),Re=Zg("render",0,Le.RENDER),hE=cE("object",1,Le.OBJECT);class Fd extends uT{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=hE}setName(e){return this.name=e,this}label(e){return me('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(s=>{const i=e(s,this);i!==void 0&&(this.value=i)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){const s=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);r===void 0&&(e.setHashNode(this,i),r=this);const l=r.getInputType(e),u=e.getUniformFromNode(r,l,e.shaderStage,this.name||e.context.nodeName),h=e.getPropertyName(u);e.context.nodeName!==void 0&&delete e.context.nodeName;let d=h;if(s==="bool"){const p=e.getDataFromNode(this);let m=p.propertyName;if(m===void 0){const y=e.getVarFromNode(this,null,"bool");m=e.getPropertyName(y),p.propertyName=m,d=e.format(h,l,s),e.addLineFlowCode(`${m} = ${d}`,this)}d=m}return e.format(d,s,t)}}const Se=(o,e)=>{const t=iE(e||o);if(t===o&&(o=lT(t)),o&&o.isNode===!0){let s=o.value;o.traverse(i=>{i.isConstNode===!0&&(s=i.value)}),o=s}return new Fd(o,t)};class ON extends qt{static get type(){return"ArrayNode"}constructor(e,t,s=null){super(e),this.count=t,this.values=s,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const dE=(...o)=>{let e;if(o.length===1){const t=o[0];e=new ON(null,t.length,t)}else{const t=o[0],s=o[1];e=new ON(t,s)}return ve(e)};K("toArray",(o,e)=>dE(Array(e).fill(o)));class Tz extends qt{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const s=e.getTypeLength(t.node.getNodeType(e));return wl.join("").slice(0,s)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:s}=this,i=t.getScope(),r=e.getDataFromNode(i);r.assign=!0;const l=e.getNodeProperties(this);l.sourceNode=s,l.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:s,sourceNode:i}=e.getNodeProperties(this),r=this.needsSplitAssign(e),l=s.build(e),u=s.getNodeType(e),h=i.build(e,u),d=i.getNodeType(e),p=e.getDataFromNode(this);let m;if(p.initialized===!0)t!=="void"&&(m=l);else if(r){const y=e.getVarFromNode(this,null,u),b=e.getPropertyName(y);e.addLineFlowCode(`${b} = ${h}`,this);const _=s.node,M=_.node.context({assign:!0}).build(e);for(let A=0;A<_.components.length;A++){const C=_.components[A];e.addLineFlowCode(`${M}.${C} = ${b}[ ${A} ]`,this)}t!=="void"&&(m=l)}else m=`${l} = ${h}`,(t==="void"||d==="void")&&(e.addLineFlowCode(m,this),t!=="void"&&(m=l));return p.initialized=!0,e.format(m,u,t)}}const fE=Ie(Tz).setParameterLength(2);K("assign",fE);class vz extends qt{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){const t=[],s=this.functionNode,i=s.getInputs(e),r=this.parameters,l=(h,d)=>{const p=d.type,m=p==="pointer";let y;return m?y="&"+h.build(e):y=h.build(e,p),y};if(Array.isArray(r)){if(r.length>i.length)he("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),r.length=i.length;else if(r.length<i.length)for(he("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");r.length<i.length;)r.push(w(0));for(let h=0;h<r.length;h++)t.push(l(r[h],i[h]))}else for(const h of i){const d=r[h.name];d!==void 0?t.push(l(d,h)):(he(`TSL: Input '${h.name}' not found in 'Fn()'.`),t.push(l(w(0),h)))}return`${s.build(e,"property")}( ${t.join(", ")} )`}}const pE=(o,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?ml(e):Wg(e[0]),new vz(ve(o),e));
60K("call",pE);const Sz={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class kt extends qt{static get type(){return"OperatorNode"}constructor(e,t,s,...i){if(super(),i.length>0){let r=new kt(e,t,s);for(let l=0;l<i.length-1;l++)r=new kt(e,r,i[l]);t=r,s=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=s,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(Sz[this.op],t)}generateNodeType(e,t=null){const s=this.op,i=this.aNode,r=this.bNode,l=i.getNodeType(e),u=r?r.getNodeType(e):null;if(l==="void"||u==="void")return t||"void";if(s==="%")return l;if(s==="~"||s==="&"||s==="|"||s==="^"||s===">>"||s==="<<")return e.getIntegerType(l);if(s==="&&"||s==="||"||s==="^^")return"bool";if(s==="!"){const h=e.getTypeLength(l);return h>1?`bvec${h}`:"bool"}else if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">="){const h=Math.max(e.getTypeLength(l),e.getTypeLength(u));return h>1?`bvec${h}`:"bool"}else{if(e.isMatrix(l)){if(u==="float")return l;if(e.isVector(u))return e.getVectorFromMatrix(l);if(e.isMatrix(u))return l}else if(e.isMatrix(u)){if(l==="float")return u;if(e.isVector(l))return e.getVectorFromMatrix(u)}return e.getTypeLength(u)>e.getTypeLength(l)?u:l}}generate(e,t){const s=this.op,{aNode:i,bNode:r}=this,l=this.getNodeType(e,t);let u=null,h=null;l!=="void"?(u=i.getNodeType(e),h=r?r.getNodeType(e):null,s==="<"||s===">"||s==="<="||s===">="||s==="=="||s==="!="?e.isVector(u)?h=u:e.isVector(h)?u=h:u!==h&&(u=h="float"):s===">>"||s==="<<"?(u=l,h=e.changeComponentType(h,"uint")):s==="%"?(u=l,h=e.isInteger(u)&&e.isInteger(h)?h:u):e.isMatrix(u)?h==="float"?h="float":e.isVector(h)?h=e.getVectorFromMatrix(u):e.isMatrix(h)||(u=h=l):e.isMatrix(h)?u==="float"?u="float":e.isVector(u)?u=e.getVectorFromMatrix(h):u=h=l:u=h=l):u=h=l;const d=i.build(e,u),p=r?r.build(e,h):null,m=e.getFunctionOperator(s);if(t!=="void"){const y=e.renderer.coordinateSystem===Hi;if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">=")return y?e.isVector(u)?e.format(`${this.getOperatorMethod(e,t)}( ${d}, ${p} )`,l,t):e.format(`( ${d} ${s} ${p} )`,l,t):e.format(`( ${d} ${s} ${p} )`,l,t);if(s==="%")return e.isInteger(h)?e.format(`( ${d} % ${p} )`,l,t):e.format(`${this.getOperatorMethod(e,l)}( ${d}, ${p} )`,l,t);if(s==="!")return y&&e.isVector(u)?e.format(`not( ${d} )`,t):e.format(`( ${s} ${d} )`,u,t);if(s==="~")return e.format(`( ${s} ${d} )`,u,t);if(m)return e.format(`${m}( ${d}, ${p} )`,l,t);if(e.isMatrix(u)&&h==="float")return e.format(`( ${p} ${s} ${d} )`,l,t);if(u==="float"&&e.isMatrix(h))return e.format(`${d} ${s} ${p}`,l,t);{let b=`( ${d} ${s} ${p} )`;return!y&&l==="bool"&&e.isVector(u)&&e.isVector(h)&&(b=`all${b}`),e.format(b,l,t)}}else if(u!=="void")return m?e.format(`${m}( ${d}, ${p} )`,l,t):e.isMatrix(u)&&h==="float"?e.format(`${p} ${s} ${d}`,l,t):e.format(`${d} ${s} ${p}`,l,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const ss=ue(kt,"+").setParameterLength(2,1/0).setName("add"),Ke=ue(kt,"-").setParameterLength(2,1/0).setName("sub"),ze=ue(kt,"*").setParameterLength(2,1/0).setName("mul"),Zi=ue(kt,"/").setParameterLength(2,1/0).setName("div"),Qg=ue(kt,"%").setParameterLength(2).setName("mod"),mE=ue(kt,"==").setParameterLength(2).setName("equal"),gE=ue(kt,"!=").setParameterLength(2).setName("notEqual"),yE=ue(kt,"<").setParameterLength(2).setName("lessThan"),MT=ue(kt,">").setParameterLength(2).setName("greaterThan"),xE=ue(kt,"<=").setParameterLength(2).setName("lessThanEqual"),bE=ue(kt,">=").setParameterLength(2).setName("greaterThanEqual"),_E=ue(kt,"&&").setParameterLength(2,1/0).setName("and"),TE=ue(kt,"||").setParameterLength(2,1/0).setName("or"),vE=ue(kt,"!").setParameterLength(1).setName("not"),SE=ue(kt,"^^").setParameterLength(2).setName("xor"),ME=ue(kt,"&").setParameterLength(2).setName("bitAnd"),AE=ue(kt,"~").setParameterLength(1).setName("bitNot"),NE=ue(kt,"|").setParameterLength(2).setName("bitOr"),wE=ue(kt,"^").setParameterLength(2).setName("bitXor"),RE=ue(kt,"<<").setParameterLength(2).setName("shiftLeft"),EE=ue(kt,">>").setParameterLength(2).setName("shiftRight"),CE=z(([o])=>(o.addAssign(1),o)),BE=z(([o])=>(o.subAssign(1),o)),DE=z(([o])=>{const e=D(o).toConst();return o.addAssign(1),e}),UE=z(([o])=>{const e=D(o).toConst();return o.subAssign(1),e});K("add",ss);K("sub",Ke);K("mul",ze);K("div",Zi);K("mod",Qg);K("equal",mE);K("notEqual",gE);K("lessThan",yE);K("greaterThan",MT);K("lessThanEqual",xE);K("greaterThanEqual",bE);K("and",_E);K("or",TE);K("not",vE);K("xor",SE);K("bitAnd",ME);K("bitNot",AE);K("bitOr",NE);K("bitXor",wE);K("shiftLeft",RE);K("shiftRight",EE);K("incrementBefore",CE);K("decrementBefore",BE);K("increment",DE);K("decrement",UE);class q extends qt{static get type(){return"MathNode"}constructor(e,t,s=null,i=null){if(super(),(e===q.MAX||e===q.MIN)&&arguments.length>
603){let r=new q(e,t,s);for(let l=3;l<arguments.length-1;l++)r=new q(e,r,arguments[l]);t=r,s=arguments[arguments.length-1],i=null}this.method=e,this.aNode=t,this.bNode=s,this.cNode=i,this.isMathNode=!0}getInputType(e){const t=this.aNode.getNodeType(e),s=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),l=e.isMatrix(s)?0:e.getTypeLength(s),u=e.isMatrix(i)?0:e.getTypeLength(i);return r>l&&r>u?t:l>u?s:u>r?i:t}generateNodeType(e){const t=this.method;return t===q.LENGTH||t===q.DISTANCE||t===q.DOT?"float":t===q.CROSS?"vec3":t===q.ALL||t===q.ANY?"bool":t===q.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:s,method:i}=this;let r=null;if(i===q.ONE_MINUS)r=Ke(1,t);else if(i===q.RECIPROCAL)r=Zi(1,t);else if(i===q.DIFFERENCE)r=wt(Ke(t,s));else if(i===q.TRANSFORM_DIRECTION){let l,u;e.isMatrix(t.getNodeType(e))?(l=t,u=s):(l=s,u=t),r=$s(ze(l,Te(O(u),0)).xyz)}return r!==null?r:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let i=this.method;const r=this.getNodeType(e),l=this.getInputType(e),u=this.aNode,h=this.bNode,d=this.cNode,p=e.renderer.coordinateSystem;if(i===q.NEGATE)return e.format("( - "+u.build(e,l)+" )",r,t);{const m=[];return i===q.CROSS?m.push(u.build(e,r),h.build(e,r)):p===Hi&&i===q.STEP?m.push(u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":l),h.build(e,l)):p===Hi&&(i===q.MIN||i===q.MAX)?m.push(u.build(e,l),h.build(e,e.getTypeLength(h.getNodeType(e))===1?"float":l)):i===q.REFRACT?m.push(u.build(e,l),h.build(e,l),d.build(e,"float")):i===q.MIX?m.push(u.build(e,l),h.build(e,l),d.build(e,e.getTypeLength(d.getNodeType(e))===1?"float":l)):(p===An&&i===q.ATAN&&h!==null&&(i="atan2"),e.shaderStage!=="fragment"&&(i===q.DFDX||i===q.DFDY)&&(me(`TSL: '${i}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),i="/*"+i+"*/"),m.push(u.build(e,l)),h!==null&&m.push(h.build(e,l)),d!==null&&m.push(d.build(e,l))),e.format(`${e.getMethod(i,r)}( ${m.join(", ")} )`,r,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}q.ALL="all";q.ANY="any";q.RADIANS="radians";q.DEGREES="degrees";q.EXP="exp";q.EXP2="exp2";q.LOG="log";q.LOG2="log2";q.SQRT="sqrt";q.INVERSE_SQRT="inversesqrt";q.FLOOR="floor";q.CEIL="ceil";q.NORMALIZE="normalize";q.FRACT="fract";q.SIN="sin";q.SINH="sinh";q.COS="cos";q.COSH="cosh";q.TAN="tan";q.TANH="tanh";q.ASIN="asin";q.ASINH="asinh";q.ACOS="acos";q.ACOSH="acosh";q.ATAN="atan";q.ATANH="atanh";q.ABS="abs";q.SIGN="sign";q.LENGTH="length";q.NEGATE="negate";q.ONE_MINUS="oneMinus";q.DFDX="dFdx";q.DFDY="dFdy";q.ROUND="round";q.RECIPROCAL="reciprocal";q.TRUNC="trunc";q.FWIDTH="fwidth";q.TRANSPOSE="transpose";q.DETERMINANT="determinant";q.INVERSE="inverse";q.EQUALS="equals";q.MIN="min";q.MAX="max";q.STEP="step";q.REFLECT="reflect";q.DISTANCE="distance";q.DIFFERENCE="difference";q.DOT="dot";q.CROSS="cross";q.POW="pow";q.TRANSFORM_DIRECTION="transformDirection";q.MIX="mix";q.CLAMP="clamp";q.REFRACT="refract";q.SMOOTHSTEP="smoothstep";q.FACEFORWARD="faceforward";const Kg=w(1e-6),Mz=w(1e6),_g=w(Math.PI),Az=w(Math.PI*2),Nz=w(Math.PI*2),wz=w(Math.PI*.5),FE=ue(q,q.ALL).setParameterLength(1),LE=ue(q,q.ANY).setParameterLength(1),OE=ue(q,q.RADIANS).setParameterLength(1),zE=ue(q,q.DEGREES).setParameterLength(1),AT=ue(q,q.EXP).setParameterLength(1),_c=ue(q,q.EXP2).setParameterLength(1),Jg=ue(q,q.LOG).setParameterLength(1),pr=ue(q,q.LOG2).setParameterLength(1),ai=ue(q,q.SQRT).setParameterLength(1),NT=ue(q,q.INVERSE_SQRT).setParameterLength(1),mr=ue(q,q.FLOOR).setParameterLength(1),ey=ue(q,q.CEIL).setParameterLength(1),$s=ue(q,q.NORMALIZE).setParameterLength(1),Hn=ue(q,q.FRACT).setParameterLength(1),ti=ue(q,q.SIN).setParameterLength(1),PE=ue(q,q.SINH).setParameterLength(1),Pn=ue(q,q.COS).setParameterLength(1),VE=ue(q,q.COSH).setParameterLength(1),GE=ue(q,q.TAN).setParameterLength(1),IE=ue(q,q.TANH).setParameterLength(1),kE=ue(q,q.ASIN).setParameterLength(1),HE=ue(q,q.ASINH).setParameterLength(1),wT=ue(q,q.ACOS).setParameterLength(1),qE=ue(q,q.ACOSH).setParameterLength(1),RT=ue(q,q.ATAN).setParameterLength(1,2),$E=ue(q,q.ATANH).setParameterLength(1),wt=ue(q,q.ABS).setParameterLength(1),ET=ue(q,q.SIGN).setParameterLength(1),gr=ue(q,q.LENGTH).setParameterLength(1),CT=ue(q,q.NEGATE).setParameterLength(1),WE=ue(q,q.ONE_MINUS).setParameterLength(1),BT=ue(q,q.DFDX).setParameterLength(1),DT=ue(q,q.DFDY).setParameterLength(1),XE=ue(q,q.ROUND).setParameterLength(1),jE=ue(q,q.RECIPROCAL).setParameterLength(1),UT=ue(q,q.TRUNC).setParameterLength(1),FT=ue(q,q.FWIDTH).setParameterLength(1),YE=ue(q,q.TRANSPOSE).setParameterLength(1),ZE=ue(q,q.DETERMINANT).setParameterLength(1),QE=ue(q,q.INVERSE).setParameterLength(1),bi=ue(q,q.MIN).setParameterLength(2,1/0),Ht=ue(q,q.MAX).setParameterLength(2,1/0),_l=ue(q,q.STEP).setParameterLength(2),KE=ue(q,q.REFLECT).setParameterLength(2),JE=ue(q,q.DISTANCE).setParameterLength(2),e
60C=ue(q,q.DIFFERENCE).setParameterLength(2),Nn=ue(q,q.DOT).setParameterLength(2),ga=ue(q,q.CROSS).setParameterLength(2),bn=ue(q,q.POW).setParameterLength(2),LT=o=>ze(o,o),tC=o=>ze(o,o,o),OT=o=>ze(o,o,o,o),sC=ue(q,q.TRANSFORM_DIRECTION).setParameterLength(2),iC=(o,e)=>$s(ze(e,Te(O(o),0)).xyz),nC=(o,e)=>$s(Te(O(o),0).mul(e).xyz),rC=o=>ze(ET(o),bn(wt(o),1/3)),zT=o=>Nn(o,o),$e=ue(q,q.MIX).setParameterLength(3),qn=(o,e=0,t=1)=>new q(q.CLAMP,ve(o),ve(e),ve(t)),ty=o=>qn(o),PT=ue(q,q.REFRACT).setParameterLength(3),Qi=ue(q,q.SMOOTHSTEP).setParameterLength(3),VT=ue(q,q.FACEFORWARD).setParameterLength(3),aC=z(([o])=>{const s=43758.5453,i=Nn(o.xy,de(12.9898,78.233)),r=Qg(i,_g);return Hn(ti(r).mul(s))}),oC=(o,e,t)=>$e(e,t,o),lC=(o,e,t)=>Qi(e,t,o),uC=(o,e)=>_l(e,o),Rz=VT,Ez=NT;K("all",FE);K("any",LE);K("radians",OE);K("degrees",zE);K("exp",AT);K("exp2",_c);K("log",Jg);K("log2",pr);K("sqrt",ai);K("inverseSqrt",NT);K("floor",mr);K("ceil",ey);K("normalize",$s);K("fract",Hn);K("sin",ti);K("sinh",PE);K("cos",Pn);K("cosh",VE);K("tan",GE);K("tanh",IE);K("asin",kE);K("asinh",HE);K("acos",wT);K("acosh",qE);K("atan",RT);K("atanh",$E);K("abs",wt);K("sign",ET);K("length",gr);K("lengthSq",zT);K("negate",CT);K("oneMinus",WE);K("dFdx",BT);K("dFdy",DT);K("round",XE);K("reciprocal",jE);K("trunc",UT);K("fwidth",FT);K("min",bi);K("max",Ht);K("step",uC);K("reflect",KE);K("distance",JE);K("dot",Nn);K("cross",ga);K("pow",bn);K("pow2",LT);K("pow3",tC);K("pow4",OT);K("transformDirection",sC);K("transformNormalByViewMatrix",iC);K("transformNormalByInverseViewMatrix",nC);K("mix",oC);K("clamp",qn);K("refract",PT);K("smoothstep",lC);K("faceForward",VT);K("difference",eC);K("saturate",ty);K("cbrt",rC);K("transpose",YE);K("determinant",ZE);K("inverse",QE);K("rand",aC);class Cz extends we{static get type(){return"ConditionalNode"}constructor(e,t,s=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=s}generateNodeType(e){const{ifNode:t,elseNode:s}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const i=t.getNodeType(e);if(s!==null){const r=s.getNodeType(e);if(e.getTypeLength(r)>e.getTypeLength(i))return r}return i}setup(e){const t=this.condNode,s=this.ifNode.isolate(),i=this.elseNode?this.elseNode.isolate():null,r=e.context.nodeBlock;e.getDataFromNode(s).parentNodeBlock=r,i!==null&&(e.getDataFromNode(i).parentNodeBlock=r);const l=e.context.uniformFlow,u=e.getNodeProperties(this);u.condNode=t,u.ifNode=l?s:s.context({nodeBlock:s}),u.elseNode=i?l?i:i.context({nodeBlock:i}):null}generate(e,t){const s=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:r,ifNode:l,elseNode:u}=e.getNodeProperties(this),h=e.currentFunctionNode,d=t!=="void",p=d?ya(s).build(e):"";i.nodeProperty=p;const m=r.build(e,"bool");if(e.context.uniformFlow&&u!==null){const _=l.build(e,s),v=u.build(e,s),M=e.getTernary(m,_,v);return e.format(M,s,t)}e.addFlowCode(` 61${e.tab}if ( ${m} ) { 62 63`).addFlowTab();let b=l.build(e,s);if(b&&(d?b=p+" = "+b+";":(b="return "+b+";",h===null&&(me("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),b="// "+b))),e.removeFlowTab().addFlowCode(e.tab+" "+b+` 64 65`+e.tab+"}"),u!==null){e.addFlowCode(` else { 66 67`).addFlowTab();let _=u.build(e,s);_&&(d?_=p+" = "+_+";":(_="return "+_+";",h===null&&(me("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),_="// "+_))),e.removeFlowTab().addFlowCode(e.tab+" "+_+` 68 69`+e.tab+`} 70 71`)}else e.addFlowCode(` 72 73`);return e.format(p,s,t)}}const Hs=Ie(Cz).setParameterLength(2,3);K("select",Hs);class GT extends we{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){const e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}
73setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const s=e.addContext(this.value),i=this.node.build(e,t);return e.setContext(s),i}}const xa=(o=null,e={})=>{let t=o;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new GT(t,e)},cC=o=>xa(o,{uniformFlow:!0}),IT=(o,e)=>xa(o,{nodeName:e});function hC(o,e,t=null){return xa(t,{getShadow:({light:s,shadowColorNode:i})=>e===s?i.mul(o):i})}function dC(o,e=null){return xa(e,{getAO:(t,{material:s})=>s.transparent===!0?t:t!==null?t.mul(o):o})}function fC(o,e){return me('TSL: "label()" has been deprecated. Use "setName()" instead.'),IT(o,e)}K("context",xa);K("label",fC);K("uniformFlow",cC);K("setName",IT);K("builtinShadowContext",(o,e,t)=>hC(e,t,o));K("builtinAOContext",(o,e)=>dC(e,o));class Tm extends we{static get type(){return"VarNode"}constructor(e,t=null,s=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=s,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){const t=e[0],s=this.getShared(t);if(this!==s)return s.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let i=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){const u=t.getDataFromNode(this);u.forceDeclaration=!0,i=!0}const r=t.getBaseStack();i?r.addToStackBefore(this):r.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:s,readOnly:i}=this,{renderer:r}=e,l=r.backend.isWebGPUBackend===!0;let u=!1,h=!1;i&&(u=e.isDeterministic(t),h=l?i:u);const d=this.getNodeType(e);if(d=="void")return this.isIntent(e)!==!0&&he('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);const p=e.getVectorType(d),m=t.build(e,p),y=e.getVarFromNode(this,s,p,void 0,h),b=e.getPropertyName(y);let _=b;if(h)if(l)_=u?`const ${b}`:`let ${b}`;else{const v=t.getArrayCount(e);_=`const ${e.getVar(y.type,b,v)}`}return e.addLineFlowCode(`${_} = ${m}`,this),b}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}}const kT=Ie(Tm),pC=(o,e=null)=>kT(o,e).toStack(),mC=(o,e=null)=>kT(o,e,!0).toStack(),gC=o=>kT(o).setIntent(!0).toStack();K("toVar",pC);K("toConst",mC);K("toVarIntent",gC);class Bz extends we{static get type(){return"SubBuild"}constructor(e,t,s=null){super(s),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const s=this.node.build(e,...t);return e.removeSubBuild(),s}}const xl=(o,e,t=null)=>new Bz(ve(o),e,t);class Dz extends we{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=xl(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let s=t.varying;if(s===void 0){const i=this.name,r=this.getNodeType(e),l=this.interpolationType,u=this.interpolationSampling;t.varying=s=e.getVaryingFromNode(this,i,r,l,u),t.node=xl(this.node,"VERTEX")}return s.needsInterpolation||(s.needsInterpolation=e.shaderStage==="fragment"),s}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ju.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ju.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),s=e.getNodeProperties(this),i=this.setupVarying(e);if(s[t]===void 0){const r=this.getNodeType(e),l=e.getPropertyName(i,ju.VERTEX);if(e.shaderStage===ju.VERTEX){const u=s.node.build(e,r);e.addLineFlowCode(`${l} = ${u}`,this)}else e.flowNodeFromShaderStage(ju.VERTEX,s.node,r,l);s[t]=l}return e.getPropertyName(i)}}const Mo=Ie(Dz).setParameterLength(1,2),yC=o=>Mo(o);K("toVarying",Mo);K("toVertexStage",yC);const xC=z(([o])=>{const e=o.mul(.9478672986).add(.0521327014).pow(2.4),t=o.mul(.0773993808),s=o.lessThanEqual(.04045);return $e(e,t,s)}
73).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),bC=z(([o])=>{const e=o.pow(.41666).mul(1.055).sub(.055),t=o.mul(12.92),s=o.lessThanEqual(.0031308);return $e(e,t,s)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),HT="WorkingColorSpace",Uz="OutputColorSpace";class qT extends qt{static get type(){return"ColorSpaceNode"}constructor(e,t,s){super("vec4"),this.colorNode=e,this.source=t,this.target=s}resolveColorSpace(e,t){return t===HT?lt.workingColorSpace:t===Uz?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,s=this.resolveColorSpace(e,this.source),i=this.resolveColorSpace(e,this.target);let r=t;return lt.enabled===!1||s===i||!s||!i||(lt.getTransfer(s)===Ve&&(r=Te(xC(r.rgb),r.a)),lt.getPrimaries(s)!==lt.getPrimaries(i)&&(r=Te(vs(lt._getMatrix(new js,s,i)).mul(r.rgb),r.a)),lt.getTransfer(i)===Ve&&(r=Te(bC(r.rgb),r.a))),r}}const _C=(o,e)=>new qT(ve(o),HT,e),sy=(o,e)=>new qT(ve(o),e,HT),Fz=(o,e,t)=>new qT(ve(o),e,t);K("workingToColorSpace",_C);K("colorSpaceToWorking",sy);let Lz=class extends Rl{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),s=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,s,i)}};class TC extends we{static get type(){return"ReferenceBaseNode"}constructor(e,t,s=null,i=null){super(),this.property=e,this.uniformType=t,this.object=s,this.count=i,this.properties=e.split("."),this.reference=s,this.node=null,this.group=null,this.updateType=Le.OBJECT}setGroup(e){return this.group=e,this}element(e){return new Lz(this,ve(e))}setNodeType(e){const t=Se(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let s=e[t[0]];for(let i=1;i<t.length;i++)s=s[t[i]];return s}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const Oz=(o,e,t)=>new TC(o,e,t);class zz extends TC{static get type(){return"RendererReferenceNode"}constructor(e,t,s=null){super(e,t,s),this.renderer=s,this.setGroup(Re)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const vC=(o,e,t=null)=>new zz(o,e,t);class Pz extends qt{static get type(){return"ToneMappingNode"}constructor(e,t=MC,s=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=s}customCacheKey(){return dd(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,s=this._toneMapping;if(s===fo)return t;let i=null;const r=e.renderer.library.getToneMappingFunction(s);return r!==null?i=Te(r(t.rgb,this.exposureNode),t.a):(he("ToneMappingNode: Unsupported Tone Mapping configuration.",s),i=t),i}}const SC=(o,e,t)=>new Pz(o,ve(e),ve(t)),MC=vC("toneMappingExposure","float");K("toneMapping",(o,e,t)=>SC(e,t,o));const zN=new WeakMap;function PN(o,e){let t=zN.get(o);return t===void 0&&(t=new kR(o,e),zN.set(o,t)),t}class Qa extends uT{static get type(){return"BufferAttributeNode"}constructor(e,t=null,s=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=s,this.bufferOffset=i,this.usage=yc,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let s=e.globalCache.getData(this.value);s===void 0&&(s={node:this},e.globalCache.setData(this.value,s)),t=s.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),s=e.getTypeLength(t),i=this.value,r=this.bufferStride||s,l=this.bufferOffset;let u;i.isInterleavedBuffer===!0?u=i:i.isBufferAttribute===!0?u=PN(i.array,r):u=PN(i,r);const h=new eT(u,s,l);u.setUsage(this.usage),this.attribute=h,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),s=e.context.nodeName;s!==void 0&&delete e.context.nodeName;const i=e.getBufferAttributeFromNode(this,t,s),r=e.getPropertyName(i);let l=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=r,l=r;else{let u;
73s&&(u=s+"Varying"),l=Mo(this,u).build(e,t)}return l}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}function iy(o,e=null,t=0,s=0,i=yc,r=!1){return e==="mat3"||e===null&&o.itemSize===9?vs(new Qa(o,"vec3",9,0).setUsage(i).setInstanced(r),new Qa(o,"vec3",9,3).setUsage(i).setInstanced(r),new Qa(o,"vec3",9,6).setUsage(i).setInstanced(r)):e==="mat4"||e===null&&o.itemSize===16?yo(new Qa(o,"vec4",16,0).setUsage(i).setInstanced(r),new Qa(o,"vec4",16,4).setUsage(i).setInstanced(r),new Qa(o,"vec4",16,8).setUsage(i).setInstanced(r),new Qa(o,"vec4",16,12).setUsage(i).setInstanced(r)):new Qa(o,e,t,s).setUsage(i)}const $T=(o,e=null,t=0,s=0)=>iy(o,e,t,s),Vz=(o,e=null,t=0,s=0)=>iy(o,e,t,s,Bd),ny=(o,e=null,t=0,s=0)=>iy(o,e,t,s,yc,!0),WT=(o,e=null,t=0,s=0)=>iy(o,e,t,s,Bd,!0);K("toAttribute",o=>$T(o.value));class zt extends we{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),s=this.scope;let i;if(s===zt.VERTEX)i=e.getVertexIndex();else if(s===zt.INSTANCE)i=e.getInstanceIndex();else if(s===zt.DRAW)i=e.getDrawIndex();else if(s===zt.INVOCATION_LOCAL)i=e.getInvocationLocalIndex();else if(s===zt.INVOCATION_SUBGROUP)i=e.getInvocationSubgroupIndex();else if(s===zt.SUBGROUP)i=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+s);let r;return e.shaderStage==="vertex"||e.shaderStage==="compute"?r=i:r=Mo(this).build(e,t),r}}zt.VERTEX="vertex";zt.INSTANCE="instance";zt.SUBGROUP="subgroup";zt.INVOCATION_LOCAL="invocationLocal";zt.INVOCATION_SUBGROUP="invocationSubgroup";zt.DRAW="draw";const AC=ge(zt,zt.VERTEX),kn=ge(zt,zt.INSTANCE),Gz=ge(zt,zt.SUBGROUP),Iz=ge(zt,zt.INVOCATION_SUBGROUP),kz=ge(zt,zt.INVOCATION_LOCAL),NC=ge(zt,zt.DRAW);class Hz extends we{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=Le.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return me('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Se(this.count,"uint").onObjectUpdate(()=>this.count));const t=this.computeNode.build(e);if(t){const s=e.getNodeProperties(this);s.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:s}=e;if(s==="compute"){const i=this.computeNode.build(e,"void");if(i!==""&&e.addLineFlowCode(i,this),this.count!==null&&e.allowEarlyReturns===!0){const r=this.countNode.build(e,"uint"),l=kn.build(e,"uint");e.flow.code=`${e.tab}if ( ${l} >= ${r} ) { return; } 74 75${e.flow.code}`}}else{const r=e.getNodeProperties(this).outputComputeNode;if(r)return r.build(e,t)}}}const XT=(o,e=[64])=>{(e.length===0||e.length>3)&&he("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new ts);for(let t=0;t<e.length;t++){const s=e[t];(typeof s!="number"||s<=0||!Number.isInteger(s))&&he(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new ts)}for(;e.length<3;)e.push(1);return new Hz(ve(o),e)},wC=(o,e,t)=>{const s=XT(o,t);return typeof e=="number"?s.count=e:s.dispatchSize=e,s};K("compute",wC);K("computeKernel",XT);class qz extends we{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){const t=e.getCache(),s=e.getCacheFromNode(this,this.parent);e.setCache(s);const i=this.node.getNodeType(e);return e.setCache(t),i}build(e,...t){const s=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);const r=this.node.build(e,...t);return e.setCache(s),r}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const lc=o=>new qz(ve(o));function RC(o,e=!0){return me('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),lc(o).setParent(e)}K("cache",RC);K("isolate",lc);class $z extends we{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const EC=Ie($z).setParameterLength(2);K("bypass",EC);const jT=z(([o,e,t,s=w(0),i=w(1),r=Yi(!1)])=>{let l=o.sub(e).div(t.sub(e));return bc(r)&&(l=l.clamp()),l.mul(i.sub(s)).add(s)});function CC(o,e,t,s=w(0),i=w(1)){return jT(o,e,t,s,i,!0)}K("remap",jT);K("remapClamp",CC);class vm extends we{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const s=this.getNodeType(e),i=this.snippet;if(s==="void")e.addLineFlowCode(i,this);else return e.format(i,s,t)}}const Ii=Ie(vm).setParameterLength(1,2),BC=o=>(o?Hs(o,Ii("discard")):Ii("discard")).toStack(),Wz=()=>Ii("return").toStack();K("discard",BC);const YT=z(([o])=>Te(o.rgb.mul(o.a),o.a),{color:"vec4",return:"vec4"}),DC=z(([o])=>o.a.equal(0).select(Te(0),Te(o.rgb.div(o.a),o.a)),{color:"vec4",return:"vec4"});
75class Xz extends qt{static get type(){return"RenderOutputNode"}constructor(e,t,s){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=s,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Te(t.rgb,t.a.clamp(0,1)),t=DC(t);const s=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||fo,i=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||bo;return s!==fo&&(t=t.toneMapping(s)),i!==bo&&i!==lt.workingColorSpace&&(t=t.workingToColorSpace(i)),t=YT(t),t}}const ry=(o,e=null,t=null)=>new Xz(ve(o),e,t);K("renderOutput",ry);class jz extends qt{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,s=this.node.build(e);if(t!==null)t(e,s);else{const i="--- TSL debug - "+e.shaderStage+" shader ---",r="-".repeat(i.length);let l="";l+="// #"+i+`# 76`,l+=e.flow.code.replace(/^\t/mg,"")+` 77`,l+="/* ... */ "+s+` /* ... */ 78`,l+="// #"+r+`# 79`,h_(l)}return s}}const UC=(o,e=null)=>new jz(ve(o),e).toStack();K("debug",UC);class FC extends Wn{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class Yz extends we{static get type(){return"InspectorNode"}constructor(e,t="",s=null){super(),this.node=e,this.name=t,this.callback=s,this.updateType=Le.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==FC&&Ye('TSL: ".toInspector()" is only available with WebGPU.'),t}}function LC(o,e="",t=null){return o=ve(o),o.before(new Yz(o,e,t))}K("toInspector",LC);function Zz(o){me("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",o)}class OC extends we{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){const s=this.getAttributeName(e);if(e.hasGeometryAttribute(s)){const i=e.geometry.getAttribute(s);t=e.getTypeFromAttribute(i)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),s=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const r=e.geometry.getAttribute(t),l=e.getTypeFromAttribute(r),u=e.getAttribute(t,l);return e.shaderStage==="vertex"?e.format(u.name,l,s):Mo(this).build(e,s)}else return me(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(s)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const qi=(o,e=null)=>new OC(o,e),xt=(o=0)=>qi("uv"+(o>0?o:""),"vec2");class Qz extends we{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const s=this.textureNode.build(e,"property"),i=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${s}, ${i} )`,this.getNodeType(e),t)}}const Tl=Ie(Qz).setParameterLength(1,2);class Kz extends Fd{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=Le.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,s=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(s&&s.width!==void 0){const{width:i,height:r}=s;this.value=Math.log2(Math.max(i,r))}}}const ZT=Ie(Kz).setParameterLength(1);
79class zC extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}}const QT=new qs;class vr extends Fd{static get type(){return"TextureNode"}constructor(e=QT,t=null,s=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=s,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=Le.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===Ut?"uvec4":this.value.type===ps?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return xt(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Se(this.value.matrix)),this._matrixUniform.mul(O(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Se(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(D(Tl(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const s=this.value;if(!s||s.isTexture!==!0)throw new zC("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);const i=z(()=>{let h=this.uvNode;return(h===null||e.context.forceUVContext===!0)&&e.context.getUV&&(h=e.context.getUV(this,e)),h||(h=this.getDefaultUV()),this.updateMatrix===!0&&(h=this.getTransformedUV(h)),h=this.setupUV(e,h),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?Le.OBJECT:Le.NONE,h})();let r=this.levelNode;r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this));let l=null,u=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Al.TEXTURE_COMPARE))l=this.compareNode;else{const h=s.compareFunction;h===null||h===Y_||h===Cd||h===cg||h===gc?u=this.compareNode:(l=this.compareNode,Ye('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=i,t.levelNode=r,t.biasNode=this.biasNode,t.compareNode=l,t.compareStepNode=u,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,s,i,r,l,u,h,d,p,m){const y=this.value;let b;return r?b=e.generateTextureBias(y,t,s,r,l,p):h?b=e.generateTextureGrad(y,t,s,h,l,p):d?u?b=e.generateTextureGatherCompare(y,t,s,u,l,p,m):b=e.generateTextureGather(y,t,s,d,l,p,m):u?b=e.generateTextureCompare(y,t,s,u,l,p):this.sampler===!1?b=e.generateTextureLoad(y,t,s,i,l,p):i?b=e.generateTextureLevel(y,t,s,i,l,p):b=e.generateTexture(y,t,s,l,p),b}generate(e,t){const s=this.value,i=e.getNodeProperties(this),r=super.generate(e,"property");if(/^sampler/.test(t))return r+"_sampler";if(e.isReference(t))return r;{const l=e.getDataFromNode(this);let u=this.getNodeType(e),h=l.propertyName;if(h===void 0){const{uvNode:p,levelNode:m,biasNode:y,compareNode:b,compareStepNode:_,depthNode:v,gradNode:M,gatherNode:A,offsetNode:C}=i,E=this.generateUV(e,p),F=m?m.build(e,"float"):null,L=y?y.build(e,"float"):null,U=v?v.build(e,"int"):null,R=b?b.build(e,"float"):null,V=_?_.build(e,"float"):null,$=M?[M[0].build(e,"vec2"),M[1].build(e,"vec2")]:null,ie=A?A.build(e,"int"):null,le=C?this.generateOffset(e,C):null,ye=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;ie&&(u="vec4");let xe=U;xe===null&&s.isArrayTexture&&this.isTexture3DNode!==!0&&(xe="0");const Ne=e.getVarFromNode(this);h=e.getPropertyName(Ne);let ce=this.generateSnippet(e,r,E,F,L,xe,R,$,ie,le,ye);if(V!==null){const X=s.compareFunction;X===cg||X===gc?ce=_l(Ii(ce,u),Ii(V,"float")).build(e,u):ce=_l(Ii(V,"float"),Ii(ce,u)).build(e,u)}e.addLineFlowCode(`${h} = ${ce}`,this),l.snippet=ce,l.propertyName=h}let d=h;
79return e.needsToWorkingColorSpace(s)&&(d=sy(Ii(d,u),s.colorSpace).setup(e).build(e,u)),e.format(d,u,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){const t=this.clone();return t.uvNode=ve(e),t.referenceNode=this.getBase(),ve(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=ve(e).mul(ZT(t)),t.referenceNode=this.getBase();const s=t.value;return t.generateMipmaps===!1&&(s&&s.generateMipmaps===!1||s.minFilter===$t||s.magFilter===$t)&&(me("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),ve(t)}level(e){const t=this.clone();return t.levelNode=ve(e),t.referenceNode=this.getBase(),ve(t)}size(e){return Tl(this,e)}bias(e){const t=this.clone();return t.biasNode=ve(e),t.referenceNode=this.getBase(),ve(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=ve(e),t.referenceNode=this.getBase(),ve(t)}grad(e,t){const s=this.clone();return s.gradNode=[ve(e),ve(t)],s.referenceNode=this.getBase(),ve(s)}gather(e=0){const t=this.clone();return t.gatherNode=ve(e),t.referenceNode=this.getBase(),ve(t)}depth(e){const t=this.clone();return t.depthNode=ve(e),t.referenceNode=this.getBase(),ve(t)}offset(e){const t=this.clone();return t.offsetNode=ve(e),t.referenceNode=this.getBase(),ve(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();const s=this._flipYUniform;s!==null&&(s.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}}const Jz=Ie(vr).setParameterLength(1,4).setName("texture"),it=(o=QT,e=null,t=null,s=null)=>{let i;return o&&o.isTextureNode===!0?(i=ve(o.clone()),i.referenceNode=o.getBase(),e!==null&&(i.uvNode=ve(e)),t!==null&&(i.levelNode=ve(t)),s!==null&&(i.biasNode=ve(s))):i=Jz(o,e,t,s),i},eP=(o=QT)=>it(o),Yt=(...o)=>it(...o).setSampler(!1),tP=(o,e,t)=>it(o,e).level(t),sP=o=>(o.isNode===!0?o:it(o)).convert("sampler"),iP=o=>(o.isNode===!0?o:it(o)).convert("samplerComparison");class KT extends Fd{static get type(){return"BufferNode"}constructor(e,t,s=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=s,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Rc=(o,e,t)=>new KT(o,e,t);class nP extends Rl{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),s=this.getNodeType(e),i=this.node.getPaddedType();return e.format(t,i,s)}}class rP extends KT{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?mo(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=Le.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){const{array:e,value:t}=this,s=this.elementType;if(s==="float"||s==="int"||s==="uint")for(let i=0;i<e.length;i++){const r=i*4;t[r]=e[i]}else if(s==="color")for(let i=0;i<e.length;i++){const r=i*4,l=e[i];t[r]=l.r,t[r+1]=l.g,t[r+2]=l.b||0}else if(s==="mat2")for(let i=0;i<e.length;i++){const r=i*4,l=e[i];t[r]=l.elements[0],t[r+1]=l.elements[1],t[r+2]=l.elements[2],t[r+3]=l.elements[3]}else if(s==="mat3")for(let i=0;i<e.length;i++){const r=i*16,l=e[i];t[r]=l.elements[0],t[r+1]=l.elements[1],t[r+2]=l.elements[2],t[r+4]=l.elements[3],t[r+5]=l.elements[4],t[r+6]=l.elements[5],t[r+8]=l.elements[6],t[r+9]=l.elements[7],t[r+10]=l.elements[8],t[r+15]=1}else if(s==="mat4")for(let i=0;i<e.length;i++){const r=i*16,l=e[i];for(let u=0;u<l.elements.length;u++)t[r+u]=l.elements[u]}else for(let i=0;i<e.length;i++){const r=i*4,l=e[i];t[r]=l.x,t[r+1]=l.y,t[r+2]=l.z||0,t[r+3]=l.w||0}}setup(e){const t=this.array.length,s=this.elementType;let i=Float32Array;const r=this.paddedType,l=e.getTypeLength(r);return s.charAt(0)==="i"&&(i=Int32Array),s.charAt(0)==="u"&&(i=Uint32Array),this.value=new i(t*l),this.bufferCount=t,this.bufferType=r,this.update(),super.setup(e)}element(e){return new nP(this,ve(e))}}const Bs=(o,e)=>new rP(o,e);class aP extends we{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const ba=Ie(aP).setParameterLength(1);let Oh,zh;class Et extends we{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===Et.DPR?"float":this.scope===Et.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=Le.NONE;return(this.scope===Et.SIZE||this.scope===Et.VIEWPORT||this.scope===Et.DPR)&&(e=Le.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===Et.VIEWPORT?t!==null?zh.copy(t.viewport):(e.getViewport(zh),zh.multiplyScalar(e.getPixelRatio())):this.scope===Et.DPR?this._output.value=e.getPixelRatio():t!==null?(Oh.width=t.width,Oh.height=t.height):e.getDrawingBufferSize(Oh)}setup(){const e=this.scope;let t=null;return e===Et.SIZE?t=Se(Oh||(Oh=new Fe)):e===Et.VIEWPORT?t=Se(zh||(zh=new ht)):e===Et.DPR?t=Se(1):t=de(Bl.div(vl)),this._output=t,t}generate(e){if(this.scope===Et.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const s=e.getNodeProperties(vl).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${s}.y - ${t}.y )`}return t}return super.generate(e)}}Et.COORDINATE="coordinate";Et.VIEWPORT="viewport";Et.SIZE="size";Et.UV="uv";Et.DPR="dpr";const JT=ge(Et,Et.DPR),In=ge(Et,Et.UV),vl=ge(Et,Et.SIZE),Bl=ge(Et,Et.COORDINATE),uc=ge(Et,Et.VIEWPORT),ev=uc.zw,PC=Bl.sub(uc.xy),oP=PC.div(ev),lP=z(()=>(me('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new ts),vl),"vec2").once()();let pb=null,Up=null,mb=null,Fp=null,gb=null,Lp=null,yb=null,Op=null,xb=null,zp=null,bb=null,Pp=null,_b=null,Vp=null;const Ao=Se(0,"uint").setName("u_cameraIndex").setGroup(Zg("cameraIndex")).toVarying("v_cameraIndex"),lo=Se("float").setName("cameraNear").setGroup(Re).onRenderUpd
79ate(({camera:o})=>o.near),uo=Se("float").setName("cameraFar").setGroup(Re).onRenderUpdate(({camera:o})=>o.far),ni=z(({camera:o})=>{let e;if(o.isArrayCamera&&o.cameras.length>0){const t=[];for(const s of o.cameras)t.push(s.projectionMatrix);Up===null?Up=Bs(t).setGroup(Re).setName("cameraProjectionMatrices"):Up.array=t,e=Up.element(o.isMultiViewCamera?ba("gl_ViewID_OVR"):Ao)}else pb===null&&(pb=Se(o.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Re).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=pb;return e}).once()(),VC=z(({camera:o})=>{let e;if(o.isArrayCamera&&o.cameras.length>0){const t=[];for(const s of o.cameras)t.push(s.projectionMatrixInverse);Fp===null?Fp=Bs(t).setGroup(Re).setName("cameraProjectionMatricesInverse"):Fp.array=t,e=Fp.element(o.isMultiViewCamera?ba("gl_ViewID_OVR"):Ao)}else mb===null&&(mb=Se(o.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Re).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=mb;return e}).once()(),No=z(({camera:o})=>{let e;if(o.isArrayCamera&&o.cameras.length>0){const t=[];for(const s of o.cameras)t.push(s.matrixWorldInverse);Lp===null?Lp=Bs(t).setGroup(Re).setName("cameraViewMatrices"):Lp.array=t,e=Lp.element(o.isMultiViewCamera?ba("gl_ViewID_OVR"):Ao)}else gb===null&&(gb=Se(o.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Re).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=gb;return e}).once()(),Ld=z(({camera:o})=>{let e;if(o.isArrayCamera&&o.cameras.length>0){const t=[];for(const s of o.cameras)t.push(s.matrixWorld);Op===null?Op=Bs(t).setGroup(Re).setName("cameraWorldMatrices"):Op.array=t,e=Op.element(o.isMultiViewCamera?ba("gl_ViewID_OVR"):Ao)}else yb===null&&(yb=Se(o.matrixWorld).setName("cameraWorldMatrix").setGroup(Re).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=yb;return e}).once()(),uP=z(({camera:o})=>{let e;if(o.isArrayCamera&&o.cameras.length>0){const t=[];for(const s of o.cameras)t.push(s.normalMatrix);zp===null?zp=Bs(t).setGroup(Re).setName("cameraNormalMatrices"):zp.array=t,e=zp.element(o.isMultiViewCamera?ba("gl_ViewID_OVR"):Ao)}else xb===null&&(xb=Se(o.normalMatrix).setName("cameraNormalMatrix").setGroup(Re).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=xb;return e}).once()(),GC=z(({camera:o})=>{let e;if(o.isArrayCamera&&o.cameras.length>0){const t=[];for(let s=0,i=o.cameras.length;s<i;s++)t.push(new H);Pp===null?Pp=Bs(t).setGroup(Re).setName("cameraPositions").onRenderUpdate(({camera:s},i)=>{const r=s.cameras,l=i.array;for(let u=0,h=r.length;u<h;u++)l[u].setFromMatrixPosition(r[u].matrixWorld)}):Pp.array=t,e=Pp.element(o.isMultiViewCamera?ba("gl_ViewID_OVR"):Ao)}else bb===null&&(bb=Se(new H).setName("cameraPosition").setGroup(Re).onRenderUpdate(({camera:t},s)=>s.value.setFromMatrixPosition(t.matrixWorld))),e=bb;return e}).once()(),cP=z(({camera:o})=>{let e;if(o.isArrayCamera&&o.cameras.length>0){const t=[];for(const s of o.cameras)t.push(s.viewport);Vp===null?Vp=Bs(t,"vec4").setGroup(Re).setName("cameraViewports"):Vp.array=t,e=Vp.element(Ao)}else _b===null&&(_b=Te(0,0,vl.x,vl.y).toConst("cameraViewport")),e=_b;return e}).once()(),VN=new Pg;class Ze extends we{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=Le.OBJECT,this.uniformNode=new Fd(null)}generateNodeType(){const e=this.scope;if(e===Ze.WORLD_MATRIX)return"mat4";if(e===Ze.POSITION||e===Ze.VIEW_POSITION||e===Ze.DIRECTION||e===Ze.SCALE)return"vec3";if(e===Ze.RADIUS)return"float"}update(e){const t=this.object3d,s=this.uniformNode,i=this.scope;if(i===Ze.WORLD_MATRIX)s.value=t.matrixWorld;else if(i===Ze.POSITION)s.value=s.value||new H,s.value.setFromMatrixPosition(t.matrixWorld);else if(i===Ze.SCALE)s.value=s.value||new H,s.value.setFromMatrixScale(t.matrixWorld);else if(i===Ze.DIRECTION)s.value=s.value||new H,t.getWorldDirection(s.value);else if(i===Ze.VIEW_POSITION){const r=e.camera;s.value=s.value||new H,s.value.setFromMatrixPosition(t.matrixWorld),s.value.applyMatrix4(r.matrixWorldInverse)}else if(i===Ze.RADIUS){const r=e.object.geometry;r.boundingSphere===null&&r.computeBoundingSphere(),VN.copy(r.boun
79dingSphere).applyMatrix4(t.matrixWorld),s.value=VN.radius}}generate(e){const t=this.scope;return t===Ze.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===Ze.POSITION||t===Ze.VIEW_POSITION||t===Ze.DIRECTION||t===Ze.SCALE?this.uniformNode.nodeType="vec3":t===Ze.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Ze.WORLD_MATRIX="worldMatrix";Ze.POSITION="position";Ze.SCALE="scale";Ze.VIEW_POSITION="viewPosition";Ze.DIRECTION="direction";Ze.RADIUS="radius";const hP=Ie(Ze,Ze.DIRECTION).setParameterLength(1),dP=Ie(Ze,Ze.WORLD_MATRIX).setParameterLength(1),fP=Ie(Ze,Ze.POSITION).setParameterLength(1),pP=Ie(Ze,Ze.SCALE).setParameterLength(1),mP=Ie(Ze,Ze.VIEW_POSITION).setParameterLength(1),gP=Ie(Ze,Ze.RADIUS).setParameterLength(1);class wn extends Ze{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const yP=ge(wn,wn.DIRECTION),_n=ge(wn,wn.WORLD_MATRIX),xP=ge(wn,wn.POSITION),bP=ge(wn,wn.SCALE),_P=ge(wn,wn.VIEW_POSITION),TP=ge(wn,wn.RADIUS),IC=Se(new js).onObjectUpdate(({object:o},e)=>e.value.getNormalMatrix(o.matrixWorld)),vP=Se(new Qe).onObjectUpdate(({object:o},e)=>e.value.copy(o.matrixWorld).invert()),Sr=z(o=>o.context.modelViewMatrix||kC).once()().toVar("modelViewMatrix"),kC=No.mul(_n),g_=z(o=>(o.context.isHighPrecisionModelViewMatrix=!0,Se("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),y_=z(o=>{const e=o.context.isHighPrecisionModelViewMatrix;return Se("mat3").onObjectUpdate(({object:t,camera:s})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),HC=z(o=>o.shaderStage!=="fragment"?(Ye("TSL: `clipSpace` is only available in fragment stage."),Te()):o.context.clipSpace.toVarying("v_clipSpace")).once()(),Is=qi("position","vec3"),Pt=Is.toVarying("positionLocal"),Sl=Is.toVarying("positionPrevious"),yr=z(o=>_n.mul(Pt).xyz.toVarying(o.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),tv=z(()=>Pt.transformDirection(_n).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),Zt=z(o=>{if(o.shaderStage==="fragment"&&o.material.vertexNode){const e=VC.mul(HC);return e.xyz.div(e.w).toVar("positionView")}return o.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),vt=z(o=>{let e;return o.camera.isOrthographicCamera?e=O(0,0,1):e=Zt.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class SP extends we{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";const{material:t}=e;return t.side===Ts?"false":e.getFrontFacing()}}const qC=ge(SP),sv=w(qC).mul(2).sub(1),Dl=z(([o],{material:e})=>{const t=e.side;return t===Ts?o=o.mul(-1):t===la&&(o=o.mul(sv)),o}),MP=o=>(Ye('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Dl(o)),ay=qi("normal","vec3"),Xs=z(o=>o.geometry.hasAttribute("normal")===!1?(me('TSL: Vertex attribute "normal" not found on geometry.'),O(0,1,0)):ay,"vec3").once()().toVar("normalLocal"),$C=Zt.dFdx().cross(Zt.dFdy()).normalize().toVar("normalFlat"),Tc=z(o=>{let e;return o.isFlatShading()?e=$C:e=nv(Xs).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),WC=z(o=>{let e=Tc.transformNormalByInverseViewMatrix(No);return o.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),st=z(o=>{let e;return o.subBuildFn==="NORMAL"||o.subBuildFn==="VERTEX"?(e=Tc,o.isFlatShading()!==!0&&(e=Dl(e))):e=o.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),wo=st.transformNormalByInverseViewMatrix(No).toVar("normalWorld"),co=z(({subBuildFn:o,context:e})=>{let t;return o==="NORMAL"||o==="VERTEX"?t=st:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),iv=z(([o,e=_n])=>vs(e).inverse().transpose().mul(o).normalize());K("transformNormal",iv);const nv=z(([o],e)=>{const t=e.context.modelNormalViewMatrix;return t?o.transformNormalByViewMatrix(t):IC.mul(o).transformNormalByViewMatrix(No)}),AP=z(()=>(me('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),st)).once(["NORMAL","VERTEX"])(),NP=z(()=>(me('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),wo)).once(["NORMAL","VERTEX"])(),wP=z(()=>(me('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),co)).once(["NORMAL","VERTEX"])(),Tb=new Qe,XC=Se(0).onReference(({material:o})=>o).onObjectUpdate(({material:o})=>o.refractionRatio),Sm=Se(1).onReference(({material:o})=>o).onObjectUpdate(function({material:o,scene:e}){return o.envMap?o.envMapIntensity:e.environmentIntensity}),Tg=Se(new Qe).onReference(function(o){return o.material}).onObjectUpdate(function({material:o,scene:e}){const s=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&o.envMap===null?e.environmentRotation:o.envMapRotation;return s?Tb.makeRotationFromEuler(s).transpose():Tb.identity(),Tb}),jC=vt.negate().reflect(st),YC=vt.negate().refract(st,XC),ZC=jC.transformDirection(Ld).toVar("reflectVector"),QC=YC.transformDirection(Ld).toVar("refractVector"),KC=new Vg;class RP extends vr{static get type(){return"CubeTextureNode"}constructor(e,t=null,s=null,i=null){super(e,t,s,i),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===dc?ZC:e.mapping===Fm?QC:(he('CubeTextureNode: Mapping "%s" not supported.',e.mapping),O(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const s=this.value;return s.isDepthTexture===!0?e.renderer.coordinateSystem===An?O(t.x,t.y.negate(),t.z):t:(t=Tg.mul(t),(e.renderer.coordinateSystem===An||!s.isRenderTargetTexture)&&(t=O(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}}const rv=Ie(RP).setParameterLength(1,4).setName("cubeTexture"),ii=(o=KC,e=null,t=null,s=null)=>{let i;return o&&o.isCubeTextureNode===!0?(i=ve(o.clone()),i.referenceNode=o,e!==null&&(i.uvNode=ve(e)),t!==null&&(i.levelNode=ve(t)),s!==null&&(i.biasNode=ve(s))):i=rv(o,e,t,s),i},EP=(o=KC)=>rv(o);class CP extends Rl{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),s=this.referenceNode.getNodeType(e),i=this.getNodeType(e);return e.format(t,s,i)}}class oy extends we{static get type(){return"ReferenceNode"}constructor(e,t,s=null,i=null){super(),this.property=e,this.uniformType=t,this.object=s,this.count=i,this.properties=e.split("."),this.reference=s,this.node=null,this.group=null,this.name=null,this.updateType=Le.OBJECT}element(e){return new CP(this,ve(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return me('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=Rc(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Bs(null,e),t.updateType=Le.OBJECT):e==="texture"?t=it(null):e==="cubeTexture"?t=ii(null):t=Se(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateV
79alue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let s=e[t[0]];for(let i=1;i<t.length;i++)s=s[t[i]];return s}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const Ct=(o,e,t)=>new oy(o,e,t),JC=(o,e,t,s)=>new oy(o,e,s,t);class BP extends oy{static get type(){return"MaterialReferenceNode"}constructor(e,t,s=null){super(e,t,s),this.material=s,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const ra=(o,e,t=null)=>new BP(o,e,t),e2=xt(),DP=Zt.dFdx(),UP=Zt.dFdy(),t2=e2.dFdx(),s2=e2.dFdy(),i2=st,n2=UP.cross(i2),r2=i2.cross(DP),x_=n2.mul(t2.x).add(r2.mul(s2.x)),b_=n2.mul(t2.y).add(r2.mul(s2.y)),GN=x_.dot(x_).max(b_.dot(b_)),a2=GN.equal(0).select(0,GN.inverseSqrt()),FP=x_.mul(a2).toVar("tangentViewFrame"),LP=b_.mul(a2).toVar("bitangentViewFrame"),ly=qi("tangent","vec4"),vo=ly.xyz.toVar("tangentLocal"),uy=z(o=>{let e;return o.subBuildFn==="VERTEX"||o.geometry.hasAttribute("tangent")?e=Sr.mul(Te(vo,0)).xyz.toVarying("v_tangentView").normalize():e=FP,o.isFlatShading()!==!0&&(e=Dl(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),o2=uy.transformDirection(Ld).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),cy=z(([o,e],t)=>{let s=o.mul(ly.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(s=s.toVarying(e)),s}).once(["NORMAL"]),OP=cy(ay.cross(ly),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),zP=cy(Xs.cross(vo),"v_bitangentLocal").normalize().toVar("bitangentLocal"),l2=z(o=>{let e;return o.subBuildFn==="VERTEX"||o.geometry.hasAttribute("tangent")?e=cy(st.cross(uy),"v_bitangentView").normalize():e=LP,o.isFlatShading()!==!0&&(e=Dl(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),PP=cy(wo.cross(o2),"v_bitangentWorld").normalize().toVar("bitangentWorld"),dl=vs(uy,l2,st).toVar("TBNViewMatrix"),u2=vt.mul(dl),VP=(o,e)=>o.sub(u2.mul(e)),c2=z(()=>{let o=gl.cross(vt);return o=o.cross(gl).normalize(),o=$e(o,st,ro.mul(lr.oneMinus()).oneMinus().pow2().pow2()).normalize(),o}).once()(),av=o=>ve(o).mul(.5).add(.5),h2=o=>ve(o).mul(2).sub(1),__=o=>O(o,ai(ty(w(1).sub(Nn(o,o))))),GP=o=>(Ye('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),av(o)),IP=o=>(Ye('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),h2(o));class kP extends qt{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=da,this.unpackNormalMode=$x}setup(e){const{normalMapType:t,scaleNode:s,unpackNormalMode:i}=this;let r=this.node.mul(2).sub(1);if(t===da?i===CR?r=__(r.xy):i===cL?r=__(r.yw):i!==$x&&he(`THREE.NodeMaterial: Unexpected unpack normal mode: ${i}`):i!==$x&&he(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${i}'`),s!==null){let u=s;e.isFlatShading()===!0&&(u=Dl(u)),r=O(r.xy.mul(u),r.z)}let l=null;return t===uL?l=nv(r):t===da?l=dl.mul(r).normalize():(he(`NodeMaterial: Unsupported normal map type: ${t}`),l=st),l}}const T_=Ie(kP).setParameterLength(1,2),HP=z(({textureNode:o,bumpScale:e})=>{const t=i=>o.isolate().context({getUV:r=>i(r.uvNode||xt()),forceUVContext:!0}),s=w(t(i=>i));return de(w(t(i=>i.add(i.dFdx()))).sub(s),w(t(i=>i.add(i.dFdy()))).sub(s)).mul(e)}),qP=z(o=>{const{surf_pos:e,surf_norm:t,dHdxy:s}=o,i=e.dFdx().normalize(),r=e.dFdy().normalize(),l=t,u=r.cross(l),h=l.cross(i),d=i.dot(u).mul(sv),p=d.sign().mul(s.x.mul(u).add(s.y.mul(h)));return d.abs().mul(t).sub(p).normalize()});class $P extends qt{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return st;const t=this.scaleNode!==null?this.scaleNode:1,s=HP({textureNode:this.textureNode,bumpScale:t});return qP({surf_pos:Zt,surf_norm:st,dHdxy:s})}}const ov=Ie($P).setParameterLength(1,2),IN=new Map;class ee extends we{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let s=IN.get(e);return s===void 0&&(s=ra(e,t),IN.set(e,s)),s}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,s=this.scope;let i=null;if(s===ee.COLOR){const r=t.color!==void 0?this.getColor(s):O();t.map&&t.map.isTexture===!0?i=r.mul(this.getTexture("map")):i=r}else if(s===ee.OPACITY){const r=this.getFloat(s);t.alphaMap&&t.alphaMap.isTexture===!0?i=r.mul(this.getTexture("alpha")):i=r}else if(s===ee.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?i=this.getTexture("specular").r:i=w(1);else if(s===ee.SPECULAR_INTENSITY){const r=this.getFloat(s);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?i=r.mul(this.getTexture(s).a):i=r}else if(s===ee.SPECULAR_COLOR){const r=this.getColor(s);t.specularColorMap&&t.specularColorMap.isTexture===!0?i=r.mul(this.getTexture(s).rgb):i=r}else if(s===ee.ROUGHNESS){const r=this.getFloat(s);t.roughnessMap&&t.roughnessMap.isTexture===!0?i=r.mul(this.getTexture(s).g):i=r}else if(s===ee.METALNESS){const r=this.getFloat(s);t.metalnessMap&&t.metalnessMap.isTexture===!0?i=r.mul(this.getTexture(s).b):i=r}else if(s===ee.EMISSIVE){const r=this.getFloat("emissiveIntensity"),l=this.getColor(s).mul(r);t.emissiveMap&&t.emissiveMap.isTexture===!0?i=l.mul(this.getTexture(s)):i=l}else if(s===ee.NORMAL)t.normalMap?(i=T_(this.getTexture("normal"),this.getCache("normalScale","vec2")),i.normalMapType=t.normalMapType,(t.normalMap.format==xn||t.normalMap.format==Md||t.normalMap.format==Sd)&&(i.unpackNormalMode=CR)):t.bumpMap?i=ov(this.getTexture("bump").r,this.getFloat("bumpScale")):i=st;else if(s===ee.CLEARCOAT){const r=this.getFloat(s);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?i=r.mul(this.getTexture(s).r):i=r}else if(s===ee.CLEARCOAT_ROUGHNESS){const r=this.getFloat(s);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?i=r.mul(this.getTexture(s).r):i=r}else if(s===ee.CLEARCOAT_NORMAL)t.clearcoatNormalMap?i=T_(this.getTexture(s),this.getCache(s+"Scale","vec2")):i=st;else if(s===ee.SHEEN){const r=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?i=r.mul(this.getTexture("sheenColor").rgb):i=r}else if(s===ee.SHEEN_ROUGHNESS){const r=this.getFloat(s);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?i=r.mul(this.getTexture(s).a):i=r,i=i.clamp(1e-4,1)}else if(s===ee.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const r=this.getTexture(s);i=jg(Yu.x,Yu.y,Yu.y.negate(),Yu.x).mul(r.rg.mul(2).sub(de(1)).normalize().mul(r.b))}else i=Yu;else if(s===ee.IRIDESCENCE_THICKNESS){const r=Ct("1","float",t.iridescenceThicknessRange);
79if(t.iridescenceThicknessMap){const l=Ct("0","float",t.iridescenceThicknessRange);i=r.sub(l).mul(this.getTexture(s).g).add(l)}else i=r}else if(s===ee.TRANSMISSION){const r=this.getFloat(s);t.transmissionMap?i=r.mul(this.getTexture(s).r):i=r}else if(s===ee.THICKNESS){const r=this.getFloat(s);t.thicknessMap?i=r.mul(this.getTexture(s).g):i=r}else if(s===ee.IOR)i=this.getFloat(s);else if(s===ee.LIGHT_MAP)t.lightMap?i=this.getTexture(s).rgb.mul(this.getFloat("lightMapIntensity")):i=O(0);else if(s===ee.AO)t.aoMap?i=this.getTexture(s).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):i=w(1);else if(s===ee.LINE_DASH_OFFSET)i=t.dashOffset?this.getFloat(s):w(0);else{const r=this.getNodeType(e);i=this.getCache(s,r)}return i}}ee.ALPHA_TEST="alphaTest";ee.COLOR="color";ee.OPACITY="opacity";ee.SHININESS="shininess";ee.SPECULAR="specular";ee.SPECULAR_STRENGTH="specularStrength";ee.SPECULAR_INTENSITY="specularIntensity";ee.SPECULAR_COLOR="specularColor";ee.REFLECTIVITY="reflectivity";ee.ROUGHNESS="roughness";ee.METALNESS="metalness";ee.NORMAL="normal";ee.CLEARCOAT="clearcoat";ee.CLEARCOAT_ROUGHNESS="clearcoatRoughness";ee.CLEARCOAT_NORMAL="clearcoatNormal";ee.EMISSIVE="emissive";ee.ROTATION="rotation";ee.SHEEN="sheen";ee.SHEEN_ROUGHNESS="sheenRoughness";ee.ANISOTROPY="anisotropy";ee.IRIDESCENCE="iridescence";ee.IRIDESCENCE_IOR="iridescenceIOR";ee.IRIDESCENCE_THICKNESS="iridescenceThickness";ee.IOR="ior";ee.TRANSMISSION="transmission";ee.THICKNESS="thickness";ee.ATTENUATION_DISTANCE="attenuationDistance";ee.ATTENUATION_COLOR="attenuationColor";ee.LINE_SCALE="scale";ee.LINE_DASH_SIZE="dashSize";ee.LINE_GAP_SIZE="gapSize";ee.LINE_WIDTH="linewidth";ee.LINE_DASH_OFFSET="dashOffset";ee.POINT_SIZE="size";ee.DISPERSION="dispersion";ee.LIGHT_MAP="light";ee.AO="ao";const d2=ge(ee,ee.ALPHA_TEST),f2=ge(ee,ee.COLOR),p2=ge(ee,ee.SHININESS),m2=ge(ee,ee.EMISSIVE),lv=ge(ee,ee.OPACITY),g2=ge(ee,ee.SPECULAR),v_=ge(ee,ee.SPECULAR_INTENSITY),y2=ge(ee,ee.SPECULAR_COLOR),gd=ge(ee,ee.SPECULAR_STRENGTH),Mm=ge(ee,ee.REFLECTIVITY),x2=ge(ee,ee.ROUGHNESS),b2=ge(ee,ee.METALNESS),_2=ge(ee,ee.NORMAL),T2=ge(ee,ee.CLEARCOAT),v2=ge(ee,ee.CLEARCOAT_ROUGHNESS),S2=ge(ee,ee.CLEARCOAT_NORMAL),M2=ge(ee,ee.ROTATION),A2=ge(ee,ee.SHEEN),N2=ge(ee,ee.SHEEN_ROUGHNESS),w2=ge(ee,ee.ANISOTROPY),R2=ge(ee,ee.IRIDESCENCE),E2=ge(ee,ee.IRIDESCENCE_IOR),C2=ge(ee,ee.IRIDESCENCE_THICKNESS),B2=ge(ee,ee.TRANSMISSION),D2=ge(ee,ee.THICKNESS),U2=ge(ee,ee.IOR),F2=ge(ee,ee.ATTENUATION_DISTANCE),L2=ge(ee,ee.ATTENUATION_COLOR),uv=ge(ee,ee.LINE_SCALE),cv=ge(ee,ee.LINE_DASH_SIZE),hv=ge(ee,ee.LINE_GAP_SIZE),vg=ge(ee,ee.LINE_WIDTH),dv=ge(ee,ee.LINE_DASH_OFFSET),O2=ge(ee,ee.POINT_SIZE),z2=ge(ee,ee.DISPERSION),fv=ge(ee,ee.LIGHT_MAP),P2=ge(ee,ee.AO),Yu=Se(new Fe).onReference(function(o){return o.material}).onRenderUpdate(function({material:o}){this.value.set(o.anisotropy*Math.cos(o.anisotropyRotation),o.anisotropy*Math.sin(o.anisotropyRotation))}),V2=z(o=>o.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class ls extends we{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===ls.OBJECT?this.updateType=Le.OBJECT:e===ls.MATERIAL?this.updateType=Le.RENDER:e===ls.FRAME?this.updateType=Le.FRAME:e===ls.BEFORE_OBJECT?this.updateBeforeType=Le.OBJECT:e===ls.BEFORE_MATERIAL?this.updateBeforeType=Le.RENDER:e===ls.BEFORE_FRAME&&(this.updateBeforeType=Le.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}ls.OBJECT="object";ls.MATERIAL="material";ls.FRAME="frame";ls.BEFORE_OBJECT="beforeObject";ls.BEFORE_MATERIAL="beforeMaterial";ls.BEFORE_FRAME="beforeFrame";const Ec=(o,e)=>new ls(o,e).toStack(),Od=o=>Ec(ls.OBJECT,o),WP=o=>Ec(ls.MATERIAL,o),G2=o=>Ec(ls.FRAME,o),XP=o=>Ec(ls.BEFORE_OBJECT,o),jP=o=>Ec(ls.BEFORE_MATERIAL,o),YP=o=>Ec(ls.BEFORE_FRAME,o);class ZP extends Rl{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const s=this.storageBufferNode.structTypeNode;return s?s.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let s;const i=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&i!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?s=e.generatePBO(this):s=this.node.build(e):s=super.generate(e),i!==!0){const r=this.getNodeType(e);s=e.format(s,r,t)}return s}}const QP=Ie(ZP).setParameterLength(2);class KP extends KT{static get type(){return"StorageBufferNode"}constructor(e,t=null,s=0){let i,r=null;t&&t.isStructTypeNode?(i="struct",r=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(s=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(i=jR(e.itemSize),s=e.count):i=t,super(e,i,s),this.isStorageBufferNode=!0,this.structTypeNode=r,this.access=Us.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let s=e.globalCache.getData(this.value);s===void 0&&(s={node:this},e.globalCache.setData(this.value,s)),t=s.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return QP(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Us.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=$T(this.value),this._varying=Mo(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:s}=this.getAttributeData(),i=s.build(e);return e.registerTransform(i,t),i}}const xo=(o,e=null,t=0)=>new KP(o,e,t),S_=new WeakMap,kN=new WeakMap,M_=new WeakMap;function I2(o,e){let t;const s=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=xo(e,"mat4",s).element
79(kn);else if(s*16*4<=o.getUniformBufferLimit())t=Rc(e.array,"mat4",s).element(kn);else{let l=S_.get(e);l||(l=new LO(e.array,16,1),S_.set(e,l));const u=e.usage===Bd?WT:ny,h=[u(l,"vec4",16,0),u(l,"vec4",16,4),u(l,"vec4",16,8),u(l,"vec4",16,12)];t=yo(...h)}return t}function JP(o,e,t){let s=M_.get(o);if(s===void 0){const i=e.clone();s={previousInstanceMatrix:i,node:I2(t,i)},M_.set(o,s)}return s.node}const pv=Cl("vec3","vInstanceColor"),k2=z(([o,e=null],t)=>{const s=o.isStorageInstancedBufferAttribute===!0,i=e&&e.isStorageInstancedBufferAttribute===!0,r=I2(t,o);let l=null;s||Math.max(o.count,1)*16*4>t.getUniformBufferLimit()&&(l=S_.get(o));let u=null,h=null;if(e)if(i)u=xo(e,"vec3",Math.max(e.count,1)).element(kn);else{let p=kN.get(e);p||(p=new rc(e.array,3),kN.set(e,p)),h=p;const m=e.usage===Bd?WT:ny;u=O(m(p,"vec3",3,0))}(l!==null||h!==null)&&G2(()=>{l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...o.updateRanges),o.version!==l.version&&(l.version=o.version)),e&&h!==null&&(h.clearUpdateRanges(),h.updateRanges.push(...e.updateRanges),e.version!==h.version&&(h.version=e.version))});const d=r.mul(Pt).xyz;if(Pt.assign(d),t.needsPreviousData()){const p=t.object;Od(({object:y})=>{M_.get(y).previousInstanceMatrix.array.set(o.array)});const m=JP(p,o,t);Sl.assign(m.mul(Sl).xyz)}if(t.hasGeometryAttribute("normal")){const p=iv(Xs,r);Xs.assign(p)}u!==null&&pv.assign(u)},"void"),H2=z(([o])=>{const{instanceMatrix:e,instanceColor:t}=o;k2(e,t)},"void"),eV=z(([o,e])=>{const t=D(Tl(Yt(o),0).x).toConst(),s=D(e),i=s.mod(t).toConst(),r=s.div(t).toConst();return Yt(o,It(i,r))}),tV=z(([o,e])=>{const t=D(Tl(Yt(o),0).x).toConst(),s=D(e).mod(t).toConst(),i=D(e).div(t).toConst();return Yt(o,It(s,i)).x}),mv=Cl("vec4","vBatchColor"),q2=z(([o],e)=>{const t=e.getDrawIndex()===null?kn:NC,s=tV(o._indirectTexture,D(t)),i=o._matricesTexture,r=D(Tl(Yt(i),0).x).toConst(),l=w(s).mul(4).toInt().toConst(),u=l.mod(r).toConst(),h=l.div(r).toConst(),d=yo(Yt(i,It(u,h)),Yt(i,It(u.add(1),h)),Yt(i,It(u.add(2),h)),Yt(i,It(u.add(3),h))),p=o._colorsTexture;if(p!==null){const _=eV(p,s);mv.assign(_)}const m=vs(d);Pt.assign(d.mul(Pt));const y=Xs.div(O(m[0].dot(m[0]),m[1].dot(m[1]),m[2].dot(m[2]))),b=m.mul(y).xyz;Xs.assign(b),e.hasGeometryAttribute("tangent")&&vo.mulAssign(m)},"void"),Sg=new WeakMap,Mg=new WeakMap;
79function gv(o,e,t,s,i,r){const l=o.element(i.x),u=o.element(i.y),h=o.element(i.z),d=o.element(i.w),p=t.mul(e),m=ss(l.mul(r.x).mul(p),u.mul(r.y).mul(p),h.mul(r.z).mul(p),d.mul(r.w).mul(p));return s.mul(m).xyz}function $2(o,e,t,s,i,r,l){const u=o.element(r.x),h=o.element(r.y),d=o.element(r.z),p=o.element(r.w);let m=ss(l.x.mul(u),l.y.mul(h),l.z.mul(d),l.w.mul(p));m=i.mul(m).mul(s);const y=m.transformDirection(e).xyz,b=m.transformDirection(t).xyz;return{skinNormal:y,skinTangent:b}}function W2(o,e,t,s,i){const r=o.skeleton;let l=Mg.get(r);if(l===void 0){r.update();const u=new Float32Array(r.boneMatrices);l={previousBoneMatrices:u,node:Rc(u,"mat4",r.bones.length)},Mg.set(r,l)}return gv(l.node,Sl,e,t,s,i)}const X2=z(([o],e)=>{const t=qi("skinIndex","uvec4"),s=qi("skinWeight","vec4"),i=Ct("bindMatrix","mat4"),r=Ct("bindMatrixInverse","mat4"),l=JC("skeleton.boneMatrices","mat4",o.skeleton.bones.length);if(Od(({object:h,frameId:d})=>{const p=h.skeleton;if(Sg.get(p)!==d){Sg.set(p,d);const m=Mg.get(p);m!==void 0&&m.previousBoneMatrices.set(p.boneMatrices),p.update()}}),e.needsPreviousData()){const h=W2(o,i,r,t,s);Sl.assign(h)}const u=gv(l,Pt,i,r,t,s);if(Pt.assign(u),e.hasGeometryAttribute("normal")){const{skinNormal:h,skinTangent:d}=$2(l,Xs,vo,i,r,t,s);Xs.assign(h),e.hasGeometryAttribute("tangent")&&vo.assign(d)}},"void"),sV=z(([o,e=null],t)=>{const s=xo(new rc(o.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(kn).toVar(),i=xo(new rc(new Uint32Array(o.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(kn).toVar(),r=xo(new rc(o.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(kn).toVar(),l=Se(o.bindMatrix,"mat4"),u=Se(o.bindMatrixInverse,"mat4"),h=Rc(o.skeleton.boneMatrices,"mat4",o.skeleton.bones.length),d=o.skeleton;if(Od(({frameId:m})=>{if(Sg.get(d)!==m){Sg.set(d,m);const y=Mg.get(d);y!==void 0&&y.previousBoneMatrices.set(d.boneMatrices),d.update()}}),t.needsPreviousData()){const m=W2(o,l,u,i,r);Sl.assign(m)}const p=gv(h,s,l,u,i,r);if(e!==null&&e.assign(p),t.hasGeometryAttribute("normal")){const{skinNormal:m,skinTangent:y}=$2(h,Xs,vo,l,u,i,r);Xs.assign(m),t.hasGeometryAttribute("tangent")&&vo.assign(y)}return p});class iV extends we{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const s={};for(let u=0,h=this.params.length-1;u<h;u++){const d=this.params[u],p=d.isNode!==!0&&d.name||this.getVarName(u),m=d.isNode!==!0&&d.type||"int";s[p]=Ii(p,m)}const i=e.addStack(),r=this.params[this.params.length-1](s);t.returnsNode=r.context({nodeLoop:r}),t.stackNode=i;const l=this.params[0];if(l.isNode!==!0&&typeof l.update=="function"){const u=z(this.params[0].update)(s);t.updateNode=u.context({nodeLoop:u})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){const t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){const t=this.getProperties(e),s=this.params,i=t.stackNode;for(let l=0,u=s.length-1;l<u;l++){const h=s[l];let d=!1,p=null,m=null,y=null,b=null,_=null,v=null;h.isNode?h.getNodeType(e)==="bool"?(d=!0,b="bool",m=h.build(e,b)):(b="int",y=this.getVarName(l),p="0",m=h.build(e,b),_="<"):(b=h.type||"int",y=h.name||this.getVarName(l),p=h.start,m=h.end,_=h.condition,v=h.update,typeof p=="number"?p=e.generateConst(b,p):p&&p.isNode&&(p=p.build(e,b)),typeof m=="number"?m=e.generateConst(b,m):m&&m.isNode&&(m=m.build(e,b)),p!==void 0&&m===void 0?(p=p+" - 1",m="0",_=">="):m!==void 0&&p===void 0&&(p="0",_="<"),_===void 0&&(Number(p)>Number(m)?_=">=":_="<"));let M;if(d)M=`while ( ${m} )`;else{const A={start:p,end:m},C=A.start,E=A.end;let F;const L=()=>_.includes("<")?"+=":"-=";if(v!=null)switch(typeof v){case"function":F=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":F=y+" "+L()+" "+e.generateConst(b,v);break;case"string":F=y+" "+v;break;default:v.isNode?F=y+" "+L()+" "+v.build(e):(he("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),F="break /* invalid update */")}else b==="int"||b==="uint"?v=_.includes("<")?"++":"--":v=L()+" 1.",F=y+" "+v;const U=e.getVar(b,y)+" = "+C,R=y+" "+_+" "+E;M=`for ( ${U}; ${R}; ${F} )`}e.addFlowCode((l===0?` 80`:"")+e.tab+M+` { 81 82`).addFlowTab()}const r=i.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(` 83`+e.tab+r);for(let l=0,u=this.params.length-1;l<u;l++)e.addFlowCode((l===0?"":e.tab)+`} 84 85`).removeFlowTab();e.addFlowTab()}}const yt=(...o)=>new iV(ml(o,"int")).toStack(),nV=()=>Ii("continue").toStack(),j2=()=>Ii("break").toStack(),vb=new WeakMap,Fi=new ht,HN=new WeakMap,qN=z(({bufferMap:o,influence:e,stride:t,width:s,depth:i,offset:r})=>{const l=D(AC).mul(t).add(r),u=l.div(s),h=l.sub(u.mul(s));return Yt(o,It(h,u)).depth(i).xyz.mul(e)});function rV(o){const e=o.morphAttributes.position!==void 0,t=o.morphAttributes.normal!==void 0,s=o.morphAttributes.color!==void 0,i=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,r=i!==void 0?i.length:0;let l=vb.get(o);if(l===void 0||l.count!==r){let C=function(){M.dispose(),vb.delete(o),o.removeEventListener("dispose",C)};var u=C;l!==void 0&&l.texture.dispose();const h=o.morphAttributes.position||[],d=o.morphAttributes.normal||[],p=o.morphAttributes.color||[];let m=0;e===!0&&(m=1),t===!0&&(m=2),s===!0&&(m=3);let y=o.attributes.position.count*m,b=1;const _=4096;y>_&&(b=Math.ceil(y/_),y=_);const v=new Float32Array(y*b*4*r),M=new XL(v,y,b,r);M.type=_s,M.needsUpdate=!0;const A=m*4;for(let E=0;E<r;E++){const F=h[E],L=d[E],U=p[E],R=y*b*4*E;for(let V=0;V<F.count;V++){const $=V*A;e===!0&&(Fi.fromBufferAttribute(F,V),v[R+$+0]=Fi.x,v[R+$+1]=Fi.y,v[R+$+2]=Fi.z,v[R+$+3]=0),t===!0&&(Fi.fromBufferAttribute(L,V),v[R+$+4]=Fi.x,v[R+$+5]=Fi.y,v[R+$+6]=
85Fi.z,v[R+$+7]=0),s===!0&&(Fi.fromBufferAttribute(U,V),v[R+$+8]=Fi.x,v[R+$+9]=Fi.y,v[R+$+10]=Fi.z,v[R+$+11]=U.itemSize===4?Fi.w:1)}}l={count:r,texture:M,stride:m,size:new Fe(y,b)},vb.set(o,l),o.addEventListener("dispose",C)}return l}const Y2=z(([o])=>{const{geometry:e}=o,t=e.morphAttributes.position!==void 0,s=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,i=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,r=i!==void 0?i.length:0;if(r===0)return;let l=HN.get(o);(l===void 0||l.count!==r)&&(l={base:Se(1),influences:o.morphTargetInfluences?Bs(o.morphTargetInfluences,"float"):null,count:r},HN.set(o,l));const{base:u,influences:h}=l,{texture:d,stride:p,size:m}=rV(e);t===!0&&Pt.mulAssign(u),s===!0&&Xs.mulAssign(u);const y=D(m.width);yt(r,({i:b})=>{const _=w(0).toVar();o.count>1&&o.morphTexture!==null&&o.morphTexture!==void 0?_.assign(Yt(o.morphTexture,It(D(b).add(1),D(kn))).r):_.assign(h.element(b).toVar()),Ae(_.notEqual(0),()=>{t===!0&&Pt.addAssign(qN({bufferMap:d,influence:_,stride:p,width:y,depth:b,offset:D(0)})),s===!0&&Xs.addAssign(qN({bufferMap:d,influence:_,stride:p,width:y,depth:b,offset:D(1)}))})}),Od(({object:b})=>{const{base:_,influences:v}=l;b.geometry.morphTargetsRelative?_.value=1:_.value=1-b.morphTargetInfluences.reduce((M,A)=>M+A,0),v&&(v.array=b.morphTargetInfluences,v.update())})},"void");class Cc extends we{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class aV extends Cc{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class oV extends GT{static get type(){return"LightingContextNode"}constructor(e,t=null,s=[],i=null,r=null){super(e),this.lightingModel=t,this.materialLightings=s,this.backdropNode=i,this.backdropAlphaNode=r,this._value=null}getContext(){const{materialLightings:e,backdropNode:t,backdropAlphaNode:s}=this,i=O().toVar("directDiffuse"),r=O().toVar("directSpecular"),l=O().toVar("indirectDiffuse"),u=O().toVar("indirectSpecular"),h={directDiffuse:i,directSpecular:r,indirectDiffuse:l,indirectSpecular:u};return{radiance:O().toVar("radiance"),irradiance:O().toVar("irradiance"),iblIrradiance:O().toVar("iblIrradiance"),ambientOcclusion:w(1).toVar("ambientOcclusion"),reflectedLight:h,materialLightings:e,backdrop:t,backdropAlpha:s}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const Z2=Ie(oV);class lV extends Cc{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const Ko=new Fe;class hy extends vr{static get type(){return"ViewportTextureNode"}constructor(e=In,t=null,s=null){let i=null;s===null?(i=new sT,i.minFilter=ca,s=i):i=s,super(s,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=i,this.isOutputTextureNode=!0,this.updateBeforeType=Le.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,s;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,s=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,s=this._cacheTextures),e===null)return t;if(s.has(e)===!1){const i=t.clone();s.set(e,i)}return s.get(e)}updateReference(e){const t=e.renderer,s=t.getRenderTarget(),i=t.getCanvasTarget(),r=s||i;return this.value=this.getTextureForReference(r),this.value}updateBefore(e){const t=e.renderer,s=t.getRenderTarget(),i=t.getCanvasTarget(),r=s||i;r===null?t.getDrawingBufferSize(Ko):r.getDrawingBufferSize?r.getDrawingBufferSize(Ko):Ko.set(r.width,r.height);const l=this.getTextureForReference(r);(l.image.width!==Ko.width||l.image.height!==Ko.height)&&(l.image.width=Ko.width,l.image.height=Ko.height,l.needsUpdate=!0);const u=l.generateMipmaps;l.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(l),l.generateMipmaps=u}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const uV=Ie(hy).setParameterLength(0,3),yv=Ie(hy,null,null,{generateMipmaps:!0}
85).setParameterLength(0,3),cV=yv(),Q2=(o=In,e=null)=>cV.sample(o,e);let Sb=null;class hV extends hy{static get type(){return"ViewportDepthTextureNode"}constructor(e=In,t=null,s=null){s===null&&(Sb===null&&(Sb=new Sn),s=Sb),super(e,t,s)}}const xv=Ie(hV).setParameterLength(0,3);class xi extends we{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===xi.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,s=this.valueNode;let i=null;if(t===xi.DEPTH_BASE)s!==null&&(i=eB().assign(s));else if(t===xi.DEPTH)e.isPerspectiveCamera?i=bv(Zt.z,lo,uo):i=bl(Zt.z,lo,uo);else if(t===xi.LINEAR_DEPTH)if(s!==null)if(e.isPerspectiveCamera){const r=dy(s,lo,uo);i=bl(r,lo,uo)}else i=s;else i=bl(Zt.z,lo,uo);return i}}xi.DEPTH_BASE="depthBase";xi.DEPTH="depth";xi.LINEAR_DEPTH="linearDepth";const bl=(o,e,t)=>o.add(e).div(e.sub(t)),dV=(o,e,t)=>o.add(t).div(t.sub(e)),K2=z(([o,e,t],s)=>s.renderer.reversedDepthBuffer===!0?t.sub(e).mul(o).sub(t):e.sub(t).mul(o).sub(e)),bv=(o,e,t)=>e.add(o).mul(t).div(t.sub(e).mul(o)),J2=(o,e,t)=>e.mul(o.add(t)).div(o.mul(e.sub(t))),dy=z(([o,e,t],s)=>s.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(o).sub(e)):e.mul(t).div(t.sub(e).mul(o).sub(t))),fy=(o,e,t)=>{e=e.max(1e-6).toVar();const s=pr(o.negate().div(e)),i=pr(t.div(e));return s.div(i)},fV=(o,e,t)=>{const s=o.mul(Jg(t.div(e)));return w(Math.E).pow(s).mul(e).negate()},eB=Ie(xi,xi.DEPTH_BASE),_v=ge(xi,xi.DEPTH),Ag=Ie(xi,xi.LINEAR_DEPTH).setParameterLength(0,1),pV=Ag(xv());_v.assign=o=>eB(o);class Mn extends we{static get type(){return"ClippingNode"}constructor(e=Mn.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:s,unionPlanes:i}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===Mn.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(s,i):this.scope===Mn.HARDWARE?this.setupHardwareClipping(i,e):this.setupDefault(s,i)}setupAlphaToCoverage(e,t){return z(()=>{const s=w().toVar("distanceToPlane"),i=w().toVar("distanceToGradient"),r=w(1).toVar("clipOpacity"),l=t.length;if(this.hardwareClipping===!1&&l>0){const h=Bs(t).setGroup(Re);yt(l,({i:d})=>{const p=h.element(d);s.assign(Zt.dot(p.xyz).negate().add(p.w)),i.assign(s.fwidth().div(2)),r.mulAssign(Qi(i.negate(),i,s))})}const u=e.length;if(u>0){const h=Bs(e).setGroup(Re),d=w(1).toVar("intersectionClipOpacity");yt(u,({i:p})=>{const m=h.element(p);s.assign(Zt.dot(m.xyz).negate().add(m.w)),i.assign(s.fwidth().div(2)),d.mulAssign(Qi(i.negate(),i,s).oneMinus())}),r.mulAssign(d.oneMinus())}gt.a.mulAssign(r),gt.a.equal(0).discard()})()}setupDefault(e,t){return z(()=>{const s=t.length;if(this.hardwareClipping===!1&&s>0){const r=Bs(t).setGroup(Re);yt(s,({i:l})=>{const u=r.element(l);Zt.dot(u.xyz).greaterThan(u.w).discard()})}const i=e.length;if(i>0){const r=Bs(e).setGroup(Re),l=Yi(!0).toVar("clipped");yt(i,({i:u})=>{const h=r.element(u);l.assign(Zt.dot(h.xyz).greaterThan(h.w).and(l))}),l.discard()}})()}setupHardwareClipping(e,t){const s=e.length;return t.enableHardwareClipping(s),z(()=>{const i=Bs(e).setGroup(Re),r=ba(t.getClipDistance());yt(s,({i:l})=>{const u=i.element(l),h=Zt.dot(u.xyz).sub(u.w).negate();r.element(l).assign(h)})})()}}Mn.ALPHA_TO_COVERAGE="alphaToCoverage";Mn.DEFAULT="default";Mn.HARDWARE="hardware";const mV=()=>new Mn,gV=()=>new Mn(Mn.ALPHA_TO_COVERAGE),yV=()=>new Mn(Mn.HARDWARE),xV=.05,$N=z(([o])=>Hn(ze(1e4,ti(ze(17,o.x).add(ze(.1,o.y)))).mul(ss(.1,wt(ti(ze(13,o.y).add(o.x))))))),WN=z(([o])=>$N(de($N(o.xy),o.z))),bV=z(([o])=>{const e=Ht(gr(BT(o.xyz)),gr(DT(o.xyz))),t=w(1).div(w(xV).mul(e)).toVar("pixScale"),s=de(_c(mr(pr(t))),_c(ey(pr(t)))),i=de(WN(mr(s.x.mul(o.xyz))),WN(mr(s.y.mul(o.xyz)))),r=Hn(pr(t)),l=ss(ze(r.oneMinus(),i.x),ze(r,i.y)),u=bi(r,r.oneMinus()),h=O(l.mul(l).div(ze(2,u).mul(Ke(1,u))),l.sub(ze(.5,u)).div(Ke(1,u)),Ke(1,Ke(1,l).mul(Ke(1,l)).div(ze(2,u).mul(Ke(1,u))))),d=l.lessThan(u.oneMinus()).select(l.lessThan(u).select(h.x,h.y),h.z);return qn(d,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class _V extends OC{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),s=e.hasGeometryAttribute(t);let i;return s===!0?i=super.generate(e):i=e.generateConst(this.nodeType,new ht(1,1,1,1)),i}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const tB=(o=0)=>new _V(o);class Bt extends ji{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;const s=this[t];s&&s.isNode===!0&&e.push({property:t,childNode:s})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:s}of this._getNodeChildren())e.push(wc(t.slice(0,-4)),s.getCacheKey());return this.type+Ud(e)}build(e){this.setup(e)}setupObserver(e){return new GO(e)}setup(e){e.context.setupNormal=()=>xl(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,s=t.getRenderTarget();e.addStack();const i=this.setupVertex(e),r=xl(this.vertexNode||i,"VERTEX");e.context.clipSpace=r,e.stack.outputNode=r,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let l;const u=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(s!==null?s.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);const h=this.setupLighting(e);u!==null&&e.stack.addToStack(u);const d=Te(h,gt.a).max(0);l=this.setupOutput(e,d),oc.assign(l);const p=this.outputNode!==null;if(p&&(l=this.outputNode),e.context.getOutput&&(l=e.context.getOutput(l,e)),s!==null){const m=t.getMRT(),y=this.mrtNode;m!==null?(p&&oc.assign(l),l=m,y!==null&&(l=m.merge(y))):y!==null&&(l=y)}}else{let h=this.fragmentNode;h.isOutputStructNode!==!0&&(h=h.convert(e.getOutputType())),l=this.setupOutput(e,h)}e.stack.outputNode=l,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:s}=e.clippingContext;let i=null;if(t.length>0||s.length>0){const r=e.renderer.currentSamples;this.alphaToCoverage&&r>1?i=gV():e.stack.addToStack(mV())}return i}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(yV()),e.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:s}=e;let i=this.depthNode;if(i===null){const r=t.getMRT();r&&r.has("depth")?i=r.get("depth"):t.logarithmicDepthBuffer===!0&&(s.isPerspectiveCamera?i=fy(Zt.z,lo,uo):i=bl(Zt.z,lo,uo))}i!==null&&_v.assign(i).toStack()}setupPositionView(){return Sr.mul(Pt).xyz}setupModelViewProjection(){return ni.mul(Zt)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),V2}setupPosition(e){const{object:t,geometry:s}=e;if((s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color)&&Y2(t),t.isSkinnedMesh===!0&&X2(t),this.displacementMap){const i=ra("displacementMap","texture"),r=ra("displacementScale","float"),l=ra("displacementBias","float");Pt.addAssign(Xs.normalize().mul(i.x.mul(r).add(l)))}return t.isBatchedMesh&&q2(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&H2(t),this.positionNode!==null&&Pt.assign(xl(this.positionNode,"POSITION","vec3")),Pt}setupDiffuseColor(e){const{object:t,geometry:s}=e;this.maskNode!==null&&Yi(this.maskNode).not().discard();let i=this.colorNode?Te(this.colorNode):f2;this.vertexColors===!0&&s.hasAttribute("color")&&(i=i.mul(tB())),t.instanceColor&&(i=pv.mul(i)),t.isBatchedMesh&&t._
85colorsTexture&&(i=mv.mul(i)),gt.assign(i);const r=this.opacityNode?w(this.opacityNode):lv;gt.a.assign(gt.a.mul(r));let l=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(l=this.alphaTestNode!==null?w(this.alphaTestNode):d2,this.alphaToCoverage===!0?(gt.a=Qi(l,l.add(FT(gt.a)),gt.a),gt.a.lessThanEqual(0).discard()):gt.a.lessThanEqual(l).discard()),this.alphaHash===!0&>.a.lessThan(bV(Pt)).discard(),e.isOpaque()&>.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?O(0):gt.rgb}setupNormal(){return this.normalNode?O(this.normalNode):_2}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?ra("envMap","cubeTexture"):ra("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new lV(fv)),t}setupMaterialLightings(e){const t=[];if(e.renderer.lighting.enabled===!1)return t;const s=this.setupEnvironment(e);s&&s.isLightingNode&&t.push(s);const i=this.setupLightMap(e);return i&&i.isLightingNode&&t.push(i),e.context.ambientOcclusion&&t.push(new aV(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=P2),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(m_.assign(t),e.context.ambientOcclusion=m_)}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:s,backdropAlphaNode:i,emissiveNode:r}=this,l=this.lights===!0||this.lightsNode!==null,u=this.lights===!0?this.setupMaterialLightings(e):[],h=l?this.lightsNode||e.lightsNode:null;let d=this.setupOutgoingLight(e);if(h&&(u.length>0||h.getScope().hasLights)){const p=this.setupLightingModel(e)||null;d=Z2(h,p,u,s,i)}else s!==null&&(d=O(i!==null?$e(d,s,i):s));return(r&&r.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(p_.assign(O(r||m2)),d=d.add(p_)),d}setupFog(e,t){const s=e.fogNode;return s&&(oc.assign(t),t=Te(s.toVar())),t}setupPremultipliedAlpha(e,t){return YT(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const s in e){const i=e[s];this[s]===void 0&&(this[s]=i,i&&i.clone&&(this[s]=i.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const s in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,s)===void 0&&t[s].get!==void 0&&Object.defineProperty(this.constructor.prototype,s,t[s])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const s=ji.prototype.toJSON.call(this,e);s.inputNodes={};for(const{property:r,childNode:l}of this._getNodeChildren())s.inputNodes[r]=l.toJSON(e).uuid;function i(r){const l=[];for(const u in r){const h=r[u];delete h.metadata,l.push(h)}return l}if(t){const r=i(e.textures),l=i(e.images),u=i(e.nodes);r.length>0&&(s.textures=r),l.length>0&&(s.images=l),u.length>0&&(s.nodes=u)}return s}copy(e){const t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(const s in t)if(t[s].set!==void 0&&e[s]!==void 0){const i=e[s];this[s]&&this[s].copy!==void 0?this[s].copy(i):this[s]=i}for(const s in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(s)&&this[s]!==void 0&&e[s]!==void 0){const i=e[s];this[s]&&this[s].copy!==void 0?this[s].copy(i):this[s]=i}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(s=>s.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}}const TV=new $R;class vV extends Bt{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(TV),this.setValues(e)}}const SV=new vO;class MV extends Bt{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(SV),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?w(this.offsetNode):dv,t=this.dashScaleNode?w(this.dashScaleNode):uv,s=this.dashSizeNode?w(this.dashSizeNode):cv,i=this.gapSizeNode?w(this.gapSizeNode):hv;yl.assign(s),Nd.assign(i);const r=Mo(qi("lineDistance").mul(t));(e?r.add(e):r).mod(yl.add(Nd)).greaterThan(yl).discard()}}const Am=Cl("vec3","worldStart"),A_=Cl("vec3","worldEnd"),sB=Cl("float","lineDistance"),ol=Cl("vec4","worldPos"),XN=z(({start:o,end:e})=>
vendor: 9,614 bytes, line 85
85{const t=ni.element(2).element(2),s=ni.element(3).element(2);return t.greaterThan(0).select(s.negate().div(t.add(1)),s.mul(-.5).div(t)).sub(o.z).div(e.z.sub(o.z))},{start:"vec4",end:"vec4",return:"float"}),AV=z(({p1:o,p2:e,p3:t,p4:s})=>{const i=o.sub(t),r=s.sub(t),l=e.sub(o),u=i.dot(r),h=r.dot(l),d=i.dot(l),p=r.dot(r),y=l.dot(l).mul(p).sub(h.mul(h)),_=u.mul(h).sub(d.mul(p)).div(y).clamp(),v=u.add(h.mul(_)).div(p).clamp();return de(_,v)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"});z(({material:o})=>{const e=o._useDash,t=o._useWorldUnits,s=qi("instanceStart"),i=qi("instanceEnd"),r=Te(Sr.mul(Te(s,1))).toVar("start"),l=Te(Sr.mul(Te(i,1))).toVar("end");let u,h;e&&(u=w(qi("instanceDistanceStart")).toVar("distanceStart"),h=w(qi("instanceDistanceEnd")).toVar("distanceEnd")),t&&(Am.assign(r.xyz),A_.assign(l.xyz));const d=uc.z.div(uc.w),p=ni.element(2).element(3).equal(-1);if(Ae(p,()=>{Ae(r.z.lessThan(0).and(l.z.greaterThan(0)),()=>{const A=XN({start:r,end:l});l.assign(Te($e(r.xyz,l.xyz,A),l.w)),e&&h.assign($e(u,h,A))}).ElseIf(l.z.lessThan(0).and(r.z.greaterThanEqual(0)),()=>{const A=XN({start:l,end:r});r.assign(Te($e(l.xyz,r.xyz,A),r.w)),e&&u.assign($e(h,u,A))})}),e){const A=o.dashScaleNode?w(o.dashScaleNode):uv,C=o.offsetNode?w(o.offsetNode):dv;let E=Is.y.lessThan(.5).select(A.mul(u),A.mul(h));E=E.add(C),sB.assign(E)}const m=ni.mul(r),y=ni.mul(l),b=m.xyz.div(m.w),_=y.xyz.div(y.w),v=_.xy.sub(b.xy).toVar();v.x.assign(v.x.mul(d)),v.assign(v.normalize());const M=Te().toVar();if(t){const A=l.xyz.sub(r.xyz).normalize(),C=$e(r.xyz,l.xyz,.5).normalize(),E=A.cross(C).normalize(),F=A.cross(E);ol.assign(Is.y.lessThan(.5).select(r,l));const L=vg.mul(.5);ol.addAssign(Te(Is.x.lessThan(0).select(E.mul(L),E.mul(L).negate()),0)),e||(ol.addAssign(Te(Is.y.lessThan(.5).select(A.mul(L).negate(),A.mul(L)),0)),ol.addAssign(Te(F.mul(L),0)),Ae(Is.y.greaterThan(1).or(Is.y.lessThan(0)),()=>{ol.subAssign(Te(F.mul(2).mul(L),0))})),M.assign(ni.mul(ol));const U=O().toVar();U.assign(Is.y.lessThan(.5).select(b,_)),M.z.assign(U.z.mul(M.w))}else{const A=de(v.y,v.x.negate()).toVar("offset");v.x.assign(v.x.div(d)),A.x.assign(A.x.div(d)),A.assign(Is.x.lessThan(0).select(A.negate(),A)),Ae(Is.y.lessThan(0),()=>{A.assign(A.sub(v))}).ElseIf(Is.y.greaterThan(1),()=>{A.assign(A.add(v))}),A.assign(A.mul(vg)),A.assign(A.div(uc.w.div(JT))),M.assign(Is.y.lessThan(.5).select(m,y)),A.assign(A.mul(M.w)),M.assign(M.add(Te(A,0,0)))}return M})();z(({material:o,renderer:e})=>{const t=o._useAlphaToCoverage,s=o._useDash,i=o._useWorldUnits,r=xt();if(s){const u=o.dashSizeNode?w(o.dashSizeNode):cv,h=o.gapSizeNode?w(o.gapSizeNode):hv;yl.assign(u),Nd.assign(h),r.y.lessThan(-1).or(r.y.greaterThan(1)).discard(),sB.mod(yl.add(Nd)).greaterThan(yl).discard()}const l=w(1).toVar("alpha");if(i){const u=ol.xyz.normalize().mul(1e5),h=A_.sub(Am),d=AV({p1:Am,p2:A_,p3:O(0,0,0),p4:u}),p=Am.add(h.mul(d.x)),m=u.mul(d.y),_=p.sub(m).length().div(vg);if(!s)if(t&&e.currentSamples>0){const v=_.fwidth();l.assign(Qi(v.negate().add(.5),v.add(.5),_).oneMinus())}else _.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){const u=r.x,h=r.y.greaterThan(0).select(r.y.sub(1),r.y.add(1)),d=u.mul(u).add(h.mul(h)),p=w(d.fwidth()).toVar("dlen");Ae(r.y.abs().greaterThan(1),()=>{l.assign(Qi(p.oneMinus(),p.add(1),d).oneMinus())})}else Ae(r.y.abs().greaterThan(1),()=>{const u=r.x,h=r.y.greaterThan(0).select(r.y.sub(1),r.y.add(1));u.mul(u).add(h.mul(h)).greaterThan(1).discard()});return l})();const NV=new bO;class wV extends Bt{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(NV),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?w(this.opacityNode):lv;gt.assign(sy(Te(av(st),e),Vi))}}const Tv=z(([o=tv])=>{const e=o.z.atan(o.x).mul(1/(Math.PI*2)).add(.5),t=o.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return de(e,t)}),N_=z(([o=xt()])=>{const e=o.x.sub(.5).mul(Math.PI*2),t=o.y.sub(.5).mul(Math.PI),s=t.cos(),i=s.mul(e.cos()),r=t.sin(),l=s.mul(e.sin());return O(i,r,l)});class iB extends $i{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;const s={width:e,height:e,depth:1},i=[s,s,s,s,s,s];this.texture=new Vg(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){const s=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,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 r=new Gg(5,5,5),l=Tv(tv),u=new Bt;u.colorNode=it(t,l,0),u.side=Ts,u.blending=ua;const h=new Tr(r,u),d=new J_;d.add(h),t.minFilter===ca&&(t.minFilter=Ss);const p=new UO(1,10,this),m=e.getMRT();return e.setMRT(null),p.update(e,d),e.setMRT(m),t.minFilter=s,t.generateMipmaps=i,h.geometry.dispose(),h.material.dispose(),this}clear(e,t=!0,s=!0,i=!0){const r=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,s,i);e.setRenderTarget(r)}}const yd=new WeakMap;class RV extends qt{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=ii(null);const t=new Vg;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=Le.RENDER}updateBefore(e){const{renderer:t,material:s}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){const r=i.isTextureNode?i.value:s[i.property];if(r&&r.isTexture){const l=r.mapping;if(l===H_||l===q_){if(yd.has(r)){const u=yd.get(r);jN(u,r.mapping),this._cubeTexture=u}else{const u=r.image;if(EV(u)){const h=new iB(u.height);h.fromEquirectangularTexture(t,r),jN(h.texture,r.mapping),this._cubeTexture=h.texture,yd.set(r,h.texture),r.addEventListener("dispose",nB)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function EV(o){return o==null?!1:o.height>0}function nB(o){const e=o.target;e.removeEventListener("dispose",nB);const t=yd.get(e);t!==void 0&&(yd.delete(e),t.dispose())}function jN(o,e){e===H_?o.mapping=dc:e===q_&&(o.mapping=Fm)}const rB=Ie(RV).setParameterLength(1);class vv extends Cc{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=rB(this.envNode)}}class CV extends Cc{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=w(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class py{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class aB extends py{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,s=e.reflectedLight,i=e.irradianceLightMap;s.indirectDiffuse.assign(Te(0)),i?s.indirectDiffuse.addAssign(i):s.indirectDiffuse.addAssign(Te(1,1,1,0)),s.indirectDiffuse.mulAssign(t),s.indirectDiffuse.mulAssign(gt.rgb)}finish(e){const{material:t,context:s}=e,i=s.outgoingLight,r=e.context.environment;if(r)switch(t.combine){case Fg:i.rgb.assign($e(i.rgb,i.rgb.mul(r.rgb),gd.mul(Mm)));break;case tL:i.rgb.assign($e(i.rgb,r.rgb,gd.mul(Mm)));break;case sL:i.rgb.addAssign(r.rgb.mul(gd.mul(Mm)));break;default:me("BasicLightingModel: Unsupported .combine value:",t.combine);break}}}const BV=new ao;class w_ extends Bt{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(BV),this.setValues(e)}setupNormal(){return Dl(Tc)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new vv(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new CV(fv)),t}setupOutgoingLight(){return gt.rgb}setupLightingModel(){return new aB}}const vc=z(({f0:o,f90:e,dotVH:t})=>{const s=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return o.mul(s.oneMinus()).add(e.mul(s))}),Ml=z(o=>o.diffuseColor.mul(1/Math.PI)),DV=()=>w(.25),UV=z(({dotNH:o})=>xg.mul(w(.5)).add(1).mul(w(1/Math.PI)).mul(o.pow(xg))),FV=z(({lightDirection:o})=>{const e=o.add(vt).normalize(),t=st.dot(e).clamp(),s=vt.dot(e).clamp(),i=vc({f0:To,f90:1,dotVH:s}),r=DV(),l=UV({dotNH:t});return i.mul(r).mul(l)});class oB extends aB{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:s}){const r=st.dot(e).clamp().mul(t);s.directDiffuse.addAssign(r.mul(Ml({diffuseColor:gt.rgb}))),this.specular===!0&&s.directSpecular.addAssign(r.mul(FV({lightDirection:e})).mul(gd))}indirect(e){const{ambientOcclusion:t,irradiance:s,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(s.mul(Ml({diffuseColor:gt}))),i.indirectDiffuse.mulAssign(t)}}const LV=new _O;class OV extends Bt{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(LV),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new vv(t):null}setupLightingModel(){return new oB(!1)}}const zV=new yO;class PV extends Bt{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(zV),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new vv(t):null}setupLightingModel(){return new oB}setupVariants(){const e=(this.shininessNode?w(this.shininessNode):p2).max(1e-4);xg.assign(e);const t=this.specularNode||g2;To.assign(t)}}const lB=z(o=>{if(o.geometry.hasAttribute("normal")===!1)return w(0);
vendor: 3,435 bytes, line 85
85const e=Tc.dFdx().abs().max(Tc.dFdy().abs());return e.x.max(e.y).max(e.z)}),Sv=z(o=>{const{roughness:e}=o,t=lB();let s=e.max(.0525);return s=s.add(t),s=s.min(1),s}),uB=z(({alpha:o,dotNL:e,dotNV:t})=>{const s=o.pow2(),i=e.mul(s.add(s.oneMinus().mul(t.pow2())).sqrt()),r=t.mul(s.add(s.oneMinus().mul(e.pow2())).sqrt());return Zi(.5,i.add(r).max(Kg))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),VV=z(({alphaT:o,alphaB:e,dotTV:t,dotBV:s,dotTL:i,dotBL:r,dotNV:l,dotNL:u})=>{const h=u.mul(O(o.mul(t),e.mul(s),l).length()),d=l.mul(O(o.mul(i),e.mul(r),u).length());return Zi(.5,h.add(d).max(Kg))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),cB=z(({alpha:o,dotNH:e})=>{const t=o.pow2(),s=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(s.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),GV=w(1/Math.PI),IV=z(({alphaT:o,alphaB:e,dotNH:t,dotTH:s,dotBH:i})=>{const r=o.mul(e),l=O(e.mul(s),o.mul(i),r.mul(t)),u=l.dot(l),h=r.div(u);return GV.mul(r.mul(h.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),Mv=z(({lightDirection:o,f0:e,f90:t,roughness:s,f:i,normalView:r=st,USE_IRIDESCENCE:l,USE_ANISOTROPY:u})=>{const h=s.pow2(),d=o.add(vt).normalize(),p=r.dot(o).clamp(),m=r.dot(vt).clamp(),y=r.dot(d).clamp(),b=vt.dot(d).clamp();let _=vc({f0:e,f90:t,dotVH:b}),v,M;if(bc(l)&&(_=Yg.mix(_,i)),bc(u)){const A=pd.dot(o),C=pd.dot(vt),E=pd.dot(d),F=gl.dot(o),L=gl.dot(vt),U=gl.dot(d);v=VV({alphaT:yg,alphaB:h,dotTV:C,dotBV:L,dotTL:A,dotBL:F,dotNV:m,dotNL:p}),M=IV({alphaT:yg,alphaB:h,dotNH:y,dotTH:E,dotBH:U})}else v=uB({alpha:h,dotNL:p,dotNV:m}),M=cB({alpha:h,dotNH:y});return _.mul(v).mul(M)}),kV=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
vendor: 3,202 bytes, line 85
8514942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let sr=null;const wd=z(({roughness:o,dotNV:e})=>{sr===null&&(sr=new qR(kV,16,16,xn,Jt),sr.name="DFG_LUT",sr.minFilter=Ss,sr.magFilter=Ss,sr.wrapS=cr,sr.wrapT=cr,sr.generateMipmaps=!1,sr.needsUpdate=!0);const t=de(o,e);return it(sr,t).rg}),HV=z(({lightDirection:o,f0:e,f90:t,roughness:s,f:i,USE_IRIDESCENCE:r,USE_ANISOTROPY:l})=>{const u=Mv({lightDirection:o,f0:e,f90:t,roughness:s,f:i,USE_IRIDESCENCE:r,USE_ANISOTROPY:l}),h=st.dot(o).clamp(),d=st.dot(vt).clamp(),p=wd({roughness:s,dotNV:d}),m=wd({roughness:s,dotNV:h}),y=e.mul(p.x).add(t.mul(p.y)),b=e.mul(m.x).add(t.mul(m.y)),_=p.x.add(p.y),v=m.x.add(m.y),M=w(1).sub(_),A=w(1).sub(v),C=e.add(e.oneMinus().mul(.047619)),E=y.mul(b).mul(C).div(w(1).sub(M.mul(A).mul(C).mul(C)).add(Kg)),F=M.mul(A),L=E.mul(F);return u.add(L)}),hB=z(o=>{const{dotNV:e,specularColor:t,specularF90:s,roughness:i}=o,r=wd({dotNV:e,roughness:i});return t.mul(r.x).add(s.mul(r.y))}),R_=z(({f:o,f90:e,dotVH:t})=>{const s=t.oneMinus().saturate(),i=s.mul(s),r=s.mul(i,i).clamp(0,.9999);return o.sub(O(e).mul(r)).div(r.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),qV=z(({roughness:o,dotNH:e})=>{const t=o.pow2(),s=w(1).div(t),r=e.pow2().oneMinus().max(.0078125);return w(2).add(s).mul(r.pow(s.mul(.5))).div(2*Math.PI)}
vendor: 4,227 bytes, line 85
85).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),$V=z(({dotNV:o,dotNL:e})=>w(1).div(w(4).mul(e.add(o).sub(e.mul(o))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),WV=z(({lightDirection:o})=>{const e=o.add(vt).normalize(),t=st.dot(o).clamp(),s=st.dot(vt).clamp(),i=st.dot(e).clamp(),r=qV({roughness:oo,dotNH:i}),l=$V({dotNV:s,dotNL:t});return Pi.mul(r).mul(l)}),YN=z(({N:o,V:e,roughness:t})=>{const r=.0078125,l=o.dot(e).saturate(),u=de(t,l.oneMinus().sqrt());return u.assign(u.mul(.984375).add(r)),u}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),XV=z(({f:o})=>{const e=o.length();return Ht(e.mul(e).add(o.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),Gp=z(({v1:o,v2:e})=>{const t=o.dot(e),s=t.abs().toVar(),i=s.mul(.0145206).add(.4965155).mul(s).add(.8543985).toVar(),r=s.add(4.1616724).mul(s).add(3.417594).toVar(),l=i.div(r),u=t.greaterThan(0).select(l,Ht(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(l));return o.cross(e).mul(u)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),Mb=z(({N:o,V:e,P:t,mInv:s,p0:i,p1:r,p2:l,p3:u})=>{const h=r.sub(i).toVar(),d=u.sub(i).toVar(),p=h.cross(d),m=O().toVar();return Ae(p.dot(t.sub(i)).greaterThanEqual(0),()=>{const y=e.sub(o.mul(e.dot(o))).normalize(),b=o.cross(y).negate(),_=s.mul(vs(y,b,o).transpose()).toVar(),v=_.mul(i.sub(t)).normalize().toVar(),M=_.mul(r.sub(t)).normalize().toVar(),A=_.mul(l.sub(t)).normalize().toVar(),C=_.mul(u.sub(t)).normalize().toVar(),E=O(0).toVar();E.addAssign(Gp({v1:v,v2:M})),E.addAssign(Gp({v1:M,v2:A})),E.addAssign(Gp({v1:A,v2:C})),E.addAssign(Gp({v1:C,v2:v})),m.assign(O(XV({f:E})))}),m}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),my=1/6,dB=o=>ze(my,ze(o,ze(o,o.negate().add(3)).sub(3)).add(1)),E_=o=>ze(my,ze(o,ze(o,ze(3,o).sub(6))).add(4)),fB=o=>ze(my,ze(o,ze(o,ze(-3,o).add(3)).add(3)).add(1)),C_=o=>ze(my,bn(o,3)),ZN=o=>dB(o).add(E_(o)),QN=o=>fB(o).add(C_(o)),KN=o=>ss(-1,E_(o).div(dB(o).add(E_(o)))),JN=o=>ss(1,C_(o).div(fB(o).add(C_(o)))),ew=(o,e,t)=>{const s=o.uvNode,i=ze(s,e.zw).add(.5),r=mr(i),l=Hn(i),u=ZN(l.x),h=QN(l.x),d=KN(l.x),p=JN(l.x),m=KN(l.y),y=JN(l.y),b=de(r.x.add(d),r.y.add(m)).sub(.5).mul(e.xy),_=de(r.x.add(p),r.y.add(m)).sub(.5).mul(e.xy),v=de(r.x.add(d),r.y.add(y)).sub(.5).mul(e.xy),M=de(r.x.add(p),r.y.add(y)).sub(.5).mul(e.xy),A=ZN(l.y).mul(ss(u.mul(o.sample(b).level(t)),h.mul(o.sample(_).level(t)))),C=QN(l.y).mul(ss(u.mul(o.sample(v).level(t)),h.mul(o.sample(M).level(t))));return A.add(C)},Av=z(([o,e])=>{const t=de(o.size(D(e))),s=de(o.size(D(e.add(1)))),i=Zi(1,t),r=Zi(1,s),l=ew(o,Te(i,t),mr(e)),u=ew(o,Te(r,s),ey(e));return Hn(e).mix(l,u)}),jV=z(([o,e])=>{const t=e.mul(ZT(o));return Av(o,t)}),tw=z(([o,e,t,s,i])=>{const r=O(PT(e.negate(),$s(o),Zi(1,s))),l=O(gr(i[0].xyz),gr(i[1].xyz),gr(i[2].xyz));return $s(r).mul(t.mul(l))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),YV=z(([o,e])=>o.mul(qn(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),ZV=yv(),QV=Q2(),sw=z(([o,e,t],{material:s})=>{const r=(s.side===Ts?ZV:QV).sample(o),l=pr(vl.x).mul(YV(e,t));return Av(r,l)}),iw=z(([o,e,t])=>(Ae(t.notEqual(0),()=>{const s=Jg(e).negate().div(t);return AT(s.negate().mul(o))}),O(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),KV=z(([o,e,t,s,i,r,l,u,h,d,p,m,y,b,_])=>{let v,M;if(_){v=Te().toVar(),M=O().toVar();const L=p.sub(1).mul(_.mul(.025)),U=O(p.sub(L),p,p.add(L));
vendor: 9,944 bytes, line 85
85yt({start:0,end:3},({i:R})=>{const V=U.element(R),$=tw(o,e,m,V,u),ie=l.add($),le=d.mul(h.mul(Te(ie,1))),ye=de(le.xy.div(le.w)).toVar();ye.addAssign(1),ye.divAssign(2),ye.assign(de(ye.x,ye.y.oneMinus()));const xe=sw(ye,t,V);v.element(R).assign(xe.element(R)),v.a.addAssign(xe.a),M.element(R).assign(s.element(R).mul(iw(gr($),y,b).element(R)))}),v.a.divAssign(3)}else{const L=tw(o,e,m,p,u),U=l.add(L),R=d.mul(h.mul(Te(U,1))),V=de(R.xy.div(R.w)).toVar();V.addAssign(1),V.divAssign(2),V.assign(de(V.x,V.y.oneMinus())),v=sw(V,t,p),M=s.mul(iw(gr(L),y,b))}const A=M.rgb.mul(v.rgb),C=o.dot(e).clamp(),E=O(hB({dotNV:C,specularColor:i,specularF90:r,roughness:t})),F=M.r.add(M.g,M.b).div(3);return Te(E.oneMinus().mul(A),v.a.oneMinus().mul(F).oneMinus())}),JV=vs(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),e4=o=>{const e=o.sqrt();return O(1).add(e).div(O(1).sub(e))},nw=(o,e)=>o.sub(e).div(o.add(e)).pow2(),t4=(o,e)=>{const t=o.mul(2*Math.PI*1e-9),s=O(54856e-17,44201e-17,52481e-17),i=O(1681e3,1795300,2208400),r=O(43278e5,93046e5,66121e5),l=w(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let u=s.mul(r.mul(2*Math.PI).sqrt()).mul(i.mul(t).add(e).cos()).mul(t.pow2().negate().mul(r).exp());return u=O(u.x.add(l),u.y,u.z).div(10685e-11),JV.mul(u)},rw=z(({outsideIOR:o,eta2:e,cosTheta1:t,thinFilmThickness:s,baseF0:i})=>{const r=$e(o,e,Qi(0,.03,s)),u=o.div(r).pow2().mul(t.pow2().oneMinus()).oneMinus();Ae(u.lessThan(0),()=>O(1));const h=u.sqrt(),d=nw(r,o),p=vc({f0:d,f90:1,dotVH:t}),m=p.oneMinus(),y=r.lessThan(o).select(Math.PI,0),b=w(Math.PI).sub(y),_=e4(i.clamp(0,.9999)),v=nw(_,r.toVec3()),M=vc({f0:v,f90:1,dotVH:h}),A=O(_.x.lessThan(r).select(Math.PI,0),_.y.lessThan(r).select(Math.PI,0),_.z.lessThan(r).select(Math.PI,0)),C=r.mul(s,h,2),E=O(b).add(A),F=p.mul(M).clamp(1e-5,.9999),L=F.sqrt(),U=m.pow2().mul(M).div(O(1).sub(F)),V=p.add(U).toVar(),$=U.sub(m).toVar();return yt({start:1,end:2,condition:"<=",name:"m"},({m:ie})=>{$.mulAssign(L);const le=t4(w(ie).mul(C),w(ie).mul(E)).mul(2);V.addAssign($.mul(le))}),V.max(O(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Ph=z(({normal:o,viewDir:e,roughness:t})=>{const s=o.dot(e).saturate(),i=t.mul(t),r=t.add(.1).reciprocal(),l=w(-1.9362).add(t.mul(1.0678)).add(i.mul(.4573)).sub(r.mul(.8469)),u=w(-.6014).add(t.mul(.5538)).sub(i.mul(.467)).sub(r.mul(.1255));return l.mul(s).add(u).exp().saturate()}),Vh=O(.04),Ip=w(1);class pB extends py{constructor(e=!1,t=!1,s=!1,i=!1,r=!1,l=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=s,this.anisotropy=i,this.transmission=r,this.dispersion=l,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=O().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=O().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=O().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=O().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=O().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=st.dot(vt).clamp(),s=rw({outsideIOR:w(1),eta2:mg,cosTheta1:t,thinFilmThickness:gg,baseF0:To}),i=rw({outsideIOR:w(1),eta2:mg,cosTheta1:t,thinFilmThickness:gg,baseF0:gt.rgb});this.iridescenceFresnel=$e(s,i,oa),this.iridescenceF0Dielectric=R_({f:s,f90:1,dotVH:t}),this.iridescenceF0Metallic=R_({f:i,f90:1,dotVH:t}),this.iridescenceF0=$e(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,oa)}if(this.transmission===!0){const t=yr,s=GC.sub(yr).normalize(),i=wo,r=e.context;r.backdrop=KV(i,s,lr,ll,cl,hl,t,_n,No,ni,md,_T,vT,TT,this.dispersion?ST:null),r.backdropAlpha=bg,gt.a.mulAssign($e(1,r.backdrop.a,bg))}super.start(e)}computeMultiscattering(e,t,s,i,r=null){const l=st.dot(vt).clamp(),u=wd({roughness:lr,dotNV:l}),h=r?Yg.mix(i,r):i,d=h.mul(u.x).add(s.mul(u.y)),m=u.x.add(u.y).oneMinus(),y=h.add(h.oneMinus().mul(.047619)),b=d.mul(y).div(m.mul(y).oneMinus());e.addAssign(d),t.addAssign(b.mul(m))}direct({lightDirection:e,lightColor:t,reflectedLight:s}){const r=st.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(r.mul(WV({lightDirection:e})));const l=Ph({normal:st,viewDir:vt,roughness:oo}),u=Ph({normal:st,viewDir:e,roughness:oo}),h=Pi.r.max(Pi.g).max(Pi.b).mul(l.max(u)).oneMinus();r.mulAssign(h)}if(this.clearcoat===!0){const u=co.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(u.mul(Mv({lightDirection:e,f0:Vh,f90:Ip,roughness:ac,normalView:co})))}s.directDiffuse.addAssign(r.mul(Ml({diffuseColor:ll}))),s.directSpecular.addAssign(r.mul(HV({lightDirection:e,f0:cl,f90:1,roughness:lr,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:s,halfHeight:i,reflectedLight:r,ltc_1:l,ltc_2:u}){const h=t.add(s).sub(i),d=t.sub(s).sub(i),p=t.sub(s).add(i),m=t.add(s).add(i),y=st,b=vt,_=Zt.toVar(),v=YN({N:y,V:b,roughness:lr}),M=l.sample(v).toVar(),A=u.sample(v).toVar(),C=vs(O(M.x,0,M.y),O(0,1,0),O(M.z,0,M.w)).toVar(),E=cl.mul(A.x).add(hl.sub(cl).mul(A.y)).toVar();if(r.directSpecular.addAssign(e.mul(E).mul(Mb({N:y,V:b,P:_,mInv:C,p0:h,p1:d,p2:p,p3:m}))),r.directDiffuse.addAssign(e.mul(ll).mul(Mb({N:y,V:b,P:_,mInv:vs(1,0,0,0,1,0,0,0,1),p0:h,p1:d,p2:p,p3:m}))),this.clearcoat===!0){const F=co,L=YN({N:F,V:b,roughness:ac}),U=l.sample(L),R=u.sample(L),V=vs(O(U.x,0,U.y),O(0,1,0),O(U.z,0,U.w)),$=Vh.mul(R.x).add(Ip.sub(Vh).mul(R.y));this.clearcoatSpecularDirect.addAssign(e.mul($).mul(Mb({N:F,V:b,P:_,mInv:V,p0:h,p1:d,p2:p,p3:m})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:s}=e.context,i=t.mul(Ml({diffuseColor:ll})).toVar();if(this.sheen===!0){const r=Ph({normal:st,viewDir:vt,roughness:oo}),l=Pi.r.max(Pi.g).max(Pi.b).mul(r).oneMinus();i.mulAssign(l)}s.indirectDiffuse.addAssign(i)}indirectSpecular(e){const{radiance:t,iblIrradiance:s,reflectedLight:i}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(s.mul(Pi,Ph({normal:st,viewDir:vt,roughness:oo}))),this.clearcoat===!0){const M=co.dot(vt).clamp(),A=hB({dotNV:M,specularColor:Vh,specularF90:Ip,roughness:ac});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(A))}const r=O().toVar("singleScatteringDielectric"),l=O().toVar("multiScatteringDielectric"),u=O().toVar("singleScatteringMetallic"),h=O().toVar("multiScatteringMetallic");this.computeMultiscattering(r,l,hl,To,this.iridescenceF0Dielectric),this.computeMultiscattering(u,h,hl,gt.rgb,this.iridescenceF0Metallic);const d=$e(r,u,oa),p=$e(l,h,oa),m=r.add(l),y=ll.mul(m.oneMinus()),b=s.mul(1/Math.PI),_=t.mul(d).add(p.mul(b)).toVar(),v=y.mul(b).toVar();if(this.sheen===!0){const M=Ph({normal:st,viewDir:vt,roughness:oo}),A=Pi.r.max(Pi.g).max(Pi.b).mul(M).oneMinus();_.mulAssign(A),v.mulAssign(A)}i.indirectSpecular.addAssign(_),i.indirectDiffuse.addAssign(v)}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:s}=e.context,r=st.dot(vt).clamp().add(t),l=lr.mul(-16).oneMinus().negate().exp2(),u=t.sub(r.pow(l).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),s.indirectDiffuse.mulAssign(t),s.indirectSpecular.mulAssign(u)}finish({context:e}){const{outgoingLight:t}=e;if(this.clearcoat===!0){const s=co.dot(vt).clamp(),i=vc({dotVH:s,f0:Vh,f90:Ip}),r=t.mul(pg.mul(i).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(pg));t.assign(r)}if(this.sheen===!0){const s=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(s)}}}const aw=w(1),B_=w(-2),kp=w(.8),Ab=w(-1),Hp=w(.4),Nb=w(2),qp=w(.305),wb=w(3),ow=w(.21),s4=w(4),lw=w(4),i4=w(16),n4=z(([o])=>{const e=O(wt(o)).toVar(),t=w(-1).toVar();return Ae(e.x.greaterThan(e.z),()=>{Ae(e.x.greaterThan(e.y),()=>{t.assign(Hs(o.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Hs(o.y.greaterThan(0),1,4))})}).Else(()=>{Ae(e.z.greaterThan(e.y),()=>{t.assign(Hs(o.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Hs(o.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),r4=z(([o,e])=>{const t=de().toVar();return Ae(e.equal(0),()=>{t.assign(de(o.z,o.y).div(wt(o.x)))}).ElseIf(e.equal(1),()=>{t.assign(de(o.x.negate(),o.z.negate()).div(wt(o.y)))}).ElseIf(e.equal(2),()=>{t.assign(de(o.x.negate(),o.y).div(wt(o.z)))}).ElseIf(e.equal(3),()=>{t.assign(de(o.z.negate(),o.y).div(wt(o.x)))}).ElseIf(e.equal(4),()=>{t.assign(de(o.x.negate(),o.z).div(wt(o.y)))}).Else(()=>{t.assign(de(o.x,o.y).div(wt(o.z)))}),ze(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),a4=z(([o])=>{const e=w(0).toVar();return Ae(o.greaterThanEqual(kp),()=>{e.assign(aw.sub(o).mul(Ab.sub(B_)).div(aw.sub(kp)).add(B_))}).ElseIf(o.greaterThanEqual(Hp),()=>{e.assign(kp.sub(o).mul(Nb.sub(Ab)).div(kp.sub(Hp)).add(Ab))}).ElseIf(o.greaterThanEqual(qp),()=>{e.assign(Hp.sub(o).mul(wb.sub(Nb)).div(Hp.sub(qp)).add(Nb))}).ElseIf(o.greaterThanEqual(ow),()=>{e.assign(qp.sub(o).mul(s4.sub(wb)).div(qp.sub(ow)).add(wb))}).Else(()=>{e.assign(w(-2).mul(pr(ze(1.16,o))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),mB=z(([o,e])=>{const t=o.toVar();t.assign(ze(2,t).sub(1));const s=O(t,1).toVar();return Ae(e.equal(0),()=>{s.assign(s.zyx)}).ElseIf(e.equal(1),()=>{s.assign(s.xzy),s.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{s.x.mulAssign(-1)}
vendor: 7,003 bytes, line 85
85).ElseIf(e.equal(3),()=>{s.assign(s.zyx),s.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{s.assign(s.xzy),s.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{s.z.mulAssign(-1)}),s}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),gB=z(([o,e,t,s,i,r])=>{const l=w(t),u=O(e),h=qn(a4(l),B_,r),d=Hn(h),p=mr(h),m=O(Rd(o,u,p,s,i,r)).toVar();return Ae(d.notEqual(0),()=>{const y=O(Rd(o,u,p.add(1),s,i,r)).toVar();m.assign($e(m,y,d))}),m}),Rd=z(([o,e,t,s,i,r])=>{const l=w(t).toVar(),u=O(e),h=w(n4(u)).toVar(),d=w(Ht(lw.sub(l),0)).toVar();l.assign(Ht(l,lw));const p=w(_c(l)).toVar(),m=de(r4(u,h).mul(p.sub(2)).add(1)).toVar();return Ae(h.greaterThan(2),()=>{m.y.addAssign(p),h.subAssign(3)}),m.x.addAssign(h.mul(p)),m.x.addAssign(d.mul(ze(3,i4))),m.y.addAssign(ze(4,_c(r).sub(p))),m.x.mulAssign(s),m.y.mulAssign(i),o.sample(m).grad(de(),de())}),Rb=z(({envMap:o,mipInt:e,outputDirection:t,theta:s,axis:i,CUBEUV_TEXEL_WIDTH:r,CUBEUV_TEXEL_HEIGHT:l,CUBEUV_MAX_MIP:u})=>{const h=Pn(s),d=t.mul(h).add(i.cross(t).mul(ti(s))).add(i.mul(i.dot(t).mul(h.oneMinus())));return Rd(o,d,e,r,l,u)}),yB=z(({n:o,latitudinal:e,poleAxis:t,outputDirection:s,weights:i,samples:r,dTheta:l,mipInt:u,envMap:h,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:m})=>{const y=O(Hs(e,t,ga(t,s))).toVar();Ae(y.equal(O(0)),()=>{y.assign(O(s.z,0,s.x.negate()))}),y.assign($s(y));const b=O().toVar();return b.addAssign(i.element(0).mul(Rb({theta:0,axis:y,outputDirection:s,mipInt:u,envMap:h,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:m}))),yt({start:D(1),end:o},({i:_})=>{Ae(_.greaterThanEqual(r),()=>{j2()});const v=w(l.mul(w(_))).toVar();b.addAssign(i.element(_).mul(Rb({theta:v.mul(-1),axis:y,outputDirection:s,mipInt:u,envMap:h,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:m}))),b.addAssign(i.element(_).mul(Rb({theta:v,axis:y,outputDirection:s,mipInt:u,envMap:h,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:m})))}),Te(b,1)}),o4=z(([o])=>{const e=ae(o).toVar();return e.assign(e.shiftLeft(ae(16)).bitOr(e.shiftRight(ae(16)))),e.assign(e.bitAnd(ae(1431655765)).shiftLeft(ae(1)).bitOr(e.bitAnd(ae(2863311530)).shiftRight(ae(1)))),e.assign(e.bitAnd(ae(858993459)).shiftLeft(ae(2)).bitOr(e.bitAnd(ae(3435973836)).shiftRight(ae(2)))),e.assign(e.bitAnd(ae(252645135)).shiftLeft(ae(4)).bitOr(e.bitAnd(ae(4042322160)).shiftRight(ae(4)))),e.assign(e.bitAnd(ae(16711935)).shiftLeft(ae(8)).bitOr(e.bitAnd(ae(4278255360)).shiftRight(ae(8)))),w(e).mul(23283064365386963e-26)}),l4=z(([o,e])=>de(w(o).div(w(e)),o4(o))),u4=z(([o,e,t])=>{const s=t.mul(t).toConst(),i=O(1,0,0).toConst(),r=ga(e,i).toConst(),l=ai(o.x).toConst(),u=ze(2,3.14159265359).mul(o.y).toConst(),h=l.mul(Pn(u)).toConst(),d=l.mul(ti(u)).toVar(),p=ze(.5,e.z.add(1)).toConst();d.assign(p.oneMinus().mul(ai(h.mul(h).oneMinus())).add(p.mul(d)));const m=i.mul(h).add(r.mul(d)).add(e.mul(ai(Ht(0,h.mul(h).add(d.mul(d)).oneMinus()))));return $s(O(s.mul(m.x),s.mul(m.y),Ht(0,m.z)))}),xB=z(({roughness:o,mipInt:e,envMap:t,N_immutable:s,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:r,CUBEUV_TEXEL_HEIGHT:l,CUBEUV_MAX_MIP:u})=>{const h=O(s).toVar(),d=O(0).toVar(),p=w(0).toVar();return Ae(o.lessThan(.001),()=>{d.assign(Rd(t,h,e,r,l,u))}).Else(()=>{const m=Hs(wt(h.z).lessThan(.999),O(0,0,1),O(1,0,0)),y=$s(ga(m,h)).toVar(),b=ga(h,y).toVar();yt({start:ae(0),end:i},({i:_})=>{const v=l4(_,i),M=u4(v,O(0,0,1),o),A=$s(y.mul(M.x).add(b.mul(M.y)).add(h.mul(M.z))),C=$s(A.mul(Nn(h,A).mul(2)).sub(h)),E=Ht(Nn(h,C),0);Ae(E.greaterThan(0),()=>{const F=Rd(t,C,e,r,l,u);d.addAssign(F.mul(E)),p.addAssign(E)})}),Ae(p.greaterThan(0),()=>{d.assign(d.div(p))})}),Te(d,1)}),go=4,uw=[.125,.215,.35,.446,.526,.582],ul=20,c4=512,Gh=new aT(-1,1,1,-1,0,1),h4=new yi(90,1),cw=new Xe;let Eb=null,Cb=0,Bb=0;const d4=new H,Ng=new WeakMap,f4=[3,1,5,0,4,2],Db=mB(xt(),qi("faceIndex")).normalize(),gy=O(Db.x,Db.y,Db.z);class p4{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,s=.1,i=100,r={}){const{size:l=256,position:u=d4,renderTarget:h=null}=r;if(this._setSize(l),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');Eb=this._renderer.getRenderTarget(),Cb=this._renderer.getActiveCubeFace(),Bb=this._renderer.getActiveMipmapLevel();const d=h||this._allocateTarget(!0);return this._init(d),this._sceneToCubeUV(e,s,i,d,u),t>0&&this._blur(d,0,0,t),this._applyPMREM(d),this._cleanup(d),d}async fromSceneAsync(e,t=0,s=.1,i=100,r={}){return Ye('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,s,i,r)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return Ye('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return Ye('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dw(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fw(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===dc||e.mapping===Fm?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Eb,Cb,Bb),e.scissorTest=!1,this._setVie
85wport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),Eb=this._renderer.getRenderTarget(),Cb=this._renderer.getActiveCubeFace(),Bb=this._renderer.getActiveMipmapLevel();const s=t||this._allocateTarget(!1);return this._init(s),this._textureToCubeUV(e,s),this._applyPMREM(s),this._cleanup(s),s}_allocateTarget(e){const t=3*Math.max(this._cubeSize,112),s=4*this._cubeSize;return hw(t,s,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=hw(e.width,e.height);const{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=m4(t)),this._blurMaterial=g4(t,e.width,e.height),this._ggxMaterial=y4(t,e.width,e.height)}}async _compileMaterial(e){const t=new Tr(new Mr,e);await this._renderer.compile(t,Gh)}_sceneToCubeUV(e,t,s,i,r){const l=h4;l.near=t,l.far=s;const u=[1,1,1,1,-1,1],h=[1,-1,1,-1,1,-1],d=this._renderer,p=d.autoClear;d.getClearColor(cw),d.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Tr(new Gg,new ao({name:"PMREM.Backgroun
85d",side:Ts,depthWrite:!1,depthTest:!1})));const m=this._backgroundBox,y=m.material;let b=!1;const _=e.background;_?_.isColor&&(y.color.copy(_),e.background=null,b=!0):(y.color.copy(cw),b=!0),d.setRenderTarget(i),d.clear(),b&&d.render(m,l);for(let v=0;v<6;v++){const M=v%3;M===0?(l.up.set(0,u[v],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+h[v],r.y,r.z)):M===1?(l.up.set(0,0,u[v]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+h[v],r.z)):(l.up.set(0,u[v],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+h[v]));const A=this._cubeSize;this._setViewport(i,M*A,v>2?A:0,A,A),d.render(e,l)}d.autoClear=p,e.background=_}_textureToCubeUV(e,t){const s=this._renderer,i=e.mapping===dc||e.mapping===Fm;i?this._cubemapMaterial===null&&(this._cubemapMaterial=dw(e)):this._equirectMaterial===null&&(this._equirectMaterial=fw(e));const r=i?this._cubemapMaterial:this._equirectMaterial;r.fragmentNode.value=e;const l=this._lodMeshes[0];l.material=r;const u=this._cubeSize;this._setViewport(t,0,0,3*u,2*u),s.setRenderTarget(t),s.render(l,Gh)}_applyPMREM(e){const t=this._renderer,s=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=s}_applyGGXFilter(e,t,s){const i=this._renderer,r=this._pingPongRenderTarget,l=this._ggxMaterial,u=this._lodMeshes[s];u.material=l;const h=Ng.get(l),d=s/(this._lodMeshes.length-1),p=t/(this._lodMeshes.length-1),m=Math.sqrt(d*d-p*p),y=0+d*1.25,b=m*y,{_lodMax:_}=this,v=this._sizeLods[s],M=3*v*(s>_-go?s-_+go:0),A=4*(this._cubeSize-v);e.texture.frame=(e.texture.frame||0)+1,h.envMap.value=e.texture,h.roughness.value=b,h.mipInt.value=_-t,this._setViewport(r,M,A,3*v,2*v),i.setRenderTarget(r),i.render(u,Gh),r.texture.frame=(r.texture.frame||0)+1,h.envMap.value=r.texture,h.roughness.value=0,h.mipInt.value=_-s,this._setViewport(e,M,A,3*v,2*v),i.setRenderTarget(e),i.render(u,Gh)}_blur(e,t,s,i,r){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,s,i,"latitudinal",r),this._halfBlur(l,e,s,s,i,"longitudinal",r)}_halfBlur(e,t,s,i,r,l,u){const h=this._renderer,d=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&he("blur direction must be either latitudinal or longitudinal!");const p=3,m=this._lodMeshes[i];m.material=d;const y=Ng.get(d),b=this._sizeLods[s]-1,_=isFinite(r)?Math.PI/(2*b):2*Math.PI/(2*ul-1),v=r/_,M=isFinite(r)?1+Math.floor(p*v):ul;M>ul&&me(`sigmaRadians, ${r}, is too large and will clip, as it requested ${M} samples when the maximum is set to ${ul}`);const A=[];let C=0;for(let R=0;R<ul;++R){const V=R/v,$=Math.exp(-V*V/2);A.push($),R===0?C+=$:R<M&&(C+=2*$)}for(let R=0;R<A.length;R++)A[R]=A[R]/C;e.texture.frame=(e.texture.frame||0)+1,y.envMap.value=e.texture,y.samples.value=M,y.weights.array=A,y.latitudinal.value=l==="latitudinal"?1:0,u&&(y.poleAxis.value=u);const{_lodMax:E}=this;y.dTheta.value=_,y.mipInt.value=E-s;const F=this._sizeLods[i],L=3*F*(i>E-go?i-E+go:0),U=4*(this._cubeSize-F);this._setViewport(t,L,U,3*F,2*F),h.setRenderTarget(t),h.render(m,Gh)}_setViewport(e,t,s,i,r){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-r-s,i,r),e.scissor.set(t,e.height-r-s,i,r)):(e.viewport.set(t,s,i,r),e.scissor.set(t,s,i,r))}}function m4(o){const e=[],t=[],s=[];let i=o;const r=o-go+1+uw.length;for(let l=0;l<r;l++){const u=Math.pow(2,i);e.push(u);let h=1/u;l>o-go?h=uw[l-o+go-1]:l===0&&(h=0),t.push(h);const d=1/(u-2),p=-d,m=1+d,y=[p,p,m,p,m,m,p,p,m,m,p,m],b=6,_=6,v=3,M=2,A=1,C=new Float32Array(v*_*b),E=new Float32Array(M*_*b),F=new Float32Array(A*_*b);for(let U=0;U<b;U++){const R=U%3*2/3-1,V=U>2?0:-1,$=[R,V,0,R+2/3,V,0,R+2/3,V+1,0,R,V,0,R+2/3,V+1,0,R,V+1,0],ie=f4[U];C.set($,v*_*ie),E.set(y,M*_*ie);const le=[ie,ie,ie,ie,ie,ie];F.set(le,A*_*ie)}const L=new Mr;L.setAttribute("position",new Wi(C,v)),L.setAttribute("uv",new Wi(E,M)),L.setAttribute("faceIndex",new Wi(F,A)),s.push(new Tr(L,null)),i>go&&i--}return{lodMeshes:s,sizeLods:e,sigmas:t}}function hw(o,e,t){const s={magFilter:Ss,minFilter:Ss,generateMipmaps:!1,type:Jt,format:ki,colorSpace:lg,depthBuffer:t},i=new $i(o,e,s);return i.texture.mapping=Lm,i.texture.name="PMREM.cubeUv",i.texture.isPMREMTexture=!0,i.scissorTest=!0,i}function yy(o){const e=new Bt;return e.depthTest=!1,e.depthWrite=!1,e.blending=ua,e.name=`PMREM_${o}`,e}function g4(o,e,t){const s=Bs(new Array(ul).fill(0)),i=Se(new H(0,1,0)),r=Se(0),l=w(ul),u=Se(0),h=Se(1),d=it(),p=Se(0),m=w(1/e),y=w(1/t),b=w(o),_={n:l,latitudinal:u,weights:s,poleAxis:i,outputDirection:gy,dTheta:r,samples:h,envMap:d,mipInt:p,CUBEUV_TEXEL_WIDTH:m,CUBEUV_TEXEL_HEIGHT:y,CUBEUV_MAX_MIP:b},v=yy("blur");return v.fragmentNode=yB({..._,latitudinal:u.equal(1)}),Ng.set(v,_),v}
85function y4(o,e,t){const s=it(),i=Se(0),r=Se(0),l=w(1/e),u=w(1/t),h=w(o),d={envMap:s,roughness:i,mipInt:r,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h},p=yy("ggx");return p.fragmentNode=xB({...d,N_immutable:gy,GGX_SAMPLES:ae(c4)}),Ng.set(p,d),p}function dw(o){const e=yy("cubemap");return e.fragmentNode=ii(o,gy),e}function fw(o){const e=yy("equirect");return e.fragmentNode=it(o,Tv(gy),0),e}const pw=new WeakMap;function x4(o){const e=Math.log2(o)-2,t=1/o;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function b4(o,e,t){const s=_4(e);let i=s.get(o);if((i!==void 0?i.pmremVersion:-1)!==o.pmremVersion){const l=o.image;if(o.isCubeTexture)if(v4(l))i=t.fromCubemap(o,i);else return null;else if(S4(l))i=t.fromEquirectangular(o,i);else return null;if(i.pmremVersion=o.pmremVersion,s.has(o)===!1){const u=()=>{o.removeEventListener("dispose",u);const h=s.get(o);h!==void 0&&(h.dispose(),s.delete(o))};o.addEventListener("dispose",u)}s.set(o,i)}return i.texture}function _4(o){let e=pw.get(o);return e===void 0&&(e=new WeakMap,pw.set(o,e)),e}class T4 extends qt{static get type(){return"PMREMNode"}constructor(e,t=null,s=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=s,this._generator=null;const i=new qs;i.isRenderTargetTexture=!0,this._texture=it(i),this._width=Se(0),this._height=Se(0),this._maxMip=Se(0),this.updateBeforeType=Le.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=x4(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const s=t?t.pmremVersion:-1,i=this._value;s!==i.pmremVersion&&(i.isPMREMTexture===!0||i.mapping===Lm?t=i:t=b4(i,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new p4(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?Tg.mul(O(t.x,t.y.negate(),t.z)):Tg.mul(t);let s=this.levelNode;return s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this)),gB(this._texture,t,s,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}}function v4(o){if(o==null)return!1;let e=0;const t=6;for(let s=0;s<t;s++)o[s]!==void 0&&e++;return e===t}function S4(o){return o==null?!1:o.height>0}const Nv=Ie(T4).setParameterLength(1,3),mw=new WeakMap;class M4 extends Cc{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let s=this.envNode;if(s.isTextureNode||s.isMaterialReferenceNode){const m=s.isTextureNode?s.value:t[s.property],y=this._getPMREMNodeCache(e.renderer);let b=y.get(m);b===void 0&&(b=Nv(m),y.set(m,b)),s=b}const r=t.useAnisotropy===!0||t.anisotropy>0?c2:st,l=s.context(gw(lr,r)).mul(Sm),u=s.context(A4(wo)).mul(Math.PI).mul(Sm),h=lc(l),d=lc(u);e.context.radiance.addAssign(h),e.context.iblIrradiance.addAssign(d);const p=e.context.lightingModel.clearcoatRadiance;if(p){const m=s.context(gw(ac,co)).mul(Sm),y=lc(m);p.addAssign(y)}}_getPMREMNodeCache(e){let t=mw.get(e);return t===void 0&&(t=new WeakMap,mw.set(e,t)),t}}const gw=(o,e)=>{let t=null;return{getUV:()=>(t===null&&(t=vt.negate().reflect(e),t=OT(o).mix(t,e).normalize(),t=t.transformDirection(Ld)),t),getTextureLevel:()=>o}},A4=o=>({getUV:()=>o,getTextureLevel:()=>w(1)}),N4=new WR;class bB extends Bt{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(N4),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new M4(t):null}setupLightingModel(){return new pB}setupSpecular(){const e=$e(O(.04),gt.rgb,oa);To.assign(O(.04)),cl.assign(e),hl.assign(1)}setupVariants(){const e=this.metalnessNode?w(this.metalnessNode):b2;oa.assign(e);let t=this.roughnessNode?w(this.roughnessNode):x2;t=Sv({roughness:t}),lr.assign(t),this.setupSpecular(),ll.assign(gt.rgb.mul(e.oneMinus()))}}const w4=new gO;class R4 extends bB{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(w4),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?w(this.iorNode):U2;md.assign(e),To.assign(bi(LT(md.sub(1).div(md.add(1))).mul(y2),O(1)).mul(v_)),cl.assign($e(To,gt.rgb,oa)),hl.assign($e(v_,1,oa))}setupLightingModel(){return new pB(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?w(this.clearcoatNode):T2,s=this.clearcoatRoughnessNode?w(this.clearcoatRoughnessNode):v2;pg.assign(t),ac.assign(Sv({roughness:s}))}if(this.useSheen){const t=this.sheenNode?O(this.sheenNode):A2,s=this.sheenRoughnessNode?w(this.sheenRoughnessNode):N2;Pi.assign(t),oo.assign(s)}if(this.useIridescence){const t=this.iridescenceNode?w(this.iridescenceNode):R2,s=this.iridescenceIORNode?w(this.iridescenceIORNode):E2,i=this.iridescenceThicknessNode?w(this.iridescenceThicknessNode):C2;Yg.assign(t),mg.assign(s),gg.assign(i)}if(this.useAnisotropy){const t=(this.anisotropyNode?de(this.anisotropyNode):w2).toVar();ro.assign(t.length()),Ae(ro.equal(0),()=>{t.assign(de(1,0))}).Else(()=>{t.divAssign(de(ro)),ro.assign(ro.saturate())}),yg.assign(ro.pow2().mix(lr.pow2(),1)),pd.assign(dl[0].mul(t.x).add(dl[1].mul(t.y))),gl.assign(dl[1].mul(t.x).sub(dl[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?w(this.transmissionNode):B2,s=this.thicknessNode?w(this.thicknessNode):D2,i=this.attenuationDistanceNode?w(this.attenuationDistanceNode):F2,r=this.attenuationColorNode?O(this.attenuationColorNode):L2;if(bg.assign(t),_T.assign(s),TT.assign(i),vT.assign(r),this.useDispersion){const l=this.dispersionNode?w(this.dispersionNode):z2;ST.assign(l)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?O(this.clearcoatNormalNode):S2}setup(e){e.context.setupClearcoatNormal=()=>xl(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}}const E4=z(({normal:o,lightDirection:e,builder:t})=>
85{const s=o.dot(e),i=de(s.mul(.5).add(.5),0);if(t.material.gradientMap){const r=ra("gradientMap","texture").context({getUV:()=>i});return O(r.r)}else{const r=i.fwidth().mul(.5);return $e(O(.7),O(1),Qi(w(.7).sub(r.x),w(.7).add(r.x),i.x))}});class C4 extends py{direct({lightDirection:e,lightColor:t,reflectedLight:s},i){const r=E4({normal:ay,lightDirection:e,builder:i}).mul(t);s.directDiffuse.addAssign(r.mul(Ml({diffuseColor:gt.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:s,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(s.mul(Ml({diffuseColor:gt}))),i.indirectDiffuse.mulAssign(t)}}const B4=new xO;class D4 extends Bt{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(B4),this.setValues(e)}setupLightingModel(){return new C4}}const _B=z(()=>{const o=O(vt.z,0,vt.x.negate()).normalize(),e=vt.cross(o);return de(o.dot(st),e.dot(st)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),U4=new TO;class F4 extends Bt{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(U4),this.setValues(e)}setupVariants(e){const t=_B;let s;e.material.matcap?s=ra("matcap","texture").context({getUV:()=>t}):s=O($e(.2,.8,t.y)),gt.rgb.mulAssign(s.rgb)}}class L4 extends qt{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:s}=this;if(this.getNodeType(e)==="vec2"){const r=t.cos(),l=t.sin();return jg(r,l,l.negate(),r).mul(s)}else{const r=t,l=yo(Te(1,0,0,0),Te(0,Pn(r.x),ti(r.x).negate(),0),Te(0,ti(r.x),Pn(r.x),0),Te(0,0,0,1)),u=yo(Te(Pn(r.y),0,ti(r.y),0),Te(0,1,0,0),Te(ti(r.y).negate(),0,Pn(r.y),0),Te(0,0,0,1)),h=yo(Te(Pn(r.z),ti(r.z).negate(),0,0),Te(ti(r.z),Pn(r.z),0,0),Te(0,0,1,0),Te(0,0,0,1));return l.mul(u).mul(h).mul(Te(s,1)).xyz}}}const zd=Ie(L4).setParameterLength(2),O4=new lO;class TB extends Bt{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(O4),this.setValues(e)}setupPositionView(e){const{object:t,camera:s}=e,{positionNode:i,rotationNode:r,scaleNode:l,sizeAttenuation:u}=this,h=Sr.mul(O(i||0));let d=de(_n[0].xyz.length(),_n[1].xyz.length());l!==null&&(d=d.mul(de(l))),s.isPerspectiveCamera&&u===!1&&(d=d.mul(h.z.negate()));let p=Is.xy;if(t.center&&t.center.isVector2===!0){const b=Oz("center","vec2",t);p=p.sub(b.sub(.5))}p=p.mul(d);const m=w(r||M2),y=zd(p,m);return Te(h.xy.add(y),h.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const z4=new fO,P4=new Fe;class V4 extends TB{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(z4),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return Sr.mul(O(e||Pt)).xyz}setupVertexSprite(e){const{material:t,camera:s}=e,{rotationNode:i,scaleNode:r,sizeNode:l,sizeAttenuation:u}=this;let h=super.setupVertex(e);if(t.isNodeMaterial!==!0)return h;let d=l!==null?de(l):O2;d=d.mul(JT),s.isPerspectiveCamera&&u===!0&&(d=d.mul(G4.div(Zt.z.negate()))),r&&r.isNode&&(d=d.mul(de(r)));let p=Is.xy;if(i&&i.isNode){const m=w(i);p=zd(p,m)}return p=p.mul(d),p=p.div(ev.div(2)),p=p.mul(h.w),h=h.add(Te(p,0,0)),h}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const G4=Se(1).onFrameUpdate(function({renderer:o}){const e=o.getSize(P4);this.value=.5*e.y});class I4 extends py{constructor(){super(),this.shadowNode=w(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){gt.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(gt.rgb)}}const k4=new mO;class H4 extends Bt{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(k4),this.setValues(e)}setupLightingModel(){return new I4}}ya("vec3");ya("vec3");ya("vec3");class q4{constructor(e,t,s){this.renderer=e,this.nodes=t,this.info=s,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,s)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(
85),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,s),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class So{constructor(){this.weakMaps={}}_getWeakMap(e){const t=e.length;let s=this.weakMaps[t];return s===void 0&&(s=new WeakMap,this.weakMaps[t]=s),s}get(e){let t=this._getWeakMap(e);for(let s=0;s<e.length-1;s++)if(t=t.get(e[s]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let s=this._getWeakMap(e);for(let i=0;i<e.length-1;i++){const r=e[i];s.has(r)===!1&&s.set(r,new WeakMap),s=s.get(r)}return s.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let s=0;s<e.length-1;s++)if(t=t.get(e[s]),t===void 0)return!1;return t.delete(e[e.length-1])}}let $4=0;const yw=new WeakMap;function W4(o){const e=Object.keys(o);let t=yw.get(o.constructor);if(t===void 0){t=[];let s=Object.getPrototypeOf(o);for(;s;){const i=Object.getOwnPropertyDescriptors(s);for(const r in i){const l=i[r];l&&typeof l.get=="function"&&t.push(r)}s=Object.getPrototypeOf(s)}yw.set(o.constructor,t)}for(let s=0;s<t.length;s++)e.push(t[s]);return e}class X4{constructor(e,t,s,i,r,l,u,h,d,p){this.id=$4++,this._nodes=e,this._geometries=t,this.renderer=s,this.object=i,this.material=r,this.scene=l,this.camera=u,this.lightsNode=h,this.context=d,this.geometry=i.geometry,this.version=r.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=p,this.clippingContextCacheKey=p!==null?p.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=s._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,s=[],i=new Set,r={};for(const l of e){let u;if(l.node&&l.node.attribute?u=l.node.attribute:(u=t.getAttribute(l.name),u!==void 0&&(u.isInterleavedBufferAttribute?r[l.name]=u.data.uuid:r[l.name]=u.id)),u===void 0)continue;s.push(u);const h=u.isInterleavedBufferAttribute?u.data:u;i.add(h)}return this.attributes=s,this.attributesId=r,this.vertexBuffers=Array.from(i.values()),s}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:s,group:i,drawRange:r}=this,l=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),u=this.getIndex(),h=u!==null;let d=1;if(s.isInstancedBufferGeometry===!0?d=s.instanceCount:e.count!==void 0&&(d=Math.max(0,e.count)),d===0)return null;if(l.instanceCount=d,e.isBatchedMesh===!0)return l;let p=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(p=2);let m=r.start*p,y=(r.start+r.count)*p;i!==null&&(m=Math.max(m,i.start*p),y=Math.min(y,(i.start+i.count)*p));const b=s.attributes.position;let _=1/0;h?_=u.count:b!=null&&(_=b.count),m=Math.max(m,0),y=Math.min(y,_);const v=y-m;return v<0||v===1/0?null:(l.vertexCount=v,l.firstVertex=m,l)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const s of Object.keys(e.attributes).sort()){const i=e.attributes[s];t+=s+",",i.data&&(t+=i.data.stride+","),i.offset&&(t+=i.offset+","),i.itemSize&&(t+=i.itemSize+","),i.normalized&&(t+="n,")}for(const s of Object.keys(e.morphAttributes).sort()){const i=e.morphAttributes[s];t+="morph-"+s+",";for(let r=0,l=i.length;r<l;r++){const u=i[r];t+=u.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t,renderer:s}=this;let i=t.customProgramCacheKey();for(const r of W4(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(r))continue;const l=t[r];let u;if(l!==null){const h=typeof l;h==="number"?r==="side"?u=String(l):u=l!==0?"1":"0":h==="object"?(u="{",l.isTexture&&(u+=l.mapping,s.backend.isWebGPUBackend===!0&&(u+=l.magFilter,u+=l.minFilter,u+=l.wrapS,u+=l.wrapT,u+=l.wrapR)),u+="}"):u=String(l)}else u=String(l);i+=u+","}return i+=this.clippingContextCacheKey+",",e.geometry&&(i+=this.getGeometryCacheKey()),e.skeleton&&(i+=e.skeleton.bones.length+","),e.isBatchedMesh&&(i+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(i+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>
851)&&(i+=e.uuid+","),i+=this.context.id+",",i+=e.receiveShadow+",",wc(i)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){const e=this.attributesId;for(const t in e){const s=this.geometry.getAttribute(t);if(s===void 0)return!0;const i=s.isInterleavedBufferAttribute?s.data.uuid:s.id;if(e[t]!==i)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=dd(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=dd(e,1)),e=dd(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}}const ir=[];class j4{constructor(e,t,s,i,r,l){this.renderer=e,this.nodes=t,this.geometries=s,this.pipelines=i,this.bindings=r,this.info=l,this.chainMaps={}}get(e,t,s,i,r,l,u,h){const d=this.getChainMap(h);ir[0]=e,ir[1]=t,ir[2]=l,ir[3]=r;let p=d.get(ir);return p===void 0?(p=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,s,i,r,l,u,h),d.set(ir,p)):(p.camera=i,p.updateClipping(u),p.needsGeometryUpdate&&p.setGeometry(e.geometry),(p.version!==t.version||p.needsUpdate)&&(p.initialCacheKey!==p.getCacheKey()?(p.dispose(),p=this.get(e,t,s,i,r,l,u,h)):p.version=t.version)),ir[0]=null,ir[1]=null,ir[2]=null,ir[3]=null,p}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new So)}dispose(){this.chainMaps={}}createRenderObject(e,t,s,i,r,l,u,h,d,p,m){const y=this.getChainMap(m),b=new X4(e,t,s,i,r,l,u,h,d,p);return b.onDispose=()=>{this.pipelines.delete(b),this.bindings.deleteForRender(b),this.nodes.delete(b),y.delete(b.getChainArray())},b}}class Ro{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const Tn={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},ho=16,Y4=211,Z4=212;class Q4 extends Ro{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){const t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){const s=this.get(e);if(s.version===void 0)t===Tn.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===Tn.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===Tn.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===Tn.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),s.version=this._getBufferAttribute(e).version;else{const i=this._getBufferAttribute(e);(s.version<i.version||i.usage===Bd)&&(this.backend.updateAttribute(e),s.version=i.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}function vB(o){return o.index!==null?o.index.version:o.attributes.position.version}function SB(o){return o.index!==null?o.index.id:o.attributes.position.id}function xw(o){const e=[],t=o.index,s=o.attributes.position;if(t!==null){const r=t.array;for(let l=0,u=r.length;l<u;l+=3){const h=r[l+0],d=r[l+1],p=r[l+2];e.push(h,d,d,p,p,h)}}else{const r=s.array;for(let l=0,u=r.length/3-1;l<u;l+=3){const h=l+0,d=l+1,p=l+2;e.push(h,d,d,p,p,h)}}const i=new(s.count>=65535?GR:VR)(e,1);return i.version=vB(o),i.__id=SB(o),i}class K4 extends Ro{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){const t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry,s=this.get(t);s.initialized=!0,this.info.memory.geometries++;const i=()=>{this.info.memory.geometries--;const r=t.index,l=e.getAttributes();r!==null&&this.attributes.delete(r);for(const h of l)this.attributes.delete(h);const u=this.wireframes.get(t);u!==void 0&&this.attributes.delete(u),t.removeEventListener("dispose",i),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",i),this._geometryDisposeListeners.set(t,i)}updateAttributes(e){const t=e.getAttributes();for(const r of t)r.isStorageBufferAttribute||r.isStorageInstancedBufferAttribute?this.updateAttribute(r,Tn.STORAGE):this.updateAttribute(r,Tn.VERTEX);const s=this.getIndex(e);s!==null&&this.updateAttribute(s,Tn.INDEX);const i=e.geometry.indirect;i!==null&&this.updateAttribute(i,Tn.INDIRECT)}updateAttribute(e,t){const s=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,s)):this.attributeCall.get(e.data)!==s&&(this.attributes.update(e,t),this.attributeCall.set(e.data,s),this.attributeCall.set(e,s)):this.attributeCall.get(e)!==s&&(this.attributes.update(e,t),this.attributeCall.set(e,s))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){const{geometry:t,material:s}=e;let i=t.index;if(s.wireframe===!0){const r=this.wireframes;let l=r.get(t);l===void 0?(l=xw(t),r.set(t,l)):(l.version!==vB(t)||l.__id!==SB(t))&&(this.attributes.delete(l),l=xw(t),r.set(t,l)),i=l}return i}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class J4{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}
vendor: 4,784 bytes, line 85
85update(e,t,s){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=s*(t/3):e.isPoints?this.render.points+=s*t:e.isLineSegments?this.render.lines+=s*(t/2):e.isLine?this.render.lines+=s*(t-1):he("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(const e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){const t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){const s=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:s,type:t}),this.memory[t]++,this.memory.total+=s,this.memory[t+"Size"]+=s}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){const t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){const t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){const{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){const t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){const t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){const t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){const t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===fl||e.type===Ds?t=1:e.type===pl||e.type===po||e.type===Jt?t=2:(e.type===ps||e.type===Ut||e.type===_s)&&(t=4);let s=4;e.format===X_||e.format===Mc||e.format===Ac||e.format===vn||e.format===fr?s=1:e.format===xn||e.format===Nc?s=2:(e.format===Sc||e.format===j_)&&(s=3);let i=t*s;e.type===$_||e.type===W_?i=2:(e.type===ha||e.type===Lg||e.type===Og)&&(i=4);const r=e.width||1,l=e.height||1,u=e.isCubeTexture?6:e.depth||1;let h=r*l*u*i;const d=e.mipmaps;if(d&&d.length>0){let p=0;for(let m=0;m<d.length;m++){const y=d[m];if(y.data)p+=y.data.byteLength;else{const b=y.width||Math.max(1,r>>m),_=y.height||Math.max(1,l>>m);p+=b*_*u*i}}h+=p}else e.generateMipmaps&&(h=h*1.333);return Math.round(h)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}}class MB{constructor(e){this.cacheKey=e,this.usedTimes=0}}class eG extends MB{constructor(e,t,s){super(e),this.vertexProgram=t,this.fragmentProgram=s}}class tG extends MB{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let sG=0;class Ub{constructor(e,t,s,i=null,r=null){this.id=sG++,this.code=e,this.stage=t,this.name=s,this.transforms=i,this.attributes=r,this.usedTimes=0}}class iG extends Ro{constructor(e,t,s){super(),this.backend=e,this.nodes=t,this.info=s,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:s}=this,i=this.get(e);if(this._needsComputeUpdate(e)){const r=i.pipeline;r&&(r.usedTimes--,r.computeProgram.usedTimes--);const l=this.nodes.getForCompute(e);let u=this.programs.compute.get(l.computeShader);u===void 0&&(r&&r.computeProgram.usedTimes===0&&this._releaseProgram(r.computeProgram),u=new Ub(l.computeShader,"compute",e.name,l.transforms,l.nodeAttributes),this.programs.compute.set(l.computeShader,u),s.createProgram(u),this.info.createProgram(u));const h=this._getComputeCacheKey(e,u);let d=this.caches.get(h);d===void 0&&(r&&r.usedTimes===0&&this._releasePipeline(r),d=this._getComputePipeline(e,u,h,t)),d.usedTimes++,u.usedTimes++,i.version=e.version,i.pipeline=d}return i.pipeline}getForRender(e,t=null){const{backend:s}=this,i=this.get(e);
85if(this._needsRenderUpdate(e)){const r=i.pipeline;r&&(r.usedTimes--,r.vertexProgram.usedTimes--,r.fragmentProgram.usedTimes--);const l=e.getNodeBuilderState(),u=e.material?e.material.name:"";let h=this.programs.vertex.get(l.vertexShader);h===void 0&&(r&&r.vertexProgram.usedTimes===0&&this._releaseProgram(r.vertexProgram),h=new Ub(l.vertexShader,"vertex",u),this.programs.vertex.set(l.vertexShader,h),s.createProgram(h),this.info.createProgram(h));let d=this.programs.fragment.get(l.fragmentShader);d===void 0&&(r&&r.fragmentProgram.usedTimes===0&&this._releaseProgram(r.fragmentProgram),d=new Ub(l.fragmentShader,"fragment",u),this.programs.fragment.set(l.fragmentShader,d),s.createProgram(d),this.info.createProgram(d));const p=this._getRenderCacheKey(e,h,d);let m=this.caches.get(p);m===void 0?(r&&r.usedTimes===0&&this._releasePipeline(r),m=this._getRenderPipeline(e,h,d,p,t)):e.pipeline=m,m.usedTimes++,h.usedTimes++,d.usedTimes++,i.pipeline=m}return i.pipeline}isReady(e){const s=this.get(e).pipeline;if(s===void 0)return!1;const i=this.backend.get(s);return i.pipeline!==void 0&&i.pipeline!==null}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,s,i){s=s||this._getComputeCacheKey(e,t);let r=this.caches.get(s);return r===void 0&&(r=new tG(s,t),this.caches.set(s,r),this.backend.createComputePipeline(r,i)),r}_getRenderPipeline(e,t,s,i,r){i=i||this._getRenderCacheKey(e,t,s);let l=this.caches.get(i);return l===void 0&&(l=new eG(i,t,s),this.caches.set(i,l),e.pipeline=l,this.backend.createRenderPipeline(e,r)),l}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,s){return t.id+","+s.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,s=e.stage;this.programs[s].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){const t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}}class nG extends Ro{constructor(e,t,s,i,r,l){super(),this.backend=e,this.textures=s,this.pipelines=r,this.attributes=i,this.nodes=t,this.info=l,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings(),s=this.get(e);return s.initialized!==!0&&(this._createBindings(t),s.initialized=!0),t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings,s=this.get(e);return(s.initialized!==!0||s.bindings!==t)&&(s.bindings!==void 0&&this._destroyBindings(s.bindings),this._createBindings(t),s.initialized=!0,s.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const s=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(s),this.delete(e)}deleteForRender(e){const t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(const t of e){const s=this.get(t);if(s.bindGroup===void 0){for(const i of t.bindings)if(i.isUniformBuffer)this.backend.createUniformBuffer(i),this.info.createUniformBuffer(i);else if(i.isSampledTexture)this.textures.updateTexture(i.texture);else if(i.isSampler)this.textures.updateSampler(i);else if(i.isStorageBuffer){const r=i.attribute,l=r.isIndirectStorageBufferAttribute?Tn.INDIRECT:Tn.STORAGE;this.attributes.update(r,l)}this.backend.createBindings(t,e,0),s.bindGroup=t,s.usedTimes=1}else s.usedTimes++}}_destroyBindings(e){for(const t of e){const s=this.get(t);if(s.usedTimes--,s.usedTimes===0){for(const i of t.bindings)i.isUniformBuffer?(this.backend.destroyUniformBuffer(i),this.info.destroyUniformBuffer(i),i.release()
85):i.isSampler&&(i.isSampledTexture!==!0&&this.backend.destroySampler(i),i.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(const t of e)this._update(t,e)}_update(e,t){const{backend:s}=this;let i=!1,r=!0,l=0,u=0;for(const h of e.bindings)if(this.nodes.updateGroup(h)!==!1){if(h.isStorageBuffer){const p=h.attribute,m=p.isIndirectStorageBufferAttribute?Tn.INDIRECT:Tn.STORAGE,y=s.get(h);this.attributes.update(p,m),y.attribute!==p&&(y.attribute=p,i=!0)}if(h.isUniformBuffer)h.update()&&s.updateBinding(h);else if(h.isSampledTexture){const p=h.update(),m=h.texture,y=this.textures.get(m);if(p&&(this.textures.updateTexture(m),h.generation!==y.generation&&(h.generation=y.generation,i=!0),y.bindGroups.add(e)),s.get(m).externalTexture!==void 0||y.isDefaultTexture?r=!1:(l=l*10+m.id,u+=m.version),m.isStorageTexture===!0&&m.mipmapsAutoUpdate===!0){const _=this.get(m);h.store===!0?_.needsMipmap=!0:this.textures.needsMipmaps(m)&&_.needsMipmap===!0&&(this.backend.generateMipmaps(m),_.needsMipmap=!1)}}else if(h.isSampler&&h.update()){const m=this.textures.updateSampler(h);h.samplerKey!==m&&(h.samplerKey=m,i=!0)}h.isBuffer&&h.updateRanges.length>0&&h.clearUpdateRanges()}i===!0&&this.backend.updateBindings(e,t,r?l:0,u)}}const rG=Object.freeze([]);function aG(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.z!==e.z?o.z-e.z:o.id-e.id}function bw(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.z!==e.z?e.z-o.z:o.id-e.id}function _w(o){return(o.transmission>0||o.transmissionNode&&o.transmissionNode.isNode)&&o.side===la&&o.forceSinglePass===!1}class oG{constructor(e,t,s){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=s,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,s,i,r,l,u){let h=this.renderItems[this.renderItemsIndex];return h===void 0?(h={id:e.id,object:e,geometry:t,material:s,groupOrder:i,renderOrder:e.renderOrder,z:r,group:l,clippingContext:u},this.renderItems[this.renderItemsIndex]=h):(h.id=e.id,h.object=e,h.geometry=t,h.material=s,h.groupOrder=i,h.renderOrder=e.renderOrder,h.z=r,h.group=l,h.clippingContext=u),this.renderItemsIndex++,h}push(e,t,s,i,r,l,u){const h=this.getNextRenderItem(e,t,s,i,r,l,u);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),s.transparent===!0||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode?(_w(s)&&this.transparentDoublePass.push(h),this.transparent.push(h)):this.opaque.push(h)}unshift(e,t,s,i,r,l,u){const h=this.getNextRenderItem(e,t,s,i,r,l,u);s.transparent===!0||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode?(_w(s)&&this.transparentDoublePass.unshift(h),this.transparent.unshift(h)):this.opaque.unshift(h)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,s){this.opaque.length>1&&this.opaque.sort(e||aG),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||bw),this.transparent.length>1&&this.transparent.sort(t||bw),s&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:rG);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){const s=this.renderItems[e];if(s.id===null)break;s.id=null,s.object=null,s.geometry=null,s.material=null,s.groupOrder=null,s.renderOrder=null,s.z=null,s.group=null,s.clippingContext=null}this._lastOcclusionObject=null}}const Bu=[];class lG{constructor(e){this.lighting=e,this.lists=new So}get(e,t){const s=this.lists;Bu[0]=e,Bu[1]=t;let i=s.get(Bu);return i===void 0&&(i=new oG(this.lighting,e,t),s.set(Bu,i)),Bu[0]=null,Bu[1]=null,i}dispose(){this.lists=new So}}let uG=0;class cG{constructor(){this.id=uG++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new ht,this.scissor=!1,this.scissorValue=new ht,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return AB(this)}}function AB(o){const{textures:e,activeCubeFace:t,activeMipmapLevel:s}=o,i=[t,s];
85for(const r of e)i.push(r.id);return Ud(i)}class hG{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,s=0){let i;if(e===null)i="default";else{const h=e.texture.format,d=e.texture.type;i=`${e.textures.length}:${h}:${d}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}const r=t!==null?t.id:"default",l=i+"-"+r+"-"+s;let u=this._renderContexts[l];return u===void 0&&(u=new cG,u.mrt=t,this._renderContexts[l]=u),e!==null&&(u.sampleCount=e.samples===0?1:e.samples),u.clearDepthValue=this.renderer.getClearDepth(),u.clearStencilValue=this.renderer.getClearStencil(),u}dispose(){this._renderContexts={}}}const dG=new H;class fG extends Ro{constructor(e,t,s){super(),this.renderer=e,this.backend=t,this.info=s,this._htmlTextures=new Set}updateRenderTarget(e,t=0){const s=this.get(e),i=e.samples===0?1:e.samples,r=s.depthTextureMips||(s.depthTextureMips={}),l=e.textures,u=this.getSize(l[0]),h=u.width>>t,d=u.height>>t;let p=e.depthTexture||r[t];const m=e.depthBuffer===!0||e.stencilBuffer===!0;let y=!1;const b=p!==void 0&&p.image!==void 0&&p.image.depth>1,_=u.depth>1&&(e.useArrayDepthTexture||e.multiview||b);p===void 0&&m&&(p=new Sn,p.format=e.stencilBuffer?fr:vn,p.type=e.stencilBuffer?ha:Ut,p.image.width=h,p.image.height=d,p.image.depth=u.depth,p.renderTarget=e,r[t]=p),p&&(p.isArrayTexture=_),(s.width!==u.width||u.height!==s.height)&&(y=!0,p&&(p.needsUpdate=!0,p.image.width=h,p.image.height=d,p.image.depth=_?u.depth:1)),s.width=u.width,s.height=u.height,s.textures=l,s.depthTexture=p||null,s.depth=e.depthBuffer,s.stencil=e.stencilBuffer,s.renderTarget=e,s.sampleCount!==i&&(y=!0,p&&(p.needsUpdate=!0),s.sampleCount=i);const v={sampleCount:i};if(e.isXRRenderTarget!==!0){for(let M=0;M<l.length;M++){const A=l[M];y&&(A.needsUpdate=!0),this.updateTexture(A,v)}p&&this.updateTexture(p,v)}s.initialized!==!0&&(s.initialized=!0,this.info.memory.renderTargets++,s.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",s.onDispose))}updateTexture(e,t={}){const s=this.get(e);if(s.initialized===!0&&s.version===e.version)return;const i=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,r=this.backend;if(i&&s.initialized===!0&&r.destroyTexture(e),e.isFramebufferTexture){const d=this.renderer.getRenderTarget();d?e.type=d.texture.type:e.type=Ds}if(e.isHTMLTexture&&e.image){const d=this.renderer.domElement;if("requestPaint"in d){if(d.hasAttribute("layoutsubtree")||d.setAttribute("layoutsubtree","true"),e.image.parentNode!==d&&d.appendChild(e.image),this._htmlTextures.size===0){const p=this._htmlTextures;d.onpaint=m=>{const y=m&&m.changedElements;for(const b of p)(!y||y.includes(b.image))&&(b.needsUpdate=!0)}}this._htmlTextures.add(e)}}const{width:l,height:u,depth:h}=this.getSize(e);if(t.width=l,t.height=u,t.depth=h,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,l,u):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,i||e.isStorageTexture===!0||e.isExternalTexture===!0)r.createTexture(e,t),s.generation=e.version;else if(e.version>0){const d=e.image;if(d===void 0)me("Renderer: Texture marked for update but image is undefined.");else if(d.complete===!1)me("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const m=[];for(const y of e.images)m.push(y);t.images=m}else t.image=d;(s.isDefaultTexture===void 0||s.isDefaultTexture===!0)&&(r.createTexture(e,t),s.isDefaultTexture=!1,s.generation=e.version),e.source.dataReady===!0&&r.updateTexture(e,t);const p=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!p&&r.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else r.createDefaultTexture(e),s.isDefaultTexture=!0,s.generation=e.version;s.initialized!==!0&&(s.initialized=!0,s.generation=e.version,s.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&<.enabled===!0&<.getTransfer(e.colorSpace)!==Ve&&me("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),s.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",s.onDispose)),s.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=dG){let s=e.images?e.images[0]:e.image;return s?(s.image!==void 0&&(s=s.image),e.isHTMLTexture?(t.width=s.offsetWidth||1,t.height=s.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement?(t.width=s.videoWidth||1,t.height=s.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&s instanceof VideoFrame?(t.width=s.displayWidth||1,t.height=s.displayHeight||1,t.depth=1):(t.width=s.width||1,t.height=s.height||1,t.depth=e.isCubeTexture?6:s.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,s){let i;return e.mipmaps.length>0?i=e.mipmaps.length:e.isCompressedTexture===!0?i=1:i=Math.floor(Math.log2(Math.max(t,s)))+1,i}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){const t=this.get(e),s=t.textures,i=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let r=0;r<s.length;r++)this._destroyTexture(s[r]);i&&this._destroyTexture(i),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){const t=this.get(e);e.removeEventListener("dispose",t.onDispose);const s=t.isDefaultTexture;if(this.backend.destroyTexture(e,s),t.bindGroups)for(const i of t.bindGroups){const r=this.backend.get(i);r.groups=void 0,r.versions=void 0;for(const l of i.bindings)l.isSampler&&l.texture===e&&(l.isSampledTexture!==!0&&this.backend.destroySampler(l),l.reset(),l.release()
85)}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}}class wv extends Xe{constructor(e,t,s,i=1){super(e,t,s),this.a=i}set(e,t,s,i=1){return this.a=i,super.set(e,t,s)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class NB extends GT{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){const e=[];this.traverse(i=>{i.isOverrideContextNode===!0&&e.push(i.value.overrideNodes)});const t=new Map(e.flatMap(i=>Array.from(i.entries()))),s=super.getFlowContextData();return s.overrideNodes=t,s}}function wB(o,e=null,t=null){if(e&&e.isNode){const s=e;e=()=>s}return new NB(new Map([[o,e]]),t)}K("overrideNode",(o,e,t)=>wB(e,t,o));function RB(o,e=null){const t=new Map;for(const[s,i]of o){const r=i!==null?typeof i=="function"?i:()=>i:null;t.set(s,r)}return new NB(t,e)}K("overrideNodes",(o,e)=>RB(e,o));class EB extends ut{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){const s=this.getNodeType(e),i=e.getStructTypeNode(s);let r;return i!==null?r=i.getMemberType(e,t):(he(`TSL: Member "${t}" not found in struct "${s}".`,new ts),r="float"),r}getHash(){return String(this.id)}generate(){return this.name}}const pG=(o,e)=>new EB(o,e);class mG extends we{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return he("TSL: Invalid node added to stack.",new ts),this;if(t===-1)if(this._currentNode){let s=this._nodeDataLibrary.get(this._currentNode);s===void 0&&(s={delta:0},this._nodeDataLibrary.set(this._currentNode,s)),s.delta++,t=this.nodes.indexOf(this._currentNode)+s.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){const t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){const s=new tc(t);return this._currentCond=Hs(e,s),this.addToStack(this._currentCond)}ElseIf(e,t){const s=new tc(t),i=Hs(e,s);return this._currentCond.elseNode=i,this._currentCond=i,this}Else(e){return this._currentCond.elseNode=new tc(e),this}Switch(e){return this._expressionNode=ve(e),this}Case(...e){const t=[];if(e.length>=2)for(let u=0;u<e.length-1;u++)t.push(this._expressionNode.equal(ve(e[u])));else he("TSL: Invalid parameter length. Case() requires at least two parameters.",new ts);const s=e[e.length-1],i=new tc(s);let r=t[0];for(let u=1;u<t.length;u++)r=r.or(t[u]);const l=Hs(r,i);return this._currentCond===null?(this._currentCond=l,this.addToStack(this._currentCond)):(this._currentCond.elseNode=l,this._currentCond=l,this)}Default(e){return this.Else(e),this}setup(e){const t=e.getNodeProperties(this);let s=0;for(const i of this.getChildren())i.isVarNode&&i.isIntent(e)&&i.isAssign(e)!==!0||(t["node"+s++]=i);return t.outputNode||null}build(e,...t){const s=pT(),i=e.buildStage;Ad(this),e.setActiveStack(this);for(let l=0;l<this.nodes.length;l++){const u=this.nodes[l],h=this._currentNode;if(this._currentNode=u,!(u.isVarNode&&u.isIntent(e)&&u.isAssign(e)!==!0)){if(i==="setup")u.build(e);else if(i==="analyze")u.build(e,this);else if(i==="generate"){const d=e.getDataFromNode(u,"any").stages,p=d&&d[e.shaderStage];if(u.isVarNode&&p&&p.length===1&&p[0]&&p[0].isStackNode)continue;u.build(e,"void")}this._currentNode=h}}let r;if(this.outputNode){const l=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(r=l)}else r=super.build(e,...t);return Ad(s),e.removeActiveStack(this),r}}const Nm=Ie(mG).setParameterLength(0,1);function gG(o){return Object.entries(o).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}class yG extends we{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=gG(e),this.name=t,this.isStru
85ctTypeNode=!0}getLength(){let e=1,t=0;for(const s of this.membersLayout){const i=s.type,r=qO(i),l=$O(i);e=Math.max(e,l);const h=t%e%l;h!==0&&(t+=l-h),t+=r}return Math.ceil(t/e)*e}getMemberType(e,t){const s=this.membersLayout.find(i=>i.name===t);return s?s.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class xG extends we{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){const e=super._getChildren(),t=e.find(s=>s.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){const t=e.getVarFromNode(this),s=t.type,i=e.getPropertyName(t);return e.addLineFlowCode(`${i} = ${e.generateStruct(s,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}const bG=(o,e=null)=>{const t=new yG(o,e);return fT((...i)=>{let r=null;if(i.length>0)if(i[0].isNode){r={};const l=Object.keys(o);for(let u=0;u<i.length;u++)r[l[u]]=i[u]}else r=i[0];return new xG(t,r)},t)};class CB extends we{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){const t=e.getDataFromNode(this);if(t.membersLayout===void 0){const l=this.members,u=[];for(let h=0;h<l.length;h++){const d="m"+h,p=l[h].getNodeType(e);u.push({name:d,type:p,index:h})}t.membersLayout=u,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}const s=e.getOutputStructName(),i=this.members,r=s!==""?s+".":"";for(let l=0;l<i.length;l++){const u=i[l].build(e,t.membersLayout[l].type);e.addLineFlowCode(`${r}m${l} = ${u}`,this)}return s}}const _G=Ie(CB);class BB{constructor(e=gn){this.blending=e,this.blendSrc=Td,this.blendDst=vd,this.blendEquation=yn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,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.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}}const TG=new BB(ua),vG=new BB(I_);function DB(o,e){for(let t=0;t<o.length;t++)if(o[t].name===e)return t;return-1}class SG extends CB{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:vG},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||TG}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){const t={...this.outputNodes,...e.outputNodes},s={...this.blendModes,...e.blendModes},i=UB(t);return i.blendings=s,i}setup(e){const t=this.outputNodes,s=e.renderer.getRenderTarget(),i=[],r=s.textures;for(const l in t){const u=DB(r,l);if(u===-1)continue;const h=e.getOutputType(u);i[u]=t[l].convert(h)}return this.members=i,super.setup(e)}}const UB=Ie(SG);class Pd extends qt{static get type(){return"BitcastNode"}constructor(e,t,s=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=s,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){const t=this.valueNode.getNodeType(e),s=e.getTypeLength(t);return e.getTypeFromLength(s,this.conversionType)}return this.conversionType}generate(e){const t=this.getNodeType(e);let s="";if(this.inputType!==null){const i=this.valueNode.getNodeType(e);s=e.getTypeLength(i)===1?this.inputType:e.changeComponentType(i,this.inputType)}else s=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,s)}( ${this.valueNode.build(e,s)} )`}}const FB=ue(Pd).setParameterLength(2),MG=o=>new Pd(o,"int","float"),LB=o=>new Pd(o,"uint","float"),AG=o=>new Pd(o,"float","int"),NG=o=>new Pd(o,"float","uint"),$p={};class Xi extends q{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,s){s==="int"?t.assign(FB(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return ae;case"int":return D;case"uvec2":return mT;case"uvec3":return El;case"uvec4":return bT;case"ivec2":return It;case"ivec3":return gT;case"ivec4":return xT}}_createTrailingZerosBaseLayout(e,t){const s=this._returnDataNode(t);return z(([r])=>{const l=ae(0);this._resolveElementType(r,l,t);const u=w(l.bitAnd(CT(l))),d=LB(u).shiftRight(23).sub(127);return s(d)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){const s=this._returnDataNode(t);return z(([r])=>{Ae(r.equal(ae(0)),()=>ae(32));const l=ae(0),u=ae(0);return this._resolveElementType(r,l,t),Ae(l.shiftRight(16).equal(0),()=>{u.addAssign(16),l.shiftLeftAssign(16)}),Ae(l.shiftRight(24).equal(0),()=>{u.addAssign(8),l.shiftLeftAssign(8)}),Ae(l.shiftRight(28).equal(0),()=>{u.addAssign(4),l.shiftLeftAssign(4)}),Ae(l.shiftRight(30).equal(0),()=>{u.addAssign(2),l.shiftLeftAssign(2)}),Ae(l.shiftRight(31).equal(0),()=>{u.addAssign(1)}),s(u)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){const s=this._returnDataNode(t);return z(([r])=>{const l=ae(0);this._resolveElementType(r,l,t),l.assign(l.sub(l.shiftRight(ae(1)).bitAnd(ae(1431655765)))),l.assign(l.bitAnd(ae(858993459)).add(l.shiftRight(ae(2)).bitAnd(ae(858993459))));const u=l.add(l.shiftRight(ae(4))).bitAnd(ae(252645135)).mul(ae(16843009)).shiftRight(ae(24));return s(u)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,s,i){const r=this._returnDataNode(t);return z(([u])=>{if(s===1)return r(i(u));{const h=r(0),d=["x","y","z","w"];for(let p=0;p<s;p++){const m=d[p];h[m].assign(i(u[m]))}return h}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){const{method:t,aNode:s}=this,{renderer:i}=e;if(i.backend.isWebGPUBackend)return super.setup(e);const r=this.getInputType(e),l=e.getElementType(r),u=e.getTypeLength(r),h=`${t}_base_${l}`,d=`${t}_${r}`;let p=$p[h];if(p===void 0){switch(t){case Xi.COUNT_LEADING_ZEROS:{p=this._createLeadingZerosBaseLayout(h,l);break}case Xi.COUNT_TRAILING_ZEROS:{p=this._createTrailingZerosBaseLayout(h,l);break}case Xi.COUNT_ONE_BITS:{p=this._createOneBitsBaseLayout(h,l);break}}$p[h]=p}let m=$p[d];return m===void 0&&(m=this._createMainLayout(d,r,u,p),$p[d]=m),z(()=>m(s))()}}Xi.COUNT_TRAILING_ZEROS="countTrailingZeros";Xi.COUNT_LEADING_ZEROS="countLeadingZeros";Xi.COUNT_ONE_BITS="countOneBits";const wG=ue(Xi,Xi.COUNT_TRAILING_ZEROS).setParameterLength(1),RG=ue(Xi,Xi.COUNT_LEADING_ZEROS).setParameterLength(1),EG=ue(Xi,Xi.COUNT_ONE_BITS).setParameterLength(1),CG=z(([o])=>{const e=o.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);
vendor: 4,246 bytes, line 85
85return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),D_=(o,e)=>bn(ze(4,o.mul(Ke(1,o))),e),BG=(o,e)=>o.lessThan(.5)?D_(o.mul(2),e).div(2):Ke(1,D_(ze(Ke(1,o),2),e).div(2)),DG=(o,e,t)=>bn(Zi(bn(o,e),ss(bn(o,e),bn(Ke(1,o),t))),1/e),UG=(o,e)=>ti(_g.mul(e.mul(o).sub(1))).div(_g.mul(e.mul(o).sub(1)));class Rv extends qt{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){const t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}const FG=ue(Rv,"snorm").setParameterLength(1),LG=ue(Rv,"unorm").setParameterLength(1),OG=ue(Rv,"float16").setParameterLength(1);class Ev extends qt{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){const t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}const zG=ue(Ev,"snorm").setParameterLength(1),PG=ue(Ev,"unorm").setParameterLength(1),VG=ue(Ev,"float16").setParameterLength(1),sa=z(([o])=>o.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),GG=z(([o])=>O(sa(o.z.add(sa(o.y.mul(1)))),sa(o.z.add(sa(o.x.mul(1)))),sa(o.y.add(sa(o.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),IG=z(([o,e,t])=>{const s=O(o).toVar(),i=w(1.4).toVar(),r=w(0).toVar(),l=O(s).toVar();return yt({start:w(0),end:w(3),type:"float",condition:"<="},()=>{const u=O(GG(l.mul(2))).toVar();s.addAssign(u.add(t.mul(w(.1).mul(e)))),l.mulAssign(1.8),i.mulAssign(1.5),s.mulAssign(1.2);const h=w(sa(s.z.add(sa(s.x.add(sa(s.y)))))).toVar();r.addAssign(h.div(i)),l.addAssign(.14)}),r}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class kG extends we{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let s=this._candidateFn;if(s===null){let i=null,r=-1;for(const l of this.functionNodes){const h=l.shaderNode.layout;if(h===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");const d=h.inputs;if(t.length===d.length){let p=0;for(let m=0;m<t.length;m++){const y=t[m],b=d[m];y.getNodeType(e)===b.type&&p++}p>r&&(i=l,r=p)}}this._candidateFn=s=i}return s}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const HG=Ie(kG),Fs=o=>(...e)=>HG(o,...e),Bc=Se(0).setGroup(Re).onRenderUpdate(o=>o.time),qG=Se(0).setGroup(Re).onRenderUpdate(o=>o.deltaTime),OB=Se(0,"uint").setGroup(Re).onRenderUpdate(o=>o.frameId),$G=(o=Bc)=>o.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),WG=(o=Bc)=>o.fract().round(),XG=(o=Bc)=>o.add(.5).fract().mul(2).sub(1).abs(),jG=(o=Bc)=>o.fract();function YG(o,e=null){return xa(e,{getUV:typeof o=="function"?o:()=>o})}const ZG=z(([o,e,t=de(.5)])=>zd(o.sub(t),e).add(t)),QG=z(([o,e,t=de(.5)])=>{const s=o.sub(t),i=s.dot(s),l=i.mul(i).mul(e);return o.add(s.mul(l))}),KG=z(({position:o=null,horizontal:e=!0,vertical:t=!1})=>{let s;o!==null?(s=_n.toVar(),s[3][0]=o.x,s[3][1]=o.y,s[3][2]=o.z):s=_n;const i=No.mul(s);return bc(e)&&(i[0][0]=_n[0].length(),i[0][1]=0,i[0][2]=0),bc(t)&&(i[1][0]=0,i[1][1]=_n[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,ni.mul(i).mul(Pt)}),JG=z(([o=null])=>{const e=Ag();return Ag(xv(o)).sub(e).lessThan(0).select(In,o)}),eI=z(([o,e=xt(),t=w(0)])=>{const s=o.x,i=o.y,r=t.mod(s.mul(i)).floor(),l=r.mod(s),u=i.sub(r.add(1).div(s).ceil()),h=o.reciprocal(),d=de(l,u);return e.add(d).mul(h)}),zB=z(([o,e=null,t=null,s=w(1),i=Pt,r=Xs])=>{let l=r.abs().normalize();l=l.div(l.dot(O(1)));const u=i.yz.mul(s),h=i.zx.mul(s),d=i.xy.mul(s),p=o.value,m=e!==null?e.value:p,y=t!==null?t.value:p,b=it(p,u).mul(l.x),_=it(m,h).mul(l.y),v=it(y,d).mul(l.z);return ss(b,_,v)}),tI=(...o)=>zB(...o),Du=new ta,Jo=new H,Uu=new H,Fb=new H,Ih=new Qe,Wp=new H(0,0,-1),nr=new ht,kh=new H,Xp=new H,Hh=new ht,jp=new Fe,wg=ne
85w $i,sI=In.flipX();wg.depthTexture=new Sn(1,1);let Yp=!1;class Cv extends vr{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||wg.texture,sI),this._reflectorBaseNode=e.reflector||new iI(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new Cv({defaultTexture:wg.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class iI extends we{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:s=new us,resolutionScale:i=1,generateMipmaps:r=!1,bounces:l=!0,depth:u=!1,samples:h=0}=t;this.textureNode=e,this.target=s,this.resolutionScale=i,t.resolution!==void 0&&(Ye('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=r,this.bounces=l,this.depth=u,this.samples=h,this.updateBeforeType=l?Le.RENDER:Le.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const s=this.resolutionScale;t.getDrawingBufferSize(jp),e.setSize(Math.round(jp.width*s),Math.round(jp.height*s))}setup(e){return this._updateResolution(wg,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new $i(0,0,{type:Jt,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=lL,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Sn),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&Yp)return!1;Yp=!0;const{scene:t,camera:s,renderer:i,material:r}=e,{target:l}=this,u=this.getVirtualCamera(s),h=this.getRenderTarget(u);i.getDrawingBufferSize(jp),this._updateResolution(h,i),Uu.setFromMatrixPosition(l.matrixWorld),Fb.setFromMatrixPosition(s.matrixWorld),Ih.extractRotation(l.matrixWorld),Jo.set(0,0,1),Jo.applyMatrix4(Ih),kh.subVectors(Uu,Fb);const d=kh.dot(Jo)>0;let p=!1;if(d===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){Yp=!1;return}p=!0}kh.reflect(Jo).negate(),kh.add(Uu),Ih.extractRotation(s.matrixWorld),Wp.set(0,0,-1),Wp.applyMatrix4(Ih),Wp.add(Fb),Xp.subVectors(Uu,Wp),Xp.reflect(Jo).negate(),Xp.add(Uu),u.coordinateSystem=s.coordinateSystem,u.position.copy(kh),u.up.set(0,1,0),u.up.applyMatrix4(Ih),u.up.reflect(Jo),u.lookAt(Xp),u.near=s.near,u.far=s.far,u.updateMatrixWorld(),u.projectionMatrix.copy(s.projectionMatrix),Du.setFromNormalAndCoplanarPoint(Jo,Uu),Du.applyMatrix4(u.matrixWorldInverse),nr.set(Du.normal.x,Du.normal.y,Du.normal.z,Du.constant);const m=u.projectionMatrix;Hh.x=(Math.sign(nr.x)+m.elements[8])/m.elements[0],Hh.y=(Math.sign(nr.y)+m.elements[9])/m.elements[5],Hh.z=-1,Hh.w=(1+m.elements[10])/m.elements[14],nr.multiplyScalar(1/nr.dot(Hh));const y=0;m.elements[2]=nr.x,m.elements[6]=nr.y,m.elements[10]=i.coordinateSystem===An?nr.z-y:nr.z+1-y,m.elements[14]=nr.w,this.textureNode.value=h.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=h.depthTexture),r.visible=!1;const b=i.getRenderTarget(),_=i.getMRT(),v=i.autoClear;i.setMRT(null),i.setRenderTarget(h),i.autoClear=!0;const M=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",p?(i.clear(),this.hasOutput=!1):(i.render(t,u),this.hasOutput=!0),t.name=M,i.setMRT(_),i.setRenderTarget(b),i.autoClear=v,r.visible=!0,Yp=!1,this.forceUpdate=!1}get resolution(){return Ye('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Ye('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const nI=o=>new Cv(o),Lb=new aT(-1,1,1,-1,0,1);class rI extends Mr{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new ri([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new ri(t,2))}}const aI=new rI;class Vd extends Tr{constructor(e=null){super(aI,e),this.camera=Lb,this.isQuadMesh=!0}async renderAsync(e){Ye('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();
85" when creating the renderer.'),await e.init(),e.render(this,Lb)}render(e){e.render(this,Lb)}}const oI=new Fe;class lI extends vr{static get type(){return"RTTNode"}constructor(e,t=null,s=null,i={type:Jt}){const r=new $i(t,s,i);super(r.texture,xt()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=s,this.renderTarget=r,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new Vd(new Bt),this.updateBeforeType=Le.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){const s=Math.floor(e*this._resolutionScale),i=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(s,i),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;const t=e.getRenderTarget();if(this.autoResize===!0){const i=e.getDrawingBufferSize(oI),r=Math.floor(i.width*this._resolutionScale),l=Math.floor(i.height*this._resolutionScale);(r!==this.renderTarget.width||l!==this.renderTarget.height)&&(this.renderTarget.setSize(r,l),this.textureNeedsUpdate=!0)}let s="RTT";this.node.name&&(s=this.node.name+" [ "+s+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=s,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new vr(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const PB=(o,...e)=>new lI(ve(o),...e),uI=(o,...e)=>o.isSampleNode||o.isTextureNode?o:o.isPassNode?o.getTextureNode():PB(o,...e),Zu=z(([o,e,t],s)=>{let i;s.renderer.coordinateSystem===An?(o=de(o.x,o.y.oneMinus()).mul(2).sub(1),i=Te(O(o,e),1)):i=Te(O(o.x,o.y.oneMinus(),e).mul(2).sub(1),1);const r=Te(t.mul(i));return r.xyz.div(r.w)}),cI=z(([o,e])=>{const t=e.mul(Te(o,1)),s=t.xy.div(t.w).mul(.5).add(.5).toVar();return de(s.x,s.y.oneMinus())}),hI=z(([o,e,t])=>{const s=Tl(Yt(e)),i=It(o.mul(s)).toVar(),r=Yt(e,i).toVar(),l=Yt(e,i.sub(It(2,0))).toVar(),u=Yt(e,i.sub(It(1,0))).toVar(),h=Yt(e,i.add(It(1,0))).toVar(),d=Yt(e,i.add(It(2,0))).toVar(),p=Yt(e,i.add(It(0,2))).toVar(),m=Yt(e,i.add(It(0,1))).toVar(),y=Yt(e,i.sub(It(0,1))).toVar(),b=Yt(e,i.sub(It(0,2))).toVar(),_=wt(Ke(w(2).mul(u).sub(l),r)).toVar(),v=wt(Ke(w(2).mul(h).sub(d),r)).toVar(),M=wt(Ke(w(2).mul(m).sub(p),r)).toVar(),A=wt(Ke(w(2).mul(y).sub(b),r)).toVar(),C=Zu(o,r,t).toVar(),E=_.lessThan(v).select(C.sub(Zu(o.sub(de(w(1).div(s.x),0)),u,t)),C.negate().add(Zu(o.add(de(w(1).div(s.x),0)),h,t))),F=M.lessThan(A).select(C.sub(Zu(o.add(de(0,w(1).div(s.y))),m,t)),C.negate().add(Zu(o.sub(de(0,w(1).div(s.y))),y,t)));return $s(ga(E,F))}),Bv=z(([o])=>Hn(w(52.9829189).mul(Hn(Nn(o,de(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Gn=z(([o,e,t])=>{const s=w(2.399963229728653),i=ai(w(o).add(.5).div(w(e))),r=w(o).mul(s).add(t);return de(Pn(r),ti(r)).mul(i)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class dI extends we{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(xt())}sample(e){return this.callback(e)}}const fI=(o,e=null)=>new dI(o,ve(e));class pI extends rc{constructor(e,t,s=Float32Array){const i=ArrayBuffer.isView(e)?e:new s(e*t);super(i,t),this.isStorageInstancedBufferAttribute=!0}}class mI extends Wi{constructor(e,t,s=Float32Array){const i=ArrayBuffer.isView(e)?e:new s(e*t);super(i,t),this.isStorageBufferAttribute=!0}}const gI=(o,e="float")=>{let t,s;e.isStructTypeNode===!0?(t=e.getLength(),s=fg("float")):(t=YR(e),s=fg(e));const i=new mI(o,t,s);return xo(i,e,o)},yI=(o,e="float")=>{let t,s;e.isStructTypeNode===!0?(t=e.getLength(),s=fg("float")):(t=YR(e),s=fg(e));const i=new pI(o,t,s);return xo(i,e,i.count)}
85;class xI extends we{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const bI=ge(xI),Ob=new Qe,VB=Se(0).setGroup(Re).onRenderUpdate(({scene:o})=>o.backgroundBlurriness),U_=Se(1).setGroup(Re).onRenderUpdate(({scene:o})=>o.backgroundIntensity),GB=Se(new Qe).setGroup(Re).onRenderUpdate(({scene:o})=>{const e=o.background;return e!==null&&e.isTexture&&e.mapping!==k_||o.backgroundNode&&o.backgroundNode.isNode?Ob.makeRotationFromEuler(o.backgroundRotation).transpose():Ob.identity(),Ob});class IB extends vr{static get type(){return"StorageTextureNode"}constructor(e,t,s=null){super(e,t),this.storeNode=s,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Us.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,s,i,r,l,u,h,d){const p=this.value;return e.generateStorageTextureLoad(p,t,s,i,l,d)}toReadWrite(){return this.setAccess(Us.READ_WRITE)}toReadOnly(){return this.setAccess(Us.READ_ONLY)}toWriteOnly(){return this.setAccess(Us.WRITE_ONLY)}store(e,t){const s=this.clone();return s.referenceNode=this.getBase(),s.uvNode=e,s.storeNode=t,t!==null&&s.toStack(),s}generateStore(e){const t=e.getNodeProperties(this),{uvNode:s,storeNode:i,depthNode:r}=t,l=super.generate(e,"property"),u=s.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),h=i.build(e,"vec4"),d=r?r.build(e,"int"):null,p=e.generateTextureStore(this.value,l,u,d,h);e.addLineFlowCode(p,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}const kB=Ie(IB).setParameterLength(1,3),_I=(o,e,t)=>{let s;return o.isStorageTextureNode===!0?s=o.store(e,t):(s=kB(o,e,t),t!==null&&s.toStack()),s};class TI extends IB{static get type(){return"StorageTexture3DNode"}constructor(e,t,s=null){super(e,t,s),this.isStorageTexture3DNode=!0}getDefaultUV(){return O(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}}const vI=Ie(TI).setParameterLength(1,3),SI=z(({texture:o,uv:e})=>{const s=O().toVar();return Ae(e.x.lessThan(1e-4),()=>{s.assign(O(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{s.assign(O(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{s.assign(O(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{s.assign(O(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{s.assign(O(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{s.assign(O(0,0,-1))}).Else(()=>{const r=o.sample(e.add(O(-.01,0,0))).r.sub(o.sample(e.add(O(.01,0,0))).r),l=o.sample(e.add(O(0,-.01,0))).r.sub(o.sample(e.add(O(0,.01,0))).r),u=o.sample(e.add(O(0,0,-.01))).r.sub(o.sample(e.add(O(0,0,.01))).r);s.assign(O(r,l,u))}),s.normalize()});class MI extends vr{static get type(){return"Texture3DNode"}constructor(e,t=null,s=null){super(e,t,s),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return O(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return SI({texture:this,uv:e})}}const Dv=Ie(MI).setParameterLength(1,3),AI=(...o)=>Dv(...o).setSampler(!1),NI=(o,e,t)=>Dv(o,e).level(t);class wI extends oy{static get type(){return"UserDataNode"}constructor(e,t,s=null){super(e,t,s),this.userData=s}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const RI=(o,e,t)=>new wI(o,e,t),Tw=new WeakMap;class EI extends qt{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=Le.OBJECT,this.updateAfterType=Le.OBJECT,this.previousModelWorldMatrix=Se(new Qe),this.previousProjectionMatrix=Se(new Qe).setGroup(Re),this.previousCameraViewMatrix=Se(new Qe)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:s}){const i=vw(s);this.previousModelWorldMatrix.value.copy(i);const r=HB(t);r.frameId!==e&&(r.frameId=e,r.previousProjectionMatrix===void 0?(r.previousProjectionMatrix=new Qe,r.previousCameraViewMatrix=new Qe,r.currentProjectionMatrix=new Qe,r.currentCameraViewMatrix=new Qe,r.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(r.previousProjectionMatrix.copy(r.currentProjectionMatrix),r.previousCameraViewMatrix.copy(r.currentCameraViewMatrix)),r.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(r.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(r.previousCameraViewMatrix))}updateAfter({object:e}){vw(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?ni:Se(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),s=e.mul(Sr).mul(Pt),i=this.previousProjectionMatrix.mul(t).mul(Sl),r=s.xy.div(s.w),l=i.xy.div(i.w);return Ke(r,l)}}function HB(o){let e=Tw.get(o);return e===void 0&&(e={},Tw.set(o,e)),e}function vw(o,e=0){const t=HB(o);let s=t[e];return s===void 0&&(t[e]=s=new Qe,t[e].copy(o.matrixWorld)),s}const CI=ge(EI),BI=z(([o,e])=>bi(1,o.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",input
vendor: 6,329 bytes, line 85
85s:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),DI=z(([o,e])=>bi(o.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),UI=z(([o,e])=>o.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),FI=z(([o,e])=>$e(o.mul(2).mul(e),o.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),_l(.5,o))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),LI=z(([o,e])=>{const t=e.a.add(o.a.mul(e.a.oneMinus()));return Te(e.rgb.mul(e.a).add(o.rgb.mul(o.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),OI=z(([o])=>Uv(o.rgb)),zI=z(([o,e=w(1)])=>e.mix(Uv(o.rgb),o.rgb).max(0)),PI=z(([o,e=w(0)])=>{const t=ss(o.r,o.g,o.b).div(3),s=o.r.max(o.g.max(o.b)),i=s.sub(t).mul(e).mul(-3);return $e(o.rgb,s,i).max(0)}),VI=z(([o,e=w(1)])=>{const t=O(.57735,.57735,.57735),s=e.cos();return O(o.rgb.mul(s).add(t.cross(o.rgb).mul(e.sin()).add(t.mul(Nn(t,o.rgb).mul(s.oneMinus()))))).max(0)}),Uv=(o,e=O(lt.getLuminanceCoefficients(new H)))=>Nn(o,e),GI=z(([o,e=O(1),t=O(0),s=O(1),i=w(1),r=O(lt.getLuminanceCoefficients(new H,lg))])=>{const l=o.rgb.dot(O(r)),u=Ht(o.rgb.mul(e).add(t),0),h=u.pow(s);return Ae(u.r.greaterThan(0),()=>{u.r.assign(h.r)}),Ae(u.g.greaterThan(0),()=>{u.g.assign(h.g)}),Ae(u.b.greaterThan(0),()=>{u.b.assign(h.b)}),u.assign(l.add(u.sub(l).mul(i)).max(0)),Te(u.rgb,o.a)}),II=z(([o,e])=>o.mul(e).floor().div(e));let Zp=null;class kI extends hy{static get type(){return"ViewportSharedTextureNode"}constructor(e=In,t=null){Zp===null&&(Zp=new sT),super(e,t,Zp)}getTextureForReference(){return Zp}updateReference(){return this}}const HI=Ie(kI).setParameterLength(0,2),Qp=new Fe;class qB extends vr{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){const t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class Sw extends qB{static get type(){return"PassMultipleTextureNode"}constructor(e,t,s=!1){super(e,null),this.textureName=t,this.previousTexture=s,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}}class $n extends qt{static get type(){return"PassNode"}constructor(e,t,s,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=s,this.options=i,this._width=1,this._height=1;const r=new $i(this._width,this._height,{type:Jt,...i});r.texture.name="output";let l=null;(this.scope===$n.DEPTH||i.depthBuffer!==!1)&&(l=new Sn,l.isRenderTargetTexture=!0,l.name="depth",r.depthTexture=l),this.renderTarget=r,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:r.texture},l!==null&&(this._textures.depth=l),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Se(0),this._cameraFar=Se(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=Le.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return me("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return me("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const s=this._textures[e],i=this.renderTarget.textures.indexOf(s);this.renderTarget.textures[i]=t,this._textures[e]=t,this._previousTextures[e]=s,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new Sw(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new Sw(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const s=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=dy(this.getTextureNode(e),s,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const s=this._cameraNear,i=this._cameraFar,r=this.getViewZNode(e);this._linearDepthNodes[e]=t=bl(r,s,i)}return t}async compileAsync(e){const t=e.getRenderTarget(),s=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(s)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=_s),this.scope===$n.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:s}=this;let i;
85const r=t.getOutputRenderTarget();r&&r.isXRRenderTarget===!0?(i=t.xr.getCamera(),t.xr.updateCamera(i),Qp.set(r.width,r.height)):(i=this.camera,t.getDrawingBufferSize(Qp)),this.setSize(Qp.width,Qp.height);const l=t.getRenderTarget(),u=t.getMRT(),h=t.autoClear,d=t.transparent,p=t.opaque,m=i.layers.mask,y=t.contextNode,b=s.overrideMaterial;this._cameraNear.value=i.near,this._cameraFar.value=i.far,this._layers!==null&&(i.layers.mask=this._layers.mask);for(const v in this._previousTextures)this.toggleTexture(v);this.overrideMaterial!==null&&(s.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:xa({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);const _=s.name;s.name=this.name?this.name:s.name,t.render(s,i),s.name=_,s.overrideMaterial=b,t.setRenderTarget(l),t.setMRT(u),t.autoClear=h,t.transparent=d,t.opaque=p,t.contextNode=y,i.layers.mask=m}setSize(e,t){this._width=e,this._height=t;const s=Math.floor(this._width*this._resolutionScale),i=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(s,i),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,s,i){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new ht),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,s,i))}setViewport(e,t,s,i){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new ht),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,s,i))}dispose(){this.renderTarget.dispose()}}$n.COLOR="color";$n.DEPTH="depth";const qI=(o,e,t)=>new $n($n.COLOR,o,e,t),$I=(o,e)=>new qB(o,e),WI=(o,e,t)=>new $n($n.DEPTH,o,e,t);class XI extends $n{static get type(){return"ToonOutlinePassNode"}constructor(e,t,s,i,r){super($n.COLOR,e,t),this.colorNode=s,this.thicknessNode=i,this.alphaNode=r,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,s=t.getRenderObjectFunction();t.setRenderObjectFunction((i,r,l,u,h,d,p,m)=>{if((h.isMeshToonMaterial||h.isMeshToonNodeMaterial)&&h.wireframe===!1){const y=this._getOutlineMaterial(h);t.renderObject(i,r,l,u,y,d,p,m)}t.renderObject(i,r,l,u,h,d,p,m)}),super.updateBefore(e),t.setRenderObjectFunction(s)}_createMaterial(){const e=new Bt;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=Ts;const t=Xs.negate(),s=ni.mul(Sr),i=w(1),r=s.mul(Te(Pt,1)),l=s.mul(Te(Pt.add(t),1)),u=$s(r.sub(l));return e.vertexNode=r.add(u.mul(this.thicknessNode).mul(r.w).mul(i)),e.colorNode=Te(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const jI=(o,e,t=new Xe(0,0,0),s=.003,i=1)=>new XI(o,e,ve(t),ve(s),ve(i)),$B=z(([o,e])=>o.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),WB=z(([o,e])=>(o=o.mul(e),o.div(o.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),XB=z(([o,e])=>{o=o.mul(e),o=o.sub(.004).max(0);const t=o.mul(o.mul(6.2).add(.5)),s=o.mul(o.mul(6.2).add(1.7)).add(.06);return t.div(s).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),YI=z(([o])=>{const e=o.mul(o.add(.0245786)).sub(90537e-9),t=o.mul(o.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),jB=z(([o,e])=>{const t=vs(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),s=vs(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return o=o.mul(e).div(.6),o=t.mul(o),o=YI(o),o=s.mul(o),o.clamp()}
vendor: 4,926 bytes, lines 85-86
85).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),ZI=vs(O(1.6605,-.1246,-.0182),O(-.5876,1.1329,-.1006),O(-.0728,-.0083,1.1187)),QI=vs(O(.6274,.0691,.0164),O(.3293,.9195,.088),O(.0433,.0113,.8956)),KI=z(([o])=>{const e=O(o).toVar(),t=O(e.mul(e)).toVar(),s=O(t.mul(t)).toVar();return w(15.5).mul(s.mul(t)).sub(ze(40.14,s.mul(e))).add(ze(31.96,s).sub(ze(6.868,t.mul(e))).add(ze(.4298,t).add(ze(.1191,e).sub(.00232))))}),YB=z(([o,e])=>{const t=O(o).toVar(),s=vs(O(.856627153315983,.137318972929847,.11189821299995),O(.0951212405381588,.761241990602591,.0767994186031903),O(.0482516061458583,.101439036467562,.811302368396859)),i=vs(O(1.1271005818144368,-.1413297634984383,-.14132976349843826),O(-.11060664309660323,1.157823702216272,-.11060664309660294),O(-.016493938717834573,-.016493938717834257,1.2519364065950405)),r=w(-12.47393),l=w(4.026069);return t.mulAssign(e),t.assign(QI.mul(t)),t.assign(s.mul(t)),t.assign(Ht(t,1e-10)),t.assign(pr(t)),t.assign(t.sub(r).div(l.sub(r))),t.assign(qn(t,0,1)),t.assign(KI(t)),t.assign(i.mul(t)),t.assign(bn(Ht(O(0),t),O(2.2))),t.assign(ZI.mul(t)),t.assign(qn(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),ZB=z(([o,e])=>{const t=w(.76),s=w(.15);o=o.mul(e);const i=bi(o.r,bi(o.g,o.b)),r=Hs(i.lessThan(.08),i.sub(ze(6.25,i.mul(i))),.04);o.subAssign(r);const l=Ht(o.r,Ht(o.g,o.b));Ae(l.lessThan(t),()=>o);const u=Ke(1,t),h=Ke(1,u.mul(u).div(l.add(u.sub(t))));o.mulAssign(h.div(l));const d=Ke(1,Zi(1,s.mul(l.sub(h)).add(1)));return $e(o,O(h),d)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class Dt extends we{static get type(){return"CodeNode"}constructor(e="",t=[],s=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=s}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const i of t)i.build(e);const s=e.getCodeFromNode(this,this.getNodeType(e));return s.code=this.code,s.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const xy=Ie(Dt).setParameterLength(1,3),JI=(o,e)=>xy(o,e,"js"),e5=(o,e)=>xy(o,e,"wgsl"),t5=(o,e)=>xy(o,e,"glsl");class QB extends Dt{static get type(){return"FunctionNode"}constructor(e="",t=[],s=""){super(e,t,s)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const s=this.getNodeType(e);return e.getStructTypeNode(s).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let s=t.nodeFunction;return s===void 0&&(s=e.parser.parseFunction(this.code),t.nodeFunction=s),s}generate(e,t){super.generate(e);const s=this.getNodeFunction(e),i=s.name,r=s.type,l=e.getCodeFromNode(this,r);i!==""&&(l.name=i);const u=e.getPropertyName(l),h=this.getNodeFunction(e).getCode(u);return l.code=h+` 86`,t==="property"?u:e.format(`${u}()`,r,t)}}const KB=(o,e=[],t="")=>{const s=new QB(o,e,t);return fT((...r)=>s.call(...r),s)},s5=(o,e)=>KB(o,e,"glsl"),i5=(o,e)=>KB(o,e,"wgsl");function Fv(o){let e;const t=o.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Zt.z).negate()}const JB=z(([o,e],t)=>{const s=Fv(t);return Qi(o,e,s)}),e3=z(([o],e)=>{const t=Fv(e);return o.mul(o,t,t).negate().exp().oneMinus()}),n5=z(([o,e],t)=>{const s=Fv(t),r=e.sub(yr.y).max(0).toConst().mul(s).toConst();return o.mul(o,r,r).negate().exp().oneMinus()}),F_=z(([o,e])=>Te(e.toFloat().mix(oc.rgb,o.toVec3()),oc.a));let el=null,tl=null;class r5 extends we{static get type(){return"RangeNode"}constructor(e=w(),t=w()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),i=e.getTypeLength(mo(t.value)),r=e.getTypeLength(mo(s.value));return i>r?i:r}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(s=>{s.isConstNode===!0&&(t=s)}),t===null)throw new zC('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){const t=e.object;let s=null;if(t.count>1){const i=this.getConstNode(this.minNode),r=this.getConstNode(this.maxNode),l=i.value,u=r.value,h=e.getTypeLength(mo(l)),d=e.getTypeLength(mo(u));el=el||new ht,tl=tl||new ht,el.setScalar(0),tl.setScalar(0),h===1?el.setScalar(l):l.isColor?el.set(l.r,l.g,l.b,1):el.set(l.x,l.y,l.z||0,l.w||0),d===1?tl.setScalar(u):u.isColor?tl.set(u.r,u.g,u.b,1):tl.set(u.x,u.y,u.z||0,u.w||0);const p=4,m=p*t.count,y=new Float32Array(m);for(let v=0;v<m;v++){const M=v%p,A=el.getComponent(M),C=tl.getComponent(M);y[v]=Q_.lerp(A,C,Math.random())}const b=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())s=Rc(y,"vec4",t.count).element
86(kn).convert(b);else{const v=new rc(y,4);e.geometry.setAttribute("__range"+this.id,v),s=ny(v).convert(b)}}else s=w(0);return s}}const a5=Ie(r5).setParameterLength(2);class o5 extends we{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){const s=this.getBuiltinName(e),i=this.getNodeType(e);return e.shaderStage==="compute"?e.format(s,i,t):(me(`ComputeBuiltinNode: Compute built-in value ${s} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const Gd=(o,e)=>new o5(o,e),l5=Gd("numWorkgroups","uvec3"),u5=Gd("workgroupId","uvec3"),c5=Gd("globalId","uvec3"),h5=Gd("localId","uvec3"),d5=Gd("subgroupSize","uint");class f5 extends we{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){const{scope:t}=this,{renderer:s}=e;s.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 87`):e.addLineFlowCode(`${t}Barrier()`,this)}}const Lv=Ie(f5),p5=()=>Lv("workgroup").toStack(),m5=()=>Lv("storage").toStack(),g5=()=>Lv("texture").toStack();class y5 extends Rl{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let s;const i=e.isContextAssign();if(s=super.generate(e),i!==!0){const r=this.getNodeType(e);s=e.format(s,r,t)}return s}}class x5 extends we{constructor(e,t,s=0){super(t),this.bufferType=t,this.bufferCount=s,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return me('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new y5(this,e)}generate(e){const t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const b5=(o,e)=>new x5("Workgroup",o,e);class ms extends we{static get type(){return"AtomicFunctionNode"}constructor(e,t,s){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=s,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),s=t.parents,i=this.method,r=this.getNodeType(e),l=this.getInputType(e),u=this.pointerNode,h=this.valueNode,d=[];d.push(`&${u.build(e,l)}`),h!==null&&d.push(h.build(e,l));const p=`${e.getMethod(i,r)}( ${d.join(", ")} )`;if(s?s.length===1&&s[0].isStackNode===!0:!1)e.addLineFlowCode(p,this);else return t.constNode===void 0&&(t.constNode=Ii(p,r).toConst()),t.constNode.build(e)}}ms.ATOMIC_LOAD="atomicLoad";ms.ATOMIC_STORE="atomicStore";ms.ATOMIC_ADD="atomicAdd";ms.ATOMIC_SUB="atomicSub";ms.ATOMIC_MAX="atomicMax";ms.ATOMIC_MIN="atomicMin";ms.ATOMIC_AND="atomicAnd";ms.ATOMIC_OR="atomicOr";ms.ATOMIC_XOR="atomicXor";const _5=Ie(ms),Nr=(o,e,t)=>_5(o,e,t).toStack(),T5=o=>Nr(ms.ATOMIC_LOAD,o,null),v5=(o,e)=>Nr(ms.ATOMIC_STORE,o,e),S5=(o,e)=>Nr(ms.ATOMIC_ADD,o,e),M5=(o,e)=>Nr(ms.ATOMIC_SUB,o,e),A5=(o,e)=>Nr(ms.ATOMIC_MAX,o,e),N5=(o,e)=>Nr(ms.ATOMIC_MIN,o,e),w5=(o,e)=>Nr(ms.ATOMIC_AND,o,e),R5=(o,e)=>Nr(ms.ATOMIC_OR,o,e),E5=(o,e)=>Nr(ms.ATOMIC_XOR,o,e);class be extends qt{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,s=null){super(),this.method=e,this.aNode=t,this.bNode=s}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,s=this.bNode?this.bNode.getNodeType(e):null,i=e.isMatrix(t)?0:e.getTypeLength(t),r=e.isMatrix(s)?0:e.getTypeLength(s);return i>r?t:s}generateNodeType(e){const t=this.method;return t===be.SUBGROUP_ELECT?"bool":t===be.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const s=this.method,i=this.getNodeType(e),r=this.getInputType(e),l=this.aNode,u=this.bNode,h=[];if(s===be.SUBGROUP_BROADCAST||s===be.SUBGROUP_SHUFFLE||s===be.QUAD_BROADCAST){const p=u.getNodeType(e);h.push(l.build(e,i),u.build(e,p==="float"?"int":i))}else s===be.SUBGROUP_SHUFFLE_XOR||s===be.SUBGROUP_SHUFFLE_DOWN||s===be.SUBGROUP_SHUFFLE_UP?h.push(l.build(e,i),u.build(e,"uint")):(l!==null&&h.push(l.build(e,r)),u!==null&&h.push(u.build(e,r)));const d=h.length===0?"()":`( ${h.join(", ")} )`;return e.format(`${e.getMethod(s,i)}${d}
87`,i,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}be.SUBGROUP_ELECT="subgroupElect";be.SUBGROUP_BALLOT="subgroupBallot";be.SUBGROUP_ADD="subgroupAdd";be.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";be.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";be.SUBGROUP_MUL="subgroupMul";be.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";be.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";be.SUBGROUP_AND="subgroupAnd";be.SUBGROUP_OR="subgroupOr";be.SUBGROUP_XOR="subgroupXor";be.SUBGROUP_MIN="subgroupMin";be.SUBGROUP_MAX="subgroupMax";be.SUBGROUP_ALL="subgroupAll";be.SUBGROUP_ANY="subgroupAny";be.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";be.QUAD_SWAP_X="quadSwapX";be.QUAD_SWAP_Y="quadSwapY";be.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";be.SUBGROUP_BROADCAST="subgroupBroadcast";be.SUBGROUP_SHUFFLE="subgroupShuffle";be.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";be.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";be.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";be.QUAD_BROADCAST="quadBroadcast";const C5=ue(be,be.SUBGROUP_ELECT).setParameterLength(0),B5=ue(be,be.SUBGROUP_BALLOT).setParameterLength(1),D5=ue(be,be.SUBGROUP_ADD).setParameterLength(1),U5=ue(be,be.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),F5=ue(be,be.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),L5=ue(be,be.SUBGROUP_MUL).setParameterLength(1),O5=ue(be,be.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),z5=ue(be,be.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),P5=ue(be,be.SUBGROUP_AND).setParameterLength(1),V5=ue(be,be.SUBGROUP_OR).setParameterLength(1),G5=ue(be,be.SUBGROUP_XOR).setParameterLength(1),I5=ue(be,be.SUBGROUP_MIN).setParameterLength(1),k5=ue(be,be.SUBGROUP_MAX).setParameterLength(1),H5=ue(be,be.SUBGROUP_ALL).setParameterLength(0),q5=ue(be,be.SUBGROUP_ANY).setParameterLength(0),$5=ue(be,be.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),W5=ue(be,be.QUAD_SWAP_X).setParameterLength(1),X5=ue(be,be.QUAD_SWAP_Y).setParameterLength(1),j5=ue(be,be.QUAD_SWAP_DIAGONAL).setParameterLength(1),Y5=ue(be,be.SUBGROUP_BROADCAST).setParameterLength(2),Z5=ue(be,be.SUBGROUP_SHUFFLE).setParameterLength(2),Q5=ue(be,be.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),K5=ue(be,be.SUBGROUP_SHUFFLE_UP).setParameterLength(2),J5=ue(be,be.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),ek=ue(be,be.QUAD_BROADCAST).setParameterLength(1);let Kp;function by(o){Kp=Kp||new WeakMap;let e=Kp.get(o);return e===void 0&&Kp.set(o,e={}),e}function _y(o){const e=by(o);return e.shadowMatrix||(e.shadowMatrix=Se("mat4").setGroup(Re).onRenderUpdate(t=>((o.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(o.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(o.shadow.camera.coordinateSystem=t.camera.coordinateSystem,o.shadow.camera.updateProjectionMatrix()),o.shadow.updateMatrices(o)),o.shadow.matrix)))}function t3(o,e=yr){const t=_y(o).mul(e);return t.xyz.div(t.w)}function Ov(o){const e=by(o);return e.position||(e.position=Se(new H).setGroup(Re).onRenderUpdate((t,s)=>s.value.setFromMatrixPosition(o.matrixWorld)))}function s3(o){const e=by(o);return e.targetPosition||(e.targetPosition=Se(new H).setGroup(Re).onRenderUpdate((t,s)=>s.value.setFromMatrixPosition(o.target.matrixWorld)))}function zv(o){const e=by(o);return e.viewPosition||(e.viewPosition=Se(new H).setGroup(Re).onRenderUpdate(({camera:t},s)=>{s.value=s.value||new H,s.value.setFromMatrixPosition(o.matrixWorld),s.value.applyMatrix4(t.matrixWorldInverse)}))}const Pv=o=>No.transformDirection(Ov(o).sub(s3(o))),tk=ya("vec3","totalDiffuse"),sk=ya("vec3","totalSpecular"),ik=ya("vec3","outgoingLight"),nk=o=>o.sort((e,t)=>e.id-t.id),rk=(o,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===o)return t;return null},zb=new WeakMap,qh=[];class Vv extends we{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=tk,this.totalSpecularNode=sk,this.outgoingLightNode=ik,this._lights=[],this.global=!0}customCacheKey(){const e=this._lights;for(let s=0;s<e.length;s++){const i=e[s];if(qh.push(i.id),qh.push(i.castShadow?1:0),i.isSpotLight===!0){const r=i.map!==null?i.map.id:-1,l=i.colorNode?i.colorNode.getCacheKey():-1;qh.push(r,l)}}const t=Ud(qh);return qh.length=0,t}getHash(e){const t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){const s=this.setupLightsNode(e);t.lightNodes=s;const i=[];for(const r of s)i.push(r.getHash());t.lightNodesHash="lights-"+i.join(",")}return t.lightNodesHash}analyze(e){const t=e.getNodeProperties(this);for(const s of t.nodes)s.build(e);t.outputNode.build(e)}setupLightsNode(e){const t=e.getDataFromNode(this),s=[],i=t.lightNodes||null,r=e.context.materialLightings,l=nk([...r,...this._lights]),u=e.renderer.library;for(const h of l)if(h.isNode)s.push(h);else{let d=null;if(i!==null&&(d=rk(h.id,i)),d===null){const p=u.getLightNodeClass(h.constructor);if(p===null){me(`LightsNode.setupNodeLights: Light node not found for ${h.constructor.name}`);continue}zb.has(h)===!1&&zb.set(h,new p(h)),d=zb.get(h)}s.push(d)}return s}
87setupDirectLight(e,t,s){const{lightingModel:i,reflectedLight:r}=e.context;i.direct({...s,lightNode:t,reflectedLight:r},e)}setupDirectRectAreaLight(e,t,s){const{lightingModel:i,reflectedLight:r}=e.context;i.directRectArea({...s,lightNode:t,reflectedLight:r},e)}setupLights(e,t){for(const s of t)s.build(e)}getLightNodes(e){const t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let s=this.outgoingLightNode;const i=e.context,r=i.lightingModel,l=e.getNodeProperties(this);if(r){const{totalDiffuseNode:u,totalSpecularNode:h}=this;i.outgoingLight=s;const d=e.addStack();l.nodes=d.nodes,r.start(e);const{backdrop:p,backdropAlpha:m}=i,{directDiffuse:y,directSpecular:b,indirectDiffuse:_,indirectSpecular:v}=i.reflectedLight;let M=y.add(_);p!==null&&(m!==null?M=O(m.mix(M,p)):M=O(p)),u.assign(M),h.assign(b.add(v)),s.assign(u.add(h)),r.finish(e),s=s.bypass(e.removeStack())}else l.nodes=[];return e.lightsNode=t,s}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}const ak=(o=[])=>new Vv().setLights(o);class ok extends we{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=Le.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){Gv.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||yr)}}const Gv=ya("vec3","shadowPositionWorld");function Iv(o,e={}){return e.toneMapping=o.toneMapping,e.toneMappingExposure=o.toneMappingExposure,e.outputColorSpace=o.outputColorSpace,e.renderTarget=o.getRenderTarget(),e.activeCubeFace=o.getActiveCubeFace(),e.activeMipmapLevel=o.getActiveMipmapLevel(),e.renderObjectFunction=o.getRenderObjectFunction(),e.pixelRatio=o.getPixelRatio(),e.mrt=o.getMRT(),e.clearColor=o.getClearColor(e.clearColor||new Xe),e.clearAlpha=o.getClearAlpha(),e.autoClear=o.autoClear,e.scissorTest=o.getScissorTest(),e}function i3(o,e){return e=Iv(o,e),o.setMRT(null),o.setRenderObjectFunction(null),o.setClearColor(0,1),o.autoClear=!0,e}function n3(o,e){o.toneMapping=e.toneMapping,o.toneMappingExposure=e.toneMappingExposure,o.outputColorSpace=e.outputColorSpace,o.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),o.setRenderObjectFunction(e.renderObjectFunction),o.setPixelRatio(e.pixelRatio),o.setMRT(e.mrt),o.setClearColor(e.clearColor,e.clearAlpha),o.autoClear=e.autoClear,o.setScissorTest(e.scissorTest)}function kv(o,e={}){return e.background=o.background,e.backgroundNode=o.backgroundNode,e.overrideMaterial=o.overrideMaterial,e}function r3(o,e){return e=kv(o,e),o.background=null,o.backgroundNode=null,o.overrideMaterial=null,e}function a3(o,e){o.background=e.background,o.backgroundNode=e.backgroundNode,o.overrideMaterial=e.overrideMaterial}function lk(o,e,t={}){return t=Iv(o,t),t=kv(e,t),t}function o3(o,e,t){return t=i3(o,t),t=r3(e,t),t}function l3(o,e,t){n3(o,t),a3(e,t)}var Mw=Object.freeze({__proto__:null,resetRendererAndSceneState:o3,resetRendererState:i3,resetSceneState:r3,restoreRendererAndSceneState:l3,restoreRendererState:n3,restoreSceneState:a3,saveRendererAndSceneState:lk,saveRendererState:Iv,saveSceneState:kv});const Rg=new WeakMap,u3=z(({depthTexture:o,shadowCoord:e,depthLayer:t})=>{let s=it(o,e.xy).setName("t_basic");return o.isArrayTexture&&(s=s.depth(t)),s.compare(e.z)}),c3=z(({depthTexture:o,shadowCoord:e,shadow:t,depthLayer:s})=>{const i=(p,m)=>{let y=it(o,p);return o.isArrayTexture&&(y=y.depth(s)),y.compare(m)},r=Ct("mapSize","vec2",t).setGroup(Re),l=Ct("radius","float",t).setGroup(Re),u=de(1).div(r),h=l.mul(u.x),d=Bv(Bl.xy).mul(6.28318530718);return ss(i(e.xy.add(Gn(0,5,d).mul(h)),e.z),i(e.xy.add(Gn(1,5,d).mul(h)),e.z),i(e.xy.add(Gn(2,5,d).mul(h)),e.z),i(e.xy.add(Gn(3,5,d).mul(h)),e.z),i(e.xy.add(Gn(4,5,d).mul(h)),e.z)).mul(1/5)}),h3=z(({depthTexture:o,shadowCoord:e,shadow:t,depthLayer:s})=>{const i=Ct("mapSize","vec2",t).setGroup(Re),r=de(1).div(i),l=e.xy,u=Hn(l.mul(i).add(.5)).toConst();l.subAssign(u.sub(.5).mul(r));const h=b=>{let _=it(o,l).offset(b).gather();return o.isArrayTexture&&(_=_.depth(s)),_.compare(e.z)},d=h(It(-1,1)).toConst(),p=h(It(1,1)).toConst(),m=h(It(-1,-1)).toConst(),y=h(It(1,-1)).toConst();return ss($e(d.x,p.y,u.x).add(d.y).add(p.x).mul(u.y),$e(d.w,p.z,u.x).add(d.z).add(p.w),$e(m.x,y.y,u.x).add(m.y).add(y.x),$e(m.w,y.z,u.x).add(m.z).add(y.w).mul(u.y.oneMinus())).mul(1/9)}),d3=z(({depthTexture:o,shadowCoord:e,depthLayer:t},s)=>{let i=it(o).sample(e.xy);o.isArrayTexture&&(i=i.depth(t)),i=i.rg;const r=i.x,l=Ht(1e-7,i.y.mul(i.y)),u=s.renderer.reversedDepthBuffer?_l(r,e.z):_l(e.z,r),h=w(1).toVar();return Ae(u.notEqual(1),()=>{const d=e.z.sub(r);let p=l.div(l.add(d.mul(d)));p=qn(Ke(p,.3).div(.65)),h.assign(Ht(u,p))}),h}),f3=o=>{let e=Rg.get(o);return e===void 0&&(e=new Bt,e.colorNode=Te(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ua,e.fog=!1,Rg.set(o,e)),e},p3=o=>{const e=Rg.get(o);e!==void 0&&(e.dispose(),Rg.delete(o))},Aw=new So,Fu=[],m3=(o,e,t,s)=>{Fu[0]=o,Fu[1]=e;let i=Aw.get(Fu);return(i===void 0||i.shadowType!==t||i.useVelocity!==s)&&(i=(r,l,u,h,d,p,m,y,b)=>{(r.castShadow===!0||r.receiveShadow&&t===rd)&&(s&&(ZR(r).useVelocity=!0),r.onBeforeShadow(o,r,u,e.camera,h,l.overrideMaterial,p),o.renderObject(r,l,u,h,d,p,m,y,b),r.onAfterShadow(o,r,u,e.camera,h,l.overrideMaterial,p))},i.shadowType=t,i.useVelocity=s,Aw.set(Fu,i)),Fu[0]=null,Fu[1]=null,i},uk=z(({samples:o,radius:e,size:t,shadowPass:s,depthLayer:i}
vendor: 4,741 bytes, line 87
87)=>{const r=w(0).toVar("meanVertical"),l=w(0).toVar("squareMeanVertical"),u=o.lessThanEqual(w(1)).select(w(0),w(2).div(o.sub(1))),h=o.lessThanEqual(w(1)).select(w(0),w(-1));yt({start:D(0),end:D(o),type:"int",condition:"<"},({i:p})=>{const m=h.add(w(p).mul(u));let y=s.sample(ss(Bl.xy,de(0,m).mul(e)).div(t));s.value.isArrayTexture&&(y=y.depth(i)),y=y.x,r.addAssign(y),l.addAssign(y.mul(y))}),r.divAssign(o),l.divAssign(o);const d=ai(l.sub(r.mul(r)).max(0));return de(r,d)}),ck=z(({samples:o,radius:e,size:t,shadowPass:s,depthLayer:i})=>{const r=w(0).toVar("meanHorizontal"),l=w(0).toVar("squareMeanHorizontal"),u=o.lessThanEqual(w(1)).select(w(0),w(2).div(o.sub(1))),h=o.lessThanEqual(w(1)).select(w(0),w(-1));yt({start:D(0),end:D(o),type:"int",condition:"<"},({i:p})=>{const m=h.add(w(p).mul(u));let y=s.sample(ss(Bl.xy,de(m,0).mul(e)).div(t));s.value.isArrayTexture&&(y=y.depth(i)),r.addAssign(y.x),l.addAssign(ss(y.y.mul(y.y),y.x.mul(y.x)))}),r.divAssign(o),l.divAssign(o);const d=ai(l.sub(r.mul(r)).max(0));return de(r,d)}),hk=[u3,c3,h3,d3];let Pb;const Jp=new Vd;class g3 extends ok{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:s,shadowCoord:i,shadow:r,depthLayer:l}){const u=i.x.greaterThanEqual(0).and(i.x.lessThanEqual(1)).and(i.y.greaterThanEqual(0)).and(i.y.lessThanEqual(1)).and(i.z.lessThanEqual(1)),h=t({depthTexture:s,shadowCoord:i,shadow:r,depthLayer:l});return u.select(h,w(1))}setupShadowCoord(e,t){const{shadow:s}=this,{renderer:i}=e,r=s.biasNode||Ct("bias","float",s).setGroup(Re);let l=t,u;if(s.camera.isOrthographicCamera||i.logarithmicDepthBuffer!==!0)l=l.xyz.div(l.w),u=l.z;else{const h=l.w;l=l.xy.div(h);const d=Ct("near","float",s.camera).setGroup(Re),p=Ct("far","float",s.camera).setGroup(Re);u=fy(h.negate(),d,p)}return l=O(l.x,l.y.oneMinus(),i.reversedDepthBuffer?u.sub(r):u.add(r)),l}getShadowFilterFn(e){return hk[e]}setupRenderTarget(e,t){const s=new Sn(e.mapSize.width,e.mapSize.height);s.name="ShadowDepthTexture",s.compareFunction=t.renderer.reversedDepthBuffer?gc:Cd;const i=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return i.texture.name="ShadowMap",i.texture.type=e.mapType,i.depthTexture=s,{shadowMap:i,depthTexture:s}}setupShadow(e){const{renderer:t,camera:s}=e,{light:i,shadow:r}=this,{depthTexture:l,shadowMap:u}=this.setupRenderTarget(r,e),h=t.shadowMap.type,d=t.hasCompatibility(Al.TEXTURE_COMPARE);if((h===yR||h===KF)&&d?(l.minFilter=Ss,l.magFilter=Ss):(l.minFilter=$t,l.magFilter=$t),r.camera.coordinateSystem=s.coordinateSystem,r.camera.updateProjectionMatrix(),h===rd&&r.isPointLightShadow!==!0){l.compareFunction=null,u.depth>1?(u._vsmShadowMapVertical||(u._vsmShadowMapVertical=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:xn,type:Jt,depth:u.depth,depthBuffer:!1}),u._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=u._vsmShadowMapVertical,u._vsmShadowMapHorizontal||(u._vsmShadowMapHorizontal=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:xn,type:Jt,depth:u.depth,depthBuffer:!1}),u._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=u._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:xn,type:Jt,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:xn,type:Jt,depthBuffer:!1}));let U=it(l);l.isArrayTexture&&(U=U.depth(this.depthLayer));let R=it(this.vsmShadowMapVertical.texture);l.isArrayTexture&&(R=R.depth(this.depthLayer));const V=Ct("blurSamples","float",r).setGroup(Re),$=Ct("radius","float",r).setGroup(Re),ie=Ct("mapSize","vec2",r).setGroup(Re);let le=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Bt);le.fragmentNode=uk({samples:V,radius:$,size:ie,shadowPass:U,depthLayer:this.depthLayer}).context(e.getSharedContext()),le.name="VSMVertical",le=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Bt),le.fragmentNode=ck({samples:V,radius:$,size:ie,shadowPass:R,depthLayer:this.depthLayer}).context(e.getSharedContext()),le.name="VSMHorizontal"}const p=Ct("intensity","float",r).setGroup(Re),m=Ct("normalBias","float",r).setGroup(Re),y=_y(i),b=wo.mul(m);let _;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?_=y.mul(Gv.add(b)):_=Se("mat4").onObjectUpdate(({object:R},V)=>V.value.multiplyMatrices(y.value,R.matrixWorld)).mul(Pt).add(y.mul(Te(b,0)));
87const v=this.setupShadowCoord(e,_),M=r.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(M===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const A=h===rd&&r.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:l,C=this.setupShadowFilter(e,{filterFn:M,shadowTexture:u.texture,depthTexture:A,shadowCoord:v,shadow:r,depthLayer:this.depthLayer});let E;t.shadowMap.transmitted===!0&&(u.texture.isCubeTexture?E=ii(u.texture,v.xyz):(E=it(u.texture,v),l.isArrayTexture&&(E=E.depth(this.depthLayer))));let F;E?F=$e(1,C.rgb.mix(E,1),p.mul(E.a)).toVar():F=$e(1,C,p).toVar(),this.shadowMap=u,this.shadow.map=u;const L=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return E&&F.toInspector(`${L} / Color`,()=>this.shadowMap.texture.isCubeTexture?ii(this.shadowMap.texture,N_()):it(this.shadowMap.texture)),F.toInspector(`${L} / Depth`,()=>{const U=Ct("near","float",this.shadow.camera),R=Ct("far","float",this.shadow.camera);let V;this.shadowMap.texture.isCubeTexture?V=ii(this.shadowMap.depthTexture,N_()).r:V=it(this.shadowMap.depthTexture).r;let $;return this.shadow.camera.isPerspectiveCamera?$=dy(V,U,R):$=K2(V,U,R),$=bl($,U,R),$.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return z(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let s=this._node;return this.setupShadowPosition(e),s===null&&(this._node=s=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(s=e.material.receivedShadowNode(s)),s})()}renderShadow(e){const{shadow:t,shadowMap:s,light:i}=this,{renderer:r,scene:l}=e;t.updateMatrices(i),s.setSize(t.mapSize.width,t.mapSize.height,s.depth);const u=l.name;l.name=`Shadow Map [ ${i.name||"ID: "+i.id} ]`,r.render(l,t.camera),l.name=u}updateShadow(e){const{shadowMap:t,light:s,shadow:i}=this,{renderer:r,scene:l,camera:u}=e,h=r.shadowMap.type,d=t.depthTexture.version;this._depthVersionCached=d;const p=i.camera.layers.mask;(i.camera.layers.mask&4294967294)===0&&(i.camera.layers.mask=u.layers.mask);const m=r.getRenderObjectFunction(),y=r.getMRT(),b=y?y.has("velocity"):!1;Pb=o3(r,l,Pb),l.overrideMaterial=f3(s),r.setRenderObjectFunction(m3(r,i,h,b)),r.setClearColor(0,0),r.setRenderTarget(t),this.renderShadow(e),r.setRenderObjectFunction(m),h===rd&&i.isPointLightShadow!==!0&&this.vsmPass(r),i.camera.layers.mask=p,l3(r,l,Pb)}vsmPass(e){const{shadow:t}=this,s=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,s),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,s),e.setRenderTarget(this.vsmShadowMapVertical),Jp.material=this.vsmMaterialVertical,Jp.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),Jp.material=this.vsmMaterialHorizontal,Jp.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,p3(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){const{shadow:t}=this;let s=t.needsUpdate||t.autoUpdate;s&&(this._cameraFrameId[e.camera]===e.frameId&&(s=!1),this._cameraFrameId[e.camera]=e.frameId),s&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const y3=(o,e)=>new g3(o,e),dk=new Xe,Nw=new Qe,$h=new H,Vb=new H,fk=[new H(1,0,0),new H(-1,0,0),new H(0,-1,0),new H(0,1,0),new H(0,0,1),new H(0,0,-1)],pk=[new H(0,-1,0),new H(0,-1,0),new H(0,0,-1),new H(0,0,1),new H(0,-1,0),new H(0,-1,0)],mk=[new H(1,0,0),new H(-1,0,0),new H(0,1,0),new H(0,-1,0),new H(0,0,1),new H(0,0,-1)],gk=[new H(0,-1,0),new H(0,-1,0),new H(0,0,1),new H(0,0,-1),new H(0,-1,0),new H(0,-1,0)],x3=z(({depthTexture:o,bd3D:e,dp:t})=>ii(o,e).compare(t)),b3=z(({depthTexture:o,bd3D:e,dp:t,shadow:s})=>{const i=Ct("radius","float",s).setGroup(Re),r=Ct("mapSize","vec2",s).setGroup(Re),l=i.div(r.x),u=wt(e),h=$s(ga(e,u.x.greaterThan(u.z).select(O(0,1,0),O(1,0,0)))),d=ga(e,h),p=Bv(Bl.xy).mul(6.28318530718),m=Gn(0,5,p),y=Gn(1,5,p),b=Gn(2,5,p),_=Gn(3,5,p),v=Gn(4,5,p);return ii(o,e.add(h.mul(m.x).add(d.mul(m.y)).mul(l))).compare(t).add(ii(o,e.add(h.mul(y.x).add(d.mul(y.y)).mul(l))).compare(t)).add(ii(o,e.add(h.mul(b.x).add(d.mul(b.y)).mul(l))).compare(t)).add(ii(o,e.add(h.mul(_.x).add(d.mul(_.y)).mul(l))).compare(t)).add(ii(o,e.add(h.mul(v.x).add(d.mul(v.y)).mul(l))).compare(t)).mul(1/5)}),yk=z(({filterFn:o,depthTexture:e,shadowCoord:t,shadow:s},i)=>{const r=t.xyz.toConst(),l=r.abs().toConst(),u=l.x.max(l.y).max(l.z),h=Se("float").setGroup(Re).onRenderUpd
vendor: 20,413 bytes, line 87
87ate(()=>s.camera.near),d=Se("float").setGroup(Re).onRenderUpdate(()=>s.camera.far),p=Ct("bias","float",s).setGroup(Re),m=w(1).toVar();return Ae(u.sub(d).lessThanEqual(0).and(u.sub(h).greaterThanEqual(0)),()=>{let y;i.renderer.reversedDepthBuffer?(y=J2(u.negate(),h,d),y.subAssign(p)):i.renderer.logarithmicDepthBuffer?(y=fy(u.negate(),h,d),y.addAssign(p)):(y=bv(u.negate(),h,d),y.addAssign(p));const b=r.normalize();m.assign(o({depthTexture:e,bd3D:b,dp:y,shadow:s}))}),m});class xk extends g3{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===QF?x3:b3}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:s,shadowCoord:i,shadow:r}){return yk({filterFn:t,depthTexture:s,shadowCoord:i,shadow:r})}setupRenderTarget(e,t){const s=new pO(e.mapSize.width);s.name="PointShadowDepthTexture",s.compareFunction=t.renderer.reversedDepthBuffer?gc:Cd;const i=t.createCubeRenderTarget(e.mapSize.width);return i.texture.name="PointShadowMap",i.depthTexture=s,{shadowMap:i,depthTexture:s}}renderShadow(e){const{shadow:t,shadowMap:s,light:i}=this,{renderer:r,scene:l}=e,u=t.camera,h=t.matrix,d=r.coordinateSystem===An,p=d?fk:mk,m=d?pk:gk;s.setSize(t.mapSize.width,t.mapSize.width);const y=r.autoClear,b=r.getClearColor(dk),_=r.getClearAlpha();r.autoClear=!1,r.setClearColor(t.clearColor,t.clearAlpha);for(let v=0;v<6;v++){r.setRenderTarget(s,v),r.clear();const M=i.distance||u.far;M!==u.far&&(u.far=M,u.updateProjectionMatrix()),$h.setFromMatrixPosition(i.matrixWorld),u.position.copy($h),Vb.copy(u.position),Vb.add(p[v]),u.up.copy(m[v]),u.lookAt(Vb),u.updateMatrixWorld(),h.makeTranslation(-$h.x,-$h.y,-$h.z),Nw.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),t._frustum.setFromProjectionMatrix(Nw,u.coordinateSystem,u.reversedDepth);const A=l.name;l.name=`Point Light Shadow [ ${i.name||"ID: "+i.id} ] - Face ${v+1}`,r.render(l,u),l.name=A}r.autoClear=y,r.setClearColor(b,_)}}const _3=(o,e)=>new xk(o,e);class Ul extends Cc{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new Xe,this.colorNode=e&&e.colorNode||Se(this.color).setGroup(Re),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=Le.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return zv(this.light).sub(e.context.positionView||Zt)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return y3(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let s=this.shadowColorNode;if(s===null){const i=this.light.shadow.shadowNode;let r;i!==void 0?r=ve(i):r=this.setupShadowNode(),this.shadowNode=r,this.shadowColorNode=s=this.colorNode.mul(r),this.baseColorNode=this.colorNode}e.context.getShadow&&(s=e.context.getShadow(this,e)),this.colorNode=s}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),s=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),s&&e.lightsNode.setupDirectRectAreaLight(e,this,s)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const Hv=z(({lightDistance:o,cutoffDistance:e,decayExponent:t})=>{const s=o.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(s.mul(o.div(e).pow4().oneMinus().clamp().pow2()),s)}),T3=({color:o,lightVector:e,cutoffDistance:t,decayExponent:s})=>{const i=e.normalize(),r=e.length(),l=Hv({lightDistance:r,cutoffDistance:t,decayExponent:s}),u=o.mul(l);return{lightDirection:i,lightColor:u}};class bk extends Ul{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Se(0).setGroup(Re),this.decayExponentNode=Se(2).setGroup(Re)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return _3(this.light)}setupDirect(e){return T3({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const _k=z(([o=xt()])=>{const e=o.mul(2),t=e.x.floor(),s=e.y.floor();return t.add(s).mod(2).sign()}),Tk=z(([o=xt()],{renderer:e,material:t})=>{const s=zT(o.mul(2).sub(1));let i;if(t.alphaToCoverage&&e.currentSamples>0){const r=w(s.fwidth()).toVar();i=Qi(r.oneMinus(),r.add(1),s).oneMinus()}else i=Hs(s.greaterThan(1),0,1);return i}),xd=z(([o,e,t])=>{const s=w(t).toVar(),i=w(e).toVar(),r=Yi(o).toVar();return Hs(r,i,s).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),Eg=z(([o,e])=>{const t=Yi(e).toVar(),s=w(o).toVar();return Hs(t,s.negate(),s).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),es=z(([o])=>{const e=w(o).toVar();return D(mr(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Vt=z(([o,e])=>{const t=w(o).toVar();return e.assign(es(t)),t.sub(w(e))}),vk=z(([o,e,t,s,i,r])=>{const l=w(r).toVar(),u=w(i).toVar(),h=w(s).toVar(),d=w(t).toVar(),p=w(e).toVar(),m=w(o).toVar(),y=w(Ke(1,u)).toVar();return Ke(1,l).mul(m.mul(y).add(p.mul(u))).add(l.mul(d.mul(y).add(h.mul(u))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Sk=z(([o,e,t,s,i,r])=>{const l=w(r).toVar(),u=w(i).toVar(),h=O(s).toVar(),d=O(t).toVar(),p=O(e).toVar(),m=O(o).toVar(),y=w(Ke(1,u)).toVar();return Ke(1,l).mul(m.mul(y).add(p.mul(u))).add(l.mul(d.mul(y).add(h.mul(u))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),v3=Fs([vk,Sk]),Mk=z(([o,e,t,s,i,r,l,u,h,d,p])=>{const m=w(p).toVar(),y=w(d).toVar(),b=w(h).toVar(),_=w(u).toVar(),v=w(l).toVar(),M=w(r).toVar(),A=w(i).toVar(),C=w(s).toVar(),E=w(t).toVar(),F=w(e).toVar(),L=w(o).toVar(),U=w(Ke(1,b)).toVar(),R=w(Ke(1,y)).toVar();return w(Ke(1,m)).toVar().mul(R.mul(L.mul(U).add(F.mul(b))).add(y.mul(E.mul(U).add(C.mul(b))))).add(m.mul(R.mul(A.mul(U).add(M.mul(b))).add(y.mul(v.mul(U).add(_.mul(b))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Ak=z(([o,e,t,s,i,r,l,u,h,d,p])=>{const m=w(p).toVar(),y=w(d).toVar(),b=w(h).toVar(),_=O(u).toVar(),v=O(l).toVar(),M=O(r).toVar(),A=O(i).toVar(),C=O(s).toVar(),E=O(t).toVar(),F=O(e).toVar(),L=O(o).toVar(),U=w(Ke(1,b)).toVar(),R=w(Ke(1,y)).toVar();return w(Ke(1,m)).toVar().mul(R.mul(L.mul(U).add(F.mul(b))).add(y.mul(E.mul(U).add(C.mul(b))))).add(m.mul(R.mul(A.mul(U).add(M.mul(b))).add(y.mul(v.mul(U).add(_.mul(b))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),S3=Fs([Mk,Ak]),Nk=z(([o,e,t])=>{const s=w(t).toVar(),i=w(e).toVar(),r=ae(o).toVar(),l=ae(r.bitAnd(ae(7))).toVar(),u=w(xd(l.lessThan(ae(4)),i,s)).toVar(),h=w(ze(2,xd(l.lessThan(ae(4)),s,i))).toVar();return Eg(u,Yi(l.bitAnd(ae(1)))).add(Eg(h,Yi(l.bitAnd(ae(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),wk=z(([o,e,t,s])=>{const i=w(s).toVar(),r=w(t).toVar(),l=w(e).toVar(),u=ae(o).toVar(),h=ae(u.bitAnd(ae(15))).toVar(),d=w(xd(h.lessThan(ae(8)),l,r)).toVar(),p=w(xd(h.lessThan(ae(4)),r,xd(h.equal(ae(12)).or(h.equal(ae(14))),l,i))).toVar();return Eg(d,Yi(h.bitAnd(ae(1)))).add(Eg(p,Yi(h.bitAnd(ae(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),bs=Fs([Nk,wk]),Rk=z(([o,e,t])=>{const s=w(t).toVar(),i=w(e).toVar(),r=El(o).toVar();return O(bs(r.x,i,s),bs(r.y,i,s),bs(r.z,i,s))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Ek=z(([o,e,t,s])=>{const i=w(s).toVar(),r=w(t).toVar(),l=w(e).toVar(),u=El(o).toVar();return O(bs(u.x,l,r,i),bs(u.y,l,r,i),bs(u.z,l,r,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),pn=Fs([Rk,Ek]),Ck=z(([o])=>{const e=w(o).toVar();return ze(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Bk=z(([o])=>{const e=w(o).toVar();return ze(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Dk=z(([o])=>{const e=O(o).toVar();return ze(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),M3=Fs([Ck,Dk]),Uk=z(([o])=>{const e=O(o).toVar();return ze(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),A3=Fs([Bk,Uk]),Gi=z(([o,e])=>{const t=D(e).toVar(),s=ae(o).toVar();return s.shiftLeft(t).bitOr(s.shiftRight(D(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),N3=z(([o,e,t])=>{o.subAssign(t),o.bitXorAssign(Gi(t,D(4))),t.addAssign(e),e.subAssign(o),e.bitXorAssign(Gi(o,D(6))),o.addAssign(t),t.subAssign(e),t.bitXorAssign(Gi(e,D(8))),e.addAssign(o),o.subAssign(t),o.bitXorAssign(Gi(t,D(16))),t.addAssign(e),e.subAssign(o),e.bitXorAssign(Gi(o,D(19))),o.addAssign(t),t.subAssign(e),t.bitXorAssign(Gi(e,D(4))),e.addAssign(o)}),Id=z(([o,e,t])=>{const s=ae(t).toVar(),i=ae(e).toVar(),r=ae(o).toVar();return s.bitXorAssign(i),s.subAssign(Gi(i,D(14))),r.bitXorAssign(s),r.subAssign(Gi(s,D(11))),i.bitXorAssign(r),i.subAssign(Gi(r,D(25))),s.bitXorAssign(i),s.subAssign(Gi(i,D(16))),r.bitXorAssign(s),r.subAssign(Gi(s,D(4))),i.bitXorAssign(r),i.subAssign(Gi(r,D(14))),s.bitXorAssign(i),s.subAssign(Gi(i,D(24))),s}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Ws=z(([o])=>{const e=ae(o).toVar();return w(e).div(w(ae(D(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),xr=z(([o])=>{const e=w(o).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),Fk=z(([o])=>{const e=D(o).toVar(),t=ae(ae(1)).toVar(),s=ae(ae(D(3735928559)).add(t.shiftLeft(ae(2))).add(ae(13))).toVar();return Id(s.add(ae(e)),s,s)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Lk=z(([o,e])=>{const t=D(e).toVar(),s=D(o).toVar(),i=ae(ae(2)).toVar(),r=ae().toVar(),l=ae().toVar(),u=ae().toVar();return r.assign(l.assign(u.assign(ae(D(3735928559)).add(i.shiftLeft(ae(2))).add(ae(13))))),r.addAssign(ae(s)),l.addAssign(ae(t)),Id(r,l,u)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Ok=z(([o,e,t])=>{const s=D(t).toVar(),i=D(e).toVar(),r=D(o).toVar(),l=ae(ae(3)).toVar(),u=ae().toVar(),h=ae().toVar(),d=ae().toVar();return u.assign(h.assign(d.assign(ae(D(3735928559)).add(l.shiftLeft(ae(2))).add(ae(13))))),u.addAssign(ae(r)),h.addAssign(ae(i)),d.addAssign(ae(s)),Id(u,h,d)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),zk=z(([o,e,t,s])=>{const i=D(s).toVar(),r=D(t).toVar(),l=D(e).toVar(),u=D(o).toVar(),h=ae(ae(4)).toVar(),d=ae().toVar(),p=ae().toVar(),m=ae().toVar();return d.assign(p.assign(m.assign(ae(D(3735928559)).add(h.shiftLeft(ae(2))).add(ae(13))))),d.addAssign(ae(u)),p.addAssign(ae(l)),m.addAssign(ae(r)),N3(d,p,m),d.addAssign(ae(i)),Id(d,p,m)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),Pk=z(([o,e,t,s,i])=>{const r=D(i).toVar(),l=D(s).toVar(),u=D(t).toVar(),h=D(e).toVar(),d=D(o).toVar(),p=ae(ae(5)).toVar(),m=ae().toVar(),y=ae().toVar(),b=ae().toVar();return m.assign(y.assign(b.assign(ae(D(3735928559)).add(p.shiftLeft(ae(2))).add(ae(13))))),m.addAssign(ae(d)),y.addAssign(ae(h)),b.addAssign(ae(u)),N3(m,y,b),m.addAssign(ae(l)),y.addAssign(ae(r)),Id(m,y,b)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),bt=Fs([Fk,Lk,Ok,zk,Pk]),Vk=z(([o,e])=>{const t=D(e).toVar(),s=D(o).toVar(),i=ae(bt(s,t)).toVar(),r=El().toVar();return r.x.assign(i.bitAnd(D(255))),r.y.assign(i.shiftRight(D(8)).bitAnd(D(255))),r.z.assign(i.shiftRight(D(16)).bitAnd(D(255))),r}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Gk=z(([o,e,t])=>{const s=D(t).toVar(),i=D(e).toVar(),r=D(o).toVar(),l=ae(bt(r,i,s)).toVar(),u=El().toVar();return u.x.assign(l.bitAnd(D(255))),u.y.assign(l.shiftRight(D(8)).bitAnd(D(255))),u.z.assign(l.shiftRight(D(16)).bitAnd(D(255))),u}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),mn=Fs([Vk,Gk]),Ik=z(([o])=>{const e=de(o).toVar(),t=D().toVar(),s=D().toVar(),i=w(Vt(e.x,t)).toVar(),r=w(Vt(e.y,s)).toVar(),l=w(xr(i)).toVar(),u=w(xr(r)).toVar(),h=w(v3(bs(bt(t,s),i,r),bs(bt(t.add(D(1)),s),i.sub(1),r),bs(bt(t,s.add(D(1))),i,r.sub(1)),bs(bt(t.add(D(1)),s.add(D(1))),i.sub(1),r.sub(1)),l,u)).toVar();return M3(h)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),kk=z(([o])=>{const e=O(o).toVar(),t=D().toVar(),s=D().toVar(),i=D().toVar(),r=w(Vt(e.x,t)).toVar(),l=w(Vt(e.y,s)).toVar(),u=w(Vt(e.z,i)).toVar(),h=w(xr(r)).toVar(),d=w(xr(l)).toVar(),p=w(xr(u)).toVar(),m=w(S3(bs(bt(t,s,i),r,l,u),bs(bt(t.add(D(1)),s,i),r.sub(1),l,u),bs(bt(t,s.add(D(1)),i),r,l.sub(1),u),bs(bt(t.add(D(1)),s.add(D(1)),i),r.sub(1),l.sub(1),u),bs(bt(t,s,i.add(D(1))),r,l,u.sub(1)),bs(bt(t.add(D(1)),s,i.add(D(1))),r.sub(1),l,u.sub(1)),bs(bt(t,s.add(D(1)),i.add(D(1))),r,l.sub(1),u.sub(1)),bs(bt(t.add(D(1)),s.add(D(1)),i.add(D(1))),r.sub(1),l.sub(1),u.sub(1)),h,d,p)).toVar();return A3(m)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),qv=Fs([Ik,kk]),Hk=z(([o])=>{const e=de(o).toVar(),t=D().toVar(),s=D().toVar(),i=w(Vt(e.x,t)).toVar(),r=w(Vt(e.y,s)).toVar(),l=w(xr(i)).toVar(),u=w(xr(r)).toVar(),h=O(v3(pn(mn(t,s),i,r),pn(mn(t.add(D(1)),s),i.sub(1),r),pn(mn(t,s.add(D(1))),i,r.sub(1)),pn(mn(t.add(D(1)),s.add(D(1))),i.sub(1),r.sub(1)),l,u)).toVar();return M3(h)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),qk=z(([o])=>{const e=O(o).toVar(),t=D().toVar(),s=D().toVar(),i=D().toVar(),r=w(Vt(e.x,t)).toVar(),l=w(Vt(e.y,s)).toVar(),u=w(Vt(e.z,i)).toVar(),h=w(xr(r)).toVar(),d=w(xr(l)).toVar(),p=w(xr(u)).toVar(),m=O(S3(pn(mn(t,s,i),r,l,u),pn(mn(t.add(D(1)),s,i),r.sub(1),l,u),pn(mn(t,s.add(D(1)),i),r,l.sub(1),u),pn(mn(t.add(D(1)),s.add(D(1)),i),r.sub(1),l.sub(1),u),pn(mn(t,s,i.add(D(1))),r,l,u.sub(1)),pn(mn(t.add(D(1)),s,i.add(D(1))),r.sub(1),l,u.sub(1)),pn(mn(t,s.add(D(1)),i.add(D(1))),r,l.sub(1),u.sub(1)),pn(mn(t.add(D(1)),s.add(D(1)),i.add(D(1))),r.sub(1),l.sub(1),u.sub(1)),h,d,p)).toVar();return A3(m)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),kd=Fs([Hk,qk]),$k=z(([o])=>{const e=w(o).toVar(),t=D(es(e)).toVar();return Ws(bt(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Wk=z(([o])=>{const e=de(o).toVar(),t=D(es(e.x)).toVar(),s=D(es(e.y)).toVar();return Ws(bt(t,s))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Xk=z(([o])=>{const e=O(o).toVar(),t=D(es(e.x)).toVar(),s=D(es(e.y)).toVar(),i=D(es(e.z)).toVar();return Ws(bt(t,s,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),jk=z(([o])=>{const e=Te(o).toVar(),t=D(es(e.x)).toVar(),s=D(es(e.y)).toVar(),i=D(es(e.z)).toVar(),r=D(es(e.w)).toVar();return Ws(bt(t,s,i,r))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Yk=Fs([$k,Wk,Xk,jk]),Zk=z(([o])=>{const e=w(o).toVar(),t=D(es(e)).toVar();return O(Ws(bt(t,D(0))),Ws(bt(t,D(1))),Ws(bt(t,D(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Qk=z(([o])=>{const e=de(o).toVar(),t=D(es(e.x)).toVar(),s=D(es(e.y)).toVar();return O(Ws(bt(t,s,D(0))),Ws(bt(t,s,D(1))),Ws(bt(t,s,D(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Kk=z(([o])=>{const e=O(o).toVar(),t=D(es(e.x)).toVar(),s=D(es(e.y)).toVar(),i=D(es(e.z)).toVar();return O(Ws(bt(t,s,i,D(0))),Ws(bt(t,s,i,D(1))),Ws(bt(t,s,i,D(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Jk=z(([o])=>{const e=Te(o).toVar(),t=D(es(e.x)).toVar(),s=D(es(e.y)).toVar(),i=D(es(e.z)).toVar(),r=D(es(e.w)).toVar();return O(Ws(bt(t,s,i,r,D(0))),Ws(bt(t,s,i,r,D(1))),Ws(bt(t,s,i,r,D(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),Ty=Fs([Zk,Qk,Kk,Jk]),Cg=z(([o,e,t,s])=>{const i=w(s).toVar(),r=w(t).toVar(),l=D(e).toVar(),u=O(o).toVar(),h=w(0).toVar(),d=w(1).toVar();return yt(l,()=>{h.addAssign(d.mul(qv(u))),d.mulAssign(i),u.mulAssign(r)}),h}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),vy=z(([o,e,t,s])=>{const i=w(s).toVar(),r=w(t).toVar(),l=D(e).toVar(),u=O(o).toVar(),h=O(0).toVar(),d=w(1).toVar();return yt(l,()=>{h.addAssign(d.mul(kd(u))),d.mulAssign(i),u.mulAssign(r)}),h}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),e6=z(([o,e,t,s])=>{const i=w(s).toVar(),r=w(t).toVar(),l=D(e).toVar(),u=O(o).toVar();return de(Cg(u,l,r,i),Cg(u.add(O(D(19),D(193),D(17))),l,r,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),t6=z(([o,e,t,s])=>{const i=w(s).toVar(),r=w(t).toVar(),l=D(e).toVar(),u=O(o).toVar(),h=O(vy(u,l,r,i)).toVar(),d=w(Cg(u.add(O(D(19),D(193),D(17))),l,r,i)).toVar();return Te(h,d)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),s6=z(([o,e,t,s,i,r,l])=>{const u=D(l).toVar(),h=w(r).toVar(),d=D(i).toVar(),p=D(s).toVar(),m=D(t).toVar(),y=D(e).toVar(),b=de(o).toVar(),_=O(Ty(de(y.add(p),m.add(d)))).toVar(),v=de(_.x,_.y).toVar();v.subAssign(.5),v.mulAssign(h),v.addAssign(.5);const M=de(de(w(y),w(m)).add(v)).toVar(),A=de(M.sub(b)).toVar();return Ae(u.equal(D(2)),()=>wt(A.x).add(wt(A.y))),Ae(u.equal(D(3)),()=>Ht(wt(A.x),wt(A.y))),Nn(A,A)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),i6=z(([o,e,t,s,i,r,l,u,h])=>{const d=D(h).toVar(),p=w(u).toVar(),m=D(l).toVar(),y=D(r).toVar(),b=D(i).toVar(),_=D(s).toVar(),v=D(t).toVar(),M=D(e).toVar(),A=O(o).toVar(),C=O(Ty(O(M.add(b),v.add(y),_.add(m)))).toVar();
vendor: 4,268 bytes, line 87
87C.subAssign(.5),C.mulAssign(p),C.addAssign(.5);const E=O(O(w(M),w(v),w(_)).add(C)).toVar(),F=O(E.sub(A)).toVar();return Ae(d.equal(D(2)),()=>wt(F.x).add(wt(F.y)).add(wt(F.z))),Ae(d.equal(D(3)),()=>Ht(wt(F.x),wt(F.y),wt(F.z))),Nn(F,F)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Dc=Fs([s6,i6]),n6=z(([o,e,t])=>{const s=D(t).toVar(),i=w(e).toVar(),r=de(o).toVar(),l=D().toVar(),u=D().toVar(),h=de(Vt(r.x,l),Vt(r.y,u)).toVar(),d=w(1e6).toVar();return yt({start:-1,end:D(1),name:"x",condition:"<="},({x:p})=>{yt({start:-1,end:D(1),name:"y",condition:"<="},({y:m})=>{const y=w(Dc(h,p,m,l,u,i,s)).toVar();d.assign(bi(d,y))})}),Ae(s.equal(D(0)),()=>{d.assign(ai(d))}),d}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),r6=z(([o,e,t])=>{const s=D(t).toVar(),i=w(e).toVar(),r=de(o).toVar(),l=D().toVar(),u=D().toVar(),h=de(Vt(r.x,l),Vt(r.y,u)).toVar(),d=de(1e6,1e6).toVar();return yt({start:-1,end:D(1),name:"x",condition:"<="},({x:p})=>{yt({start:-1,end:D(1),name:"y",condition:"<="},({y:m})=>{const y=w(Dc(h,p,m,l,u,i,s)).toVar();Ae(y.lessThan(d.x),()=>{d.y.assign(d.x),d.x.assign(y)}).ElseIf(y.lessThan(d.y),()=>{d.y.assign(y)})})}),Ae(s.equal(D(0)),()=>{d.assign(ai(d))}),d}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),a6=z(([o,e,t])=>{const s=D(t).toVar(),i=w(e).toVar(),r=de(o).toVar(),l=D().toVar(),u=D().toVar(),h=de(Vt(r.x,l),Vt(r.y,u)).toVar(),d=O(1e6,1e6,1e6).toVar();return yt({start:-1,end:D(1),name:"x",condition:"<="},({x:p})=>{yt({start:-1,end:D(1),name:"y",condition:"<="},({y:m})=>{const y=w(Dc(h,p,m,l,u,i,s)).toVar();Ae(y.lessThan(d.x),()=>{d.z.assign(d.y),d.y.assign(d.x),d.x.assign(y)}).ElseIf(y.lessThan(d.y),()=>{d.z.assign(d.y),d.y.assign(y)}).ElseIf(y.lessThan(d.z),()=>{d.z.assign(y)})})}),Ae(s.equal(D(0)),()=>{d.assign(ai(d))}),d}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),o6=z(([o,e,t])=>{const s=D(t).toVar(),i=w(e).toVar(),r=O(o).toVar(),l=D().toVar(),u=D().toVar(),h=D().toVar(),d=O(Vt(r.x,l),Vt(r.y,u),Vt(r.z,h)).toVar(),p=w(1e6).toVar();return yt({start:-1,end:D(1),name:"x",condition:"<="},({x:m})=>{yt({start:-1,end:D(1),name:"y",condition:"<="},({y})=>{yt({start:-1,end:D(1),name:"z",condition:"<="},({z:b})=>{const _=w(Dc(d,m,y,b,l,u,h,i,s)).toVar();p.assign(bi(p,_))})})}),Ae(s.equal(D(0)),()=>{p.assign(ai(p))}),p}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),l6=Fs([n6,o6]),u6=z(([o,e,t])=>{const s=D(t).toVar(),i=w(e).toVar(),r=O(o).toVar(),l=D().toVar(),u=D().toVar(),h=D().toVar(),d=O(Vt(r.x,l),Vt(r.y,u),Vt(r.z,h)).toVar(),p=de(1e6,1e6).toVar();return yt({start:-1,end:D(1),name:"x",condition:"<="},({x:m})=>{yt({start:-1,end:D(1),name:"y",condition:"<="},({y})=>{yt({start:-1,end:D(1),name:"z",condition:"<="},({z:b})=>{const _=w(Dc(d,m,y,b,l,u,h,i,s)).toVar();Ae(_.lessThan(p.x),()=>{p.y.assign(p.x),p.x.assign(_)}).ElseIf(_.lessThan(p.y),()=>{p.y.assign(_)})})})}),Ae(s.equal(D(0)),()=>{p.assign(ai(p))}),p}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),c6=Fs([r6,u6]),h6=z(([o,e,t])=>{const s=D(t).toVar(),i=w(e).toVar(),r=O(o).toVar(),l=D().toVar(),u=D().toVar(),h=D().toVar(),d=O(Vt(r.x,l),Vt(r.y,u),Vt(r.z,h)).toVar(),p=O(1e6,1e6,1e6).toVar();return yt({start:-1,end:D(1),name:"x",condition:"<="},({x:m})=>{yt({start:-1,end:D(1),name:"y",condition:"<="},({y})=>{yt({start:-1,end:D(1),name:"z",condition:"<="},({z:b})=>{const _=w(Dc(d,m,y,b,l,u,h,i,s)).toVar();Ae(_.lessThan(p.x),()=>{p.z.assign(p.y),p.y.assign(p.x),p.x.assign(_)}).ElseIf(_.lessThan(p.y),()=>{p.z.assign(p.y),p.y.assign(_)}).ElseIf(_.lessThan(p.z),()=>{p.z.assign(_)})})})}),Ae(s.equal(D(0)),()=>{p.assign(ai(p))}),p}
vendor: 4,397 bytes, line 87
87).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),$v=Fs([a6,h6]),d6=z(([o,e,t,s,i,r,l,u,h,d,p])=>{const m=D(o).toVar(),y=de(e).toVar(),b=de(t).toVar(),_=de(s).toVar(),v=w(i).toVar(),M=w(r).toVar(),A=w(l).toVar(),C=Yi(u).toVar(),E=D(h).toVar(),F=w(d).toVar(),L=w(p).toVar(),U=y.mul(b).add(_),R=w(0).toVar();return Ae(m.equal(D(0)),()=>{R.assign(kd(U))}),Ae(m.equal(D(1)),()=>{R.assign(Ty(U))}),Ae(m.equal(D(2)),()=>{R.assign($v(U,v,D(0)))}),Ae(m.equal(D(3)),()=>{R.assign(vy(O(U,0),E,F,L))}),R.assign(R.mul(A.sub(M)).add(M)),Ae(C,()=>{R.assign(qn(R,M,A))}),R}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),f6=z(([o,e,t,s,i,r,l,u,h,d,p])=>{const m=D(o).toVar(),y=O(e).toVar(),b=O(t).toVar(),_=O(s).toVar(),v=w(i).toVar(),M=w(r).toVar(),A=w(l).toVar(),C=Yi(u).toVar(),E=D(h).toVar(),F=w(d).toVar(),L=w(p).toVar(),U=y.mul(b).add(_),R=w(0).toVar();return Ae(m.equal(D(0)),()=>{R.assign(kd(U))}),Ae(m.equal(D(1)),()=>{R.assign(Ty(U))}),Ae(m.equal(D(2)),()=>{R.assign($v(U,v,D(0)))}),Ae(m.equal(D(3)),()=>{R.assign(vy(U,E,F,L))}),R.assign(R.mul(A.sub(M)).add(M)),Ae(C,()=>{R.assign(qn(R,M,A))}),R}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),p6=z(([o])=>{const e=o.y,t=o.z,s=O().toVar();return Ae(e.lessThan(1e-4),()=>{s.assign(O(t,t,t))}).Else(()=>{let i=o.x;i=i.sub(mr(i)).mul(6).toVar();const r=D(UT(i)),l=i.sub(w(r)),u=t.mul(e.oneMinus()),h=t.mul(e.mul(l).oneMinus()),d=t.mul(e.mul(l.oneMinus()).oneMinus());Ae(r.equal(D(0)),()=>{s.assign(O(t,d,u))}).ElseIf(r.equal(D(1)),()=>{s.assign(O(h,t,u))}).ElseIf(r.equal(D(2)),()=>{s.assign(O(u,t,d))}).ElseIf(r.equal(D(3)),()=>{s.assign(O(u,h,t))}).ElseIf(r.equal(D(4)),()=>{s.assign(O(d,u,t))}).Else(()=>{s.assign(O(t,u,h))})}),s}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),m6=z(([o])=>{const e=O(o).toVar(),t=w(e.x).toVar(),s=w(e.y).toVar(),i=w(e.z).toVar(),r=w(bi(t,bi(s,i))).toVar(),l=w(Ht(t,Ht(s,i))).toVar(),u=w(l.sub(r)).toVar(),h=w().toVar(),d=w().toVar(),p=w().toVar();return p.assign(l),Ae(l.greaterThan(0),()=>{d.assign(u.div(l))}).Else(()=>{d.assign(0)}),Ae(d.lessThanEqual(0),()=>{h.assign(0)}).Else(()=>{Ae(t.greaterThanEqual(l),()=>{h.assign(s.sub(i).div(u))}).ElseIf(s.greaterThanEqual(l),()=>{h.assign(ss(2,i.sub(t).div(u)))}).Else(()=>{h.assign(ss(4,t.sub(s).div(u)))}),h.mulAssign(1/6),Ae(h.lessThan(0),()=>{h.addAssign(1)})}),O(h,d,p)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),g6=z(([o])=>{const e=O(o).toVar(),t=yT(MT(e,O(.04045))).toVar(),s=O(e.div(12.92)).toVar(),i=O(bn(Ht(e.add(O(.055)),O(0)).div(1.055),O(2.4))).toVar();return $e(s,i,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),w3=(o,e)=>{o=w(o),e=w(e);const t=de(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Qi(o.sub(t),o.add(t),e)},R3=(o,e,t,s)=>$e(o,e,t[s].clamp()),y6=(o,e,t=xt())=>R3(o,e,t,"x"),x6=(o,e,t=xt())=>R3(o,e,t,"y"),b6=(o,e,t,s,i=xt())=>{const r=i.x.clamp(),l=i.y.clamp(),u=$e(o,e,r),h=$e(t,s,r);return $e(u,h,l)},E3=(o,e,t,s,i)=>$e(o,e,w3(t,s[i])),_6=(o,e,t,s=xt())=>E3(o,e,t,s,"x"),T6=(o,e,t,s=xt())=>E3(o,e,t,s,"y"),v6=(o=1,e=0,t=xt())=>t.mul(o).add(e),S6=(o,e=1)=>(o=w(o),o.abs().pow(e).mul(o.sign())),M6=(o,e=1,t=.5)=>w(o).sub(t).mul(e).add(t),A6=(o=xt(),e=1,t=0)=>qv(o.convert("vec2|vec3")).mul(e).add(t),N6=(o=xt(),e=1,t=0)=>kd(o.convert("vec2|vec3")).mul(e).add(t),w6=(o=xt(),e=1,t=0)=>(o=o.convert("vec2|vec3"),Te(kd(o),qv(o.add(de(19,73)))).mul(e).add(t)),R6=(o,e=xt(),t=de(1,1),s=de(0,0),i=1,r=0,l=1,u=!1,h=1,d=2,p=.5)=>d6(o,e.convert("vec2|vec3"),t,s,i,r,l,u,h,d,p),E6=(o,e=xt(),t=de(1,1),s=de(0,0),i=1,r=0,l=1,u=!1,h=1,d=2,p=.5)=>
87f6(o,e.convert("vec2|vec3"),t,s,i,r,l,u,h,d,p),C6=(o=xt(),e=1)=>l6(o.convert("vec2|vec3"),e,D(1)),B6=(o=xt(),e=1)=>c6(o.convert("vec2|vec3"),e,D(1)),D6=(o=xt(),e=1)=>$v(o.convert("vec2|vec3"),e,D(1)),U6=(o=xt())=>Yk(o.convert("vec2|vec3")),F6=(o=xt(),e=3,t=2,s=.5,i=1)=>Cg(o,D(e),t,s).mul(i),L6=(o=xt(),e=3,t=2,s=.5,i=1)=>e6(o,D(e),t,s).mul(i),O6=(o=xt(),e=3,t=2,s=.5,i=1)=>vy(o,D(e),t,s).mul(i),z6=(o=xt(),e=3,t=2,s=.5,i=1)=>t6(o,D(e),t,s).mul(i),P6=(o,e=w(0))=>ss(o,e),V6=(o,e=w(0))=>Ke(o,e),G6=(o,e=w(1))=>ze(o,e),I6=(o,e=w(1))=>Zi(o,e),k6=(o,e=w(1))=>Qg(o,e),H6=(o,e=w(1))=>bn(o,e),q6=(o=w(0),e=w(1))=>RT(o,e),$6=()=>Bc,W6=()=>OB,X6=(o,e=w(1))=>Ke(e,o),j6=(o,e,t,s)=>o.greaterThan(e).mix(t,s),Y6=(o,e,t,s)=>o.greaterThanEqual(e).mix(t,s),Z6=(o,e,t,s)=>o.equal(e).mix(t,s),Q6=(o,e=null)=>{if(typeof e=="string"){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},s=e.replace(/^out/,"").toLowerCase();if(t[s]!==void 0)return o.element(t[s])}if(typeof e=="number")return o.element(e);if(typeof e=="string"&&e.length===1){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return o.element(t[e])}return o},K6=(o,e=de(.5,.5),t=de(1,1),s=w(0),i=de(0,0))=>{let r=o;if(e&&(r=r.sub(e)),t&&(r=r.mul(t)),s){const l=s.mul(Math.PI/180),u=l.cos(),h=l.sin();r=de(r.x.mul(u).sub(r.y.mul(h)),r.x.mul(h).add(r.y.mul(u)))}return e&&(r=r.add(e)),i&&(r=r.add(i)),r},J6=(o,e)=>{o=de(o),e=w(e);const t=e.mul(Math.PI/180);return zd(o,t)},e8=(o,e,t)=>{o=O(o),e=w(e),t=O(t);const s=e.mul(Math.PI/180),i=t.normalize(),r=s.cos(),l=s.sin(),u=w(1).sub(r);return o.mul(r).add(i.cross(o).mul(l)).add(i.mul(i.dot(o)).mul(u))},t8=(o,e)=>(o=O(o),e=w(e),ov(o,e)),s8=z(([o,e,t])=>{const s=$s(o).toVar(),i=Ke(w(.5).mul(e.sub(t)),yr).div(s).toVar(),r=Ke(w(-.5).mul(e.sub(t)),yr).div(s).toVar(),l=O().toVar();l.x=s.x.greaterThan(w(0)).select(i.x,r.x),l.y=s.y.greaterThan(w(0)).select(i.y,r.y),l.z=s.z.greaterThan(w(0)).select(i.z,r.z);const u=bi(l.x,l.y,l.z).toVar();return yr.add(s.mul(u)).toVar().sub(t)}),C3=z(([o,e])=>{const t=o.x,s=o.y,i=o.z;let r=e.element(0).mul(.886227);
87return r=r.add(e.element(1).mul(2*.511664).mul(s)),r=r.add(e.element(2).mul(2*.511664).mul(i)),r=r.add(e.element(3).mul(2*.511664).mul(t)),r=r.add(e.element(4).mul(2*.429043).mul(t).mul(s)),r=r.add(e.element(5).mul(2*.429043).mul(s).mul(i)),r=r.add(e.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),r=r.add(e.element(7).mul(2*.429043).mul(t).mul(i)),r=r.add(e.element(8).mul(.429043).mul(ze(t,t).sub(ze(s,s)))),r});var T=Object.freeze({__proto__:null,BRDF_GGX:Mv,BRDF_Lambert:Ml,BasicPointShadowFilter:x3,BasicShadowFilter:u3,Break:j2,Const:mC,Continue:nV,DFGLUT:wd,D_GGX:cB,Discard:BC,EPSILON:Kg,F_Schlick:vc,Fn:z,HALF_PI:wz,INFINITY:Mz,If:Ae,Loop:yt,NodeAccess:Us,NodeShaderStage:ju,NodeType:jO,NodeUpdateType:Le,OnBeforeFrameUpdate:YP,OnBeforeMaterialUpdate:jP,OnBeforeObjectUpdate:XP,OnFrameUpdate:G2,OnMaterialUpdate:WP,OnObjectUpdate:Od,PCFShadowFilter:c3,PCFSoftShadowFilter:h3,PI:_g,PI2:Az,PointShadowFilter:b3,Return:Wz,Schlick_to_F0:R_,ShaderNode:tc,Stack:Xg,Switch:gz,TBNViewMatrix:dl,TWO_PI:Nz,VSMShadowFilter:d3,V_GGX_SmithCorrelated:uB,Var:pC,VarIntent:gC,abs:wt,acesFilmicToneMapping:jB,acos:wT,acosh:qE,add:ss,addMethodChaining:K,addNodeElement:Zz,agxToneMapping:YB,all:FE,alphaT:yg,ambientOcclusion:m_,and:_E,anisotropy:ro,anisotropyB:gl,anisotropyT:pd,any:LE,append:xz,array:dE,asin:kE,asinh:HE,assign:fE,atan:RT,atanh:$E,atomicAdd:S5,atomicAnd:w5,atomicFunc:Nr,atomicLoad:T5,atomicMax:A5,atomicMin:N5,atomicOr:R5,atomicStore:v5,atomicSub:M5,atomicXor:E5,attenuationColor:vT,attenuationDistance:TT,attribute:qi,attributeArray:gI,backgroundBlurriness:VB,backgroundIntensity:U_,backgroundRotation:GB,batch:q2,batchColor:mv,bentNormalView:c2,billboarding:KG,bitAnd:ME,bitNot:AE,bitOr:NE,bitXor:wE,bitangentGeometry:OP,bitangentLocal:zP,bitangentView:l2,bitangentWorld:PP,bitcast:FB,blendBurn:BI,blendColor:LI,blendDodge:DI,blendOverlay:FI,blendScreen:UI,blur:yB,bool:Yi,buffer:Rc,bufferAttribute:$T,builtin:ba,builtinAOContext:dC,builtinShadowContext:hC,bumpMap:ov,bvec2:rE,bvec3:yT,bvec4:aE,bypass:EC,cache:RC,call:pE,cameraFar:uo,cameraIndex:Ao,cameraNear:lo,cameraNormalMatrix:uP,cameraPosition:GC,cameraProjectionMatrix:ni,cameraProjectionMatrixInverse:VC,cameraViewMatrix:No,cameraViewport:cP,cameraWorldMatrix:Ld,cbrt:rC,cdl:GI,ceil:ey,checker:_k,cineonToneMapping:XB,clamp:qn,clearcoat:pg,clearcoatNormalView:co,clearcoatRoughness:ac,clipSpace:HC,code:xy,color:nE,colorSpaceToWorking:sy,colorToDirection:IP,compute:wC,computeKernel:XT,computeSkinning:sV,context:xa,convert:lE,convertColorSpace:Fz,convertToTexture:uI,cos:Pn,cosh:VE,countLeadingZeros:RG,countOneBits:EG,countTrailingZeros:wG,cross:ga,cubeTexture:ii,cubeTextureBase:rv,dFdx:BT,dFdy:DT,dashSize:yl,debug:UC,decrement:UE,decrementBefore:BE,defaultBuildStages:bm,defaultShaderStages:QR,defined:bc,degrees:zE,deltaTime:qG,densityFogFactor:e3,depth:_v,depthPass:WI,determinant:ZE,difference:eC,diffuseColor:gt,diffuseContribution:ll,directPointLight:T3,directionToColor:GP,directionToFaceDirection:MP,dispersion:ST,disposeShadowMaterial:p3,distance:JE,div:Zi,dot:Nn,drawIndex:NC,dynamicBufferAttribute:Vz,element:oE,emissive:p_,equal:mE,equirectDirection:N_,equirectUV:Tv,exp:AT,exp2:_c,exponentialHeightFogFactor:n5,expression:Ii,faceDirection:sv,faceForward:VT,faceforward:Rz,float:w,floatBitsToInt:MG,floatBitsToUint:LB,floor:mr,fog:F_,fract:Hn,frameGroup:_z,frameId:OB,frontFacing:qC,fwidth:FT,gain:BG,gapSize:Nd,getConstNodeType:iE,getCurrentStack:pT,getDirection:mB,getDistanceAttenuation:Hv,getGeometryRoughness:lB,getNormalFromDepth:hI,getParallaxCorrectNormal:s8,getRoughness:Sv,getScreenPosition:cI,getShIrradianceAt:C3,getShadowMaterial:f3,getShadowRenderObjectFunction:m3,getTextureIndex:DB,getViewPosition:Zu,ggxConvolution:xB,globalId:c5,glsl:t5,glslFn:s5,grayscale:OI,greaterThan:MT,greaterThanEqual:bE,hash:CG,highpModelNormalViewMatrix:y_,highpModelViewMatrix:g_,hue:VI,increment:DE,incrementBefore:CE,inspector:LC,instance:k2,instanceColor:pv,instanceIndex:kn,instancedArray:yI,instancedBufferAttribute:ny,instancedDynamicBufferAttribute:WT,instancedMesh:H2,int:D,intBitsToFloat:AG,interleavedGradientNoise:Bv,inverse:QE,inverseSqrt:NT,inversesqrt:Ez,invocationLocalIndex:kz,invocationSubgroupIndex:Iz,ior:md,iridescence:Yg,iridescenceIOR:mg,iridescenceThickness:gg,isolate:lc,ivec2:It,ivec3:gT,ivec4:xT,js:JI,label:fC,length:gr,lengthSq:zT,lessThan:yE,lessThanEqual:xE,lightPosition:Ov,lightProjectionUV:t3,lightShadowMatrix:_y,lightTargetDirection:Pv,lightTargetPosition:s3,lightViewPosition:zv,lightingContext:Z2,lights:ak,linearDepth:Ag,linearToneMapping:$B,localId:h5,log:Jg,log2:pr,logarithmicDepthToViewZ:fV,luminance:Uv,mat2:jg,mat3:vs,mat4:yo,matc
87apUV:_B,materialAO:P2,materialAlphaTest:d2,materialAnisotropy:w2,materialAnisotropyVector:Yu,materialAttenuationColor:L2,materialAttenuationDistance:F2,materialClearcoat:T2,materialClearcoatNormal:S2,materialClearcoatRoughness:v2,materialColor:f2,materialDispersion:z2,materialEmissive:m2,materialEnvIntensity:Sm,materialEnvRotation:Tg,materialIOR:U2,materialIridescence:R2,materialIridescenceIOR:E2,materialIridescenceThickness:C2,materialLightMap:fv,materialLineDashOffset:dv,materialLineDashSize:cv,materialLineGapSize:hv,materialLineScale:uv,materialLineWidth:vg,materialMetalness:b2,materialNormal:_2,materialOpacity:lv,materialPointSize:O2,materialReference:ra,materialReflectivity:Mm,materialRefractionRatio:XC,materialRotation:M2,materialRoughness:x2,materialSheen:A2,materialSheenRoughness:N2,materialShininess:p2,materialSpecular:g2,materialSpecularColor:y2,materialSpecularIntensity:v_,materialSpecularStrength:gd,materialThickness:D2,materialTransmission:B2,max:Ht,maxMipLevel:ZT,mediumpModelViewMatrix:kC,metalness:oa,min:bi,mix:$e,mixElement:oC,mod:Qg,modelDirection:yP,modelNormalMatrix:IC,modelPosition:xP,modelRadius:TP,modelScale:bP,modelViewMatrix:Sr,modelViewPosition:_P,modelViewProjection:V2,modelWorldMatrix:_n,modelWorldMatrixInverse:vP,morphReference:Y2,mrt:UB,mul:ze,mx_aastep:w3,mx_add:P6,mx_atan2:q6,mx_cell_noise_float:U6,mx_contrast:M6,mx_divide:I6,mx_fractal_noise_float:F6,mx_fractal_noise_vec2:L6,mx_fractal_noise_vec3:O6,mx_fractal_noise_vec4:z6,mx_frame:W6,mx_heighttonormal:t8,mx_hsvtorgb:p6,mx_ifequal:Z6,mx_ifgreater:j6,mx_ifgreatereq:Y6,mx_invert:X6,mx_modulo:k6,mx_multiply:G6,mx_noise_float:A6,mx_noise_vec3:N6,mx_noise_vec4:w6,mx_place2d:K6,mx_power:H6,mx_ramp4:b6,mx_ramplr:y6,mx_ramptb:x6,mx_rgbtohsv:m6,mx_rotate2d:J6,mx_rotate3d:e8,mx_safepower:S6,mx_separate:Q6,mx_splitlr:_6,mx_splittb:T6,mx_srgb_texture_to_lin_rec709:g6,mx_subtract:V6,mx_timer:$6,mx_transform_uv:v6,mx_unifiednoise2d:R6,mx_unifiednoise3d:E6,mx_worley_noise_float:C6,mx_worley_noise_vec2:B6,mx_worley_noise_vec3:D6,negate:CT,negateOnBackSide:Dl,neutralToneMapping:ZB,nodeArray:ml,nodeImmutable:ge,nodeObject:ve,nodeObjectIntent:sd,nodeObjects:Wg,nodeProxy:Ie,nodeProxyConstructor:fT,nodeProxyIntent:ue,normalFlat:$C,normalGeometry:ay,normalLocal:Xs,normalMap:T_,normalView:st,normalViewGeometry:Tc,normalWorld:wo,normalWorldGeometry:WC,normalize:$s,not:vE,notEqual:gE,numWorkgroups:l5,objectDirection:hP,objectGroup:hE,objectPosition:fP,objectRadius:gP,objectScale:pP,objectViewPosition:mP,objectWorldMatrix:dP,oneMinus:WE,or:TE,orthographicDepthToViewZ:K2,oscSawtooth:jG,oscSine:$G,oscSquare:WG,oscTriangle:XG,output:oc,outputStruct:_G,overloadingFn:Fs,overrideNode:wB,overrideNodes:RB,packHalf2x16:OG,packNormalToRGB:av,packSnorm2x16:FG,packUnorm2x16:LG,parabola:D_,parallaxDirection:u2,parallaxUV:VP,parameter:pG,pass:qI,passTexture:$I,pcurve:DG,perspectiveDepthToViewZ:dy,pmremTexture:Nv,pointShadow:_3,pointUV:bI,pointWidth:bz,positionGeometry:Is,positionLocal:Pt,positionPrevious:Sl,positionView:Zt,positionViewDirection:vt,positionWorld:yr,positionWorldDirection:tv,posterize:II,pow:bn,pow2:LT,pow3:tC,pow4:OT,premultiplyAlpha:YT,property:ya,quadBroadcast:ek,quadSwapDiagonal:j5,quadSwapX:W5,quadSwapY:X5,radians:OE,rand:aC,range:a5,rangeFogFactor:JB,reciprocal:jE,reference:Ct,referenceBuffer:JC,reflect:KE,reflectVector:ZC,reflectView:jC,reflector:nI,refract:PT,refractVector:QC,refractView:YC,reinhardToneMapping:WB,remap:jT,remapClamp:CC,renderGroup:Re,renderOutput:ry,rendererReference:vC,replaceDefaultUV:YG,rotate:zd,rotateUV:ZG,roughness:lr,round:XE,rtt:PB,sRGBTransferEOTF:xC,sRGBTransferOETF:bC,sample:fI,sampler:sP,samplerComparison:iP,saturate:ty,saturation:zI,screenCoordinate:Bl,screenDPR:JT,screenSize:vl,screenUV:In,select:Hs,setCurrentStack:Ad,setName:IT,shaderStages:_m,shadow:y3,shadowPositionWorld:Gv,shapeCircle:Tk,sharedUniformGroup:Zg,sheen:Pi,sheenRoughness:oo,shiftLeft:RE,shiftRight:EE,shininess:xg,sign:ET,sin:ti,sinc:UG,sinh:PE,skinning:X2,smoothstep:Qi,smoothstepElement:lC,specularColor:To,specularColorBlended:cl,specularF90:hl,spherizeUV:QG,split:yz,spritesheetUV:eI,sqrt:ai,stack:Nm,step:_l,stepElement:uC,storage:xo,storageBarrier:m5,storageTexture:kB,storageTexture3D:vI,struct:bG,sub:Ke,subBuild:xl,subgroupAdd:D5,subgroupAll:H5,subgroupAnd:P5,subgroupAny:q5,subgroupBallot:B5,subgroupBroadcast:Y5,subgroupBroadcastFirst:$5,subgroupElect:C5,subgroupExclusiveAdd:F5,subgroupExclusiveMul:z5,subgroupInclusiveAdd:U5,subgroupInclusiveMul:O5,subgroupIndex:Gz,subgroupMax:k5,subgroupMin:I5,subgroupMul:L5,subgroupOr:V5,subgroupShuffle:Z5,subgroupShuffleDown:J5,subgroupShuffleUp:K5,subgroupShuffleXor:Q5,subgroupSize:d5,subgroupXor:G5,tan:GE,tangentGeometry:ly,tangentLocal:vo,tangentView:uy,tangentWorld:o2,tanh:IE,texture:it,texture3D:Dv,texture3DLevel:NI,texture3DLoad:AI,textureBarrier:g5,textureBicubic:jV,textureBicubicLevel:Av,textureCubeUV:gB,textureLevel:tP,textureLoad:Yt,textureSize:Tl,textureStore:_I,thickness:_T,time:Bc,toneMapping:SC,toneMappingExposure:MC,toonOutlinePass:jI,transformDirection:sC,transformNormal:iv,transformNormalByInverseViewMatrix:nC,transformNormalByViewMatrix:iC,transformNormalToView:nv,transformedClearcoatNormalView:wP,transformedNormalView:AP,transformedNormalWorld:NP,transmission:bg,transpose:YE,triNoise3D:IG,triplanarTexture:tI,triplanarTextures:zB,trunc:UT,uint:ae,uintBitsToFloat:NG,uniform:Se,uniformArray:Bs,uniformCubeTexture:EP,uniformFlow:cC,uniformGroup:cE,uniformTexture:eP,unpackHalf2x16:VG,unpackNormal:__,unpackRGBToNormal:h2,unpackSnorm2x16:zG,unpackUnorm2x16:PG,unpremultiplyAlpha:DC,userData:RI,uv:xt,uvec2:mT,uvec3:El,uvec4:bT,varying:Mo,varyingProperty:Cl,vec2:de,vec3:O,vec4:Te,vectorComponents:wl,velocity:CI,vertexColor:tB,vertexIndex:AC,vertexStage:yC,vibrance:PI,viewZToLogarithmicDepth:fy,viewZToOrthographicDepth:bl,viewZToPerspectiveDepth:bv,viewZToReversedOrthographicDepth:dV,viewZToReversedPerspectiveDepth:J2,viewport:uc,viewportCoordinate:PC,viewportDepthTexture:xv,viewportLinearDepth:pV,viewportMipTexture:yv,viewportOpaqueMipTexture:Q2,viewportResolution:lP,viewportSafeUV:JG,viewportSharedTexture:HI,viewportSize:ev,viewportTexture:uV,viewportUV:oP,vogelDiskSample:Gn,wgsl:e5,wgslFn:i5,workgroupArray:b5,workgroupBarrier:p5,workgroupId:u5,workingToColorSpace:_C,xor:SE});const Ln=new wv;class i8 extends Ro{constructor(e,t){super(),this.renderer=e,this.nodes=t}
87update(e,t,s){const i=this.renderer,r=this.nodes.getBackgroundNode(e)||e.background;let l=!1;if(r===null)i._clearColor.getRGB(Ln),Ln.a=i._clearColor.a;else if(r.isColor===!0)r.getRGB(Ln),Ln.a=1,l=!0;else if(r.isNode===!0){const d=this.get(e),p=r;Ln.copy(i._clearColor);let m=d.backgroundMesh;if(m===void 0){let F=function(){r.removeEventListener("dispose",F),m.material.dispose(),m.geometry.dispose()};var h=F;const b=Te(p).mul(U_).context({getUV:()=>GB.mul(WC),getTextureLevel:()=>VB}),_=ni.element(3).element(3).equal(1),v=Zi(1,ni.element(1).element(1)).mul(3),M=_.select(Pt.mul(v),Pt),A=Sr.mul(Te(M,0));let C=ni.mul(Te(A.xyz,1));C=C.setZ(C.w);const E=new Bt;E.name="Background.material",E.side=Ts,E.depthTest=!1,E.depthWrite=!1,E.allowOverride=!1,E.fog=!1,E.lights=!1,E.vertexNode=C,E.colorNode=b,d.backgroundMeshNode=b,d.backgroundMesh=m=new Tr(new kg(1,32,32),E),m.frustumCulled=!1,m.name="Background.mesh",r.addEventListener("dispose",F)}const y=p.getCacheKey();d.backgroundCacheKey!==y&&(d.backgroundMeshNode.node=Te(p).mul(U_),d.backgroundMeshNode.needsUpdate=!0,m.material.needsUpdate=!0,d.backgroundCacheKey=y),t.unshift(m,m.geometry,m.material,0,0,null,null)}else he("Renderer: Unsupported background configuration.",r);const u=i.xr.getEnvironmentBlendMode();if(u==="additive"?Ln.set(0,0,0,1):u==="alpha-blend"&&Ln.set(0,0,0,0),i.autoClear===!0||l===!0){const d=s.clearColorValue;d.r=Ln.r,d.g=Ln.g,d.b=Ln.b,d.a=Ln.a,(i.backend.isWebGLBackend===!0||i.alpha===!0)&&(d.r*=d.a,d.g*=d.a,d.b*=d.a),s.depthClearValue=i.getClearDepth(),s.stencilClearValue=i.getClearStencil(),s.clearColor=i.autoClearColor===!0,s.clearDepth=i.autoClearDepth===!0,s.clearStencil=i.autoClearStencil===!0}else s.clearColor=!1,s.clearDepth=!1,s.clearStencil=!1}}let n8=0;class L_{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=n8++}}class r8{constructor(e,t,s,i,r,l,u,h,d,p,m=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=s,this.transforms=m,this.nodeAttributes=i,this.bindings=r,this.updateNodes=l,this.updateBeforeNodes=u,this.updateAfterNodes=h,this.observer=d,this.hardwareClipping=p,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const i=new L_(t.name,[]);e.push(i);for(const r of t.bindings)i.bindings.push(r.clone())}else e.push(t);return e}}class ww{constructor(e,t,s=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=s}}class a8{constructor(e,t,s){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=s}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class B3{constructor(e,t,s=!1,i=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=s,this.count=i}}class o8 extends B3{constructor(e,t,s=null,i=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=s,this.interpolationSampling=i}}class l8{constructor(e,t,s=""){this.name=e,this.type=t,this.code=s,Object.defineProperty(this,"isNodeCode",{value:!0})}}let u8=0;class Gb{constructor(e=null){this.id=u8++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class c8{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class Eo{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}}class h8 extends Eo{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class d8 extends Eo{constructor(e,t=new Fe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class f8 extends Eo{constructor(e,t=new H){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class p8 extends Eo{constructor(e,t=new ht){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class m8 extends Eo{constructor(e,t=new Xe){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class g8 extends Eo{constructor(e,t=new Hg){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}
87class y8 extends Eo{constructor(e,t=new js){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class x8 extends Eo{constructor(e,t=new Qe){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class b8 extends h8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class _8 extends d8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class T8 extends f8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class v8 extends p8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class S8 extends m8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class M8 extends g8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class A8 extends y8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class N8 extends x8{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let w8=0;const Rw=new WeakMap,Ew=new WeakMap,R8=new WeakMap,E8=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),em=o=>/e/g.test(o)?String(o).replace(/\+/g,""):(o=Number(o),o+(o%1?"":".0")),D3=o=>{if(o.writeUsageCount>0)return!0;if(o.subBuildsCache!==void 0){for(const e in o.subBuildsCache)if(D3(o.subBuildsCache[e]))return!0}return!1};class U3{constructor(e,t,s){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=s,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=Nm(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Gb,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:w8++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){const e=this.material;return e.transparent===!1&&e.blending===gn&&e.alphaToCoverage===!1}createRenderTarget(e,t,s){return new $i(e,t,s)}createCubeRenderTarget(e,t){return new iB(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4";const s=this.renderer.getRenderTarget();if(s!==null){const i=s.textures[e].type,r=s.textures[e].format;let l="vec";i===ps?l="ivec":i===Ut&&(l="uvec"),r===Mc||r===Ac?i===ps?t="int":i===Ut?t="uint":t="float":r===xn||r===Nc?t=`${l}2`:r===Sc||r===j_?t=`${l}3`:t=`${l}4`}return t}getOutputStructName(){}_getBindGroup(e,t){const s=t[0].groupNode;let i=s.shared;if(i)for(let l=1;l<t.length;l++)s!==t[l].groupNode&&(i=!1);let r;if(i){let l="";for(const p of t)if(p.isNodeUniformsGroup){p.uniforms.sort((m,y)=>m.nodeUniform.node.id-y.nodeUniform.node.id);for(const m of p.uniforms)l+=m.nodeUniform.node.id}else l+=p.nodeUniform.id;const u=this.renderer._currentRenderContext||this.renderer;let h=Rw.get(u);h===void 0&&(h=new Map,Rw.set(u,h));const d=wc(l);r=h.get(d),r===void 0&&(r=new L_(e,t),h.set(d,r))}else r=new L_(e,t);return r}getBindGroupArray(e,t){const s=this.bindings[t];let i=s[e];return i===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),s[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(e===null){const t={},s=this.bindings;for(const i of _m)for(const r in s[i]){const l=s[i][r],u=t[r]||(t[r]=[]);for(const h of l)u.includes(h)===!1&&u.push(h)}e=[];for(const i in t){const r=t[i],l=this._getBindGroup(i,r);e.push(l)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((t,s)=>t.bindings[0].groupNode.order-s.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){const s=e[t];this.bindingsIndexes[s.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){const t=e.getUpdateBeforeType(),s=e.getUpdateAfterType();
87(t!==Le.NONE||s!==Le.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(const e of this.nodes)e.getUpdateType()!==Le.NONE&&this.updateNodes.push(e);for(const e of this.sequentialNodes){const t=e.getUpdateBeforeType(),s=e.getUpdateAfterType();t!==Le.NONE&&this.updateBeforeNodes.push(e),s!==Le.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Ss||e.magFilter===n_||e.magFilter===mc||e.magFilter===ca||e.minFilter===Ss||e.minFilter===n_||e.minFilter===mc||e.minFilter===ca}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){const t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){const e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){const s=this.getDataFromNode(e);return s.cache===void 0&&(s.cache=new Gb(t?this.getCache():null)),s.cache}isAvailable(){return!1}getVertexIndex(){me("Abstract function.")}getInstanceIndex(){me("Abstract function.")}getDrawIndex(){me("Abstract function.")}getFrontFacing(){me("Abstract function.")}getFragCoord(){me("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){const t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){const t=e.getShared(this),i=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(i!==void 0){for(const r in i)if(D3(i[r]))return!0}return!1}generateTexture(){me("Abstract function.")}generateTextureLod(){me("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,s=null){let i=this.generateArrayDeclaration(e,t)+"( ";for(let r=0;r<t;r++){const l=s?s[r]:null;l!==null?i+=l.build(this,e):i+=this.generateConst(e),r<t-1&&(i+=", ")}return i+=" )",i}generateStruct(e,t,s=null){const i=[];for(const r of t){const{name:l,type:u}=r;s&&s[l]&&s[l].isNode?i.push(s[l].build(this,u)):i.push(this.generateConst(u))}return e+"( "+i.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new Xe:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Fe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new H:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new ht)),e==="float")return em(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${em(t.r)}, ${em(t.g)}, ${em(t.b)} )`;const s=this.getTypeLength(e),i=this.getComponentType(e),r=l=>this.generateConst(i,l);if(s===2)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)} )`;if(s===3)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)} )`;if(s===4&&e!=="mat2")return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)}, ${r(t.w)} )`;if(s>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(r).join(", ")} )`;if(s>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){const s=this.attributes;for(const r of s)if(r.name===e)return r;const i=new ww(e,t);return this.registerDeclaration(i),s.push(i),i}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;return e.isDepthTexture===!0?"float":t===ps?"int":t===Ut?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let s=jR(e);const i=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(s=s.replace("vec","mat")),i+s}getTypeFromArray(e){return E8.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const s=t.array,i=e.itemSize,r=e.normalized;let l;return!(e instanceof IR)&&r!==!0&&(l=this.getTypeFromArray(s)),this.getTypeFromLength(i,l)}getTypeLength(e){const t=this.getVectorType(e),s=/vec([2-4])/.exec(t);return s!==null?Number(s[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}
87addStack(){this.stack=Nm(this.stack);const e=pT();return this.stacks.push(e),Ad(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){const s=this.getDataFromNode(t);s.stack=e}return this.stack=e.parent,Ad(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,s=null){s=s===null?e.isGlobal(this)?this.globalCache:this.cache:s;let i=s.getData(e);i===void 0&&(i={},s.setData(e,i)),i[t]===void 0&&(i[t]={});let r=i[t];if(this.subBuildLayers.length===0)return r;const l=i.any?i.any.subBuilds:null,u=this.getClosestSubBuild(l);return u&&(r.subBuildsCache===void 0&&(r.subBuildsCache={}),r=r.subBuildsCache[u]||(r.subBuildsCache[u]={}),r.subBuilds=l),r}getNodeProperties(e,t="any"){const s=this.getDataFromNode(e,t);return s.properties||(s.properties={outputNode:null})}getBufferAttributeFromNode(e,t,s=null){const i=this.getDataFromNode(e,"vertex");let r=i.bufferAttribute;if(r===void 0){const l=this.uniforms.index++;s===null&&(s="nodeAttribute"+l),r=new ww(s,t,e),this.bufferAttributes.push(r),i.bufferAttribute=r}return r}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,s=null,i=this.shaderStage){const r=this.getDataFromNode(e,i,this.globalCache);let l=r.structType;if(l===void 0){const u=this.structs.index++;s===null&&(s="StructType"+u),l=new c8(s,t),this.structs[i].push(l),this.types[i][s]=e,r.structType=l}return l}getOutputStructTypeFromNode(e,t){const s=this.getStructTypeFromNode(e,t,"OutputType","fragment");return s.output=!0,s}getUniformFromNode(e,t,s=this.shaderStage,i=null){const r=this.getDataFromNode(e,s,this.globalCache);let l=r.uniform;if(l===void 0){const u=this.uniforms.index++;l=new a8(i||"nodeUniform"+u,t,e),this.uniforms[s].push(l),this.registerDeclaration(l),r.uniform=l}return l}getVarFromNode(e,t=null,s=e.getNodeType(this),i=this.shaderStage,r=!1){const l=this.getDataFromNode(e,i),u=this.getSubBuildProperty("variable",l.subBuilds);let h=l[u];if(h===void 0){const d=r?"_const":"_var",p=this.vars[i]||(this.vars[i]=[]),m=this.vars[d]||(this.vars[d]=0);t===null&&(t=(r?"nodeConst":"nodeVar")+m,this.vars[d]++),u!=="variable"&&(t=this.getSubBuildProperty(t,l.subBuilds));const y=e.getArrayCount(this);h=new B3(t,s,r,y),r||p.push(h),this.registerDeclaration(h),l[u]=h}return h}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(const t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,s=e.getNodeType(this),i=null,r=null){const l=this.getDataFromNode(e,"any"),u=this.getSubBuildProperty("varying",l.subBuilds);let h=l[u];if(h===void 0){const d=this.varyings,p=d.length;t===null&&(t="nodeVarying"+p),u!=="varying"&&(t=this.getSubBuildProperty(t,l.subBuilds)),h=new o8(t,s,i,r),d.push(h),this.registerDeclaration(h),l[u]=h}return h}registerDeclaration(e){const t=this.shaderStage,s=this.declarations[t]||(this.declarations[t]={}),i=e.name;let r=i,l=this.getPropertyName(e),u=1;for(;s[l]!==void 0;)r=i+"_"+u++,e.name=r,l=this.getPropertyName(e);r!==i&&me(`TSL: Declaration name '${i}' of '${e.type}' already in use. Renamed to '${r}'.`),s[l]=e}getCodeFromNode(e,t,s=this.shaderStage){const i=this.getDataFromNode(e);let r=i.code;if(r===void 0){const l=this.codes[s]||(this.codes[s]=[]),u=l.length;r=new l8("nodeCode"+u,t),l.push(r),i.code=r}return r}addFlowCodeHierarchy(e,t){const{flowCodes:s,flowCodeBlock:i}=this.getDataFromNode(e);let r=!0,l=t;for(;l;){if(i.get(l)===!0){r=!1;break}l=this.getDataFromNode(l).parentNodeBlock}if(r)for(const u of s)this.addLineFlowCode(u)}addLineFlowCodeBlock(e,t,s){const i=this.getDataFromNode(e),r=i.flowCodes||(i.flowCodes=[]),l=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);r.push(t),l.set(s,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`; 88`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),s=this.flowChildNode(e,t);return this.flowsData.set(e,s),s}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=this.renderer.backend;let s=Ew.get(t);s===void 0&&(s=new WeakMap,Ew.set(t,s));let i=s.get(e);if(i===void 0){i=new QB;const r=this.currentFunctionNode;this.currentFunctionNode=i,i.code=this.buildFunctionCode(e),this.currentFunctionNode=r,s.set(e,i)}return i}flowShaderNode(e){const t=e.layout,s={[Symbol.iterator](){let l=0;const u=Object.values(this);return{next:()=>({value:u[l],done:l++>=u.length})}}};
88for(const l of t.inputs)s[l.name]=new EB(l.type,l.name);e.layout=null;const i=e.call(s),r=this.flowStagesNode(i,t.type);return e.layout=t,r}flowBuildStage(e,t,s=null){const i=this.getBuildStage();this.setBuildStage(t);const r=e.build(this,s);return this.setBuildStage(i),r}flowStagesNode(e,t=null){const s=this.flow,i=this.vars,r=this.declarations,l=this.cache,u=this.buildStage,h=this.stack,d={code:""};this.flow=d,this.vars={},this.declarations={},this.cache=new Gb,this.stack=Nm();for(const p of bm)this.setBuildStage(p),d.result=e.build(this,t);return d.vars=this.getVars(this.shaderStage),this.flow=s,this.vars=i,this.declarations=r,this.cache=l,this.stack=h,this.setBuildStage(u),d}getFunctionOperator(){return null}buildFunctionCode(){me("Abstract function.")}flowChildNode(e,t=null){const s=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=s,i}flowNodeFromShaderStage(e,t,s=null,i=null){const r=this.tab,l=this.cache,u=this.shaderStage,h=this.context;this.setShaderStage(e);const d={...this.context};delete d.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=d;let p=null;if(this.buildStage==="generate"){const m=this.flowChildNode(t,s);i!==null&&(m.code+=`${this.tab+i} = ${m.result}; 89`),this.flowCode[e]=this.flowCode[e]+m.code,p=m}else p=t.build(this);return this.setShaderStage(u),this.cache=l,this.tab=r,this.context=h,p}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){me("Abstract function.")}getVaryings(){me("Abstract function.")}getVar(e,t,s=null){return`${s!==null?this.generateArrayDeclaration(e,s):this.getType(e)} ${t}`}getVars(e,t=!1){const s=[],i=this.vars[e];if(i!==void 0)for(const r of i)s.push(`${this.getVar(r.type,r.name,r.count)};`);return s.join(t?` 90`:` 91 `)}getUniforms(){me("Abstract function.")}getCodes(e){const t=this.codes[e];let s="";if(t!==void 0)for(const i of t)s+=i.code+` 92`;return s}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){me("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;const s=this.subBuildLayers;for(let i=t.length-1;i>=0;i--){const r=t[i];if(s.includes(r))return r}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let s;t!==null?s=this.getClosestSubBuild(t):s=this.subBuildFn;let i;return s?i=e?s+"_"+e:s:i=e,i}prebuild(){const{object:e,renderer:t,material:s}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:he('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),s&&s.contextNode&&(s.contextNode.isContextNode===!0?this.context={...this.context,...s.contextNode.getFlowContextData()}:he('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),s!==null){let i=t.library.fromMaterial(s);i===null&&(he(`NodeBuilder: Material "${s.type}" is not compatible.`),i=new Bt),i.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(const e of bm){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of _m){this.setShaderStage(t);const s=this.flowNodes[t];for(const i of s)e==="generate"?this.flowNode(i):i.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(const e of bm){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const t of _m){this.setShaderStage(t);const s=this.flowNodes[t];for(const i of s)e==="generate"?this.flowNode(i):i.build(this);await OR()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUp
92dateNodes(),this}getSharedDataFromNode(e){let t=R8.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){const s=this.getSharedDataFromNode(e);let i=s.cache;if(i===void 0){if(t==="float"||t==="int"||t==="uint")i=new b8(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")i=new _8(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")i=new T8(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")i=new v8(e);else if(t==="color")i=new S8(e);else if(t==="mat2")i=new M8(e);else if(t==="mat3")i=new A8(e);else if(t==="mat4")i=new N8(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);s.cache=i}return i}format(e,t,s){if(t=this.getVectorType(t),s=this.getVectorType(s),t===s||s===null||this.isReference(s))return e;const i=this.getTypeLength(t),r=this.getTypeLength(s);return i===16&&r===9?`${this.getType(s)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:i===9&&r===4?`${this.getType(s)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:i>4||r>4||r===0?e:i===r?`${this.getType(s)}( ${e} )`:i>r?(e=s==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,r)}`,this.format(e,this.getTypeFromLength(r,this.getComponentType(t)),s)):r===4&&i>1?`${this.getType(s)}( ${this.format(e,t,"vec3")}, 1.0 )`:i===2?`${this.getType(s)}( ${this.format(e,t,"vec2")}, 0.0 )`:(i===1&&r>1&&t!==this.getComponentType(s)&&(e=`${this.getType(this.getComponentType(s))}( ${e} )`),`${this.getType(s)}( ${e} )`)}getSignature(){return`// Three.js r${Ed} - Node System 93`}needsPreviousData(){const e=this.renderer.getMRT();return e&&e.has("velocity")||ZR(this.object).useVelocity===!0}}class Cw{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let s=e.get(t);return s===void 0&&(s={renderId:0,frameId:0},e.set(t,s)),s}updateBeforeNode(e){const t=e.getUpdateBeforeType(),s=e.updateReference(this);if(t===Le.FRAME){const i=this._getMaps(this.updateBeforeMap,s);if(i.frameId!==this.frameId){const r=i.frameId;i.frameId=this.frameId,e.updateBefore(this)===!1&&(i.frameId=r)}}else if(t===Le.RENDER){const i=this._getMaps(this.updateBeforeMap,s);if(i.renderId!==this.renderId){const r=i.renderId;i.renderId=this.renderId,e.updateBefore(this)===!1&&(i.renderId=r)}}else t===Le.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),s=e.updateReference(this);if(t===Le.FRAME){const i=this._getMaps(this.updateAfterMap,s);i.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(i.frameId=this.frameId)}else if(t===Le.RENDER){const i=this._getMaps(this.updateAfterMap,s);i.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(i.renderId=this.renderId)}else t===Le.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),s=e.updateReference(this);if(t===Le.FRAME){const i=this._getMaps(this.updateMap,s);i.frameId!==this.frameId&&e.update(this)!==!1&&(i.frameId=this.frameId)}else if(t===Le.RENDER){const i=this._getMaps(this.updateMap,s);i.renderId!==this.renderId&&e.update(this)!==!1&&(i.renderId=this.renderId)}else t===Le.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class Wv{constructor(e,t,s=null,i="",r=!1){this.type=e,this.name=t,this.count=s,this.qualifier=i,this.isConst=r}}Wv.isNodeFunctionInput=!0;class C8 extends Ul{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class B8 extends Ul{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:Pv(this.light),lightColor:e}}}class D8 extends Ul{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=Ov(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Se(new Xe).setGroup(Re)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:s,lightDirectionNode:i}=this,l=wo.dot(i).mul(.5).add(.5),u=$e(s,t,l);
93e.context.irradiance.addAssign(u)}}class Xv extends Ul{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Se(0).setGroup(Re),this.penumbraCosNode=Se(0).setGroup(Re),this.cutoffDistanceNode=Se(0).setGroup(Re),this.decayExponentNode=Se(0).setGroup(Re),this.colorNode=Se(this.color).setGroup(Re)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:s,penumbraCosNode:i}=this;return Qi(s,i,t)}getLightCoord(e){const t=e.getNodeProperties(this);let s=t.projectionUV;return s===void 0&&(s=t3(this.light,e.context.positionWorld),t.projectionUV=s),s}setupDirect(e){const{colorNode:t,cutoffDistanceNode:s,decayExponentNode:i,light:r}=this,l=this.getLightVector(e),u=l.normalize(),h=u.dot(Pv(r)),d=this.getSpotAttenuation(e,h),p=l.length(),m=Hv({lightDistance:p,cutoffDistance:s,decayExponent:i});let y=t.mul(d).mul(m),b,_;return r.colorNode?(_=this.getLightCoord(e),b=r.colorNode(_)):r.map&&(_=this.getLightCoord(e),b=it(r.map,_.xy).onRenderUpdate(()=>r.map)),b&&(y=_.mul(2).sub(1).abs().lessThan(1).all().select(y.mul(b),y)),{lightColor:y,lightDirection:u}}}class U8 extends Xv{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){const s=this.light.iesMap;let i=null;if(s&&s.isTexture===!0){const r=t.acos().mul(1/Math.PI);this._iesTextureNode=it(s,de(r,0),0),i=this._iesTextureNode.r}else i=super.getSpotAttenuation(e,t);return i}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}}class F8 extends Ul{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let s=0;s<9;s++)t.push(new H);this.lightProbe=Bs(t)}update(e){const{light:t}=this;super.update(e);for(let s=0;s<9;s++)this.lightProbe.array[s].copy(t.sh.coefficients[s]).multiplyScalar(t.intensity)}setup(e){const t=C3(wo,this.lightProbe);e.context.irradiance.addAssign(t)}}const L8=z(([o,e])=>{const t=o.abs().sub(e);return gr(Ht(t,0)).add(bi(Ht(t.x,t.y),0))});class O8 extends Xv{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let s=1;t.map!==null&&(s=t.map.width/t.map.height),t.shadow.aspect=s}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=w(0),s=this.penumbraCosNode,i=_y(this.light).mul(e.context.positionWorld||yr);return Ae(i.w.greaterThan(0),()=>{const r=i.xyz.div(i.w),l=L8(r.xy.sub(de(.5)),de(.5)),u=Zi(-1,Ke(1,wT(s)).sub(1));t.assign(ty(l.mul(-2).mul(u)))}),t}}const Ib=new Qe,tm=new Qe;let Wh=null;class z8 extends Ul{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Se(new H).setGroup(Re),this.halfWidth=Se(new H).setGroup(Re),this.updateType=Le.RENDER}update(e){super.update(e);const{light:t}=this,s=e.camera.matrixWorldInverse;tm.identity(),Ib.copy(t.matrixWorld),Ib.premultiply(s),tm.extractRotation(Ib),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(tm),this.halfHeight.value.applyMatrix4(tm)}setupDirectRectArea(e){let t,s;e.isAvailable("float32Filterable")?(t=it(Wh.LTC_FLOAT_1),s=it(Wh.LTC_FLOAT_2)):(t=it(Wh.LTC_HALF_1),s=it(Wh.LTC_HALF_2));const{colorNode:i,light:r}=this,l=zv(r);return{lightColor:i,lightPosition:l,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:s}}static setLTC(e){Wh=e}}class F3{parseFunction(){me("Abstract function.")}}class jv{constructor(e,t,s="",i=""){this.type=e,this.inputs=t,this.name=s,this.precision=i}getCode(){me("Abstract function.")}}jv.isNodeFunction=!0;const P8=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,V8=/[a-z_0-9]+/ig,Bw="#pragma main",G8=o=>{o=o.trim();const e=o.indexOf(Bw),t=e!==-1?o.slice(e+Bw.length):o,s=t.match(P8);if(s!==null&&s.length===5){const i=s[4],r=[];let l=null;for(;(l=V8.exec(i))!==null;)r.push(l);const u=[];let h=0;for(;h<r.length;){const _=r[h][0]==="const";_===!0&&h++;let v=r[h][0];v==="in"||v==="out"||v==="inout"?h++:v="";const M=r[h++][0];let A=Number.parseInt(r[h][0]);Number.isNaN(A)===!1?h++:A=null;const C=r[h++][0];u.push(new Wv(M,C,A,v,_))}const d=t.substring(s[0].length),p=s[3]!==void 0?s[3]:"",m=s[2],y=s[1]!==void 0?s[1]:"",b=e!==-1?o.slice(0,e):"";return{type:m,inputs:u,name:p,precision:y,inputsCode:i,blockCode:d,headerCode:b}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")};class I8 extends jv{constructor(e){const{type:t,inputs:s,name:i,precision:r,
93inputsCode:l,blockCode:u,headerCode:h}=G8(e);super(t,s,i,r),this.inputsCode=l,this.blockCode=u,this.headerCode=h}getCode(e=this.name){let t;const s=this.blockCode;if(s!==""){const{type:i,inputsCode:r,headerCode:l,precision:u}=this;let h=`${i} ${e} ( ${r.trim()} )`;u!==""&&(h=`${u} ${h}`),t=l+h+s}else t="";return t}}class k8 extends F3{parseFunction(e){return new I8(e)}}const cn=[],Zr=[],Dw=Se(0,"int").setGroup(Re);class H8 extends Ro{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new Cw,this.nodeBuilderCache=new Map,this.callHashCache=new So,this.groupsData=new So,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){const t=e.groupNode;if(t.updateType===Le.OBJECT)return!0;cn[0]=t,cn[1]=e;let s=this.groupsData.get(cn);return s===void 0&&this.groupsData.set(cn,s={}),cn[0]=null,cn[1]=null,s.version!==t.version?(s.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){const s=this.backend.createNodeBuilder(e.object,this.renderer);return s.scene=e.scene,s.material=t,s.camera=e.camera,s.context.material=t,s.lightsNode=e.lightsNode,s.environmentNode=this.getEnvironmentNode(e.scene),s.fogNode=this.getFogNode(e.scene),s.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&s.enableMultiview(),s}getForRender(e,t=!1){const s=this.get(e);let i=s.nodeBuilderState;if(i===void 0){const{nodeBuilderCache:r}=this,l=this.getForRenderCacheKey(e);if(i=r.get(l),i===void 0){const u=async()=>{let h=this._createNodeBuilder(e,e.material);try{t?await h.buildAsync():h.build()}catch(d){h=this._createNodeBuilder(e,new Bt),t?await h.buildAsync():h.build(),he("TSL: "+d)}return h};if(t)return u().then(h=>(i=this._createNodeBuilderState(h),r.set(l,i),i.usedTimes++,s.nodeBuilderState=i,i));{let h=this._createNodeBuilder(e,e.material);try{h.build()}catch(d){h=this._createNodeBuilder(e,new Bt),h.build();let p=d.stackTrace;!p&&d.stack&&(p=new ts(d.stack)),he("TSL: "+d,p)}i=this._createNodeBuilderState(h),r.set(l,i)}}i.usedTimes++,s.nodeBuilderState=i}return i}getForRenderAsync(e){const t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){const t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;const s=this.getForRenderCacheKey(e),i=this.nodeBuilderCache.get(s);return i!==void 0?(i.usedTimes++,t.nodeBuilderState=i,i):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){const t=this.get(e);let s=t.nodeBuilderState;if(s===void 0||t.version!==e.version){const i=this.backend.createNodeBuilder(e,this.renderer);i.build(),s=this._createNodeBuilderState(i),t.nodeBuilderState=s,t.version=e.version}return s}_createNodeBuilderState(e){return new r8(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const s=this.get(e);s.environmentNode&&(t=s.environmentNode)}return t}
93getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const s=this.get(e);s.backgroundNode&&(t=s.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){cn[0]=e,cn[1]=t;const s=this.renderer.info.calls,i=this.callHashCache.get(cn)||{};if(i.callId!==s){if(Zr.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Zr.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Zr.push(t.getCacheKey(!0)),Zr.push(this.renderer.shadowMap.enabled?1:0),Zr.push(this.renderer.shadowMap.type);const l=this.getEnvironmentNode(e);l&&Zr.push(l.getCacheKey())}const r=this.getFogNode(e);r&&Zr.push(r.getCacheKey()),i.callId=s,i.cacheKey=Ud(Zr),this.callHashCache.set(cn,i),Zr.length=0}return cn[0]=null,cn[1]=null,i.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),s=e.background;if(s){const i=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==s||i){const r=this.getCacheNode("background",s,()=>{if(s.isCubeTexture===!0||s.mapping===H_||s.mapping===q_||s.mapping===Lm){if(e.backgroundBlurriness>0||s.mapping===Lm)return Nv(s);{let l;return s.isCubeTexture===!0?l=ii(s):l=it(s),rB(l)}}else{if(s.isTexture===!0)return it(s,In.flipY()).setUpdateMatrix(!0);s.isColor!==!0&&he("WebGPUNodes: Unsupported background configuration.",s)}},i);t.backgroundNode=r,t.background=s,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,s,i=!1){const r=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let l=r.get(t);return(l===void 0||i)&&(l=s(),r.set(t,l)),l}updateFog(e){const t=this.get(e),s=e.fog;if(s){if(t.fog!==s){const i=this.getCacheNode("fog",s,()=>{if(s.isFogExp2){const r=Ct("color","color",s).setGroup(Re),l=Ct("density","float",s).setGroup(Re);return F_(r,e3(l))}else if(s.isFog){const r=Ct("color","color",s).setGroup(Re),l=Ct("near","float",s).setGroup(Re),u=Ct("far","float",s).setGroup(Re);return F_(r,JB(l,u))}else he("Renderer: Unsupported fog configuration.",s)});t.fogNode=i,t.fog=s}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),s=e.environment;if(s){if(t.environment!==s){const i=this.getCacheNode("environment",s,()=>{if(s.isCubeTexture===!0)return ii(s);if(s.isTexture===!0)return it(s);he("Nodes: Unsupported environment configuration.",s)});t.environmentNode=i,t.environment=s}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,s=null,i=null,r=null){const l=this.nodeFrame;return l.renderer=e,l.scene=t,l.object=s,l.camera=i,l.material=r,l}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){const t=this.renderer;let s;return e.isArrayTexture?this.backend.isWebGLBackend?s=it(e,In).depth(ba("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):s=it(e,In).depth(Dw).renderOutput(t.toneMapping,t.currentColorSpace):s=it(e,In).renderOutput(t.toneMapping,t.currentColorSpace),s}setOutputLayerIndex(e){Dw.value=e}updateBefore(e){const t=e.getNodeBuilderState();for(const s of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(s)}updateAfter(e){const t=e.getNodeBuilderState();for(const s of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(s)}updateForCompute(e){const t=this.getNodeFrame(),s=this.getForCompute(e);for(const i of s.updateNodes)t.updateNode(i)}updateForRender(e){const t=this.getNodeFrameForRender(e),s=e.getNodeBuilderState();for(const i of s.updateNodes)t.updateNode(i)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new Cw,this.nodeBuilderCache=new Map,this.cacheLib={}}}const kb=new ta;class Bg{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new Qe,this.viewNormalMatrix=new js,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,s){const i=e.length;for(let r=0;r<i;r++){kb.copy(e[r]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);const l=t[s+r],u=kb.normal;l.x=-u.x,l.y=-u.y,l.z=-u.z,l.w=kb.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let s=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);const i=t.clippingPlanes,r=i.length;let l,u;if(this.clipIntersection?(l=this.intersectionPlanes,u=e.intersectionPlanes.length):(l=this.unionPlanes,u=e.unionPlanes.length),l.length!==u+r){l.length=u+r;for(let h=0;h<r;h++)l[u+h]=new ht;s=!0}this.projectPlanes(i,l,u),s&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}
93getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new Bg(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}}class q8{constructor(e,t,s){this.bundleGroup=e,this.camera=t,this.renderContext=s}}const Ka=[];class $8{constructor(){this.bundles=new So}get(e,t,s){const i=this.bundles;Ka[0]=e,Ka[1]=t,Ka[2]=s;let r=i.get(Ka);return r===void 0&&(r=new q8(e,t,s),i.set(Ka,r)),Ka[0]=null,Ka[1]=null,Ka[2]=null,r}dispose(){this.bundles=new So}}class L3{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const s=this.getMaterialNodeClass(e.type);if(s!==null){t=new s;for(const i in e)t[i]=e[i]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,s){if(s.has(t)){me(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);s.set(t,e)}addClass(e,t,s){if(s.has(t)){me(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);s.set(t,e)}}
93const W8=new Vv,Uw=new WeakMap;class X8{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new Vv().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return W8;let t=Uw.get(e);return t===void 0&&(t=this.createNode(),Uw.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}}class id extends $i{constructor(e=1,t=1,s={}){super(e,t,s),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}}const Fw=new H,Lw=new H,Ow=new WeakMap;class j8 extends Wn{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new yi,this._cameraL.viewport=new ht,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new yi,this._cameraR.viewport=new ht,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new FO,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=e9.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Fe,this._onSessionEvent=Q8.bind(this),this._onSessionEnd=K8.bind(this),this._onInputSourcesChange=J8.bind(this),this._onAnimationFrame=t9.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&me("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&me("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;const t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;const s=this._renderer.getOutputRenderTarget();if(s===null||s.isXRRenderTarget!==!0)return;const i=this.getBinding();if(i===null||typeof i.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);const{textureGPU:r,glTextureType:l}=t.get(e.texture);if(!(r===void 0||l===void 0)&&e._xrFoveationTextureGPU!==r){e._xrFoveationTextureGPU=r,t.state.bindTexture(l,r);try{i.foveateBoundTexture(l,this.getFoveation())}catch(u){Ye(`XRManager: Unable to foveate bound XR post-processing texture. ${u.name}: ${u.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){const e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(Ye("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){const t=this.getWebGPUBinding(),s=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=s,e.updateRenderState({layers:[s]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new $i(s.textureWidth,s.textureHeight,{depth:2,minFilter:Ss,magFilter:Ss,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Ye("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}
93_disposeWebGPUSession(){const e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;const s=e.backend,i=e._textures,r=s.get?s.get(t):null;r&&(r.descriptors=void 0);const l=u=>{u!=null&&(s.delete&&s.delete(u),i.delete&&i.delete(u))};for(let u=0;u<t.textures.length;u++)l(t.textures[u]);l(t.depthTexture),l(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){const t=this.getWebGPUBinding(),s={colorTexture:null,viewDescriptors:[],viewports:[]};for(let i=0;i<e.length;i++){const r=t.getViewSubImage(this._glProjLayer,e[i]);s.colorTexture===null&&(s.colorTexture=r.colorTexture),s.viewports.push(r.viewport),r.getViewDescriptor&&s.viewDescriptors.push(r.getViewDescriptor())}return s}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,s,i,r,l,u,h={}){const d=new Ig(e,t),p=new id(r,l,{format:ki,type:Ds,depthTexture:new Sn(r,l,h.stencil?ha:Ut,void 0,void 0,void 0,void 0,void 0,void 0,h.stencil?fr:vn),stencilBuffer:h.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});p._autoAllocateDepthBuffer=!0;const m=new ao({color:16777215,side:dr});m.map=p.texture,m.map.offset.y=1,m.map.repeat.y=-1;const y=new Tr(d,m);y.position.copy(s),y.quaternion.copy(i);const b={type:"quad",width:e,height:t,translation:s,quaternion:i,pixelwidth:r,pixelheight:l,plane:y,material:m,rendercall:u,renderTarget:p};if(this._layers.push(b),this._session!==null){b.plane.material=new ao({color:16777215,side:dr}),b.plane.material.blending=ic,b.plane.material.blendEquation=yn,b.plane.material.blendSrc=no,b.plane.material.blendDst=no,b.xrlayer=this._createXRLayer(b);const _=this._session.renderState.layers;_.unshift(b.xrlayer),this._session.updateRenderState({layers:_})}else p.isXRRenderTarget=!1;return y}createCylinderLayer(e,t,s,i,r,l,u,h,d={}){const p=new iT(e,e,e*t/s,64,64,!0,Math.PI-t/2,t),m=new id(l,u,{format:ki,type:Ds,depthTexture:new Sn(l,u,d.stencil?ha:Ut,void 0,void 0,void 0,void 0,void 0,void 0,d.stencil?fr:vn),stencilBuffer:d.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});m._autoAllocateDepthBuffer=!0;const y=new ao({color:16777215,side:Ts});y.map=m.texture,y.map.offset.y=1,y.map.repeat.y=-1;const b=new Tr(p,y);b.position.copy(i),b.quaternion.copy(r);const _={type:"cylinder",radius:e,centralAngle:t,aspectratio:s,translation:i,quaternion:r,pixelwidth:l,pixelheight:u,plane:b,material:y,rendercall:h,renderTarget:m};if(this._layers.push(_),this._session!==null){_.plane.material=new ao({color:16777215,side:Ts}),_.plane.material.blending=ic,_.plane.material.blendEquation=yn,_.plane.material.blendSrc=no,_.plane.material.blendDst=no,_.xrlayer=this._createXRLayer(_);const v=this._session.renderState.layers;v.unshift(_.xrlayer),this._session.updateRenderState({layers:v})}else m.isXRRenderTarget=!1;return b}renderLayers(){const e=new H,t=new ma,s=this._renderer,i=this.isPresenting;this.isPresenting=!1;const r=new Fe;s.getSize(r);const l=s.getRenderTarget();for(const u of this._layers){u.renderTarget.isXRRenderTarget=this._session!==null,u.renderTarget._hasExternalTextures=u.renderTarget.isXRRenderTarget;const h=s.contextNode;let d;if(u.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){u.xrlayer.transform=new XRRigidTransform(u.plane.getWorldPosition(e),u.plane.getWorldQuaternion(t));const p=this._glBinding.getSubImage(u.xrlayer,this._xrFrame);s.backend.setXRRenderTargetTextures(u.renderTarget,p.colorTexture,void 0),s._setXRLayerSize(u.renderTarget.width,u.renderTarget.height),d=Ow.get(h),d===void 0&&(d=h.context({getOutput:m=>ry(m,s.toneMapping,s.outputColorSpace)}),Ow.set(h,d))}else d=h;s.contextNode=d,s.setRenderTarget(u.renderTarget),u.rendercall(),s.contextNode=h}s.setRenderTarget(l),s._setXRLayerSize(r.x,r.y),this.isPresenting=i}getSession(){return this._session}async setSession(e){const t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();const s=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._val
93idateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let i=null,r=null,l=null;const u=s.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(l=t.stencil?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24,i=t.stencil?fr:vn,r=t.stencil?ha:Ut);const h={colorFormat:s.RGBA8,depthFormat:l,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(h.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const d=this._glBinding.createProjectionLayer(h),p=[d];this._glProjLayer=d,t.setPixelRatio(1),t._setXRLayerSize(d.textureWidth,d.textureHeight);const m=this._useMultiview?2:1,y=new Sn(d.textureWidth,d.textureHeight,r,void 0,void 0,void 0,void 0,void 0,void 0,i,m);if(this._xrRenderTarget=new id(d.textureWidth,d.textureHeight,{format:ki,type:Ds,colorSpace:t.outputColorSpace,depthTexture:y,stencilBuffer:t.stencil,samples:u.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const b of this._layers)b.plane.material=new ao({color:16777215,side:b.type==="cylinder"?Ts:dr}),b.plane.material.blending=ic,b.plane.material.blendEquation=yn,b.plane.material.blendSrc=no,b.plane.material.blendDst=no,b.xrlayer=this._createXRLayer(b),p.unshift(b.xrlayer);e.updateRenderState({layers:p})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());const i={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},r=new XRWebGLLayer(e,s,i);this._glBaseLayer=r,e.updateRenderState({baseLayer:r}),t.setPixelRatio(1),t._setXRLayerSize(r.framebufferWidth,r.framebufferHeight),this._xrRenderTarget=new id(r.framebufferWidth,r.framebufferHeight,{format:ki,type:Ds,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:r.ignoreDepthValues===!1,resolveStencilBuffer:r.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(t===null)return;const s=e.near,i=e.far,r=this._cameraXR,l=this._cameraL,u=this._cameraR;r.near=u.near=l.near=s,r.far=u.far=l.far=i,r.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==r.near||this._currentDepthFar!==r.far)&&(t.updateRenderState({depthNear:r.near,depthFar:r.far}),this._currentDepthNear=r.near,this._currentDepthFar=r.far),r.layers.mask=e.layers.mask|6,l.layers.mask=r.layers.mask&-5,u.layers.mask=r.layers.mask&-3;const h=e.parent,d=r.cameras;zw(r,h);for(let p=0;p<d.length;p++)zw(d[p],h);d.length===2?Y8(r,l,u):r.projectionMatrix.copy(l.projectionMatrix),Z8(e,r,h)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new sO,this._controllers[e]=t),t}}function Y8(o,e,t){Fw.setFromMatrixPosition(e.matrixWorld),Lw.setFromMatrixPosition(t.matrixWorld);const s=Fw.distanceTo(Lw),i=e.projectionMatrix.elements,r=t.projectionMatrix.elements,l=i[14]/(i[10]-1),u=i[14]/(i[10]+1),h=(i[9]+1)/i[5],d=(i[9]-1)/i[5],p=(i[8]-1)/i[0],m=(r[8]+1)/r[0],y=l*p,b=l*m,_=s/(-p+m),v=_*-p;if(e.matrixWorld.decompose(o.position,o.quaternion,o.scale),o.translateX(v),o.translateZ(_),o.matrixWorld.compose(o.position,o.quaternion,o.scale),o.matrixWorldInverse.copy(o.matrixWorld).invert(),i[10]===-1)o.projectionMatrix.copy(e.projectionMatrix),o.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const M=l+_,A=u+_,C=y-v,E=b+(s-v),F=h*u/A*M,L=d*u/A*M;o.projectionMatrix.makePerspective(C,E,F,L,M,A),o.projectionMatrixInverse.copy(o.projectionMatrix).invert()}}function zw(o,e){e===null?o.matrixWorld.copy(o.matrix):o.matrixWorld.multiplyMatrices(e.matrixWorld,o.matrix
93),o.matrixWorldInverse.copy(o.matrixWorld).invert()}function Z8(o,e,t){t===null?o.matrix.copy(e.matrixWorld):(o.matrix.copy(t.matrixWorld),o.matrix.invert(),o.matrix.multiply(e.matrixWorld)),o.matrix.decompose(o.position,o.quaternion,o.scale),o.updateMatrixWorld(!0),o.projectionMatrix.copy(e.projectionMatrix),o.projectionMatrixInverse.copy(e.projectionMatrixInverse),o.isPerspectiveCamera&&(o.fov=xc*2*Math.atan(1/o.projectionMatrix.elements[5]),o.zoom=1)}function Q8(o){const e=this._controllerInputSources.indexOf(o.inputSource);if(e===-1)return;const t=this._controllers[e];if(t!==void 0){const s=this.getReferenceSpace();t.update(o.inputSource,o.frame,s),t.dispatchEvent({type:o.type,data:o.inputSource})}}function K8(){const o=this._session,e=this._renderer;o.removeEventListener("select",this._onSessionEvent),o.removeEventListener("selectstart",this._onSessionEvent),o.removeEventListener("selectend",this._onSessionEvent),o.removeEventListener("squeeze",this._onSessionEvent),o.removeEventListener("squeezestart",this._onSessionEvent),o.removeEventListener("squeezeend",this._onSessionEvent),o.removeEventListener("end",this._onSessionEnd),o.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){const s=this._controllerInputSources[t];s!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(s))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(const t of this._layers)t.renderTarget=new id(t.pixelwidth,t.pixelheight,{format:ki,type:Ds,depthTexture:new Sn(t.pixelwidth,t.pixelheight,t.stencilBuffer?ha:Ut,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?fr:vn),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function J8(o){const e=this._controllers,t=this._controllerInputSources;for(let s=0;s<o.removed.length;s++){const i=o.removed[s],r=t.indexOf(i);r>=0&&(t[r]=null,e[r].disconnect(i))}for(let s=0;s<o.added.length;s++){const i=o.added[s];let r=t.indexOf(i);if(r===-1){for(let u=0;u<e.length;u++)if(u>=t.length){t.push(i),r=u;break}else if(t[u]===null){t[u]=i,r=u;break}if(r===-1)break}const l=e[r];l&&l.connect(i)}}function e9(o){return o.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(o.translation,o.quaternion),width:o.width/2,height:o.height/2,space:this._referenceSpace,viewPixelWidth:o.pixelwidth,viewPixelHeight:o.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(o.translation,o.quaternion),radius:o.radius,centralAngle:o.centralAngle,aspectRatio:o.aspectRatio,space:this._referenceSpace,viewPixelWidth:o.pixelwidth,viewPixelHeight:o.pixelheight,clearOnAccess:!1})}function t9(o,e){if(e===void 0)return;const t=this._cameraXR,s=this._renderer,i=s.backend,r=this._glBaseLayer,l=this.getReferenceSpace(),u=e.getViewerPose(l);if(this._xrFrame=e,u!==null){const h=u.views,d=this._isWebGPUSession()?this._getWebGPUViewData(h):null;this._glBaseLayer!==null&&d===null&&i.setXRTarget(r.framebuffer);let p=!1;h.length!==t.cameras.length&&(t.cameras.length=0,p=!0);for(let y=0;y<h.length;y++){const b=h[y];let _;if(d!==null)_=d.viewports[y];else if(this._supportsLayers===!0){const M=this._glBinding.getViewSubImage(this._glProjLayer,b);_=M.viewport,y===0&&i.setXRRenderTargetTextures(this._xrRenderTarget,M.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:M.depthStencilTexture)}else _=r.getViewport(b);let v=this._cameras[y];v===void 0&&(v=new yi,v.layers.enable(y),v.viewport=new ht,v.matrixWorldAutoUpdate=!1,this._cameras[y]=v),v.matrix.fromArray(b.transform.matrix),v.matrix.decompose(v.position,v.quaternion,v.scale),v.projectionMatrix.fromArray(b.projectionMatrix),v.projectionMatrixInverse.copy(v.projectionMatrix).invert(),v.viewport.set(_.x,_.y,_.width,_.height),y===0&&(t.matrix.copy(v.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),p===!0&&t.cameras.push(v)}d!==null&&d.colorTexture!==null&&i.setXRRenderTargetTextures(this._xrRenderTarget,d.colorTexture,d.viewDescriptors),s.setOutputRe
vendor: 1,700 bytes, line 93
93nderTarget(this._xrRenderTarget);const m=s._getFrameBufferTarget();s.xr.foveateBoundTexture(m)}for(let h=0;h<this._controllers.length;h++){const d=this._controllerInputSources[h],p=this._controllers[h];d!==null&&p!==void 0&&p.update(d,e,l)}this._currentAnimationLoop&&this._currentAnimationLoop(o,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}class s9 extends Wn{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new ht(0,0,this._width,this._height),this._scissor=new ht(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new sT,this.depthTexture=new Sn}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,s){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=s,this.domElement.width=Math.floor(e*s),this.domElement.height=Math.floor(t*s),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,s=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),s===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){const t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,s,i){const r=this._scissor;
93e.isVector4?r.copy(e):r.set(e,t,s,i)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,s,i,r=0,l=1){const u=this._viewport;e.isVector4?u.copy(e):u.set(e,t,s,i),u.minDepth=r,u.maxDepth=l}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}}const Pw=new J_,Lu=new Fe,Hb=new ht,sm=new dg,im=new tT,Ou=new Qe,Qr=new ht,i9={[dr]:Ts,[Ts]:dr,[la]:la};class n9{constructor(e,t={}){this.isRenderer=!0;const{logarithmicDepthBuffer:s=!1,reversedDepthBuffer:i=!1,alpha:r=!0,depth:l=!0,stencil:u=!1,antialias:h=!1,samples:d=0,getFallback:p=null,outputBufferType:m=Jt,multiview:y=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=r,this.logarithmicDepthBuffer=s,this.reversedDepthBuffer=i,this.outputColorSpace=Vi,this.toneMapping=fo,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=l,this.stencil=u,this.info=new J4,this.contextNode=xa(),this.library=new L3,this.lighting=new X8,this._samples=d||h===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new s9(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new FC,this._inspector.setRenderer(this),this._getFallback=p,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;const b=this.alpha===!0?0:1;this._clearColor=new wv(0,0,0,b),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=m,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:yR},this.xr=new j8(this,y),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(_,v,M)=>{await this.compileAsync(M,v,_);const C=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,E=this._renderLists.get(_,v),F=this._renderContexts.get(C,this._mrt),L=_.overrideMaterial||M.material,U=this._objects.get(M,L,_,v,E.lightsNode,F,F.clippingContext),{fragmentShader:R,vertexShader:V}=U.getNodeBuilderState();return{fragmentShader:R,vertexShader:V}}}}
93async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let s=this.backend;try{await s.init(this)}catch(i){if(this._getFallback!==null)try{this.backend=s=this._getFallback(i),await s.init(this)}catch(r){t(r);return}else{t(i);return}}this._nodes=new H8(this,s),this._animation=new q4(this,this._nodes,this.info),this._attributes=new Q4(s,this.info),this._background=new i8(this,this._nodes),this._geometries=new K4(this._attributes,this.info),this._textures=new fG(this,s,this.info),this._pipelines=new iG(s,this._nodes,this.info),this._bindings=new nG(s,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new j4(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new lG(this.lighting),this._bundles=new $8,this._renderContexts=new hG(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,s=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();const i=this._nodes.nodeFrame,r=i.renderId,l=this._currentRenderContext,u=this._currentRenderObjectFunction,h=this._handleObjectFunction,d=this._compilationPromises;s===null&&(s=e);const p=e.isScene===!0?e:s.isScene===!0?s:Pw,y=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,b=this._renderContexts.get(y,this._mrt),_=this._activeMipmapLevel,v=[];this._currentRenderContext=b,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=v,i.renderId++,i.update(),b.depth=this.depth,b.stencil=this.stencil,b.clippingContext||(b.clippingContext=new Bg),b.clippingContext.updateGlobal(p,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),p.onBeforeRender(this,e,t,y);const M=t.isArrayCamera?im:sm;t.isArrayCamera?M.setFromArrayCamera(t):(Ou.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),M.setFromProjectionMatrix(Ou,t.coordinateSystem,t.reversedDepth));const A=this._renderLists.get(p,t);if(A.begin(),this._projectObject(e,t,0,A,b.clippingContext),s!==e&&s.traverseVisible(function(U){U.isLight&&U.layers.test(t.layers)&&A.pushLight(U)}),A.finish(),y!==null){this._textures.updateRenderTarget(y,_);const U=this._textures.get(y);b.textures=U.textures,b.depthTexture=U.depthTexture}else b.textures=null,b.depthTexture=null;s!==e?this._background.update(s,A,b):this._background.update(p,A,b);const C=A.opaque,E=A.transparent,F=A.transparentDoublePass,L=A.lightsNode;this.opaque===!0&&C.length>0&&this._renderObjects(C,t,p,L),this.transparent===!0&&E.length>0&&this._renderTransparents(E,F,t,p,L),i.renderId=r,this._currentRenderContext=l,this._currentRenderObjectFunction=u,this._handleObjectFunction=h,this._compilationPromises=d;for(const U of v){const R=this._objects.get(U.object,U.material,U.scene,U.camera,U.lightsNode,U.renderContext,U.clippingContext,U.passId);R.drawRange=U.object.geometry.drawRange,R.group=U.group,await this._nodes.getForRenderAsync(R),this._nodes.updateBefore(R),this._geometries.updateForRender(R),this._nodes.updateForRender(R),this._bindings.updateForRender(R);const V=[];this._pipelines.getForRender(R,V),V.length>0&&await Promise.all(V),this._nodes.updateAfter(R),await OR()}}async renderAsync(e,t){Ye('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){he("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){const t=this.contextNode.value;e===!0?(t.modelViewMatrix=g_,t.modelNormalViewMatrix=y_):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){const e=this.contextNode.value;return e.modelViewMatrix===g_&&e.modelNormalViewMatrix===y_}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Ye('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost: 94 95Message: ${e.message}`;e.reason&&(t+=` 96Reason: ${e.reason}`),he(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),he(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,s){const{bundleGroup:i,camera:r,renderList:l}=e,u=this._currentRenderContext,h=this._bundles.get(i,r,u),d=this.backend.get(h);if(this._bundleNeedsUpdate(i,d)){this.backend.beginBundle(u),this._currentRenderBundle=h;const{transparentDoublePass:m,transparent:y,opaque:b}=l;this.opaque===!0&&b.length>
960&&this._renderObjects(b,r,t,s),this.transparent===!0&&y.length>0&&this._renderTransparents(y,m,r,t,s),this._currentRenderBundle=null,this.backend.finishBundle(u,h),d.version=i.version}else{const{renderObjects:m}=d;for(let y=0,b=m.length;y<b;y++){const _=m[y];this._nodes.needsRefresh(_)&&(this._nodes.updateBefore(_),this._geometries.updateForRender(_),this._nodes.updateForRender(_),this._bindings.updateForRender(_),this._nodes.updateAfter(_))}}this.backend.addBundle(u,h)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}const s=this._activeCubeFace;try{for(let i=0;i<t.texture.image.depth;i++)this._nodes.setOutputLayerIndex(i),this._activeCubeFace=i,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=s}}_getFrameBufferTarget(){const{currentToneMapping:e,currentColorSpace:t}=this,s=e!==fo,i=t!==lt.workingColorSpace;if(s===!1&&i===!1)return null;const{width:r,height:l}=this.getDrawingBufferSize(Lu),{depth:u,stencil:h}=this,d=this._outputRenderTarget||this._canvasTarget;let p=this._frameBufferTargets.get(d);if(p===void 0){p=new $i(r,l,{depthBuffer:u,stencilBuffer:h,type:this._outputBufferType,format:ki,colorSpace:lt.workingColorSpace,generateMipmaps:!1,minFilter:Ss,magFilter:Ss,samples:this.samples}),p.isPostProcessingRenderTarget=!0;const M=()=>{d.removeEventListener("dispose",M),p.dispose(),this._frameBufferTargets.delete(d)};d.addEventListener("dispose",M),this._frameBufferTargets.set(d,p)}const m=this.getOutputRenderTarget();p.depthBuffer=u,p.stencilBuffer=h,m!==null?p.setSize(m.width,m.height,m.depth):p.setSize(r,l,1);const y=this._outputRenderTarget?this._outputRenderTarget.viewport:d._viewport,b=this._outputRenderTarget?this._outputRenderTarget.scissor:d._scissor,_=this._outputRenderTarget?1:d._pixelRatio,v=this._outputRenderTarget?this._outputRenderTarget.scissorTest:d._scissorTest;return p.viewport.copy(y),p.scissor.copy(b),p.viewport.multiplyScalar(_),p.scissor.multiplyScalar(_),p.scissorTest=v,p.multiview=m!==null?m.multiview:!1,p.useArrayDepthTexture=m!==null?m.useArrayDepthTexture:!1,p.resolveDepthBuffer=m!==null?m.resolveDepthBuffer:!0,p._autoAllocateDepthBuffer=m!==null?m._autoAllocateDepthBuffer:!1,p}_renderScene(e,t,s=!0){if(this._isDeviceLost===!0)return;const i=s?this._getFrameBufferTarget():null,r=this._nodes.nodeFrame,l=r.renderId,u=this._currentRenderContext,h=this._currentRenderObjectFunction,d=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;const p=e.isScene===!0?e:Pw,m=this._renderTarget||this._outputRenderTarget,y=this._activeCubeFace,b=this._activeMipmapLevel;let _;if(i!==null?(_=i,this.setRenderTarget(_)):_=m,_!==null&&_.depthBuffer===!0){const xe=this._textures.get(_);xe.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),xe.depthInitialized=!0)}const v=this._renderContexts.get(_,this._mrt,this._callDepth);this._currentRenderContext=v,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(v),this.inspector.beginRender(this.backend.getTimestampUID(v),e,t,_),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);const M=this._canvasTarget;let A=M._viewport,C=M._scissor,E=M._pixelRatio;_!==null&&(A=_.viewport,C=_.scissor,E=1),this.getDrawingBufferSize(Lu),Hb.set(0,0,Lu.width,Lu.height);const F=A.minDepth===void 0?0:A.minDepth,L=A.maxDepth===void 0?1:A.maxDepth;v.viewportValue.copy(A).multiplyScalar(E).floor(),v.viewportValue.width>>=b,v.viewportValue.height>>=b,v.viewportValue.minDepth=F,v.viewportValue.maxDepth=L,v.viewport=v.viewportValue.equals(Hb)===!1,v.scissorValue.copy(C).multiplyScalar(E).floor(),v.scissor=M._scissorTest&&v.scissorValue.equals(Hb)===!1,v.scissorValue.width>>=b,v.scissorValue.height>>=b,v.clippingContext||(v.clippingContext=new Bg),v.clippingContext.updateGlobal(p,t),p.onBeforeRender(this,e,t,_);const U=t.isArrayCamera?im:sm;t.isArrayCamera?U.setFromArrayCamera(t):(Ou.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),U.setFromProjectionMatrix(Ou,t.coordinateSystem,t.reversedDepth));const R=this._renderLists.get(e,t);if(R.begin(),this._projectObject(e,t,0,R,v.clippingContext),R.finish(),this.sortObjects===!0&&R.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),_!==null){this._textures.updateRenderTarget(_,b);const xe=this._textures.get(_);v.textures=xe.textures,v.depthTexture=xe.depthTexture,v.width=xe.width,v.height=xe.height,v.renderTarget=_,v.depth=_.depthBuffer,v.stencil=_.stencilBuffer}else v.textures=null,v.depthTexture=null,v.width=Lu.width,v.height=Lu.height,v.depth=this.depth,v.stencil=this.stencil;v.width>>=b,v.height>>=b,v.activeCubeFace=y,v.activeMipmapLevel=b,v.occlusionQueryCount=R.occlusionQueryCount,v.scissorValue.max(Qr.set(0,0,0,0)),v.scissorValue.x+v.scissorValue.width>v.width&&(v.scissorValue.width=Math.max(v.width-v.scissorValue.x,0)),v.scissorValue.y+v.scissorValue.height>v.height&&(v.scissorValue.height=Math.max(v.height-v.scissorValue.y,0)),this._background.update(p,R,v),v.camera=t,this.backend.beginRender(v);const{bundles:V,lightsNode:$,transparentDoublePass:ie,transparent:le,opaque:ye}=R;return V.length>0&&this._renderBundles(V,p,$),this.opaque===!0&&ye.length>0&&this._renderObjects(ye,t,p,$),this.transparent===!0&&le.length>0&&this._renderTransparents(le,ie,t,p,$),this.backend.finishRender(v),r.renderId=l,this._currentRenderContext=u,this._currentRenderObjectFunction=h,this._handleObjectFunction=d,this.lighting.finishRender(e),this._callDepth--,i!==null&&(this.setRenderTarget(m,y,b),this._renderOutput(_)),p.onAfterRender(this,e,t,_),this.inspector.finishRender(this.backend.getTimestampUID(v)),v}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._nodes.getOutputCacheKey();let s=this._quadCache.get(e.texture),i;
96if(s===void 0){i=new Vd(new Bt),i.name="Output Color Transform",i.material.name="outputColorTransform",i.material.fragmentNode=this._nodes.getOutputNode(e.texture),s={quad:i,cacheKey:t},this._quadCache.set(e.texture,s);const u=()=>{i.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",u)};e.texture.addEventListener("dispose",u)}else i=s.quad,s.cacheKey!==t&&(i.material.fragmentNode=this._nodes.getOutputNode(e.texture),i.material.needsUpdate=!0,s.cacheKey=t);const r=this.autoClear,l=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(i,e),this.autoClear=r,this.xr.enabled=l}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,s=0,i=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);const r=()=>{t.removeEventListener("dispose",r),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",r)}if(s%4!==0||i>0&&i%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,s,i)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,s){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,s)}setSize(e,t,s=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,s)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,s,i){this._canvasTarget.setScissor(e,t,s,i)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,s,i,r=0,l=1){this._canvasTarget.setViewport(e,t,s,i,r,l)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,s=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');const i=this._renderTarget||this._getFrameBufferTarget();let r=null;if(i!==null){this._textures.updateRenderTarget(i);const l=this._textures.get(i);r=this._renderContexts.get(i,null,-1),r.textures=l.textures,r.depthTexture=l.depthTexture,r.width=l.width,r.height=l.height,r.renderTarget=i,r.depth=i.depthBuffer,r.stencil=i.stencilBuffer;const u=this.backend.getClearColor();r.clearColorValue.r=u.r,r.clearColorValue.g=u.g,r.clearColorValue.b=u.b,r.clearColorValue.a=u.a,r.clearDepthValue=this.getClearDepth(),r.clearStencilValue=this.getClearStencil(),r.activeCubeFace=this.getActiveCubeFace(),r.activeMipmapLevel=this.getActiveMipmapLevel(),i.depthBuffer===!0&&(l.depthInitialized=!0)}this.backend.clear(e,t,s,r),i!==null&&this._renderTarget===null&&this._renderOutput(i)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,s=!0){Ye('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,s)}async clearColorAsync(){Ye('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Ye('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Ye('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){const e=this.currentToneMapping!==fo,t=this.currentColorSpace!==lt.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:fo}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:lt.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();
96for(const e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,s=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=s}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(const e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return me("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const s=this._nodes.nodeFrame,i=s.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const r=this.backend,l=this._pipelines,u=this._bindings,h=this._nodes,d=Array.isArray(e)?e:[e];if(d[0]===void 0||d[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");r.beginCompute(e);for(const p of d){if(l.has(p)===!1){const b=()=>{p.removeEventListener("dispose",b),l.delete(p),u.deleteForCompute(p),h.delete(p)};p.addEventListener("dispose",b);const _=p.onInitFunction;_!==null&&_.call(p,{renderer:this})}h.updateForCompute(p),u.updateForCompute(p);const m=u.getForCompute(p),y=l.getForCompute(p,m);r.compute(e,p,m,y,t)}r.finishCompute(e),s.renderId=i,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return Ye('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){Ye('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);const t=this._textures.get(e),s=this._renderContexts.get(e);s.textures=t.textures,s.depthTexture=t.depthTexture,s.width=t.width,s.height=t.height,s.renderTarget=e,s.depth=e.depthBuffer,s.stencil=e.stencilBuffer,this.backend.initRenderTarget(s)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=Qr.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Qr.copy(t).floor();else{he("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Qr.set(0,0,e.image.width,e.image.height);let s=this._currentRenderContext,i;s!==null?i=s.renderTarget:(i=this._renderTarget||this._getFrameBufferTarget(),i!==null&&(this._textures.updateRenderTarget(i),s=this._textures.get(i))),this._textures.updateTexture(e,{renderTarget:i}),this.backend.copyFramebufferToTexture(e,s,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,s=null,i=null,r=0,l=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,s,i,r,l),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,s,i,r,l=0,u=0){return this.backend.copyTextureToBuffer(e.textures[l],t,s,i,r,u)}_projectObject(e,t,s,i,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)s=e.renderOrder,e.isClippingGroup&&e.enabled&&(r=r.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)i.pushLight(e);else if(e.isSprite){const h=t.isArrayCamera?im:sm;if(!e.frustumCulled||h.intersectsSprite(e)){this.sortObjects===!0&&Qr.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ou);const{geometry:d,material:p}=e;p.visible&&i.push(e,d,p,s,Qr.z,null,r)}}else if(e.isLineLoop)he("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const h=t.isArrayCamera?im:sm;if(!e.frustumCulled||h.intersectsObject(e)){const{geometry:d,material:p}=e;if(this.sortObjects===!0&&(d.boundingSphere===null&&d.computeBoundingSphere(),Qr.copy(d.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(Ou)),Array.isArray(p)){const m=d.groups;for(let y=0,b=m.length;y<b;y++){const _=m[y],v=p[_.materialIndex];v&&v.visible&&i.push(e,d,v,s,Qr.z,_,r)}}else p.visible&&i.push(e,d,p,s,Qr.z,null,r)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){const h=i;i=this._renderLists.get(e,t);const d=this._bundles.get(e,t,this._currentRenderContext),p=this.backend.get(d);if(this._bundleNeedsUpdate(e,p)){i.begin(),p.renderObjects===void 0?p.renderObjects=[]:p.renderObjects.length=0;const y=e.children;for(let b=0,_=y.length;b<_;b++)this._projectObject(y[b],t,s,i,r);i.finish()}h.pushBundle({bundleGroup:e,camera:t,renderList:i});return}const u=e.children;for(let h=0,d=u.length;h<d;h++)this._projectObject(u[h],t,s,i,r)}_renderBundles(e,t,s){for(const i of e)this._renderBundle(i,t,s)}_renderTransparents(e,t,s,i,r){if(t.length>0){for(const{material:l}of t)l.side=Ts;this._renderObjects(t,s,i,r,"backSide");for(const{material:l}of t)l.side=dr;this._renderObjects(e,s,i,r);for(const{material:l}of t)l.side=la}else this._renderObjects(e,s,i,r)}_renderObjects(e,t,s,i,r=null){for(let l=0,u=e.length;l<u;l++){const{object:h,geometry:d,material:p,group:m,clippingContext:y}=e[l];this._currentRenderObjectFunction(h,s,t,d,p,m,i,y,r)}}_getShadowNodes(e){const t=e.version;let s=this._cacheShadowNodes.get(e);if(s===void 0||s.version!==t){const i=e.map&&e.map.isTexture,r=e.colorNode&&e.colorNode.isNode,l=e.castShadowNode&&e.castShadowNode.isNode,u=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode;let h=null,d=null,p=null;if(i||r||l||u){let m,y;if(l?(m=e.castShadowNode.rgb,y=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&Ye("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(m=O(0),y=w(1)),i&&(y=y.mul(Ct("map","texture",e).a)),r&&(y=y.mul(e.colorNode.a)),d=Te(m,y),u){const b=e.maskShadowNode||e.maskNode;d=z(([_])=>(b.not().discard(),_))(d)}}e.depthNode&&e.depthNode.isNode&&(p=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?h=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(h=e.positionNode),s={version:t,colorNode:d,depthNode:p,positionNode:h},this._cacheShadowNodes.set(e,s)}return s}_updateCamera(e){const t=this.xr;if(t.isPresenting===!1){let s=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(const r of e.cameras)r._reversedDepth=!0;s=!0}const i=this.coordinateSystem;if(e.coordinateSystem!==i){if(e.coordinateSystem=i,e.isArrayCamera)for(const r of e.cameras)r.coordinateSystem=i;s=!0}if(s===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(const r of e.cameras)r.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,s,i,r,l,u,h=null,d=null){let p=!1,m,y,b,_,v,M,A;const C=this._currentSourceMaterial;if(e.onBeforeRender(this,t,s,i,r,l),r.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=r;const E=t.overrideMaterial;if(p=!0,m=E.isNodeMaterial?E.colorNode:null,y=E.isNodeMaterial?E.depthNode:null,b=E.isNodeMaterial?E.positionNode:null,_=t.overrideMaterial.side,v=E.displacementMap,M=E.displacementScale,A=E.displacementBias,r.positionNode&&r.positionNode.isNode&&(E.positionNode=r.positionNode),E.alphaTest=r.alphaTest,E.alphaMap=r.alphaMap,E.displacementMap=r.displacementMap,E.displacementScale=r.displacementScale,E.displacementBias=r.displacementBias,E.transparent=r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode,E.isShadowPassMaterial){const{colorNode:F,depthNode:L,positionNode:U}=this._getShadowNodes(r);this.shadowMap.type===rd?E.side=r.shadowSide!==null?r.shadowSide:r.side:E.side=r.shadowSide!==null?r.shadowSide:i9[r.side],F!==null&&(E.colorNode=F),L!==null&&(E.depthNode=L),U!==null&&(E.positionNode=U)}r=E}r.transparent===!0&&r.side===la&&r.forceSinglePass===!1?(r.side=Ts,this._handleObjectFunction(e,r,t,s,u,l,h,"backSide"),r.side=dr,this._handleObjectFunction(e,r,t,s,u,l,h,d),r.side=la):this._handleObjectFunction(e,r,t,s,u,l,h,d),p&&(t.overrideMaterial.colorNode=m,t.overrideMaterial.depthNode=y,t.overrideMaterial.positionNode=b,t.overrideMaterial.side=_,t.overrideMaterial.displacementMap=v,t.overrideMaterial.displacementScale=M,t.overrideMaterial.displacementBias=A),this._currentSourceMaterial=C,e.onAfterRender(this,t,s,i,r,l)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,s,i,r,l,u,h){const d=this._objects.get(e,t,s,i,r,this._currentRenderContext,u,h);d.drawRange=e.geometry.drawRange,d.group=l,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(d),d.bundle=this._currentRenderBundle.bundleGroup);const p=this._nodes.needsRefresh(d);p&&(this._nodes.updateBefore(d),this._geometries.updateForRender(d),this._nodes.updateForRender(d),this._bindings.updateForRender(d)),this._pipelines.updateForRender(d),this._pipelines.isReady(d)&&(this.backend.draw(d,this.info),p&&this._nodes.updateAfter(d))}_createObjectPipeline(e,t,s,i,r,l,u,h){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:s,camera:i,lightsNode:r,group:l,clippingContext:u,passId:h,renderContext:this._currentRenderContext});return}const d=this._objects.get(e,t,s,i,r,this._currentRenderContext,u,h);d.drawRange=e.geometry.drawRange,d.group=l,this._nodes.updateBefore(d),this._geometries.updateForRender(d),this._nodes.updateForRender(d),this._bindings.updateForRender(d),this._pipelines.getForRender(d,this._compilationPromises),this._nodes.updateAfter(d)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class O3{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}function z3(o){return o+(ho-o%ho)%ho}class P3 extends O3{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return z3(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}}class V3 extends P3{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let r9=0;class G3 extends V3{constructor(e,t){super("UniformBuffer_"+r9++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return z3(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}}class a9 extends V3{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){const t=e.index;if(this._addedIndices.has(t))return;let s=this._updateRangeCache.get(t);s===void 0&&(s={start:0,count:0},this._updateRangeCache.set(t,s)),s.start=e.offset,s.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(s)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){const t=this.byteLength;
96e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let s=0,i=this.uniforms.length;s<i;s++){const r=this.uniforms[s],l=r.boundary,u=r.itemSize*e,h=t%ho,d=h%l,p=h+d;t+=d,p!==0&&ho-p<u&&(t+=ho-p),r.offset=t/e,r.index=s,t+=u}return Math.ceil(t/ho)*ho}update(){let e=!1;for(const t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);he("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1;const s=this.values,i=e.getValue(),r=e.offset,l=e.getType();if(s[r]!==i){const u=this._getBufferForType(l);u[r]=s[r]=i,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1;const s=this.values,i=e.getValue(),r=e.offset,l=e.getType();if(s[r+0]!==i.x||s[r+1]!==i.y){const u=this._getBufferForType(l);u[r+0]=s[r+0]=i.x,u[r+1]=s[r+1]=i.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1;const s=this.values,i=e.getValue(),r=e.offset,l=e.getType();if(s[r+0]!==i.x||s[r+1]!==i.y||s[r+2]!==i.z){const u=this._getBufferForType(l);u[r+0]=s[r+0]=i.x,u[r+1]=s[r+1]=i.y,u[r+2]=s[r+2]=i.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1;const s=this.values,i=e.getValue(),r=e.offset,l=e.getType();if(s[r+0]!==i.x||s[r+1]!==i.y||s[r+2]!==i.z||s[r+3]!==i.w){const u=this._getBufferForType(l);u[r+0]=s[r+0]=i.x,u[r+1]=s[r+1]=i.y,u[r+2]=s[r+2]=i.z,u[r+3]=s[r+3]=i.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1;const s=this.values,i=e.getValue(),r=e.offset;if(s[r+0]!==i.r||s[r+1]!==i.g||s[r+2]!==i.b){const l=this.buffer;l[r+0]=s[r+0]=i.r,l[r+1]=s[r+1]=i.g,l[r+2]=s[r+2]=i.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1;const s=this.values,i=e.getValue().elements,r=e.offset;if(s[r+0]!==i[0]||s[r+1]!==i[1]||s[r+2]!==i[2]||s[r+4]!==i[3]||s[r+5]!==i[4]||s[r+6]!==i[5]||s[r+8]!==i[6]||s[r+9]!==i[7]||s[r+10]!==i[8]){const l=this.buffer;l[r+0]=s[r+0]=i[0],l[r+1]=s[r+1]=i[1],l[r+2]=s[r+2]=i[2],l[r+4]=s[r+4]=i[3],l[r+5]=s[r+5]=i[4],l[r+6]=s[r+6]=i[5],l[r+8]=s[r+8]=i[6],l[r+9]=s[r+9]=i[7],l[r+10]=s[r+10]=i[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1;const s=this.values,i=e.getValue().elements,r=e.offset;return l9(s,i,r)===!1&&(this.buffer.set(i,r),o9(s,i,r),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}}function o9(o,e,t){for(let s=0,i=e.length;s<i;s++)o[t+s]=e[s]}function l9(o,e,t){for(let s=0,i=e.length;s<i;s++)if(o[t+s]!==e[s])return!1;return!0}let u9=0;class I3 extends a9{constructor(e,t){super(e),this.id=u9++,this.groupNode=t,this.isNodeUniformsGroup=!0}}class k3 extends O3{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}}let c9=0;class h9 extends k3{constructor(e,t){super(e,t),this.id=c9++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class Sy extends h9{constructor(e,t,s,i=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=s,this.access=i}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class H3 extends Sy{constructor(e,t,s,i=null){super(e,t,s,i),this.isSampledCubeTexture=!0}}class O_ extends Sy{constructor(e,t,s,i=null){super(e,t,s,i),this.isSampledTexture3D=!0}}const Vw={bitcast_int_uint:new Dt("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Dt("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Dt(` 97vec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset, bool flipY ) { 98 if ( flipY ) offset.y = - offset.y; 99 vec2 size = vec2( textureSize( map, 0 ) );
100 vec2 st = floor( coord * size + vec2( offset ) - 0.5 ); 101 vec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy; 102 vec4 ret = vec4( 103 textureLod( map, ij.xw, 0.0 )[ comp ], 104 textureLod( map, ij.zw, 0.0 )[ comp ], 105 textureLod( map, ij.zy, 0.0 )[ comp ], 106 textureLod( map, ij.xy, 0.0 )[ comp ] 107 ); 108 return flipY ? ret.wzyx : ret; 109} 110`),textureGatherArray:new Dt(` 111vec4 tsl_textureGather_array( const int comp, sampler2DArray map, vec3 coord, ivec2 offset, bool flipY ) { 112 if ( flipY ) offset.y = - offset.y; 113 vec2 size = vec2( textureSize( map, 0 ).xy ); 114 vec2 st = floor( coord.xy * size + vec2( offset ) - 0.5 ); 115 vec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy; 116 vec4 ret = vec4( 117 textureLod( map, vec3( ij.xw, coord.z ), 0.0 )[ comp ], 118 textureLod( map, vec3( ij.zw, coord.z ), 0.0 )[ comp ], 119 textureLod( map, vec3( ij.zy, coord.z ), 0.0 )[ comp ], 120 textureLod( map, vec3( ij.xy, coord.z ), 0.0 )[ comp ] 121 ); 122 return flipY ? ret.wzyx : ret; 123} 124`),textureGatherCompare:new Dt(` 125vec4 tsl_textureGatherCompare( sampler2DShadow map, vec2 coord, ivec2 offset, float ref, bool flipY ) { 126 if ( flipY ) offset.y = - offset.y; 127 vec2 size = vec2( textureSize( map, 0 ) ); 128 vec2 st = floor( coord * size + vec2( offset ) - 0.5 ); 129 vec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy; 130 vec4 ret = vec4( 131 textureLod( map, vec3( ij.xw, ref ), 0.0 ), 132 textureLod( map, vec3( ij.zw, ref ), 0.0 ), 133 textureLod( map, vec3( ij.zy, ref ), 0.0 ), 134 textureLod( map, vec3( ij.xy, ref ), 0.0 ) 135 ); 136 return flipY ? ret.wzyx : ret; 137} 138`),textureGatherCompareArray:new Dt(` 139vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2 offset, float ref, bool flipY ) { 140 if ( flipY ) offset.y = - offset.y; 141 vec2 size = vec2( textureSize( map, 0 ).xy ); 142 vec2 st = floor( coord.xy * size + vec2( offset ) - 0.5 ); 143 vec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy; 144 vec4 ret = vec4( 145 texture( map, vec4( ij.xw, coord.z, ref ) ), 146 texture( map, vec4( ij.zw, coord.z, ref ) ), 147 texture( map, vec4( ij.zy, coord.z, ref ) ), 148 texture( map, vec4( ij.xy, coord.z, ref ) ) 149 ); 150 return flipY ? ret.wzyx : ret; 151} 152`)},d9={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},Gw={low:"lowp",medium:"mediump",high:"highp"},Iw={swizzleAssign:!0,storageBuffer:!1},kw={perspective:"smooth",linear:"noperspective"},Hw={centroid:"centroid"},qw=` 153precision highp float; 154precision highp int; 155precision highp sampler2D; 156precision highp sampler3D; 157precision highp samplerCube; 158precision highp sampler2DArray; 159 160precision highp usampler2D; 161precision highp usampler3D; 162precision highp usamplerCube; 163precision highp usampler2DArray; 164 165precision highp isampler2D; 166precision highp isampler3D; 167precision highp isamplerCube; 168precision highp isampler2DArray; 169 170precision highp sampler2DShadow; 171precision highp sampler2DArrayShadow; 172precision highp samplerCubeShadow; 173`;class f9 extends U3{constructor(e,t){super(e,t,new k8),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==bo}_include(e){const t=Vw[e];return t.build(this),this.addInclude(t),t}getMethod(e){return Vw[e]!==void 0&&this._include(e),d9[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,s){return`${e} ? ${t} : ${s}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,s=this.flowShaderNode(e),i=[];for(const l of t.inputs)i.push(this.getType(l.type)+" "+l.name);return`${this.getType(t.type)} ${t.name}( ${i.join(", ")} ) { 174 175 ${s.vars} 176 177${s.code} 178 return ${s.result}; 179 180}`}setupPBO(e){const t=e.value;if(t.pbo===void 0){const s=t.array,i=t.count*t.itemSize,{itemSize:r}=t,l=t.array.constructor.name.toLowerCase().includes("int");let u=l?Ac:Mc;r===2?u=l?Nc:xn:r===3?u=l?j_:Sc:r===4&&(u=l?zg:ki);const h={Float32Array:_s,Uint8Array:Ds,Uint16Array:po,Uint32Array:Ut,Int8Array:fl,Int16Array:pl,Int32Array:ps,Uint8ClampedArray:Ds},d=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(i/r))));let p=Math.ceil(i/r/d);d*p*r<i&&p++;const m=d*p*r,y=new s.constructor(m);y.set(s,0),t.array=y;const b=new qR(t.array,d,p,u,h[t.array.constructor.name]||_s);b.needsUpdate=!0,b.isPBOTexture=!0;const _=new vr(b,null,null);_.setPrecision("high"),t.pboNode=_,t.pbo=_.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){const{node:t,indexNode:s}=e,i=t.value;if(this.renderer.backend.has(i)){const p=this.renderer.backend.get(i);p.pbo=i.pbo}const r=this.getUniformFromNode(i.pboNode,"texture",this.shaderStage,this.context.nodeName),l=this.getPropertyName(r);this.increaseUsage(s);const u=s.build(this,"uint"),h=this.getDataFromNode(e);let d=h.propertyName;if(d===void 0){const p=this.getVarFromNode(e);d=this.getPropertyName(p);const m=this.getDataFromNode(t);let y=m.propertySizeName;y===void 0&&(y=d+"Size",this.getVarFromNode(t,y,"uint"),this.addLineFlowCode(`${y} = uint( textureSize( ${l}, 0 ).x )`,e),m.propertySizeName=y);const{itemSize:b}=i,_="."+wl.join("").slice(0,b),v=`ivec2(${u} % ${y}, ${u} / ${y})`,M=this.generateTextureLoad(null,l,v,"0",null,null);let A="vec4";i.pbo.type===Ut?A="uvec4":i.pbo.type===ps&&(A="ivec4"),this.addLineFlowCode(`${d} = ${A}(${M})${_}`,e),h.propertyName=d}return d}generateTextureLoad(e,t,s,i,r,l){i===null&&(i="0");let u;return r?l?u=`texelFetchOffset( ${t}, ivec3( ${s}, ${r} ), int( ${i} ), ${l} )`:u=`texelFetch( ${t}, ivec3( ${s}, ${r} ), int( ${i} ) )`:l?u=`texelFetchOffset( ${t}, ${s}, int( ${i} ), ${l} )`:u=`texelFetch( ${t}, ${s}, int( ${i} ) )`,e!==null&&e.isDepthTexture&&(u+=".x"),u}generateTexture(e,t,s,i,r){return i&&(s=`vec3( ${s}, ${i} )`),e.isDepthTexture?r?`textureOffset( ${t}, ${s}, ${r} ).x`:`texture( ${t}, ${s} ).x`:r?`textureOffset( ${t}, ${s}, ${r} )`:`texture( ${t}, ${s} )`}generateTextureLevel(e,t,s,i,r,l){return r&&(s=`vec3( ${s}, ${r} )`),l?`textureLodOffset( ${t}, ${s}, ${i}, ${l} )`:`textureLod( ${t}, ${s}, ${i} )`}generateTextureBias(e,t,s,i,r,l){return r&&(s=`vec3( ${s}, ${r} )`),l?`textureOffset( ${t}, ${s}, ${l}, ${i} )`:`texture( ${t}, ${s}, ${i} )`}generateTextureGrad(e,t,s,i,r,l){return r&&(s=`vec3( ${s}, ${r} )`),l?`textureGradOffset( ${t}, ${s}, ${i[0]}, ${i[1]}, ${l} )`:`textureGrad( ${t}, ${s}, ${i[0]}, ${i[1]} )`}generateTextureCompare(e,t,s,i,r,l,u=this.shaderStage){if(u==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${s}, ${i} ) )`:r?l?`textureOffset( ${t}, vec4( ${s}, ${r}, ${i} ), ${l} )`:`texture( ${t}, vec4( ${s}, ${r}, ${i} ) )`:l?`textureOffset( ${t}, vec3( ${s}, ${i} ), ${l} )`:`texture( ${t}, vec3( ${s}, ${i} ) )`;he(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${u} shader.`)}generateTextureGather(e,t,s,i,r,l,u){return e.isDepthTexture&&(i="0"),l===null&&(l="ivec2( 0 )"),u===null&&(u="false"),r?(this._include("textureGatherArray"),`tsl_textureGather_array( ${i}, ${t}, vec3( ${s}, ${r} ), ${l}, ${u} )`):(this._include("textureGather"),`tsl_textureGather( ${i}, ${t}, ${s}, ${l}, ${u} )`)}generateTextureGatherCompare(e,t,s,i,r,l,u){return l===null&&(l="ivec2( 0 )"),u===null&&(u="false"),r?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${s}, ${r} ), ${l}, ${i}, ${u} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${s}, ${l}, ${i}, ${u} )`)}getUniforms(e){const t=this.uniforms[e],s=[],i={};for(const l of t){let u=null,h=!1;if(l.type==="texture"||l.type==="texture3D"){const d=l.node,p=d.value;let m="";(p.isDataTexture===!0||p.isData3DTexture===!0)&&(p.type===Ut?m="u":p.type===ps&&(m="i")),l.type==="texture3D"&&p.isArrayTexture===!1?u=`${m}sampler3D ${l.name};`:p.compareFunction&&d.compareNode!==null?p.isArrayTexture===!0?u=`sampler2DArrayShadow ${l.name};`:u=`sampler2DShadow ${l.name};`:p.isArrayTexture===!0||p.isDataArrayTexture===!0||p.isCompressedArrayTexture===!0?u=`${m}sampler2DArray ${l.name};`:u=`${m}sampler2D ${l.name};`}else if(l.type==="cubeTexture")u=`samplerCube ${l.name};`;else if(l.type==="cubeDepthTexture")l.node.value.compareFunction?u=`samplerCubeShadow ${l.name};`:u=`samplerCube ${l.name};`;else if(l.type==="buffer"){const d=l.node,p=this.getType(d.bufferType),m=d.bufferCount,y=m>0?m:"";u=`${d.name} { 181 ${p} ${l.name}[${y}]; 182}; 183`}else{const d=l.groupNode.name;if(i[d]===void 0){const p=this.uniformGroups[d];if(p!==void 0){const m=[];for(const y of p.uniforms){const b=y.getType(),_=this.getVectorType(b),v=y.nodeUniform.node.precision;let M=`${_} ${y.name};`;v!==null&&(M=Gw[v]+" "+M),m.push(" "+M)}i[d]=m}}h=!0}if(!h){const d=l.node.precision;d!==null&&(u=Gw[d]+" "+u),u="uniform "+u,s.push(u)}}let r="";for(const l in i){const u=i[l];
183r+=this._getGLSLUniformStruct(l,u.join(` 184`))+` 185`}return r+=s.join(` 186`),r}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==ps){let s=e;e.isInterleavedBufferAttribute&&(s=e.data);const i=s.array;i instanceof Uint32Array||i instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){const s=this.getAttributesArray();let i=0;for(const r of s)t+=`layout( location = ${i++} ) in ${r.type} ${r.name}; 187`}return t}getStructMembers(e){const t=[];for(const s of e.members)t.push(` ${s.type} ${s.name};`);return t.join(` 188`)}getStructs(e){const t=[],s=this.structs[e],i=[];for(const r of s)if(r.output)for(const l of r.members)i.push(`layout( location = ${l.index} ) out ${l.type} ${l.name};`);else{let l="struct "+r.name+` { 189`;l+=this.getStructMembers(r),l+=` 190}; 191`,t.push(l)}return e==="fragment"&&i.length===0&&i.push(`layout( location = 0 ) out ${this.getOutputType()} fragColor;`),` 192`+i.join(` 193`)+` 194 195`+t.join(` 196`)}getVaryings(e){let t="";const s=this.varyings;if(e==="vertex"||e==="compute")for(const i of s){e==="compute"&&(i.needsInterpolation=!0);const r=this.getType(i.type);if(i.needsInterpolation)if(i.interpolationType){const l=kw[i.interpolationType]||i.interpolationType,u=Hw[i.interpolationSampling]||"";t+=`${l} ${u} out ${r} ${i.name}; 197`}else{const l=r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":"";t+=`${l}out ${r} ${i.name}; 198`}else t+=`${r} ${i.name}; 199`}else if(e==="fragment"){for(const i of s)if(i.needsInterpolation){const r=this.getType(i.type);if(i.interpolationType){const l=kw[i.interpolationType]||i.interpolationType,u=Hw[i.interpolationSampling]||"";t+=`${l} ${u} in ${r} ${i.name}; 200`}else{const l=r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":"";t+=`${l}in ${r} ${i.name}; 201`}}}for(const i of this.builtins[e])t+=`${i}; 202`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((s,i)=>
202s*i,1)}u`}getSubgroupSize(){he("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){he("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){he("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,s=this.shaderStage){const i=this.extensions[s]||(this.extensions[s]=new Map);i.has(e)===!1&&i.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if(e==="vertex"){const i=this.renderer.backend.extensions;this.object.isBatchedMesh&&i.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const s=this.extensions[e];if(s!==void 0)for(const{name:i,behavior:r}of s.values())t.push(`#extension ${i} : ${r}`);return t.join(` 203`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=Iw[e];if(t===void 0){let s;switch(t=!1,e){case"float32Filterable":s="OES_texture_float_linear";break;case"clipDistance":s="WEBGL_clip_cull_distance";break}if(s!==void 0){const i=this.renderer.backend.extensions;i.has(s)&&(i.get(s),t=!0)}Iw[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}
203enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let s=0;s<e.length;s++){const i=e[s],r=this.getPropertyName(i.attributeNode);r&&(t+=`${i.varyingName} = ${r}; 204 `)}return t}_getGLSLUniformStruct(e,t){return` 205layout( std140 ) uniform ${e} { 206${t} 207};`}_getGLSLVertexCode(e){return`#version 300 es 208 209${this.getSignature()} 210 211// extensions 212${e.extensions} 213 214// precision 215${qw} 216 217// structs 218${e.structs} 219 220// uniforms 221${e.uniforms} 222 223// varyings 224${e.varyings} 225 226// attributes 227${e.attributes} 228 229// vars 230${e.vars} 231 232// codes 233${e.codes} 234 235void main() { 236 237 // transforms 238 ${e.transforms} 239 240 // flow 241 ${e.flow} 242 243 gl_PointSize = 1.0; 244 245} 246`}_getGLSLFragmentCode(e){return`#version 300 es 247 248${this.getSignature()} 249 250// extensions 251${e.extensions} 252 253// precision 254${qw} 255 256// structs 257${e.structs} 258 259// uniforms 260${e.uniforms} 261 262// varyings 263${e.varyings} 264 265// vars 266${e.vars} 267 268// codes 269${e.codes} 270 271void main() { 272 273 // flow 274 ${e.flow} 275 276} 277`}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){let s=`// code 278 279`;s+=this.flowCode[t];const i=this.flowNodes[t],r=i[i.length-1];for(const u of i){const h=this.getFlowData(u),d=u.name;d&&(s.length>0&&(s+=` 280`),s+=` // flow -> ${d} 281 `),s+=`${h.code} 282 `,u===r&&t!=="compute"&&(s+=`// result 283 `,t==="vertex"?(s+="gl_Position = ",s+=`${this.format(h.result,r.getNodeType(this),"vec4")};`):t==="fragment"&&(u.outputNode.isOutputStructNode||(s+="fragColor = ",s+=`${this.format(h.result,r.getNodeType(this),this.getOutputType())};`)))}const l=e[t];if(l.extensions=this.getExtensions(t),l.uniforms=this.getUniforms(t),l.attributes=this.getAttributes(t),l.varyings=this.getVaryings(t),l.vars=this.getVars(t,!0),l.structs=this.getStructs(t),l.codes=this.getCodes(t),l.transforms=this.getTransforms(t),l.flow=s,t==="vertex"){const u=this.renderer.backend.extensions;this.object.isBatchedMesh&&u.has("WEBGL_multi_draw")===!1&&(l.uniforms+=` 284uniform uint nodeUniformDrawId; 285`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,s,i=null){const r=super.getUniformFromNode(e,t,s,i),l=this.getDataFromNode(e,s,this.globalCache);let u=l.uniformGPU;if(u===void 0){const h=e.groupNode,d=h.name,p=this.getBindGroupArray(d,s);if(t==="texture")u=new Sy(r.name,r.node,h),p.push(u);else if(t==="cubeTexture"||t==="cubeDepthTexture")u=new H3(r.name,r.node,h),p.push(u);else if(t==="texture3D")u=new O_(r.name,r.node,h),p.push(u);else if(t==="buffer"){r.name=`buffer${e.id}`;const m=this.getSharedDataFromNode(e);let y=m.buffer;y===void 0&&(e.name=`NodeBuffer_${e.id}`,y=new G3(e,h),y.name=e.name,m.buffer=y),p.push(y),u=y}else{let m=this.uniformGroups[d];m===void 0?(m=new I3(d,h),this.uniformGroups[d]=m,p.push(m)):p.indexOf(m)===-1&&p.push(m),u=this.getNodeUniform(r,t);const y=u.name;m.uniforms.some(_=>_.name===y)||m.addUniform(u)}l.uniformGPU=u}return r}}let qb=null,zu=null;class q3{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[hr.RENDER]:null,[hr.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),s=this.renderer.info.frame;let i;e.isComputeNode===!0?i="c:"+this.renderer.info.compute.frameCalls:i="r:"+this.renderer.info.render.frameCalls,t.timestampUID=i+":"+e.id+":f"+s}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?hr.COMPUTE:hr.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){Ye("WebGPURenderer: Timestamp tracking is disabled.");return}const t=this.timestampQueryPool[e];if(!t)return;const s=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=s,s}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return qb=qb||new Fe,this.renderer.getDrawingBufferSize(qb)}setScissorTest(){}getClearColor(){const e=this.renderer;return zu=zu||new wv,e.getClearColor(zu),zu.getRGB(zu),zu}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:NL(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Ed} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}}let p9=0;class m9{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}}class g9{constructor(e){this.backend=e}createAttribute(e,t){const s=this.backend,{gl:i}=s,r=e.array,l=e.usage||i.STATIC_DRAW,u=e.isInterleavedBufferAttribute?e.data:e,h=s.get(u);let d=h.bufferGPU;d===void 0&&(d=this._createBuffer(i,t,r,l),h.bufferGPU=d,h.bufferType=t,h.version=u.version);let p;if(r instanceof Float32Array)p=i.FLOAT;else if(typeof Float16Array<"u"&&r instanceof Float16Array)p=i.HALF_FLOAT;else if(r instanceof Uint16Array)e.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(r instanceof Int16Array)p=i.SHORT;else if(r instanceof Uint32Array)p=i.UNSIGNED_INT;else if(r instanceof Int32Array)p=i.INT;else if(r instanceof Int8Array)p=i.BYTE;else if(r instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+r);let m={bufferGPU:d,bufferType:t,type:p,byteLength:r.byteLength,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:p===i.INT||p===i.UNSIGNED_INT||e.gpuType===ps,id:p9++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const y=this._createBuffer(i,t,r,l);m=new m9(m,y)}s.set(e,m)}updateAttribute(e){const t=this.backend,{gl:s}=t,i=e.array,r=e.isInterleavedBufferAttribute?e.data:e,l=t.get(r),u=l.bufferType,h=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(s.bindBuffer(u,l.bufferGPU),h.length===0)s.bufferSubData(u,0,i);else{for(let d=0,p=h.length;d<p;d++){const m=h[d];s.bufferSubData(u,m.start*i.BYTES_PER_ELEMENT,i,m.start,m.count)}r.clearUpdateRanges()}s.bindBuffer(u,null),l.version=r.version}destroyAttribute(e){const t=this.backend,{gl:s}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);const i=t.get(e);s.deleteBuffer(i.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,s=0,i=-1){const r=this.backend,{gl:l}=r,u=e.isInterleavedBufferAttribute?e.data:e,h=r.get(u),{bufferGPU:d}=h,p=i===-1?h.byteLength-s:i;let m;
285if(t===null)m=new Uint8Array(new ArrayBuffer(p));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");const y=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",y),t.removeEventListener("dispose",y)};t.addEventListener("release",y),t.addEventListener("dispose",y),m=new Uint8Array(new ArrayBuffer(p)),t.buffer=m.buffer}else m=new Uint8Array(t);return l.bindBuffer(l.COPY_READ_BUFFER,d),l.getBufferSubData(l.COPY_READ_BUFFER,s,m),l.bindBuffer(l.COPY_READ_BUFFER,null),l.bindBuffer(l.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:m.buffer}_createBuffer(e,t,s,i){const r=e.createBuffer();return e.bindBuffer(t,r),e.bufferData(t,s,i),e.bindBuffer(t,null),r}}let Xh,Kr;class y9{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;Xh={[yn]:e.FUNC_ADD,[xR]:e.FUNC_SUBTRACT,[bR]:e.FUNC_REVERSE_SUBTRACT},Kr={[no]:e.ZERO,[_R]:e.ONE,[TR]:e.SRC_COLOR,[Td]:e.SRC_ALPHA,[wR]:e.SRC_ALPHA_SATURATE,[AR]:e.DST_COLOR,[SR]:e.DST_ALPHA,[vR]:e.ONE_MINUS_SRC_COLOR,[vd]:e.ONE_MINUS_SRC_ALPHA,[NR]:e.ONE_MINUS_DST_COLOR,[MR]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),s=e.getParameter(e.VIEWPORT);this.currentScissor=new ht().fromArray(t),this.currentViewport=new ht().fromArray(s),this._tempVec4=new ht}enable(e){const{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==jF?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===YF?t.cullFace(t.BACK):e===ZF?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:s}=this;e!==t&&(s.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,s){const i=this.gl,r=this.backend.drawBuffersIndexedExt;if(!r){Ye("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let l=0;l<e.length;l++){const u=e[l];let h=null;if(t!==null){const d=t.getBlendMode(u.name);d.blending===I_?h=s:d.blending!==ua&&(h=d)}else h=s;h!==null?this._setMRTBlendingIndex(l,h):r.blendFuncSeparateiOES(l,i.ONE,i.ZERO,i.ONE,i.ZERO)}}_setMRTBlendingIndex(e,t){const{gl:s}=this,i=this.backend.drawBuffersIndexedExt,r=t.blending,l=t.blendSrc,u=t.blendDst,h=t.blendEquation,d=t.premultipliedAlpha;if(r===ic){const p=t.blendSrcAlpha!==null?t.blendSrcAlpha:l,m=t.blendDstAlpha!==null?t.blendDstAlpha:u,y=t.blendEquationAlpha!==null?t.blendEquationAlpha:h;i.blendEquationSeparateiOES(e,Xh[h],Xh[y]),i.blendFuncSeparateiOES(e,Kr[l],Kr[u],Kr[p],Kr[m])}else if(i.blendEquationSeparateiOES(e,s.FUNC_ADD,s.FUNC_ADD),d)switch(r){case gn:i.blendFuncSeparateiOES(e,s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ku:i.blendFuncSeparateiOES(e,s.ONE,s.ONE,s.ONE,s.ONE);break;case Ju:i.blendFuncSeparateiOES(e,s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case ec:i.blendFuncSeparateiOES(e,s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:i.blendFuncSeparateiOES(e,s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break}else switch(r){case gn:i.blendFuncSeparateiOES(e,s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ku:i.blendFuncSeparateiOES(e,s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case Ju:i.blendFuncSeparateiOES(e,s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case ec:i.blendFuncSeparateiOES(e,s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:i.blendFuncSeparateiOES(e,s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,s,i,r,l,u,h){const{gl:d}=this;if(e===ua){this.currentBlendingEnabled===!0&&(this.disable(d.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(d.BLEND),this.currentBlendingEnabled=!0),e!==ic){if(e!==this.currentBlending||h!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==yn||this.currentBlendEquationAlpha!==yn)&&(d.blendEquation(d.FUNC_ADD),this.currentBlendEquation=yn,this.currentBlendEquationAlpha=yn),h)switch(e){case gn:d.blendFuncSeparate(d.ONE,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA);break;case Ku:d.blendFunc(d.ONE,d.ONE);break;case Ju:d.blendFuncSeparate(d.ZERO,d.ONE_MINUS_SRC_COLOR,d.ZERO,d.ONE);break;case ec:d.blendFuncSeparate(d.DST_COLOR,d.ONE_MINUS_SRC_ALPHA,d.ZERO,d.ONE);break;default:he("WebGLState: Invalid blending: ",e);break}else switch(e){case gn:d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA);break;case Ku:d.blendFuncSeparate(d.SRC_ALPHA,d.ONE,d.ONE,d.ONE);break;case Ju:he("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case ec:he("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:he("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=h}return}r=r||t,l=l||s,u=u||i,(t!==this.currentBlendEquation||r!==this.currentBlendEquationAlpha)&&(d.blendEquationSeparate(Xh[t],Xh[r]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=r),(s!==this.currentBlendSrc||i!==this.currentBlendDst||l!==this.currentBlendSrcAlpha||u!==this.currentBlendDstAlpha)&&(d.blendFuncSeparate(Kr[s],Kr[i],Kr[l],Kr[u]),this.currentBlendSrc=s,this.currentBlendDst=i,this.currentBlendSrcAlpha=l,this.currentBlendDstAlpha=u),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){const{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){const t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=zR[e]),this.currentDepthFunc!==e){const{gl:t}=this;switch(e){case wm:t.depthFunc(t.NEVER);break;case Rm:t.depthFunc(t.ALWAYS);break;case Em:t.depthFunc(t.LESS);break;case hc:t.depthFunc(t.LEQUAL);break;case Cm:t.depthFunc(t.EQUAL);break;case Bm:t.depthFunc(t.GEQUAL);break;case Dm:t.depthFunc(t.GREATER);break;case Um:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,s,i){const r=this._tempVec4.set(e,t,s,i);if(this.currentScissor.equals(r)===!1){const{gl:l}=this;l.scissor(r.x,r.y,r.z,r.w),this.currentScissor.copy(r)}}viewport(e,t,s,i){const r=this._tempVec4.set(e,t,s,i);if(this.currentViewport.equals(r)===!1){const{gl:l}=this;l.viewport(r.x,r.y,r.z,r.w),this.currentViewport.copy(r)}}setScissorTest(e){const t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){const{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,s){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==s)&&(this.gl.stencilFunc(e,t,s),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=s)}setStencilOp(e,t,s){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==s)&&(this.gl.stencilOp(e,t,s),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=s)}setMaterial(e,t,s){const{gl:i}=this;e.side===la?this.disable(i.CULL_FACE):this.enable(i.CULL_FACE);let r=e.side===Ts;t&&(r=!r),this.setFlipSided(r),e.blending===gn&&e.transparent===!1?this.setBlending(ua):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);const l=e.stencilWrite;if(this.setStencilTest(l),l&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(i.SAMPLE_ALPHA_TO_COVERAGE):this.disable(i.SAMPLE_ALPHA_TO_COVERAGE),s>0&&this.currentClippingPlanes!==s)for(let h=0;h<8;h++)h<s?this.enable(12288+h):this.disable(12288+h)}setPolygonOffset(e,t,s){const{gl:i}=this;e?(this.enable(i.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==s)&&(i.polygonOffset(t,s),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=s)):this.disable(i.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){const s=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(s.bindVertexArray(e),t!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){const e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){const{gl:s,currentBoundFramebuffers:i}=this;return i[e]!==t?(s.bindFramebuffer(e,t),i[e]=t,e===s.DRAW_FRAMEBUFFER&&(i[s.FRAMEBUFFER]=t),e===s.FRAMEBUFFER&&(i[s.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){const{gl:s}=this;let i=[],r=!1;if(e.textures!==null){i=this.currentDrawbuffers.get(t),i===void 0&&(i=[],this.currentDrawbuffers.set(t,i));const l=e.textures;if(i.length!==l.length||i[0]!==s.COLOR_ATTACHMENT0){for(let u=0,h=l.length;u<h;u++)i[u]=s.COLOR_ATTACHMENT0+u;i.length=l.length,r=!0}}else i[0]!==s.BACK&&(i[0]=s.BACK,r=!0);r&&s.drawBuffers(i)}activeTexture(e){const{gl:t,currentTextureSlot:s,maxTextures:i}=this;e===void 0&&(e=t.TEXTURE0+i-1),s!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,s){const{gl:i,currentTextureSlot:r,currentBoundTextures:l,maxTextures:u}=this;s===void 0&&(r===null?s=i.TEXTURE0+u-1:s=r);let h=l[s];h===void 0&&(h={type:void 0,texture:void 0},l[s]=h),(h.type!==e||h.texture!==t)&&(r!==s&&(i.activeTexture(s),this.currentTextureSlot=s),i.bindTexture(e,t),h.type=e,h.texture=t)}bindBufferBase(e,t,s){const{gl:i}=this,r=`${e}-${t}`;return this.currentBoundBufferBases[r]!==s?(i.bindBufferBase(e,t,s),this.currentBoundBufferBases[r]=s,!0):!1}unbindTexture(){const{gl:e,currentTextureSlot:t,currentBoundTextures:s}=this,i=s[t];i!==void 0&&i.type!==void 0&&(e.bindTexture(i.type,null),i.type=void 0,i.texture=void 0)}getParameter(e){const{gl:t,parameters:s}=this;return s[e]!==void 0?s[e]:t.getParameter(e)}pixelStorei(e,t){const{gl:s,parameters:i}=this;i[e]!==t&&(s.pixelStorei(e,t),i[e]=t)}}class x9{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=bo){const{gl:s,extensions:i}=this;let r;const l=lt.getTransfer(t);if(e===Ds)return s.UNSIGNED_BYTE;if(e===$_)return s.UNSIGNED_SHORT_4_4_4_4;if(e===W_)return s.UNSIGNED_SHORT_5_5_5_1;if(e===Lg)return s.UNSIGNED_INT_5_9_9_9_REV;if(e===Og)return s.UNSIGNED_INT_10F_11F_11F_REV;if(e===fl)return s.BYTE;if(e===pl)return s.SHORT;if(e===po)return s.UNSIGNED_SHORT;if(e===ps)return s.INT;if(e===Ut)return s.UNSIGNED_INT;if(e===_s)return s.FLOAT;if(e===Jt)return s.HALF_FLOAT;if(e===X_)return s.ALPHA;if(e===Sc)return s.RGB;if(e===ki)return s.RGBA;if(e===vn)return s.DEPTH_COMPONENT;if(e===fr)return s.DEPTH_STENCIL;if(e===Mc)return s.RED;if(e===Ac)return s.RED_INTEGER;if(e===xn)return s.RG;if(e===Nc)return s.RG_INTEGER;if(e===zg)return s.RGBA_INTEGER;if(e===ad||e===od||e===ld||e===ud)if(l===Ve)if(r=i.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(e===ad)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===od)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===ld)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===ud)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=i.get("WEBGL_compressed_texture_s3tc"),r!==null){if(e===ad)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===od)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===ld)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===ud)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===r_||e===a_||e===o_||e===l_)if(r=i.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(e===r_)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===a_)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===o_)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===l_)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===Om||e===zm||e===Pm||e===Vm||e===Gm||e===Sd||e===Im)if(r=i.get("WEBGL_compressed_texture_etc"),r!==null){if(e===Om||e===zm)return l===Ve?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(e===Pm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;
285if(e===Vm)return r.COMPRESSED_R11_EAC;if(e===Gm)return r.COMPRESSED_SIGNED_R11_EAC;if(e===Sd)return r.COMPRESSED_RG11_EAC;if(e===Im)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===km||e===Hm||e===qm||e===$m||e===Wm||e===Xm||e===jm||e===Ym||e===Zm||e===Qm||e===Km||e===Jm||e===eg||e===tg)if(r=i.get("WEBGL_compressed_texture_astc"),r!==null){if(e===km)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===Hm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===qm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===$m)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===Wm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===Xm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===jm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===Ym)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Zm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===Qm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===Km)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===Jm)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===eg)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===tg)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===sg||e===ig||e===ng)if(r=i.get("EXT_texture_compression_bptc"),r!==null){if(e===sg)return l===Ve?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===ig)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===ng)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===rg||e===ag||e===Md||e===og)if(r=i.get("EXT_texture_compression_rgtc"),r!==null){if(e===rg)return r.COMPRESSED_RED_RGTC1_EXT;if(e===ag)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===Md)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===og)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ha?s.UNSIGNED_INT_24_8:s[e]!==void 0?s[e]:null}_clientWaitAsync(){const{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((s,i)=>{function r(){const l=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(l===e.WAIT_FAILED){e.deleteSync(t),i();return}if(l===e.TIMEOUT_EXPIRED){requestAnimationFrame(r);return}e.deleteSync(t),s()}r()})}}let $w=!1,nm,$b,Ww;class b9{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,$w===!1&&(this._init(),$w=!0)}_init(){const e=this.gl;nm={[fc]:e.REPEAT,[cr]:e.CLAMP_TO_EDGE,[pc]:e.MIRRORED_REPEAT},$b={[$t]:e.NEAREST,[ER]:e.NEAREST_MIPMAP_NEAREST,[mc]:e.NEAREST_MIPMAP_LINEAR,[Ss]:e.LINEAR,[n_]:e.LINEAR_MIPMAP_NEAREST,[ca]:e.LINEAR_MIPMAP_LINEAR},Ww={[BR]:e.NEVER,[FR]:e.ALWAYS,[Y_]:e.LESS,[Cd]:e.LEQUAL,[DR]:e.EQUAL,[gc]:e.GEQUAL,[cg]:e.GREATER,[UR]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let s;return e.isCubeTexture===!0?s=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?s=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?s=t.TEXTURE_3D:s=t.TEXTURE_2D,s}getInternalFormat(e,t,s,i,r,l=!1){const{gl:u,extensions:h}=this;if(e!==null){if(u[e]!==void 0)return u[e];me("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let d=null;i&&(d=h.get("EXT_texture_norm16"),d||me("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let p=t;if(t===u.RED&&(s===u.FLOAT&&(p=u.R32F),s===u.HALF_FLOAT&&(p=u.R16F),s===u.UNSIGNED_BYTE&&(p=u.R8),s===u.BYTE&&(p=u.R8_SNORM),s===u.UNSIGNED_SHORT&&d&&(p=d.R16_EXT),s===u.SHORT&&d&&(p=d.R16_SNORM_EXT)),t===u.RED_INTEGER&&(s===u.UNSIGNED_BYTE&&(p=u.R8UI),s===u.UNSIGNED_SHORT&&(p=u.R16UI),s===u.UNSIGNED_INT&&(p=u.R32UI),s===u.BYTE&&(p=u.R8I),s===u.SHORT&&(p=u.R16I),s===u.INT&&(p=u.R32I)),t===u.RG&&(s===u.FLOAT&&(p=u.RG32F),s===u.HALF_FLOAT&&(p=u.RG16F),s===u.UNSIGNED_BYTE&&(p=u.RG8),s===u.BYTE&&(p=u.RG8_SNORM),s===u.UNSIGNED_SHORT&&d&&(p=d.RG16_EXT),s===u.SHORT&&d&&(p=d.RG16_SNORM_EXT)),t===u.RG_INTEGER&&(s===u.UNSIGNED_BYTE&&(p=u.RG8UI),s===u.UNSIGNED_SHORT&&(p=u.RG16UI),s===u.UNSIGNED_INT&&(p=u.RG32UI),s===u.BYTE&&(p=u.RG8I),s===u.SHORT&&(p=u.RG16I),s===u.INT&&(p=u.RG32I)),t===u.RGB){const m=l?ug:lt.getTransfer(r);s===u.FLOAT&&(p=u.RGB32F),s===u.HALF_FLOAT&&(p=u.RGB16F),s===u.UNSIGNED_BYTE&&(p=m===Ve?u.SRGB8:u.RGB8),s===u.BYTE&&(p=u.RGB8_SNORM),s===u.UNSIGNED_SHORT&&d&&(p=d.RGB16_EXT),s===u.SHORT&&d&&(p=d.RGB16_SNORM_EXT),s===u.UNSIGNED_SHORT_5_6_5&&(p=u.RGB565),s===u.UNSIGNED_SHORT_5_5_5_1&&(p=u.RGB5_A1),s===u.UNSIGNED_SHORT_4_4_4_4&&(p=u.RGB4),s===u.UNSIGNED_INT_5_9_9_9_REV&&(p=u.RGB9_E5),s===u.UNSIGNED_INT_10F_11F_11F_REV&&(p=u.R11F_G11F_B10F)}if(t===u.RGB_INTEGER&&(s===u.UNSIGNED_BYTE&&(p=u.RGB8UI),s===u.UNSIGNED_SHORT&&(p=u.RGB16UI),s===u.UNSIGNED_INT&&(p=u.RGB32UI),s===u.BYTE&&(p=u.RGB8I),s===u.SHORT&&(p=u.RGB16I),s===u.INT&&(p=u.RGB32I)),t===u.RGBA){const m=l?ug:lt.getTransfer(r);s===u.FLOAT&&(p=u.RGBA32F),s===u.HALF_FLOAT&&(p=u.RGBA16F),s===u.UNSIGNED_BYTE&&(p=m===Ve?u.SRGB8_ALPHA8:u.RGBA8),s===u.BYTE&&(p=u.RGBA8_SNORM),s===u.UNSIGNED_SHORT&&d&&(p=d.RGBA16_EXT),s===u.SHORT&&d&&(p=d.RGBA16_SNORM_EXT),s===u.UNSIGNED_SHORT_4_4_4_4&&(p=u.RGBA4),s===u.UNSIGNED_SHORT_5_5_5_1&&(p=u.RGB5_A1)}return t===u.RGBA_INTEGER&&(s===u.UNSIGNED_BYTE&&(p=u.RGBA8UI),s===u.UNSIGNED_SHORT&&(p=u.RGBA16UI),s===u.UNSIGNED_INT&&(p=u.RGBA32UI),s===u.BYTE&&(p=u.RGBA8I),s===u.SHORT&&(p=u.RGBA16I),s===u.INT&&(p=u.RGBA32I)),t===u.DEPTH_COMPONENT&&(s===u.UNSIGNED_SHORT&&(p=u.DEPTH_COMPONENT16),s===u.UNSIGNED_INT&&(p=u.DEPTH_COMPONENT24),s===u.FLOAT&&(p=u.DEPTH_COMPONENT32F)),t===u.DEPTH_STENCIL&&s===u.UNSIGNED_INT_24_8&&(p=u.DEPTH24_STENCIL8),(p===u.R16F||p===u.R32F||p===u.RG16F||p===u.RG32F||p===u.RGBA16F||p===u.RGBA32F)&&h.get("EXT_color_buffer_float"),p}setTextureParameters(e,t){const{gl:s,extensions:i,backend:r}=this,{state:l}=this.backend,u=lt.getPrimaries(lt.workingColorSpace),h=t.colorSpace
285===bo?null:lt.getPrimaries(t.colorSpace),d=t.colorSpace===bo||u===h?s.NONE:s.BROWSER_DEFAULT_WEBGL;l.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,t.flipY),l.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),l.pixelStorei(s.UNPACK_ALIGNMENT,t.unpackAlignment),l.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,d),s.texParameteri(e,s.TEXTURE_WRAP_S,nm[t.wrapS]),s.texParameteri(e,s.TEXTURE_WRAP_T,nm[t.wrapT]),(e===s.TEXTURE_3D||e===s.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||s.texParameteri(e,s.TEXTURE_WRAP_R,nm[t.wrapR])),s.texParameteri(e,s.TEXTURE_MAG_FILTER,$b[t.magFilter]);const p=t.mipmaps!==void 0&&t.mipmaps.length>0,m=t.minFilter===Ss&&p?ca:t.minFilter;if(s.texParameteri(e,s.TEXTURE_MIN_FILTER,$b[m]),t.compareFunction&&(s.texParameteri(e,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(e,s.TEXTURE_COMPARE_FUNC,Ww[t.compareFunction])),i.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===$t||t.minFilter!==mc&&t.minFilter!==ca||t.type===_s&&i.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const y=i.get("EXT_texture_filter_anisotropic");s.texParameterf(e,y.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,r.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:s,defaultTextures:i}=this,r=this.getGLTextureType(e);let l=i[r];l===void 0&&(l=t.createTexture(),s.state.bindTexture(r,l),t.texParameteri(r,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(r,t.TEXTURE_MAG_FILTER,t.NEAREST),i[r]=l),s.set(e,{textureGPU:l,glTextureType:r})}createTexture(e,t){const{gl:s,backend:i}=this;let r,l,u,h,d;if(e.isExternalTexture===!0)r=e.sourceTexture,l=this.getGLTextureType(e);else{const{levels:p,width:m,height:y,depth:b}=t;u=i.utils.convert(e.format,e.colorSpace),h=i.utils.convert(e.type),d=this.getInternalFormat(e.internalFormat,u,h,e.normalized,e.colorSpace,e.isVideoTexture),r=s.createTexture(),l=this.getGLTextureType(e),i.state.bindTexture(l,r),this.setTextureParameters(l,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?s.texStorage3D(s.TEXTURE_2D_ARRAY,p,d,m,y,b):e.isData3DTexture?s.texStorage3D(s.TEXTURE_3D,p,d,m,y,b):e.isVideoTexture||s.texStorage2D(l,p,d,m,y)}i.set(e,{textureGPU:r,glTextureType:l,glFormat:u,glType:h,glInternalFormat:d})}copyBufferToTexture(e,t){const{gl:s,backend:i}=this,{state:r}=i,{textureGPU:l,glTextureType:u,glFormat:h,glType:d}=i.get(t),{width:p,height:m}=t.source.data;s.bindBuffer(s.PIXEL_UNPACK_BUFFER,e),i.state.bindTexture(u,l),r.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.texSubImage2D(u,0,0,0,p,m,h,d,0),s.bindBuffer(s.PIXEL_UNPACK_BUFFER,null),i.state.unbindTexture()}updateTexture(e,t){const{gl:s}=this,{width:i,height:r}=t,{textureGPU:l,glTextureType:u,glFormat:h,glType:d,glInternalFormat:p}=this.backend.get(e);if(!(e.isRenderTargetTexture||l===void 0))if(this.backend.state.bindTexture(u,l),this.setTextureParameters(u,e),e.isCompressedTexture){const m=e.mipmaps,y=t.image;for(let b=0;b<m.length;b++){const _=m[b];e.isCompressedArrayTexture?e.format!==s.RGBA?h!==null?s.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,b,0,0,0,_.width,_.height,y.depth,h,_.data):me("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):s.texSubImage3D(s.TEXTURE_2D_ARRAY,b,0,0,0,_.width,_.height,y.depth,h,d,_.data):h!==null?s.compressedTexSubImage2D(s.TEXTURE_2D,b,0,0,_.width,_.height,h,_.data):me("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){const m=t.images,y=e.mipmaps;for(let b=0;b<6;b++){const _=rm(m[b]);s.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,0,0,i,r,h,d,_);for(let v=0;v<y.length;v++){const M=y[v],A=rm(M.images[b]);s.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+b,v+1,0,0,A.width,A.height,h,d,A)}}}else if(e.isDataArrayTexture||e.isArrayTexture){const m=t.image;if(e.layerUpdates.size>0){const y=zO(m.width,m.height,e.format,e.type);for(const b of e.layerUpdates){const _=m.data.subarray(b*y/m.data.BYTES_PER_ELEMENT,(b+1)*y/m.data.BYTES_PER_ELEMENT);s.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,b,m.width,m.height,1,h,d,_)}e.clearLayerUpdates()}else s.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,m.width,m.height,m.depth,h,d,m.data)}else if(e.isData3DTexture){const m=t.image;s.texSubImage3D(s.TEXTURE_3D,0,0,0,0,m.width,m.height,m.depth,h,d,m.data)}
285else if(e.isVideoTexture)e.update(),s.texImage2D(u,0,p,h,d,t.image);else if(e.isHTMLTexture)typeof s.texElementImage2D=="function"&&(s.texElementImage2D.length===3?s.texElementImage2D(s.TEXTURE_2D,s.RGBA8,t.image):s.texElementImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t.image));else{const m=e.mipmaps;if(m.length>0)for(let y=0,b=m.length;y<b;y++){const _=m[y],v=rm(_);s.texSubImage2D(u,y,0,0,_.width,_.height,h,d,v)}else{const y=rm(t.image);s.texSubImage2D(u,0,0,0,i,r,h,d,y)}}}generateMipmaps(e){const{gl:t,backend:s}=this,{textureGPU:i,glTextureType:r}=s.get(e);s.state.bindTexture(r,i),t.generateMipmap(r)}deallocateRenderBuffers(e){const{gl:t,backend:s}=this;if(e){const i=s.get(e);if(i.renderBufferStorageSetup=void 0,i.framebuffers){for(const r in i.framebuffers)t.deleteFramebuffer(i.framebuffers[r]);delete i.framebuffers}if(i.depthRenderbuffer&&(t.deleteRenderbuffer(i.depthRenderbuffer),delete i.depthRenderbuffer),i.stencilRenderbuffer&&(t.deleteRenderbuffer(i.stencilRenderbuffer),delete i.stencilRenderbuffer),i.msaaFrameBuffer&&(t.deleteFramebuffer(i.msaaFrameBuffer),delete i.msaaFrameBuffer),i.msaaRenderbuffers){for(let r=0;r<i.msaaRenderbuffers.length;r++)t.deleteRenderbuffer(i.msaaRenderbuffers[r]);delete i.msaaRenderbuffers}}}destroyTexture(e,t=!1){const{gl:s,backend:i}=this,{textureGPU:r,renderTarget:l}=i.get(e);this.deallocateRenderBuffers(l),t===!1&&e.isExternalTexture!==!0&&s.deleteTexture(r),i.delete(e)}copyTextureToTexture(e,t,s=null,i=null,r=0,l=0){const{gl:u,backend:h}=this,{state:d}=this.backend,{textureGPU:p,glTextureType:m,glType:y,glFormat:b}=h.get(t);d.bindTexture(m,p);let _,v,M,A,C,E,F,L,U;const R=e.isCompressedTexture?e.mipmaps[l]:e.image;if(s!==null)_=s.max.x-s.min.x,v=s.max.y-s.min.y,M=s.isBox3?s.max.z-s.min.z:1,A=s.min.x,C=s.min.y,E=s.isBox3?s.min.z:0;else{const ce=Math.pow(2,-r);_=Math.floor(R.width*ce),v=Math.floor(R.height*ce),e.isDataArrayTexture||e.isArrayTexture?M=R.depth:e.isData3DTexture?M=Math.floor(R.depth*ce):M=1,A=0,C=0,E=0}i!==null?(F=i.x,L=i.y,U=i.z):(F=0,L=0,U=0),d.pixelStorei(u.UNPACK_FLIP_Y_WEBGL,t.flipY),d.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),d.pixelStorei(u.UNPACK_ALIGNMENT,t.unpackAlignment);const V=d.getParameter(u.UNPACK_ROW_LENGTH),$=d.getParameter(u.UNPACK_IMAGE_HEIGHT),ie=d.getParameter(u.UNPACK_SKIP_PIXELS),le=d.getParameter(u.UNPACK_SKIP_ROWS),ye=d.getParameter(u.UNPACK_SKIP_IMAGES);d.pixelStorei(u.UNPACK_ROW_LENGTH,R.width),d.pixelStorei(u.UNPACK_IMAGE_HEIGHT,R.height),d.pixelStorei(u.UNPACK_SKIP_PIXELS,A),d.pixelStorei(u.UNPACK_SKIP_ROWS,C),d.pixelStorei(u.UNPACK_SKIP_IMAGES,E);const xe=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Ne=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){const ce=h.get(e),X=h.get(t),ne=h.get(ce.renderTarget),fe=h.get(X.renderTarget),Be=ne.framebuffers[ce.cacheKey],Ce=fe.framebuffers[X.cacheKey],G=d.currentBoundFramebuffers[u.READ_FRAMEBUFFER]??null,j=d.currentBoundFramebuffers[u.DRAW_FRAMEBUFFER]??null;d.bindFramebuffer(u.READ_FRAMEBUFFER,Be),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,Ce);for(let te=0;te<M;te++)xe&&(u.framebufferTextureLayer(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,ce.textureGPU,r,E+te),u.framebufferTextureLayer(u.DRAW_FRAMEBUFFER,u.COLOR_ATTACHMENT0,p,l,U+te)),u.blitFramebuffer(A,C,_,v,F,L,_,v,u.DEPTH_BUFFER_BIT,u.NEAREST);d.bindFramebuffer(u.READ_FRAMEBUFFER,G),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,j)}else if(r!==0||e.isRenderTargetTexture||h.has(e)){const ce=h.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=u.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=u.createFramebuffer());const X=d.currentBoundFramebuffers[u.READ_FRAMEBUFFER]??null,ne=d.currentBoundFramebuffers[u.DRAW_FRAMEBUFFER]??null;d.bindFramebuffer(u.READ_FRAMEBUFFER,this._srcFramebuffer),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let fe=0;fe<M;fe++)xe?u.framebufferTextureLayer(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,ce.textureGPU,r,E+fe):u.framebufferTexture2D(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,ce.textureGPU,r),Ne?u.framebufferTextureLayer(u.DRAW_FRAMEBUFFER,u.COLOR_ATTACHMENT0,p,l,U+fe):u.framebufferTexture2D(u.DRAW_FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,l),r!==0?u.blitFramebuffer(A,C,_,v,F,L,_,v,u.COLOR_BUFFER_BIT,u.NEAREST):Ne?u.copyTexSubImage3D(m,l,F,L,U+fe,A,C,_,v):u.copyTexSubImage2D(m,l,F,L,A,C,_,v);d.bindFramebuffer(u.READ_FRAMEBUFFER,X),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,ne)}else Ne?e.isDataTexture||e.isData3DTexture?u.texSubImage3D(m,l,F,L,U,_,v,M,b,y,R.data):t.isCompressedArrayTexture?u.compressedTexSubImage3D(m,l,F,L,U,_,v,M,b,R.data):u.texSubImage3D(m,l,F,L,U,_,v,M,b,y,R):e.isDataTexture?u.texSubImage2D(u.TEXTURE_2D,l,F,L,_,v,b,y,R.data):e.isCompressedTexture?u.compressedTexSubImage2D(u.TEXTURE_2D,l,F,L,R.width,R.height,b,R.data):u.texSubImage2D(u.TEXTURE_2D,l,F,L,_,v,b,y,R);d.pixelStorei(u.UNPACK_ROW_LENGTH,V),d.pixelStorei(u.UNPACK_IMAGE_HEIGHT,$),d.pixelStorei(u.UNPACK_SKIP_PIXELS,ie),d.pixelStorei(u.UNPACK_SKIP_ROWS,le),d.pixelStorei(u.UNPACK_SKIP_IMAGES,ye),l===0&&t.generateMipmaps&&u.generateMipmap(m),d.unbindTexture()}copyFramebufferToTexture(e,t,s){const{gl:i}=this,{state:r}=this.backend,{textureGPU:l}=this.backend.get(e),{x:u,y:h,z:d,w:p}=s,m=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,y=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(m){const b=u!==0||h!==0;let _,v;if(e.isDepthTexture===!0?(_=i.DEPTH_BUFFER_BIT,v=i.DEPTH_ATTACHMENT,t.stencil&&(_|=i.STENCIL_BUFFER_BIT)):(_=i.COLOR_BUFFER_BIT,v=i.COLOR_ATTACHMENT0),b){const M=this.backend.get(t.renderTarget),A=M.framebuffers[t.getCacheKey()],C=M.msaaFrameBuffer;r.bindFramebuffer(i.DRAW_FRAMEBUFFER,A),r.bindFramebuffer(i.READ_FRAMEBUFFER,C);const E=y-h-p;
vendor: 2,368 bytes, line 285
285i.blitFramebuffer(u,E,u+d,E+p,u,E,u+d,E+p,_,i.NEAREST),r.bindFramebuffer(i.READ_FRAMEBUFFER,A),r.bindTexture(i.TEXTURE_2D,l),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,u,E,d,p),r.unbindTexture()}else{const M=i.createFramebuffer();r.bindFramebuffer(i.DRAW_FRAMEBUFFER,M),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,v,i.TEXTURE_2D,l,0),i.blitFramebuffer(0,0,d,p,0,0,d,p,_,i.NEAREST),i.deleteFramebuffer(M)}}else r.bindTexture(i.TEXTURE_2D,l),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,u,y-p-h,d,p),r.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,s,i=!1){const{gl:r}=this,l=t.renderTarget,{depthTexture:u,depthBuffer:h,stencilBuffer:d,width:p,height:m}=l;if(r.bindRenderbuffer(r.RENDERBUFFER,e),h&&!d){let y=r.DEPTH_COMPONENT24;i===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(r.RENDERBUFFER,l.samples,y,p,m):s>0?(u&&u.isDepthTexture&&u.type===r.FLOAT&&(y=r.DEPTH_COMPONENT32F),r.renderbufferStorageMultisample(r.RENDERBUFFER,s,y,p,m)):r.renderbufferStorage(r.RENDERBUFFER,y,p,m),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,e)}else h&&d&&(s>0?r.renderbufferStorageMultisample(r.RENDERBUFFER,s,r.DEPTH24_STENCIL8,p,m):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,p,m),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,e));r.bindRenderbuffer(r.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,s,i,r,l){const{backend:u,gl:h}=this,{textureGPU:d,glFormat:p,glType:m}=this.backend.get(e),y=h.createFramebuffer();u.state.bindFramebuffer(h.READ_FRAMEBUFFER,y);const b=e.isCubeTexture?h.TEXTURE_CUBE_MAP_POSITIVE_X+l:h.TEXTURE_2D;h.framebufferTexture2D(h.READ_FRAMEBUFFER,h.COLOR_ATTACHMENT0,b,d,0);const _=this._getTypedArrayType(m),v=this._getBytesPerTexel(m,p),A=i*r*v,C=h.createBuffer();h.bindBuffer(h.PIXEL_PACK_BUFFER,C),h.bufferData(h.PIXEL_PACK_BUFFER,A,h.STREAM_READ),h.readPixels(t,s,i,r,p,m,0),h.bindBuffer(h.PIXEL_PACK_BUFFER,null),await u.utils._clientWaitAsync();const E=new _(A/_.BYTES_PER_ELEMENT);return h.bindBuffer(h.PIXEL_PACK_BUFFER,C),h.getBufferSubData(h.PIXEL_PACK_BUFFER,0,E),h.bindBuffer(h.PIXEL_PACK_BUFFER,null),u.state.bindFramebuffer(h.READ_FRAMEBUFFER,null),h.deleteFramebuffer(y),E}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;
285if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:s}=this;let i=0;if(e===s.UNSIGNED_BYTE&&(i=1),(e===s.UNSIGNED_SHORT_4_4_4_4||e===s.UNSIGNED_SHORT_5_5_5_1||e===s.UNSIGNED_SHORT_5_6_5||e===s.UNSIGNED_SHORT||e===s.HALF_FLOAT)&&(i=2),(e===s.UNSIGNED_INT||e===s.FLOAT)&&(i=4),t===s.RGBA)return i*4;if(t===s.RGB)return i*3;if(t===s.ALPHA)return i}dispose(){const{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}}function rm(o){return o.isDataTexture?o.image.data:typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&o instanceof OffscreenCanvas?o:o.data}class _9{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class T9{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){const s=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;const e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}}const Xw={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class v9{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:s,mode:i,object:r,type:l,info:u,index:h}=this;h!==0?s.drawElements(i,t,l,e):s.drawArrays(i,e,t),u.update(r,t,1)}renderInstances(e,t,s){const{gl:i,mode:r,type:l,index:u,object:h,info:d}=this;s!==0&&(u!==0?i.drawElementsInstanced(r,t,l,e,s):i.drawArraysInstanced(r,e,t,s),d.update(h,t,s))}renderMultiDraw(e,t,s){const{extensions:i,mode:r,object:l,info:u}=this;if(s===0)return;const h=i.get("WEBGL_multi_draw");if(h===null)for(let d=0;d<s;d++)this.render(e[d],t[d]);else{this.index!==0?h.multiDrawElementsWEBGL(r,t,0,this.type,e,0,s):h.multiDrawArraysWEBGL(r,e,0,t,0,s);let d=0;for(let p=0;p<s;p++)d+=t[p];u.update(l,d,1)}}}class $3{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(me(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}}class S9 extends $3{constructor(e,t,s=2048){if(super(s),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){me("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let i=0;i<this.maxQueries;i++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return Ye(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;const s=this.queries[t];
285if(s)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,s),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(i){he("Error in beginQuery:",i),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(s){he("Error in endQuery:",s),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[r,l]of this.queryOffsets)if(this.queryStates.get(l)==="ended"){const h=this.queries[l];e.set(r,this.resolveQuery(h))}if(e.size===0)return this.lastValue;const t={},s=[];for(const[r,l]of e){const u=r.match(/^(.*):f(\d+)$/),h=parseInt(u[2]);s.includes(h)===!1&&s.push(h),t[h]===void 0&&(t[h]=0);const d=await l;this.timestamps.set(r,d),t[h]+=d}const i=t[s[s.length-1]];return this.lastValue=i,this.frames=s,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,i}catch(e){return he("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let s,i=!1;const r=()=>{s&&(clearTimeout(s),s=null)},l=h=>{i||(i=!0,r(),t(h))},u=()=>{if(this.isDisposed){l(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){l(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){s=setTimeout(u,1);return}const p=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(p)/1e6)}catch(h){he("Error checking query:",h),t(this.lastValue)}};u()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class jw extends q3{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,s={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},i=t.context!==void 0?t.context:e.domElement.getContext("webgl2",s);function r(l){l.preventDefault();const u={api:"WebGL",message:l.statusMessage||"Unknown reason",reason:null,originalEvent:l};e.onDeviceLost(u)}this._onContextLost=r,e.domElement.addEventListener("webglcontextlost",r,!1),this.gl=i,this.extensions=new _9(this),this.capabilities=new T9(this),this.attributeUtils=new g9(this),this.textureUtils=new b9(this),this.bufferRenderer=new v9(this),this.state=new y9(this),this.utils=new x9(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(me("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return Hi}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,s=0,i=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,s,i)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,s=null){const i=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:i.RGBA8}),s!==null){const r=e.stencilBuffer?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:s,glInternalFormat:r}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&me("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new S9(this.gl,e,2048));const s=this.timestampQueryPool[e];s.allocateQueriesForContext(t)!==null&&s.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,s=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:r,height:l}=this.getDrawingBufferSize();t.viewport(0,0,r,l)}if(e.scissor)this.updateScissor(e);else{const{width:r,height:l}=this.getDrawingBufferSize();t.scissor(0,0,r,l)}this.initTimestampQuery(hr.RENDER,this.getTimestampUID(e)),s.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const i=e.occlusionQueryCount;i>0&&(s.currentOcclusionQueries=s.occlusionQueries,s.currentOcclusionQueryObjects=s.occlusionQueryObjects,s.lastOcclusionObject=null,s.occlusionQueries=new Array(i),s.occlusionQueryObjects=new Array(i),s.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:s}=this,i=this.get(e),r=i.previousContext;s.resetVertexState();const l=e.occlusionQueryCount;l>0&&(l>i.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const u=e.textures;if(u!==null)for(let h=0;h<u.length;h++){const d=u[h];d.generateMipmaps&&this.generateMipmaps(d)}if(this._currentContext=r,this._resolveRenderTarget(e),r!==null){if(this._setFramebuffer(r),r.viewport)this.updateViewport(r);else{const{width:h,height:d}=this.getDrawingBufferSize();s.viewport(0,0,h,d)}if(r.scissor)this.updateScissor(r);else{const{width:h,height:d}=this.getDrawingBufferSize();s.scissor(0,0,h,d)}}this.prepareTimestampBuffer(hr.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueries:s,currentOcclusionQueryObjects:i}=t;if(s&&i){const r=new WeakSet,{gl:l}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;const u=()=>{let h=0;for(let d=0;d<s.length;d++){const p=s[d];p!==null&&l.getQueryParameter(p,l.QUERY_RESULT_AVAILABLE)&&(l.getQueryParameter(p,l.QUERY_RESULT)===0&&r.add(i[d]),s[d]=null,l.deleteQuery(p),h++)}h<s.length?requestAnimationFrame(u):t.occluded=r};u()}}isOccluded(e,t){const s=this.get(e);return s.occluded&&s.occluded.has(t)}updateViewport(e){const{state:t}=this,{x:s,y:i,width:r,height:l}=e.viewportValue;t.viewport(s,e.height-l-i,r,l)}updateScissor(e){const{state:t}=this,{x:s,y:i,width:r,height:l}=e.scissorValue;t.scissor(s,e.height-l-i,r,l)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){const e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,s,i=null,r=!0,l=!0){const{gl:u,renderer:h}=this;i===null&&(i={textures:null,clearColorValue:this.getClearColor()});let d=0;if(e&&(d|=u.COLOR_BUFFER_BIT),t&&(d|=u.DEPTH_BUFFER_BIT),s&&(d|=u.STENCIL_BUFFER_BIT),d!==0){let p;i.clearColorValue?p=i.clearColorValue:p=this.getClearColor();const m=h.getClearDepth(),y=h.getClearStencil();if(t&&this.state.setDepthMask(!0),i.textures===null)u.clearColor(p.r,p.g,p.b,p.a),u.clear(d);else{if(r&&this._setFramebuffer(i),e)for(let b=0;b<i.textures.length;
285b++)b===0?u.clearBufferfv(u.COLOR,b,[p.r,p.g,p.b,p.a]):u.clearBufferfv(u.COLOR,b,[0,0,0,1]);t&&s?u.clearBufferfi(u.DEPTH_STENCIL,0,m,y):t?u.clearBufferfv(u.DEPTH,0,[m]):s&&u.clearBufferiv(u.STENCIL,0,[y]),r&&l&&this._resolveRenderTarget(i),r&&this._currentContext!==null&&this._currentContext!==i&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){const{state:t,gl:s}=this;t.bindFramebuffer(s.FRAMEBUFFER,null),this.initTimestampQuery(hr.COMPUTE,this.getTimestampUID(e))}compute(e,t,s,i,r=null){const{state:l,gl:u}=this;this.discard===!1&&(l.enable(u.RASTERIZER_DISCARD),this.discard=!0);const{programGPU:h,transformBuffers:d,attributes:p}=this.get(i),m=this._getVaoKey(p),y=this.vaoCache[m];y===void 0?this.vaoCache[m]=this._createVao(p):l.setVertexState(y),l.useProgram(h),this._bindUniforms(s);const b=this._getTransformFeedback(d);u.bindTransformFeedback(u.TRANSFORM_FEEDBACK,b),u.beginTransformFeedback(u.POINTS),r=r!==null?r:t.count,Array.isArray(r)?(Ye("WebGLBackend.compute(): The count parameter must be a single number, not an array."),r=r[0]):r&&typeof r=="object"&&r.isIndirectStorageBufferAttribute&&(Ye("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),r=t.count),p[0].isStorageInstancedBufferAttribute?u.drawArraysInstanced(u.POINTS,0,1,r):u.drawArrays(u.POINTS,0,r),u.endTransformFeedback(),u.bindTransformFeedback(u.TRANSFORM_FEEDBACK,null);for(let _=0;_<d.length;_++){const v=d[_];v.pbo&&this.has(v.pbo)&&this.textureUtils.copyBufferToTexture(v.transformBuffer,v.pbo),v.switchBuffers()}}finishCompute(e){const{state:t,gl:s}=this;this.discard=!1,t.disable(s.RASTERIZER_DISCARD),this.prepareTimestampBuffer(hr.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,s,i,r,l){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){const{gl:u}=this,h=u.getUniformLocation(l,"nodeUniformDrawId"),d=e._multiDrawStarts,p=e._multiDrawCounts,m=e._multiDrawCount;for(let y=0;y<m;y++)u.uniform1ui(h,y),t.render(d[y],p[y])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else r>1?t.renderInstances(s,i,r):t.render(s,i)}draw(e){const{object:t,pipeline:s,material:i,context:r,hardwareClippingPlanes:l}=e,{programGPU:u}=this.get(s),{gl:h,state:d}=this,p=this.get(r),m=e.getDrawParameters();if(m===null)return;this._bindUniforms(e.getBindings());const y=t.isMesh&&t.matrixWorld.determinantAffine()<0;d.setMaterial(i,y,l),r.mrt!==null&&r.textures!==null&&d.setMRTBlending(r.textures,r.mrt,i),d.useProgram(u);const b=e.getAttributes(),_=this.get(b);let v=_.vaoGPU;if(v===void 0){const R=this._getVaoKey(b);v=this.vaoCache[R],v===void 0&&(v=this._createVao(b),this.vaoCache[R]=v,_.vaoGPU=v)}const M=e.getIndex(),A=M!==null?this.get(M).bufferGPU:null;d.setVertexState(v,A);const C=p.lastOcclusionObject;if(C!==t&&C!==void 0){if(C!==null&&C.occlusionTest===!0&&(h.endQuery(h.ANY_SAMPLES_PASSED),p.occlusionQueryIndex++),t.occlusionTest===!0){const R=h.createQuery();h.beginQuery(h.ANY_SAMPLES_PASSED,R),p.occlusionQueries[p.occlusionQueryIndex]=R,p.occlusionQueryObjects[p.occlusionQueryIndex]=t}p.lastOcclusionObject=t}const E=this.bufferRenderer;t.isPoints?E.mode=h.POINTS:t.isLineSegments?E.mode=h.LINES:t.isLine?E.mode=h.LINE_STRIP:t.isLineLoop?E.mode=h.LINE_LOOP:i.wireframe===!0?(d.setLineWidth(i.wireframeLinewidth*this.renderer.getPixelRatio()),E.mode=h.LINES):E.mode=h.TRIANGLES;const{vertexCount:F,instanceCount:L}=m;let{firstVertex:U}=m;if(E.object=t,M!==null){U*=M.array.BYTES_PER_ELEMENT;const R=this.get(M);E.index=M.count,E.type=R.type}else E.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){const R=this.get(e.camera),V=e.camera.cameras,$=e.getBindingGroup("cameraIndex").bindings[0];if(R.indexesGPU===void 0||R.indexesGPU.length!==V.length){const ce=new Uint32Array([0,0,0,0]),X=[];for(let ne=0,fe=V.length;ne<fe;ne++){const Be=h.createBuffer();ce[0]=ne,h.bindBuffer(h.UNIFORM_BUFFER,Be),h.bufferData(h.UNIFORM_BUFFER,ce,h.STATIC_DRAW),X.push(Be)}R.indexesGPU=X}let ie=0;e:for(const ce of e.getBindings())for(const X of ce.bindings){if(X===$)break e;(X.isUniformsGroup||X.isUniformBuffer)&&ie++}const le=this.renderer.getPixelRatio(),ye=this._currentContext.renderTarget,xe=this._isRenderCameraDepthArray(this._currentContext),Ne=this._currentContext.activeCubeFace;if(xe){const ce=this.get(ye.depthTexture);if(ce.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){ce.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;const{stencilBuffer:X}=ye;for(let ne=0,fe=V.length;ne<fe;ne++)this.renderer._activeCubeFace=ne,this._currentContext.activeCubeFace=ne,this._setFramebuffer(this._currentContext),this.clear(!1,!0,X,this._currentContext,!1,!1);this.renderer._activeCubeFace=Ne,this._currentContext.activeCubeFace=Ne}}for(let ce=0,X=V.length;ce<X;ce++){const ne=V[ce];
vendor: 16,384 bytes, lines 285-297
285if(t.layers.test(ne.layers)){xe&&(this.renderer._activeCubeFace=ce,this._currentContext.activeCubeFace=ce,this._setFramebuffer(this._currentContext));const fe=ne.viewport;if(fe!==void 0){const Be=fe.x*le,Ce=fe.y*le,G=fe.width*le,j=fe.height*le;d.viewport(Math.floor(Be),Math.floor(e.context.height-j-Ce),Math.floor(G),Math.floor(j))}d.bindBufferBase(h.UNIFORM_BUFFER,ie,R.indexesGPU[ce]),this._draw(t,E,U,F,L,u)}this._currentContext.activeCubeFace=Ne,this.renderer._activeCubeFace=Ne}}else this._draw(t,E,U,F,L,u)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,s,i,r,l){return this.textureUtils.copyTextureToBuffer(e,t,s,i,r,l)}updateSampler(){return""}createNodeBuilder(e,t){return new f9(e,t)}createProgram(e){const t=this.gl,{stage:s,code:i}=e,r=s==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(r,i),t.compileShader(r),this.set(e,{shaderGPU:r})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const s=this.gl,i=e.pipeline,{fragmentProgram:r,vertexProgram:l}=i,u=s.createProgram(),h=this.get(r).shaderGPU,d=this.get(l).shaderGPU;if(s.attachShader(u,h),s.attachShader(u,d),s.linkProgram(u),this.set(i,{programGPU:u,fragmentShader:h,vertexShader:d}),t!==null&&this.parallel){const p=new Promise(m=>{const y=this.parallel,b=()=>{s.getProgramParameter(u,y.COMPLETION_STATUS_KHR)?(this._completeCompile(e,i),m()):requestAnimationFrame(b)};b()});t.push(p);return}this._completeCompile(e,i)}_handleSource(e,t){const s=e.split(` 286`),i=[],r=Math.max(t-6,0),l=Math.min(t+6,s.length);for(let u=r;u<l;u++){const h=u+1;i.push(`${h===t?">":" "} ${h}: ${s[u]}`)}return i.join(` 287`)}_getShaderErrors(e,t,s){const i=e.getShaderParameter(t,e.COMPILE_STATUS),l=(e.getShaderInfoLog(t)||"").trim();if(i&&l==="")return"";const u=/ERROR: 0:(\d+)/.exec(l);if(u){const h=parseInt(u[1]);return s.toUpperCase()+` 288 289`+l+` 290 291`+this._handleSource(e.getShaderSource(t),h)}else return l}_logProgramError(e,t,s){if(this.renderer.debug.checkShaderErrors){const i=this.gl,l=(i.getProgramInfoLog(e)||"").trim();if(i.getProgramParameter(e,i.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError=="function")this.renderer.debug.onShaderError(i,e,s,t);else{const u=this._getShaderErrors(i,s,"vertex"),h=this._getShaderErrors(i,t,"fragment");he("WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(e,i.VALIDATE_STATUS)+` 292 293Program Info Log: `+l+` 294`+u+` 295`+h)}else l!==""&&me("WebGLProgram: Program Info Log:",l)}}_completeCompile(e,t){const{state:s,gl:i}=this,r=this.get(t),{programGPU:l,fragmentShader:u,vertexShader:h}=r;i.getProgramParameter(l,i.LINK_STATUS)===!1&&this._logProgramError(l,u,h),s.useProgram(l);const d=e.getBindings();this._setupBindings(d,l),this.set(t,{programGPU:l,pipeline:l})}createComputePipeline(e,t){const{state:s,gl:i}=this,r={stage:"fragment",code:`#version 300 es 296precision highp float; 297void main() {}`};this.createProgram(r);const{computeProgram:l}=e,u=i.createProgram(),h=this.get(r).shaderGPU,d=this.get(l).shaderGPU,p=l.transforms,m=[],y=[];for(let M=0;M<p.length;M++){const A=p[M];m.push(A.varyingName),y.push(A.attributeNode)}i.attachShader(u,h),i.attachShader(u,d),i.transformFeedbackVaryings(u,m,i.SEPARATE_ATTRIBS),i.linkProgram(u),i.getProgramParameter(u,i.LINK_STATUS)===!1&&this._logProgramError(u,h,d),s.useProgram(u),this._setupBindings(t,u);const b=l.attributes,_=[],v=[];for(let M=0;M<b.length;M++){const A=b[M].node.attribute;_.push(A),this.has(A)||this.attributeUtils.createAttribute(A,i.ARRAY_BUFFER)}for(let M=0;M<y.length;M++){const A=y[M].attribute;this.has(A)||this.attributeUtils.createAttribute(A,i.ARRAY_BUFFER);const C=this.get(A);v.push(C)}this.set(e,{programGPU:u,transformBuffers:v,attributes:_})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let s=0,i=0;for(const r of t){this.set(r,{textures:i,uniformBuffers:s});for(const l of r.bindings)l.isUniformBuffer&&s++,l.isSampledTexture&&i++}}this.updateBindings(e,t)}updateBindings(e){const{gl:t}=this;for(const s of e.bindings){const i=this.get(s);if(s.isUniformsGroup||s.isUniformBuffer){const r=s.buffer,l=i.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,l);const u=s.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,l),u.length===0)t.bufferData(t.UNIFORM_BUFFER,r,t.DYNAMIC_DRAW);else{const h=hg(r),d=h?1:r.BYTES_PER_ELEMENT;for(let p=0,m=u.length;p<m;p++){const y=u[p],b=y.start*d,_=y.count*d,v=b*(h?r.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,v,r,b,_)}}this.set(s,i)}else if(s.isSampledTexture){const{textureGPU:r,glTextureType:l}=this.get(s.texture);i.textureGPU=r,i.glTextureType=l,this.set(s,i)}}}updateBinding(e){const t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){const i=this.get(e).bufferGPU,r=e.buffer,l=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,i),l.length===0)t.bufferData(t.UNIFORM_BUFFER,r,t.DYNAMIC_DRAW);else{const u=hg(r),h=u?1:r.BYTES_PER_ELEMENT;let d=l[0].start;for(let p=0,m=l.length;p<m;p++){const y=l[p],b=l[p+1],_=y.start+y.count;if(b!==void 0&&b.start===_)continue;const v=d*h,M=(_-d)*h,A=v*(u?r.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,A,r,v,M),b!==void 0&&(d=b.start)}}}}createUniformBuffer(e){const t=this.get(e);if(t.bufferGPU===void 0){const s=this.gl,i=e.buffer;t.bufferGPU=s.createBuffer(),s.bindBuffer(s.UNIFORM_BUFFER,t.bufferGPU),s.bufferData(s.UNIFORM_BUFFER,i.byteLength,s.DYNAMIC_DRAW)}}destroyUniformBuffer(e){const t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){const t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){const t=Object.keys(Xw).filter(i=>Xw[i]===e),s=this.extensions;for(let i=0;i<t.length;i++)if(s.has(t[i]))return!0;return!1}copyTextureToTexture(e,t,s=null,i=null,r=0,l=0){this.textureUtils.copyTextureToTexture(e,t,s,i,r,l)}copyFramebufferToTexture(e,t,s){this.textureUtils.copyFramebufferToTexture(e,t,s)}hasCompatibility(e){return e===Al.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){const{gl:t,state:s}=this;this._setFramebuffer(e),s.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){const{gl:t,state:s}=this;let i=null;if(e.textures!==null){const r=e.renderTarget,l=this.get(r),{samples:u,depthBuffer:h,stencilBuffer:d}=r,p=r.isCubeRenderTarget===!0,m=r.isRenderTarget3D===!0,y=r.depth>1,b=r.isXRRenderTarget===!0,_=b===!0&&r._hasExternalTextures===!0;let v=l.msaaFrameBuffer,M=l.depthRenderbuffer;const A=this.extensions.get("WEBGL_multisampled_render_to_texture"),C=this.extensions.get("OVR_multiview2"),E=this._useMultisampledExtension(r),F=AB(e);let L;if(p?(l.cubeFramebuffers||(l.cubeFramebuffers={}),L=l.cubeFramebuffers[F]):b&&_===!1?L=this._xrFramebuffer:(l.framebuffers||(l.framebuffers={}),L=l.framebuffers[F]),L===void 0){L=t.createFramebuffer(),s.bindFramebuffer(t.FRAMEBUFFER,L);const U=e.textures,R=[];if(p){l.cubeFramebuffers[F]=L;const{textureGPU:$}=this.get(U[0]),ie=this.renderer._activeCubeFace,le=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,$,le)}else{l.framebuffers[F]=L;for(let $=0;$<U.length;$++){const ie=U[$],le=this.get(ie);le.renderTarget=e.renderTarget,le.cacheKey=F;const ye=t.COLOR_ATTACHMENT0+$;if(r.multiview)C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,ye,le.textureGPU,0,u,0,2);else if(m||y){const xe=this.renderer._activeCubeFace,Ne=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,ye,le.textureGPU,Ne,xe)}else if(E)A.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ye,t.TEXTURE_2D,le.textureGPU,0,u);else{const xe=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,ye,t.TEXTURE_2D,le.textureGPU,xe)}}}const V=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(r._autoAllocateDepthBuffer===!0){const $=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage($,e,0,E),l.xrDepthRenderbuffer=$,R.push(d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,V,t.RENDERBUFFER,$)}else if(e.depthTexture!==null){R.push(d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);const $=this.get(e.depthTexture);if($.renderTarget=e.renderTarget,$.cacheKey=F,r.multiview)C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,V,$.textureGPU,0,u,0,2);else if(_&&E)A.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,V,t.TEXTURE_2D,$.textureGPU,0,u);else if(e.depthTexture.isArrayTexture){const ie=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,V,$.textureGPU,0,ie)}else if(e.depthTexture.isCubeTexture){const ie=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,V,t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,$.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,V,t.TEXTURE_2D,$.textureGPU,0)}l.depthInvalidationArray=R}else{if(this._isRenderCameraDepthArray(e)){s.bindFramebuffer(t.FRAMEBUFFER,L);const R=this.renderer._activeCubeFace,V=this.get(e.depthTexture),$=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,$,V.textureGPU,0,R)}if((b||E||r.multiview)&&r._isOpaqueFramebuffer!==!0){s.bindFramebuffer(t.FRAMEBUFFER,L);const R=this.get(e.textures[0]);r.multiview?C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,R.textureGPU,0,u,0,2):E?A.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,R.textureGPU,0,u):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,R.textureGPU,0);const V=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(r._autoAllocateDepthBuffer===!0){const $=l.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,V,t.RENDERBUFFER,$)}else{const $=this.get(e.depthTexture);r.multiview?C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,V,$.textureGPU,0,u,0,2):E?A.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,V,t.TEXTURE_2D,$.textureGPU,0,u):t.framebufferTexture2D(t.FRAMEBUFFER,V,t.TEXTURE_2D,$.textureGPU,0)}}}if(u>0&&E===!1&&!r.multiview){if(v===void 0){const U=[];v=t.createFramebuffer(),s.bindFramebuffer(t.FRAMEBUFFER,v);const R=[],V=e.textures;for(let $=0;$<V.length;$++){R[$]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,R[$]),U.push(t.COLOR_ATTACHMENT0+$);const ie=e.textures[$],le=this.get(ie);t.renderbufferStorageMultisample(t.RENDERBUFFER,u,le.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+$,t.RENDERBUFFER,R[$])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),l.msaaFrameBuffer=v,l.msaaRenderbuffers=R,h&&M===void 0){M=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(M,e,u),l.depthRenderbuffer=M;const $=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;U.push($)}l.invalidationArray=U}i=l.msaaFrameBuffer}else i=L;s.drawBuffers(e,L)}s.bindFramebuffer(t.FRAMEBUFFER,i)}_getVaoKey(e){let t="";for(let s=0;s<e.length;s++){const i=this.get(e[s]);t+=":"+i.id}return t}_createVao(e){const{gl:t}=this,s=t.createVertexArray();t.bindVertexArray(s);for(let i=0;i<e.length;i++){const r=e[i],l=this.get(r);t.bindBuffer(t.ARRAY_BUFFER,l.bufferGPU),t.enableVertexAttribArray(i);let u,h;r.isInterleavedBufferAttribute===!0?(u=r.data.stride*l.bytesPerElement,h=r.offset*l.bytesPerElement):(u=0,h=0),l.isInteger?t.vertexAttribIPointer(i,r.itemSize,l.type,u,h):t.vertexAttribPointer(i,r.itemSize,l.type,r.normalized,u,h),r.isInstancedBufferAttribute&&!r.isInterleavedBufferAttribute?t.vertexAttribDivisor(i,r.meshPerAttribute):r.isInterleavedBufferAttribute&&r.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(i,r.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),s}_getTransformFeedback(e){let t="";for(let r=0;r<e.length;r++)t+=":"+e[r].id;let s=this.transformFeedbackCache[t];if(s!==void 0)return s;const{gl:i}=this;s=i.createTransformFeedback(),i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,s);for(let r=0;r<e.length;r++){const l=e[r];i.bindBufferBase(i.TRANSFORM_FEEDBACK_BUFFER,r,l.transformBuffer)}return i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=s,s}_setupBindings(e,t){const s=this.gl;let i=0,r=0;for(const l of e)for(const u of l.bindings)if(u.isUniformsGroup||u.isUniformBuffer){const h=i++,d=s.getUniformBlockIndex(t,u.name);s.uniformBlockBinding(t,d,h)}else if(u.isSampledTexture){const h=r++,d=s.getUniformLocation(t,u.name);s.uniform1i(d,h)}}_bindUniforms(e){const{gl:t,state:s}=this;let i=0,r=0;for(const l of e)for(const u of l.bindings){const h=this.get(u);if(u.isUniformsGroup||u.isUniformBuffer){const d=i++;s.bindBufferBase(t.UNIFORM_BUFFER,d,h.bufferGPU)}else if(u.isSampledTexture){const d=r++;s.bindTexture(h.glTextureType,h.textureGPU,t.TEXTURE0+d)}}}_resolveRenderTarget(e){const{gl:t,state:s}=this,i=e.renderTarget;if(e.textures!==null&&i){const r=this.get(i);if(i.samples>0&&this._useMultisampledExtension(i)===!1){const l=r.framebuffers[e.getCacheKey()];let u=t.COLOR_BUFFER_BIT;i.resolveDepthBuffer&&(i.depthBuffer&&(u|=t.DEPTH_BUFFER_BIT),i.stencilBuffer&&i.resolveStencilBuffer&&(u|=t.STENCIL_BUFFER_BIT));const h=r.msaaFrameBuffer,d=r.msaaRenderbuffers,p=e.textures,m=p.length>1;if(s.bindFramebuffer(t.READ_FRAMEBUFFER,h),s.bindFramebuffer(t.DRAW_FRAMEBUFFER,l),m)for(let y=0;y<p.length;y++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.TEXTURE_2D,null,0);for(let y=0;y<p.length;y++){if(m){const{textureGPU:b}=this.get(p[y]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,d[y]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,b,0)}if(e.scissor){const{x:b,y:_,width:v,height:M}=e.scissorValue,A=e.height-M-_;t.blitFramebuffer(b,A,b+v,A+M,b,A,b+v,A+M,u,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,u,t.NEAREST)}if(m)for(let y=0;y<p.length;y++){const{textureGPU:b}=this.get(p[y]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.RENDERBUFFER,d[y]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.TEXTURE_2D,b,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,r.invalidationArray)}else if(i.resolveDepthBuffer===!1&&r.framebuffers){const l=r.framebuffers[e.getCacheKey()];s.bindFramebuffer(t.DRAW_FRAMEBUFFER,l),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,r.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const nd={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},br=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},Es={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Js={Store:"store"},mt={Load:"load",Clear:"clear"},Yw={CCW:"ccw",CW:"cw"},Zw={None:"none",Back:"back"},Dg={Uint16:"uint16",Uint32:"uint32"},B={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uin
297t",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},Wb={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},fn={Linear:"linear",Nearest:"nearest"},tt={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},sl={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},Qw={None:0,All:15},Ja={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},Xb={Storage:"storage",ReadOnlyStorage:"read-only-storage"},jb={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},Kw={NonFiltering:"non-filtering",Comparison:"comparison"},il={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},Jw={TwoD:"2d",ThreeD:"3d"},Cs={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},M9={All:"all"},am={Vertex:"vertex",Instance:"instance"},Ug={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},eR={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class A9 extends k3{constructor(e,t,s){super(e,t?t.value:null),this.textureNode=t,this.groupNode=s}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update(
297)}}class N9 extends P3{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}}let w9=0;class R9 extends N9{constructor(e,t){super("StorageBuffer_"+w9++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Us.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}}const Yb=[null];class E9{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=B.Depth32FloatStencil8:t=B.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=B.Depth32Float:t=B.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const r=this.backend.renderer,l=r.getRenderTarget();t=l?l.samples:r.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);const s=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:s?1:t,isMSAA:s}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return nd.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return nd.LineList;if(e.isLine)return nd.LineStrip;if(e.isMesh)return nd.TriangleList}getSampleCount(e){return e>=4?4:1}
vendor: 4,363 bytes, lines 297-336
297getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Ds)return B.BGRA8Unorm;if(t===Jt)return B.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}}function ur(o,e){Yb[0]=e,o.queue.submit(Yb),Yb[0]=null}class W3{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}}class Uc{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}}class Hd{constructor(){this.label=""}reset(){this.label=""}}class X3{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}}class bd{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}}class _d{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}}class j3{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new C9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}}class C9{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}}class Y3{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}}class Yv{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}}class Zv{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}}const eo=new W3,to=new Uc,om=new Hd,Zb=new X3,Qb=new _d,Pu=new j3,jh=new bd,lm=new Y3,Vu=new Yv,jt=new Zv;class B9 extends Ro{constructor(e){super(),this.device=e;const t=` 298struct VarysStruct { 299 @builtin( position ) Position: vec4f, 300 @location( 0 ) vTex : vec2f, 301 @location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32, 302}; 303 304@group( 0 ) @binding ( 2 ) 305var<uniform> flipY: u32; 306 307@vertex 308fn mainVS( 309 @builtin( vertex_index ) vertexIndex : u32, 310 @builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct { 311 312 var Varys : VarysStruct; 313 314 var pos = array( 315 vec2f( -1, -1 ), 316 vec2f( -1, 3 ), 317 vec2f( 3, -1 ), 318 ); 319 320 let p = pos[ vertexIndex ]; 321 let mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 ); 322 Varys.vTex = p * mult + vec2f( 0.5 ); 323 Varys.Position = vec4f( p, 0, 1 ); 324 Varys.vBaseArrayLayer = instanceIndex; 325 326 return Varys; 327 328} 329 330@group( 0 ) @binding( 0 ) 331var imgSampler : sampler; 332 333@group( 0 ) @binding( 1 ) 334var img2d : texture_2d<f32>; 335 336@fragment
337fn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 338 339 return textureSample( img2d, imgSampler, Varys.vTex ); 340 341} 342 343@group( 0 ) @binding( 1 ) 344var img2dArray : texture_2d_array<f32>; 345 346@fragment 347fn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 348 349 return textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer ); 350 351} 352 353const faceMat = array( 354 mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x 355 mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x 356 mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y 357 mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y 358 mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z 359 mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z 360); 361 362@group( 0 ) @binding( 1 ) 363var imgCube : texture_cube<f32>; 364 365@fragment 366fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 367 368 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) ); 369 370} 371`;this.mipmapSampler=e.createSampler({minFilter:fn.Linear}),this.flipYSampler=e.createSampler({minFilter:fn.Nearest}),to.size=4,to.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(to),to.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),to.size=4,to.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(to),to.reset(),this.transferPipelines={},lm.label="mipmap",lm.code=t,this.mipmapShaderModule=e.createShaderModule(lm),lm.reset()}getTransferPipeline(e,t){t=t||"2d-array";const s=`${e}-${t}`;let i=this.transferPipelines[s];return i===void 0&&(Pu.label=`mipmap-${e}-${t}`,Pu.vertex={module:this.mipmapShaderModule},Pu.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},Pu.layout="auto",i=this.device.createRenderPipeline(Pu),Pu.reset(),this.transferPipelines[s]=i),i}flipY(e,t,s=0){const i=t.format,{width:r,height:l}=t.size;Vu.size.width=r,Vu.size.height=l,Vu.format=i,Vu.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;const u=this.device.createTexture(Vu);Vu.reset();const h=this.getTransferPipeline(i,e.textureBindingViewDimension),d=this.getTransferPipeline(i,u.textureBindingViewDimension),p=this.device.createCommandEncoder(om),m=(y,b,_,v,M,A)=>{const C=y.getBindGroupLayout(0);jt.dimension=b.textureBindingViewDimension||"2d-array",jt.mipLevelCount=1;const E=b.createView(jt);jt.reset(),eo.layout=C,eo.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:E},{binding:2,resource:{buffer:A?this.flipUniformBuffer:this.noFlipUniformBuffer}});const F=this.device.createBindGroup(eo);eo.reset(),jt.dimension="2d",jt.mipLevelCount=1,jt.baseArrayLayer=M,jt.arrayLayerCount=1;const L=v.createView(jt);jt.reset(),jh.view=L,jh.loadOp=mt.Clear,jh.storeOp=Js.Store,Qb.colorAttachments.push(jh);const U=p.beginRenderPass(Qb);Qb.reset(),jh.reset(),U.setPipeline(y),U.setBindGroup(0,F),U.draw(3,1,0,_),U.end()};m(h,e,s,u,0,!1),m(d,u,0,e,s,!0),ur(this.device,p.finish()),u.destroy()}generateMipmaps(e,t=null){const s=this.get(e),i=s.layers||this._mipmapCreateBundles(e);let r=t;r===null&&(om.label="mipmapEncoder",r=this.device.createCommandEncoder(om),om.reset()),this._mipmapRunBundles(r,i),t===null&&ur(this.device,r.finish()),s.layers=i}_mipmapCreateBundles(e){const t=e.textureBindingViewDimension||"2d-array",s=this.getTransferPipeline(e.format,t),i=s.getBindGroupLayout(0),r=[];for(let l=1;l<e.mipLevelCount;l++)for(let u=0;u<e.depthOrArrayLayers;u++){jt.dimension=t,jt.baseMipLevel=l-1,jt.mipLevelCount=1;const h=e.createView(jt);jt.reset(),eo.layout=i,eo.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:h},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});const d=this.device.createBindGroup(eo);eo.reset(),jt.dimension="2d",jt.baseMipLevel=l,jt.mipLevelCount=1,jt.baseArrayLayer=u,jt.arrayLayerCount=1;const p=e.createView(jt);jt.reset();const m=new bd;m.view=p,m.loadOp=mt.Clear,m.storeOp=Js.Store;const y=new _d;y.colorAttachments.push(m),Zb.colorFormats=[e.format];const b=this.device.createRenderBundleEncoder(Zb);Zb.reset(),b.setPipeline(s),b.setBindGroup(0,d),b.draw(3,1,0,u),r.push({renderBundles:[b.finish()],passDescriptor:y})}return r}_mipmapRunBundles(e,t){const s=t.length;for(let i=0;i<s;i++){const r=t[i],l=e.beginRenderPass(r.passDescriptor);l.executeBundles(r.renderBundles),l.end()}}}
371class D9{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}}class My{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}}class U9{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}}class F9{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}}class L9{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}}class O9 extends My{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}}class Z3{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}}const um=new Uc,z9=new Hd,Ps=new D9,ks=new My,cm=new U9,aa=new F9,hm=new L9,Gu=new O9,so=new Yv,Gs=new Z3,P9={[BR]:"never",[Y_]:"less",[DR]:"equal",[Cd]:"less-equal",[cg]:"greater",[gc]:"greater-equal",[FR]:"always",[UR]:"not-equal"},V9=[0,1,3,2,4,5];function tR(o,e,t,s,i,r,l,u,h,d){ks.texture=e,ks.mipLevel=t,ks.origin.z=s,aa.offset=s*r,aa.bytesPerRow=l,aa.rowsPerImage=u,Gs.width=h,Gs.height=d,o.queue.writeTexture(ks,i.data,aa,Gs),ks.reset(),aa.reset(),Gs.reset()}class G9{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){const t=this.backend,s=e.texture,i=e.textureNode,r=s.minFilter+"-"+s.magFilter+"-"+s.wrapS+"-"+s.wrapT+"-"+(s.wrapR||"0")+"-"+s.anisotropy+"-"+(s.isDepthTexture===!0?1:0)+"-"+(s.compareFunction!==null&&i.compareNode!==null?s.compareFunction:0);let l=this._samplerCache.get(r);if(l===void 0){Ps.addressModeU=this._convertAddressMode(s.wrapS),Ps.addressModeV=this._convertAddressMode(s.wrapT),Ps.addressModeW=this._convertAddressMode(s.wrapR),Ps.magFilter=this._convertFilterMode(s.magFilter),Ps.minFilter=this._convertFilterMode(s.minFilter),Ps.mipmapFilter=this._convertMipmapFilterMode(s.minFilter),s.isDepthTexture&&(s.compareFunction===null||i.compareNode===null)&&(Ps.magFilter=fn.Nearest,Ps.minFilter=fn.Nearest,Ps.mipmapFilter=fn.Nearest),Ps.magFilter===fn.Linear&&Ps.minFilter===fn.Linear&&Ps.mipmapFilter===fn.Linear&&(Ps.maxAnisotropy=s.anisotropy),s.isDepthTexture&&s.compareFunction!==null&&i.compareNode!==null&&t.hasCompatibility(Al.TEXTURE_COMPARE)&&(Ps.compare=P9[s.compareFunction]);const h=t.device.createSampler(Ps);Ps.reset(),l={sampler:h,usedTimes:0},this._samplerCache.set(r,l)}const u=t.get(e);return u.sampler!==l.sampler&&(this._releaseSampler(u),u.samplerKey=r,u.sampler=l.sampler,l.usedTimes++),r}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){const t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t;const s=z_(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(s):t=this._getDefaultTextureGPU(s),this.backend.get(e).texture=t}createTexture(e,t={}){const s=this.backend,i=s.get(e);if(i.initialized){if(i.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){i.texture=e.sourceTexture,i.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);const{width:r,height:l,depth:u,levels:h}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasF
371ormat());const d=this._getDimension(e),p=e.internalFormat||t.format||z_(e,s.device);i.format=p;const{samples:m,primarySamples:y,isMSAA:b}=s.utils.getTextureSampleData(e);let _=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(_|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&p!==B.RGB9E5UFloat&&(_|=GPUTextureUsage.RENDER_ATTACHMENT);const v=new Yv;if(v.label=e.name,v.size.width=r,v.size.height=l,v.size.depthOrArrayLayers=u,v.mipLevelCount=h,v.sampleCount=y,v.dimension=d,v.format=p,v.usage=_,p===void 0){me("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(v.textureBindingViewDimension=Cs.Cube);try{i.texture=s.device.createTexture(v)}catch{me("WebGPURenderer: Failed to create texture with descriptor:",v),this.createDefaultTexture(e);return}if(b){const M=Object.assign({},v);M.label=M.label+"-msaa",M.sampleCount=m,M.mipLevelCount=1,i.msaaTexture=s.device.createTexture(M)}i.initialized=!0,i.textureDescriptorGPU=v}destroyTexture(e,t=!1){const s=this.backend,i=s.get(e);i.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&i.texture.destroy(),i.msaaTexture!==void 0&&i.msaaTexture.destroy(),s.delete(e)}generateMipmaps(e,t=null){const s=this.backend.get(e);this._generateMipmaps(s.texture,t)}getColorBuffer(){const e=this.backend,t=e.renderer.getCanvasTarget(),{width:s,height:i}=e.getDrawingBufferSize(),r=e.renderer.currentSamples,l=t.colorTexture,u=e.get(l);if(l.width===s&&l.height===i&&l.samples===r)return u.texture;let h=u.texture;return h&&h.destroy(),so.label="colorBuffer",so.size.width=s,so.size.height=i,so.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),so.format=e.utils.getPreferredCanvasFormat(),so.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,h=e.device.createTexture(so),so.reset(),l.source.width=s,l.source.height=i,l.samples=r,u.texture=h,h}getDepthBuffer(e=!0,t=!1){const s=this.backend,i=s.renderer.getCanvasTarget(),{width:r,height:l}=s.getDrawingBufferSize(),u=s.renderer.currentSamples,h=i.depthTexture;if(h.width===r&&h.height===l&&h.samples===u&&h.depth===e&&h.stencil===t)return s.get(h).texture;const d=s.get(h).texture;let p,m;if(t?(p=fr,m=s.renderer.reversedDepthBuffer===!0?_s:ha):e&&(p=vn,m=s.renderer.reversedDepthBuffer===!0?_s:Ut),d!==void 0){if(h.image.width===r&&h.image.height===l&&h.format===p&&h.type===m&&h.samples===u)return d;this.destroyTexture(h)}return h.name="depthBuffer",h.format=p,h.type=m,h.image.width=r,h.image.height=l,h.samples=u,this.createTexture(h,{width:r,height:l}),s.get(h).texture}updateTexture(e,t){const s=this.backend.get(e),i=e.mipmaps,{textureDescriptorGPU:r}=s;if(!(e.isRenderTargetTexture||r===void 0)){if(e.isDataTexture)if(i.length>0)for(let l=0,u=i.length;l<u;l++){const h=i[l];this._copyBufferToTexture(h,s.texture,r,0,e.flipY,0,l)}else this._copyBufferToTexture(t.image,s.texture,r,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(const l of e.layerUpdates)this._copyBufferToTexture(t.image,s.texture,r,l,e.flipY,l);e.clearLayerUpdates()}else for(let l=0;l<t.image.depth;l++)this._copyBufferToTexture(t.image,s.texture,r,l,e.flipY,l);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,s.texture,r,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,s.texture,r);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,s.texture,r);else if(e.isHTMLTexture){const l=this.backend.device,u=this.backend.renderer.domElement,h=e.image;if(typeof l.queue.copyElementImageToTexture!="function")return;if(!s.hasPaintCallback){s.hasPaintCallback=!0,u.requestPaint();return}const d=r.size.width,p=r.size.height;l.queue.copyElementImageToTexture.length===2?l.queue.copyElementImageToTexture({source:h},{destination:{texture:s.texture},width:d,height:p}):l.queue.copyElementImageToTexture(h,d,p,{texture:s.texture}),e.flipY&&this._flipY(s.texture,r)}else if(i.length>0)for(let l=0,u=i.length;l<u;l++){const h=i[l];this._copyImageToTexture(h,s.texture,r,0,e.flipY,e.premultiplyAlpha,l)}else this._copyImageToTexture(t.image,s.texture,r,0,e.flipY,e.premultiplyAlpha);s.version=e.version}}async copyTextureToBuffer(e,t,s,i,r,l){const u=this.backend.device,h=this.backend.get(e),d=h.texture,p=h.textureDescriptorGPU.format,m=this._getBytesPerTexel(p);let y=i*m;y=Math.ceil(y/256)*256,um.size=(r-1)*y+i*m,um.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;const b=u.createBuffer(um);um.reset();const _=u.createCommandEncoder(z9);ks.texture=d,ks.origin.x=t,ks.origin.y=s,ks.origin.z=l,cm.buffer=b,cm.bytesPerRow=y,Gs.width=i,Gs.height=r,_.copyTextureToBuffer(ks,cm,Gs),ks.reset(),cm.reset(),Gs.reset();const v=this._getTypedArrayType(p);ur(u,_.finish()),await b.mapAsync(GPUMapMode.READ);const M=b.getMappedRange().slice();return b.destroy(),new v(M)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){const s=new qs;s.minFilter=$t,s.magFilter=$t,this.createTexture(s,{width:1,height:1,format:e}),this.defaultTexture[e]=t=s}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){const s=new Vg;s.minFilter=$t,s.magFilter=$t,this.createTexture(s,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=s}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,s){const i=e.images,r=e.mipmaps;for(let l=0;l<6;l++){const u=i[l],h=e.flipY===!0?V9[l]:l;u.isDataTexture?this._copyBufferToTexture(u.image,t,s,h,e.flipY):this._copyImageToTexture(u,t,s,h,e.flipY,e.premultiplyAlpha);for(let d=0;d<r.length;d++){const m=r[d].images[l];m.isDataTexture?this._copyBufferToTexture(m.image,t,s,h,e.flipY,0,d+1):this._copyImageToTexture(m,t,s,h,e.flipY,e.premultiplyAlpha,d+1)}}}_copyImageToTexture(e,t,s,i,r,l,u=0){const h=this.backend.device,d=u>0?e.width:s.size.width,p=u>0?e.height:s.size.height;hm.source=e,hm.flipY=r,Gu.texture=t,Gu.mipLevel=u,Gu.origin.z=i,Gu.premultipliedAlpha=l,Gs.width=d,Gs.height=p;try{h.queue.copyExternalImageToTexture(hm,Gu,Gs)}catch{}finally{hm.reset(),Gu.reset(),Gs.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new B9(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,s=0){this._getPassUtils().flipY(e,t,s)}_copyBufferToTexture(e,t,s,i,r,l=0,u=0){const h=this.backend.device,d=e.data,p=this._getBytesPerTexel(s.format),m=e.width*p;ks.texture=t,ks.mipLevel=u,ks.origin.z=i,aa.offset=e.width*e.height*p*l,aa.bytesPerRow=m,Gs.width=e.width,Gs.height=e.height,h.queue.writeTexture(ks,d,aa,Gs),ks.reset(),aa.reset(),Gs.reset(),r===!0&&this._flipY(t,s,i)}_copyCompressedBufferToTexture(e,t,s,i=null){const r=this.backend.device,l=this._getBlockData(s.format),u=s.size.depthOrArrayLayers>1,h=i&&i.size>0?i:null;for(let d=0;d<e.length;d++){const p=e[d],m=p.width,y=p.height,b=u?s.size.depthOrArrayLayers:1,_=Math.ceil(m/l.width)*l.byteLength,v=Math.ceil(y/l.height),M=_*v,A=Math.ceil(m/l.width)*l.width,C=v*l.height;if(h!==null)for(const E of h)tR(r,t,d,E,p,M,_,v,A,C);else for(let E=0;E<b;E++)tR(r,t,d,E,p,M,_,v,A,C)}}_getBlockData(e){if(e===B.BC1RGBAUnorm||e===B.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===B.BC2RGBAUnorm||e===B.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===B.BC3RGBAUnorm||e===B.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===B.BC4RUnorm||e===B.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===B.BC5RGUnorm||e===B.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===B.BC6HRGBUFloat||e===B.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===B.BC7RGBAUnorm||e===B.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===B.ETC2RGB8Unorm||e===B.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===B.ETC2RGB8A1Unorm||e===B.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===B.ETC2RGBA8Unorm||e===B.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===B.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===B.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===B.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===B.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===B.ASTC4x4Unorm||e===B.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===B.ASTC5x4Unorm||e===B.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===B.ASTC5x5Unorm||e===B.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===B.ASTC6x5Unorm||e===B.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===B.ASTC6x6Unorm||e===B.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===B.ASTC8x5Unorm||e===B.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===B.ASTC8x6Unorm||e===B.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===B.ASTC8x8Unorm||e===B.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===B.ASTC10x5Unorm||e===B.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===B.ASTC10x6Unorm||e===B.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===B.ASTC10x8Unorm||e===B.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===B.ASTC10x10Unorm||e===B.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===B.ASTC12x10Unorm||e===B.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===B.ASTC12x12Unorm||e===B.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=Wb.ClampToEdge;return e===fc?t=Wb.Repeat:e===pc&&(t=Wb.MirrorRepeat),t}_convertFilterMode(e){let t=fn.Linear;return(e===$t||e===ER||e===mc)&&(t=fn.Nearest),t}_convertMipmapFilterMode(e){return e===mc||e===ca?fn.Linear:fn.Nearest}_getBytesPerTexel(e){if(e===B.R8Unorm||e===B.R8Snorm||e===B.R8Uint||e===B.R8Sint)return 1;if(e===B.R16Uint||e===B.R16Sint||e===B.R16Float||e===B.RG8Unorm||e===B.RG8Snorm||e===B.RG8Uint||e===B.RG8Sint||e===B.R16Unorm||e===B.R16Snorm)return 2;if(e===B.R32Uint||e===B.R32Sint||e===B.R32Float||e===B.RG16Uint||e===B.RG16Sint||e===B.RG16Float||e===B.RGBA8Unorm||e===B.RGBA8UnormSRGB||e===B.RGBA8Snorm||e===B.RGBA8Uint||e===B.RGBA8Sint||e===B.BGRA8Unorm||e===B.BGRA8UnormSRGB||e===B.RG16Unorm||e===B.RG16Snorm||e===B.RGB9E5UFloat||e===B.RGB10A2Unorm||e===B.RG11B10UFloat||e===B.Depth32Float||e===B.Depth24Plus||e===B.Depth24PlusStencil8||e===B.Depth32FloatStencil8)return 4;if(e===B.RG32Uint||e===B.RG32Sint||e===B.RG32Float||e===B.RGBA16Uint||e===B.RGBA16Sint||e===B.RGBA16Float||e===B.RGBA16Unorm||e===B.RGBA16Snorm)return 8;if(e===B.RGBA32Uint||e===B.RGBA32Sint||e===B.RGBA32Float)return 16}_getTypedArrayType(e){if(e===B.R8Uint)return Uint8Array;
371if(e===B.R8Sint)return Int8Array;if(e===B.R8Unorm)return Uint8Array;if(e===B.R8Snorm)return Int8Array;if(e===B.RG8Uint)return Uint8Array;if(e===B.RG8Sint)return Int8Array;if(e===B.RG8Unorm)return Uint8Array;if(e===B.RG8Snorm)return Int8Array;if(e===B.RGBA8Uint)return Uint8Array;if(e===B.RGBA8Sint)return Int8Array;if(e===B.RGBA8Unorm||e===B.RGBA8UnormSRGB)return Uint8Array;if(e===B.RGBA8Snorm)return Int8Array;if(e===B.R16Uint)return Uint16Array;if(e===B.R16Sint)return Int16Array;if(e===B.RG16Uint)return Uint16Array;if(e===B.RG16Sint)return Int16Array;if(e===B.RGBA16Uint)return Uint16Array;if(e===B.RGBA16Sint)return Int16Array;if(e===B.R16Float||e===B.RG16Float||e===B.RGBA16Float||e===B.R16Unorm)return Uint16Array;if(e===B.R16Snorm)return Int16Array;if(e===B.RG16Unorm)return Uint16Array;if(e===B.RG16Snorm)return Int16Array;if(e===B.RGBA16Unorm)return Uint16Array;if(e===B.RGBA16Snorm)return Int16Array;if(e===B.R32Uint)return Uint32Array;if(e===B.R32Sint)return Int32Array;if(e===B.R32Float)return Float32Array;if(e===B.RG32Uint)return Uint32Array;if(e===B.RG32Sint)return Int32Array;if(e===B.RG32Float)return Float32Array;if(e===B.RGBA32Uint)return Uint32Array;if(e===B.RGBA32Sint)return Int32Array;if(e===B.RGBA32Float)return Float32Array;if(e===B.BGRA8Unorm||e===B.BGRA8UnormSRGB)return Uint8Array;
371if(e===B.RGB10A2Unorm||e===B.RGB9E5UFloat||e===B.RG11B10UFloat)return Uint32Array;if(e===B.Depth32Float)return Float32Array;if(e===B.Depth24Plus||e===B.Depth24PlusStencil8)return Uint32Array;if(e===B.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=Jw.ThreeD:t=Jw.TwoD,t}}function z_(o,e){const t=o.format,s=o.type,i=o.normalized,r=o.colorSpace,l=lt.getTransfer(r);let u,h=!1;if(i&&(h=e.features.has(Ug.TextureFormatsTier1),h===!1&&me("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),o.isCompressedTexture===!0||o.isCompressedArrayTexture===!0)switch(t){case ad:case od:u=l===Ve?B.BC1RGBAUnormSRGB:B.BC1RGBAUnorm;break;case ld:u=l===Ve?B.BC2RGBAUnormSRGB:B.BC2RGBAUnorm;break;case ud:u=l===Ve?B.BC3RGBAUnormSRGB:B.BC3RGBAUnorm;break;case rg:u=B.BC4RUnorm;break;case ag:u=B.BC4RSnorm;break;case Md:u=B.BC5RGUnorm;break;case og:u=B.BC5RGSnorm;break;case sg:u=l===Ve?B.BC7RGBAUnormSRGB:B.BC7RGBAUnorm;break;case ig:u=B.BC6HRGBFloat;break;case ng:u=B.BC6HRGBUFloat;break;case zm:case Om:u=l===Ve?B.ETC2RGB8UnormSRGB:B.ETC2RGB8Unorm;break;case Pm:u=l===Ve?B.ETC2RGBA8UnormSRGB:B.ETC2RGBA8Unorm;break;case Vm:u=B.EACR11Unorm;break;case Gm:u=B.EACR11Snorm;break;case Sd:u=B.EACRG11Unorm;break;case Im:u=B.EACRG11Snorm;break;case km:u=l===Ve?B.ASTC4x4UnormSRGB:B.ASTC4x4Unorm;break;case Hm:u=l===Ve?B.ASTC5x4UnormSRGB:B.ASTC5x4Unorm;break;case qm:u=l===Ve?B.ASTC5x5UnormSRGB:B.ASTC5x5Unorm;break;case $m:u=l===Ve?B.ASTC6x5UnormSRGB:B.ASTC6x5Unorm;break;case Wm:u=l===Ve?B.ASTC6x6UnormSRGB:B.ASTC6x6Unorm;break;case Xm:u=l===Ve?B.ASTC8x5UnormSRGB:B.ASTC8x5Unorm;break;case jm:u=l===Ve?B.ASTC8x6UnormSRGB:B.ASTC8x6Unorm;break;case Ym:u=l===Ve?B.ASTC8x8UnormSRGB:B.ASTC8x8Unorm;break;case Zm:u=l===Ve?B.ASTC10x5UnormSRGB:B.ASTC10x5Unorm;break;case Qm:u=l===Ve?B.ASTC10x6UnormSRGB:B.ASTC10x6Unorm;break;case Km:u=l===Ve?B.ASTC10x8UnormSRGB:B.ASTC10x8Unorm;break;case Jm:u=l===Ve?B.ASTC10x10UnormSRGB:B.ASTC10x10Unorm;break;case eg:u=l===Ve?B.ASTC12x10UnormSRGB:B.ASTC12x10Unorm;break;case tg:u=l===Ve?B.ASTC12x12UnormSRGB:B.ASTC12x12Unorm;break;case ki:u=l===Ve?B.RGBA8UnormSRGB:B.RGBA8Unorm;break;default:he("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case ki:switch(s){case fl:u=B.RGBA8Snorm;break;case pl:u=h?B.RGBA16Snorm:B.RGBA16Sint;break;case po:u=h?B.RGBA16Unorm:B.RGBA16Uint;break;case Ut:u=B.RGBA32Uint;break;case ps:u=B.RGBA32Sint;break;case Ds:u=l===Ve?B.RGBA8UnormSRGB:B.RGBA8Unorm;break;case Jt:u=B.RGBA16Float;break;case _s:u=B.RGBA32Float;break;default:he("WebGPURenderer: Unsupported texture type with RGBAFormat.",s)}break;case Sc:switch(s){case Lg:u=B.RGB9E5UFloat;break;case Og:u=B.RG11B10UFloat;break;default:he("WebGPURenderer: Unsupported texture type with RGBFormat.",s)}break;case Mc:switch(s){case fl:u=B.R8Snorm;break;case pl:u=h?B.R16Snorm:B.R16Sint;break;case po:u=h?B.R16Unorm:B.R16Uint;break;case Ut:u=B.R32Uint;break;case ps:u=B.R32Sint;break;case Ds:u=B.R8Unorm;break;case Jt:u=B.R16Float;break;case _s:u=B.R32Float;break;default:he("WebGPURenderer: Unsupported texture type with RedFormat.",s)}break;case xn:switch(s){case fl:u=B.RG8Snorm;break;case pl:u=h?B.RG16Snorm:B.RG16Sint;break;case po:u=h?B.RG16Unorm:B.RG16Uint;break;case Ut:u=B.RG32Uint;break;case ps:u=B.RG32Sint;break;case Ds:u=B.RG8Unorm;break;case Jt:u=B.RG16Float;break;case _s:u=B.RG32Float;break;default:he("WebGPURenderer: Unsupported texture type with RGFormat.",s)}break;case vn:switch(s){case po:u=B.Depth16Unorm;break;case Ut:u=B.Depth24Plus;break;case _s:u=B.Depth32Float;break;default:he("WebGPURenderer: Unsupported texture type with DepthFormat.",s)}break;case fr:switch(s){case ha:u=B.Depth24PlusStencil8;break;case _s:e&&e.features.has(Ug.Depth32FloatStencil8)===!1&&he('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),u=B.Depth32FloatStencil8;break;default:he("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",s)}break;case Ac:switch(s){case ps:u=B.R32Sint;break;case Ut:u=B.R32Uint;break;default:he("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",s)}break;case Nc:switch(s){case ps:u=B.RG32Sint;break;case Ut:u=B.RG32Uint;break;default:he("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",s)}break;case zg:switch(s){case ps:u=B.RGBA32Sint;break;case Ut:u=B.RGBA32Uint;break;default:he("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",s)}break;default:he("WebGPURenderer: Unsupported texture format.",t)}return u}const I9=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,k9=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,sR={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>
371":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},H9=o=>{o=o.trim();const e=o.match(I9);if(e!==null&&e.length===4){const t=e[2],s=[];let i=null;for(;(i=k9.exec(t))!==null;)s.push({name:i[1],type:i[2]});const r=[];for(let p=0;p<s.length;p++){const{name:m,type:y}=s[p];let b=y;b.startsWith("ptr")?b="pointer":(b.startsWith("texture")&&(b=y.split("<")[0]),b=sR[b]),r.push(new Wv(b,m))}const l=o.substring(e[0].length),u=e[3]||"void",h=e[1]!==void 0?e[1]:"";return{type:sR[u]||u,inputs:r,name:h,inputsCode:t,blockCode:l,outputType:u}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")};class q9 extends jv{constructor(e){const{type:t,inputs:s,name:i,inputsCode:r,blockCode:l,outputType:u}=H9(e);super(t,s,i),this.inputsCode=r,this.blockCode=l,this.outputType=u}getCode(e=this.name){const t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class $9 extends F3{parseFunction(e){return new q9(e)}}const W9={[Us.READ_ONLY]:"read",[Us.WRITE_ONLY]:"write",[Us.READ_WRITE]:"read_write"},iR={[fc]:"repeat",[cr]:"clamp",[pc]:"mirror"},Kb={vertex:br.VERTEX,fragment:br.FRAGMENT,compute:br.COMPUTE},nR={instance:!0,swizzleAssign:!1,storageBuffer:!0},X9={"^^":"tsl_xor"},j9={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},rR={},Yh={tsl_xor:new Dt("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Dt("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Dt("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Dt("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Dt("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Dt("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Dt("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Dt("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new Dt("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new Dt("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Dt("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new Dt("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Dt(` 372fn tsl_inverse_mat2( m : mat2x2<f32> ) -> mat2x2<f32> { 373 374 let det = m[ 0 ][ 0 ] * m[ 1 ][ 1 ] - m[ 0 ][ 1 ] * m[ 1 ][ 0 ]; 375 376 return mat2x2<f32>( 377 m[ 1 ][ 1 ], - m[ 0 ][ 1 ], 378 - m[ 1 ][ 0 ], m[ 0 ][ 0 ] 379 ) * ( 1.0 / det ); 380 381} 382`),inverse_mat3:new Dt(` 383fn tsl_inverse_mat3( m : mat3x3<f32> ) -> mat3x3<f32> { 384 385 let a00 = m[ 0 ][ 0 ]; let a01 = m[ 0 ][ 1 ]; let a02 = m[ 0 ][ 2 ]; 386 let a10 = m[ 1 ][ 0 ]; let a11 = m[ 1 ][ 1 ]; let a12 = m[ 1 ][ 2 ]; 387 let a20 = m[ 2 ][ 0 ]; let a21 = m[ 2 ][ 1 ]; let a22 = m[ 2 ][ 2 ]; 388 389 let b01 = a22 * a11 - a12 * a21; 390 let b11 = - a22 * a10 + a12 * a20; 391 let b21 = a21 * a10 - a11 * a20; 392 393 let det = a00 * b01 + a01 * b11 + a02 * b21; 394 395 return mat3x3<f32>( 396 b01, ( - a22 * a01 + a02 * a21 ), ( a12 * a01 - a02 * a11 ), 397 b11, ( a22 * a00 - a02 * a20 ), ( - a12 * a00 + a02 * a10 ), 398 b21, ( - a21 * a00 + a01 * a20 ), ( a11 * a00 - a01 * a10 ) 399 ) * ( 1.0 / det ); 400 401} 402`),inverse_mat4:new Dt(` 403fn tsl_inverse_mat4( m : mat4x4<f32> ) -> mat4x4<f32> { 404 405 let a00 = m[ 0 ][ 0 ]; let a01 = m[ 0 ][ 1 ]; let a02 = m[ 0 ][ 2 ]; let a03 = m[ 0 ][ 3 ]; 406 let a10 = m[ 1 ][ 0 ]; let a11 = m[ 1 ][ 1 ]; let a12 = m[ 1 ][ 2 ]; let a13 = m[ 1 ][ 3 ]; 407 let a20 = m[ 2 ][ 0 ]; let a21 = m[ 2 ][ 1 ]; let a22 = m[ 2 ][ 2 ]; let a23 = m[ 2 ][ 3 ]; 408 let a30 = m[ 3 ][ 0 ]; let a31 = m[ 3 ][ 1 ]; let a32 = m[ 3 ][ 2 ]; let a33 = m[ 3 ][ 3 ]; 409 410 let b00 = a00 * a11 - a01 * a10; 411 let b01 = a00 * a12 - a02 * a10; 412 let b02 = a00 * a13 - a03 * a10; 413 let b03 = a01 * a12 - a02 * a11; 414 let b04 = a01 * a13 - a03 * a11; 415 let b05 = a02 * a13 - a03 * a12; 416 let b06 = a20 * a31 - a21 * a30; 417 let b07 = a20 * a32 - a22 * a30; 418 let b08 = a20 * a33 - a23 * a30; 419 let b09 = a21 * a32 - a22 * a31; 420 let b10 = a21 * a33 - a23 * a31; 421 let b11 = a22 * a33 - a23 * a32; 422 423 let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; 424 425 return mat4x4<f32>( 426 a11 * b11 - a12 * b10 + a13 * b09, 427 a02 * b10 - a01 * b11 - a03 * b09, 428 a31 * b05 - a32 * b04 + a33 * b03, 429 a22 * b04 - a21 * b05 - a23 * b03, 430 a12 * b08 - a10 * b11 - a13 * b07, 431 a00 * b11 - a02 * b08 + a03 * b07, 432 a32 * b02 - a30 * b05 - a33 * b01, 433 a20 * b05 - a22 * b02 + a23 * b01, 434 a10 * b10 - a11 * b08 + a13 * b06, 435 a01 * b08 - a00 * b10 - a03 * b06, 436 a30 * b04 - a31 * b02 + a33 * b00, 437 a21 * b02 - a20 * b04 - a23 * b00, 438 a11 * b07 - a10 * b09 - a12 * b06, 439 a00 * b09 - a01 * b07 + a02 * b06, 440 a31 * b01 - a30 * b03 - a32 * b00, 441 a20 * b03 - a21 * b01 + a22 * b00 442 ) * ( 1.0 / det ); 443 444} 445`),biquadraticTexture:new Dt(` 446fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f { 447 448 let res = vec2f( iRes ); 449 450 let uvScaled = coord * res; 451 let uvWrapping = ( ( uvScaled % res ) + res ) % res; 452 453 // https://www.shadertoy.com/view/WtyXRy 454 455 let uv = uvWrapping - 0.5; 456 let iuv = floor( uv ); 457 let f = fract( uv ); 458 459 let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level ); 460 let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level ); 461 let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level ); 462 let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level ); 463 464 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); 465 466} 467`),biquadraticTextureArray:new Dt(` 468fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f { 469 470 let res = vec2f( iRes ); 471 472 let uvScaled = coord * res; 473 let uvWrapping = ( ( uvScaled % res ) + res ) % res; 474 475 // https://www.shadertoy.com/view/WtyXRy 476 477 let uv = uvWrapping - 0.5; 478 let iuv = floor( uv ); 479 let f = fract( uv ); 480 481 let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level ); 482 let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level ); 483 let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level ); 484 let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level ); 485 486 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); 487 488} 489`)},Y9={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"};let Q3="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Q3+=`diagnostic( off, derivative_uniformity ); 490`);class Z9 extends U3{constructor(e,t){super(e,t,new $9),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,s,i,r,l=this.shaderStage){return l==="fragment"?i?r?`textureSample( ${t}, ${t}_sampler, ${s}, ${i}, ${r} )`:`textureSample( ${t}, ${t}_sampler, ${s}, ${i} )`:r?`textureSample( ${t}, ${t}_sampler, ${s}, ${r} )`:`textureSample( ${t}, ${t}_sampler, ${s} )`:this.generateTextureSampleLevel(e,t,s,"0",i)}generateTextureSampleLevel(e,t,s,i,r,l){return this.isUnfilterable(e)===!1?r?l?`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${r}, ${i}, ${l} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${r}, ${i} )`:l?`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${i}, ${l} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,s,l,i,r):this.generateTextureLod(e,t,s,r,l,i)}generateWrapFunction(e){const t=`tsl_coord_${iR[e.wrapS]}S_${iR[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`;let s=rR[t];if(s===void 0){const i=[],r=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f";let l=`fn ${t}( coord : ${r} ) -> ${r} { 491 492 return ${r}( 493`;const u=(h,d)=>{h===fc?(i.push(Yh.repeatWrapping_float),l+=` tsl_repeatWrapping_float( coord.${d}
493 )`):h===cr?(i.push(Yh.clampWrapping_float),l+=` tsl_clampWrapping_float( coord.${d} )`):h===pc?(i.push(Yh.mirrorWrapping_float),l+=` tsl_mirrorWrapping_float( coord.${d} )`):(l+=` coord.${d}`,me(`WebGPURenderer: Unsupported texture wrap type "${h}" for vertex shader.`))};u(e.wrapS,"x"),l+=`, 494`,u(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(l+=`, 495`,u(e.wrapR,"z")),l+=` 496 ); 497 498} 499`,rR[t]=s=new Dt(l,i)}return s.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,s){const i=this.getDataFromNode(e,this.shaderStage,this.cache);i.dimensionsSnippet===void 0&&(i.dimensionsSnippet={});let r=i.dimensionsSnippet[s];if(i.dimensionsSnippet[s]===void 0){let l,u;const{primarySamples:h}=this.renderer.backend.utils.getTextureSampleData(e),d=h>1;e.is3DTexture||e.isData3DTexture?u="vec3<u32>":u="vec2<u32>",d||e.isStorageTexture?l=t:l=`${t}${s?`, u32( ${s} )`:""}`,r=new Tm(new vm(`textureDimensions( ${l} )`,u)),i.dimensionsSnippet[s]=r,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(i.arrayLayerCount=new Tm(new vm(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(i.cubeFaceCount=new Tm(new vm("6u","u32")))}return r.build(this)}generateFilteredTexture(e,t,s,i,r="0u",l){const u=this.generateWrapFunction(e),h=this.generateTextureDimension(e,t,r);return i&&(s=`${s} + vec2<f32>(${i}) / ${h}`),l?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${u}( ${s} ), ${h}, u32( ${l} ), u32( ${r} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${u}( ${s} ), ${h}, u32( ${r} ) )`)}generateTextureLod(e,t,s,i,r,l="0u"){if(e.isCubeTexture===!0){r&&(s=`${s} + vec3<f32>(${r})`);const b=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${b}( ${l} ) )`}const u=this.generateWrapFunction(e),h=this.generateTextureDimension(e,t,l),d=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",p=d==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";r&&(s=`${s} + ${d}<f32>(${r}) / ${d}<f32>( ${h} )`);const m=`${d}<f32>( 0 )`,y=`${d}<f32>( ${h} - ${p} )`;return s=`${d}<u32>( clamp( floor( ${u}( ${s} ) * ${d}<f32>( ${h} ) ), ${m}, ${y} ) )`,this.generateTextureLoad(e,t,s,l,i,null)}generateStorageTextureLoad(e,t,s,i,r,l){l&&(s=`${s} + ${l}`);let u;return r?u=`textureLoad( ${t}, ${s}, ${r} )`:u=`textureLoad( ${t}, ${s} )`,u}generateTextureLoad(e,t,s,i,r,l){i===null&&(i="0u"),l&&(s=`${s} + ${l}`);let u;return r?u=`textureLoad( ${t}, ${s}, ${r}, u32( ${i} ) )`:(u=`textureLoad( ${t}, ${s}, u32( ${i} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(u+=".x")),u}generateTextureStore(e,t,s,i,r){let l;return i?l=`textureStore( ${t}, ${s}, ${i}, ${r} )`:l=`textureStore( ${t}, ${s}, ${r} )`,l}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Al.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===_s||this.isSampleCompare(e)===!1&&e.minFilter===$t&&e.magFilter===$t||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,s,i,r,l=this.shaderStage){let u=null;return this.isUnfilterable(e)?u=this.generateTextureLod(e,t,s,i,r,"0",l):u=this._generateTextureSample(e,t,s,i,r,l),u}generateTextureGrad(e,t,s,i,r,l,u=this.shaderStage){if(u==="fragment")return r?l?`textureSampleGrad( ${t}, ${t}_sampler, ${s}, ${r}, ${i[0]}, ${i[1]}, ${l} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${s}, ${r}, ${i[0]}, ${i[1]} )`:l?`textureSampleGrad( ${t}, ${t}_sampler, ${s}, ${i[0]}, ${i[1]}, ${l} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${s}, ${i[0]}, ${i[1]} )`;he(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${u} shader.`)}generateTextureCompare(e,t,s,i,r,l,u=this.shaderStage){if(u==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?l?`textureSampleCompare( ${t}, ${t}_sampler, ${s}, ${r}, ${i}, ${l} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${s}, ${r}, ${i} )`:l?`textureSampleCompare( ${t}, ${t}_sampler, ${s}, ${i}, ${l} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${s}, ${i} )`;he(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${u} shader.`)}generateTextureGather(e,t,s,i,r,l){const u=e.isDepthTexture===!0?"":`${i}, `;return r?l?`textureGather( ${u}${t}, ${t}_sampler, ${s}, ${r}, ${l} )`:`textureGather( ${u}${t}, ${t}_sampler, ${s}, ${r} )`:l?`textureGather( ${u}${t}, ${t}_sampler, ${s}, ${l} )`:`textureGather( ${u}${t}, ${t}_sampler, ${s})`}generateTextureGatherCompare(e,t,s,i,r,l){return r?l?`textureGatherCompare( ${t}, ${t}_sampler, ${s}, ${r}, ${i}, ${l} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${s}, ${r}, ${i})`:l?`textureGatherCompare( ${t}, ${t}_sampler, ${s}, ${i}, ${l} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${s}, ${i})`}generateTextureLevel(e,t,s,i,r,l){return this.isUnfilterable(e)===!1?r?l?`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${r}, ${i}, ${l} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${r}, ${i} )`:l?`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${i}, ${l} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,s,l,i,r):this.generateTextureLod(e,t,s,r,l,i)}generateTextureBias(e,t,s,i,r,l,u=this.shaderStage){if(u==="fragment")return r?l?`textureSampleBias( ${t}, ${t}_sampler, ${s}, ${r}, ${i}, ${l} )`:`textureSampleBias( ${t}, ${t}_sampler, ${s}, ${r}, ${i} )`:l?`textureSampleBias( ${t}, ${t}_sampler, ${s}, ${i}, ${l} )`:`textureSampleBias( ${t}, ${t}_sampler, ${s}, ${i} )`;he(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${u} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){const s=e.name,i=e.type;return i==="texture"||i==="cubeTexture"||i==="cubeDepthTexture"||i==="storageTexture"||i==="texture3D"?s:i==="buffer"||i==="storageBuffer"||i==="indirectStorageBuffer"?this.isCu
499stomStruct(e)?s:s+".value":e.groupNode.name+"."+s}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=X9[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(me("WebGPURenderer: Atomic operations are only supported in compute shaders."),Us.READ_WRITE):Us.READ_ONLY:e.access}getStorageAccess(e,t){return W9[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,s,i=null){const r=super.getUniformFromNode(e,t,s,i),l=this.getDataFromNode(e,s,this.globalCache);if(l.uniformGPU===void 0){let u;const h=e.groupNode,d=h.name,p=this.getBindGroupArray(d,s);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let m=null;const y=this.getNodeAccess(e,s);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?m=new O_(r.name,r.node,h,y):m=new Sy(r.name,r.node,h,y):t==="cubeTexture"||t==="cubeDepthTexture"?m=new H3(r.name,r.node,h,y):t==="texture3D"&&(m=new O_(r.name,r.node,h,y)),m.store=e.isStorageTextureNode===!0,m.mipLevel=m.store?e.mipLevel:0,m.setVisibility(Kb[s]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&m.store===!1||e.gatherNode!==null){const _=new A9(`${r.name}_sampler`,r.node,h);_.setVisibility(Kb[s]),p.push(_,m),u=[_,m]}else p.push(m),u=[m]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){const m=this.getSharedDataFromNode(e);let y=m.buffer;if(y===void 0){const b=t==="buffer"?G3:R9;y=new b(e,h),m.buffer=y}y.setVisibility(y.getVisibility()|Kb[s]),p.push(y),u=y,r.name=i||"NodeBuffer_"+r.id}else{let m=this.uniformGroups[d];m===void 0&&(m=new I3(d,h),m.setVisibility(br.VERTEX|br.FRAGMENT|br.COMPUTE),this.uniformGroups[d]=m),p.indexOf(m)===-1&&p.push(m),u=this.getNodeUniform(r,t);const y=u.name;m.uniforms.some(_=>_.name===y)||m.addUniform(u)}l.uniformGPU=u}return r}getBuiltin(e,t,s,i=this.shaderStage){const r=this.builtins[i]||(this.builtins[i]=new Map);return r.has(e)===!1&&r.set(e,{name:e,property:t,type:s}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,s=this.flowShaderNode(e),i=[];for(const l of t.inputs)i.push(l.name+" : "+this.getType(l.type));let r=`fn ${t.name}( ${i.join(", ")} ) -> ${this.getType(t.type)} { 500${s.vars} 501${s.code} 502`;return s.result&&(r+=` return ${s.result}; 503`),r+=` 504} 505`,r}getInstanceIndex(){return this.shaderStage==="vertex"?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4<f32>")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],s=this.directives[e];if(s!==void 0)for(const i of s)t.push(`enable ${i};`);return t.join(` 506`)}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array<f32, ${e} >`,"vertex")}getBuiltins(e){const t=[],s=this.builtins[e];if(s!==void 0)for(const{name:i,property:r,type:l}of s.values())t.push(`@builtin( ${i} ) ${r} : ${l}`);return t.join(`, 507 `)}getScopedArray(e,t,s,i){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:s,bufferCount:i}),e}getScopedArrays(e){if(e!=="compute")return;const t=[];for(const{name:s,scope:i,bufferType:r,bufferCount:l}of this.scopedArrays.values()){const u=this.getType(r);t.push(`var<${i}> ${s}: array< ${u}, ${l} >;`)}return t.join(` 508`)}getAttributes(e){const t=[];if(e==="compute"&&(this.getBuiltin("global_invocation_id","globalId","vec3<u32>","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3<u32>","attribute"),this.getBuiltin("local_invocation_id","localId","vec3<u32>","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3<u32>","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),e==="vertex"||e==="compute"){const s=this.getBuiltins("attribute");
508s&&t.push(s);const i=this.getAttributesArray();for(let r=0,l=i.length;r<l;r++){const u=i[r],h=u.name,d=this.getType(u.type);t.push(`@location( ${r} ) ${h} : ${d}`)}}return t.join(`, 509 `)}getStructMembers(e){const t=[];for(const s of e.members){const i=e.output?"@location( "+s.index+" ) ":"";let r=this.getType(s.type);s.atomic&&(r="atomic< "+r+" >"),t.push(` ${i+s.name} : ${r}`)}return e.output&&t.push(` ${this.getBuiltins("output")}`),t.join(`, 510`)}getStructs(e){let t="";const s=this.structs[e];if(s.length>0){const i=[];for(const r of s){let l=`struct ${r.name} { 511`;l+=this.getStructMembers(r),l+=` 512};`,i.push(l)}t=` 513`+i.join(` 514 515`)+` 516`}return t}getVar(e,t,s=null,i=""){let r=`var${i} ${t} : `;return s!==null?r+=this.generateArrayDeclaration(e,s):r+=this.getType(e),r}getVars(e,t=!1){let s="";t&&(s="<private>");const i=[],r=this.vars[e];if(r!==void 0)for(const l of r)i.push(`${this.getVar(l.type,l.name,l.count,s)};`);return t?i.join(` 517`):` 518 ${i.join(` 519 `)} 520`}getVaryings(e){const t=[];if(e==="vertex"&&this.getBuiltin("position","builtinClipSpace","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){const r=this.varyings,l=this.vars[e];let u=0;for(let h=0;h<r.length;h++){const d=r[h];if(d.needsInterpolation){let p=`@location( ${u++} )`;if(d.interpolationType){const m=d.interpolationSampling!==null?`, ${d.interpolationSampling} )`:" )";p+=` @interpolate( ${d.interpolationType}${m}`}else/^(int|uint|ivec|uvec)/.test(d.type)&&(p+=" @interpolate(flat, either)");t.push(`${p} ${d.name} : ${this.getType(d.type)}`)}else e==="vertex"&&l.includes(d)===!1&&l.push(d)}}const s=this.getBuiltins(e);s&&t.push(s);const i=t.join(`, 521 `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+i):i}isCustomStruct(e){const t=e.value,s=e.node,i=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&s.structTypeNode!==null,r=s.value&&s.value.array&&typeof s.value.itemSize=="number"&&s.value.array.length>s.value.itemSize;return i&&!r}getUniforms(e){const t=this.renderer.backend,s=this.uniforms[e],i=[],r=[],l=[],u={};for(const d of s){const p=d.groupNode.name,m=this.bindingsIndexes[p];if(d.type==="texture"||d.type==="cubeTexture"||d.type==="cubeDepthTexture"||d.type==="storageTexture"||d.type==="texture3D"){const y=d.node,b=y.value;(b.isCubeTexture===!0||this.isUnfilterable(b)===!1&&y.isStorageTextureNode!==!0||y.gatherNode!==null)&&(this.isSampleCompare(b)&&y.compareNode!==null?i.push(`@binding( ${m.binding++} ) @group( ${m.group} ) var ${d.name}_sampler : sampler_comparison;`):i.push(`@binding( ${m.binding++} ) @group( ${m.group} ) var ${d.name}_sampler : sampler;`));let v,M="";const{primarySamples:A}=t.utils.getTextureSampleData(b);if(A>1&&(M="_multisampled"),b.isCubeTexture===!0&&b.isDepthTexture===!0)v="texture_depth_cube";else if(b.isCubeTexture===!0)v="texture_cube<f32>";else if(b.isDepthTexture===!0)t.compatibilityMode&&b.compareFunction===null?v=`texture${M}_2d<f32>`:v=`texture_depth${M}_2d${b.isArrayTexture===!0?"_array":""}`;else if(d.node.isStorageTextureNode===!0){const C=z_(b,t.device),E=this.getStorageAccess(d.node,e),F=d.node.value.is3DTexture,L=d.node.value.isArrayTexture;v=`texture_storage_${F?"3d":`2d${L?"_array":""}`}<${C}, ${E}>`}else if(b.isArrayTexture===!0||b.isDataArrayTexture===!0||b.isCompressedArrayTexture===!0)v="texture_2d_array<f32>";else if(b.is3DTexture===!0||b.isData3DTexture===!0)v="texture_3d<f32>";else{const C=this.getComponentTypeFromTexture(b).charAt(0);v=`texture${M}_2d<${C}32>`}i.push(`@binding( ${m.binding++} ) @group( ${m.group} ) var ${d.name} : ${v};`)}else if(d.type==="buffer"||d.type==="storageBuffer"||d.type==="indirectStorageBuffer"){const y=d.node,b=this.getType(y.getNodeType(this)),_=y.bufferCount,v=_>0&&d.type==="buffer"?", "+_:"",M=y.isStorageBufferNode?`storage, ${this.getStorageAccess(y,e)}`:"uniform";if(this.isCustomStruct(d))r.push(`@binding( ${m.binding++} ) @group( ${m.group} ) var<${M}> ${d.name} : ${b};`);else{const C=` value : array< ${y.isAtomic?`atomic<${b}>`:`${b}`}${v} >`;r.push(this._getWGSLStructBinding(d.name,C,M,m.binding++,m.group))}}else{const y=d.groupNode.name;if(u[y]===void 0){const b=this.uniformGroups[y];if(b!==void 0){const _=[];for(const M of b.uniforms){const A=M.getType(),C=this.getType(this.getVectorType(A));_.push(` ${M.name} : ${C}`)}let v=this.uniformGroupsBindings[y];
521v===void 0&&(v={index:m.binding++,id:m.group},this.uniformGroupsBindings[y]=v),u[y]={index:v.index,id:v.id,snippets:_}}}}}for(const d in u){const p=u[d];l.push(this._getWGSLStructBinding(d,p.snippets.join(`, 522`),"uniform",p.index,p.id))}return[...i,...r,...l].join(` 523`)}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const s=this.allowGlobalVariables,i=e[t];i.uniforms=this.getUniforms(t),i.attributes=this.getAttributes(t),i.varyings=this.getVaryings(t),i.structs=this.getStructs(t),i.vars=this.getVars(t,s),i.codes=this.getCodes(t),i.directives=this.getDirectives(t),i.scopedArrays=this.getScopedArrays(t);let r=`// code 524 525`;r+=this.flowCode[t];const l=this.flowNodes[t],u=l[l.length-1],h=u.outputNode,d=h!==void 0&&h.isOutputStructNode===!0;for(const p of l){const m=this.getFlowData(p),y=p.name;if(y&&(r.length>0&&(r+=` 526`),r+=` // flow -> ${y} 527`),r+=`${m.code} 528 `,p===u&&t!=="compute"){if(r+=`// result 529 530 `,t==="vertex")r+=`varyings.builtinClipSpace = ${m.result};`;else if(t==="fragment")if(d)i.returnType=h.getNodeType(this),i.structs+="var<private> output : "+i.returnType+";",r+=`return ${m.result};`;else{let b=` @location( 0 ) color: ${this.getType(this.getOutputType())}`;const _=this.getBuiltins("output");_&&(b+=`, 531 `+_),i.returnType="OutputStruct",i.structs+=this._getWGSLStruct("OutputStruct",b),i.structs+=` 532var<private> output : OutputStruct;`,r+=`output.color = ${this.format(m.result,u.getNodeType(this),this.getOutputType())}; 533 534 return output;`}}}i.flow=r}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let s;return t!==null&&(s=this._getWGSLMethod(e+"_"+t)),s===void 0&&(s=this._getWGSLMethod(e)),s||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,s){return`select( ${s}, ${t}, ${e} )`}getType(e){return j9[e]||e}isAvailable(e){let t=nR[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),nR[e]=t),t}_getWGSLMethod(e){return Yh[e]!==void 0&&this._include(e),Y9[e]}_include(e){const t=Yh[e];return t.build(this),this.addInclude(t),t}
534_getWGSLVertexCode(e){return`${this.getSignature()} 535// directives 536${e.directives} 537 538// structs 539${e.structs} 540 541// uniforms 542${e.uniforms} 543 544// varyings 545${e.varyings} 546var<private> varyings : VaryingsStruct; 547 548// vars 549${e.vars} 550 551// codes 552${e.codes} 553 554@vertex 555fn main( ${e.attributes} ) -> VaryingsStruct { 556 557 // flow 558 ${e.flow} 559 560 return varyings; 561 562} 563`}_getWGSLFragmentCode(e){return`${this.getSignature()} 564// global 565${Q3} 566 567// structs 568${e.structs} 569 570// uniforms 571${e.uniforms} 572 573// vars 574${e.vars} 575 576// codes 577${e.codes} 578 579@fragment 580fn main( ${e.varyings} ) -> ${e.returnType} { 581 582 // flow 583 ${e.flow} 584 585} 586`}_getWGSLComputeCode(e,t){const[s,i,r]=t;return`${this.getSignature()} 587// directives 588${e.directives} 589 590// system 591var<private> instanceIndex : u32; 592 593// locals 594${e.scopedArrays} 595 596// structs 597${e.structs} 598 599// uniforms 600${e.uniforms} 601 602// vars 603${this.allowGlobalVariables?e.vars:""} 604 605// codes 606${e.codes} 607 608@compute @workgroup_size( ${s}, ${i}, ${r} ) 609fn main( ${e.attributes} ) { 610 611 // local vars 612 ${this.allowGlobalVariables?"":e.vars} 613 614 // system 615 instanceIndex = globalId.x 616 + globalId.y * ( ${s} * numWorkgroups.x ) 617 + globalId.z * ( ${s} * numWorkgroups.x ) * ( ${i} * numWorkgroups.y ); 618 619 // flow 620 ${e.flow} 621 622} 623`}_getWGSLStruct(e,t){return` 624struct ${e} { 625${t} 626};`}_getWGSLStructBinding(e,t,s,i=0,r=0){const l=e+"Struct";return`${this._getWGSLStruct(l,t)} 627@binding( ${i} ) @group( ${r} ) 628var<${s}> ${e} : ${l};`}}const Vs=new Uc,Jb=new Hd,K3=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&K3.set(Float16Array,["float16"]);const Q9=new Map([[IR,["float16"]]]),K9=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class J9{constructor(e){this.backend=e}createAttribute(e,t){const s=this._getBufferAttribute(e),i=this.backend,r=i.get(s);let l=r.buffer;if(l===void 0){const u=i.device;let h=s.array;if(e.normalized===!1){if(h.constructor===Int16Array||h.constructor===Int8Array)h=new Int32Array(h);else if((h.constructor===Uint16Array||h.constructor===Uint8Array)&&(h=new Uint32Array(h),t&GPUBufferUsage.INDEX))for(let y=0;y<h.length;y++)h[y]===65535&&(h[y]=4294967295)}s.array=h;let d;if((s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute)&&s.itemSize===3)d=4;else if(s.itemSize>1&&s.itemSize*h.BYTES_PER_ELEMENT%4!==0){const y=s.itemSize*h.BYTES_PER_ELEMENT;d=Math.floor((y+3)/4)*4/h.BYTES_PER_ELEMENT}if(d!==void 0){const y=s.itemSize,b=new h.constructor(s.count*d);for(let _=0;_<s.count;_++)b.set(h.subarray(_*y,_*y+y),_*d);(s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute)&&(s.itemSize=d,s.array=b),h=b,r._itemSize=y,r._paddedItemSize=d}const p=h.byteLength,m=p+(4-p%4)%4;Vs.label=s.name,Vs.size=m,Vs.usage=t,Vs.mappedAtCreation=!0,l=u.createBuffer(Vs),Vs.reset(),new h.constructor(l.getMappedRange()).set(h),l.unmap(),r.buffer=l}}updateAttribute(e){const t=this._getBufferAttribute(e),s=this.backend,i=s.device,r=s.get(t),l=s.get(t).buffer;let u=t.array;const h=r._itemSize,d=r._paddedItemSize;if(d!==void 0){u=new u.constructor(t.count*d);for(let m=0;m<t.count;m++)u.set(t.array.subarray(m*h,m*h+h),m*d);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=u)}const p=t.updateRanges;if(p.length===0)i.queue.writeBuffer(l,0,u,0);else{const m=hg(u),y=m?1:u.BYTES_PER_ELEMENT;for(let b=0,_=p.length;b<_;b++){const v=p[b];let M,A;if(d!==void 0){const E=Math.floor(v.start/h),F=Math.ceil((v.start+v.count)/h)-E;M=E*d*y,A=F*d*y}else M=v.start*y,A=v.count*y;const C=M*(m?u.BYTES_PER_ELEMENT:1);i.queue.writeBuffer(l,C,u,M,A)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){const t=e.getAttributes(),s=new Map;for(let i=0;i<t.length;i++){const r=t[i],l=r.array.BYTES_PER_ELEMENT,u=this._getBufferAttribute(r);let h=s.get(u);if(h===void 0){let m,y;r.isInterleavedBufferAttribute===!0?(m=r.data.stride*l,y=r.data.isInstancedInterleavedBuffer?am.Instance:am.Vertex):(m=r.itemSize*l,y=r.isInstancedBufferAttribute?am.Instance:am.Vertex,r.itemSize>1&&m%4!==0&&(m=Math.floor((m+3)/4)*4)),r.normalized===!1&&(r.array.constructor===Int16Array||r.array.constructor===Uint16Array)&&(m=4),h={arrayStri
628de:m,attributes:[],stepMode:y},s.set(u,h)}const d=this._getVertexFormat(r),p=r.isInterleavedBufferAttribute===!0?r.offset*l:0;h.attributes.push({shaderLocation:i,offset:p,format:d})}return Array.from(s.values())}destroyAttribute(e){const t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,s=0,i=-1){const r=this.backend,l=r.device,h=r.get(this._getBufferAttribute(e)).buffer,d=i===-1?h.size-s:i;let p;if(t!==null&&t.isReadbackBuffer){const b=r.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,b.readBufferGPU===void 0){Vs.label=`${t.name}_readback`,Vs.size=t.maxByteLength,Vs.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,p=l.createBuffer(Vs),Vs.reset();const _=()=>{t.buffer=null,t._mapped=!1,p.unmap()},v=()=>{t.buffer=null,t._mapped=!1,p.destroy(),r.delete(t),t.removeEventListener("release",_),t.removeEventListener("dispose",v)};t.addEventListener("release",_),t.addEventListener("dispose",v),b.readBufferGPU=p}else p=b.readBufferGPU}else Vs.label=`${e.name}_readback`,Vs.size=d,Vs.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,p=l.createBuffer(Vs),Vs.reset();Jb.label=`readback_encoder_${e.name}`;const m=l.createCommandEncoder(Jb);Jb.reset(),m.copyBufferToBuffer(h,s,p,0,d);const y=m.finish();if(ur(l,y),await p.mapAsync(GPUMapMode.READ,0,d),t===null){const _=p.getMappedRange(0,d).slice();return p.destroy(),_}else{if(t.isReadbackBuffer)return t.buffer=p.getMappedRange(0,d),t;{const b=p.getMappedRange(0,d);return new Uint8Array(t).set(new Uint8Array(b)),p.destroy(),t}}}_getVertexFormat(e){const{itemSize:t,normalized:s}=e,i=e.array.constructor,r=e.constructor;let l;if(t===1)l=K9.get(i);else{const h=(Q9.get(r)||K3.get(i))[s?1:0];if(h){const d=i.BYTES_PER_ELEMENT*t,m=Math.floor((d+3)/4)*4/i.BYTES_PER_ELEMENT;if(m%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");l=`${h}x${m}`}}return l||he("WebGPUAttributeUtils: Vertex format not supported yet."),l}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}const Li=new W3,Zh=new Uc,Iu=new Zv;class eH{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class tH{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){const t=this.backend,s=t.device,i=t.get(e);if(i.layout)return i.layout.layoutGPU;const r=this._createLayoutEntries(e),l=wc(JSON.stringify(r));let u=this._bindGroupLayoutCache.get(l);return u===void 0&&(u=new eH(s.createBindGroupLayout({entries:r})),this._bindGroupLayoutCache.set(l,u)),u.usedTimes++,i.layout=u,i.layoutKey=l,u.layoutGPU}createBindings(e,t,s,i=0){const{backend:r}=this,l=r.get(e),u=this.createBindingsLayout(e);let h;s>0&&(l.groups===void 0&&(l.groups=[],l.versions=[]),l.versions[s]===i&&(h=l.groups[s])),h===void 0&&(h=this.createBindGroup(e,u),s>0&&(l.groups[s]=h,l.versions[s]=i)),l.group=h}updateBinding(e){const t=this.backend,s=t.device,i=e.buffer,r=t.get(e).buffer,l=e.updateRanges;if(l.length===0)s.queue.writeBuffer(r,0,i,0);else{const u=hg(i),h=u?1:i.BYTES_PER_ELEMENT;let d=l[0].start;for(let p=0,m=l.length;p<m;p++){const y=l[p],b=l[p+1],_=y.start+y.count;if(b!==void 0&&b.start===_)continue;const v=d*h,M=(_-d)*h,A=v*(u?i.BYTES_PER_ELEMENT:1);s.queue.writeBuffer(r,A,i,v,M),b!==void 0&&(d=b.start)}}}createBindGroupIndex(e,t){const i=this.backend.device,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,l=e[0];Zh.label="bindingCameraIndex_"+l,Zh.size=16,Zh.usage=r;const u=i.createBuffer(Zh);Zh.reset(),i.queue.writeBuffer(u,0,e,0),Li.label="bindGroupCameraIndex_"+l,Li.layout=t,Li.entries.push({binding:0,resource:{buffer:u}});const h=i.createBindGroup(Li);return Li.reset(),h}createBindGroup(e,t){const s=this.backend,i=s.device;let r=0;Li.label="bindGroup_"+e.name,Li.layout=t;for(const u of e.bindings){if(u.isUniformBuffer){const h=s.get(u);Li.entries.push({binding:r,resource:{buffer:h.buffer}})}else if(u.isStorageBuffer){const h=s.get(u.attribute).buffer;Li.entries.push({binding:r,resource:{buffer:h}})}else if(u.isSampledTexture){const h=s.get(u.texture);let d;if(h.externalTexture!==void 0)d=i.importExternalTexture({source:h.externalTexture});else{const p=u.store?1:h.texture.mipLevelCount,m=u.store?u.mipLevel:0;let y=`view-${h.texture.width}-${h.texture.height}`;if(h.texture.depthOrArrayLayers>1&&(y+=`-${h.texture.depthOrArrayLayers}`),y+=`-${p}-${m}`,d=h[y],d===void 0){const b=M9.All;let _;u.isSampledCubeTexture?_=Cs.Cube:u.texture.isArrayTexture||u.texture.isDataArrayTexture||u.texture.isCompressedArrayTexture?_=Cs.TwoDArray:u.isSampledTexture3D?_=Cs.ThreeD:_=Cs.TwoD,Iu.aspect=b,Iu.dimension=_,Iu.mipLevelCount=p,Iu.baseMipLevel=m,d=h[y]=h.texture.createView(Iu),Iu.reset()}}Li.entries.push({binding:r,resource:d})}else if(u.isSampler){const h=s.get(u);Li.entries.push({binding:r,resource:h.sampler})}r++}const l=i.createBindGroup(Li);return Li.reset(),l}_createLayoutEntries(e){const t=[];let s=0;for(const i of e.bindings){const r=this.backend,l={binding:s,visibility:i.visibility};if(i.isUniformBuffer||i.isStorageBuffer){const u={};i.isStorageBuffer&&(i.visibility&br.COMPUTE&&(i.access===Us.READ_WRITE||i.access===Us.WRITE_ONLY)?u.type=Xb.Storage:u.type=Xb.ReadOnlyStorage),l.buffer=u}else if(i.isSampledTexture&&i.store){const u={};u.format=this.backend.get(i.texture).texture.format;const h=i.access;h===Us.READ_WRITE?u.access=jb.ReadWrite:h===Us.WRITE_ONLY?u.access=jb.WriteOnly:u.access=jb.ReadOnly,i.texture.isArrayTexture?u.viewDimension=Cs.TwoDArray:i.texture.is3DTexture&&(u.viewDimension=Cs.ThreeD),l.storageTexture=u}else if(i.isSampledTexture){const u={},{primarySamples:h}=r.utils.getTextureSampleData(i.texture);if(h>
6281&&(u.multisampled=!0,i.texture.isDepthTexture||(u.sampleType=il.UnfilterableFloat)),i.texture.isDepthTexture)r.compatibilityMode&&i.texture.compareFunction===null?u.sampleType=il.UnfilterableFloat:u.sampleType=il.Depth;else{const d=i.texture.type;d===ps?u.sampleType=il.SInt:d===Ut?u.sampleType=il.UInt:d===_s&&(this.backend.hasFeature("float32-filterable")?u.sampleType=il.Float:u.sampleType=il.UnfilterableFloat)}i.isSampledCubeTexture?u.viewDimension=Cs.Cube:i.texture.isArrayTexture||i.texture.isDataArrayTexture||i.texture.isCompressedArrayTexture?u.viewDimension=Cs.TwoDArray:i.isSampledTexture3D&&(u.viewDimension=Cs.ThreeD),l.texture=u}else if(i.isSampler){const u={};i.texture.isDepthTexture&&(i.texture.compareFunction!==null&&i.textureNode.compareNode!==null&&r.hasCompatibility(Al.TEXTURE_COMPARE)?u.type=Kw.Comparison:u.type=Kw.NonFiltering),l.sampler=u}else he(`WebGPUBindingUtils: Unsupported binding "${i}".`);t.push(l),s++}return t}deleteBindGroupData(e){const{backend:t}=this,s=t.get(e);s.layout&&(s.layout.usedTimes--,s.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(s.layoutKey),s.layout=void 0,s.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class sH{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}}class iH{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}}class nH{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}}const Qh=new iH,ku=new nH,Hu=new X3,Oi=new j3;class rH{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:s,material:i,geometry:r,pipeline:l}=e,{vertexProgram:u,fragmentProgram:h}=l,d=this.backend,p=d.device,m=d.utils,y=d.get(l),b=[];for(const ce of e.getBindings()){const X=d.get(ce),{layoutGPU:ne}=X.layout;b.push(ne)}const _=d.attributeUtils.createShaderVertexBuffers(e);let v;i.blending!==ua&&(i.blending!==gn||i.transparent!==!1)&&(v=this._getBlending(i));let M={};i.stencilWrite===!0&&(M={compare:this._getStencilCompare(i),failOp:this._getStencilOperation(i.stencilFail),depthFailOp:this._getStencilOperation(i.stencilZFail),passOp:this._getStencilOperation(i.stencilZPass)});const A=this._getColorWriteMask(i),C=[];if(e.context.textures!==null){const ce=e.context.textures,X=e.context.mrt;for(let ne=0;ne<ce.length;ne++){const fe=ce[ne],Be=m.getTextureFormatGPU(fe);let Ce;if(X!==null)if(this.backend.compatibilityMode!==!0){const G=X.getBlendMode(fe.name);G.blending===I_?Ce=v:G.blending!==ua&&(Ce=this._getBlending(G))}else Ye("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),Ce=v;else Ce=v;C.push({format:Be,blend:Ce,writeMask:A})}}else{const ce=m.getCurrentColorFormat(e.context);C.push({format:ce,blend:v,writeMask:A})}const E=d.get(u).module,F=d.get(h).module,L=this._getPrimitiveState(s,r,i),U=this._getDepthCompare(i),R=m.getCurrentDepthStencilFormat(e.context),V=this._getSampleCount(e.context);ku.bindGroupLayouts=b;const $=p.createPipelineLayout(ku);ku.reset(),Oi.label=`renderPipeline_${i.name||i.type}_${i.id}`,Oi.vertex=Object.assign({},E,{buffers:_}),Oi.fragment=Object.assign({},F,{targets:C}),Oi.primitive=L,Oi.multisample.count=V,Oi.multisample.alphaToCoverageEnabled=i.alphaToCoverage&&V>1,Oi.layout=$;const ie={},le=e.context.depth,ye=e.context.stencil;(le===!0||ye===!0)&&(le===!0&&(ie.format=R,ie.depthWriteEnabled=i.depthWrite,ie.depthCompare=U),ye===!0&&(ie.stencilFront=M,ie.stencilBack=M,ie.stencilReadMask=i.stencilFuncMask,ie.stencilWriteMask=i.stencilWriteMask),i.polygonOffset===!0&&L.topology===nd.TriangleList&&(ie.depthBias=i.polygonOffsetUnits,ie.depthBiasSlopeScale=i.polygonOffsetFactor,ie.depthBiasClamp=0),Oi.depthStencil=ie),p.pushErrorScope("validation");const xe=[{program:u,module:E.module},{program:h,module:F.module}],Ne=Oi.label;if(t===null)y.pipeline=p.createRenderPipeline(Oi),Oi.reset(),p.popErrorScope().then(ce=>{ce!==null&&(y.error=!0,he(`WebGPURenderer: Render pipeline creation failed (${Ne}): ${ce.message}`),this._reportShaderDiagnostics(xe,Ne))});else{const ce=new Promise(async X=>{try{let ne=null,fe=null;try{fe=p.createRenderPipelineAsync(Oi)}catch(Ce){ne=Ce}if(Oi.reset(),fe!==null)try{y.pipeline=await fe}catch(Ce){ne=Ce}const Be=await p.popErrorScope();if(Be!==null||ne!==null){y.error=!0;const Ce=Be&&Be.message||ne&&ne.message||"unknown";he(`WebGPURenderer: Async render pipeline creation failed (${Ne}): ${Ce}`),await this._reportShaderDiagnostics(xe,Ne)}}finally{X()}});t.push(ce)}}createBundleEncoder(e,t="renderBundleEncoder"){const s=this.backend,{utils:i,device:r}=s,l=i.getCurrentDepthStencilFormat(e),u=i.getCurrentColorFormats(e),h=this._getSampleC
628ount(e);Hu.label=t,Hu.colorFormats=u,Hu.depthStencilFormat=l,Hu.sampleCount=h;const d=r.createRenderBundleEncoder(Hu);return Hu.reset(),d}createComputePipeline(e,t){const s=this.backend,i=s.device,r=s.get(e.computeProgram).module,l=s.get(e),u=[];for(const m of t){const y=s.get(m),{layoutGPU:b}=y.layout;u.push(b)}const h=e.computeProgram,d=`computePipeline_${h.stage}${h.name?`_${h.name}`:""}`;i.pushErrorScope("validation"),ku.bindGroupLayouts=u;const p=i.createPipelineLayout(ku);ku.reset(),Qh.label=d,Qh.compute=r,Qh.layout=p,l.pipeline=i.createComputePipeline(Qh),Qh.reset(),i.popErrorScope().then(m=>{m!==null&&(l.error=!0,he(`WebGPURenderer: Compute pipeline creation failed (${d}): ${m.message}`),this._reportShaderDiagnostics([{program:h,module:r.module}],d))})}async _reportShaderDiagnostics(e,t){for(const{program:s,module:i}of e){const r=await i.getCompilationInfo();if(r.messages.length===0)continue;const l=s.code.split(` 629`);for(const u of r.messages){const h=u.lineNum>0?` at line ${u.lineNum}${u.linePos>0?`:${u.linePos}`:""}`:"",d=`WebGPURenderer [${t} / ${s.stage} ${u.type}]${h}: ${u.message}`;let p="";u.lineNum>0&&u.lineNum<=l.length&&(p=` 630 ${l[u.lineNum-1]}`,u.linePos>0&&(p+=` 631 ${" ".repeat(u.linePos-1)}^`)),(u.type==="error"?he:me)(d+p)}}}_getBlending(e){let t,s;const i=e.blending,r=e.blendSrc,l=e.blendDst,u=e.blendEquation;if(i===ic){const h=e.blendSrcAlpha!==null?e.blendSrcAlpha:r,d=e.blendDstAlpha!==null?e.blendDstAlpha:l,p=e.blendEquationAlpha!==null?e.blendEquationAlpha:u;t={srcFactor:this._getBlendFactor(r),dstFactor:this._getBlendFactor(l),operation:this._getBlendOperation(u)},s={srcFactor:this._getBlendFactor(h),dstFactor:this._getBlendFactor(d),operation:this._getBlendOperation(p)}}else{const h=e.premultipliedAlpha,d=(p,m,y,b)=>{t={srcFactor:p,dstFactor:m,operation:sl.Add},s={srcFactor:y,dstFactor:b,operation:sl.Add}};if(h)switch(i){case gn:d(tt.One,tt.OneMinusSrcAlpha,tt.One,tt.OneMinusSrcAlpha);break;case Ku:d(tt.One,tt.One,tt.One,tt.One);break;case Ju:d(tt.Zero,tt.OneMinusSrc,tt.Zero,tt.One);break;case ec:d(tt.Dst,tt.OneMinusSrcAlpha,tt.Zero,tt.One);break}else switch(i){case gn:d(tt.SrcAlpha,tt.OneMinusSrcAlpha,tt.One,tt.OneMinusSrcAlpha);break;case Ku:d(tt.SrcAlpha,tt.One,tt.One,tt.One);break;case Ju:he(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case ec:he(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&s!==void 0)return{color:t,alpha:s};he("WebGPURenderer: Invalid blending: ",i)}_getBlendFactor(e){let t;switch(e){case no:t=tt.Zero;break;case _R:t=tt.One;break;case TR:t=tt.Src;break;case vR:t=tt.OneMinusSrc;break;case Td:t=tt.SrcAlpha;break;case vd:t=tt.OneMinusSrcAlpha;break;case AR:t=tt.Dst;break;case NR:t=tt.OneMinusDst;break;case SR:t=tt.DstAlpha;break;case MR:t=tt.OneMinusDstAlpha;break;case wR:t=tt.SrcAlphaSaturated;break;case Y4:t=tt.Constant;break;case Z4:t=tt.OneMinusConstant;break;default:he("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const s=e.stencilFunc;switch(s){case xL:t=Es.Never;break;case u_:t=Es.Always;break;case bL:t=Es.Less;break;case TL:t=Es.LessEqual;break;case _L:t=Es.Equal;break;case ML:t=Es.GreaterEqual;break;case vL:t=Es.Greater;break;case SL:t=Es.NotEqual;break;default:he("WebGPURenderer: Invalid stencil function.",s)}return t}_getStencilOperation(e){let t;switch(e){case al:t=Ja.Keep;break;case hL:t=Ja.Zero;break;case dL:t=Ja.Replace;break;case yL:t=Ja.Invert;break;case fL:t=Ja.IncrementClamp;break;case pL:t=Ja.DecrementClamp;break;case mL:t=Ja.IncrementWrap;break;case gL:t=Ja.DecrementWrap;break;default:he("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case yn:t=sl.Add;break;case xR:t=sl.Subtract;break;case bR:t=sl.ReverseSubtract;break;case JF:t=sl.Min;break;case eL:t=sl.Max;break;default:he("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,s){const i={},r=this.backend.utils;
631i.topology=r.getPrimitiveTopology(e,s),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(i.stripIndexFormat=t.index.array instanceof Uint16Array?Dg.Uint16:Dg.Uint32);let l=s.side===Ts;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(l=!l),i.frontFace=l===!0?Yw.CW:Yw.CCW,i.cullMode=s.side===la?Zw.None:Zw.Back,i}_getColorWriteMask(e){return e.colorWrite===!0?Qw.All:Qw.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Es.Always;else{const s=this.backend.parameters.reversedDepthBuffer?zR[e.depthFunc]:e.depthFunc;switch(s){case wm:t=Es.Never;break;case Rm:t=Es.Always;break;case Em:t=Es.Less;break;case hc:t=Es.LessEqual;break;case Cm:t=Es.Equal;break;case Bm:t=Es.GreaterEqual;break;case Dm:t=Es.Greater;break;case Um:t=Es.NotEqual;break;default:he("WebGPUPipelineUtils: Invalid depth function.",s)}}return t}}class J3{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}}const rr=new Uc,aH=new Hd,Kh=new J3;class oH extends $3{constructor(e,t,s=2048){super(s),this.device=e,this.type=t,Kh.label=`queryset_global_timestamp_${t}`,Kh.type="timestamp",Kh.count=this.maxQueries,this.querySet=this.device.createQuerySet(Kh),Kh.reset();const i=this.maxQueries*8;rr.label=`buffer_timestamp_resolve_${t}`,rr.size=i,rr.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(rr),rr.reset(),rr.label=`buffer_timestamp_result_${t}`,rr.size=i,rr.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(rr),rr.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Ye(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,s=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();const i=this.device.createCommandEncoder(aH);i.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),i.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,s);const r=i.finish();if(ur(this.device,r),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,s),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;const l=new BigUint64Array(this.resultBuffer.getMappedRange(0,s)),u={},h=[];for(const[p,m]of e){const y=p.match(/^(.*):f(\d+)$/),b=parseInt(y[2]);h.includes(b)===!1&&h.push(b),u[b]===void 0&&(u[b]=0);const _=l[m],v=l[m+1],M=Number(v-_)/1e6;this.timestamps.set(p,M),u[b]+=M}const d=u[h[h.length-1]];return this.resultBuffer.unmap(),this.lastValue=d,this.frames=h,d}catch(e){return he("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){he("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){he("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}class lH{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}}class dm{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}}class uH{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}}
631const On={r:0,g:0,b:0,a:1},zi=new Uc,Ks=new Hd,fm=new lH,Jh=new J3,pm=new Y3,mm=new uH,hn=new My,ar=new My,Ot=new Zv,Jr=new Z3;class cH extends q3{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new E9(this),this.attributeUtils=new J9(this),this.bindingUtils=new tH(this),this.capabilities=new sH(this),this.pipelineUtils=new rH(this),this.textureUtils=new G9(this),this.occludedResolveCache=new Map;const t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Al.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);const t=this.parameters;let s;if(t.device===void 0){const i={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},r=typeof navigator<"u"?await navigator.gpu.requestAdapter(i):null;if(r===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");const l=Object.values(Ug),u=[];for(const d of l)r.features.has(d)&&u.push(d);const h={requiredFeatures:u,requiredLimits:t.requiredLimits};s=await r.requestDevice(h)}else s=t.device;this.compatibilityMode=!s.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),s.lost.then(i=>{if(i.reason==="destroyed")return;const r={api:"WebGPU",message:i.message||"Unknown reason",reason:i.reason||null,originalEvent:i};e.onDeviceLost(r)}),s.onuncapturederror=i=>{const r=i.error,l=r&&r.constructor?r.constructor.name:"GPUError",u=r&&r.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:l,message:u,originalEvent:i})},this.device=s,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(Ug.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,s=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:s,initialized:!0})}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let s=t.context;if(s===void 0){const i=this.parameters;e.isDefaultCanvasTarget===!0&&i.context!==void 0?s=i.context:s=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${Ed} webgpu`);const r=i.alpha?"premultiplied":"opaque",l=i.outputType===Jt?"extended":"standard";s.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:r,toneMapping:{mode:l}}),t.context=s}return s}get coordinateSystem(){return An}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,s=0,i=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,s,i)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),s=this.get(t),i=e.currentSamples;let r=s.descriptor;if(r===void 0||s.samples!==i){if(r=new _d,r.colorAttachments.push(new bd),e.depth===!0||e.stencil===!0){const h=new dm;h.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),r.depthStencilAttachment=h}const u=r.colorAttachments[0];i>0?u.view=this.textureUtils.getColorBuffer().createView():u.resolveTarget=void 0,s.descriptor=r,s.samples=i}const l=r.colorAttachments[0];return i>0?l.resolveTarget=this.context.getCurrentTexture().createView():l.view=this.context.getCurrentTexture().createView(),r}_isRenderCameraDepthArray(e){const t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){const t=e.textures;if(t===null)return!1;for(let s=0;s<t.length;s++)if(this.get(t[s]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){const s=[],i=e.camera;if(t.xrViewDescriptors&&i!==null&&i.isArrayCamera===!0)for(let r=0;r<t.xrViewDescriptors.length;r++)s.push({view:t.texture.createView(t.xrViewDescriptors[r]),resolveTarget:void 0,depthSlice:void 0});else s.push({view:t.texture.createView({dimension:Cs.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return s}_getRenderPassDescriptor(e,t={}){const s=e.renderTarget,i=this.get(s),r=this._hasExternalTexture(e);let l=i.descriptors;(l===void 0||i.width!==s.width||i.height!==s.height||i.samples!==s.samples||r)&&(l={},i.descriptors=l);const u=e.getCacheKey();let h=l[u];if(h===void 0||r){const p=e.textures,m=[];let y;const b=this._isRenderCameraDepthArray(e);for(let v=0;v<p.length;v++){const M=this.get(p[v]);if(M.externalTexture===!0){m.push(...this._createExternalTextureViews(e,M));continue}if(Ot.label=`colorAttachment_${v}`,Ot.baseMipLevel=e.activeMipmapLevel,Ot.mipLevelCount=1,Ot.baseArrayLayer=e.activeCubeFace,Ot.arrayLayerCount=1,Ot.dimension=Cs.TwoD,s.isRenderTarget3D)y=e.activeCubeFace,Ot.baseArrayLayer=0,Ot.dimension=Cs.ThreeD;else if(s.isRenderTarget&&p[v].image.depth>1)if(b===!0){const A=e.camera.cameras;for(let C=0;C<A.length;C++){Ot.baseArrayLayer=C,Ot.arrayLayerCount=1,Ot.dimension=Cs.TwoD;const E=M.texture.createView(Ot);m.push({view:E,resolveTarget:void 0,depthSlice:void 0})}}else Ot.dimension=Cs.TwoDArray;if(b!==!0){const A=M.texture.createView(Ot);let C,E;M.msaaTexture!==void 0?(C=M.msaaTexture.createView(),E=A):(C=A,E=void 0),m.push({view:C,resolveTarget:E,depthSlice:y})}Ot.reset()}const _=[];for(let v=0;v<m.length;v++){const M=m[v],A=new bd;A.view=M.view,A.depthSlice=M.depthSlice,A.resolveTarget=M.resolveTarget,_.push(A)}if(h={textureViews:m,colorAttachments:_,descriptor:new _d},e.depth){const v=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Ot.dimension=Cs.TwoD,Ot.arrayLayerCount=1,Ot.baseArrayLayer=e.activeCubeFace);const M=new dm;M.view=v.texture.createView(Ot),h.depthStencilAttachment=M,Ot.reset()}l[u]=h,i.width=s.width,i.height=s.height,i.samples=s.samples,i.activeMipmapLevel=e.activeMipmapLevel,i.activeCubeFace=e.activeCubeFace}const d=h.descriptor;d.reset();for(let p=0;p<h.colorAttachments.length;p++){const m=h.colorAttachments[p];let y={r:0,g:0,b:0,a:1};p===0&&t.clearValue&&(y=t.clearValue),m.loadOp=t.loadOp||mt.Load,m.storeOp=t.storeOp||Js.Store,m.clearValue=y,d.colorAttachments.push(m)}return h.depthStencilAttachment&&(d.depthStencilAttachment=h.depthStencilAttachment),d}beginRender(e){const t=this.get(e),s=this.device,i=e.occlusionQueryCount;let r;i>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,Jh.label=`occlusionQuerySet_${e.id}`,Jh.type="occlusion",Jh.count=i,r=s.createQuerySet(Jh),Jh.reset(),t.occlusionQuerySet=r,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(i),t.lastOcclusionObject=null);let l;e.textures===null?l=this._getDefaultRenderPassDescriptor():l=this._getRenderPassDescriptor(e,{loadOp:mt.Load}),this.initTimestampQuery(hr.RENDER,this.getTimestampUID(e),l),l.occlusionQuerySet=r;const u=l.depthStencilAttachment;if(e.textures!==null){const d=l.colorAttachments;for(let p=0;p<d.length;p++){const m=d[p];e.clearColor?(p===0?m.clearValue=e.clearColorValue:(On.r=0,On.g=0,On.b=0,On.a=1,m.clearValue=On),m.loadOp=mt.Clear):m.loadOp=mt.Load,m.storeOp=Js.Store}}else{const d=l.colorAttachments[0];e.clearColor?(d.clearValue=e.clearColorValue,d.loadOp=mt.Clear):d.loadOp=mt.Load,d.storeOp=Js.Store}e.depth&&(e.clearDepth?(u.depthClearValue=e.clearDepthValue,u.depthLoadOp=mt.Clear):u.depthLoadOp=mt.Load,u.depthStoreOp=Js.Store),e.stencil&&(e.clearStencil?(u.stencilClearValue=e.clearStencilValue,u.stencilLoadOp=mt.Clear):u.stencilLoadOp=mt.Load,u.stencilStoreOp=Js.Store),Ks.label="renderContext_"+e.id;const h=s.createCommandEncoder(Ks);if(Ks.reset(),this._isRenderCameraDepthArray(e)===!0){const d=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==d.length?this._createArrayCameraLayerDescriptors(e,t,l,d):this._updateArrayCameraLayerDescriptors(e,t,d),t.bundleEncoders=[],t.bundleSets=[];for(let p=0;p<d.length;p++){const m=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+p),y={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(m),t.bundleSets.push(y)}t.currentPass=null}else{const d=h.beginRenderPass(l);t.currentPass=d,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}
631t.descriptor=l,t.encoder=h,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,s,i){const r=s.depthStencilAttachment;t.layerDescriptors=[];const l=this.get(e.depthTexture);l.viewCache||(l.viewCache=[]);for(let u=0;u<i.length;u++){const h=s.colorAttachments[0],d=new bd;d.view=s.colorAttachments[u].view,d.depthSlice=h.depthSlice,d.resolveTarget=h.resolveTarget,d.loadOp=h.loadOp,d.storeOp=h.storeOp,d.clearValue=h.clearValue;const p=new _d;if(p.label=s.label,p.occlusionQuerySet=s.occlusionQuerySet,p.timestampWrites=s.timestampWrites,p.colorAttachments.push(d),s.depthStencilAttachment){const m=u;l.viewCache[m]||(Ot.dimension=Cs.TwoD,Ot.baseArrayLayer=u,Ot.arrayLayerCount=1,l.viewCache[m]=l.texture.createView(Ot),Ot.reset());const y=new dm;y.view=l.viewCache[m],y.depthLoadOp=r.depthLoadOp||mt.Clear,y.depthStoreOp=r.depthStoreOp||Js.Store,y.depthClearValue=r.depthClearValue||1,e.stencil&&(y.stencilLoadOp=r.stencilLoadOp,y.stencilStoreOp=r.stencilStoreOp,y.stencilClearValue=r.stencilClearValue),p.depthStencilAttachment=y}else{const m=new dm;m.view=r.view,m.depthLoadOp=r.depthLoadOp,m.depthStoreOp=r.depthStoreOp,m.depthClearValue=r.depthClearValue,m.depthReadOnly=r.depthReadOnly,m.stencilLoadOp=r.stencilLoadOp,m.stencilStoreOp=r.stencilStoreOp,m.stencilClearValue=r.stencilClearValue,m.stencilReadOnly=r.stencilReadOnly,p.depthStencilAttachment=m}t.layerDescriptors.push(p)}}_updateArrayCameraLayerDescriptors(e,t,s){for(let i=0;i<s.length;i++){const r=t.layerDescriptors[i];if(r.depthStencilAttachment){const l=r.depthStencilAttachment;e.depth&&(e.clearDepth?(l.depthClearValue=e.clearDepthValue,l.depthLoadOp=mt.Clear):l.depthLoadOp=mt.Load),e.stencil&&(e.clearStencil?(l.stencilClearValue=e.clearStencilValue,l.stencilLoadOp=mt.Clear):l.stencilLoadOp=mt.Load)}}}finishRender(e){const t=this.get(e),s=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),s>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const i=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){const r=[];for(let l=0;l<t.bundleEncoders.length;l++){const u=t.bundleEncoders[l];r.push(u.finish())}for(let l=0;l<t.layerDescriptors.length;l++)if(l<r.length){const u=t.layerDescriptors[l],h=i.beginRenderPass(u);if(e.viewport){const{x:d,y:p,width:m,height:y,minDepth:b,maxDepth:_}=e.viewportValue;h.setViewport(d,p,m,y,b,_)}if(e.scissor){const{x:d,y:p,width:m,height:y}=e.scissorValue;h.setScissorRect(d,p,m,y)}h.executeBundles([r[l]]),h.end()}}else t.currentPass&&t.currentPass.end();if(s>0){const r=s*8;let l=this.occludedResolveCache.get(r);l===void 0&&(zi.size=r,zi.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,l=this.device.createBuffer(zi),zi.reset(),this.occludedResolveCache.set(r,l)),zi.size=r,zi.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;const u=this.device.createBuffer(zi);zi.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,s,l,0),t.encoder.copyBufferToBuffer(l,0,u,0,r),t.occlusionQueryBuffer=u,this.resolveOccludedAsync(e)}if(ur(this.device,t.encoder.finish()),e.textures!==null){const r=e.textures;for(let l=0;l<r.length;l++){const u=r[l];u.generateMipmaps===!0&&this.textureUtils.generateMipmaps(u)}}}isOccluded(e,t){const s=this.get(e);return s.occluded&&s.occluded.has(t)}async resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueryBuffer:s,currentOcclusionQueryObjects:i}=t;if(s&&i){const r=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await s.mapAsync(GPUMapMode.READ);const l=s.getMappedRange(),u=new BigUint64Array(l);for(let h=0;h<i.length;h++)u[h]===BigInt(0)&&r.add(i[h]);s.destroy(),t.occluded=r}}updateViewport(e){const{currentPass:t}=this.get(e),{x:s,y:i,width:r,height:l,minDepth:u,maxDepth:h}=e.viewportValue;t.setViewport(s,i,r,l,u,h)}updateScissor(e){const{currentPass:t}=this.get(e),{x:s,y:i,width:r,height:l}=e.scissorValue;t.setScissorRect(s,i,r,l)}getClearColor(){const e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,s,i=null){const r=this.device,l=this.renderer;let u=[],h,d,p;
631if(e){const b=this.getClearColor();On.r=b.r,On.g=b.g,On.b=b.b,On.a=b.a}if(i===null){d=l.depth,p=l.stencil;const b=this._getDefaultRenderPassDescriptor();if(e){u=b.colorAttachments;const _=u[0];_.clearValue=On,_.loadOp=mt.Clear,_.storeOp=Js.Store}(d||p)&&(h=b.depthStencilAttachment)}else{d=i.depth,p=i.stencil;const b={loadOp:e?mt.Clear:mt.Load,clearValue:e?On:void 0};d&&(b.depthLoadOp=t?mt.Clear:mt.Load,b.depthClearValue=t?l.getClearDepth():void 0,b.depthStoreOp=Js.Store),p&&(b.stencilLoadOp=s?mt.Clear:mt.Load,b.stencilClearValue=s?l.getClearStencil():void 0,b.stencilStoreOp=Js.Store);const _=this._getRenderPassDescriptor(i,b);u=_.colorAttachments,h=_.depthStencilAttachment}d&&h&&(t?(h.depthLoadOp=mt.Clear,h.depthClearValue=l.getClearDepth(),h.depthStoreOp=Js.Store):(h.depthLoadOp=mt.Load,h.depthStoreOp=Js.Store)),p&&h&&(s?(h.stencilLoadOp=mt.Clear,h.stencilClearValue=l.getClearStencil(),h.stencilStoreOp=Js.Store):(h.stencilLoadOp=mt.Load,h.stencilStoreOp=Js.Store)),Ks.label="clear";const m=r.createCommandEncoder(Ks);Ks.reset(),m.beginRenderPass({colorAttachments:u,depthStencilAttachment:h}).end(),ur(r,m.finish())}beginCompute(e){const t=this.get(e),s="computeGroup_"+e.id;fm.label=s,Ks.label=s,this.initTimestampQuery(hr.COMPUTE,this.getTimestampUID(e),fm),t.cmdEncoderGPU=this.device.createCommandEncoder(Ks),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(fm),t.currentPipeline=null,Ks.reset(),fm.reset()}compute(e,t,s,i,r=null){const l=this.get(t),u=this.get(e),{passEncoderGPU:h}=u,d=this.get(i).pipeline;u.currentPipeline!==d&&(h.setPipeline(d),u.currentPipeline=d);for(let p=0,m=s.length;p<m;p++){const y=s[p],b=this.get(y);h.setBindGroup(p,b.group)}if(r===null&&(r=t.dispatchSize||t.count),r&&r.isIndirectStorageBufferAttribute){const p=this.get(r).buffer;h.dispatchWorkgroupsIndirect(p,0);return}if(typeof r=="number"){const p=r;if(l.dispatchSize===void 0||l.count!==p){l.dispatchSize=[0,1,1],l.count=p;const m=t.workgroupSize;let y=m[0];for(let v=1;v<m.length;v++)y*=m[v];const b=Math.ceil(p/y),_=this.device.limits.maxComputeWorkgroupsPerDimension;r=[b,1,1],b>_&&(r[0]=Math.min(b,_),r[1]=Math.ceil(b/_)),l.dispatchSize=r}r=l.dispatchSize}h.dispatchWorkgroups(r[0],r[1]||1,r[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),ur(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,s,i,r,l,u,h,d){const{object:p,material:m,context:y}=e,b=e.getIndex(),_=b!==null;d.pipeline!==i&&(h.setPipeline(i),d.pipeline=i);const v=d.bindingGroups;for(let M=0,A=r.length;M<A;M++){const C=r[M];if(v[M]!==C.id){const E=this.get(C);h.setBindGroup(M,E.group),v[M]=C.id}}if(_===!0&&d.index!==b){const M=this.get(b).buffer,A=b.array instanceof Uint16Array?Dg.Uint16:Dg.Uint32;h.setIndexBuffer(M,A),d.index=b}for(let M=0,A=l.length;M<A;M++){const C=l[M];if(d.attributes[M]!==C){const E=this.get(C).buffer;h.setVertexBuffer(M,E),d.attributes[M]=C}}if(y.stencil===!0&&m.stencilWrite===!0&&s.currentStencilRef!==m.stencilRef&&(h.setStencilReference(m.stencilRef),s.currentStencilRef=m.stencilRef),p.isBatchedMesh===!0){const M=p._multiDrawStarts,A=p._multiDrawCounts,C=p._multiDrawCount;let E=_===!0?b.array.BYTES_PER_ELEMENT:1;m.wireframe&&(E=p.geometry.attributes.position.count>65535?4:2);for(let F=0;F<C;F++)_===!0?h.drawIndexed(A[F],1,M[F]/E,0,F):h.draw(A[F],1,M[F],F),t.update(p,A[F],1)}else if(_===!0){const{vertexCount:M,instanceCount:A,firstVertex:C}=u,E=e.getIndirect();if(E!==null){const F=this.get(E).buffer,L=e.getIndirectOffset(),U=Array.isArray(L)?L:[L];for(let R=0;R<U.length;R++)h.drawIndexedIndirect(F,U[R])}else h.drawIndexed(M,A,C,0,0);t.update(p,M,A)}else{const{vertexCount:M,instanceCount:A,firstVertex:C}=u,E=e.getIndirect();if(E!==null){const F=this.get(E).buffer,L=e.getIndirectOffset(),U=Array.isArray(L)?L:[L];for(let R=0;R<U.length;R++)h.drawIndirect(F,U[R])}else h.draw(M,A,C,0);t.update(p,M,A)}}draw(e,t){const{object:s,context:i,pipeline:r}=e,l=this.get(i),u=this.get(r),h=u.pipeline;if(u.error===!0)return;const d=e.getDrawParameters();if(d===null)return;const p=e.getBindings(),m=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){const y=this.get(e.camera),b=e.camera.cameras,_=e.getBindingGroup("cameraIndex");if(y.indexesGPU===void 0||y.indexesGPU.length!==b.length){const M=this.get(_),A=[],C=new Uint32Array([0,0,0,0]);for(let E=0,F=b.length;E<F;E++){C[0]=E;const{layoutGPU:L}=M.layout,U=this.bindingUtils.createBindGroupIndex(C,L);A.push(U)}y.indexesGPU=A}const v=this.renderer.getPixelRatio();for(let M=0,A=b.length;M<A;M++){const C=b[M];if(s.layers.test(C.layers)){const E=C.viewport;let F=l.currentPass,L=l.currentSets;const U=l.bundleEncoders!==void 0;if(U){const R=l.bundleEncoders[M],V=l.bundleSets[M];F=R,L=V}if(E&&!U&&F.setViewport(Math.floor(E.x*v),Math.floor(E.y*v),Math.floor(E.width*v),Math.floor(E.height*v),i.viewportValue.minDepth,i.viewportValue.maxDepth),_&&y.indexesGPU){const R=p.indexOf(_);F.setBindGroup(R,y.indexesGPU[M]),L.bindingGroups[R]=_.id}this._draw(e,t,l,h,p,m,d,F,L)}}}else if(l.currentPass){if(l.occlusionQuerySet!==void 0){const y=l.lastOcclusionObject;y!==s&&(y!==null&&y.occlusionTest===!0&&(l.currentPass.endOcclusionQuery(),l.occlusionQueryIndex++),s.occlusionTest===!0&&(l.currentPass.beginOcclusionQuery(l.occlusionQueryIndex),l.occlusionQueryObjects[l.occlusionQueryIndex]=s),l.lastOcclusionObject=s)}this._draw(e,t,l,h,p,m,d,l.currentPass,l.currentSets)}}
631needsRenderUpdate(e){const t=this.get(e),{object:s,material:i}=e,r=this.utils,l=r.getSampleCountRenderContext(e.context),u=r.getCurrentColorSpace(e.context),h=r.getCurrentColorFormat(e.context),d=r.getCurrentDepthStencilFormat(e.context),p=r.getPrimitiveTopology(s,i),m=s.isMesh&&s.matrixWorld.determinantAffine()<0;let y=!1;return(t.material!==i||t.materialVersion!==i.version||t.transparent!==i.transparent||t.blending!==i.blending||t.premultipliedAlpha!==i.premultipliedAlpha||t.blendSrc!==i.blendSrc||t.blendDst!==i.blendDst||t.blendEquation!==i.blendEquation||t.blendSrcAlpha!==i.blendSrcAlpha||t.blendDstAlpha!==i.blendDstAlpha||t.blendEquationAlpha!==i.blendEquationAlpha||t.colorWrite!==i.colorWrite||t.depthWrite!==i.depthWrite||t.depthTest!==i.depthTest||t.depthFunc!==i.depthFunc||t.stencilWrite!==i.stencilWrite||t.stencilFunc!==i.stencilFunc||t.stencilFail!==i.stencilFail||t.stencilZFail!==i.stencilZFail||t.stencilZPass!==i.stencilZPass||t.stencilFuncMask!==i.stencilFuncMask||t.stencilWriteMask!==i.stencilWriteMask||t.side!==i.side||t.alphaToCoverage!==i.alphaToCoverage||t.sampleCount!==l||t.colorSpace!==u||t.colorFormat!==h||t.depthStencilFormat!==d||t.primitiveTopology!==p||t.frontFaceCW!==m||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=i,t.materialVersion=i.version,t.transparent=i.transparent,t.blending=i.blending,t.premultipliedAlpha=i.premultipliedAlpha,t.blendSrc=i.blendSrc,t.blendDst=i.blendDst,t.blendEquation=i.blendEquation,t.blendSrcAlpha=i.blendSrcAlpha,t.blendDstAlpha=i.blendDstAlpha,t.blendEquationAlpha=i.blendEquationAlpha,t.colorWrite=i.colorWrite,t.depthWrite=i.depthWrite,t.depthTest=i.depthTest,t.depthFunc=i.depthFunc,t.stencilWrite=i.stencilWrite,t.stencilFunc=i.stencilFunc,t.stencilFail=i.stencilFail,t.stencilZFail=i.stencilZFail,t.stencilZPass=i.stencilZPass,t.stencilFuncMask=i.stencilFuncMask,t.stencilWriteMask=i.stencilWriteMask,t.side=i.side,t.alphaToCoverage=i.alphaToCoverage,t.sampleCount=l,t.colorSpace=u,t.colorFormat=h,t.depthStencilFormat=d,t.primitiveTopology=p,t.frontFaceCW=m,t.clippingContextCacheKey=e.clippingContextCacheKey,y=!0),y}getRenderCacheKey(e){const{object:t,material:s}=e,i=this.utils,r=e.context,l=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[s.transparent,s.blending,s.premultipliedAlpha,s.blendSrc,s.blendDst,s.blendEquation,s.blendSrcAlpha,s.blendDstAlpha,s.blendEquationAlpha,s.colorWrite,s.depthWrite,s.depthTest,s.depthFunc,s.stencilWrite,s.stencilFunc,s.stencilFail,s.stencilZFail,s.stencilZPass,s.stencilFuncMask,s.stencilWriteMask,s.side,l,i.getSampleCountRenderContext(r),i.getCurrentColorSpace(r),i.getCurrentColorFormat(r),i.getCurrentDepthStencilFormat(r),i.getPrimitiveTopology(t,s),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,s,i,r,l){return this.textureUtils.copyTextureToBuffer(e,t,s,i,r,l)}initTimestampQuery(e,t,s){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new oH(this.device,e,2048));const i=this.timestampQueryPool[e],r=i.allocateQueriesForContext(t);mm.querySet=i.querySet,mm.beginningOfPassWriteIndex=r,mm.endOfPassWriteIndex=r+1,s.timestampWrites=mm}createNodeBuilder(e,t){return new Z9(e,t)}createProgram(e){const t=this.get(e);pm.label=e.stage+(e.name!==""?`_${e.name}`:""),pm.code=e.code,t.module={module:this.device.createShaderModule(pm),entryPoint:"main"},pm.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){const t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){const s=this.get(e),r=s.currentPass.finish();this.get(t).bundleGPU=r,s.currentSets=s._currentSets,s.currentPass=s._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){const t=this.get(e);if(t.buffer===void 0){const s=e.byteLength,i=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,r=[];e.visibility&br.VERTEX&&r.push("vertex"),e.visibility&br.FRAGMENT&&r.push("fragment"),e.visibility&br.COMPUTE&&r.push("compute");const l=`(${r.join(",")})`;zi.label=`bindingBuffer${e.id}_${e.name}_${l}`,zi.size=s,zi.usage=i;const u=this.device.createBuffer(zi);zi.reset(),t.buffer=u}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,s,i){this.bindingUtils.createBindings(e,t,s,i)}updateBindings(e,t,s,i){this.bindingUtils.createBindings(e,t,s,i)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return eR[e]!==void 0&&(e=eR[e]),this.device.features.has(e)}copyTextureToTexture(e,t,s=null,i=null,r=0,l=0){let u=0,h=0,d=0,p=0,m=0,y=0,b=e.image.width,_=e.image.height,v=1;s!==null&&(s.isBox3===!0?(p=s.min.x,m=s.min.y,y=s.min.z,b=s.max.x-s.min.x,_=s.max.y-s.min.y,v=s.max.z-s.min.z):(p=s.min.x,m=s.min.y,b=s.max.x-s.min.x,_=s.max.y-s.min.y,v=1)),i!==null&&(u=i.x,h=i.y,d=i.z||0),Ks.label="copyTextureToTexture_"+e.id+"_"+t.id;const M=this.device.createCommandEncoder(Ks);Ks.reset();const A=this.get(e).texture,C=this.get(t).texture;hn.texture=A,hn.mipLevel=r,hn.origin.x=p,hn.origin.y=m,hn.origin.z=y,ar.texture=C,ar.mipLevel=l,ar.origin.x=u,ar.origin.y=h,ar.origin.z=d,Jr.width=b,Jr.height=_,Jr.depthOrArrayLayers=v,M.copyTextureToTexture(hn,ar,Jr),hn.reset(),ar.reset(),Jr.reset(),ur(this.device,M.finish()),l===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,s){const i=this.get(t);let r=null;t.renderTarget?e.isDepthTexture?r=this.get(t.depthTexture).texture:r=this.get(t.textures[0]).texture:e.isDepthTexture?r=this.textureUtils.getDepthBuffer(t.depth,t.stencil):r=this.context.getCurrentTexture();const l=this.get(e).texture;if(r.format!==l.format){he("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",r.format,l.format);return}let u;if(i.currentPass?(i.currentPass.end(),u=i.encoder):(Ks.label="copyFramebufferToTexture_"+e.id,u=this.device.createCommandEncoder(Ks),Ks.reset()),hn.texture=r,hn.origin.x=s.x,hn.origin.y=s.y,ar.texture=l,Jr.width=s.z,Jr.he
631ight=s.w,u.copyTextureToTexture(hn,ar,Jr),hn.reset(),ar.reset(),Jr.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,u),i.currentPass){const{descriptor:h}=i;for(let d=0;d<h.colorAttachments.length;d++)h.colorAttachments[d].loadOp=mt.Load;t.depth&&(h.depthStencilAttachment.depthLoadOp=mt.Load),t.stencil&&(h.depthStencilAttachment.stencilLoadOp=mt.Load),i.currentPass=u.beginRenderPass(h),i.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else ur(this.device,u.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(const e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(const e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}}class hH extends rT{constructor(e,t,s,i,r,l){super(e,t,s,i,r,l),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class dH extends rT{constructor(e,t,s,i,r,l){super(e,t,s,i,r,l),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}}class fH extends L3{constructor(){super(),this.addMaterial(PV,"MeshPhongMaterial"),this.addMaterial(bB,"MeshStandardMaterial"),this.addMaterial(R4,"MeshPhysicalMaterial"),this.addMaterial(D4,"MeshToonMaterial"),this.addMaterial(w_,"MeshBasicMaterial"),this.addMaterial(OV,"MeshLambertMaterial"),this.addMaterial(wV,"MeshNormalMaterial"),this.addMaterial(F4,"MeshMatcapMaterial"),this.addMaterial(vV,"LineBasicMaterial"),this.addMaterial(MV,"LineDashedMaterial"),this.addMaterial(V4,"PointsMaterial"),this.addMaterial(TB,"SpriteMaterial"),this.addMaterial(H4,"ShadowMaterial"),this.addLight(bk,NO),this.addLight(B8,RO),this.addLight(z8,CO),this.addLight(Xv,rT),this.addLight(C8,EO),this.addLight(D8,SO),this.addLight(F8,DO),this.addLight(U8,hH),this.addLight(O8,dH),this.addToneMapping($B,iL),this.addToneMapping(WB,nL),this.addToneMapping(XB,rL),this.addToneMapping(jB,RR),this.addToneMapping(YB,aL),this.addToneMapping(ZB,oL)}}class pH extends n9{constructor(e={}){let t;e.forceWebGL?t=jw:(t=cH,e.getFallback=()=>(me("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new jw(e)));const s=new t(e);super(s,e),this.library=new fH,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class mH{constructor(e,t=Te(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;const s=new Bt;s.name="RenderPipeline",this._quadMesh=new Vd(s),this._quadMesh.name="Render Pipeline",this._context=null,this._toneMapping=e.toneMapping,this._outputColorSpace=e.outputColorSpace}render(){const e=this.renderer;this._update(),this._context.onBeforeRenderPipeline!==null&&this._context.onBeforeRenderPipeline();const t=e.toneMapping,s=e.outputColorSpace;e.toneMapping=fo,e.outputColorSpace=lt.workingColorSpace;const i=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=i,e.toneMapping=t,e.outputColorSpace=s,this._context.onAfterRenderPipeline!==null&&this._context.onAfterRenderPipeline()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(this._toneMapping!==this.renderer.toneMapping&&(this._toneMapping=this.renderer.toneMapping,this.needsUpdate=!0),this._outputColorSpace!==this.renderer.outputColorSpace&&(this._outputColorSpace=this.renderer.outputColorSpace,this.needsUpdate=!0),this.needsUpdate===!0){const e=this._toneMapping,t=this._outputColorSpace,s={renderPipeline:this,onBeforeRenderPipeline:null,onAfterRenderPipeline:null};let i=this.outputNode;this.outputColorTransform===!0?(i=i.context(s),i=ry(i,e,t)):(s.toneMapping=e,s.outputColorSpace=t,i=i.context(s)),this._context=s,this._quadMesh.material.fragmentNode=i,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){Ye('RenderPipeline: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.renderer.init(),this.render()}}class gH extends mH{constructor(e,t){Ye('PostProcessing: "PostProcessing" has been renamed to "RenderPipeline". Please update your co
631de to use "THREE.RenderPipeline" instead.'),super(e,t)}}/** 632 * @license 633 * Copyright 2010-2026 Three.js Authors 634 * SPDX-License-Identifier: MIT 635 */const yH=new js;yH.set(-1,0,0,0,1,0,0,0,1);const xH=new js;xH.set(-1,0,0,0,1,0,0,0,1);const aR={type:"change"},Qv={type:"start"},eD={type:"end"},gm=new HR,oR=new ta,bH=Math.cos(70*Q_.DEG2RAD),ds=new H,pi=2*Math.PI,Nt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},e_=1e-6;class _H extends OO{constructor(e,t=null){super(e,t),this.state=Nt.NONE,this.target=new H,this.cursor=new H,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.keyRotateSpeed=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:sc.ROTATE,MIDDLE:sc.DOLLY,RIGHT:sc.PAN},this.touches={ONE:Qu.ROTATE,TWO:Qu.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new H,this._lastQuaternion=new ma,this._lastTargetPosition=new H,this._quat=new ma().setFromUnitVectors(e.up,new H(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new RN,this._sphericalDelta=new RN,this._scale=1,this._panOffset=new H,this._rotateStart=new Fe,this._rotateEnd=new Fe,this._rotateDelta=new Fe,this._panStart=new Fe,this._panEnd=new Fe,this._panDelta=new Fe,this._dollyStart=new Fe,this._dollyEnd=new Fe,this._dollyDelta=new Fe,this._dollyDirection=new H,this._mouse=new Fe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=vH.bind(this),this._onPointerDown=TH.bind(this),this._onPointerUp=SH.bind(this),this._onContextMenu=CH.bind(this),this._onMouseWheel=NH.bind(this),this._onKeyDown=wH.bind(this),this._onTouchStart=RH.bind(this),this._onTouchMove=EH.bind(this),this._onMouseDown=MH.bind(this),this._onMouseMove=AH.bind(this),this._interceptControlDown=BH.bind(this),this._interceptControlUp=DH.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(aR),this.update(),this.state=Nt.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;ds.copy(t).sub(this.target),ds.applyQuaternion(this._quat),this._spherical.setFromVector3(ds),this.autoRotate&&this.state===Nt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let s=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(s)&&isFinite(i)&&(s<-Math.PI?s+=pi:s>
vendor: 20,597 bytes, lines 635-639
635Math.PI&&(s-=pi),i<-Math.PI?i+=pi:i>Math.PI&&(i-=pi),s<=i?this._spherical.theta=Math.max(s,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+i)/2?Math.max(s,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const l=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=l!=this._spherical.radius}if(ds.setFromSpherical(this._spherical),ds.applyQuaternion(this._quatInverse),t.copy(this.target).add(ds),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let l=null;if(this.object.isPerspectiveCamera){const u=ds.length();l=this._clampDistance(u*this._scale);const h=u-l;this.object.position.addScaledVector(this._dollyDirection,h),this.object.updateMatrixWorld(),r=!!h}else if(this.object.isOrthographicCamera){const u=new H(this._mouse.x,this._mouse.y,0);u.unproject(this.object);const h=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=h!==this.object.zoom;const d=new H(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(u),this.object.updateMatrixWorld(),l=ds.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;l!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(l).add(this.object.position):(gm.origin.copy(this.object.position),gm.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(gm.direction))<bH?this.object.lookAt(this.target):(oR.setFromNormalAndCoplanarPoint(this.object.up,this.target),gm.intersectPlane(oR,this.target))))}else if(this.object.isOrthographicCamera){const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),l!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>e_||8*(1-this._lastQuaternion.dot(this.object.quaternion))>e_||this._lastTargetPosition.distanceToSquared(this.target)>e_?(this.dispatchEvent(aR),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?pi/60*this.autoRotateSpeed*e:pi/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ds.setFromMatrixColumn(t,0),ds.multiplyScalar(-e),this._panOffset.add(ds)}_panUp(e,t){this.screenSpacePanning===!0?ds.setFromMatrixColumn(t,1):(ds.setFromMatrixColumn(t,0),ds.crossVectors(this.object.up,ds)),ds.multiplyScalar(e),this._panOffset.add(ds)}_pan(e,t){const s=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;ds.copy(i).sub(this.target);let r=ds.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/s.clientHeight,this.object.matrix),this._panUp(2*t*r/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/s.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const s=this.domElement.getBoundingClientRect(),i=e-s.left,r=t-s.top,l=s.width,u=s.height;this._mouse.x=i/l*2-1,this._mouse.y=-(r/u)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(pi*this._rotateDelta.x/t.clientHeight),this._rotateUp(pi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(pi*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-pi*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(pi*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-pi*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(s,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(s,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(s*s+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const s=this._getSecondPointerPosition(e),i=.5*(e.pageX+s.x),r=.5*(e.pageY+s.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(pi*this._rotateDelta.x/t.clientHeight),this._rotateUp(pi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(s,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(s*s+i*i);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const l=(e.pageX+t.x)*.5,u=(e.pageY+t.y)*.5;this._updateZoomParameters(l,u)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Fe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,s={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function TH(o){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(o.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(o)&&(this._addPointer(o),o.pointerType==="touch"?this._onTouchStart(o):this._onMouseDown(o),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function vH(o){this.enabled!==!1&&(o.pointerType==="touch"?this._onTouchMove(o):this._onMouseMove(o))}function SH(o){switch(this._removePointer(o),this._pointers.length){case 0:this.domElement.releasePointerCapture(o.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(eD),this.state=Nt.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function MH(o){let e;switch(o.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case sc.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(o),this.state=Nt.DOLLY;break;case sc.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(o),this.state=Nt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(o),this.state=Nt.ROTATE}break;case sc.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(o),this.state=Nt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(o),this.state=Nt.PAN}break;default:this.state=Nt.NONE}this.state!==Nt.NONE&&this.dispatchEvent(Qv)}function AH(o){switch(this.state){case Nt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(o);break;case Nt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(o);break;case Nt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(o);break}}function NH(o){this.enabled===!1||this.enableZoom===!1||this.state!==Nt.NONE||(o.preventDefault(),this.dispatchEvent(Qv),this._handleMouseWheel(this._customWheelEvent(o)),this.dispatchEvent(eD))}function wH(o){this.enabled!==!1&&this._handleKeyDown(o)}function RH(o){switch(this._trackPointer(o),this._pointers.length){case 1:switch(this.touches.ONE){case Qu.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(o),this.state=Nt.TOUCH_ROTATE;break;case Qu.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(o),this.state=Nt.TOUCH_PAN;break;default:this.state=Nt.NONE}break;case 2:switch(this.touches.TWO){case Qu.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(o),this.state=Nt.TOUCH_DOLLY_PAN;break;case Qu.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(o),this.state=Nt.TOUCH_DOLLY_ROTATE;break;default:this.state=Nt.NONE}break;default:this.state=Nt.NONE}this.state!==Nt.NONE&&this.dispatchEvent(Qv)}function EH(o){switch(this._trackPointer(o),this.state){case Nt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(o),this.update();break;case Nt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(o),this.update();break;case Nt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(o),this.update();break;case Nt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(o),this.update();break;default:this.state=Nt.NONE}}function CH(o){this.enabled!==!1&&o.preventDefault()}function BH(o){o.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function DH(o){o.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}/** 636 * @license 637 * Copyright 2010-2026 Three.js Authors 638 * SPDX-License-Identifier: MIT 639 */T.BRDF_GGX;T.BRDF_Lambert;T.BasicPointShadowFilter;T.BasicShadowFilter;T.Break;T.Const;T.Continue;T.DFGLUT;T.D_GGX;T.Discard;T.EPSILON;T.F_Schlick;const mi=T.Fn;T.INFINITY;T.If;const UH=T.Loop;T.NodeAccess;T.NodeShaderStage;T.NodeType;T.NodeUpdateType;T.PCFShadowFilter;T.PCFSoftShadowFilter;T.PI;T.PI2;T.TWO_PI;T.HALF_PI;T.PointShadowFilter;T.Return;T.Schlick_to_F0;T.ShaderNode;T.Stack;T.Switch;T.TBNViewMatrix;T.VSMShadowFilter;T.V_GGX_SmithCorrelated;T.Var;T.VarIntent;T.abs;T.acesFilmicToneMapping;T.acos;T.acosh;const FH=T.add;T.addMethodChaining;T.addNodeElement;T.agxToneMapping;T.all;T.alphaT;T.ambientOcclusion;T.and;T.anisotropy;T.anisotropyB;T.anisotropyT;T.any;T.append;T.array;T.asin;T.asinh;T.assign;T.atan;T.atanh;T.atomicAdd;T.atomicAnd;T.atomicFunc;T.atomicLoad;T.atomicMax;T.atomicMin;T.atomicOr;T.atomicStore;T.atomicSub;T.atomicXor;T.attenuationColor;T.attenuationDistance;T.attribute;T.attributeArray;T.backgroundBlurriness;T.backgroundIntensity;T.backgroundRotation;T.batch;T.bentNormalView;T.billboarding;T.bitAnd;T.bitNot;T.bitOr;T.bitXor;T.bitangentGeometry;T.bitangentLocal;T.bitangentView;T.bitangentWorld;T.bitcast;T.blendBurn;T.blendColor;T.blendDodge;T.blendOverlay;T.blendScreen;T.blur;T.bool;T.buffer;T.bufferAttribute;T.bumpMap;T.builtin;T.builtinAOContext;T.builtinShadowContext;T.bvec2;T.bvec3;T.bvec4;T.bypass;T.cache;T.call;T.cameraFar;T.cameraIndex;T.cameraNear;T.cameraNormalMatrix;const lR=T.cameraPosition;T.cameraProjectionMatrix;T.cameraProjectionMatrixInverse;T.cameraViewMatrix;T.cameraViewport;T.cameraWorldMatrix;T.cbrt;T.cdl;T.ceil;T.checker;T.cineonToneMapping;const ym=T.clamp;T.clearcoat;T.clearcoatNormalView;T.clearcoatRoughness;T.clipSpace;T.code;T.color;T.colorSpaceToWorking;T.colorToDirection;T.compute;T.computeKernel;T.computeSkinning;T.context;T.convert;T.convertColorSpace;T.convertToTexture;T.countLeadingZeros;T.countOneBits;T.countTrailingZeros;const t_=T.cos;T.cosh;const LH=T.cross;T.cubeTexture;T.cubeTextureBase;T.dFdx;T.dFdy;T.dashSize;T.debug;T.decrement;T.decrementBefore;T.defaultBuildStages;T.defaultShaderStages;T.defined;T.degrees;T.deltaTime;T.densityFog;T.densityFogFactor;T.depth;T.depthPass;T.determinant;T.difference;T.diffuseColor;T.directPointLight;T.directionToColor;T.directionToFaceDirection;T.dispersion;const OH=T.distance;T.div;const dn=T.dot;T.drawIndex;T.dynamicBufferAttribute;T.element;T.emissive;T.equal;T.equirectDirection;T.equirectUV;T.exp;T.exp2;T.exponentialHeightFogFactor;T.expression;T.faceDirection;T.faceForward;T.faceforward;const or=T.float;T.floatBitsToInt;T.floatBitsToUint;const zH=T.floor;T.fog;const uR=T.fract;T.frameGroup;T.frameId;T.frontFacing;T.fwidth;T.gain;T.gapSize;T.getConstNodeType;T.getCurrentStack;T.getDirection;T.getDistanceAttenuation;T.getGeometryRoughness;T.getNormalFromDepth;T.interleavedGradientNoise;T.vogelDiskSample;T.getParallaxCorrectNormal;T.getRoughness;T.getScreenPosition;T.getShIrradianceAt;T.getShadowMaterial;T.getShadowRenderObjectFunction;T.getTextureIndex;T.getViewPosition;T.globalId;T.glsl;T.glslFn;T.grayscale;T.greaterThan;T.greaterThanEqual;T.hash;T.highpModelNormalViewMatrix;T.highpModelViewMatrix;T.hue;T.increment;T.incrementBefore;T.instance;T.instanceIndex;T.instancedArray;T.instancedBufferAttribute;T.instancedDynamicBufferAttribute;T.instancedMesh;const cR=T.int;T.intBitsToFloat;T.inverse;T.inverseSqrt;T.inversesqrt;T.invocationLocalIndex;T.invocationSubgroupIndex;T.ior;T.iridescence;T.iridescenceIOR;T.iridescenceThickness;T.ivec2;T.ivec3;T.ivec4;T.js;T.label;T.length;T.lengthSq;T.lessThan;T.lessThanEqual;T.lightPosition;T.lightProjectionUV;T.lightShadowMatrix;T.lightTargetDirection;T.lightTargetPosition;T.lightViewPosition;T.lightingContext;T.lights;T.linearDepth;T.linearToneMapping;T.localId;T.log;T.log2;T.logarithmicDepthToViewZ;const PH=T.luminance;T.mat2;T.mat3;T.mat4;T.matcapUV;T.materialAO;T.materialAlphaTest;T.materialAnisotropy;T.materialAnisotropyVector;T.materialAttenuationColor;T.materialAttenuationDistance;T.materialClearcoat;T.materialClearcoatNormal;T.materialClearcoatRoughness;T.materialColor;T.materialDispersion;T.materialEmissive;T.materialEnvIntensity;T.materialEnvRotation;T.materialIOR;T.materialIridescence;T.materialIridescenceIOR;T.materialIridescenceThickness;T.materialLightMap;T.materialLineDashOffset;T.materialLineDashSize;T.materialLineGapSize;T.materialLineScale;T.materialLineWidth;T.materialMetalness;T.materialNormal;T.materialOpacity;T.materialPointSize;T.materialReference;T.materialReflectivity;T.materialRefractionRatio;T.materialRotation;T.materialRoughness;T.materialSheen;T.materialSheenRoughness;T.materialShininess;T.materialSpecular;T.materialSpecularColor;T.materialSpecularIntensity;T.materialSpecularStrength;T.materialThickness;T.materialTransmission;const io=T.max;T.maxMipLevel;T.mediumpModelViewMatrix;T.metalness;T.min;const ei=T.mix;T.mixElement;T.mod;T.modelDirection;T.modelNormalMatrix;T.modelPosition;T.modelRadius;T.modelScale;T.modelViewMatrix;T.modelViewPosition;T.modelViewProjection;T.modelWorldMatrix;T.modelWorldMatrixInverse;T.morphReference;T.mrt;T.mul;T.mx_aastep;T.mx_add;T.mx_atan2;T.mx_cell_noise_float;T.mx_contrast;T.mx_divide;T.mx_fractal_noise_float;T.mx_fractal_noise_vec2;T.mx_fractal_noise_vec3;T.mx_fractal_noise_vec4;T.mx_frame;T.mx_heighttonormal;T.mx_hsvtorgb;T.mx_ifequal;T.mx_ifgreater;T.mx_ifgreatereq;T.mx_invert;T.mx_modulo;T.mx_multiply;T.mx_noise_float;T.mx_noise_vec3;T.mx_noise_vec4;T.mx_place2d;T.mx_power;T.mx_ramp4;T.mx_ramplr;T.mx_ramptb;T.mx_rgbtohsv;T.mx_rotate2d;T.mx_rotate3d;T.mx_safepower;T.mx_separate;T.mx_splitlr;T.mx_splittb;T.mx_srgb_texture_to_lin_rec709;T.mx_subtract;T.mx_timer;T.mx_transform_uv;T.mx_unifiednoise2d;T.mx_unifiednoise3d;T.mx_worley_noise_float;T.mx_worley_noise_vec2;T.mx_worley_noise_vec3;T.negate;T.negateOnBackSide;T.neutralToneMapping;T.nodeArray;
vendor: 7,718 bytes, line 639
639T.nodeImmutable;const VH=T.nodeObject;T.nodeObjectIntent;T.nodeObjects;T.nodeProxy;T.nodeProxyIntent;T.normalFlat;T.normalGeometry;T.normalLocal;T.normalMap;T.normalView;T.normalViewGeometry;T.normalWorld;T.normalWorldGeometry;const nl=T.normalize;T.not;T.notEqual;T.numWorkgroups;T.objectDirection;T.objectGroup;T.objectPosition;T.objectRadius;T.objectScale;T.objectViewPosition;T.objectWorldMatrix;T.OnBeforeObjectUpdate;T.OnBeforeMaterialUpdate;T.OnObjectUpdate;T.OnMaterialUpdate;T.oneMinus;T.or;T.orthographicDepthToViewZ;T.oscSawtooth;T.oscSine;T.oscSquare;T.oscTriangle;T.output;T.outputStruct;T.overloadingFn;T.overrideNode;T.overrideNodes;T.packHalf2x16;T.packSnorm2x16;T.packUnorm2x16;T.packNormalToRGB;T.parabola;T.parallaxDirection;T.parallaxUV;T.parameter;const GH=T.pass,IH=T.passTexture;T.pcurve;T.perspectiveDepthToViewZ;T.pmremTexture;T.pointShadow;T.pointUV;T.pointWidth;T.positionGeometry;const kH=T.positionLocal;T.positionPrevious;T.positionView;T.positionViewDirection;const hR=T.positionWorld;T.positionWorldDirection;T.posterize;const qu=T.pow;T.pow2;T.pow3;T.pow4;T.premultiplyAlpha;T.property;T.radians;T.rand;T.range;T.rangeFog;T.rangeFogFactor;T.reciprocal;T.reference;T.referenceBuffer;const HH=T.reflect;T.reflectVector;T.reflectView;T.reflector;T.refract;T.refractVector;T.refractView;T.reinhardToneMapping;T.remap;T.remapClamp;T.renderGroup;T.renderOutput;T.rendererReference;T.replaceDefaultUV;T.rotate;T.rotateUV;T.roughness;T.round;T.rtt;T.sRGBTransferEOTF;T.sRGBTransferOETF;T.sample;T.sampler;T.samplerComparison;T.saturate;T.saturation;T.screen;T.screenCoordinate;T.screenDPR;T.screenSize;T.screenUV;T.select;T.setCurrentStack;T.setName;T.shaderStages;T.shadow;T.shadowPositionWorld;T.shapeCircle;T.sharedUniformGroup;T.sheen;T.sheenRoughness;T.shiftLeft;T.shiftRight;T.shininess;T.sign;const xm=T.sin;T.sinh;T.sinc;T.skinning;const ea=T.smoothstep;T.smoothstepElement;T.specularColor;T.specularF90;T.spherizeUV;T.split;T.spritesheetUV;T.sqrt;T.stack;T.step;T.stepElement;T.storage;T.storageBarrier;T.storageTexture;T.storageTexture3D;T.struct;T.sub;T.subgroupAdd;T.subgroupAll;T.subgroupAnd;T.subgroupAny;T.subgroupBallot;T.subgroupBroadcast;T.subgroupBroadcastFirst;T.subBuild;T.subgroupElect;T.subgroupExclusiveAdd;T.subgroupExclusiveMul;T.subgroupInclusiveAdd;T.subgroupInclusiveMul;T.subgroupIndex;T.subgroupMax;T.subgroupMin;T.subgroupMul;T.subgroupOr;T.subgroupShuffle;T.subgroupShuffleDown;T.subgroupShuffleUp;T.subgroupShuffleXor;T.subgroupSize;T.subgroupXor;T.tan;T.tanh;T.tangentGeometry;T.tangentLocal;T.tangentView;T.tangentWorld;const rl=T.texture;T.texture3D;T.textureBarrier;T.textureBicubic;T.textureBicubicLevel;T.textureCubeUV;T.textureLoad;T.textureSize;T.textureLevel;T.textureStore;T.thickness;T.time;T.toneMapping;T.toneMappingExposure;T.toonOutlinePass;T.transformDirection;T.transformNormal;T.transformNormalByInverseViewMatrix;T.transformNormalByViewMatrix;T.transformNormalToView;T.transformedClearcoatNormalView;T.transformedNormalView;T.transformedNormalWorld;T.transmission;T.transpose;T.triNoise3D;T.triplanarTexture;T.triplanarTextures;T.trunc;T.uint;T.uintBitsToFloat;const gi=T.uniform,s_=T.uniformArray;T.uniformCubeTexture;T.uniformGroup;T.uniformFlow;T.uniformTexture;T.unpackHalf2x16;T.unpackSnorm2x16;T.unpackUnorm2x16;T.unpackRGBToNormal;T.unpremultiplyAlpha;T.userData;const qH=T.uv;T.uvec2;T.uvec3;T.uvec4;T.varying;T.varyingProperty;const fs=T.vec2,$u=T.vec3,ia=T.vec4;T.vectorComponents;T.velocity;T.vertexColor;T.vertexIndex;T.vertexStage;T.vibrance;T.viewZToLogarithmicDepth;T.viewZToOrthographicDepth;T.viewZToPerspectiveDepth;T.viewZToReversedOrthographicDepth;T.viewZToReversedPerspectiveDepth;T.viewport;T.viewportCoordinate;T.viewportDepthTexture;T.viewportLinearDepth;T.viewportMipTexture;T.viewportOpaqueMipTexture;T.viewportResolution;T.viewportSafeUV;T.viewportSharedTexture;T.viewportSize;T.viewportTexture;T.viewportUV;T.wgsl;T.wgslFn;T.workgroupArray;T.workgroupBarrier;T.workgroupId;T.workingToColorSpace;T.xor;const zn=new Vd,$H=new Fe,WH=new Fe(1,0),XH=new Fe(0,1);let i_;const jH=mi(({input:o,threshold:e,smoothWidth:t})=>{const s=PH(o.rgb),i=ea(e,e.add(t),s);return ei(ia(0),o,i)});class YH extends qt{static get type(){return"BloomNode"}constructor(e,t=1,s=0,i=0){super("vec4"),this.inputNode=e,this.strength=t.isNode?t:gi(t),this.radius=s.isNode?s:gi(s),this.threshold=i.isNode?i:gi(i),this.smoothWidth=gi(.01),this._resolutionScale=.5,this.highPassFn=jH,this._renderTargetsHorizontal=[],this._renderTargetsVertical=[],this._nMips=5,this._renderTargetBright=new $i(1,1,{depthBuffer:!1,type:Jt}),this._renderTargetBright.texture.name="UnrealBloomPass.bright",this._renderTargetBright.texture.generateMipmaps=!1;for(let r=0;r<this._nMips;r++){const l=new $i(1,1,{depthBuffer:!1,type:Jt});l.texture.name="UnrealBloomPass.h"+r,l.texture.generateMipmaps=!1,this._renderTargetsHorizontal.push(l);const u=new $i(1,1,{depthBuffer:!1,type:Jt});u.texture.name="UnrealBloomPass.v"+r,u.texture.generateMipmaps=!1,this._renderTargetsVertical.push(u)}this._compositeMaterial=null,this._highPassFilterMaterial=null,this._separableBlurMaterials=[],this._textureNodeBright=rl(this._renderTargetBright.texture),this._textureNodeBlur0=rl(this._renderTargetsVertical[0].texture),this._textureNodeBlur1=rl(this._renderTargetsVertical[1].texture),this._textureNodeBlur2=rl(this._renderTargetsVertical[2].texture),this._textureNodeBlur3=rl(this._renderTargetsVertical[3].texture),this._textureNodeBlur4=rl(this._renderTargetsVertical[4].texture),this._textureOutput=IH(this,this._renderTargetsHorizontal[0].texture),this.updateBeforeType=Le.FRAME}getTextureNode(){return this._textureOutput}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setSize(e,t){let s=Math.floor(e*this._resolutionScale),i=Math.floor(t*this._resolutionScale);this._renderTargetBright.setSize(s,i);for(let r=0;r<this._nMips;r++)this._renderTargetsHorizontal[r].setSize(s,i),this._renderTargetsVertical[r].setSize(s,i),this._separableBlurMaterials[r].invSize.value.set(1/s,1/i),s=Math.floor(s/2),i=Math.floor(i/2)}updateBefore(e){const{renderer:t}=e;i_=Mw.resetRendererState(t,i_);const s=t.getDrawingBufferSize($H);this.setSize(s.width,s.height),t.setRenderTarget(this._renderTargetBright),zn.material=this._highPassFilterMaterial,zn.name="Bloom [ High Pass ]",zn.render(t);let i=this._renderTargetBright;for(let r=0;r<this._nMips;r++)zn.material=this._separableBlurMaterials[r],this._separableBlurMaterials[r].colorTexture.value=i.texture,this._separableBlurMaterials[r].direction.value=WH,t.setRenderTarget(this._renderTargetsHorizontal[r]),zn.name=`Bloom [ Blur Horizontal - ${r} ]`,zn.render(t),this._separableBlurMaterials[r].colorTexture.value=this._renderTargetsHorizontal[r].texture,this._separableBlurMaterials[r].direction.value=XH,t.setRenderTarget(this._renderTargetsVertical[r]),zn.name=`Bloom [ Blur Vertical - ${r} ]`,zn.render(t),i=this._renderTargetsVertical[r];t.setRenderTarget(this._renderTargetsHorizontal[0]),zn.material=this._compositeMaterial,zn.name="Bloom [ Composite ]",zn.render(t),Mw.restoreRendererState(t,i_)}setup(e){this._highPassFilterMaterial=this._highPassFilterMaterial||new Bt,this._highPassFilterMaterial.fragmentNode=this.highPassFn({input:this.inputNode,threshold:this.threshold,smoothWidth:this.smoothWidth}).context(e.getSharedContext()),this._highPassFilterMaterial.name="Bloom_highPass",this._highPassFilterMaterial.needsUpdate=!0;const t=[6,10,14,18,22];for(let u=0;u<this._nMips;u++)this._separableBlurMaterials.push(this._getSeparableBlurMaterial(e,t[u]));const s=s_([1,.8,.6,.4,.2]),i=s_([new H(1,1,1),new H(1,1,1),new H(1,1,1),new H(1,1,1),new H(1,1,1)]),r
639=mi(([u,h])=>{const d=or(1.2).sub(u);return ei(u,d,h)}).setLayout({name:"lerpBloomFactor",type:"float",inputs:[{name:"factor",type:"float"},{name:"radius",type:"float"}]}),l=mi(()=>{const u=r(s.element(0),this.radius).mul(ia(i.element(0),1)).mul(this._textureNodeBlur0),h=r(s.element(1),this.radius).mul(ia(i.element(1),1)).mul(this._textureNodeBlur1),d=r(s.element(2),this.radius).mul(ia(i.element(2),1)).mul(this._textureNodeBlur2),p=r(s.element(3),this.radius).mul(ia(i.element(3),1)).mul(this._textureNodeBlur3),m=r(s.element(4),this.radius).mul(ia(i.element(4),1)).mul(this._textureNodeBlur4);return u.add(h).add(d).add(p).add(m).mul(this.strength)});return this._compositeMaterial=this._compositeMaterial||new Bt,this._compositeMaterial.fragmentNode=l().context(e.getSharedContext()),this._compositeMaterial.name="Bloom_comp",this._compositeMaterial.needsUpdate=!0,this._textureOutput}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(),this._highPassFilterMaterial!==null&&this._highPassFilterMaterial.dispose(),this._compositeMaterial!==null&&this._compositeMaterial.dispose();for(let e=0;e<this._separableBlurMaterials.length;e++)this._separableBlurMaterials[e].dispose()}_getSeparableBlurMaterial(e,t){const s=[],i=t/3;for(let b=0;b<t;b++)s.push(.39894*Math.exp(-.5*b*b/(i*i))/i);const r=rl(null),l=s_(s),u=gi(new Fe),h=gi(new Fe(.5,.5)),d=qH(),p=b=>r.sample(b),m=mi(()=>{const b=p(d).rgb.mul(l.element(0)).toVar();return UH({start:cR(1),end:cR(t),type:"int",condition:"<"},({i:_})=>{const v=or(_),M=l.element(_),A=h.mul(u).mul(v),C=p(d.add(A)).rgb,E=p(d.sub(A)).rgb;b.addAssign(FH(C,E).mul(M))}),ia(b,1)}),y=new Bt;return y.fragmentNode=m().context(e.getSharedContext()),y.name="Bloom_separable",y.needsUpdate=!0,y.colorTexture=r,y.direction=h,y.invSize=u,y}}const ZH=(o,e,t,s)=>new YH(VH(o),e,t,s),cc=(o,e,t)=>o+(e-o)*t,ed=(o,e,t)=>[cc(o[0],e[0],t),cc(o[1],e[1],t),cc(o[2],e[2],t)],QH=(o,e,t)=>{const s=Math.min(Math.max((t-o)/(e-o),0),1);return s*s*(3-2*s)},Wu={zenith:[.07,.2,.42],horizon:[.52,.68,.82],sun:[1,.93,.8],intensity:1.6,deep:[.015,.09,.11],shallow:[.06,.32,.36]},Xu={zenith:[.03,.05,.16],horizon:[.85,.36,.16],sun:[1,.42,.14],intensity:2.6,deep:[.02,.045,.075],shallow:[.09,.15,.2]};async function KH(o){if(!o)throw new Error("Container element required");const e=gi(0),t=gi(.925),s=gi(new H(0,1,0)),i=gi(new Xe(1,1,1)),r=gi(new Xe(.52,.68,.82)),l=gi(new Xe(.07,.2,.42)),u=gi(new Xe(.015,.09,.11)),h=gi(new Xe(.06,.32,.36));function d(j){const te=cc(-.05,.62,j),pe=cc(-.9,.9,j),_e=Math.cos(te);s.value.set(_e*Math.sin(pe),Math.sin(te),-_e*Math.cos(pe));const Me=QH(0,.42,te);l.value.setRGB(...ed(Xu.zenith,Wu.zenith,Me)),r.value.setRGB(...ed(Xu.horizon,Wu.horizon,Me)),u.value.setRGB(...ed(Xu.deep,Wu.deep,Me)),h.value.setRGB(...ed(Xu.shallow,Wu.shallow,Me));const De=ed(Xu.sun,Wu.sun,Me),nt=cc(Xu.intensity,Wu.intensity,Me);i.value.setRGB(De[0]*nt,De[1]*nt,De[2]*nt)}d(.55);const m=[{dir:[1,0],wavelength:60,steepness:.12},{dir:[.6,.8],wavelength:31,steepness:.12},{dir:[-.7,.7],wavelength:18,steepness:.09},{dir:[.3,-.95],wavelength:9.5,steepness:.07},{dir:[-.35,-.94],wavelength:5,steepness:.05}].map(({dir:j,wavelength:te,steepness:pe})=>{const _e=Math.hypot(j[0],j[1]),Me=2*Math.PI/te;return{dx:j[0]/_e,dz:j[1]/_e,k:Me,c:Math.sqrt(9.8*Me),steepness:pe}}),y=(j,te,pe)=>or(j.k).mul(dn(fs(j.dx,j.dz),te).sub(pe.mul(j.c))),b=mi(([j,te,pe])=>{const _e=$u(j.x,0,j.y).toVar();for(const Me of m){const De=or(Me.steepness).mul(pe).div(Me.k),nt=y(Me,j,te);_e.x.addAssign(De.mul(Me.dx).mul(t_(nt))),_e.y.addAssign(De.mul(xm(nt))),_e.z.addAssign(De.mul(Me.dz).mul(t_(nt)))}return _e}),_=mi(([j,te,pe])=>{const _e=$u(1,0,0).toVar(),Me=$u(0,0,1).toVar();for(const De of m){const nt=or(De.steepness).mul(pe),ct=y(De,j,te),Ys=xm(ct),Rn=t_(ct);_e.x.subAssign(nt.mul(De.dx*De.dx).mul(Ys)),_e.y.addAssign(nt.mul(De.dx).mul(Rn)),_e.z.subAssign(nt.mul(De.dx*De.dz).mul(Ys)),Me.x.subAssign(nt.mul(De.dx*De.dz).mul(Ys)),Me.y.addAssign(nt.mul(De.dz).mul(Rn)),Me.z.subAssign(nt.mul(De.dz*De.dz).mul(Ys))}return nl(LH(Me,_e))}),v=mi(([j,te,pe])=>{const _e=or(0).toVar();
639for(const Me of m){const De=or(Me.steepness).mul(pe).div(Me.k);_e.addAssign(De.mul(xm(y(Me,j,te))))}return _e}),M=mi(([j])=>{const te=fs(dn(j,fs(127.1,311.7)),dn(j,fs(269.5,183.3)));return uR(xm(te).mul(43758.5453)).mul(2).sub(1)}),A=mi(([j])=>{const te=zH(j),pe=uR(j),_e=pe.mul(pe).mul(pe.mul(pe.mul(6).sub(15)).add(10)),Me=dn(M(te),pe),De=dn(M(te.add(fs(1,0))),pe.sub(fs(1,0))),nt=dn(M(te.add(fs(0,1))),pe.sub(fs(0,1))),ct=dn(M(te.add(fs(1,1))),pe.sub(fs(1,1)));return ei(ei(Me,De,_e.x),ei(nt,ct,_e.x),_e.y)}),C=mi(([j])=>A(j).add(A(j.mul(2.04).add(fs(17.3,9.1))).mul(.5)).add(A(j.mul(4.11).add(fs(42.7,28.6))).mul(.25))),E=mi(([j,te])=>{const pe=fs(te.mul(.55),te.mul(.32)),_e=fs(te.mul(-.4),te.mul(.5));return C(j.mul(.85).add(pe)).add(C(j.mul(2.1).add(_e)).mul(.45))}),F=mi(([j])=>{const te=nl(j).toVar(),pe=ym(te.y,-.15,1),_e=ei(r,l,qu(io(pe,0),.42)).toVar(),Me=u.mul(1.4).add(r.mul(.25));_e.assign(ei(_e,Me,ea(-.15,0,te.y).oneMinus()));const De=io(dn(te,s),0);return _e.addAssign(i.mul(qu(De,10)).mul(.18)),_e.addAssign(i.mul(ea(.9994,.9998,De)).mul(30)),_e}),L=new w_;L.positionNode=b(kH.xz,e,t),L.colorNode=mi(()=>{const j=hR.toVar(),te=j.xz,pe=_(te,e,t),_e=E(te,e),Me=E(te.add(fs(.
6391,0)),e),De=E(te.add(fs(0,.1)),e),nt=$u(_e.sub(Me),0,_e.sub(De)).mul(or(1.5).mul(t.mul(.6).add(.4))),ct=nl(pe.add(nt)).toVar(),Ys=nl(lR.sub(j)).toVar(),Rn=v(te,e,t).toVar(),Fl=ei(u,h,ym(Rn.mul(.35).add(.45),0,1)).toVar(),qd=qu(io(dn(Ys,s),0),3).mul(io(Rn,0)).mul(.18);Fl.addAssign(ei(h,i,.5).mul(qd));const _i=HH(Ys.negate(),ct).toVar();_i.y.assign(io(_i.y,.04)),_i.assign(nl(_i));const Fc=or(.02).add(or(.98).mul(qu(io(dn(ct,Ys),0).oneMinus(),5))),Xn=ei(Fl,F(_i),Fc).toVar(),$d=nl(s.add(Ys)),Wd=C(te.mul(2.1).add(fs(e.mul(-.4),e.mul(.5)))).mul(.5).add(.5),Lc=qu(io(dn(ct,$d),0),500).mul(ei(.4,3.4,Wd)),Oc=qu(io(dn(ct,$d),0),48).mul(.12);Xn.addAssign(i.mul(Lc.add(Oc)));const zc=C(te.mul(1.1).add(fs(e.mul(.22),e.mul(.14)))).mul(.5).add(.5),Ay=ea(.5,.95,zc).mul(ea(1,2,Rn));Xn.assign(ei(Xn,$u(.82,.88,.9),ym(Ay.mul(.85),0,1)));const Ny=OH(lR,j);return Xn.assign(ei(Xn,r,ea(150,290,Ny))),ia(Xn,1)})();const U=new w_;U.side=Ts,U.depthWrite=!1,U.colorNode=mi(()=>{const j=nl(hR).toVar(),te=F(j).toVar(),pe=ea(.03,.16,j.y).mul(ea(.22,.6,j.y).oneMinus()),_e=j.xz.div(j.y.add(.18)).mul(.55),Me=fs(e.mul(.006),e.mul(.003)),De=C(_e.add(Me)).mul(.5).add(.5),nt=ea(.62,.95,De).mul(pe),ct=ei($u(.92,.9,.87),i,.25);return te.assign(ei(te,ct,ym(nt.mul(.6),0,1))),ia(te,1)})();const R=new pH({antialias:!0,powerPreference:"high-performance"});R.setPixelRatio(Math.min(window.devicePixelRatio,2)),R.setSize(window.innerWidth,window.innerHeight),R.toneMapping=RR,R.toneMappingExposure=1,R.domElement.style.display="block",R.domElement.style.width="100%",R.domElement.style.height="100%",o.appendChild(R.domElement);const V=new J_;V.background=new Xe("#05070a");const $=new yi(55,window.innerWidth/window.innerHeight,.5,8e3);$.position.set(0,5.5,17);const ie=new Ig(420,420,440,440);ie.rotateX(-Math.PI/2);const le=new Tr(ie,L);le.frustumCulled=!1,V.add(le);const ye=new kg(4e3,48,24),xe=new Tr(ye,U);xe.renderOrder=-1,xe.frustumCulled=!1,V.add(xe);const Ne=new _H($,R.domElement);Ne.enableDamping=!0,Ne.dampingFactor=.06,Ne.target.set(0,1.5,0),Ne.autoRotate=!0,Ne.autoRotateSpeed=.08,Ne.enableRotate=!1,Ne.enableZoom=!1,Ne.enablePan=!1,Ne.minPolarAngle=.15,Ne.maxPolarAngle=Math.PI*.495;const ce=new gH(R),ne=GH(V,$).getTextureNode("output");ce.outputNode=ne.add(ZH(ne,.4,.3,.9)),await R.init();let fe=performance.now();function Be(j){const te=Math.min((j-fe)/1e3,.1);fe=j,e.value+=te,Ne.update(),ce.render()}R.setAnimationLoop(Be);function Ce(){$.aspect=window.innerWidth/window.innerHeight,$.updateProjectionMatrix(),R.setPixelRatio(Math.min(window.devicePixelRatio,2)),R.setSize(window.innerWidth,window.innerHeight)}window.addEventListener("resize",Ce);function G(){document.hidden?R.setAnimationLoop(null):(fe=performance.now(),R.setAnimationLoop(Be))}return document.addEventListener("visibilitychange",G),{dispose(){R.setAnimationLoop(null),window.removeEventListener("resize",Ce),document.removeEventListener("visibilitychange",G),Ne.dispose(),ie.dispose(),L.dispose(),ye.dispose(),U.dispose(),R.dispose(),R.domElement.parentNode&&R.domElement.parentNode.removeChild(R.domElement)}}}const JH=()=>{const o=je.useRef(null);return je.useEffect(()=>{const e=o.current;if(!e)return;let t=null,s=!1;return KH(e).then(i=>{if(s){i.dispose();return}t=i.dispose}).catch(i=>{console.warn("Ocean background failed to initialize:",i)}),()=>{s=!0,t?.()}},[]),k.jsxs(k.Fragment,{children:[k.jsx("div",{ref:o,className:"fixed inset-0 w-full h-full",style:{zIndex:-10,pointerEvents:"none"}}),k.jsx("div",{className:"fixed inset-0",style:{zIndex:-5,pointerEvents:"none",background:["linear-gradient(to top, rgba(3, 5, 8, 0.38), transparent 32%)","radial-gradient(ellipse 125% 95% at 50% 38%, transparent 52%, rgba(3, 5, 8, 0.55) 100%)"].join(", ")},"aria-hidden":"true"})]})},eq=({onImagesUpload:o,disabled:e})=>{const[t,s]=je.useState(!1),i=je.useCallback(h=>{h.preventDefault(),h.stopPropagation(),h.type==="dragenter"||h.type==="dragover"?s(!0):h.type==="dragleave"&&s(!1)},[]),r=je.useCallback(h=>{if(!h||e)return;const d=Array.from(h).filter(p=>p.type.startsWith("image/"));d.length>0&&o(d.slice(0,3))},[e,o]),l=je.useCallback(h=>{h.preventDefault(),h.stopPropagation(),s(!1),r(h.dataTransfer.files)},[r]),u=h=>{r(h.target.files),h.currentTarget.value=""};return k.jsx("div",{className:"w-full max-w-lg mx-auto text-center",children:k.jsxs("label",{htmlFor:"file-upload",onDragEnter:i,onDragLeave:i,onDragOver:i,onDrop:l,className:`relative block w-full rounded-2xl border-2 border-dashed transition-all duration-500 640 ${t?"bg-teal-950/50 border-teal-400 scale-105 shadow-[0_0_30px_rgba(45,212,191,0.3)]":"bg-teal-950/40 animate-border-pulse hover:bg-teal-950/50 hover:border-teal-400/50 hover:shadow-[0_0_20px_rgba(45,212,191,0.15)] hover:scale-[1.02]"} 641 backdrop-blur-md p-12
642 ${e?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[k.jsx(qF,{className:`mx-auto h-12 w-12 text-teal-200/70 mb-4 transition-transform duration-500 ${!t&&"group-hover:scale-110"}`}),k.jsx("span",{className:"mt-2 block text-lg font-semibold text-slate-100",children:"Upload Coral Photos"}),k.jsx("span",{className:"mt-1 block text-sm text-teal-100/60",children:"Drag and drop up to 3 images"}),k.jsx("input",{id:"file-upload",name:"file-upload",type:"file",className:"sr-only",onChange:u,accept:"image/*",multiple:!0,disabled:e})]})})},tD=o=>o.trim().replace(/\s+/g," ").toLowerCase(),tq=` 643Acanthastrea bowerbanki Acanthastrea brevis Acanthastrea echinata Acanthastrea faviaformis Acanthastrea hemprichii Acanthastrea hillae Acanthastrea ishigakiensis Acanthastrea lordhowensis Acanthastrea regularis Acanthastrea rotundoflora Acanthastrea subechinata Acanthophyllia deshayesiana Acropora abrolhosensis Acropora abrotanoides Acropora aculeus Acropora acuminata Acropora akajimensis Acropora anthocercis Acropora appressa Acropora arabensis Acropora aspera Acropora austera Acropora awi Acropora azurea Acropora batunai Acropora bifurcata Acropora branchi Acropora bushyensis Acropora cardenae Acropora carduus Acropora caroliniana Acropora cerealis Acropora cervicornis Acropora chesterfieldensis Acropora clathrata Acropora convexa Acropora cophodactyla Acropora copiosa Acropora cytherea Acropora dendrum Acropora derawanensis Acropora desalwii Acropora digitifera Acropora divaricata Acropora donei Acropora downingi Acropora echinata Acropora efflorescens Acropora elegans Acropora elegantula Acropora elseyi Acropora eurystoma Acropora fastigata Acropora fenneri Acropora filiformis Acropora florida Acropora forskali Acropora fragilis Acropora gemmifera Acropora glauca Acropora globiceps Acropora grandis Acropora granulosa Acropora haimei Acropora halmaherae Acropora hemprichii Acropora hoeksemai Acropora horrida Acropora humilis Acropora hyacinthus Acropora indonesia Acropora insignis Acropora intermedia Acropora jacquelineae Acropora japonica Acropora kimbeensis Acropora kirstyae Acropora kosurini Acropora lamarcki Acropora latistella Acropora lianae Acropora listeri Acropora loisetteae Acropora lokani Acropora longicyathus Acropora loripes Acropora lovelli Acropora lutkeni Acropora maryae Acropora massawensis Acropora meridiana Acropora microclados Acropora microphthalma Acropora millepora Acropora minuta Acropora mirabilis Acropora monticulosa Acropora multiacuta Acropora muricata Acropora nana Acropora nasuta Acropora natalensis Acropora navini Acropora ocellata Acropora orbicularis Acropora palmata Acropora palmerae Acropora paniculata Acropora papillare Acropora parahemprichii Acropora parapharaonis Acropora parilis Acropora pectinatus Acropora pharaonis Acropora pichoni Acropora pinguis Acropora plana Acropora plantaginea Acropora plumosa Acropora polystoma Acropora prolifera Acropora proximalis Acropora pruinosa Acropora pulchra Acropora retusa Acropora robusta Acropora rongelapensis Acropora rosaria Acropora roseni Acropora rudis Acropora rufus Acropora russelli Acropora samoensis A
643cropora sarmentosa Acropora schmitti Acropora secale Acropora sekiseiensis Acropora selago Acropora seriata Acropora simplex Acropora sirikitiae Acropora solitaryensis Acropora spathulata Acropora speciosa Acropora spicifera Acropora squamata Acropora squarrosa Acropora stoddarti Acropora striata Acropora subglabra Acropora subulata Acropora suharsonoi Acropora sukarnoi Acropora tanegashimensis Acropora tenella Acropora tenuis Acropora teres Acropora tizardi Acropora torihalimeda Acropora torresiana Acropora tortuosa Acropora tumida Acropora turaki Acropora tutuilensis Acropora valenciennesi Acropora valida Acropora variabilis Acropora variolosa Acropora vaughani Acropora vermiculata Acropora verweyi Acropora walindii Acropora wallaceae Acropora willisae Acropora yongei Agaricia agaricites Agaricia fragilis Agaricia grahamae Agaricia humilis Agaricia lamarcki Agaricia tenuifolia Agaricia undata Alveopora allingi Alveopora catalai Alveopora daedalea Alveopora excelsa Alveopora fenestrata Alveopora gigas Alveopora japonica Alveopora marionensis Alveopora minuta Alveopora ocellata Alveopora spongiosa Alveopora tizardi Alveopora verrilliana Alveopora viridis Anacropora forbesi Anacropora matthaii Anacropora pillai Anacropora puertogalerae Anacropora reticulata Anacropora spinosa Anacropora spumosa Anomastraea irregularis Astrangia poculata Astrea annuligera Astrea curta Astrea rotulosa Astreopora acroporina Astreopora cenderawasih Astreopora cucullata Astreopora expansa Astreopora gracilis Astreopora incrustans Astreopora listeri Astreopora longiseptata Astreopora macrostoma Astreopora montiporina Astreopora moretonensis Astreopora myriophthalma Astreopora ocellata Astreopora randalli Astreopora scabra Astreopora suggesta Australogyra zelli Australomussa rowleyensis Balanophyllia europaea Bernardpora stutchburyi Blastomussa loyae Blastomussa merleti Blastomussa vivida Blastomussa wellsi Boninastrea boninensis Calathiscus tantillus Cantharellus doederleini Cantharellus jebbi Cantharellus noumeae Catalaphyllia jardinei Caulastrea connata Caulastrea curvata Caulastrea echinulata Caulastrea furcata Caulastrea tumida Cladocora arbuscula Cladocora caespitosa Coeloseris mayeri Colpophyllia natans Coscinaraea columna Coscinaraea crassa Coscinaraea exesa Coscinaraea hahazimaensis Coscinaraea marshae Coscinaraea mcneilli Coscinaraea monile Coscinaraea wellsi Craterastrea levis Ctenactis albitentaculata Ctenactis crassa Ctenactis echinata Ctenella chagius Cycloseris boschmai Cycloseris colini Cycloseris costulata Cycloseris curvata Cycloseris cyclolites Cycloseris erosa Cycloseris hexagonalis Cycloseris patelliformis Cycloseris sinensis Cycloseris somervillei Cycloseris tenuis Cycloseris vaughani Cynarina lacrymalis Cyphastrea agassizi Cyphastrea chalcidicum Cyphastrea decadia Cyphastrea hexasepta Cyphastrea japonica Cyphastrea kausti Cyphastrea microphthalma Cyphastrea ocellina Cyphastrea serailia Dendrogyra cylindrus Diaseris distorta Diaseris fragilis Dichocoenia stokesi Diploastrea heliopora Diploria clivosa Diploria labyrinthiformis Diploria strigosa Duncanopsammia axifuga Echinomorpha nishihirai Echinophyllia aspera Echinophyllia costata Echinophyllia echinata Echinophyllia echinoporoides Echinophyllia orpheensis Echinophyllia patula Echinophyllia pectinata Echinophyllia tarae Echinopora ashmorensis Echinopora forskaliana Echinopora fruticulosa Echinopora gemmacea Echinopora hirsutissima Echinopora horrida Echinopora irregularis Echinopora lamellosa Echinopora mammiformis Echinopora pacificus Echinopora robusta Echinopora taylorae Echinopora tiranensis Erythrastrea flabellata Euphyllia ancora Euphyllia baliensis Euphyllia cristata Euphyllia divisa Euphyllia glabrescens Euphyllia paraancora Euphyllia paradivisa Euphyllia paraglabrescens Euphyllia yaeyamaensis Eusmilia fastigiata Favia albidus Favia amicorum Favia danai Favia favus Favia fragum Favia gravida Favia helianthoides Favia lacuna Favia laddi Favia laxa Favia leptophylla Favia lizardensis Favia maritima Favia marshae Favia matthaii Favia maxima Favia pallida Favia rosaria Favia rotumana Favi
643a rotundata Favia speciosa Favia stelligera Favia truncatus Favia veroni Favia vietnamensis Favia wisseli Favites abdita Favites acuticollis Favites bestae Favites chinensis Favites complanata Favites flexuosa Favites halicora Favites micropentagona Favites paraflexuosa Favites pentagona Favites russelli Favites spinosa Favites stylifera Favites vasta Fungia concinna Fungia corona Fungia danai Fungia fralinae Fungia fungites Fungia granulosa Fungia gravis Fungia horrida Fungia klunzingeri Fungia moluccensis Fungia paumotensis Fungia puishani Fungia repanda Fungia scabra Fungia scruposa Fungia scutaria Fungia seychellensis Fungia spinifer Fungia taiwanensis Galaxea acrhelia Galaxea astreata Galaxea cryptoramosa Galaxea fascicularis Galaxea horrescens Galaxea lawisiana Galaxea longisepta Galaxea paucisepta Gardineroseris planulata Goniastrea aspera Goniastrea australensis Goniastrea columella Goniastrea deformis Goniastrea edwardsi Goniastrea favulus Goniastrea minuta Goniastrea palauensis Goniastrea pectinata Goniastrea peresi Goniastrea ramosa Goniastrea retiformis Goniastrea thecata Goniopora albiconus Goniopora burgosi Goniopora cellulosa Goniopora ciliatus Goniopora columna Goniopora djiboutiensis Goniopora eclipsensis Goniopora fruticosa Goniopora lobata Goniopora minor Goniopora norfolkensis Goniopora palmensis Goniopora pandoraensis Goniopora pearsoni Goniopora pendulus Goniopora planulata Goniopora polyformis Goniopora savignyi Goniopora somaliensis Goniopora stokesi Goniopora sultani Goniopora tenuidens Gyrosmilia interrupta Halomitra clavator Halomitra meierae Halomitra pileus Heliofungia actiniformis Herpolitha limax Herpolitha weberi Heterocyathus aequicostatus Heteropsammia cochlea Heteropsammia moretonensis Horastrea indica Hydnophora bonsai Hydnophora exesa Hydnophora microconos Hydnophora pilosa Hydnophora rigida Indophyllia macassarensis Isophyllia rigida Isophyllia sinuosa Isopora brueggemanni Isopora crateriformis Isopora cuneata Isopora cylindrica Isopora elizabethensis Isopora palifera Isopora togianensis Leptastrea aequalis Leptastrea bewickensis Leptastrea bottae Leptastrea inaequalis Leptastrea pruinosa Leptastrea purpurea Leptastrea transversa Leptoria irregularis Leptoria phrygia Leptoseris amitoriensis Leptoseris cailleti Leptoseris cucullata Leptoseris explanata Leptoseris foliosa Leptoseris gardineri Leptoseris hawaiiensis Leptoseris incrustans Leptoseris kalayaanensis Leptoseris mycetoseroides Leptoseris papyracea Leptoseris scabra Leptoseris solida Leptoseris striata Leptoseris tubulifera Leptoseris yabei Lithophyllon lobata Lithophyllon mokai Lithophyllon undulatum Lobophyllia corymbosa Lobophyllia dentatus Lobophyllia diminuta Lobophyllia flabelliformis Lobophyllia hataii Lobophyllia hemprichii Lobophyllia pachysepta Lobophyllia robusta Lobophyllia serratus Madracis asanoi Madracis asperula Madracis carmabi Madracis decactis Madracis formosa Madracis kirbyi Madracis mirabilis Madracis pharensis Madracis senaria Manicina areolata Meandrina brasiliensis Meandrina danae Meandrina jacksoni Meandrina meandrites Merulina ampliata Merulina scabricula Merulina scheeri Micromussa amakusensis Micromussa diminuta Micromussa minuta Montastraea cavernosa Montigyra kenti Montipora aequituberculata Montipora altasepta Montipora angulata Montipora aspergillus Montipora australiensis Montipora bilaminata Montipora cactus Montipora caliculata Montipora capitata Montipora capricornis Montipora carinata Montipora cebuensis Montipora circumvallata Montipora confusa Montipora corbettensis Montipora crassituberculata Montipora cryptus Montipora danae Montipora delicatula Montipora digitata Montipora dilatata Montipora echinata Montipora efflorescens Montipora effusa Montipora flabellata Montipora florida Montipora floweri Montipora foliosa Montipora foveolata Montipora friabilis Montipora gaimardi Montipora grisea Montipora hemispherica Montipora hispida Montipora hodgsoni Montipora hoffmeisteri Montipora incrassata Montipora informis Montipora kellyi Montipora lobulata Montipora mactanensis Montipora malampaya Montipora meandrina Montipora millepora Montipora mollis Montipora monasteriata Montipora myriophthalma Montipora niugini Montipora nodosa Montipora orientalis Montipora pachytuberculata Montipora palawanensis Montipora patula Montipora peltiformis Montipora porites Montipora samarensis Montipora saudii Montipora setosa Montipora spongiosa Montipora spongodes Montipora spumosa Montipora stellata Montipora stilosa Montipora taiwanensis Montipora tuberculosa Montipora turgescens Montipora turtlensis Montipora undata Montipora venosa Montipora verrilli Montipora verrucosa Montipora verruculosus Montipora viet
643namensis Moseleya latistellata Mussa angulosa Mussismilia braziliensis Mussismilia harttii Mussismilia hispida Mycedium elephantotus Mycedium mancaoi Mycedium robokaki Mycedium steeni Mycedium umbra Mycetophyllia aliciae Mycetophyllia danaana Mycetophyllia ferox Mycetophyllia lamarckiana Mycetophyllia reesi Nemenzophyllia turbida Oculina diffusa Oculina patagonica Oculina robusta Oculina valenciennesi Oculina varicosa Orbicella annularis Orbicella faveolata Orbicella franksi Oulastrea crispata Oulophyllia bennettae Oulophyllia crispa Oulophyllia levis Oxypora convoluta Oxypora crassispinosa Oxypora egyptensis Oxypora glabra Oxypora lacera Pachyseris foliosa Pachyseris gemmae Pachyseris inattesa Pachyseris involuta Pachyseris rugosa Pachyseris speciosa Palauastrea ramosa Paraclavarina triangularis Paramontastraea salebrosa Paramontastraea serageldini Parascolymia australis Parascolymia vitiensis Parasimplastrea omanensis Pavona bipartita Pavona cactus Pavona chiriquiensis Pavona clavus Pavona danai Pavona decussata Pavona diffluens Pavona duerdeni Pavona explanulata Pavona frondifera Pavona gigantea Pavona maldivensis Pavona minuta Pavona varians Pavona venosa Pectinia africanus Pectinia alcicornis Pectinia ayleni Pectinia elongata Pectinia lactuca Pectinia maxima Pectinia paeonia Pectinia pygmaeus Pectinia teres Phymastrea colemani Phymastrea magnistellata Phymastrea multipunctata Phymastrea valenciennesi Physogyra lichtensteini Platygyra acuta Platygyra carnosus Platygyra contorta Platygyra crosslandi Platygyra daedalea Platygyra lamellina Platygyra pini Platygyra ryukyuensis Platygyra sinensis Platygyra verweyi Platygyra yaeyamaensis Plerogyra cauliformis Plerogyra discus Plerogyra simplex Plerogyra sinuosa Plesiastrea versipora Pocillopora acuta Pocillopora aliciae Pocillopora ankeli Pocillopora bairdi Pocillopora brevicornis Pocillopora capitata Pocillopora damicornis Pocillopora danae Pocillopora effusus Pocillopora elegans Pocillopora eydouxi Pocillopora fungiformis Pocillopora indiania Pocillopora kelleheri Pocillopora ligulata Pocillopora meandrina Pocillopora molokensis Pocillopora verrucosa Pocillopora woodjonesi Pocillopora zelli Podabacia crustacea Podabacia kunzmanni Podabacia lankaensis Podabacia motuporensis Podabacia sinai Polycyathus chaishanensis Polyphyllia novaehiberniae Polyphyllia talpina Porites annae Porites aranetai Porites arnaudi Porites astreoides Porites attenuata Porites australiensis Porites branneri Porites brighami Porites cocosensis Porites colonensis Porites columnaris Porites compressa Porites cumulatus Porites cylindrica Porites decasepta Porites deformis Porites densa Porites desilveri Porites divaricata Porites duerdeni Porites echinulata Porites eridani Porites evermanni Porites flavus Porites fontanesii Porites furcata Porites harrisoni Porites hawaiiensis Porites heronensis Porites horizontalata Porites latistellata Porites lichen Porites lobata Porites lutea Porites mayeri Porites monticulosa Porites murrayensis Porites myrmidonensis Porites napopora Porites negrosensis Porites nigrescens Porites nodifera Porites okinawensis Porites ornata Porites panamensis Porites porites Porites profundus Porites pukoensis Porites randalli Porites rugosa Porites rus Porites sillimaniana Porites solida Porites somaliensis Porites stephensoni Porites studeri Porites superfusa Porites sverdrupi Porites tuberculosa Porites vaughani Poritipora paliformis Psammocora albopicta Psammocora contigua Psammocora digitata Psammocora explanulata Psammocora haimiana Psammocora nierstraszi Psammocora obtusangula Psammocora profundacella Psammocora stellata Pseudosiderastrea formosa Pseudosiderastrea tayamai Sandalolitha africana Sandalolitha boucheti Sandalolitha dentata Sandalolitha robusta Scapophyllia cylindrica Schizoculina africana Schizoculina fissipara Sclerophyllia margariticola Sclerophyllia maxima Scolymia cubensis Seriatopora aculeata Seriatopora caliendrum Seriatopora dendritica Seriatopora guttatus Seriatopora hystrix Seriatopora stellata Siderastrea radians Siderastrea savignyana Siderastrea siderea Siderastrea stellata Simplastrea vesicularis Solenastrea bournoni Solenastrea hyades Stephanocoenia michelini Stylaraea punctata Stylocoeniella armata Stylocoeniella cocosensis Stylocoeniella guentheri Stylophora danae Stylophora kuehlmanni Stylophora madagascarensis Stylophora mamillata Stylophora pistillata Stylophora subseriata Stylophora wellsi Symphyllia agaricia Symphyllia erythraea Symphyllia hassi Symphyllia radians Symphyllia recta Symphyllia valenciennesi Symphyllia wilsoni Trachyphyllia geoffroyi Turbinaria bifrons Turbinaria conspicua Turbinaria frondens Turbinaria heronensis Turbinaria irregularis Turbinaria mesenterina Turbinaria patula Turbinaria peltata Turbinaria radicalis Turbinaria reniformis Turbinaria stellulata Zoopilus echinatus 644`,sD=new Set((tq.match(/\b[A-Z][a-z]+ [a-z]+\b/g)||[]).map(tD));sD.size;const sq=o=>sD.has(tD(o)),td=o=>o.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),P_=o=>o.trim().replace(/\s+/g," "),iq=o=>{const e=o<=1?o*100:o;return Math.max(0,Math.min(100,e))},iD=o=>
644!!(o&&!/^unresolved/i.test(o)&&!/^unknown$/i.test(o)),nD=o=>!!(iD(o)&&o.trim().split(/\s+/).length>=2),nq=o=>`https://www.marinespecies.org/aphia.php?p=taxlist&tName=${encodeURIComponent(P_(o))}`,rq=o=>{if(!nD(o))return null;if(sq(o)){const[e,t]=P_(o).split(/\s+/);return{label:"Factsheet",url:`https://www.coralsoftheworld.org/species_factsheets/species_factsheet_summary/${e.toLowerCase()}-${t.toLowerCase()}/`,title:"View on Corals of the World"}}return{label:"WoRMS",url:nq(o),title:`Search WoRMS for ${P_(o)}`}},aq=o=>`https://www.inaturalist.org/search?q=${encodeURIComponent(o)}`,oq=({confidence:o})=>{const e=je.useMemo(()=>{switch(o){case"High":return{bg:"bg-emerald-950/30",text:"text-emerald-300",ring:"ring-emerald-500/25"};case"Medium":return{bg:"bg-amber-950/30",text:"text-amber-300",ring:"ring-amber-500/25"};case"Low":return{bg:"bg-orange-950/30",text:"text-orange-300",ring:"ring-orange-500/25"};case"Very Low":return{bg:"bg-rose-950/30",text:"text-rose-300",ring:"ring-rose-500/25"};default:return{bg:"bg-slate-800/50",text:"text-slate-300",ring:"ring-slate-500/25"}}},[o]);return k.jsxs("span",{className:`inline-flex items-center rounded-full px-3 py-1 text-xs font-bold ${e.bg} ${e.text} ring-1 ring-inset ${e.ring} tracking-wide uppercase`,children:[o," Confidence"]})},lq=({status:o})=>{const e=je.useMemo(()=>{switch(o){case"Healthy":return{bg:"bg-emerald-950/30",text:"text-emerald-300",ring:"ring-emerald-500/25"};case"Stressed":return{bg:"bg-amber-950/30",text:"text-amber-300",ring:"ring-amber-500/25"};case"Diseased":return{bg:"bg-rose-950/30",text:"text-rose-300",ring:"ring-rose-500/25"};default:return{bg:"bg-slate-800/50",text:"text-slate-300",ring:"ring-slate-500/25"}}},[o]);return k.jsx("span",{className:`inline-flex items-center rounded-full px-3 py-1 text-xs font-bold ${e.bg} ${e.text} ring-1 ring-inset ${e.ring} tracking-wide uppercase`,children:o})},dR=({item:o})=>{const e=iq(o.probability),t=rq(o.name);return k.jsxs("div",{className:"w-full group",children:[k.jsxs("div",{className:"flex flex-wrap justify-between items-baseline gap-2 mb-2 text-sm",children:[k.jsxs("div",{className:"flex flex-wrap items-center gap-2 min-w-0",children:[k.jsx("span",{className:"font-bold text-slate-100 group-hover:text-white transition-colors break-words",children:o.name}),t&&k.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-sky-300 hover:text-sky-200 underline underline-offset-4",title:t.title,onClick:s=>s.stopPropagation(),children:t.label})]}),k.jsxs("span",{className:"font-mono text-slate-200 text-xs font-bold",children:[e.toFixed(1),"%"]})]}),k.jsx("div",{className:"w-full bg-slate-800/70 rounded-full h-3 overflow-hidden border border-slate-700/60",children:k.jsx("div",{className:"bg-sky-500 h-full rounded-full transition-all duration-1000 ease-out shadow-[0_0_10px_rgba(14,165,233,0.4)]",style:{width:`${e}%`}})}),o.reasoning&&k.jsx("p",{className:"mt-2 text-xs text-slate-400 pl-1 leading-relaxed font-medium",children:o.reasoning}),o.cautions&&o.cautions.length>0&&k.jsx("p",{className:"mt-1 text-xs text-amber-200/80 pl-1 leading-relaxed",children:o.cautions.slice(0,2).join(" ")})]})},uq=({analysis:o})=>{const e=o.top_3_genus||o.genus||[],t=o.top_3_species||o.species||[],s=je.useMemo(()=>{const d=t.filter(m=>nD(m.name)).slice(0,3).map(m=>m.name);if(d.length>0&&!o.abstain_species)return d;const p=e[0];return iD(p?.name)?[p.name]:["Scleractinia"]},[o.abstain_species,e,t]),[i,r]=je.useState(s[0]),l=o.diagnostic_features_seen?.slice(0,6)||[],u=o.diagnostic_features_missing?.slice(0,3)||[],h=o.photo_context;return mR.useEffect(()=>{r(d=>s.includes(d)?d:s[0])},[s]),k.jsx("div",{className:"relative group space-y-8",children:k.jsxs("div",{className:"relative bg-[#0f172a]/90 backdrop-blur-xl rounded-2xl p-6 md:p-8 border border-slate-700/50 space-y-8 shadow-[0_0_50px_rgba(14,165,233,0.15)]",children:[k.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 border-b border-slate-800 pb-6",children:[k.jsxs("div",{children:[k.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-white tracking-tight",children:"Analysis Report"}),o.abstain_species&&k.jsx("p",{className:"mt-2 text-sm text-amber-200/80",children:"Species-level evidence is limited in this photo set."})]}),k.jsx(oq,{confidence:o.confidence})]}),k.jsxs("div",{className:"space-y-5",children:[k.jsx("p",{className:"text-slate-200 leading-relaxed text-base font-medium",children:o.summary}),h&&k.jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[k.jsxs("div",{className:"rounded-xl border border-slate-700/60 bg-slate-900/45 p-4",children:[k.jsx("p",{className:"text-[11px] uppercase tracking-wider text-slate-500 font-bold",children:"Photo Read"}),k.jsx("p",{className:"mt-1 text-sm text-slate-200 font-semibold",children:td(h.photo_scale)})]}),k.jsxs("div",{className:"rounded-xl border border-slate-700/60 bg-slate-900/45 p-4",children:[k.jsx("p",{className:"text-[11px] uppercase tracking-wider text-slate-500 font-bold",children:"Lighting"}),k.jsx("p",{className:"mt-1 text-sm text-slate-200 font-semibold",children:td(h.lighting)})]}),k.jsxs("div",{className:"rounded-xl border border-slate-700/60 bg-slate-900/45 p-4",children:[k.jsx("p",{className:"text-[11px] uppercase tracking-wider text-slate-500 font-bold",children:"Color Reliability"}),k.jsx("p",{className:"mt-1 text-sm text-slate-200 font-semibold",children:td(h.color_reliability)})]})]})]}),l.length>0&&k.jsxs("div",{className:"space-y-3",children:[k.jsx("h3",{className:"text-sm font-bold text-slate-100 uppercase tracking-wide",children:"Visible Clues"}),k.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(d=>k.jsx("span",{className:"rounded-full bg-sky-950/40 text-sky-100 ring-1 ring-sky-500/20 px-3 py-1 text-xs font-semibold",children:d},d))})]}),k.jsxs("div",{className:"grid md:grid-cols-2 gap-10 pt-2",children:[k.jsxs("div",{className:"space-y-6",children:[k.jsx("h3",{className:"text-lg font-bold text-slate-100 uppercase tracking-wide border-b border-slate-800/50 pb-2",children:"Genus Predictions"}),k.jsx("div",{className:"space-y-5",children:e.map(d=>k.jsx(dR,{item:d},d.name))})]}),k.jsxs("div",{className:"space-y-6",children:[k.jsx("h3",{className:"text-lg font-bold text-slate-100 uppercase tracking-wide border-b border-slate-800/50 pb-2",children:"Species Predictions"}),k.jsx("div",{className:"space-y-5",children:t.map(d=>k.jsx(dR,{item:d},d.name))})]})]}),(u.length>0||o.recommended_next_photo)&&k.jsxs("div",{className:"rounded-xl border border-amber-500/15 bg-amber-950/15 p-5 space-y-3",children:[u.length>0&&k.jsxs("p",{className:"text-sm text-amber-100/85 leading-relaxed",children:["Missing evidence: ",u.join(", "),"."]}),o.recommended_next_photo&&k.jsxs("p",{className:"text-sm text-slate-200 leading-relaxed",children:["Best next p
644hoto: ",o.recommended_next_photo]})]}),k.jsxs("div",{className:"grid md:grid-cols-2 gap-6 pt-6 border-t border-slate-800",children:[k.jsxs("div",{className:"bg-slate-800/40 rounded-xl p-6 border border-slate-700/50 relative overflow-hidden",children:[k.jsx("div",{className:"absolute top-0 left-0 w-1 h-full bg-emerald-500/50"}),k.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[k.jsx("h3",{className:"text-base font-bold text-slate-100 uppercase tracking-wide pl-2",children:"Health Status"}),k.jsx(lq,{status:o.healthAssessment.status})]}),o.healthAssessment.indicators&&o.healthAssessment.indicators.length>0?k.jsx("ul",{className:"space-y-3 pl-2",children:o.healthAssessment.indicators.map(d=>k.jsxs("li",{className:"text-sm text-slate-300 flex items-start gap-3 font-medium",children:[k.jsx("span",{className:"mt-1.5 w-1.5 h-1.5 rounded-full bg-emerald-400 shadow-[0_0_5px_rgba(52,211,153,0.5)]"}),k.jsx("span",{children:d})]},d))}):k.jsx("p",{className:"text-sm text-slate-500 italic font-medium pl-2",children:"No specific indicators detected."})]}),k.jsxs("div",{className:"bg-slate-800/40 rounded-xl p-6 border border-slate-700/50 relative overflow-hidden",children:[k.jsx("div",{className:"absolute top-0 left-0 w-1 h-full bg-sky-500/50"}),k.jsx("h3",{className:"text-base font-bold text-slate-100 uppercase tracking-wide mb-3 pl-2",children:"Growth Form"}),k.jsx("p",{className:"text-slate-300 text-sm leading-relaxed font-medium pl-2",children:td(o.growthForm||"Unknown")}),o.ecological_plausibility?.notes&&k.jsx("p",{className:"mt-4 text-xs text-slate-400 leading-relaxed pl-2",children:o.ecological_plausibility.notes})]})]}),o.differential_diagnosis&&o.differential_diagnosis.length>0&&k.jsxs("div",{className:"space-y-3",children:[k.jsx("h3",{className:"text-sm font-bold text-slate-100 uppercase tracking-wide",children:"How This Was Told Apart"}),k.jsx("div",{className:"space-y-2",children:o.differential_diagnosis.slice(0,3).map(d=>k.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/40 p-4",children:[k.jsxs("p",{className:"text-sm text-slate-200 leading-relaxed",children:[k.jsx("span",{className:"font-semibold text-slate-100",children:d.taxon}),d.nearest_lookalike&&k.jsxs("span",{className:"text-slate-400",children:[" vs. ",d.nearest_lookalike]})," â ",d.discriminating_feature]}),k.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[k.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-[11px] font-bold uppercase tracking-wide ring-1 ring-inset ${d.feature_visible==="visible"?"bg-emerald-950/30 text-emerald-300 ring-emerald-500/25":d.feature_visible==="partially_visible"?"bg-amber-950/30 text-amber-300 ring-amber-500/25":"bg-rose-950/30 text-rose-300 ring-rose-500/25"}`,children:td(d.feature_visible)}),d.resolution_note&&k.jsx("span",{className:"text-xs text-slate-400 leading-relaxed",children:d.resolution_note})]})]},`${d.taxon}-${d.nearest_lookalike}`))})]}),o.lookalikes&&o.lookalikes.length>0&&k.jsxs("div",{className:"space-y-3",children:[k.jsx("h3",{className:"text-sm font-bold text-slate-100 uppercase tracking-wide",children:"Similar Possibilities"}),k.jsx("div",{className:"space-y-2",children:o.lookalikes.slice(0,3).map(d=>k.jsxs("p",{className:"text-sm text-slate-300 leading-relaxed",children:[k.jsxs("span",{className:"font-semibold text-slate-100",children:[d.name,":"]})," ",d.reason]},d.name))})]}),k.jsxs("div",{className:"pt-6 border-t border-slate-800 flex flex-col sm:flex-row items-center justify-between gap-4",children:[k.jsxs("label",{className:"flex flex-col sm:flex-row sm:items-center gap-2 text-sm text-slate-400",children:[k.jsx("span",{children:"Community Reference:"}),k.jsx("select",{value:i,onChange:d=>r(d.target.value),className:"min-w-0 rounded-lg border border-slate-700 bg-slate-900/80 px-3 py-2 text-sm font-semibold text-slate-100 focus:border-sky-400 focus:outline-none focus:ring-2 focus:ring-sky-500/30",children:s.map(d=>k.jsx("option",{value:d,children:d},d))})]}),k.jsx("a",{href:aq(i),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-3 px-6 py-3 bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-500 hover:to-teal-500 text-white font-bold rounded-xl shadow-lg hover:shadow-emerald-500/20 transition-all transform hover:-translate-y-0.5",children:"Search iNaturalist"})]})]})})},cq=({message:o,type:e,onClose:t})=>{je.useEffect(()=>{const i=setTimeout(()=>{t()},5e3);return()=>clearTimeout(i)},[t]);const s={error:"bg-red-500/10 border-red-500/20 text-red-400",success:"bg-green-500/10 border-green-500/20 text-green-400",info:"bg-blue-500/10 border-blue-500/20 text-blue-400"};return k.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-3 rounded-xl border backdrop-blur-md shadow-xl animate-fade-in-down ${s[e]}`,children:k.jsxs("div",{className:"flex items-center gap-3",children:[k.jsx("span",{children:o}),k.jsx("button",{onClick:t,className:"hover:opacity-70 transition-opacity",children:"Ã"})]})})},fR={"248,118,109":"Australia","216,144,0":"Brazil","163,165,0":"Caribbean","57,182,0":"East Asia","0,191,125":"ETP (Eastern Tro
644pical Pacific)","0,191,196":"Pacific","0,176,246":"PERSGA (Red Sea)","149,144,255":"ROPME (Persian Gulf)","231,107,243":"South Asia","255,98,188":"WIO (Western Indian Ocean)"},hq=({onSelect:o,selectedRegion:e})=>{const t=je.useRef(null),s=je.useRef(null),i=je.useRef(null),[r,l]=je.useState(null),[u,h]=je.useState(!1),d=je.useRef(null),p=L=>{const U=Object.entries(fR).find(([,R])=>R===L);return U?`rgb(${U[0]})`:"#0284c7"},m=je.useCallback(()=>{const L=t.current,U=L?.getContext("2d",{willReadFrequently:!0}),R=d.current,V=i.current;if(!L||!U||!R||!V)return;const $=R.width/R.height,ie=V.clientWidth,le=ie/$;L.width=ie,L.height=le,U.drawImage(R,0,0,ie,le),s.current&&(s.current.width=ie,s.current.height=le)},[]);je.useEffect(()=>{const L=new Image;L.src="/images/regions-map.png",L.onload=()=>{d.current=L,h(!0),m()}},[m]),je.useEffect(()=>(u&&m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)),[m,u]);const y=(L,U,R,V,$,ie,le=30)=>Math.abs(L-V)<le&&Math.abs(U-$)<le&&Math.abs(R-ie)<le,b=(L,U,R)=>{for(const[V,$]of Object.entries(fR)){const[ie,le,ye]=V.split(",").map(Number);if(y(L,U,R,ie,le,ye))return $}return null},_=(L,U)=>{const R=t.current,V=R?.getContext("2d",{willReadFrequently:!0});if(!R||!V)return null;const $=R.getBoundingClientRect(),ie=Math.floor(L-$.left),le=Math.floor(U-$.top),ye=R.width/$.width,xe=R.height/$.height,Ne=Math.max(0,Math.min(R.width-1,Math.floor(ie*ye))),ce=Math.max(0,Math.min(R.height-1,Math.floor(le*xe))),X=V.getImageData(Ne,ce,1,1).data;return{region:b(X[0],X[1],X[2]),r:X[0],g:X[1],b:X[2]}},v=(L,U,R)=>{const V=t.current,$=s.current,ie=V?.getContext("2d",{willReadFrequently:!0}),le=$?.getContext("2d");if(!V||!ie||!$||!le)return;const ye=V.width,xe=V.height;le.clearRect(0,0,ye,xe);const ce=ie.getImageData(0,0,ye,xe).data,X=le.createImageData(ye,xe),ne=X.data;for(let fe=0;fe<ce.length;fe+=4)y(ce[fe],ce[fe+1],ce[fe+2],L,U,R,30)&&(ne[fe]=255,ne[fe+1]=255,ne[fe+2]=255,ne[fe+3]=120);le.putImageData(X,0,0)},M=()=>{const L=s.current,U=L?.getContext("2d");L&&U&&U.clearRect(0,0,L.width,L.height)},A=L=>{const U=_(L.clientX,L.clientY);U&&(l(U.region||null),U.region?v(U.r,U.g,U.b):M())},C=L=>{const U=_(L.clientX,L.clientY);U?.region&&o(U.region)},E=L=>{L.preventDefault()},F=L=>{L.preventDefault();const U=L.changedTouches[0];if(!U)return;const R=_(U.clientX,U.clientY);R?.region&&o(R.region),l(null),M()};return k.jsxs("div",{ref:i,className:"relative w-full max-w-4xl mx-auto rounded-2xl overflow-hidden shadow-2xl border border-slate-700/50 bg-[#0f172a] group",children:[k.jsx("canvas",{ref:t,onMouseMove:A,onClick:C,onTouchStart:E,onTouchEnd:F,onMouseLeave:()=>{l(null),M()},className:"w-full h-auto cursor-crosshair relative z-10 touch-none"}),k.jsx("canvas",{ref:s,className:"absolute inset-0 w-full h-full pointer-events-none z-20 mix-blend-overlay filter blur-sm transition-opacity duration-300"}),r&&k.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 bg-black/80 backdrop-blur text-white px-4 py-2 rounded-full text-sm font-bold pointer-events-none z-30 border border-white/20 shadow-xl animate-fade-in whitespace-nowrap",children:r}),e&&k.jsxs("div",{className:"absolute bottom-4 right-4 text-white px-4 py-2 rounded-xl text-sm font-bold shadow-lg z-30 flex items-center gap-2 animate-slide-up transition-colors duration-300",style:{backgroundColor:p(e)},children:[k.jsx("span",{className:"w-2 h-2 rounded-full bg-white animate-pulse"}),e]})]})},dq=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,V_=["Unknown","0-5m","5-10m","10-15m","15-20m","20-25m","25-30m","30-35m","35-40m","40-45m","45-50m","50m+"],fq=o=>o,pq=o=>Math.max(0,V_.indexOf(o)),mq=({url:o,index:e,analysis:t,location:s,markerStatus:i})=>{const r=(t.diagnosticMarkers||[]).filter(l=>typeof l.imageIndex=="number"?l.imageIndex===e:e===0);return k.jsxs("div",{className:"relative group rounded-2xl overflow-hidden shadow-2xl border border-slate-700/50 bg-[#0f172a]",children:[k.jsx("img",{src:o,alt:`Uploaded coral ${e+1}`,className:"w-full h-auto object-cover"}),r.map((l,u)=>k.jsxs("div",{className:"absolute z-30 group/marker",style:{left:`${l.coordinates.x}%`,top:`${l.coordinates.y}%`},children:[k.jsx("button",{type:"button","aria-label":l.label,className:`block w-5 h-5 -ml-2.5 -mt-2.5 rounded-full border-2 border-white shadow-[0_0_12px_rgba(0,0,0,0.65)] ${l.type==="arrow"?"bg-sky-500":"bg-emerald-500"} animate-pulse focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-slate-950`}),k.jsx("div",{className:"absolute left-7 top-1/2 -translate-y-1/2 bg-slate-950/95 text-white text-xs font-bold px-2 py-1 rounded border border-slate-600 whitespace-nowrap opacity-0 group-hover/marker:
644opacity-100 group-focus-within/marker:opacity-100 transition-opacity pointer-events-none z-40 shadow-xl",children:l.label}),l.type==="arrow"&&k.jsx("svg",{className:"absolute top-0 left-0 w-8 h-8 -ml-1 -mt-1 pointer-events-none overflow-visible","aria-hidden":"true",children:k.jsx("line",{x1:"0",y1:"0",x2:"20",y2:"20",stroke:"white",strokeWidth:"2"})})]},`${l.label}-${e}-${u}`)),k.jsx("div",{className:"absolute inset-0 z-10 bg-gradient-to-t from-[#020617]/85 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 flex items-end p-4 pointer-events-none",children:k.jsxs("p",{className:"text-slate-200 font-medium flex items-center gap-2 text-sm",children:[k.jsx("span",{className:"w-2 h-2 rounded-full bg-sky-400"}),s," - Image ",e+1]})}),i==="pending"&&r.length===0&&k.jsx("div",{className:"absolute bottom-3 left-3 z-20 rounded-full bg-slate-950/80 border border-slate-700/70 px-3 py-1 text-xs font-semibold text-sky-100 shadow-lg",children:"Locating clues..."})]})};function gq(){const[o,e]=je.useState([]),[t,s]=je.useState([]),[i,r]=je.useState(""),[l,u]=je.useState("Unknown"),[h,d]=je.useState("fast"),[p,m]=je.useState(null),[y,b]=je.useState(!1),[_,v]=je.useState("skipped"),[M,A]=je.useState(null),[C,E]=je.useState(null),F=je.useRef(null);je.useEffect(()=>{const V=localStorage.getItem("coral_analysis"),$=localStorage.getItem("coral_location");if(V)try{m(JSON.parse(V))}catch{console.error("Failed to parse saved analysis")}$&&r($)},[]),je.useEffect(()=>{p?localStorage.setItem("coral_analysis",JSON.stringify(p)):localStorage.removeItem("coral_analysis")},[p]),je.useEffect(()=>{i&&localStorage.setItem("coral_location",i)},[i]),je.useEffect(()=>()=>{t.forEach(V=>URL.revokeObjectURL(V))},[t]);const L=je.useCallback((V=!0)=>{F.current=null,e([]),s($=>($.forEach(ie=>URL.revokeObjectURL(ie)),[])),m(null),A(null),v("skipped"),b(!1),V&&(r(""),localStorage.removeItem("coral_location")),localStorage.removeItem("coral_analysis")},[]),U=je.useCallback(V=>{y||(L(!1),e(V),s(V.map($=>URL.createObjectURL($))))},[L,y]),R=je.useCallback(async()=>{if(o.length===0||!i){E({message:"Please provide at least one image and a location.",type:"error"});return}const V=dq();F.current=V,b(!0),A(null),v("skipped"),E(null);try{const $=await IF(o,i,l,V,h);if(F.current!==V)return;const ie={...$,diagnosticMarkers:[],analysis_metadata:{...$.analysis_metadata,analysis_request_id:V,marker_status:"pending"}};m(ie),b(!1),v("pending"),E({message:"Analysis complete!",type:"success"});const le=await HF(o,i,l,ie,V);if(F.current!==V)return;const ye=le.marker_metadata?.schema_status==="valid";m(xe=>!xe||xe.analysis_metadata.analysis_request_id!==V?xe:{...xe,diagnosticMarkers:le.diagnosticMarkers||[],marker_metadata:le.marker_metadata,analysis_metadata:{...xe.analysis_metadata,marker_status:ye?"complete":"failed",marker_prompt_hash:le.marker_metadata?.prompt_hash,marker_model:le.marker_metadata?.marker_model||le.marker_metadata?.model,marker_retry_count:le.marker_metadata?.marker_retry_count||le.marker_metadata?.retry_count||0,marker_schema_status:le.marker_metadata?.schema_status}}),v(ye?"complete":"failed")}catch($){if(F.current!==V)return;const ie=$.message||"An unknown error occurred.";A(ie),E({message:ie,type:"error"}),v("failed"),b(!1)}},[o,i,l,h]);return k.jsxs("div",{className:"min-h-screen relative text-slate-100 overflow-x-hidden font-sans",children:[k.jsx(JH,{}),C&&k.jsx(cq,{message:C.message,type:C.type,onClose:()=>E(null)}),k.jsx("img",{src:"/reef-logo.png",alt:"REEF Scuba",className:"fixed top-4 left-4 h-14 md:h-16 drop-shadow-lg op
644acity-80 hover:opacity-100 transition-opacity z-20"}),k.jsxs("div",{className:"relative z-10 container mx-auto px-4 pt-8 pb-8",children:[k.jsxs("header",{className:"text-center mb-12",children:[k.jsx("img",{src:"/images/coral-vision-title.png",alt:"Coral Vision",className:"mx-auto h-28 md:h-36 drop-shadow-2xl animate-fade-in"}),k.jsx("h1",{className:"sr-only",children:"Coral Vision"})]}),k.jsx("main",{className:`max-w-6xl mx-auto transition-all duration-500 ${p?"max-w-7xl":"max-w-4xl"}`,children:t.length===0&&!p?k.jsx("div",{className:"space-y-6 animate-fade-in",children:k.jsx(eq,{onImagesUpload:U,disabled:y})}):k.jsxs("div",{className:"space-y-8",children:[!p&&!y&&t.length>0&&k.jsxs("div",{className:"relative group max-w-2xl mx-auto animate-fade-in",children:[k.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-blue-600 to-indigo-600 rounded-2xl opacity-20 group-hover:opacity-30 blur transition duration-500"}),k.jsxs("div",{className:"relative bg-[#0f172a]/80 backdrop-blur-xl rounded-2xl p-6 border border-slate-700/50 shadow-2xl",children:[k.jsxs("button",{onClick:()=>L(!1),className:"absolute top-4 right-4 p-2 rounded-full bg-slate-800/50 hover:bg-slate-700 text-slate-400 hover:text-white transition-colors z-10",children:[k.jsx("span",{className:"sr-only",children:"Reset"}),"Ã"]}),k.jsxs("div",{className:"space-y-6",children:[k.jsx("div",{className:"grid grid-cols-3 gap-4",children:t.map((V,$)=>k.jsx("div",{className:"rounded-xl overflow-hidden shadow-lg border border-slate-700/50 aspect-square",children:k.jsx("img",{src:V,alt:`Uploaded coral ${$+1}`,className:"w-full h-full object-cover"})},V))}),k.jsxs("div",{className:"space-y-4",children:[k.jsxs("div",{className:"space-y-2",children:[k.jsx("label",{className:"block text-sm font-medium text-slate-300",children:"1. Select Location"}),k.jsx(hq,{onSelect:V=>r(V),selectedRegion:i})]}),k.jsxs("div",{className:"bg-slate-800/50 rounded-xl p-4 border border-slate-700/50 space-y-4",children:[k.jsxs("label",{className:"block text-sm font-medium text-slate-300",children:["2. Approximate Depth: ",k.jsx("span",{className:"text-sky-400 font-bold",children:fq(l)})]}),k.jsx("input",{type:"range",min:"0",max:V_.length-1,step:"1",value:pq(l),onChange:V=>{const $=parseInt(V.target.value,10);u(V_[$]||"Unknown")},className:"w-full h-2 bg-slate-700 rounded-lg appearance-none cursor-pointer accent-sky-500"}),k.jsxs("div",{className:"flex justify-between text-xs text-slate-500 font-mono",children:[k.jsx("span",{children:"Unknown"}),k.jsx("span",{children:"25m"}),k.jsx("span",{children:"50m+"})]})]}),k.jsxs("div",{className:"bg-slate-800/50 rounded-xl p-4 border border-slate-700/50 space-y-3",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("label",{className:"block text-sm font-medium text-slate-300",children:"3. Analysis Mode"}),k.jsxs("span",{className:"relative group/tip inline-flex",children:[k.jsx("button",{type:"button","aria-label":"What do the analysis modes do?",className:"flex h-4 w-4 items-center justify-center rounded-full border border-slate-500 text-[10px] font-bold text-slate-300 hover:border-sky-400 hover:text-sky-300 focus:outline-none focus:ring-2 focus:ring-sky-500/40",children:"i"}),k.jsxs("span",{role:"tooltip",className:"pointer-events-none absolute left-1/2 top-6 z-50 w-72 -translate-x-1/2 rounded-lg border border-slate-600 bg-slate-950/95 p-3 text-left text-xs leading-relaxed text-slate-200 opacity-0 shadow-2xl transition-opacity duration-200 group-hover/tip:opacity-100 group-focus-within/tip:opacity-100",children:[k.jsx("span",{className:"block font-bold text-slate-100",children:"Fast"}),k.jsx("span",{className:"block text-slate-400",children:"Quick pass on the standard model. Best for clear colony shots and casual IDs."}),k.jsx("span",{className:"mt-2 block font-bold text-slate-100",children:"Careful (Accurate)"}),k.jsx("span",{className:"block text-slate-400",children:"Leads with the higher-capability model and sends an extra magnified crop of your photo to read corallite-scale detail. Slower and more costly, but the best shot at a defensible species-level ID."})]})]})]}),k.jsx("div",{className:"grid grid-cols-2 gap-2",role:"radiogroup","aria-label":"Analysis mode",children:[{key:"fast",label:"Fast",sub:"Quick pass"},{key:"accurate",label:"Careful",sub:"Best accuracy"}
644].map(V=>{const $=h===V.key;return k.jsxs("button",{type:"button",role:"radio","aria-checked":$,title:V.key==="accurate"?"Careful mode: higher-capability model + magnified corallite crop for the strongest species-level ID (slower, higher cost).":"Fast mode: quick pass on the standard model.",onClick:()=>d(V.key),className:`rounded-lg border px-3 py-2 text-sm font-semibold transition-all ${$?"border-sky-400 bg-sky-500/15 text-sky-100 shadow-[0_0_12px_rgba(14,165,233,0.25)]":"border-slate-700 bg-slate-900/60 text-slate-300 hover:border-slate-500 hover:text-white"}`,children:[k.jsx("span",{className:"block",children:V.label}),k.jsx("span",{className:`block text-[11px] font-normal ${$?"text-sky-200/80":"text-slate-500"}`,children:V.sub})]},V.key)})})]}),M&&k.jsxs("div",{className:"rounded-xl border border-rose-500/25 bg-rose-950/20 p-4 space-y-3",children:[k.jsx("p",{className:"text-sm text-rose-100 leading-relaxed",children:M}),k.jsx("button",{type:"button",onClick:R,disabled:!i||y,className:"inline-flex items-center justify-center rounded-lg bg-rose-500/20 hover:bg-rose-500/30 border border-rose-400/30 px-4 py-2 text-sm font-bold text-rose-50 transition-colors disabled:opacity-50",children:"Retry Analysis"})]}),k.jsxs("button",{onClick:R,disabled:!i||y,className:"w-full flex items-center justify-center gap-2 px-6 py-4 bg-gradient-to-r from-sky-600 to-blue-700 hover:from-sky-500 hover:to-blue-600 text-white font-semibold rounded-xl shadow-lg hover:shadow-sky-900/20 transition-all duration-300 disabled:opacity-50 disabled:cursor-not-allowed transform hover:-translate-y-0.5 mt-6",children:[k.jsx($F,{className:"w-5 h-5"})," Identify Coral"]})]})]})]})]}),y&&k.jsxs("div",{className:"flex flex-col items-center justify-center py-20 space-y-8 animate-fade-in",children:[k.jsx(XF,{className:"w-40 h-40 text-sky-400"}),k.jsxs("div",{className:"text-center space-y-3",children:[k.jsx("h3",{className:"text-2xl font-light text-slate-100 tracking-wide",children:"Analyzing Coral Structure"}),k.jsx("p",{className:"text-slate-400 text-sm font-mono uppercase tracking-widest",children:"Consulting Knowledge Base"})]})]}),p&&!y&&k.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-8 items-start animate-fade-in-up",children:[k.jsxs("div",{className:"lg:col-span-5 lg:sticky lg:top-8 space-y-6",children:[k.jsx("div",{className:"space-y-4",children:t.map((V,$)=>k.jsx(mq,{url:V,index:$,analysis:p,location:i,markerStatus:_},V))}),k.jsxs("button",{onClick:()=>L(!1),className:"w-full py-4 px-6 bg-[#1e293b]/50 hover:bg-[#1e293b] text-slate-300 hover:text-white rounded-xl border border-slate-700/50 hover:border-slate-600 transition-all duration-200 flex items-center justify-center gap-2 text-sm font-medium group",children:[k.jsx(WF,{className:"w-4 h-4 group-hover:rotate-180 transition-transform duration-500"})," Upload New Images"]})]}),k.jsx("div",{className:"lg:col-span-7 space-y-6",children:k.jsx(uq,{analysis:p,onReset:()=>L(!1)})})]})]})})]})]})}const rD=document.getElementById("root");if(!rD)throw new Error("Could not find root element to mount to");const yq=OF.createRoot(rD);yq.render(k.jsx(mR.StrictMode,{children:k.jsx(gq,{})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.