function EO(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function mu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qC={exports:{}},Ug={},ZC={exports:{}},Gt={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var zd=Symbol.for("react.element"),MO=Symbol.for("react.portal"),bO=Symbol.for("react.fragment"),TO=Symbol.for("react.strict_mode"),AO=Symbol.for("react.profiler"),CO=Symbol.for("react.provider"),RO=Symbol.for("react.context"),PO=Symbol.for("react.forward_ref"),IO=Symbol.for("react.suspense"),LO=Symbol.for("react.memo"),DO=Symbol.for("react.lazy"),MM=Symbol.iterator;function OO(t){return t===null||typeof t!="object"?null:(t=MM&&t[MM]||t["@@iterator"],typeof t=="function"?t:null)}var KC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},JC=Object.assign,QC={};function gu(t,e,n){this.props=t,this.context=e,this.refs=QC,this.updater=n||KC}gu.prototype.isReactComponent={};gu.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};gu.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function e2(){}e2.prototype=gu.prototype;function C1(t,e,n){this.props=t,this.context=e,this.refs=QC,this.updater=n||KC}var R1=C1.prototype=new e2;R1.constructor=C1;JC(R1,gu.prototype);R1.isPureReactComponent=!0;var bM=Array.isArray,t2=Object.prototype.hasOwnProperty,P1={current:null},n2={key:!0,ref:!0,__self:!0,__source:!0};function r2(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)t2.call(e,r)&&!n2.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,Z=F[H];if(0>>1;Hi(Ee,j))Sei(We,Ee)?(F[H]=We,F[Se]=j,H=Se):(F[H]=Ee,F[xe]=j,H=xe);else if(Sei(We,j))F[H]=We,F[Se]=j,H=Se;else break e}}return $}function i(F,$){var j=F.sortIndex-$.sortIndex;return j!==0?j:F.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var l=[],u=[],d=1,h=null,p=3,g=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(F){for(var $=n(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=F)r(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=n(u)}}function M(F){if(w=!1,S(F),!y)if(n(l)!==null)y=!0,J(T);else{var $=n(u);$!==null&&se(M,$.startTime-F)}}function T(F,$){y=!1,w&&(w=!1,m(O),O=-1),g=!0;var j=p;try{for(S($),h=n(l);h!==null&&(!(h.expirationTime>$)||F&&!k());){var H=h.callback;if(typeof H=="function"){h.callback=null,p=h.priorityLevel;var Z=H(h.expirationTime<=$);$=t.unstable_now(),typeof Z=="function"?h.callback=Z:h===n(l)&&r(l),S($)}else r(l);h=n(l)}if(h!==null)var ge=!0;else{var xe=n(u);xe!==null&&se(M,xe.startTime-$),ge=!1}return ge}finally{h=null,p=j,g=!1}}var A=!1,R=null,O=-1,C=5,P=-1;function k(){return!(t.unstable_now()-PF||125H?(F.sortIndex=j,e(u,F),n(l)===null&&F===n(u)&&(w?(m(O),O=-1):w=!0,se(M,j-H))):(F.sortIndex=Z,e(l,F),y||g||(y=!0,J(T))),F},t.unstable_shouldYield=k,t.unstable_wrapCallback=function(F){var $=p;return function(){var j=p;p=$;try{return F.apply(this,arguments)}finally{p=j}}}})(a2);s2.exports=a2;var jO=s2.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var l2=L,Ei=jO;function ze(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g_=Object.prototype.hasOwnProperty,XO=/^[: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]*$/,AM={},CM={};function YO(t){return g_.call(CM,t)?!0:g_.call(AM,t)?!1:XO.test(t)?CM[t]=!0:(AM[t]=!0,!1)}function qO(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function ZO(t,e,n,r){if(e===null||typeof e>"u"||qO(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function jr(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var gr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){gr[t]=new jr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];gr[e]=new jr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){gr[t]=new jr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){gr[t]=new jr(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){gr[t]=new jr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){gr[t]=new jr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){gr[t]=new jr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){gr[t]=new jr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){gr[t]=new jr(t,5,!1,t.toLowerCase(),null,!1,!1)});var L1=/[\-:]([a-z])/g;function D1(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(L1,D1);gr[e]=new jr(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(L1,D1);gr[e]=new jr(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(L1,D1);gr[e]=new jr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){gr[t]=new jr(t,1,!1,t.toLowerCase(),null,!1,!1)});gr.xlinkHref=new jr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){gr[t]=new jr(t,1,!1,t.toLowerCase(),null,!0,!0)});function O1(t,e,n,r){var i=gr.hasOwnProperty(e)?gr[e]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` `+i[s].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{Hv=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?wf(t):""}function KO(t){switch(t.tag){case 5:return wf(t.type);case 16:return wf("Lazy");case 13:return wf("Suspense");case 19:return wf("SuspenseList");case 0:case 2:case 15:return t=Vv(t.type,!1),t;case 11:return t=Vv(t.type.render,!1),t;case 1:return t=Vv(t.type,!0),t;default:return""}}function x_(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Rc:return"Fragment";case Cc:return"Portal";case v_:return"Profiler";case N1:return"StrictMode";case y_:return"Suspense";case __:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case f2:return(t.displayName||"Context")+".Consumer";case u2:return(t._context.displayName||"Context")+".Provider";case k1:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case U1:return e=t.displayName||null,e!==null?e:x_(t.type)||"Memo";case Ys:e=t._payload,t=t._init;try{return x_(t(e))}catch{}}return null}function JO(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return x_(e);case 8:return e===N1?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function ma(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function h2(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function QO(t){var e=h2(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function cp(t){t._valueTracker||(t._valueTracker=QO(t))}function p2(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=h2(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function jm(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function S_(t,e){var n=e.checked;return On({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function PM(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=ma(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function m2(t,e){e=e.checked,e!=null&&O1(t,"checked",e,!1)}function w_(t,e){m2(t,e);var n=ma(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?E_(t,e.type,n):e.hasOwnProperty("defaultValue")&&E_(t,e.type,ma(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function IM(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function E_(t,e,n){(e!=="number"||jm(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ef=Array.isArray;function jc(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=up.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function qf(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Rf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},eN=["Webkit","ms","Moz","O"];Object.keys(Rf).forEach(function(t){eN.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Rf[e]=Rf[t]})});function _2(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Rf.hasOwnProperty(t)&&Rf[t]?(""+e).trim():e+"px"}function x2(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=_2(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var tN=On({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function T_(t,e){if(e){if(tN[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ze(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ze(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ze(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ze(62))}}function A_(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 C_=null;function F1(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var R_=null,Xc=null,Yc=null;function OM(t){if(t=Vd(t)){if(typeof R_!="function")throw Error(ze(280));var e=t.stateNode;e&&(e=Vg(e),R_(t.stateNode,t.type,e))}}function S2(t){Xc?Yc?Yc.push(t):Yc=[t]:Xc=t}function w2(){if(Xc){var t=Xc,e=Yc;if(Yc=Xc=null,OM(t),e)for(t=0;t>>=0,t===0?32:31-(dN(t)/hN|0)|0}var fp=64,dp=4194304;function Mf(t){switch(t&-t){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: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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Zm(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=Mf(a):(o&=s,o!==0&&(r=Mf(o)))}else s=n&~i,s!==0?r=Mf(s):o!==0&&(r=Mf(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Bd(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-co(e),t[e]=n}function vN(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=If),WM=" ",GM=!1;function V2(t,e){switch(t){case"keyup":return $N.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function W2(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Pc=!1;function XN(t,e){switch(t){case"compositionend":return W2(e);case"keypress":return e.which!==32?null:(GM=!0,WM);case"textInput":return t=e.data,t===WM&&GM?null:t;default:return null}}function YN(t,e){if(Pc)return t==="compositionend"||!j1&&V2(t,e)?(t=B2(),Cm=W1=Qs=null,Pc=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=YM(n)}}function X2(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?X2(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Y2(){for(var t=window,e=jm();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=jm(t.document)}return e}function X1(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function rk(t){var e=Y2(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&X2(n.ownerDocument.documentElement,n)){if(r!==null&&X1(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=qM(n,o);var s=qM(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ic=null,N_=null,Df=null,k_=!1;function ZM(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;k_||Ic==null||Ic!==jm(r)||(r=Ic,"selectionStart"in r&&X1(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Df&&td(Df,r)||(Df=r,r=Qm(N_,"onSelect"),0Oc||(t.current=V_[Oc],V_[Oc]=null,Oc--)}function pn(t,e){Oc++,V_[Oc]=t.current,t.current=e}var ga={},Dr=ba(ga),si=ba(!1),Sl=ga;function nu(t,e){var n=t.type.contextTypes;if(!n)return ga;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function ai(t){return t=t.childContextTypes,t!=null}function tg(){yn(si),yn(Dr)}function rb(t,e,n){if(Dr.current!==ga)throw Error(ze(168));pn(Dr,e),pn(si,n)}function rR(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(ze(108,JO(t)||"Unknown",i));return On({},n,r)}function ng(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||ga,Sl=Dr.current,pn(Dr,t),pn(si,si.current),!0}function ib(t,e,n){var r=t.stateNode;if(!r)throw Error(ze(169));n?(t=rR(t,e,Sl),r.__reactInternalMemoizedMergedChildContext=t,yn(si),yn(Dr),pn(Dr,t)):yn(si),pn(si,n)}var ls=null,Wg=!1,ny=!1;function iR(t){ls===null?ls=[t]:ls.push(t)}function mk(t){Wg=!0,iR(t)}function Ta(){if(!ny&&ls!==null){ny=!0;var t=0,e=on;try{var n=ls;for(on=1;t>=s,i-=s,hs=1<<32-co(e)+i|n<O?(C=R,R=null):C=R.sibling;var P=p(m,R,S[O],M);if(P===null){R===null&&(R=C);break}t&&R&&P.alternate===null&&e(m,R),_=o(P,_,O),A===null?T=P:A.sibling=P,A=P,R=C}if(O===S.length)return n(m,R),En&&Ka(m,O),T;if(R===null){for(;OO?(C=R,R=null):C=R.sibling;var k=p(m,R,P.value,M);if(k===null){R===null&&(R=C);break}t&&R&&k.alternate===null&&e(m,R),_=o(k,_,O),A===null?T=k:A.sibling=k,A=k,R=C}if(P.done)return n(m,R),En&&Ka(m,O),T;if(R===null){for(;!P.done;O++,P=S.next())P=h(m,P.value,M),P!==null&&(_=o(P,_,O),A===null?T=P:A.sibling=P,A=P);return En&&Ka(m,O),T}for(R=r(m,R);!P.done;O++,P=S.next())P=g(R,m,O,P.value,M),P!==null&&(t&&P.alternate!==null&&R.delete(P.key===null?O:P.key),_=o(P,_,O),A===null?T=P:A.sibling=P,A=P);return t&&R.forEach(function(X){return e(m,X)}),En&&Ka(m,O),T}function x(m,_,S,M){if(typeof S=="object"&&S!==null&&S.type===Rc&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case lp:e:{for(var T=S.key,A=_;A!==null;){if(A.key===T){if(T=S.type,T===Rc){if(A.tag===7){n(m,A.sibling),_=i(A,S.props.children),_.return=m,m=_;break e}}else if(A.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ys&&fb(T)===A.type){n(m,A.sibling),_=i(A,S.props),_.ref=nf(m,A,S),_.return=m,m=_;break e}n(m,A);break}else e(m,A);A=A.sibling}S.type===Rc?(_=ml(S.props.children,m.mode,M,S.key),_.return=m,m=_):(M=km(S.type,S.key,S.props,null,m.mode,M),M.ref=nf(m,_,S),M.return=m,m=M)}return s(m);case Cc:e:{for(A=S.key;_!==null;){if(_.key===A)if(_.tag===4&&_.stateNode.containerInfo===S.containerInfo&&_.stateNode.implementation===S.implementation){n(m,_.sibling),_=i(_,S.children||[]),_.return=m,m=_;break e}else{n(m,_);break}else e(m,_);_=_.sibling}_=uy(S,m.mode,M),_.return=m,m=_}return s(m);case Ys:return A=S._init,x(m,_,A(S._payload),M)}if(Ef(S))return y(m,_,S,M);if(Ku(S))return w(m,_,S,M);_p(m,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,_!==null&&_.tag===6?(n(m,_.sibling),_=i(_,S),_.return=m,m=_):(n(m,_),_=cy(S,m.mode,M),_.return=m,m=_),s(m)):n(m,_)}return x}var iu=dR(!0),hR=dR(!1),Wd={},Uo=ba(Wd),od=ba(Wd),sd=ba(Wd);function sl(t){if(t===Wd)throw Error(ze(174));return t}function nS(t,e){switch(pn(sd,e),pn(od,t),pn(Uo,Wd),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:b_(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=b_(e,t)}yn(Uo),pn(Uo,e)}function ou(){yn(Uo),yn(od),yn(sd)}function pR(t){sl(sd.current);var e=sl(Uo.current),n=b_(e,t.type);e!==n&&(pn(od,t),pn(Uo,n))}function rS(t){od.current===t&&(yn(Uo),yn(od))}var Rn=ba(0);function lg(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var ry=[];function iS(){for(var t=0;tn?n:4,t(!0);var r=iy.transition;iy.transition={};try{t(!1),e()}finally{on=n,iy.transition=r}}function PR(){return $i().memoizedState}function _k(t,e,n){var r=la(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},IR(t))LR(e,n);else if(n=lR(t,e,n,r),n!==null){var i=Gr();uo(n,t,r,i),DR(n,e,r)}}function xk(t,e,n){var r=la(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(IR(t))LR(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,po(a,s)){var l=e.interleaved;l===null?(i.next=i,eS(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=lR(t,e,i,r),n!==null&&(i=Gr(),uo(n,t,r,i),DR(n,e,r))}}function IR(t){var e=t.alternate;return t===Ln||e!==null&&e===Ln}function LR(t,e){Of=cg=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function DR(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,B1(t,n)}}var ug={readContext:Gi,useCallback:wr,useContext:wr,useEffect:wr,useImperativeHandle:wr,useInsertionEffect:wr,useLayoutEffect:wr,useMemo:wr,useReducer:wr,useRef:wr,useState:wr,useDebugValue:wr,useDeferredValue:wr,useTransition:wr,useMutableSource:wr,useSyncExternalStore:wr,useId:wr,unstable_isNewReconciler:!1},Sk={readContext:Gi,useCallback:function(t,e){return Lo().memoizedState=[t,e===void 0?null:e],t},useContext:Gi,useEffect:hb,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Lm(4194308,4,bR.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Lm(4194308,4,t,e)},useInsertionEffect:function(t,e){return Lm(4,2,t,e)},useMemo:function(t,e){var n=Lo();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Lo();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=_k.bind(null,Ln,t),[r.memoizedState,t]},useRef:function(t){var e=Lo();return t={current:t},e.memoizedState=t},useState:db,useDebugValue:cS,useDeferredValue:function(t){return Lo().memoizedState=t},useTransition:function(){var t=db(!1),e=t[0];return t=yk.bind(null,t[1]),Lo().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ln,i=Lo();if(En){if(n===void 0)throw Error(ze(407));n=n()}else{if(n=e(),fr===null)throw Error(ze(349));El&30||vR(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,hb(_R.bind(null,r,o,t),[t]),r.flags|=2048,cd(9,yR.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=Lo(),e=fr.identifierPrefix;if(En){var n=ps,r=hs;n=(r&~(1<<32-co(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ad++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Do]=e,t[id]=r,VR(t,e,!1,!1),e.stateNode=t;e:{switch(s=A_(n,r),n){case"dialog":mn("cancel",t),mn("close",t),i=r;break;case"iframe":case"object":case"embed":mn("load",t),i=r;break;case"video":case"audio":for(i=0;iau&&(e.flags|=128,r=!0,rf(o,!1),e.lanes=4194304)}else{if(!r)if(t=lg(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),rf(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!En)return Er(e),null}else 2*$n()-o.renderingStartTime>au&&n!==1073741824&&(e.flags|=128,r=!0,rf(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=$n(),e.sibling=null,n=Rn.current,pn(Rn,r?n&1|2:n&1),e):(Er(e),null);case 22:case 23:return mS(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?gi&1073741824&&(Er(e),e.subtreeFlags&6&&(e.flags|=8192)):Er(e),null;case 24:return null;case 25:return null}throw Error(ze(156,e.tag))}function Rk(t,e){switch(q1(e),e.tag){case 1:return ai(e.type)&&tg(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ou(),yn(si),yn(Dr),iS(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return rS(e),null;case 13:if(yn(Rn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ze(340));ru()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return yn(Rn),null;case 4:return ou(),null;case 10:return Q1(e.type._context),null;case 22:case 23:return mS(),null;case 24:return null;default:return null}}var Sp=!1,Ar=!1,Pk=typeof WeakSet=="function"?WeakSet:Set,ot=null;function Fc(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Fn(t,e,r)}else n.current=null}function ex(t,e,n){try{n()}catch(r){Fn(t,e,r)}}var wb=!1;function Ik(t,e){if(U_=Km,t=Y2(),X1(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,d=0,h=t,p=null;t:for(;;){for(var g;h!==n||i!==0&&h.nodeType!==3||(a=s+i),h!==o||r!==0&&h.nodeType!==3||(l=s+r),h.nodeType===3&&(s+=h.nodeValue.length),(g=h.firstChild)!==null;)p=h,h=g;for(;;){if(h===t)break t;if(p===n&&++u===i&&(a=s),p===o&&++d===r&&(l=s),(g=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(F_={focusedElem:t,selectionRange:n},Km=!1,ot=e;ot!==null;)if(e=ot,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ot=t;else for(;ot!==null;){e=ot;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,x=y.memoizedState,m=e.stateNode,_=m.getSnapshotBeforeUpdate(e.elementType===e.type?w:ro(e.type,w),x);m.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ze(163))}}catch(M){Fn(e,e.return,M)}if(t=e.sibling,t!==null){t.return=e.return,ot=t;break}ot=e.return}return y=wb,wb=!1,y}function Nf(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&ex(e,n,o)}i=i.next}while(i!==r)}}function jg(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function tx(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function $R(t){var e=t.alternate;e!==null&&(t.alternate=null,$R(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Do],delete e[id],delete e[H_],delete e[hk],delete e[pk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function jR(t){return t.tag===5||t.tag===3||t.tag===4}function Eb(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||jR(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function nx(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=eg));else if(r!==4&&(t=t.child,t!==null))for(nx(t,e,n),t=t.sibling;t!==null;)nx(t,e,n),t=t.sibling}function rx(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(rx(t,e,n),t=t.sibling;t!==null;)rx(t,e,n),t=t.sibling}var hr=null,oo=!1;function zs(t,e,n){for(n=n.child;n!==null;)XR(t,e,n),n=n.sibling}function XR(t,e,n){if(ko&&typeof ko.onCommitFiberUnmount=="function")try{ko.onCommitFiberUnmount(Fg,n)}catch{}switch(n.tag){case 5:Ar||Fc(n,e);case 6:var r=hr,i=oo;hr=null,zs(t,e,n),hr=r,oo=i,hr!==null&&(oo?(t=hr,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):hr.removeChild(n.stateNode));break;case 18:hr!==null&&(oo?(t=hr,n=n.stateNode,t.nodeType===8?ty(t.parentNode,n):t.nodeType===1&&ty(t,n),Qf(t)):ty(hr,n.stateNode));break;case 4:r=hr,i=oo,hr=n.stateNode.containerInfo,oo=!0,zs(t,e,n),hr=r,oo=i;break;case 0:case 11:case 14:case 15:if(!Ar&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&ex(n,e,s),i=i.next}while(i!==r)}zs(t,e,n);break;case 1:if(!Ar&&(Fc(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Fn(n,e,a)}zs(t,e,n);break;case 21:zs(t,e,n);break;case 22:n.mode&1?(Ar=(r=Ar)||n.memoizedState!==null,zs(t,e,n),Ar=r):zs(t,e,n);break;default:zs(t,e,n)}}function Mb(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Pk),e.forEach(function(r){var i=Bk.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ji(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=$n()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Dk(r/1960))-r,10t?16:t,ea===null)var r=!1;else{if(t=ea,ea=null,hg=0,Yt&6)throw Error(ze(331));var i=Yt;for(Yt|=4,ot=t.current;ot!==null;){var o=ot,s=o.child;if(ot.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l$n()-hS?pl(t,0):dS|=n),li(t,e)}function tP(t,e){e===0&&(t.mode&1?(e=dp,dp<<=1,!(dp&130023424)&&(dp=4194304)):e=1);var n=Gr();t=Ss(t,e),t!==null&&(Bd(t,e,n),li(t,n))}function zk(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),tP(t,n)}function Bk(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ze(314))}r!==null&&r.delete(e),tP(t,n)}var nP;nP=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||si.current)ii=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return ii=!1,Ak(t,e,n);ii=!!(t.flags&131072)}else ii=!1,En&&e.flags&1048576&&oR(e,ig,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Dm(t,e),t=e.pendingProps;var i=nu(e,Dr.current);Zc(e,n),i=sS(null,e,r,t,i,n);var o=aS();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ai(r)?(o=!0,ng(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tS(e),i.updater=Gg,e.stateNode=i,i._reactInternals=e,X_(e,r,t,n),e=Z_(null,e,r,!0,o,n)):(e.tag=0,En&&o&&Y1(e),Hr(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Dm(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Vk(r),t=ro(r,t),i){case 0:e=q_(null,e,r,t,n);break e;case 1:e=_b(null,e,r,t,n);break e;case 11:e=vb(null,e,r,t,n);break e;case 14:e=yb(null,e,r,ro(r.type,t),n);break e}throw Error(ze(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ro(r,i),q_(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ro(r,i),_b(t,e,r,i,n);case 3:e:{if(zR(e),t===null)throw Error(ze(387));r=e.pendingProps,o=e.memoizedState,i=o.element,cR(t,e),ag(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=su(Error(ze(423)),e),e=xb(t,e,r,n,i);break e}else if(r!==i){i=su(Error(ze(424)),e),e=xb(t,e,r,n,i);break e}else for(_i=oa(e.stateNode.containerInfo.firstChild),xi=e,En=!0,so=null,n=hR(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ru(),r===i){e=ws(t,e,n);break e}Hr(t,e,r,n)}e=e.child}return e;case 5:return pR(e),t===null&&G_(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,z_(r,i)?s=null:o!==null&&z_(r,o)&&(e.flags|=32),FR(t,e),Hr(t,e,s,n),e.child;case 6:return t===null&&G_(e),null;case 13:return BR(t,e,n);case 4:return nS(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=iu(e,null,r,n):Hr(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ro(r,i),vb(t,e,r,i,n);case 7:return Hr(t,e,e.pendingProps,n),e.child;case 8:return Hr(t,e,e.pendingProps.children,n),e.child;case 12:return Hr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,pn(og,r._currentValue),r._currentValue=s,o!==null)if(po(o.value,s)){if(o.children===i.children&&!si.current){e=ws(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=gs(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),$_(o.return,n,e),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(ze(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),$_(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Hr(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Zc(e,n),i=Gi(i),r=r(i),e.flags|=1,Hr(t,e,r,n),e.child;case 14:return r=e.type,i=ro(r,e.pendingProps),i=ro(r.type,i),yb(t,e,r,i,n);case 15:return kR(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ro(r,i),Dm(t,e),e.tag=1,ai(r)?(t=!0,ng(e)):t=!1,Zc(e,n),fR(e,r,i),X_(e,r,i,n),Z_(null,e,r,!0,t,n);case 19:return HR(t,e,n);case 22:return UR(t,e,n)}throw Error(ze(156,e.tag))};function rP(t,e){return R2(t,e)}function Hk(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hi(t,e,n,r){return new Hk(t,e,n,r)}function vS(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Vk(t){if(typeof t=="function")return vS(t)?1:0;if(t!=null){if(t=t.$$typeof,t===k1)return 11;if(t===U1)return 14}return 2}function ca(t,e){var n=t.alternate;return n===null?(n=Hi(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function km(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")vS(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Rc:return ml(n.children,i,o,e);case N1:s=8,i|=8;break;case v_:return t=Hi(12,n,e,i|2),t.elementType=v_,t.lanes=o,t;case y_:return t=Hi(13,n,e,i),t.elementType=y_,t.lanes=o,t;case __:return t=Hi(19,n,e,i),t.elementType=__,t.lanes=o,t;case d2:return Yg(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case u2:s=10;break e;case f2:s=9;break e;case k1:s=11;break e;case U1:s=14;break e;case Ys:s=16,r=null;break e}throw Error(ze(130,t==null?t:typeof t,""))}return e=Hi(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function ml(t,e,n,r){return t=Hi(7,t,r,e),t.lanes=n,t}function Yg(t,e,n,r){return t=Hi(22,t,r,e),t.elementType=d2,t.lanes=n,t.stateNode={isHidden:!1},t}function cy(t,e,n){return t=Hi(6,t,null,e),t.lanes=n,t}function uy(t,e,n){return e=Hi(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Wk(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gv(0),this.expirationTimes=Gv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gv(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function yS(t,e,n,r,i,o,s,a,l){return t=new Wk(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Hi(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tS(o),t}function Gk(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(aP)}catch(t){console.error(t)}}aP(),o2.exports=Mi;var Gd=o2.exports;const lP=mu(Gd);var Lb=Gd;m_.createRoot=Lb.createRoot,m_.hydrateRoot=Lb.hydrateRoot;/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT */const $d="158",Qa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},el={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},cP=0,lx=1,uP=2,qk=3,fP=0,Qg=1,Ff=2,io=3,Bo=0,Lr=1,lo=2,Zk=2,vs=0,gl=1,cx=2,ux=3,fx=4,wS=5,Js=100,dP=101,hP=102,dx=103,hx=104,pP=200,ES=201,mP=202,gP=203,gg=204,vg=205,vP=206,yP=207,_P=208,xP=209,SP=210,wP=211,EP=212,MP=213,bP=214,TP=0,AP=1,CP=2,fd=3,RP=4,PP=5,IP=6,LP=7,jd=0,DP=1,OP=2,fo=0,NP=1,kP=2,UP=3,MS=4,FP=5,px="attached",zP="detached",e0=300,Ho=301,va=302,lu=303,dd=304,_u=306,hd=1e3,Cr=1001,pd=1002,Gn=1003,yg=1004,Kk=1004,zf=1005,Jk=1005,un=1006,bS=1007,Qk=1007,ya=1008,eU=1008,Fo=1009,BP=1010,HP=1011,t0=1012,TS=1013,Oo=1014,cr=1015,Pr=1016,AS=1017,CS=1018,ua=1020,VP=1021,Rr=1023,WP=1024,GP=1025,fa=1026,Tl=1027,RS=1028,PS=1029,$P=1030,IS=1031,n0=1033,Um=33776,Fm=33777,zm=33778,Bm=33779,mx=35840,gx=35841,vx=35842,yx=35843,jP=36196,_x=37492,xx=37496,Sx=37808,wx=37809,Ex=37810,Mx=37811,bx=37812,Tx=37813,Ax=37814,Cx=37815,Rx=37816,Px=37817,Ix=37818,Lx=37819,Dx=37820,Ox=37821,Hm=36492,Nx=36494,kx=36495,XP=36283,Ux=36284,Fx=36285,zx=36286,YP=2200,qP=2201,ZP=2202,md=2300,gd=2301,Vm=2302,al=2400,ll=2401,vd=2402,r0=2500,LS=2501,tU=0,nU=1,rU=2,DS=3e3,da=3001,KP=3200,JP=3201,Aa=0,QP=1,yi="",Qn="srgb",Vo="srgb-linear",i0="display-p3",Xd="display-p3-linear",yd="linear",hn="srgb",_d="rec709",xd="p3",iU=0,tl=7680,oU=7681,sU=7682,aU=7683,lU=34055,cU=34056,uU=5386,fU=512,dU=513,hU=514,pU=515,mU=516,gU=517,vU=518,Bx=519,e3=512,t3=513,n3=514,r3=515,i3=516,o3=517,s3=518,a3=519,Sd=35044,l3=35048,yU=35040,_U=35045,xU=35049,SU=35041,wU=35046,EU=35050,MU=35042,bU="100",Hx="300 es",_g=1035,No=2e3,wd=2001;class $o{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(n);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let o=0,s=i.length;o>8&255]+Mr[t>>16&255]+Mr[t>>24&255]+"-"+Mr[e&255]+Mr[e>>8&255]+"-"+Mr[e>>16&15|64]+Mr[e>>24&255]+"-"+Mr[n&63|128]+Mr[n>>8&255]+"-"+Mr[n>>16&255]+Mr[n>>24&255]+Mr[r&255]+Mr[r>>8&255]+Mr[r>>16&255]+Mr[r>>24&255]).toLowerCase()}function zn(t,e,n){return Math.max(e,Math.min(n,t))}function OS(t,e){return(t%e+e)%e}function TU(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function AU(t,e,n){return t!==e?(n-t)/(e-t):0}function Bf(t,e,n){return(1-n)*t+n*e}function CU(t,e,n,r){return Bf(t,e,1-Math.exp(-n*r))}function RU(t,e=1){return e-Math.abs(OS(t,e*2)-e)}function PU(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function IU(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function LU(t,e){return t+Math.floor(Math.random()*(e-t+1))}function DU(t,e){return t+Math.random()*(e-t)}function OU(t){return t*(.5-Math.random())}function NU(t){t!==void 0&&(Db=t);let e=Db+=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 kU(t){return t*vl}function UU(t){return t*cu}function Vx(t){return(t&t-1)===0&&t!==0}function c3(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function xg(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function FU(t,e,n,r,i){const o=Math.cos,s=Math.sin,a=o(n/2),l=s(n/2),u=o((e+r)/2),d=s((e+r)/2),h=o((e-r)/2),p=s((e-r)/2),g=o((r-e)/2),y=s((r-e)/2);switch(i){case"XYX":t.set(a*d,l*h,l*p,a*u);break;case"YZY":t.set(l*p,a*d,l*h,a*u);break;case"ZXZ":t.set(l*h,l*p,a*d,a*u);break;case"XZX":t.set(a*d,l*y,l*g,a*u);break;case"YXY":t.set(l*g,a*d,l*y,a*u);break;case"ZYZ":t.set(l*y,l*g,a*d,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ri(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function kt(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const u3={DEG2RAD:vl,RAD2DEG:cu,generateUUID:Si,clamp:zn,euclideanModulo:OS,mapLinear:TU,inverseLerp:AU,lerp:Bf,damp:CU,pingpong:RU,smoothstep:PU,smootherstep:IU,randInt:LU,randFloat:DU,randFloatSpread:OU,seededRandom:NU,degToRad:kU,radToDeg:UU,isPowerOfTwo:Vx,ceilPowerOfTwo:c3,floorPowerOfTwo:xg,setQuaternionFromProperEuler:FU,normalize:kt,denormalize:ri};class Te{constructor(e=0,n=0){Te.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}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 n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(zn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),o=this.x-e.x,s=this.y-e.y;return this.x=o*r-s*i+e.x,this.y=o*i+s*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ft{constructor(e,n,r,i,o,s,a,l,u){Ft.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,o,s,a,l,u)}set(e,n,r,i,o,s,a,l,u){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=o,d[5]=l,d[6]=r,d[7]=s,d[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,o=this.elements,s=r[0],a=r[3],l=r[6],u=r[1],d=r[4],h=r[7],p=r[2],g=r[5],y=r[8],w=i[0],x=i[3],m=i[6],_=i[1],S=i[4],M=i[7],T=i[2],A=i[5],R=i[8];return o[0]=s*w+a*_+l*T,o[3]=s*x+a*S+l*A,o[6]=s*m+a*M+l*R,o[1]=u*w+d*_+h*T,o[4]=u*x+d*S+h*A,o[7]=u*m+d*M+h*R,o[2]=p*w+g*_+y*T,o[5]=p*x+g*S+y*A,o[8]=p*m+g*M+y*R,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],d=e[8];return n*s*d-n*a*u-r*o*d+r*a*l+i*o*u-i*s*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],d=e[8],h=d*s-a*u,p=a*l-d*o,g=u*o-s*l,y=n*h+r*p+i*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return e[0]=h*w,e[1]=(i*u-d*r)*w,e[2]=(a*r-i*s)*w,e[3]=p*w,e[4]=(d*n-i*l)*w,e[5]=(i*o-a*n)*w,e[6]=g*w,e[7]=(r*l-u*n)*w,e[8]=(s*n-r*o)*w,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,o,s,a){const l=Math.cos(o),u=Math.sin(o);return this.set(r*l,r*u,-r*(l*s+u*a)+s+e,-i*u,i*l,-i*(-u*s+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(fy.makeScale(e,n)),this}rotate(e){return this.premultiply(fy.makeRotation(-e)),this}translate(e,n){return this.premultiply(fy.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const fy=new Ft;function f3(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const zU={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Bc(t,e){return new zU[t](e)}function Ed(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function d3(){const t=Ed("canvas");return t.style.display="block",t}const Ob={};function Hf(t){t in Ob||(Ob[t]=!0,console.warn(t))}const Nb=new Ft().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),kb=new Ft().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Mp={[Vo]:{transfer:yd,primaries:_d,toReference:t=>t,fromReference:t=>t},[Qn]:{transfer:hn,primaries:_d,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[Xd]:{transfer:yd,primaries:xd,toReference:t=>t.applyMatrix3(kb),fromReference:t=>t.applyMatrix3(Nb)},[i0]:{transfer:hn,primaries:xd,toReference:t=>t.convertSRGBToLinear().applyMatrix3(kb),fromReference:t=>t.applyMatrix3(Nb).convertLinearToSRGB()}},BU=new Set([Vo,Xd]),rn={enabled:!0,_workingColorSpace:Vo,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!BU.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=Mp[e].toReference,i=Mp[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return Mp[t].primaries},getTransfer:function(t){return t===yi?yd:Mp[t].transfer}};function Jc(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function dy(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let tc;class NS{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{tc===void 0&&(tc=Ed("canvas")),tc.width=e.width,tc.height=e.height;const r=tc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=tc}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Ed("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),o=i.data;for(let s=0;s0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==e0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case hd:e.x=e.x-Math.floor(e.x);break;case Cr:e.x=e.x<0?0:1;break;case pd: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 hd:e.y=e.y-Math.floor(e.y);break;case Cr:e.y=e.y<0?0:1;break;case pd: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)}get encoding(){return Hf("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Qn?da:DS}set encoding(e){Hf("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===da?Qn:yi}}Dn.DEFAULT_IMAGE=null;Dn.DEFAULT_MAPPING=e0;Dn.DEFAULT_ANISOTROPY=1;class tn{constructor(e=0,n=0,r=0,i=1){tn.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,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,n,r,i){return this.x=e,this.y=n,this.z=r,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,r=this.y,i=this.z,o=this.w,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i+s[12]*o,this.y=s[1]*n+s[5]*r+s[9]*i+s[13]*o,this.z=s[2]*n+s[6]*r+s[10]*i+s[14]*o,this.w=s[3]*n+s[7]*r+s[11]*i+s[15]*o,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,o;const l=e.elements,u=l[0],d=l[4],h=l[8],p=l[1],g=l[5],y=l[9],w=l[2],x=l[6],m=l[10];if(Math.abs(d-p)<.01&&Math.abs(h-w)<.01&&Math.abs(y-x)<.01){if(Math.abs(d+p)<.1&&Math.abs(h+w)<.1&&Math.abs(y+x)<.1&&Math.abs(u+g+m-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const S=(u+1)/2,M=(g+1)/2,T=(m+1)/2,A=(d+p)/4,R=(h+w)/4,O=(y+x)/4;return S>M&&S>T?S<.01?(r=0,i=.707106781,o=.707106781):(r=Math.sqrt(S),i=A/r,o=R/r):M>T?M<.01?(r=.707106781,i=0,o=.707106781):(i=Math.sqrt(M),r=A/i,o=O/i):T<.01?(r=.707106781,i=.707106781,o=0):(o=Math.sqrt(T),r=R/o,i=O/o),this.set(r,i,o,n),this}let _=Math.sqrt((x-y)*(x-y)+(h-w)*(h-w)+(p-d)*(p-d));return Math.abs(_)<.001&&(_=1),this.x=(x-y)/_,this.y=(h-w)/_,this.z=(p-d)/_,this.w=Math.acos((u+g+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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 h3 extends $o{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new tn(0,0,e,n),this.scissorTest=!1,this.viewport=new tn(0,0,e,n);const i={width:e,height:n,depth:1};r.encoding!==void 0&&(Hf("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=r.encoding===da?Qn:yi),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:un,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},r),this.texture=new Dn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps,this.texture.internalFormat=r.internalFormat,this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}setSize(e,n,r=1){(this.width!==e||this.height!==n||this.depth!==r)&&(this.width=e,this.height=n,this.depth=r,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new cl(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ji extends h3{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class o0 extends Dn{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Gn,this.minFilter=Gn,this.wrapR=Cr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class WU extends ji{constructor(e=1,n=1,r=1){super(e,n),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new o0(null,e,n,r),this.texture.isRenderTargetTexture=!0}}class kS extends Dn{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Gn,this.minFilter=Gn,this.wrapR=Cr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class GU extends ji{constructor(e=1,n=1,r=1){super(e,n),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new kS(null,e,n,r),this.texture.isRenderTargetTexture=!0}}class $U extends ji{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLMultipleRenderTargets=!0;const o=this.texture;this.texture=[];for(let s=0;s=0?1:-1,S=1-m*m;if(S>Number.EPSILON){const T=Math.sqrt(S),A=Math.atan2(T,m*_);x=Math.sin(x*A)/T,a=Math.sin(a*A)/T}const M=a*_;if(l=l*x+p*M,u=u*x+g*M,d=d*x+y*M,h=h*x+w*M,x===1-a){const T=1/Math.sqrt(l*l+u*u+d*d+h*h);l*=T,u*=T,d*=T,h*=T}}e[n]=l,e[n+1]=u,e[n+2]=d,e[n+3]=h}static multiplyQuaternionsFlat(e,n,r,i,o,s){const a=r[i],l=r[i+1],u=r[i+2],d=r[i+3],h=o[s],p=o[s+1],g=o[s+2],y=o[s+3];return e[n]=a*y+d*h+l*g-u*p,e[n+1]=l*y+d*p+u*h-a*g,e[n+2]=u*y+d*g+a*p-l*h,e[n+3]=d*y-a*h-l*p-u*g,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,n,r,i){return this._x=e,this._y=n,this._z=r,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,n){const r=e._x,i=e._y,o=e._z,s=e._order,a=Math.cos,l=Math.sin,u=a(r/2),d=a(i/2),h=a(o/2),p=l(r/2),g=l(i/2),y=l(o/2);switch(s){case"XYZ":this._x=p*d*h+u*g*y,this._y=u*g*h-p*d*y,this._z=u*d*y+p*g*h,this._w=u*d*h-p*g*y;break;case"YXZ":this._x=p*d*h+u*g*y,this._y=u*g*h-p*d*y,this._z=u*d*y-p*g*h,this._w=u*d*h+p*g*y;break;case"ZXY":this._x=p*d*h-u*g*y,this._y=u*g*h+p*d*y,this._z=u*d*y+p*g*h,this._w=u*d*h-p*g*y;break;case"ZYX":this._x=p*d*h-u*g*y,this._y=u*g*h+p*d*y,this._z=u*d*y-p*g*h,this._w=u*d*h+p*g*y;break;case"YZX":this._x=p*d*h+u*g*y,this._y=u*g*h+p*d*y,this._z=u*d*y-p*g*h,this._w=u*d*h-p*g*y;break;case"XZY":this._x=p*d*h-u*g*y,this._y=u*g*h-p*d*y,this._z=u*d*y+p*g*h,this._w=u*d*h+p*g*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],o=n[8],s=n[1],a=n[5],l=n[9],u=n[2],d=n[6],h=n[10],p=r+a+h;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(d-l)*g,this._y=(o-u)*g,this._z=(s-i)*g}else if(r>a&&r>h){const g=2*Math.sqrt(1+r-a-h);this._w=(d-l)/g,this._x=.25*g,this._y=(i+s)/g,this._z=(o+u)/g}else if(a>h){const g=2*Math.sqrt(1+a-r-h);this._w=(o-u)/g,this._x=(i+s)/g,this._y=.25*g,this._z=(l+d)/g}else{const g=2*Math.sqrt(1+h-r-a);this._w=(s-i)/g,this._x=(o+u)/g,this._y=(l+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(zn(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);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,n){const r=e._x,i=e._y,o=e._z,s=e._w,a=n._x,l=n._y,u=n._z,d=n._w;return this._x=r*d+s*a+i*u-o*l,this._y=i*d+s*l+o*a-r*u,this._z=o*d+s*u+r*l-i*a,this._w=s*d-r*a-i*l-o*u,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,o=this._z,s=this._w;let a=s*e._w+r*e._x+i*e._y+o*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=r,this._y=i,this._z=o,this;const l=1-a*a;if(l<=Number.EPSILON){const g=1-n;return this._w=g*s+n*this._w,this._x=g*r+n*this._x,this._y=g*i+n*this._y,this._z=g*o+n*this._z,this.normalize(),this._onChangeCallback(),this}const u=Math.sqrt(l),d=Math.atan2(u,a),h=Math.sin((1-n)*d)/u,p=Math.sin(n*d)/u;return this._w=s*h+this._w*p,this._x=r*h+this._x*p,this._y=i*h+this._y*p,this._z=o*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=Math.random(),n=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),o=2*Math.PI*Math.random();return this.set(n*Math.cos(i),r*Math.sin(o),r*Math.cos(o),n*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),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 G{constructor(e=0,n=0,r=0){G.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(Ub.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Ub.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,o=e.elements;return this.x=o[0]*n+o[3]*r+o[6]*i,this.y=o[1]*n+o[4]*r+o[7]*i,this.z=o[2]*n+o[5]*r+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,o=e.elements,s=1/(o[3]*n+o[7]*r+o[11]*i+o[15]);return this.x=(o[0]*n+o[4]*r+o[8]*i+o[12])*s,this.y=(o[1]*n+o[5]*r+o[9]*i+o[13])*s,this.z=(o[2]*n+o[6]*r+o[10]*i+o[14])*s,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,o=e.x,s=e.y,a=e.z,l=e.w,u=2*(s*i-a*r),d=2*(a*n-o*i),h=2*(o*r-s*n);return this.x=n+l*u+s*h-a*d,this.y=r+l*d+a*u-o*h,this.z=i+l*h+o*d-s*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i,this.y=o[1]*n+o[5]*r+o[9]*i,this.z=o[2]*n+o[6]*r+o[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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,o=e.z,s=n.x,a=n.y,l=n.z;return this.x=i*l-o*a,this.y=o*s-r*l,this.z=r*a-i*s,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return py.copy(this).projectOnVector(e),this.sub(py)}reflect(e){return this.sub(py.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(zn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+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,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(n),this.y=r*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const py=new G,Ub=new mr;class jo{constructor(e=new G(1/0,1/0,1/0),n=new G(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;nthis.max.x||e.ythis.max.y||e.zthis.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,n){return n.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Qi),Qi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(sf),Tp.subVectors(this.max,sf),nc.subVectors(e.a,sf),rc.subVectors(e.b,sf),ic.subVectors(e.c,sf),Bs.subVectors(rc,nc),Hs.subVectors(ic,rc),Va.subVectors(nc,ic);let n=[0,-Bs.z,Bs.y,0,-Hs.z,Hs.y,0,-Va.z,Va.y,Bs.z,0,-Bs.x,Hs.z,0,-Hs.x,Va.z,0,-Va.x,-Bs.y,Bs.x,0,-Hs.y,Hs.x,0,-Va.y,Va.x,0];return!my(n,nc,rc,ic,Tp)||(n=[1,0,0,0,1,0,0,0,1],!my(n,nc,rc,ic,Tp))?!1:(Ap.crossVectors(Bs,Hs),n=[Ap.x,Ap.y,Ap.z],my(n,nc,rc,ic,Tp))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qi).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:(es[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),es[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),es[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),es[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),es[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),es[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),es[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),es[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(es),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const es=[new G,new G,new G,new G,new G,new G,new G,new G],Qi=new G,bp=new jo,nc=new G,rc=new G,ic=new G,Bs=new G,Hs=new G,Va=new G,sf=new G,Tp=new G,Ap=new G,Wa=new G;function my(t,e,n,r,i){for(let o=0,s=t.length-3;o<=s;o+=3){Wa.fromArray(t,o);const a=i.x*Math.abs(Wa.x)+i.y*Math.abs(Wa.y)+i.z*Math.abs(Wa.z),l=e.dot(Wa),u=n.dot(Wa),d=r.dot(Wa);if(Math.max(-Math.max(l,u,d),Math.min(l,u,d))>a)return!1}return!0}const jU=new jo,af=new G,gy=new G;class go{constructor(e=new G,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):jU.setFromPoints(e).getCenter(r);let i=0;for(let o=0,s=e.length;othis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;af.subVectors(e,this.center);const n=af.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(af,i/r),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):(gy.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(af.copy(e.center).add(gy)),this.expandByPoint(af.copy(e.center).sub(gy))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ts=new G,vy=new G,Cp=new G,Vs=new G,yy=new G,Rp=new G,_y=new G;class Nl{constructor(e=new G,n=new G(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,ts)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=ts.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(ts.copy(this.origin).addScaledVector(this.direction,n),ts.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){vy.copy(e).add(n).multiplyScalar(.5),Cp.copy(n).sub(e).normalize(),Vs.copy(this.origin).sub(vy);const o=e.distanceTo(n)*.5,s=-this.direction.dot(Cp),a=Vs.dot(this.direction),l=-Vs.dot(Cp),u=Vs.lengthSq(),d=Math.abs(1-s*s);let h,p,g,y;if(d>0)if(h=s*l-a,p=s*a-l,y=o*d,h>=0)if(p>=-y)if(p<=y){const w=1/d;h*=w,p*=w,g=h*(h+s*p+2*a)+p*(s*h+p+2*l)+u}else p=o,h=Math.max(0,-(s*p+a)),g=-h*h+p*(p+2*l)+u;else p=-o,h=Math.max(0,-(s*p+a)),g=-h*h+p*(p+2*l)+u;else p<=-y?(h=Math.max(0,-(-s*o+a)),p=h>0?-o:Math.min(Math.max(-o,-l),o),g=-h*h+p*(p+2*l)+u):p<=y?(h=0,p=Math.min(Math.max(-o,-l),o),g=p*(p+2*l)+u):(h=Math.max(0,-(s*o+a)),p=h>0?o:Math.min(Math.max(-o,-l),o),g=-h*h+p*(p+2*l)+u);else p=s>0?-o:o,h=Math.max(0,-(s*p+a)),g=-h*h+p*(p+2*l)+u;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(vy).addScaledVector(Cp,p),g}intersectSphere(e,n){ts.subVectors(e.center,this.origin);const r=ts.dot(this.direction),i=ts.dot(ts)-r*r,o=e.radius*e.radius;if(i>o)return null;const s=Math.sqrt(o-i),a=r-s,l=r+s;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,o,s,a,l;const u=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,p=this.origin;return u>=0?(r=(e.min.x-p.x)*u,i=(e.max.x-p.x)*u):(r=(e.max.x-p.x)*u,i=(e.min.x-p.x)*u),d>=0?(o=(e.min.y-p.y)*d,s=(e.max.y-p.y)*d):(o=(e.max.y-p.y)*d,s=(e.min.y-p.y)*d),r>s||o>i||((o>r||isNaN(r))&&(r=o),(s=0?(a=(e.min.z-p.z)*h,l=(e.max.z-p.z)*h):(a=(e.max.z-p.z)*h,l=(e.min.z-p.z)*h),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,ts)!==null}intersectTriangle(e,n,r,i,o){yy.subVectors(n,e),Rp.subVectors(r,e),_y.crossVectors(yy,Rp);let s=this.direction.dot(_y),a;if(s>0){if(i)return null;a=1}else if(s<0)a=-1,s=-s;else return null;Vs.subVectors(this.origin,e);const l=a*this.direction.dot(Rp.crossVectors(Vs,Rp));if(l<0)return null;const u=a*this.direction.dot(yy.cross(Vs));if(u<0||l+u>s)return null;const d=-a*Vs.dot(_y);return d<0?null:this.at(d/s,o)}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 wt{constructor(e,n,r,i,o,s,a,l,u,d,h,p,g,y,w,x){wt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,o,s,a,l,u,d,h,p,g,y,w,x)}set(e,n,r,i,o,s,a,l,u,d,h,p,g,y,w,x){const m=this.elements;return m[0]=e,m[4]=n,m[8]=r,m[12]=i,m[1]=o,m[5]=s,m[9]=a,m[13]=l,m[2]=u,m[6]=d,m[10]=h,m[14]=p,m[3]=g,m[7]=y,m[11]=w,m[15]=x,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 wt().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/oc.setFromMatrixColumn(e,0).length(),o=1/oc.setFromMatrixColumn(e,1).length(),s=1/oc.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[7]=0,n[8]=r[8]*s,n[9]=r[9]*s,n[10]=r[10]*s,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,o=e.z,s=Math.cos(r),a=Math.sin(r),l=Math.cos(i),u=Math.sin(i),d=Math.cos(o),h=Math.sin(o);if(e.order==="XYZ"){const p=s*d,g=s*h,y=a*d,w=a*h;n[0]=l*d,n[4]=-l*h,n[8]=u,n[1]=g+y*u,n[5]=p-w*u,n[9]=-a*l,n[2]=w-p*u,n[6]=y+g*u,n[10]=s*l}else if(e.order==="YXZ"){const p=l*d,g=l*h,y=u*d,w=u*h;n[0]=p+w*a,n[4]=y*a-g,n[8]=s*u,n[1]=s*h,n[5]=s*d,n[9]=-a,n[2]=g*a-y,n[6]=w+p*a,n[10]=s*l}else if(e.order==="ZXY"){const p=l*d,g=l*h,y=u*d,w=u*h;n[0]=p-w*a,n[4]=-s*h,n[8]=y+g*a,n[1]=g+y*a,n[5]=s*d,n[9]=w-p*a,n[2]=-s*u,n[6]=a,n[10]=s*l}else if(e.order==="ZYX"){const p=s*d,g=s*h,y=a*d,w=a*h;n[0]=l*d,n[4]=y*u-g,n[8]=p*u+w,n[1]=l*h,n[5]=w*u+p,n[9]=g*u-y,n[2]=-u,n[6]=a*l,n[10]=s*l}else if(e.order==="YZX"){const p=s*l,g=s*u,y=a*l,w=a*u;n[0]=l*d,n[4]=w-p*h,n[8]=y*h+g,n[1]=h,n[5]=s*d,n[9]=-a*d,n[2]=-u*d,n[6]=g*h+y,n[10]=p-w*h}else if(e.order==="XZY"){const p=s*l,g=s*u,y=a*l,w=a*u;n[0]=l*d,n[4]=-h,n[8]=u*d,n[1]=p*h+w,n[5]=s*d,n[9]=g*h-y,n[2]=y*h-g,n[6]=a*d,n[10]=w*h+p}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(XU,e,YU)}lookAt(e,n,r){const i=this.elements;return pi.subVectors(e,n),pi.lengthSq()===0&&(pi.z=1),pi.normalize(),Ws.crossVectors(r,pi),Ws.lengthSq()===0&&(Math.abs(r.z)===1?pi.x+=1e-4:pi.z+=1e-4,pi.normalize(),Ws.crossVectors(r,pi)),Ws.normalize(),Pp.crossVectors(pi,Ws),i[0]=Ws.x,i[4]=Pp.x,i[8]=pi.x,i[1]=Ws.y,i[5]=Pp.y,i[9]=pi.y,i[2]=Ws.z,i[6]=Pp.z,i[10]=pi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,o=this.elements,s=r[0],a=r[4],l=r[8],u=r[12],d=r[1],h=r[5],p=r[9],g=r[13],y=r[2],w=r[6],x=r[10],m=r[14],_=r[3],S=r[7],M=r[11],T=r[15],A=i[0],R=i[4],O=i[8],C=i[12],P=i[1],k=i[5],X=i[9],oe=i[13],V=i[2],K=i[6],J=i[10],se=i[14],F=i[3],$=i[7],j=i[11],H=i[15];return o[0]=s*A+a*P+l*V+u*F,o[4]=s*R+a*k+l*K+u*$,o[8]=s*O+a*X+l*J+u*j,o[12]=s*C+a*oe+l*se+u*H,o[1]=d*A+h*P+p*V+g*F,o[5]=d*R+h*k+p*K+g*$,o[9]=d*O+h*X+p*J+g*j,o[13]=d*C+h*oe+p*se+g*H,o[2]=y*A+w*P+x*V+m*F,o[6]=y*R+w*k+x*K+m*$,o[10]=y*O+w*X+x*J+m*j,o[14]=y*C+w*oe+x*se+m*H,o[3]=_*A+S*P+M*V+T*F,o[7]=_*R+S*k+M*K+T*$,o[11]=_*O+S*X+M*J+T*j,o[15]=_*C+S*oe+M*se+T*H,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],o=e[12],s=e[1],a=e[5],l=e[9],u=e[13],d=e[2],h=e[6],p=e[10],g=e[14],y=e[3],w=e[7],x=e[11],m=e[15];return y*(+o*l*h-i*u*h-o*a*p+r*u*p+i*a*g-r*l*g)+w*(+n*l*g-n*u*p+o*s*p-i*s*g+i*u*d-o*l*d)+x*(+n*u*h-n*a*g-o*s*h+r*s*g+o*a*d-r*u*d)+m*(-i*a*d-n*l*h+n*a*p+i*s*h-r*s*p+r*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],d=e[8],h=e[9],p=e[10],g=e[11],y=e[12],w=e[13],x=e[14],m=e[15],_=h*x*u-w*p*u+w*l*g-a*x*g-h*l*m+a*p*m,S=y*p*u-d*x*u-y*l*g+s*x*g+d*l*m-s*p*m,M=d*w*u-y*h*u+y*a*g-s*w*g-d*a*m+s*h*m,T=y*h*l-d*w*l-y*a*p+s*w*p+d*a*x-s*h*x,A=n*_+r*S+i*M+o*T;if(A===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/A;return e[0]=_*R,e[1]=(w*p*o-h*x*o-w*i*g+r*x*g+h*i*m-r*p*m)*R,e[2]=(a*x*o-w*l*o+w*i*u-r*x*u-a*i*m+r*l*m)*R,e[3]=(h*l*o-a*p*o-h*i*u+r*p*u+a*i*g-r*l*g)*R,e[4]=S*R,e[5]=(d*x*o-y*p*o+y*i*g-n*x*g-d*i*m+n*p*m)*R,e[6]=(y*l*o-s*x*o-y*i*u+n*x*u+s*i*m-n*l*m)*R,e[7]=(s*p*o-d*l*o+d*i*u-n*p*u-s*i*g+n*l*g)*R,e[8]=M*R,e[9]=(y*h*o-d*w*o-y*r*g+n*w*g+d*r*m-n*h*m)*R,e[10]=(s*w*o-y*a*o+y*r*u-n*w*u-s*r*m+n*a*m)*R,e[11]=(d*a*o-s*h*o-d*r*u+n*h*u+s*r*g-n*a*g)*R,e[12]=T*R,e[13]=(d*w*i-y*h*i+y*r*p-n*w*p-d*r*x+n*h*x)*R,e[14]=(y*a*i-s*w*i-y*r*l+n*w*l+s*r*x-n*a*x)*R,e[15]=(s*h*i-d*a*i+d*r*l-n*h*l-s*r*p+n*a*p)*R,this}scale(e){const n=this.elements,r=e.x,i=e.y,o=e.z;return n[0]*=r,n[4]*=i,n[8]*=o,n[1]*=r,n[5]*=i,n[9]*=o,n[2]*=r,n[6]*=i,n[10]*=o,n[3]*=r,n[7]*=i,n[11]*=o,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=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(n,r,i))}makeTranslation(e,n,r){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,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),o=1-r,s=e.x,a=e.y,l=e.z,u=o*s,d=o*a;return this.set(u*s+r,u*a-i*l,u*l+i*a,0,u*a+i*l,d*a+r,d*l-i*s,0,u*l-i*a,d*l+i*s,o*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,o,s){return this.set(1,r,o,0,e,1,s,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,o=n._x,s=n._y,a=n._z,l=n._w,u=o+o,d=s+s,h=a+a,p=o*u,g=o*d,y=o*h,w=s*d,x=s*h,m=a*h,_=l*u,S=l*d,M=l*h,T=r.x,A=r.y,R=r.z;return i[0]=(1-(w+m))*T,i[1]=(g+M)*T,i[2]=(y-S)*T,i[3]=0,i[4]=(g-M)*A,i[5]=(1-(p+m))*A,i[6]=(x+_)*A,i[7]=0,i[8]=(y+S)*R,i[9]=(x-_)*R,i[10]=(1-(p+w))*R,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let o=oc.set(i[0],i[1],i[2]).length();const s=oc.set(i[4],i[5],i[6]).length(),a=oc.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),e.x=i[12],e.y=i[13],e.z=i[14],eo.copy(this);const u=1/o,d=1/s,h=1/a;return eo.elements[0]*=u,eo.elements[1]*=u,eo.elements[2]*=u,eo.elements[4]*=d,eo.elements[5]*=d,eo.elements[6]*=d,eo.elements[8]*=h,eo.elements[9]*=h,eo.elements[10]*=h,n.setFromRotationMatrix(eo),r.x=o,r.y=s,r.z=a,this}makePerspective(e,n,r,i,o,s,a=No){const l=this.elements,u=2*o/(n-e),d=2*o/(r-i),h=(n+e)/(n-e),p=(r+i)/(r-i);let g,y;if(a===No)g=-(s+o)/(s-o),y=-2*s*o/(s-o);else if(a===wd)g=-s/(s-o),y=-s*o/(s-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,o,s,a=No){const l=this.elements,u=1/(n-e),d=1/(r-i),h=1/(s-o),p=(n+e)*u,g=(r+i)*d;let y,w;if(a===No)y=(s+o)*h,w=-2*h;else if(a===wd)y=o*h,w=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-g,l[2]=0,l[6]=0,l[10]=w,l[14]=-y,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const oc=new G,eo=new wt,XU=new G(0,0,0),YU=new G(1,1,1),Ws=new G,Pp=new G,pi=new G,Fb=new wt,zb=new mr;class Yd{constructor(e=0,n=0,r=0,i=Yd.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,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,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,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,n=this._order,r=!0){const i=e.elements,o=i[0],s=i[4],a=i[8],l=i[1],u=i[5],d=i[9],h=i[2],p=i[6],g=i[10];switch(n){case"XYZ":this._y=Math.asin(zn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,u),this._z=0);break;case"YXZ":this._x=Math.asin(-zn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,g),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(zn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,g),this._z=Math.atan2(-s,u)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-zn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,u));break;case"YZX":this._z=Math.asin(zn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,u),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(a,g));break;case"XZY":this._z=Math.asin(-zn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,u),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-d,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return Fb.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Fb,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return zb.setFromEuler(this),this.setFromQuaternion(zb,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}Yd.DEFAULT_ORDER="XYZ";class yl{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let r=0;r0&&(r=r.concat(s))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(lf,e,ZU),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(lf,KU,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function o(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.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=o(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let u=0,d=l.length;u0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),u.length>0&&(r.textures=u),d.length>0&&(r.images=d),h.length>0&&(r.shapes=h),p.length>0&&(r.skeletons=p),g.length>0&&(r.animations=g),y.length>0&&(r.nodes=y)}return r.object=i,r;function s(a){const l=[];for(const u in a){const d=a[u];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,n,r,i,o){to.subVectors(i,n),rs.subVectors(r,n),xy.subVectors(e,n);const s=to.dot(to),a=to.dot(rs),l=to.dot(xy),u=rs.dot(rs),d=rs.dot(xy),h=s*u-a*a;if(h===0)return o.set(-2,-1,-1);const p=1/h,g=(u*l-a*d)*p,y=(s*d-a*l)*p;return o.set(1-g-y,y,g)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,is),is.x>=0&&is.y>=0&&is.x+is.y<=1}static getUV(e,n,r,i,o,s,a,l){return Lp===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Lp=!0),this.getInterpolation(e,n,r,i,o,s,a,l)}static getInterpolation(e,n,r,i,o,s,a,l){return this.getBarycoord(e,n,r,i,is),l.setScalar(0),l.addScaledVector(o,is.x),l.addScaledVector(s,is.y),l.addScaledVector(a,is.z),l}static isFrontFacing(e,n,r,i){return to.subVectors(r,n),rs.subVectors(e,n),to.cross(rs).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),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 to.subVectors(this.c,this.b),rs.subVectors(this.a,this.b),to.cross(rs).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ni.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return ni.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,r,i,o){return Lp===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Lp=!0),ni.getInterpolation(e,this.a,this.b,this.c,n,r,i,o)}getInterpolation(e,n,r,i,o){return ni.getInterpolation(e,this.a,this.b,this.c,n,r,i,o)}containsPoint(e){return ni.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ni.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,o=this.c;let s,a;ac.subVectors(i,r),lc.subVectors(o,r),Sy.subVectors(e,r);const l=ac.dot(Sy),u=lc.dot(Sy);if(l<=0&&u<=0)return n.copy(r);wy.subVectors(e,i);const d=ac.dot(wy),h=lc.dot(wy);if(d>=0&&h<=d)return n.copy(i);const p=l*h-d*u;if(p<=0&&l>=0&&d<=0)return s=l/(l-d),n.copy(r).addScaledVector(ac,s);Ey.subVectors(e,o);const g=ac.dot(Ey),y=lc.dot(Ey);if(y>=0&&g<=y)return n.copy(o);const w=g*u-l*y;if(w<=0&&u>=0&&y<=0)return a=u/(u-y),n.copy(r).addScaledVector(lc,a);const x=d*y-g*h;if(x<=0&&h-d>=0&&g-y>=0)return Gb.subVectors(o,i),a=(h-d)/(h-d+(g-y)),n.copy(i).addScaledVector(Gb,a);const m=1/(x+w+p);return s=w*m,a=p*m,n.copy(r).addScaledVector(ac,s).addScaledVector(lc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const p3={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},Gs={h:0,s:0,l:0},Dp={h:0,s:0,l:0};function My(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let tt=class{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===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,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Qn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rn.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=rn.workingColorSpace){return this.r=e,this.g=n,this.b=r,rn.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=rn.workingColorSpace){if(e=OS(e,1),n=zn(n,0,1),r=zn(r,0,1),n===0)this.r=this.g=this.b=r;else{const o=r<=.5?r*(1+n):r+n-r*n,s=2*r-o;this.r=My(s,o,e+1/3),this.g=My(s,o,e),this.b=My(s,o,e-1/3)}return rn.toWorkingColorSpace(this,i),this}setStyle(e,n=Qn){function r(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,n);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,n);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],s=o.length;if(s===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,n);if(s===6)return this.setHex(parseInt(o,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Qn){const r=p3[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Jc(e.r),this.g=Jc(e.g),this.b=Jc(e.b),this}copyLinearToSRGB(e){return this.r=dy(e.r),this.g=dy(e.g),this.b=dy(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Qn){return rn.fromWorkingColorSpace(br.copy(this),e),Math.round(zn(br.r*255,0,255))*65536+Math.round(zn(br.g*255,0,255))*256+Math.round(zn(br.b*255,0,255))}getHexString(e=Qn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=rn.workingColorSpace){rn.fromWorkingColorSpace(br.copy(this),n);const r=br.r,i=br.g,o=br.b,s=Math.max(r,i,o),a=Math.min(r,i,o);let l,u;const d=(a+s)/2;if(a===s)l=0,u=0;else{const h=s-a;switch(u=d<=.5?h/(s+a):h/(2-s-a),s){case r:l=(i-o)/h+(i0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==gl&&(r.blending=this.blending),this.side!==Bo&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==gg&&(r.blendSrc=this.blendSrc),this.blendDst!==vg&&(r.blendDst=this.blendDst),this.blendEquation!==Js&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==fd&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Bx&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==tl&&(r.stencilFail=this.stencilFail),this.stencilZFail!==tl&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==tl&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(o){const s=[];for(const a in o){const l=o[a];delete l.metadata,s.push(l)}return s}if(n){const o=i(e.textures),s=i(e.images);o.length>0&&(r.textures=o),s.length>0&&(r.images=s)}return r}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 n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let o=0;o!==i;++o)r[o]=n[o].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ca extends vr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=jd,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.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 fs=tF();function tF(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const u=l-127;u<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):u<-14?(r[l]=1024>>-u-14,r[l|256]=1024>>-u-14|32768,i[l]=-u-1,i[l|256]=-u-1):u<=15?(r[l]=u+15<<10,r[l|256]=u+15<<10|32768,i[l]=13,i[l|256]=13):u<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const o=new Uint32Array(2048),s=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let u=l<<13,d=0;for(;!(u&8388608);)u<<=1,d-=8388608;u&=-8388609,d+=947912704,o[l]=u|d}for(let l=1024;l<2048;++l)o[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)s[l]=l<<23;s[31]=1199570944,s[32]=2147483648;for(let l=33;l<63;++l)s[l]=2147483648+(l-32<<23);s[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:o,exponentTable:s,offsetTable:a}}function Qr(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=zn(t,-65504,65504),fs.floatView[0]=t;const e=fs.uint32View[0],n=e>>23&511;return fs.baseTable[n]+((e&8388607)>>fs.shiftTable[n])}function Tf(t){const e=t>>10;return fs.uint32View[0]=fs.mantissaTable[fs.offsetTable[e]+(t&1023)]+fs.exponentTable[e],fs.floatView[0]}const ul={toHalfFloat:Qr,fromHalfFloat:Tf},Yn=new G,Op=new Te;class sn{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=Sd,this.updateRange={offset:0,count:-1},this.gpuType=cr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,o=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const u=r[l];e.data.attributes[l]=u.toJSON(e.data)}const i={};let o=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],d=[];for(let h=0,p=u.length;h0&&(i[l]=d,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const u in i){const d=i[u];this.setAttribute(u,d.clone(n))}const o=e.morphAttributes;for(const u in o){const d=[],h=o[u];for(let p=0,g=h.length;p0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o(e.far-e.near)**2))&&($b.copy(o).invert(),Ga.copy(e.ray).applyMatrix4($b),!(r.boundingBox!==null&&Ga.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Ga)))}_computeIntersections(e,n,r){let i;const o=this.geometry,s=this.material,a=o.index,l=o.attributes.position,u=o.attributes.uv,d=o.attributes.uv1,h=o.attributes.normal,p=o.groups,g=o.drawRange;if(a!==null)if(Array.isArray(s))for(let y=0,w=p.length;yn.far?null:{distance:u,point:Hp.clone(),object:t}}function Vp(t,e,n,r,i,o,s,a,l,u){t.getVertexPosition(a,uc),t.getVertexPosition(l,fc),t.getVertexPosition(u,dc);const d=uF(t,e,n,r,uc,fc,dc,Bp);if(d){i&&(Up.fromBufferAttribute(i,a),Fp.fromBufferAttribute(i,l),zp.fromBufferAttribute(i,u),d.uv=ni.getInterpolation(Bp,uc,fc,dc,Up,Fp,zp,new Te)),o&&(Up.fromBufferAttribute(o,a),Fp.fromBufferAttribute(o,l),zp.fromBufferAttribute(o,u),d.uv1=ni.getInterpolation(Bp,uc,fc,dc,Up,Fp,zp,new Te),d.uv2=d.uv1),s&&(Xb.fromBufferAttribute(s,a),Yb.fromBufferAttribute(s,l),qb.fromBufferAttribute(s,u),d.normal=ni.getInterpolation(Bp,uc,fc,dc,Xb,Yb,qb,new G),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const h={a,b:l,c:u,normal:new G,materialIndex:0};ni.getNormal(uc,fc,dc,h.normal),d.face=h}return d}class kl extends zt{constructor(e=1,n=1,r=1,i=1,o=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:o,depthSegments:s};const a=this;i=Math.floor(i),o=Math.floor(o),s=Math.floor(s);const l=[],u=[],d=[],h=[];let p=0,g=0;y("z","y","x",-1,-1,r,n,e,s,o,0),y("z","y","x",1,-1,r,n,-e,s,o,1),y("x","z","y",1,1,e,r,n,i,s,2),y("x","z","y",1,-1,e,r,-n,i,s,3),y("x","y","z",1,-1,e,n,r,i,o,4),y("x","y","z",-1,-1,e,n,-r,i,o,5),this.setIndex(l),this.setAttribute("position",new ut(u,3)),this.setAttribute("normal",new ut(d,3)),this.setAttribute("uv",new ut(h,2));function y(w,x,m,_,S,M,T,A,R,O,C){const P=M/R,k=T/O,X=M/2,oe=T/2,V=A/2,K=R+1,J=O+1;let se=0,F=0;const $=new G;for(let j=0;j0?1:-1,d.push($.x,$.y,$.z),h.push(Z/R),h.push(1-j/O),se+=1}}for(let j=0;j0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class qd extends Qt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new wt,this.projectionMatrix=new wt,this.projectionMatrixInverse=new wt,this.coordinateSystem=No}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Bn extends qd{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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 n=.5*this.getFilmHeight()/e;this.fov=cu*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(vl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return cu*2*Math.atan(Math.tan(vl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,n,r,i,o,s){this.aspect=e/n,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=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=o,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(vl*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,o=-.5*i;const s=this.view;if(this.view!==null&&this.view.enabled){const l=s.fullWidth,u=s.fullHeight;o+=s.offsetX*i/l,n-=s.offsetY*r/u,i*=s.width/l,r*=s.height/u}const a=this.filmOffset;a!==0&&(o+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const hc=-90,pc=1;class g3 extends Qt{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Bn(hc,pc,e,n);i.layers=this.layers,this.add(i);const o=new Bn(hc,pc,e,n);o.layers=this.layers,this.add(o);const s=new Bn(hc,pc,e,n);s.layers=this.layers,this.add(s);const a=new Bn(hc,pc,e,n);a.layers=this.layers,this.add(a);const l=new Bn(hc,pc,e,n);l.layers=this.layers,this.add(l);const u=new Bn(hc,pc,e,n);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,o,s,a,l]=n;for(const u of n)this.remove(u);if(e===No)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===wd)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const u of n)this.add(u),u.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,s,a,l,u,d]=this.children,h=e.getRenderTarget(),p=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const w=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,o),e.setRenderTarget(r,1,i),e.render(n,s),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,u),r.texture.generateMipmaps=w,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(h,p,g),e.xr.enabled=y,r.texture.needsPMREMUpdate=!0}}class Zd extends Dn{constructor(e,n,r,i,o,s,a,l,u,d){e=e!==void 0?e:[],n=n!==void 0?n:Ho,super(e,n,r,i,o,s,a,l,u,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class BS extends ji{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];n.encoding!==void 0&&(Hf("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===da?Qn:yi),this.texture=new Zd(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:un}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},i=new kl(5,5,5),o=new Xi({name:"CubemapFromEquirect",uniforms:uu(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Lr,blending:vs});o.uniforms.tEquirect.value=n;const s=new ur(i,o),a=n.minFilter;return n.minFilter===ya&&(n.minFilter=un),new g3(1,10,this).update(e,s),n.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,n,r,i){const o=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(n,r,i);e.setRenderTarget(o)}}const Ay=new G,pF=new G,mF=new Ft;class cs{constructor(e=new G(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=Ay.subVectors(r,n).cross(pF.subVectors(e,n)).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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(Ay),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/i;return o<0||o>1?null:n.copy(e.start).addScaledVector(r,o)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>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,n){const r=n||mF.getNormalMatrix(e),i=this.coplanarPoint(Ay).applyMatrix4(e),o=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(o),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 $a=new go,Wp=new G;class s0{constructor(e=new cs,n=new cs,r=new cs,i=new cs,o=new cs,s=new cs){this.planes=[e,n,r,i,o,s]}set(e,n,r,i,o,s){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(o),a[5].copy(s),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=No){const r=this.planes,i=e.elements,o=i[0],s=i[1],a=i[2],l=i[3],u=i[4],d=i[5],h=i[6],p=i[7],g=i[8],y=i[9],w=i[10],x=i[11],m=i[12],_=i[13],S=i[14],M=i[15];if(r[0].setComponents(l-o,p-u,x-g,M-m).normalize(),r[1].setComponents(l+o,p+u,x+g,M+m).normalize(),r[2].setComponents(l+s,p+d,x+y,M+_).normalize(),r[3].setComponents(l-s,p-d,x-y,M-_).normalize(),r[4].setComponents(l-a,p-h,x-w,M-S).normalize(),n===No)r[5].setComponents(l+a,p+h,x+w,M+S).normalize();else if(n===wd)r[5].setComponents(a,h,w,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),$a.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),$a.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($a)}intersectsSprite(e){return $a.center.set(0,0,0),$a.radius=.7071067811865476,$a.applyMatrix4(e.matrixWorld),this.intersectsSphere($a)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let o=0;o<6;o++)if(n[o].distanceToPoint(r)0?e.max.x:e.min.x,Wp.y=i.normal.y>0?e.max.y:e.min.y,Wp.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Wp)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function v3(){let t=null,e=!1,n=null,r=null;function i(o,s){n(o,s),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(o){n=o},setContext:function(o){t=o}}}function gF(t,e){const n=e.isWebGL2,r=new WeakMap;function i(u,d){const h=u.array,p=u.usage,g=t.createBuffer();t.bindBuffer(d,g),t.bufferData(d,h,p),u.onUploadCallback();let y;if(h instanceof Float32Array)y=t.FLOAT;else if(h instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(n)y=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else y=t.UNSIGNED_SHORT;else if(h instanceof Int16Array)y=t.SHORT;else if(h instanceof Uint32Array)y=t.UNSIGNED_INT;else if(h instanceof Int32Array)y=t.INT;else if(h instanceof Int8Array)y=t.BYTE;else if(h instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:g,type:y,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version}}function o(u,d,h){const p=d.array,g=d.updateRange;t.bindBuffer(h,u),g.count===-1?t.bufferSubData(h,0,p):(n?t.bufferSubData(h,g.offset*p.BYTES_PER_ELEMENT,p,g.offset,g.count):t.bufferSubData(h,g.offset*p.BYTES_PER_ELEMENT,p.subarray(g.offset,g.offset+g.count)),g.count=-1),d.onUploadCallback()}function s(u){return u.isInterleavedBufferAttribute&&(u=u.data),r.get(u)}function a(u){u.isInterleavedBufferAttribute&&(u=u.data);const d=r.get(u);d&&(t.deleteBuffer(d.buffer),r.delete(u))}function l(u,d){if(u.isGLBufferAttribute){const p=r.get(u);(!p||p.version 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif`,IF=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,LF=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,DF=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,OF=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,NF=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,kF=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,UF=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif`,FF=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } float luminance( const in vec3 rgb ) { const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,zF=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_v0 0.339 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_v1 0.276 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_v4 0.046 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_v5 0.016 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_v6 0.0038 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,BF=`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); transformedNormal = m * transformedNormal; #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,HF=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,VF=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,WF=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,GF=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,$F="gl_FragColor = linearToOutputTexel( gl_FragColor );",jF=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), vec3( 0.0170827, 0.0723974, 0.9105199 ) ); const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( vec3( 1.2249401, - 0.2249404, 0.0 ), vec3( - 0.0420569, 1.0420571, 0.0 ), vec3( - 0.0196376, - 0.0786361, 1.0982735 ) ); vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); } vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); } vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); } vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); }`,XF=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,YF=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,qF=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,ZF=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,KF=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,JF=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,QF=`#ifdef USE_FOG varying float vFogDepth; #endif`,ez=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,tz=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,nz=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif }`,rz=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,iz=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,oz=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,sz=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,az=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { #if defined ( LEGACY_LIGHTS ) if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #else float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #endif } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,lz=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,cz=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,uz=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,fz=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,dz=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,hz=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y; #endif`,pz=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,mz=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,gz=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,vz=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,yz=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,_z=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,xz=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,Sz=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif`,wz=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,Ez=`#ifdef USE_MAP uniform sampler2D map; #endif`,Mz=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,bz=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,Tz=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,Az=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,Cz=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,Rz=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #else objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif #endif`,Pz=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #else #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif #endif`,Iz=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #else transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif #endif`,Lz=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,Dz=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,Oz=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,Nz=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,kz=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,Uz=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,Fz=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,zz=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,Bz=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,Hz=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,Vz=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Wz=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec2 packDepthToRG( in highp float v ) { return packDepthToRGBA( v ).yx; } float unpackRGToDepth( const in highp vec2 v ) { return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); } vec4 pack2HalfToRGBA( vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { return depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); }`,Gz=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,$z=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,jz=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,Xz=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,Yz=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,qz=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,Zz=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return shadow; } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); vec3 lightToPosition = shadowCoord.xyz; float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif`,Kz=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,Jz=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,Qz=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,e4=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,t4=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; uniform int boneTextureSize; mat4 getBoneMatrix( const in float i ) { float j = i * 4.0; float x = mod( j, float( boneTextureSize ) ); float y = floor( j / float( boneTextureSize ) ); float dx = 1.0 / float( boneTextureSize ); float dy = 1.0 / float( boneTextureSize ); y = dy * ( y + 0.5 ); vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } #endif`,n4=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,r4=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,i4=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,o4=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,s4=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,a4=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 OptimizedCineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,l4=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,c4=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,u4=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,f4=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,d4=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,h4=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const p4=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,m4=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,g4=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,v4=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,y4=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,_4=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,x4=`#include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,S4=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif }`,w4=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,E4=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,M4=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,b4=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,T4=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include }`,A4=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,C4=`#include #include #include #include #include #include #include #include #include void main() { #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,R4=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,P4=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,I4=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,L4=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,D4=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,O4=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,N4=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,k4=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,U4=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,F4=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,z4=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,B4=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,H4=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,V4=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,W4=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,G4=`#include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include }`,$4=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,j4=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,X4=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,Nt={alphahash_fragment:vF,alphahash_pars_fragment:yF,alphamap_fragment:_F,alphamap_pars_fragment:xF,alphatest_fragment:SF,alphatest_pars_fragment:wF,aomap_fragment:EF,aomap_pars_fragment:MF,begin_vertex:bF,beginnormal_vertex:TF,bsdfs:AF,iridescence_fragment:CF,bumpmap_pars_fragment:RF,clipping_planes_fragment:PF,clipping_planes_pars_fragment:IF,clipping_planes_pars_vertex:LF,clipping_planes_vertex:DF,color_fragment:OF,color_pars_fragment:NF,color_pars_vertex:kF,color_vertex:UF,common:FF,cube_uv_reflection_fragment:zF,defaultnormal_vertex:BF,displacementmap_pars_vertex:HF,displacementmap_vertex:VF,emissivemap_fragment:WF,emissivemap_pars_fragment:GF,colorspace_fragment:$F,colorspace_pars_fragment:jF,envmap_fragment:XF,envmap_common_pars_fragment:YF,envmap_pars_fragment:qF,envmap_pars_vertex:ZF,envmap_physical_pars_fragment:lz,envmap_vertex:KF,fog_vertex:JF,fog_pars_vertex:QF,fog_fragment:ez,fog_pars_fragment:tz,gradientmap_pars_fragment:nz,lightmap_fragment:rz,lightmap_pars_fragment:iz,lights_lambert_fragment:oz,lights_lambert_pars_fragment:sz,lights_pars_begin:az,lights_toon_fragment:cz,lights_toon_pars_fragment:uz,lights_phong_fragment:fz,lights_phong_pars_fragment:dz,lights_physical_fragment:hz,lights_physical_pars_fragment:pz,lights_fragment_begin:mz,lights_fragment_maps:gz,lights_fragment_end:vz,logdepthbuf_fragment:yz,logdepthbuf_pars_fragment:_z,logdepthbuf_pars_vertex:xz,logdepthbuf_vertex:Sz,map_fragment:wz,map_pars_fragment:Ez,map_particle_fragment:Mz,map_particle_pars_fragment:bz,metalnessmap_fragment:Tz,metalnessmap_pars_fragment:Az,morphcolor_vertex:Cz,morphnormal_vertex:Rz,morphtarget_pars_vertex:Pz,morphtarget_vertex:Iz,normal_fragment_begin:Lz,normal_fragment_maps:Dz,normal_pars_fragment:Oz,normal_pars_vertex:Nz,normal_vertex:kz,normalmap_pars_fragment:Uz,clearcoat_normal_fragment_begin:Fz,clearcoat_normal_fragment_maps:zz,clearcoat_pars_fragment:Bz,iridescence_pars_fragment:Hz,opaque_fragment:Vz,packing:Wz,premultiplied_alpha_fragment:Gz,project_vertex:$z,dithering_fragment:jz,dithering_pars_fragment:Xz,roughnessmap_fragment:Yz,roughnessmap_pars_fragment:qz,shadowmap_pars_fragment:Zz,shadowmap_pars_vertex:Kz,shadowmap_vertex:Jz,shadowmask_pars_fragment:Qz,skinbase_vertex:e4,skinning_pars_vertex:t4,skinning_vertex:n4,skinnormal_vertex:r4,specularmap_fragment:i4,specularmap_pars_fragment:o4,tonemapping_fragment:s4,tonemapping_pars_fragment:a4,transmission_fragment:l4,transmission_pars_fragment:c4,uv_pars_fragment:u4,uv_pars_vertex:f4,uv_vertex:d4,worldpos_vertex:h4,background_vert:p4,background_frag:m4,backgroundCube_vert:g4,backgroundCube_frag:v4,cube_vert:y4,cube_frag:_4,depth_vert:x4,depth_frag:S4,distanceRGBA_vert:w4,distanceRGBA_frag:E4,equirect_vert:M4,equirect_frag:b4,linedashed_vert:T4,linedashed_frag:A4,meshbasic_vert:C4,meshbasic_frag:R4,meshlambert_vert:P4,meshlambert_frag:I4,meshmatcap_vert:L4,meshmatcap_frag:D4,meshnormal_vert:O4,meshnormal_frag:N4,meshphong_vert:k4,meshphong_frag:U4,meshphysical_vert:F4,meshphysical_frag:z4,meshtoon_vert:B4,meshtoon_frag:H4,points_vert:V4,points_frag:W4,shadow_vert:G4,shadow_frag:$4,sprite_vert:j4,sprite_frag:X4},Ye={common:{diffuse:{value:new tt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ft}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ft}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ft}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ft},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ft},normalScale:{value:new Te(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ft},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ft}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ft}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ft}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new tt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0},uvTransform:{value:new Ft}},sprite:{diffuse:{value:new tt(16777215)},opacity:{value:1},center:{value:new Te(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0}}},ao={basic:{uniforms:Br([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.fog]),vertexShader:Nt.meshbasic_vert,fragmentShader:Nt.meshbasic_frag},lambert:{uniforms:Br([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new tt(0)}}]),vertexShader:Nt.meshlambert_vert,fragmentShader:Nt.meshlambert_frag},phong:{uniforms:Br([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new tt(0)},specular:{value:new tt(1118481)},shininess:{value:30}}]),vertexShader:Nt.meshphong_vert,fragmentShader:Nt.meshphong_frag},standard:{uniforms:Br([Ye.common,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.roughnessmap,Ye.metalnessmap,Ye.fog,Ye.lights,{emissive:{value:new tt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Nt.meshphysical_vert,fragmentShader:Nt.meshphysical_frag},toon:{uniforms:Br([Ye.common,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.gradientmap,Ye.fog,Ye.lights,{emissive:{value:new tt(0)}}]),vertexShader:Nt.meshtoon_vert,fragmentShader:Nt.meshtoon_frag},matcap:{uniforms:Br([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,{matcap:{value:null}}]),vertexShader:Nt.meshmatcap_vert,fragmentShader:Nt.meshmatcap_frag},points:{uniforms:Br([Ye.points,Ye.fog]),vertexShader:Nt.points_vert,fragmentShader:Nt.points_frag},dashed:{uniforms:Br([Ye.common,Ye.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Nt.linedashed_vert,fragmentShader:Nt.linedashed_frag},depth:{uniforms:Br([Ye.common,Ye.displacementmap]),vertexShader:Nt.depth_vert,fragmentShader:Nt.depth_frag},normal:{uniforms:Br([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,{opacity:{value:1}}]),vertexShader:Nt.meshnormal_vert,fragmentShader:Nt.meshnormal_frag},sprite:{uniforms:Br([Ye.sprite,Ye.fog]),vertexShader:Nt.sprite_vert,fragmentShader:Nt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ft},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Nt.background_vert,fragmentShader:Nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Nt.backgroundCube_vert,fragmentShader:Nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Nt.cube_vert,fragmentShader:Nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Nt.equirect_vert,fragmentShader:Nt.equirect_frag},distanceRGBA:{uniforms:Br([Ye.common,Ye.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Nt.distanceRGBA_vert,fragmentShader:Nt.distanceRGBA_frag},shadow:{uniforms:Br([Ye.lights,Ye.fog,{color:{value:new tt(0)},opacity:{value:1}}]),vertexShader:Nt.shadow_vert,fragmentShader:Nt.shadow_frag}};ao.physical={uniforms:Br([ao.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ft},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ft},clearcoatNormalScale:{value:new Te(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ft},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ft},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ft},sheen:{value:0},sheenColor:{value:new tt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ft},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ft},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ft},transmissionSamplerSize:{value:new Te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ft},attenuationDistance:{value:0},attenuationColor:{value:new tt(0)},specularColor:{value:new tt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ft},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ft},anisotropyVector:{value:new Te},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ft}}]),vertexShader:Nt.meshphysical_vert,fragmentShader:Nt.meshphysical_frag};const Gp={r:0,b:0,g:0};function Y4(t,e,n,r,i,o,s){const a=new tt(0);let l=o===!0?0:1,u,d,h=null,p=0,g=null;function y(x,m){let _=!1,S=m.isScene===!0?m.background:null;S&&S.isTexture&&(S=(m.backgroundBlurriness>0?n:e).get(S)),S===null?w(a,l):S&&S.isColor&&(w(S,1),_=!0);const M=t.xr.getEnvironmentBlendMode();M==="additive"?r.buffers.color.setClear(0,0,0,1,s):M==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,s),(t.autoClear||_)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),S&&(S.isCubeTexture||S.mapping===_u)?(d===void 0&&(d=new ur(new kl(1,1,1),new Xi({name:"BackgroundCubeMaterial",uniforms:uu(ao.backgroundCube.uniforms),vertexShader:ao.backgroundCube.vertexShader,fragmentShader:ao.backgroundCube.fragmentShader,side:Lr,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(T,A,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),d.material.uniforms.envMap.value=S,d.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,d.material.toneMapped=rn.getTransfer(S.colorSpace)!==hn,(h!==S||p!==S.version||g!==t.toneMapping)&&(d.material.needsUpdate=!0,h=S,p=S.version,g=t.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null)):S&&S.isTexture&&(u===void 0&&(u=new ur(new Kd(2,2),new Xi({name:"BackgroundMaterial",uniforms:uu(ao.background.uniforms),vertexShader:ao.background.vertexShader,fragmentShader:ao.background.fragmentShader,side:Bo,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(u)),u.material.uniforms.t2D.value=S,u.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,u.material.toneMapped=rn.getTransfer(S.colorSpace)!==hn,S.matrixAutoUpdate===!0&&S.updateMatrix(),u.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||p!==S.version||g!==t.toneMapping)&&(u.material.needsUpdate=!0,h=S,p=S.version,g=t.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null))}function w(x,m){x.getRGB(Gp,m3(t)),r.buffers.color.setClear(Gp.r,Gp.g,Gp.b,m,s)}return{getClearColor:function(){return a},setClearColor:function(x,m=1){a.set(x),l=m,w(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,w(a,l)},render:y}}function q4(t,e,n,r){const i=t.getParameter(t.MAX_VERTEX_ATTRIBS),o=r.isWebGL2?null:e.get("OES_vertex_array_object"),s=r.isWebGL2||o!==null,a={},l=x(null);let u=l,d=!1;function h(V,K,J,se,F){let $=!1;if(s){const j=w(se,J,K);u!==j&&(u=j,g(u.object)),$=m(V,se,J,F),$&&_(V,se,J,F)}else{const j=K.wireframe===!0;(u.geometry!==se.id||u.program!==J.id||u.wireframe!==j)&&(u.geometry=se.id,u.program=J.id,u.wireframe=j,$=!0)}F!==null&&n.update(F,t.ELEMENT_ARRAY_BUFFER),($||d)&&(d=!1,O(V,K,J,se),F!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(F).buffer))}function p(){return r.isWebGL2?t.createVertexArray():o.createVertexArrayOES()}function g(V){return r.isWebGL2?t.bindVertexArray(V):o.bindVertexArrayOES(V)}function y(V){return r.isWebGL2?t.deleteVertexArray(V):o.deleteVertexArrayOES(V)}function w(V,K,J){const se=J.wireframe===!0;let F=a[V.id];F===void 0&&(F={},a[V.id]=F);let $=F[K.id];$===void 0&&($={},F[K.id]=$);let j=$[se];return j===void 0&&(j=x(p()),$[se]=j),j}function x(V){const K=[],J=[],se=[];for(let F=0;F=0){const xe=F[Z];let Ee=$[Z];if(Ee===void 0&&(Z==="instanceMatrix"&&V.instanceMatrix&&(Ee=V.instanceMatrix),Z==="instanceColor"&&V.instanceColor&&(Ee=V.instanceColor)),xe===void 0||xe.attribute!==Ee||Ee&&xe.data!==Ee.data)return!0;j++}return u.attributesNum!==j||u.index!==se}function _(V,K,J,se){const F={},$=K.attributes;let j=0;const H=J.getAttributes();for(const Z in H)if(H[Z].location>=0){let xe=$[Z];xe===void 0&&(Z==="instanceMatrix"&&V.instanceMatrix&&(xe=V.instanceMatrix),Z==="instanceColor"&&V.instanceColor&&(xe=V.instanceColor));const Ee={};Ee.attribute=xe,xe&&xe.data&&(Ee.data=xe.data),F[Z]=Ee,j++}u.attributes=F,u.attributesNum=j,u.index=se}function S(){const V=u.newAttributes;for(let K=0,J=V.length;K=0){let ge=F[H];if(ge===void 0&&(H==="instanceMatrix"&&V.instanceMatrix&&(ge=V.instanceMatrix),H==="instanceColor"&&V.instanceColor&&(ge=V.instanceColor)),ge!==void 0){const xe=ge.normalized,Ee=ge.itemSize,Se=n.get(ge);if(Se===void 0)continue;const We=Se.buffer,Je=Se.type,ft=Se.bytesPerElement,At=r.isWebGL2===!0&&(Je===t.INT||Je===t.UNSIGNED_INT||ge.gpuType===TS);if(ge.isInterleavedBufferAttribute){const Qe=ge.data,Q=Qe.stride,Le=ge.offset;if(Qe.isInstancedInterleavedBuffer){for(let we=0;we0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let a=n.precision!==void 0?n.precision:"highp";const l=o(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const u=s||e.has("WEBGL_draw_buffers"),d=n.logarithmicDepthBuffer===!0,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=t.getParameter(t.MAX_TEXTURE_SIZE),y=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),w=t.getParameter(t.MAX_VERTEX_ATTRIBS),x=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),_=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,M=s||e.has("OES_texture_float"),T=S&&M,A=s?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:u,getMaxAnisotropy:i,getMaxPrecision:o,precision:a,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:y,maxAttributes:w,maxVertexUniforms:x,maxVaryings:m,maxFragmentUniforms:_,vertexTextures:S,floatFragmentTextures:M,floatVertexTextures:T,maxSamples:A}}function J4(t){const e=this;let n=null,r=0,i=!1,o=!1;const s=new cs,a=new Ft,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const g=h.length!==0||p||r!==0||i;return i=p,r=h.length,g},this.beginShadows=function(){o=!0,d(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(h,p){n=d(h,p,0)},this.setState=function(h,p,g){const y=h.clippingPlanes,w=h.clipIntersection,x=h.clipShadows,m=t.get(h);if(!i||y===null||y.length===0||o&&!x)o?d(null):u();else{const _=o?0:r,S=_*4;let M=m.clippingState||null;l.value=M,M=d(y,p,S,g);for(let T=0;T!==S;++T)M[T]=n[T];m.clippingState=M,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=_}};function u(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(h,p,g,y){const w=h!==null?h.length:0;let x=null;if(w!==0){if(x=l.value,y!==!0||x===null){const m=g+w*4,_=p.matrixWorldInverse;a.getNormalMatrix(_),(x===null||x.length0){const u=new BS(l.height/2);return u.fromEquirectangularTexture(t,s),e.set(s,u),s.addEventListener("dispose",i),n(u.texture,s.mapping)}else return null}}return s}function i(s){const a=s.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function o(){e=new WeakMap}return{get:r,dispose:o}}class ms extends qd{constructor(e=-1,n=1,r=1,i=-1,o=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=o,this.far=s,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,r,i,o,s){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=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=o,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let o=r-e,s=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=u*this.view.offsetX,s=o+u*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(o,s,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const Hc=4,Zb=[.125,.215,.35,.446,.526,.582],rl=20,Cy=new ms,Kb=new tt;let Ry=null,Py=0,Iy=0;const nl=(1+Math.sqrt(5))/2,mc=1/nl,Jb=[new G(1,1,1),new G(-1,1,1),new G(1,1,-1),new G(-1,1,-1),new G(0,nl,mc),new G(0,nl,-mc),new G(mc,0,nl),new G(-mc,0,nl),new G(nl,mc,0),new G(-nl,mc,0)];class Wx{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){Ry=this._renderer.getRenderTarget(),Py=this._renderer.getActiveCubeFace(),Iy=this._renderer.getActiveMipmapLevel(),this._setSize(256);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,r,i,o),n>0&&this._blur(o,0,0,n),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=tT(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=eT(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),d.setRenderTarget(i),w&&d.render(y,a),d.render(e,a)}y.geometry.dispose(),y.material.dispose(),d.toneMapping=p,d.autoClear=h,e.background=x}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Ho||e.mapping===va;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=tT()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=eT());const o=i?this._cubemapMaterial:this._equirectMaterial,s=new ur(this._lodPlanes[0],o),a=o.uniforms;a.envMap.value=e;const l=this._cubeSize;$p(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(s,Cy)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;for(let i=1;irl&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${rl}`);const m=[];let _=0;for(let R=0;RS-Hc?i-S+Hc:0),A=4*(this._cubeSize-M);$p(n,T,A,3*M,2*M),l.setRenderTarget(n),l.render(h,Cy)}}function eB(t){const e=[],n=[],r=[];let i=t;const o=t-Hc+1+Zb.length;for(let s=0;st-Hc?l=Zb[s-t+Hc-1]:s===0&&(l=0),r.push(l);const u=1/(a-2),d=-u,h=1+u,p=[d,d,h,d,h,h,d,d,h,h,d,h],g=6,y=6,w=3,x=2,m=1,_=new Float32Array(w*y*g),S=new Float32Array(x*y*g),M=new Float32Array(m*y*g);for(let A=0;A2?0:-1,C=[R,O,0,R+2/3,O,0,R+2/3,O+1,0,R,O,0,R+2/3,O+1,0,R,O+1,0];_.set(C,w*y*A),S.set(p,x*y*A);const P=[A,A,A,A,A,A];M.set(P,m*y*A)}const T=new zt;T.setAttribute("position",new sn(_,w)),T.setAttribute("uv",new sn(S,x)),T.setAttribute("faceIndex",new sn(M,m)),e.push(T),i>Hc&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function Qb(t,e,n){const r=new ji(t,e,n);return r.texture.mapping=_u,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function $p(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function tB(t,e,n){const r=new Float32Array(rl),i=new G(0,1,0);return new Xi({name:"SphericalGaussianBlur",defines:{n:rl,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:HS(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:vs,depthTest:!1,depthWrite:!1})}function eT(){return new Xi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:HS(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:vs,depthTest:!1,depthWrite:!1})}function tT(){return new Xi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:HS(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:vs,depthTest:!1,depthWrite:!1})}function HS(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function nB(t){let e=new WeakMap,n=null;function r(a){if(a&&a.isTexture){const l=a.mapping,u=l===lu||l===dd,d=l===Ho||l===va;if(u||d)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return n===null&&(n=new Wx(t)),h=u?n.fromEquirectangular(a,h):n.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(u&&h&&h.height>0||d&&h&&i(h)){n===null&&(n=new Wx(t));const p=u?n.fromEquirectangular(a):n.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",o),p.texture}else return null}}}return a}function i(a){let l=0;const u=6;for(let d=0;de.maxTextureSize&&(k=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const X=new Float32Array(P*k*4*w),oe=new o0(X,P,k,w);oe.type=cr,oe.needsUpdate=!0;const V=C*4;for(let J=0;J0)return t;const i=e*n;let o=nT[i];if(o===void 0&&(o=new Float32Array(i),nT[i]=o),e!==0){r.toArray(o,0);for(let s=1,a=0;s!==e;++s)a+=n,t[s].toArray(o,a)}return o}function tr(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n":" "} ${a}: ${n[s]}`)}return r.join(` `)}function i5(t){const e=rn.getPrimaries(rn.workingColorSpace),n=rn.getPrimaries(t);let r;switch(e===n?r="":e===xd&&n===_d?r="LinearDisplayP3ToLinearSRGB":e===_d&&n===xd&&(r="LinearSRGBToLinearDisplayP3"),t){case Vo:case Xd:return[r,"LinearTransferOETF"];case Qn:case i0:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function cT(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const o=/ERROR: 0:(\d+)/.exec(i);if(o){const s=parseInt(o[1]);return n.toUpperCase()+` `+i+` `+r5(t.getShaderSource(e),s)}else return i}function o5(t,e){const n=i5(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function s5(t,e){let n;switch(e){case NP:n="Linear";break;case kP:n="Reinhard";break;case UP:n="OptimizedCineon";break;case MS:n="ACESFilmic";break;case FP:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function a5(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||t.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Af).join(` `)}function l5(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(` `)}function c5(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Gx(t){return t.replace(u5,d5)}const f5=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function d5(t,e){let n=Nt[e];if(n===void 0){const r=f5.get(e);if(r!==void 0)n=Nt[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return Gx(n)}const h5=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function dT(t){return t.replace(h5,p5)}function p5(t,e,n,r){let i="";for(let o=parseInt(e);o0&&(x+=` `),m=[g,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Af).join(` `),m.length>0&&(m+=` `)):(x=[hT(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(Af).join(` `),m=[g,hT(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",n.envMap?"#define "+h:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==fo?"#define TONE_MAPPING":"",n.toneMapping!==fo?Nt.tonemapping_pars_fragment:"",n.toneMapping!==fo?s5("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Nt.colorspace_pars_fragment,o5("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` `].filter(Af).join(` `)),s=Gx(s),s=uT(s,n),s=fT(s,n),a=Gx(a),a=uT(a,n),a=fT(a,n),s=dT(s),a=dT(a),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(_=`#version 300 es `,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+x,m=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===Hx?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Hx?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` `+m);const S=_+x+s,M=_+m+a,T=lT(i,i.VERTEX_SHADER,S),A=lT(i,i.FRAGMENT_SHADER,M);i.attachShader(w,T),i.attachShader(w,A),n.index0AttributeName!==void 0?i.bindAttribLocation(w,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(w,0,"position"),i.linkProgram(w);function R(k){if(t.debug.checkShaderErrors){const X=i.getProgramInfoLog(w).trim(),oe=i.getShaderInfoLog(T).trim(),V=i.getShaderInfoLog(A).trim();let K=!0,J=!0;if(i.getProgramParameter(w,i.LINK_STATUS)===!1)if(K=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,w,T,A);else{const se=cT(i,T,"vertex"),F=cT(i,A,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(w,i.VALIDATE_STATUS)+` Program Info Log: `+X+` `+se+` `+F)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(oe===""||V==="")&&(J=!1);J&&(k.diagnostics={runnable:K,programLog:X,vertexShader:{log:oe,prefix:x},fragmentShader:{log:V,prefix:m}})}i.deleteShader(T),i.deleteShader(A),O=new Wm(i,w),C=c5(i,w)}let O;this.getUniforms=function(){return O===void 0&&R(this),O};let C;this.getAttributes=function(){return C===void 0&&R(this),C};let P=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=i.getProgramParameter(w,t5)),P},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(w),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=n5++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=T,this.fragmentShader=A,this}let S5=0;class w5{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),o=this._getShaderStage(r),s=this._getShaderCacheForMaterial(e);return s.has(i)===!1&&(s.add(i),i.usedTimes++),s.has(o)===!1&&(s.add(o),o.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new E5(e),n.set(e,r)),r}}class E5{constructor(e){this.id=S5++,this.code=e,this.usedTimes=0}}function M5(t,e,n,r,i,o,s){const a=new yl,l=new w5,u=[],d=i.isWebGL2,h=i.logarithmicDepthBuffer,p=i.vertexTextures;let g=i.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function w(C){return C===0?"uv":`uv${C}`}function x(C,P,k,X,oe){const V=X.fog,K=oe.geometry,J=C.isMeshStandardMaterial?X.environment:null,se=(C.isMeshStandardMaterial?n:e).get(C.envMap||J),F=se&&se.mapping===_u?se.image.height:null,$=y[C.type];C.precision!==null&&(g=i.getMaxPrecision(C.precision),g!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",g,"instead."));const j=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,H=j!==void 0?j.length:0;let Z=0;K.morphAttributes.position!==void 0&&(Z=1),K.morphAttributes.normal!==void 0&&(Z=2),K.morphAttributes.color!==void 0&&(Z=3);let ge,xe,Ee,Se;if($){const en=ao[$];ge=en.vertexShader,xe=en.fragmentShader}else ge=C.vertexShader,xe=C.fragmentShader,l.update(C),Ee=l.getVertexShaderID(C),Se=l.getFragmentShaderID(C);const We=t.getRenderTarget(),Je=oe.isInstancedMesh===!0,ft=!!C.map,At=!!C.matcap,Qe=!!se,Q=!!C.aoMap,Le=!!C.lightMap,we=!!C.bumpMap,De=!!C.normalMap,Ae=!!C.displacementMap,lt=!!C.emissiveMap,je=!!C.metalnessMap,et=!!C.roughnessMap,dt=C.anisotropy>0,xt=C.clearcoat>0,qt=C.iridescence>0,z=C.sheen>0,U=C.transmission>0,ue=dt&&!!C.anisotropyMap,Ie=xt&&!!C.clearcoatMap,Re=xt&&!!C.clearcoatNormalMap,Ne=xt&&!!C.clearcoatRoughnessMap,Ze=qt&&!!C.iridescenceMap,Be=qt&&!!C.iridescenceThicknessMap,$e=z&&!!C.sheenColorMap,gt=z&&!!C.sheenRoughnessMap,bt=!!C.specularMap,Pe=!!C.specularColorMap,Dt=!!C.specularIntensityMap,re=U&&!!C.transmissionMap,he=U&&!!C.thicknessMap,Ce=!!C.gradientMap,ke=!!C.alphaMap,be=C.alphaTest>0,ae=!!C.alphaHash,Ge=!!C.extensions,He=!!K.attributes.uv1,Me=!!K.attributes.uv2,Fe=!!K.attributes.uv3;let ct=fo;return C.toneMapped&&(We===null||We.isXRRenderTarget===!0)&&(ct=t.toneMapping),{isWebGL2:d,shaderID:$,shaderType:C.type,shaderName:C.name,vertexShader:ge,fragmentShader:xe,defines:C.defines,customVertexShaderID:Ee,customFragmentShaderID:Se,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:g,instancing:Je,instancingColor:Je&&oe.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:We===null?t.outputColorSpace:We.isXRRenderTarget===!0?We.texture.colorSpace:Vo,map:ft,matcap:At,envMap:Qe,envMapMode:Qe&&se.mapping,envMapCubeUVHeight:F,aoMap:Q,lightMap:Le,bumpMap:we,normalMap:De,displacementMap:p&&Ae,emissiveMap:lt,normalMapObjectSpace:De&&C.normalMapType===QP,normalMapTangentSpace:De&&C.normalMapType===Aa,metalnessMap:je,roughnessMap:et,anisotropy:dt,anisotropyMap:ue,clearcoat:xt,clearcoatMap:Ie,clearcoatNormalMap:Re,clearcoatRoughnessMap:Ne,iridescence:qt,iridescenceMap:Ze,iridescenceThicknessMap:Be,sheen:z,sheenColorMap:$e,sheenRoughnessMap:gt,specularMap:bt,specularColorMap:Pe,specularIntensityMap:Dt,transmission:U,transmissionMap:re,thicknessMap:he,gradientMap:Ce,opaque:C.transparent===!1&&C.blending===gl,alphaMap:ke,alphaTest:be,alphaHash:ae,combine:C.combine,mapUv:ft&&w(C.map.channel),aoMapUv:Q&&w(C.aoMap.channel),lightMapUv:Le&&w(C.lightMap.channel),bumpMapUv:we&&w(C.bumpMap.channel),normalMapUv:De&&w(C.normalMap.channel),displacementMapUv:Ae&&w(C.displacementMap.channel),emissiveMapUv:lt&&w(C.emissiveMap.channel),metalnessMapUv:je&&w(C.metalnessMap.channel),roughnessMapUv:et&&w(C.roughnessMap.channel),anisotropyMapUv:ue&&w(C.anisotropyMap.channel),clearcoatMapUv:Ie&&w(C.clearcoatMap.channel),clearcoatNormalMapUv:Re&&w(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ne&&w(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Ze&&w(C.iridescenceMap.channel),iridescenceThicknessMapUv:Be&&w(C.iridescenceThicknessMap.channel),sheenColorMapUv:$e&&w(C.sheenColorMap.channel),sheenRoughnessMapUv:gt&&w(C.sheenRoughnessMap.channel),specularMapUv:bt&&w(C.specularMap.channel),specularColorMapUv:Pe&&w(C.specularColorMap.channel),specularIntensityMapUv:Dt&&w(C.specularIntensityMap.channel),transmissionMapUv:re&&w(C.transmissionMap.channel),thicknessMapUv:he&&w(C.thicknessMap.channel),alphaMapUv:ke&&w(C.alphaMap.channel),vertexTangents:!!K.attributes.tangent&&(De||dt),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!K.attributes.color&&K.attributes.color.itemSize===4,vertexUv1s:He,vertexUv2s:Me,vertexUv3s:Fe,pointsUvs:oe.isPoints===!0&&!!K.attributes.uv&&(ft||ke),fog:!!V,useFog:C.fog===!0,fogExp2:V&&V.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:oe.isSkinnedMesh===!0,morphTargets:K.morphAttributes.position!==void 0,morphNormals:K.morphAttributes.normal!==void 0,morphColors:K.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:Z,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:C.dithering,shadowMapEnabled:t.shadowMap.enabled&&k.length>0,shadowMapType:t.shadowMap.type,toneMapping:ct,useLegacyLights:t._useLegacyLights,decodeVideoTexture:ft&&C.map.isVideoTexture===!0&&rn.getTransfer(C.map.colorSpace)===hn,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===lo,flipSided:C.side===Lr,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionDerivatives:Ge&&C.extensions.derivatives===!0,extensionFragDepth:Ge&&C.extensions.fragDepth===!0,extensionDrawBuffers:Ge&&C.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ge&&C.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:d||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||r.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()}}function m(C){const P=[];if(C.shaderID?P.push(C.shaderID):(P.push(C.customVertexShaderID),P.push(C.customFragmentShaderID)),C.defines!==void 0)for(const k in C.defines)P.push(k),P.push(C.defines[k]);return C.isRawShaderMaterial===!1&&(_(P,C),S(P,C),P.push(t.outputColorSpace)),P.push(C.customProgramCacheKey),P.join()}function _(C,P){C.push(P.precision),C.push(P.outputColorSpace),C.push(P.envMapMode),C.push(P.envMapCubeUVHeight),C.push(P.mapUv),C.push(P.alphaMapUv),C.push(P.lightMapUv),C.push(P.aoMapUv),C.push(P.bumpMapUv),C.push(P.normalMapUv),C.push(P.displacementMapUv),C.push(P.emissiveMapUv),C.push(P.metalnessMapUv),C.push(P.roughnessMapUv),C.push(P.anisotropyMapUv),C.push(P.clearcoatMapUv),C.push(P.clearcoatNormalMapUv),C.push(P.clearcoatRoughnessMapUv),C.push(P.iridescenceMapUv),C.push(P.iridescenceThicknessMapUv),C.push(P.sheenColorMapUv),C.push(P.sheenRoughnessMapUv),C.push(P.specularMapUv),C.push(P.specularColorMapUv),C.push(P.specularIntensityMapUv),C.push(P.transmissionMapUv),C.push(P.thicknessMapUv),C.push(P.combine),C.push(P.fogExp2),C.push(P.sizeAttenuation),C.push(P.morphTargetsCount),C.push(P.morphAttributeCount),C.push(P.numDirLights),C.push(P.numPointLights),C.push(P.numSpotLights),C.push(P.numSpotLightMaps),C.push(P.numHemiLights),C.push(P.numRectAreaLights),C.push(P.numDirLightShadows),C.push(P.numPointLightShadows),C.push(P.numSpotLightShadows),C.push(P.numSpotLightShadowsWithMaps),C.push(P.numLightProbes),C.push(P.shadowMapType),C.push(P.toneMapping),C.push(P.numClippingPlanes),C.push(P.numClipIntersection),C.push(P.depthPacking)}function S(C,P){a.disableAll(),P.isWebGL2&&a.enable(0),P.supportsVertexTextures&&a.enable(1),P.instancing&&a.enable(2),P.instancingColor&&a.enable(3),P.matcap&&a.enable(4),P.envMap&&a.enable(5),P.normalMapObjectSpace&&a.enable(6),P.normalMapTangentSpace&&a.enable(7),P.clearcoat&&a.enable(8),P.iridescence&&a.enable(9),P.alphaTest&&a.enable(10),P.vertexColors&&a.enable(11),P.vertexAlphas&&a.enable(12),P.vertexUv1s&&a.enable(13),P.vertexUv2s&&a.enable(14),P.vertexUv3s&&a.enable(15),P.vertexTangents&&a.enable(16),P.anisotropy&&a.enable(17),P.alphaHash&&a.enable(18),C.push(a.mask),a.disableAll(),P.fog&&a.enable(0),P.useFog&&a.enable(1),P.flatShading&&a.enable(2),P.logarithmicDepthBuffer&&a.enable(3),P.skinning&&a.enable(4),P.morphTargets&&a.enable(5),P.morphNormals&&a.enable(6),P.morphColors&&a.enable(7),P.premultipliedAlpha&&a.enable(8),P.shadowMapEnabled&&a.enable(9),P.useLegacyLights&&a.enable(10),P.doubleSided&&a.enable(11),P.flipSided&&a.enable(12),P.useDepthPacking&&a.enable(13),P.dithering&&a.enable(14),P.transmission&&a.enable(15),P.sheen&&a.enable(16),P.opaque&&a.enable(17),P.pointsUvs&&a.enable(18),P.decodeVideoTexture&&a.enable(19),C.push(a.mask)}function M(C){const P=y[C.type];let k;if(P){const X=ao[P];k=zS.clone(X.uniforms)}else k=C.uniforms;return k}function T(C,P){let k;for(let X=0,oe=u.length;X0?r.push(m):g.transparent===!0?i.push(m):n.push(m)}function l(h,p,g,y,w,x){const m=s(h,p,g,y,w,x);g.transmission>0?r.unshift(m):g.transparent===!0?i.unshift(m):n.unshift(m)}function u(h,p){n.length>1&&n.sort(h||T5),r.length>1&&r.sort(p||pT),i.length>1&&i.sort(p||pT)}function d(){for(let h=e,p=t.length;h=o.length?(s=new mT,o.push(s)):s=o[i],s}function n(){t=new WeakMap}return{get:e,dispose:n}}function C5(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new G,color:new tt};break;case"SpotLight":n={position:new G,direction:new G,color:new tt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new G,color:new tt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new G,skyColor:new tt,groundColor:new tt};break;case"RectAreaLight":n={color:new tt,position:new G,halfWidth:new G,halfHeight:new G};break}return t[e.id]=n,n}}}function R5(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let P5=0;function I5(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function L5(t,e){const n=new C5,r=R5(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new G);const o=new G,s=new wt,a=new wt;function l(d,h){let p=0,g=0,y=0;for(let X=0;X<9;X++)i.probe[X].set(0,0,0);let w=0,x=0,m=0,_=0,S=0,M=0,T=0,A=0,R=0,O=0,C=0;d.sort(I5);const P=h===!0?Math.PI:1;for(let X=0,oe=d.length;X0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ye.LTC_FLOAT_1,i.rectAreaLTC2=Ye.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ye.LTC_HALF_1,i.rectAreaLTC2=Ye.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=p,i.ambient[1]=g,i.ambient[2]=y;const k=i.hash;(k.directionalLength!==w||k.pointLength!==x||k.spotLength!==m||k.rectAreaLength!==_||k.hemiLength!==S||k.numDirectionalShadows!==M||k.numPointShadows!==T||k.numSpotShadows!==A||k.numSpotMaps!==R||k.numLightProbes!==C)&&(i.directional.length=w,i.spot.length=m,i.rectArea.length=_,i.point.length=x,i.hemi.length=S,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=T,i.pointShadowMap.length=T,i.spotShadow.length=A,i.spotShadowMap.length=A,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=T,i.spotLightMatrix.length=A+R-O,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=O,i.numLightProbes=C,k.directionalLength=w,k.pointLength=x,k.spotLength=m,k.rectAreaLength=_,k.hemiLength=S,k.numDirectionalShadows=M,k.numPointShadows=T,k.numSpotShadows=A,k.numSpotMaps=R,k.numLightProbes=C,i.version=P5++)}function u(d,h){let p=0,g=0,y=0,w=0,x=0;const m=h.matrixWorldInverse;for(let _=0,S=d.length;_=a.length?(l=new gT(t,e),a.push(l)):l=a[s],l}function i(){n=new WeakMap}return{get:r,dispose:i}}class VS extends vr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=KP,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class WS extends vr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const O5=`void main() { gl_Position = vec4( position, 1.0 ); }`,N5=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function k5(t,e,n){let r=new s0;const i=new Te,o=new Te,s=new tn,a=new VS({depthPacking:JP}),l=new WS,u={},d=n.maxTextureSize,h={[Bo]:Lr,[Lr]:Bo,[lo]:lo},p=new Xi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Te},radius:{value:4}},vertexShader:O5,fragmentShader:N5}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const y=new zt;y.setAttribute("position",new sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const w=new ur(y,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Qg;let m=this.type;this.render=function(T,A,R){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||T.length===0)return;const O=t.getRenderTarget(),C=t.getActiveCubeFace(),P=t.getActiveMipmapLevel(),k=t.state;k.setBlending(vs),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const X=m!==io&&this.type===io,oe=m===io&&this.type!==io;for(let V=0,K=T.length;Vd||i.y>d)&&(i.x>d&&(o.x=Math.floor(d/F.x),i.x=o.x*F.x,se.mapSize.x=o.x),i.y>d&&(o.y=Math.floor(d/F.y),i.y=o.y*F.y,se.mapSize.y=o.y)),se.map===null||X===!0||oe===!0){const j=this.type!==io?{minFilter:Gn,magFilter:Gn}:{};se.map!==null&&se.map.dispose(),se.map=new ji(i.x,i.y,j),se.map.texture.name=J.name+".shadowMap",se.camera.updateProjectionMatrix()}t.setRenderTarget(se.map),t.clear();const $=se.getViewportCount();for(let j=0;j<$;j++){const H=se.getViewport(j);s.set(o.x*H.x,o.y*H.y,o.x*H.z,o.y*H.w),k.viewport(s),se.updateMatrices(J,j),r=se.getFrustum(),M(A,R,se.camera,J,this.type)}se.isPointLightShadow!==!0&&this.type===io&&_(se,R),se.needsUpdate=!1}m=this.type,x.needsUpdate=!1,t.setRenderTarget(O,C,P)};function _(T,A){const R=e.update(w);p.defines.VSM_SAMPLES!==T.blurSamples&&(p.defines.VSM_SAMPLES=T.blurSamples,g.defines.VSM_SAMPLES=T.blurSamples,p.needsUpdate=!0,g.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new ji(i.x,i.y)),p.uniforms.shadow_pass.value=T.map.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,t.setRenderTarget(T.mapPass),t.clear(),t.renderBufferDirect(A,null,R,p,w,null),g.uniforms.shadow_pass.value=T.mapPass.texture,g.uniforms.resolution.value=T.mapSize,g.uniforms.radius.value=T.radius,t.setRenderTarget(T.map),t.clear(),t.renderBufferDirect(A,null,R,g,w,null)}function S(T,A,R,O){let C=null;const P=R.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(P!==void 0)C=P;else if(C=R.isPointLight===!0?l:a,t.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){const k=C.uuid,X=A.uuid;let oe=u[k];oe===void 0&&(oe={},u[k]=oe);let V=oe[X];V===void 0&&(V=C.clone(),oe[X]=V),C=V}if(C.visible=A.visible,C.wireframe=A.wireframe,O===io?C.side=A.shadowSide!==null?A.shadowSide:A.side:C.side=A.shadowSide!==null?A.shadowSide:h[A.side],C.alphaMap=A.alphaMap,C.alphaTest=A.alphaTest,C.map=A.map,C.clipShadows=A.clipShadows,C.clippingPlanes=A.clippingPlanes,C.clipIntersection=A.clipIntersection,C.displacementMap=A.displacementMap,C.displacementScale=A.displacementScale,C.displacementBias=A.displacementBias,C.wireframeLinewidth=A.wireframeLinewidth,C.linewidth=A.linewidth,R.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const k=t.properties.get(C);k.light=R}return C}function M(T,A,R,O,C){if(T.visible===!1)return;if(T.layers.test(A.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&C===io)&&(!T.frustumCulled||r.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,T.matrixWorld);const X=e.update(T),oe=T.material;if(Array.isArray(oe)){const V=X.groups;for(let K=0,J=V.length;K=1):j.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),F=$>=2);let H=null,Z={};const ge=t.getParameter(t.SCISSOR_BOX),xe=t.getParameter(t.VIEWPORT),Ee=new tn().fromArray(ge),Se=new tn().fromArray(xe);function We(ae,Ge,He,Me){const Fe=new Uint8Array(4),ct=t.createTexture();t.bindTexture(ae,ct),t.texParameteri(ae,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ae,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ot=0;Ot"u"?!1:/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap;let w;const x=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(z,U){return m?new OffscreenCanvas(z,U):Ed("canvas")}function S(z,U,ue,Ie){let Re=1;if((z.width>Ie||z.height>Ie)&&(Re=Ie/Math.max(z.width,z.height)),Re<1||U===!0)if(typeof HTMLImageElement<"u"&&z instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&z instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&z instanceof ImageBitmap){const Ne=U?xg:Math.floor,Ze=Ne(Re*z.width),Be=Ne(Re*z.height);w===void 0&&(w=_(Ze,Be));const $e=ue?_(Ze,Be):w;return $e.width=Ze,$e.height=Be,$e.getContext("2d").drawImage(z,0,0,Ze,Be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+z.width+"x"+z.height+") to ("+Ze+"x"+Be+")."),$e}else return"data"in z&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+z.width+"x"+z.height+")."),z;return z}function M(z){return Vx(z.width)&&Vx(z.height)}function T(z){return a?!1:z.wrapS!==Cr||z.wrapT!==Cr||z.minFilter!==Gn&&z.minFilter!==un}function A(z,U){return z.generateMipmaps&&U&&z.minFilter!==Gn&&z.minFilter!==un}function R(z){t.generateMipmap(z)}function O(z,U,ue,Ie,Re=!1){if(a===!1)return U;if(z!==null){if(t[z]!==void 0)return t[z];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+z+"'")}let Ne=U;if(U===t.RED&&(ue===t.FLOAT&&(Ne=t.R32F),ue===t.HALF_FLOAT&&(Ne=t.R16F),ue===t.UNSIGNED_BYTE&&(Ne=t.R8)),U===t.RED_INTEGER&&(ue===t.UNSIGNED_BYTE&&(Ne=t.R8UI),ue===t.UNSIGNED_SHORT&&(Ne=t.R16UI),ue===t.UNSIGNED_INT&&(Ne=t.R32UI),ue===t.BYTE&&(Ne=t.R8I),ue===t.SHORT&&(Ne=t.R16I),ue===t.INT&&(Ne=t.R32I)),U===t.RG&&(ue===t.FLOAT&&(Ne=t.RG32F),ue===t.HALF_FLOAT&&(Ne=t.RG16F),ue===t.UNSIGNED_BYTE&&(Ne=t.RG8)),U===t.RGBA){const Ze=Re?yd:rn.getTransfer(Ie);ue===t.FLOAT&&(Ne=t.RGBA32F),ue===t.HALF_FLOAT&&(Ne=t.RGBA16F),ue===t.UNSIGNED_BYTE&&(Ne=Ze===hn?t.SRGB8_ALPHA8:t.RGBA8),ue===t.UNSIGNED_SHORT_4_4_4_4&&(Ne=t.RGBA4),ue===t.UNSIGNED_SHORT_5_5_5_1&&(Ne=t.RGB5_A1)}return(Ne===t.R16F||Ne===t.R32F||Ne===t.RG16F||Ne===t.RG32F||Ne===t.RGBA16F||Ne===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Ne}function C(z,U,ue){return A(z,ue)===!0||z.isFramebufferTexture&&z.minFilter!==Gn&&z.minFilter!==un?Math.log2(Math.max(U.width,U.height))+1:z.mipmaps!==void 0&&z.mipmaps.length>0?z.mipmaps.length:z.isCompressedTexture&&Array.isArray(z.image)?U.mipmaps.length:1}function P(z){return z===Gn||z===yg||z===zf?t.NEAREST:t.LINEAR}function k(z){const U=z.target;U.removeEventListener("dispose",k),oe(U),U.isVideoTexture&&y.delete(U)}function X(z){const U=z.target;U.removeEventListener("dispose",X),K(U)}function oe(z){const U=r.get(z);if(U.__webglInit===void 0)return;const ue=z.source,Ie=x.get(ue);if(Ie){const Re=Ie[U.__cacheKey];Re.usedTimes--,Re.usedTimes===0&&V(z),Object.keys(Ie).length===0&&x.delete(ue)}r.remove(z)}function V(z){const U=r.get(z);t.deleteTexture(U.__webglTexture);const ue=z.source,Ie=x.get(ue);delete Ie[U.__cacheKey],s.memory.textures--}function K(z){const U=z.texture,ue=r.get(z),Ie=r.get(U);if(Ie.__webglTexture!==void 0&&(t.deleteTexture(Ie.__webglTexture),s.memory.textures--),z.depthTexture&&z.depthTexture.dispose(),z.isWebGLCubeRenderTarget)for(let Re=0;Re<6;Re++){if(Array.isArray(ue.__webglFramebuffer[Re]))for(let Ne=0;Ne=l&&console.warn("THREE.WebGLTextures: Trying to use "+z+" texture units while this GPU supports only "+l),J+=1,z}function $(z){const U=[];return U.push(z.wrapS),U.push(z.wrapT),U.push(z.wrapR||0),U.push(z.magFilter),U.push(z.minFilter),U.push(z.anisotropy),U.push(z.internalFormat),U.push(z.format),U.push(z.type),U.push(z.generateMipmaps),U.push(z.premultiplyAlpha),U.push(z.flipY),U.push(z.unpackAlignment),U.push(z.colorSpace),U.join()}function j(z,U){const ue=r.get(z);if(z.isVideoTexture&&xt(z),z.isRenderTargetTexture===!1&&z.version>0&&ue.__version!==z.version){const Ie=z.image;if(Ie===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ie.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ft(ue,z,U);return}}n.bindTexture(t.TEXTURE_2D,ue.__webglTexture,t.TEXTURE0+U)}function H(z,U){const ue=r.get(z);if(z.version>0&&ue.__version!==z.version){ft(ue,z,U);return}n.bindTexture(t.TEXTURE_2D_ARRAY,ue.__webglTexture,t.TEXTURE0+U)}function Z(z,U){const ue=r.get(z);if(z.version>0&&ue.__version!==z.version){ft(ue,z,U);return}n.bindTexture(t.TEXTURE_3D,ue.__webglTexture,t.TEXTURE0+U)}function ge(z,U){const ue=r.get(z);if(z.version>0&&ue.__version!==z.version){At(ue,z,U);return}n.bindTexture(t.TEXTURE_CUBE_MAP,ue.__webglTexture,t.TEXTURE0+U)}const xe={[hd]:t.REPEAT,[Cr]:t.CLAMP_TO_EDGE,[pd]:t.MIRRORED_REPEAT},Ee={[Gn]:t.NEAREST,[yg]:t.NEAREST_MIPMAP_NEAREST,[zf]:t.NEAREST_MIPMAP_LINEAR,[un]:t.LINEAR,[bS]:t.LINEAR_MIPMAP_NEAREST,[ya]:t.LINEAR_MIPMAP_LINEAR},Se={[e3]:t.NEVER,[a3]:t.ALWAYS,[t3]:t.LESS,[r3]:t.LEQUAL,[n3]:t.EQUAL,[s3]:t.GEQUAL,[i3]:t.GREATER,[o3]:t.NOTEQUAL};function We(z,U,ue){if(ue?(t.texParameteri(z,t.TEXTURE_WRAP_S,xe[U.wrapS]),t.texParameteri(z,t.TEXTURE_WRAP_T,xe[U.wrapT]),(z===t.TEXTURE_3D||z===t.TEXTURE_2D_ARRAY)&&t.texParameteri(z,t.TEXTURE_WRAP_R,xe[U.wrapR]),t.texParameteri(z,t.TEXTURE_MAG_FILTER,Ee[U.magFilter]),t.texParameteri(z,t.TEXTURE_MIN_FILTER,Ee[U.minFilter])):(t.texParameteri(z,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(z,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(z===t.TEXTURE_3D||z===t.TEXTURE_2D_ARRAY)&&t.texParameteri(z,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(U.wrapS!==Cr||U.wrapT!==Cr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(z,t.TEXTURE_MAG_FILTER,P(U.magFilter)),t.texParameteri(z,t.TEXTURE_MIN_FILTER,P(U.minFilter)),U.minFilter!==Gn&&U.minFilter!==un&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),U.compareFunction&&(t.texParameteri(z,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(z,t.TEXTURE_COMPARE_FUNC,Se[U.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Ie=e.get("EXT_texture_filter_anisotropic");if(U.magFilter===Gn||U.minFilter!==zf&&U.minFilter!==ya||U.type===cr&&e.has("OES_texture_float_linear")===!1||a===!1&&U.type===Pr&&e.has("OES_texture_half_float_linear")===!1)return;(U.anisotropy>1||r.get(U).__currentAnisotropy)&&(t.texParameterf(z,Ie.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(U.anisotropy,i.getMaxAnisotropy())),r.get(U).__currentAnisotropy=U.anisotropy)}}function Je(z,U){let ue=!1;z.__webglInit===void 0&&(z.__webglInit=!0,U.addEventListener("dispose",k));const Ie=U.source;let Re=x.get(Ie);Re===void 0&&(Re={},x.set(Ie,Re));const Ne=$(U);if(Ne!==z.__cacheKey){Re[Ne]===void 0&&(Re[Ne]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,ue=!0),Re[Ne].usedTimes++;const Ze=Re[z.__cacheKey];Ze!==void 0&&(Re[z.__cacheKey].usedTimes--,Ze.usedTimes===0&&V(U)),z.__cacheKey=Ne,z.__webglTexture=Re[Ne].texture}return ue}function ft(z,U,ue){let Ie=t.TEXTURE_2D;(U.isDataArrayTexture||U.isCompressedArrayTexture)&&(Ie=t.TEXTURE_2D_ARRAY),U.isData3DTexture&&(Ie=t.TEXTURE_3D);const Re=Je(z,U),Ne=U.source;n.bindTexture(Ie,z.__webglTexture,t.TEXTURE0+ue);const Ze=r.get(Ne);if(Ne.version!==Ze.__version||Re===!0){n.activeTexture(t.TEXTURE0+ue);const Be=rn.getPrimaries(rn.workingColorSpace),$e=U.colorSpace===yi?null:rn.getPrimaries(U.colorSpace),gt=U.colorSpace===yi||Be===$e?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,U.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,U.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,gt);const bt=T(U)&&M(U.image)===!1;let Pe=S(U.image,bt,!1,d);Pe=qt(U,Pe);const Dt=M(Pe)||a,re=o.convert(U.format,U.colorSpace);let he=o.convert(U.type),Ce=O(U.internalFormat,re,he,U.colorSpace,U.isVideoTexture);We(Ie,U,Dt);let ke;const be=U.mipmaps,ae=a&&U.isVideoTexture!==!0,Ge=Ze.__version===void 0||Re===!0,He=C(U,Pe,Dt);if(U.isDepthTexture)Ce=t.DEPTH_COMPONENT,a?U.type===cr?Ce=t.DEPTH_COMPONENT32F:U.type===Oo?Ce=t.DEPTH_COMPONENT24:U.type===ua?Ce=t.DEPTH24_STENCIL8:Ce=t.DEPTH_COMPONENT16:U.type===cr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),U.format===fa&&Ce===t.DEPTH_COMPONENT&&U.type!==t0&&U.type!==Oo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),U.type=Oo,he=o.convert(U.type)),U.format===Tl&&Ce===t.DEPTH_COMPONENT&&(Ce=t.DEPTH_STENCIL,U.type!==ua&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),U.type=ua,he=o.convert(U.type))),Ge&&(ae?n.texStorage2D(t.TEXTURE_2D,1,Ce,Pe.width,Pe.height):n.texImage2D(t.TEXTURE_2D,0,Ce,Pe.width,Pe.height,0,re,he,null));else if(U.isDataTexture)if(be.length>0&&Dt){ae&&Ge&&n.texStorage2D(t.TEXTURE_2D,He,Ce,be[0].width,be[0].height);for(let Me=0,Fe=be.length;Me>=1,Fe>>=1}}else if(be.length>0&&Dt){ae&&Ge&&n.texStorage2D(t.TEXTURE_2D,He,Ce,be[0].width,be[0].height);for(let Me=0,Fe=be.length;Me0&&Ge++,n.texStorage2D(t.TEXTURE_CUBE_MAP,Ge,ke,Pe[0].width,Pe[0].height));for(let Me=0;Me<6;Me++)if(bt){be?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,Pe[Me].width,Pe[Me].height,he,Ce,Pe[Me].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,ke,Pe[Me].width,Pe[Me].height,0,he,Ce,Pe[Me].data);for(let Fe=0;Fe>Ne),Pe=Math.max(1,U.height>>Ne);Re===t.TEXTURE_3D||Re===t.TEXTURE_2D_ARRAY?n.texImage3D(Re,Ne,$e,bt,Pe,U.depth,0,Ze,Be,null):n.texImage2D(Re,Ne,$e,bt,Pe,0,Ze,Be,null)}n.bindFramebuffer(t.FRAMEBUFFER,z),dt(U)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ie,Re,r.get(ue).__webglTexture,0,et(U)):(Re===t.TEXTURE_2D||Re>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Re<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Ie,Re,r.get(ue).__webglTexture,Ne),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Q(z,U,ue){if(t.bindRenderbuffer(t.RENDERBUFFER,z),U.depthBuffer&&!U.stencilBuffer){let Ie=a===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(ue||dt(U)){const Re=U.depthTexture;Re&&Re.isDepthTexture&&(Re.type===cr?Ie=t.DEPTH_COMPONENT32F:Re.type===Oo&&(Ie=t.DEPTH_COMPONENT24));const Ne=et(U);dt(U)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Ne,Ie,U.width,U.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,Ne,Ie,U.width,U.height)}else t.renderbufferStorage(t.RENDERBUFFER,Ie,U.width,U.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,z)}else if(U.depthBuffer&&U.stencilBuffer){const Ie=et(U);ue&&dt(U)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Ie,t.DEPTH24_STENCIL8,U.width,U.height):dt(U)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Ie,t.DEPTH24_STENCIL8,U.width,U.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,U.width,U.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,z)}else{const Ie=U.isWebGLMultipleRenderTargets===!0?U.texture:[U.texture];for(let Re=0;Re0){ue.__webglFramebuffer[Be]=[];for(let $e=0;$e0){ue.__webglFramebuffer=[];for(let Be=0;Be0&&dt(z)===!1){const Be=Ne?U:[U];ue.__webglMultisampledFramebuffer=t.createFramebuffer(),ue.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,ue.__webglMultisampledFramebuffer);for(let $e=0;$e0)for(let $e=0;$e0)for(let $e=0;$e0&&dt(z)===!1){const U=z.isWebGLMultipleRenderTargets?z.texture:[z.texture],ue=z.width,Ie=z.height;let Re=t.COLOR_BUFFER_BIT;const Ne=[],Ze=z.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Be=r.get(z),$e=z.isWebGLMultipleRenderTargets===!0;if($e)for(let gt=0;gt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&U.__useRenderToTexture!==!1}function xt(z){const U=s.render.frame;y.get(z)!==U&&(y.set(z,U),z.update())}function qt(z,U){const ue=z.colorSpace,Ie=z.format,Re=z.type;return z.isCompressedTexture===!0||z.isVideoTexture===!0||z.format===_g||ue!==Vo&&ue!==yi&&(rn.getTransfer(ue)===hn?a===!1?e.has("EXT_sRGB")===!0&&Ie===Rr?(z.format=_g,z.minFilter=un,z.generateMipmaps=!1):U=NS.sRGBToLinear(U):(Ie!==Rr||Re!==Fo)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ue)),U}this.allocateTextureUnit=F,this.resetTextureUnits=se,this.setTexture2D=j,this.setTexture2DArray=H,this.setTexture3D=Z,this.setTextureCube=ge,this.rebindTextures=De,this.setupRenderTarget=Ae,this.updateRenderTargetMipmap=lt,this.updateMultisampleRenderTarget=je,this.setupDepthRenderbuffer=we,this.setupFrameBufferTexture=Qe,this.useMultisampledRTT=dt}function w3(t,e,n){const r=n.isWebGL2;function i(o,s=yi){let a;const l=rn.getTransfer(s);if(o===Fo)return t.UNSIGNED_BYTE;if(o===AS)return t.UNSIGNED_SHORT_4_4_4_4;if(o===CS)return t.UNSIGNED_SHORT_5_5_5_1;if(o===BP)return t.BYTE;if(o===HP)return t.SHORT;if(o===t0)return t.UNSIGNED_SHORT;if(o===TS)return t.INT;if(o===Oo)return t.UNSIGNED_INT;if(o===cr)return t.FLOAT;if(o===Pr)return r?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(o===VP)return t.ALPHA;if(o===Rr)return t.RGBA;if(o===WP)return t.LUMINANCE;if(o===GP)return t.LUMINANCE_ALPHA;if(o===fa)return t.DEPTH_COMPONENT;if(o===Tl)return t.DEPTH_STENCIL;if(o===_g)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(o===RS)return t.RED;if(o===PS)return t.RED_INTEGER;if(o===$P)return t.RG;if(o===IS)return t.RG_INTEGER;if(o===n0)return t.RGBA_INTEGER;if(o===Um||o===Fm||o===zm||o===Bm)if(l===hn)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(o===Um)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(o===Fm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(o===zm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(o===Bm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(o===Um)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(o===Fm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(o===zm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(o===Bm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(o===mx||o===gx||o===vx||o===yx)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(o===mx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(o===gx)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(o===vx)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(o===yx)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(o===jP)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(o===_x||o===xx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(o===_x)return l===hn?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(o===xx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(o===Sx||o===wx||o===Ex||o===Mx||o===bx||o===Tx||o===Ax||o===Cx||o===Rx||o===Px||o===Ix||o===Lx||o===Dx||o===Ox)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(o===Sx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(o===wx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(o===Ex)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(o===Mx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(o===bx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(o===Tx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(o===Ax)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(o===Cx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(o===Rx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(o===Px)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(o===Ix)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(o===Lx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(o===Dx)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(o===Ox)return l===hn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(o===Hm||o===Nx||o===kx)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(o===Hm)return l===hn?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(o===Nx)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(o===kx)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(o===XP||o===Ux||o===Fx||o===zx)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(o===Hm)return a.COMPRESSED_RED_RGTC1_EXT;if(o===Ux)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(o===Fx)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(o===zx)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return o===ua?r?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):t[o]!==void 0?t[o]:null}return{convert:i}}class E3 extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Vc extends Qt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const z5={type:"move"};class Dy{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Vc,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 Vc,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Vc,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),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 n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}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,n,r){let i=null,o=null,s=null;const a=this._targetRay,l=this._grip,u=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(u&&e.hand){s=!0;for(const w of e.hand.values()){const x=n.getJointPose(w,r),m=this._getHandJoint(u,w);x!==null&&(m.matrix.fromArray(x.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=x.radius),m.visible=x!==null}const d=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],p=d.position.distanceTo(h.position),g=.02,y=.005;u.inputState.pinching&&p>g+y?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&p<=g-y&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(o=n.getPose(e.gripSpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&o!==null&&(i=o),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(z5)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=o!==null),u!==null&&(u.visible=s!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Vc;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}class GS extends Dn{constructor(e,n,r,i,o,s,a,l,u,d){if(d=d!==void 0?d:fa,d!==fa&&d!==Tl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&d===fa&&(r=Oo),r===void 0&&d===Tl&&(r=ua),super(null,i,o,s,a,l,d,r,u),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a:Gn,this.minFilter=l!==void 0?l:Gn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class B5 extends $o{constructor(e,n){super();const r=this;let i=null,o=1,s=null,a="local-floor",l=1,u=null,d=null,h=null,p=null,g=null,y=null;const w=n.getContextAttributes();let x=null,m=null;const _=[],S=[],M=new Bn;M.layers.enable(1),M.viewport=new tn;const T=new Bn;T.layers.enable(2),T.viewport=new tn;const A=[M,T],R=new E3;R.layers.enable(1),R.layers.enable(2);let O=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(H){let Z=_[H];return Z===void 0&&(Z=new Dy,_[H]=Z),Z.getTargetRaySpace()},this.getControllerGrip=function(H){let Z=_[H];return Z===void 0&&(Z=new Dy,_[H]=Z),Z.getGripSpace()},this.getHand=function(H){let Z=_[H];return Z===void 0&&(Z=new Dy,_[H]=Z),Z.getHandSpace()};function P(H){const Z=S.indexOf(H.inputSource);if(Z===-1)return;const ge=_[Z];ge!==void 0&&(ge.update(H.inputSource,H.frame,u||s),ge.dispatchEvent({type:H.type,data:H.inputSource}))}function k(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",k),i.removeEventListener("inputsourceschange",X);for(let H=0;H<_.length;H++){const Z=S[H];Z!==null&&(S[H]=null,_[H].disconnect(Z))}O=null,C=null,e.setRenderTarget(x),g=null,p=null,h=null,i=null,m=null,j.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(H){o=H,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(H){a=H,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||s},this.setReferenceSpace=function(H){u=H},this.getBaseLayer=function(){return p!==null?p:g},this.getBinding=function(){return h},this.getFrame=function(){return y},this.getSession=function(){return i},this.setSession=async function(H){if(i=H,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",k),i.addEventListener("inputsourceschange",X),w.xrCompatible!==!0&&await n.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const Z={antialias:i.renderState.layers===void 0?w.antialias:!0,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:o};g=new XRWebGLLayer(i,n,Z),i.updateRenderState({baseLayer:g}),m=new ji(g.framebufferWidth,g.framebufferHeight,{format:Rr,type:Fo,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil})}else{let Z=null,ge=null,xe=null;w.depth&&(xe=w.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Z=w.stencil?Tl:fa,ge=w.stencil?ua:Oo);const Ee={colorFormat:n.RGBA8,depthFormat:xe,scaleFactor:o};h=new XRWebGLBinding(i,n),p=h.createProjectionLayer(Ee),i.updateRenderState({layers:[p]}),m=new ji(p.textureWidth,p.textureHeight,{format:Rr,type:Fo,depthTexture:new GS(p.textureWidth,p.textureHeight,ge,void 0,void 0,void 0,void 0,void 0,void 0,Z),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0});const Se=e.properties.get(m);Se.__ignoreDepthValues=p.ignoreDepthValues}m.isXRRenderTarget=!0,this.setFoveation(l),u=null,s=await i.requestReferenceSpace(a),j.setContext(i),j.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function X(H){for(let Z=0;Z=0&&(S[xe]=null,_[xe].disconnect(ge))}for(let Z=0;Z=S.length){S.push(ge),xe=Se;break}else if(S[Se]===null){S[Se]=ge,xe=Se;break}if(xe===-1)break}const Ee=_[xe];Ee&&Ee.connect(ge)}}const oe=new G,V=new G;function K(H,Z,ge){oe.setFromMatrixPosition(Z.matrixWorld),V.setFromMatrixPosition(ge.matrixWorld);const xe=oe.distanceTo(V),Ee=Z.projectionMatrix.elements,Se=ge.projectionMatrix.elements,We=Ee[14]/(Ee[10]-1),Je=Ee[14]/(Ee[10]+1),ft=(Ee[9]+1)/Ee[5],At=(Ee[9]-1)/Ee[5],Qe=(Ee[8]-1)/Ee[0],Q=(Se[8]+1)/Se[0],Le=We*Qe,we=We*Q,De=xe/(-Qe+Q),Ae=De*-Qe;Z.matrixWorld.decompose(H.position,H.quaternion,H.scale),H.translateX(Ae),H.translateZ(De),H.matrixWorld.compose(H.position,H.quaternion,H.scale),H.matrixWorldInverse.copy(H.matrixWorld).invert();const lt=We+De,je=Je+De,et=Le-Ae,dt=we+(xe-Ae),xt=ft*Je/je*lt,qt=At*Je/je*lt;H.projectionMatrix.makePerspective(et,dt,xt,qt,lt,je),H.projectionMatrixInverse.copy(H.projectionMatrix).invert()}function J(H,Z){Z===null?H.matrixWorld.copy(H.matrix):H.matrixWorld.multiplyMatrices(Z.matrixWorld,H.matrix),H.matrixWorldInverse.copy(H.matrixWorld).invert()}this.updateCamera=function(H){if(i===null)return;R.near=T.near=M.near=H.near,R.far=T.far=M.far=H.far,(O!==R.near||C!==R.far)&&(i.updateRenderState({depthNear:R.near,depthFar:R.far}),O=R.near,C=R.far);const Z=H.parent,ge=R.cameras;J(R,Z);for(let xe=0;xe0&&(x.alphaTest.value=m.alphaTest);const _=e.get(m).envMap;if(_&&(x.envMap.value=_,x.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=m.reflectivity,x.ior.value=m.ior,x.refractionRatio.value=m.refractionRatio),m.lightMap){x.lightMap.value=m.lightMap;const S=t._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=m.lightMapIntensity*S,n(m.lightMap,x.lightMapTransform)}m.aoMap&&(x.aoMap.value=m.aoMap,x.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,x.aoMapTransform))}function s(x,m){x.diffuse.value.copy(m.color),x.opacity.value=m.opacity,m.map&&(x.map.value=m.map,n(m.map,x.mapTransform))}function a(x,m){x.dashSize.value=m.dashSize,x.totalSize.value=m.dashSize+m.gapSize,x.scale.value=m.scale}function l(x,m,_,S){x.diffuse.value.copy(m.color),x.opacity.value=m.opacity,x.size.value=m.size*_,x.scale.value=S*.5,m.map&&(x.map.value=m.map,n(m.map,x.uvTransform)),m.alphaMap&&(x.alphaMap.value=m.alphaMap,n(m.alphaMap,x.alphaMapTransform)),m.alphaTest>0&&(x.alphaTest.value=m.alphaTest)}function u(x,m){x.diffuse.value.copy(m.color),x.opacity.value=m.opacity,x.rotation.value=m.rotation,m.map&&(x.map.value=m.map,n(m.map,x.mapTransform)),m.alphaMap&&(x.alphaMap.value=m.alphaMap,n(m.alphaMap,x.alphaMapTransform)),m.alphaTest>0&&(x.alphaTest.value=m.alphaTest)}function d(x,m){x.specular.value.copy(m.specular),x.shininess.value=Math.max(m.shininess,1e-4)}function h(x,m){m.gradientMap&&(x.gradientMap.value=m.gradientMap)}function p(x,m){x.metalness.value=m.metalness,m.metalnessMap&&(x.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,x.metalnessMapTransform)),x.roughness.value=m.roughness,m.roughnessMap&&(x.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,x.roughnessMapTransform)),e.get(m).envMap&&(x.envMapIntensity.value=m.envMapIntensity)}function g(x,m,_){x.ior.value=m.ior,m.sheen>0&&(x.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),x.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(x.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,x.sheenColorMapTransform)),m.sheenRoughnessMap&&(x.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,x.sheenRoughnessMapTransform))),m.clearcoat>0&&(x.clearcoat.value=m.clearcoat,x.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(x.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,x.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(x.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Lr&&x.clearcoatNormalScale.value.negate())),m.iridescence>0&&(x.iridescence.value=m.iridescence,x.iridescenceIOR.value=m.iridescenceIOR,x.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(x.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,x.iridescenceMapTransform)),m.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),m.transmission>0&&(x.transmission.value=m.transmission,x.transmissionSamplerMap.value=_.texture,x.transmissionSamplerSize.value.set(_.width,_.height),m.transmissionMap&&(x.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,x.transmissionMapTransform)),x.thickness.value=m.thickness,m.thicknessMap&&(x.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=m.attenuationDistance,x.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(x.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(x.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=m.specularIntensity,x.specularColor.value.copy(m.specularColor),m.specularColorMap&&(x.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,x.specularColorMapTransform)),m.specularIntensityMap&&(x.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,m){m.matcap&&(x.matcap.value=m.matcap)}function w(x,m){const _=e.get(m).light;x.referencePosition.value.setFromMatrixPosition(_.matrixWorld),x.nearDistance.value=_.shadow.camera.near,x.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function V5(t,e,n,r){let i={},o={},s=[];const a=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,S){const M=S.program;r.uniformBlockBinding(_,M)}function u(_,S){let M=i[_.id];M===void 0&&(y(_),M=d(_),i[_.id]=M,_.addEventListener("dispose",x));const T=S.program;r.updateUBOMapping(_,T);const A=e.render.frame;o[_.id]!==A&&(p(_),o[_.id]=A)}function d(_){const S=h();_.__bindingPointIndex=S;const M=t.createBuffer(),T=_.__size,A=_.usage;return t.bindBuffer(t.UNIFORM_BUFFER,M),t.bufferData(t.UNIFORM_BUFFER,T,A),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,S,M),M}function h(){for(let _=0;_0){A=M%T;const X=T-A;A!==0&&X-P.boundary<0&&(M+=T-A,C.__offset=M)}M+=P.storage}return A=M%T,A>0&&(M+=T-A),_.__size=M,_.__cache={},this}function w(_){const S={boundary:0,storage:0};return typeof _=="number"?(S.boundary=4,S.storage=4):_.isVector2?(S.boundary=8,S.storage=8):_.isVector3||_.isColor?(S.boundary=16,S.storage=12):_.isVector4?(S.boundary=16,S.storage=16):_.isMatrix3?(S.boundary=48,S.storage=48):_.isMatrix4?(S.boundary=64,S.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),S}function x(_){const S=_.target;S.removeEventListener("dispose",x);const M=s.indexOf(S.__bindingPointIndex);s.splice(M,1),t.deleteBuffer(i[S.id]),delete i[S.id],delete o[S.id]}function m(){for(const _ in i)t.deleteBuffer(i[_]);s=[],i={},o={}}return{bind:l,update:u,dispose:m}}class $S{constructor(e={}){const{canvas:n=d3(),context:r=null,depth:i=!0,stencil:o=!0,alpha:s=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;r!==null?p=r.getContextAttributes().alpha:p=s;const g=new Uint32Array(4),y=new Int32Array(4);let w=null,x=null;const m=[],_=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Qn,this._useLegacyLights=!1,this.toneMapping=fo,this.toneMappingExposure=1;const S=this;let M=!1,T=0,A=0,R=null,O=-1,C=null;const P=new tn,k=new tn;let X=null;const oe=new tt(0);let V=0,K=n.width,J=n.height,se=1,F=null,$=null;const j=new tn(0,0,K,J),H=new tn(0,0,K,J);let Z=!1;const ge=new s0;let xe=!1,Ee=!1,Se=null;const We=new wt,Je=new Te,ft=new G,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Qe(){return R===null?se:1}let Q=r;function Le(D,W){for(let Y=0;Y{function de(){if(ne.forEach(function(pe){je.get(pe).currentProgram.isReady()&&ne.delete(pe)}),ne.size===0){ee(D);return}setTimeout(de,10)}we.get("KHR_parallel_shader_compile")!==null?de():setTimeout(de,10)})};let Ot=null;function en(D){Ot&&Ot(D)}function Mn(){Zn.stop()}function $t(){Zn.start()}const Zn=new v3;Zn.setAnimationLoop(en),typeof self<"u"&&Zn.setContext(self),this.setAnimationLoop=function(D){Ot=D,ke.setAnimationLoop(D),D===null?Zn.stop():Zn.start()},ke.addEventListener("sessionstart",Mn),ke.addEventListener("sessionend",$t),this.render=function(D,W){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),ke.enabled===!0&&ke.isPresenting===!0&&(ke.cameraAutoUpdate===!0&&ke.updateCamera(W),W=ke.getCamera()),D.isScene===!0&&D.onBeforeRender(S,D,W,R),x=Ne.get(D,_.length),x.init(),_.push(x),We.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),ge.setFromProjectionMatrix(We),Ee=this.localClippingEnabled,xe=Ze.init(this.clippingPlanes,Ee),w=Re.get(D,m.length),w.init(),m.push(w),Yr(D,W,0,S.sortObjects),w.finish(),S.sortObjects===!0&&w.sort(F,$),this.info.render.frame++,xe===!0&&Ze.beginShadows();const Y=x.state.shadowsArray;if(Be.render(Y,D,W),xe===!0&&Ze.endShadows(),this.info.autoReset===!0&&this.info.reset(),$e.render(w,D),x.setupLights(S._useLegacyLights),W.isArrayCamera){const ne=W.cameras;for(let ee=0,de=ne.length;ee0?x=_[_.length-1]:x=null,m.pop(),m.length>0?w=m[m.length-1]:w=null};function Yr(D,W,Y,ne){if(D.visible===!1)return;if(D.layers.test(W.layers)){if(D.isGroup)Y=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(W);else if(D.isLight)x.pushLight(D),D.castShadow&&x.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||ge.intersectsSprite(D)){ne&&ft.setFromMatrixPosition(D.matrixWorld).applyMatrix4(We);const pe=U.update(D),ye=D.material;ye.visible&&w.push(D,pe,ye,Y,ft.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||ge.intersectsObject(D))){const pe=U.update(D),ye=D.material;if(ne&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),ft.copy(D.boundingSphere.center)):(pe.boundingSphere===null&&pe.computeBoundingSphere(),ft.copy(pe.boundingSphere.center)),ft.applyMatrix4(D.matrixWorld).applyMatrix4(We)),Array.isArray(ye)){const ve=pe.groups;for(let nt=0,Oe=ve.length;nt0&&Ia(ee,de,W,Y),ne&&Ae.viewport(P.copy(ne)),ee.length>0&&Ti(ee,W,Y),de.length>0&&Ti(de,W,Y),pe.length>0&&Ti(pe,W,Y),Ae.buffers.depth.setTest(!0),Ae.buffers.depth.setMask(!0),Ae.buffers.color.setMask(!0),Ae.setPolygonOffset(!1)}function Ia(D,W,Y,ne){if((Y.isScene===!0?Y.overrideMaterial:null)!==null)return;const de=De.isWebGL2;Se===null&&(Se=new ji(1,1,{generateMipmaps:!0,type:we.has("EXT_color_buffer_half_float")?Pr:Fo,minFilter:ya,samples:de?4:0})),S.getDrawingBufferSize(Je),de?Se.setSize(Je.x,Je.y):Se.setSize(xg(Je.x),xg(Je.y));const pe=S.getRenderTarget();S.setRenderTarget(Se),S.getClearColor(oe),V=S.getClearAlpha(),V<1&&S.setClearColor(16777215,.5),S.clear();const ye=S.toneMapping;S.toneMapping=fo,Ti(D,Y,ne),et.updateMultisampleRenderTarget(Se),et.updateRenderTargetMipmap(Se);let ve=!1;for(let nt=0,Oe=W.length;nt0),Ue=!!Y.morphAttributes.position,it=!!Y.morphAttributes.normal,mt=!!Y.morphAttributes.color;let vt=fo;ne.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(vt=S.toneMapping);const Ct=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,rt=Ct!==void 0?Ct.length:0,Xe=je.get(ne),Bt=x.state.lights;if(xe===!0&&(Ee===!0||D!==C)){const Rt=D===C&&ne.id===O;Ze.setState(ne,D,Rt)}let Et=!1;ne.version===Xe.__version?(Xe.needsLights&&Xe.lightsStateVersion!==Bt.state.version||Xe.outputColorSpace!==ye||ee.isInstancedMesh&&Xe.instancing===!1||!ee.isInstancedMesh&&Xe.instancing===!0||ee.isSkinnedMesh&&Xe.skinning===!1||!ee.isSkinnedMesh&&Xe.skinning===!0||ee.isInstancedMesh&&Xe.instancingColor===!0&&ee.instanceColor===null||ee.isInstancedMesh&&Xe.instancingColor===!1&&ee.instanceColor!==null||Xe.envMap!==ve||ne.fog===!0&&Xe.fog!==de||Xe.numClippingPlanes!==void 0&&(Xe.numClippingPlanes!==Ze.numPlanes||Xe.numIntersection!==Ze.numIntersection)||Xe.vertexAlphas!==nt||Xe.vertexTangents!==Oe||Xe.morphTargets!==Ue||Xe.morphNormals!==it||Xe.morphColors!==mt||Xe.toneMapping!==vt||De.isWebGL2===!0&&Xe.morphTargetsCount!==rt)&&(Et=!0):(Et=!0,Xe.__version=ne.version);let Mt=Xe.currentProgram;Et===!0&&(Mt=Lt(ne,W,ee));let nn=!1,Nn=!1,xn=!1;const jt=Mt.getUniforms(),Vt=Xe.uniforms;if(Ae.useProgram(Mt.program)&&(nn=!0,Nn=!0,xn=!0),ne.id!==O&&(O=ne.id,Nn=!0),nn||C!==D){jt.setValue(Q,"projectionMatrix",D.projectionMatrix),jt.setValue(Q,"viewMatrix",D.matrixWorldInverse);const Rt=jt.map.cameraPosition;Rt!==void 0&&Rt.setValue(Q,ft.setFromMatrixPosition(D.matrixWorld)),De.logarithmicDepthBuffer&&jt.setValue(Q,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshLambertMaterial||ne.isMeshBasicMaterial||ne.isMeshStandardMaterial||ne.isShaderMaterial)&&jt.setValue(Q,"isOrthographic",D.isOrthographicCamera===!0),C!==D&&(C=D,Nn=!0,xn=!0)}if(ee.isSkinnedMesh){jt.setOptional(Q,ee,"bindMatrix"),jt.setOptional(Q,ee,"bindMatrixInverse");const Rt=ee.skeleton;Rt&&(De.floatVertexTextures?(Rt.boneTexture===null&&Rt.computeBoneTexture(),jt.setValue(Q,"boneTexture",Rt.boneTexture,et),jt.setValue(Q,"boneTextureSize",Rt.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const bn=Y.morphAttributes;if((bn.position!==void 0||bn.normal!==void 0||bn.color!==void 0&&De.isWebGL2===!0)&>.update(ee,Y,Mt),(Nn||Xe.receiveShadow!==ee.receiveShadow)&&(Xe.receiveShadow=ee.receiveShadow,jt.setValue(Q,"receiveShadow",ee.receiveShadow)),ne.isMeshGouraudMaterial&&ne.envMap!==null&&(Vt.envMap.value=ve,Vt.flipEnvMap.value=ve.isCubeTexture&&ve.isRenderTargetTexture===!1?-1:1),Nn&&(jt.setValue(Q,"toneMappingExposure",S.toneMappingExposure),Xe.needsLights&&B(Vt,xn),de&&ne.fog===!0&&Ie.refreshFogUniforms(Vt,de),Ie.refreshMaterialUniforms(Vt,ne,se,J,Se),Wm.upload(Q,La(Xe),Vt,et)),ne.isShaderMaterial&&ne.uniformsNeedUpdate===!0&&(Wm.upload(Q,La(Xe),Vt,et),ne.uniformsNeedUpdate=!1),ne.isSpriteMaterial&&jt.setValue(Q,"center",ee.center),jt.setValue(Q,"modelViewMatrix",ee.modelViewMatrix),jt.setValue(Q,"normalMatrix",ee.normalMatrix),jt.setValue(Q,"modelMatrix",ee.matrixWorld),ne.isShaderMaterial||ne.isRawShaderMaterial){const Rt=ne.uniformsGroups;for(let Wt=0,fn=Rt.length;Wt0&&et.useMultisampledRTT(D)===!1?ee=je.get(D).__webglMultisampledFramebuffer:Array.isArray(Oe)?ee=Oe[Y]:ee=Oe,P.copy(D.viewport),k.copy(D.scissor),X=D.scissorTest}else P.copy(j).multiplyScalar(se).floor(),k.copy(H).multiplyScalar(se).floor(),X=Z;if(Ae.bindFramebuffer(Q.FRAMEBUFFER,ee)&&De.drawBuffers&&ne&&Ae.drawBuffers(D,ee),Ae.viewport(P),Ae.scissor(k),Ae.setScissorTest(X),de){const ve=je.get(D.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+W,ve.__webglTexture,Y)}else if(pe){const ve=je.get(D.texture),nt=W||0;Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,ve.__webglTexture,Y||0,nt)}O=-1},this.readRenderTargetPixels=function(D,W,Y,ne,ee,de,pe){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ye=je.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&pe!==void 0&&(ye=ye[pe]),ye){Ae.bindFramebuffer(Q.FRAMEBUFFER,ye);try{const ve=D.texture,nt=ve.format,Oe=ve.type;if(nt!==Rr&&Dt.convert(nt)!==Q.getParameter(Q.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ue=Oe===Pr&&(we.has("EXT_color_buffer_half_float")||De.isWebGL2&&we.has("EXT_color_buffer_float"));if(Oe!==Fo&&Dt.convert(Oe)!==Q.getParameter(Q.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Oe===cr&&(De.isWebGL2||we.has("OES_texture_float")||we.has("WEBGL_color_buffer_float")))&&!Ue){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=D.width-ne&&Y>=0&&Y<=D.height-ee&&Q.readPixels(W,Y,ne,ee,Dt.convert(nt),Dt.convert(Oe),de)}finally{const ve=R!==null?je.get(R).__webglFramebuffer:null;Ae.bindFramebuffer(Q.FRAMEBUFFER,ve)}}},this.copyFramebufferToTexture=function(D,W,Y=0){const ne=Math.pow(2,-Y),ee=Math.floor(W.image.width*ne),de=Math.floor(W.image.height*ne);et.setTexture2D(W,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Y,0,0,D.x,D.y,ee,de),Ae.unbindTexture()},this.copyTextureToTexture=function(D,W,Y,ne=0){const ee=W.image.width,de=W.image.height,pe=Dt.convert(Y.format),ye=Dt.convert(Y.type);et.setTexture2D(Y,0),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,Y.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,Y.unpackAlignment),W.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,ne,D.x,D.y,ee,de,pe,ye,W.image.data):W.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,ne,D.x,D.y,W.mipmaps[0].width,W.mipmaps[0].height,pe,W.mipmaps[0].data):Q.texSubImage2D(Q.TEXTURE_2D,ne,D.x,D.y,pe,ye,W.image),ne===0&&Y.generateMipmaps&&Q.generateMipmap(Q.TEXTURE_2D),Ae.unbindTexture()},this.copyTextureToTexture3D=function(D,W,Y,ne,ee=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const de=D.max.x-D.min.x+1,pe=D.max.y-D.min.y+1,ye=D.max.z-D.min.z+1,ve=Dt.convert(ne.format),nt=Dt.convert(ne.type);let Oe;if(ne.isData3DTexture)et.setTexture3D(ne,0),Oe=Q.TEXTURE_3D;else if(ne.isDataArrayTexture)et.setTexture2DArray(ne,0),Oe=Q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,ne.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ne.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,ne.unpackAlignment);const Ue=Q.getParameter(Q.UNPACK_ROW_LENGTH),it=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),mt=Q.getParameter(Q.UNPACK_SKIP_PIXELS),vt=Q.getParameter(Q.UNPACK_SKIP_ROWS),Ct=Q.getParameter(Q.UNPACK_SKIP_IMAGES),rt=Y.isCompressedTexture?Y.mipmaps[0]:Y.image;Q.pixelStorei(Q.UNPACK_ROW_LENGTH,rt.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,rt.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,D.min.x),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,D.min.y),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,D.min.z),Y.isDataTexture||Y.isData3DTexture?Q.texSubImage3D(Oe,ee,W.x,W.y,W.z,de,pe,ye,ve,nt,rt.data):Y.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Q.compressedTexSubImage3D(Oe,ee,W.x,W.y,W.z,de,pe,ye,ve,rt.data)):Q.texSubImage3D(Oe,ee,W.x,W.y,W.z,de,pe,ye,ve,nt,rt),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Ue),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,it),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,mt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,vt),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,Ct),ee===0&&ne.generateMipmaps&&Q.generateMipmap(Oe),Ae.unbindTexture()},this.initTexture=function(D){D.isCubeTexture?et.setTextureCube(D,0):D.isData3DTexture?et.setTexture3D(D,0):D.isDataArrayTexture||D.isCompressedArrayTexture?et.setTexture2DArray(D,0):et.setTexture2D(D,0),Ae.unbindTexture()},this.resetState=function(){T=0,A=0,R=null,Ae.reset(),re.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return No}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===i0?"display-p3":"srgb",n.unpackColorSpace=rn.workingColorSpace===Xd?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Qn?da:DS}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===da?Qn:Vo}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class M3 extends $S{}M3.prototype.isWebGL1Renderer=!0;class l0{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new tt(e),this.density=n}clone(){return new l0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class c0{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new tt(e),this.near=n,this.far=r}clone(){return new c0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Md extends Qt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class u0{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Sd,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Si()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,n,r){e*=this.stride,r*=n.stride;for(let i=0,o=this.stride;ie.far||n.push({distance:l,point:uf.clone(),uv:ni.getInterpolation(uf,jp,df,Xp,vT,Oy,yT,new Te),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Yp(t,e,n,r,i,o){_c.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(ff.x=o*_c.x-i*_c.y,ff.y=i*_c.x+o*_c.y):ff.copy(_c),t.copy(e),t.x+=ff.x,t.y+=ff.y,t.applyMatrix4(b3)}const qp=new G,_T=new G;class A3 extends Qt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let r=0,i=n.length;r0){let r,i;for(r=1,i=n.length;r0){qp.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(qp);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){qp.setFromMatrixPosition(e.matrixWorld),_T.setFromMatrixPosition(this.matrixWorld);const r=qp.distanceTo(_T)/e.zoom;n[0].object.visible=!0;let i,o;for(i=1,o=n.length;i=s)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;il)continue;p.applyMatrix4(this.matrixWorld);const O=e.ray.origin.distanceTo(p);Oe.far||n.push({distance:O,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,s.start),_=Math.min(x.count,s.start+s.count);for(let S=m,M=_-1;Sl)continue;p.applyMatrix4(this.matrixWorld);const A=e.ray.origin.distanceTo(p);Ae.far||n.push({distance:A,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;oi.far)return;o.push({distance:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:s})}}class j5 extends Dn{constructor(e,n,r,i,o,s,a,l,u){super(e,n,r,i,o,s,a,l,u),this.isVideoTexture=!0,this.minFilter=s!==void 0?s:un,this.magFilter=o!==void 0?o:un,this.generateMipmaps=!1;const d=this;function h(){d.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class X5 extends Dn{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Gn,this.minFilter=Gn,this.generateMipmaps=!1,this.needsUpdate=!0}}class d0 extends Dn{constructor(e,n,r,i,o,s,a,l,u,d,h,p){super(null,s,a,l,u,d,i,o,h,p),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Y5 extends d0{constructor(e,n,r,i,o,s){super(e,n,r,o,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Cr}}class q5 extends d0{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Ho),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Z5 extends Dn{constructor(e,n,r,i,o,s,a,l,u){super(e,n,r,i,o,s,a,l,u),this.isCanvasTexture=!0,this.needsUpdate=!0}}class vo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),o=0;n.push(0);for(let s=1;s<=e;s++)r=this.getPoint(s/e),o+=r.distanceTo(i),n.push(o),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const o=r.length;let s;n?s=n:s=e*r[o-1];let a=0,l=o-1,u;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),u=r[i]-s,u<0)a=i+1;else if(u>0)l=i-1;else{l=i;break}if(i=l,r[i]===s)return i/(o-1);const d=r[i],p=r[i+1]-d,g=(s-d)/p;return(i+g)/(o-1)}getTangent(e,n){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const s=this.getPoint(i),a=this.getPoint(o),l=n||(s.isVector2?new Te:new G);return l.copy(a).sub(s).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new G,i=[],o=[],s=[],a=new G,l=new wt;for(let g=0;g<=e;g++){const y=g/e;i[g]=this.getTangentAt(y,new G)}o[0]=new G,s[0]=new G;let u=Number.MAX_VALUE;const d=Math.abs(i[0].x),h=Math.abs(i[0].y),p=Math.abs(i[0].z);d<=u&&(u=d,r.set(1,0,0)),h<=u&&(u=h,r.set(0,1,0)),p<=u&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),o[0].crossVectors(i[0],a),s[0].crossVectors(i[0],o[0]);for(let g=1;g<=e;g++){if(o[g]=o[g-1].clone(),s[g]=s[g-1].clone(),a.crossVectors(i[g-1],i[g]),a.length()>Number.EPSILON){a.normalize();const y=Math.acos(zn(i[g-1].dot(i[g]),-1,1));o[g].applyMatrix4(l.makeRotationAxis(a,y))}s[g].crossVectors(i[g],o[g])}if(n===!0){let g=Math.acos(zn(o[0].dot(o[e]),-1,1));g/=e,i[0].dot(a.crossVectors(o[0],o[e]))>0&&(g=-g);for(let y=1;y<=e;y++)o[y].applyMatrix4(l.makeRotationAxis(i[y],g*y)),s[y].crossVectors(i[y],o[y])}return{tangents:i,normals:o,binormals:s}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class h0 extends vo{constructor(e=0,n=0,r=1,i=1,o=0,s=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=s,this.aClockwise=a,this.aRotation=l}getPoint(e,n){const r=n||new Te,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const s=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(a)/o)+1)*o:l===0&&a===o-1&&(a=o-2,l=1);let u,d;this.closed||a>0?u=i[(a-1)%o]:(tm.subVectors(i[0],i[1]).add(i[0]),u=tm);const h=i[a%o],p=i[(a+1)%o];if(this.closed||a+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return r.set(NT(a,l.x,u.x,d.x,h.x),NT(a,l.y,u.y,d.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n=r){const s=i[o]-r,a=this.curves[o],l=a.getLength(),u=l===0?0:1-s/l;return a.getPointAt(u,n)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n0){const h=u.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(u);const d=u.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Jd extends zt{constructor(e=[new Te(0,-.5),new Te(.5,0),new Te(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=zn(i,0,Math.PI*2);const o=[],s=[],a=[],l=[],u=[],d=1/n,h=new G,p=new Te,g=new G,y=new G,w=new G;let x=0,m=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:x=e[_+1].x-e[_].x,m=e[_+1].y-e[_].y,g.x=m*1,g.y=-x,g.z=m*0,w.copy(g),g.normalize(),l.push(g.x,g.y,g.z);break;case e.length-1:l.push(w.x,w.y,w.z);break;default:x=e[_+1].x-e[_].x,m=e[_+1].y-e[_].y,g.x=m*1,g.y=-x,g.z=m*0,y.copy(g),g.x+=w.x,g.y+=w.y,g.z+=w.z,g.normalize(),l.push(g.x,g.y,g.z),w.copy(y)}for(let _=0;_<=n;_++){const S=r+_*d*i,M=Math.sin(S),T=Math.cos(S);for(let A=0;A<=e.length-1;A++){h.x=e[A].x*M,h.y=e[A].y,h.z=e[A].x*T,s.push(h.x,h.y,h.z),p.x=_/n,p.y=A/(e.length-1),a.push(p.x,p.y);const R=l[3*A+0]*M,O=l[3*A+1],C=l[3*A+0]*T;u.push(R,O,C)}}for(let _=0;_0&&S(!0),n>0&&S(!1)),this.setIndex(d),this.setAttribute("position",new ut(h,3)),this.setAttribute("normal",new ut(p,3)),this.setAttribute("uv",new ut(g,2));function _(){const M=new G,T=new G;let A=0;const R=(n-e)/r;for(let O=0;O<=o;O++){const C=[],P=O/o,k=P*(n-e)+e;for(let X=0;X<=i;X++){const oe=X/i,V=oe*l+a,K=Math.sin(V),J=Math.cos(V);T.x=k*K,T.y=-P*r+x,T.z=k*J,h.push(T.x,T.y,T.z),M.set(K,R,J).normalize(),p.push(M.x,M.y,M.z),g.push(oe,1-P),C.push(y++)}w.push(C)}for(let O=0;O.9&&R<.1&&(S<.2&&(s[_+0]+=1),M<.2&&(s[_+2]+=1),T<.2&&(s[_+4]+=1))}}function p(_){o.push(_.x,_.y,_.z)}function g(_,S){const M=_*3;S.x=e[M+0],S.y=e[M+1],S.z=e[M+2]}function y(){const _=new G,S=new G,M=new G,T=new G,A=new Te,R=new Te,O=new Te;for(let C=0,P=0;C80*n){a=u=t[0],l=d=t[1];for(let y=n;yu&&(u=h),p>d&&(d=p);g=Math.max(u-a,d-l),g=g!==0?32767/g:0}return Td(o,s,n,a,l,g,0),s}};function F3(t,e,n,r,i){let o,s;if(i===xH(t,e,n,r)>0)for(o=e;o=e;o-=r)s=kT(o,t[o],t[o+1],s);return s&&y0(s,s.next)&&(Cd(s),s=s.next),s}function Rl(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(y0(n,n.next)||Pn(n.prev,n,n.next)===0)){if(Cd(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Td(t,e,n,r,i,o,s){if(!t)return;!s&&o&&pH(t,r,i,o);let a=t,l,u;for(;t.prev!==t.next;){if(l=t.prev,u=t.next,o?sH(t,r,i,o):oH(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(u.i/n|0),Cd(t),t=u.next,a=u.next;continue}if(t=u,t===a){s?s===1?(t=aH(Rl(t),e,n),Td(t,e,n,r,i,o,2)):s===2&&lH(t,e,n,r,i,o):Td(Rl(t),e,n,r,i,o,1);break}}}function oH(t){const e=t.prev,n=t,r=t.next;if(Pn(e,n,r)>=0)return!1;const i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,u=r.y,d=io?i>s?i:s:o>s?o:s,g=a>l?a>u?a:u:l>u?l:u;let y=r.next;for(;y!==e;){if(y.x>=d&&y.x<=p&&y.y>=h&&y.y<=g&&Wc(i,a,o,l,s,u,y.x,y.y)&&Pn(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function sH(t,e,n,r){const i=t.prev,o=t,s=t.next;if(Pn(i,o,s)>=0)return!1;const a=i.x,l=o.x,u=s.x,d=i.y,h=o.y,p=s.y,g=al?a>u?a:u:l>u?l:u,x=d>h?d>p?d:p:h>p?h:p,m=jx(g,y,e,n,r),_=jx(w,x,e,n,r);let S=t.prevZ,M=t.nextZ;for(;S&&S.z>=m&&M&&M.z<=_;){if(S.x>=g&&S.x<=w&&S.y>=y&&S.y<=x&&S!==i&&S!==s&&Wc(a,d,l,h,u,p,S.x,S.y)&&Pn(S.prev,S,S.next)>=0||(S=S.prevZ,M.x>=g&&M.x<=w&&M.y>=y&&M.y<=x&&M!==i&&M!==s&&Wc(a,d,l,h,u,p,M.x,M.y)&&Pn(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;S&&S.z>=m;){if(S.x>=g&&S.x<=w&&S.y>=y&&S.y<=x&&S!==i&&S!==s&&Wc(a,d,l,h,u,p,S.x,S.y)&&Pn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;M&&M.z<=_;){if(M.x>=g&&M.x<=w&&M.y>=y&&M.y<=x&&M!==i&&M!==s&&Wc(a,d,l,h,u,p,M.x,M.y)&&Pn(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function aH(t,e,n){let r=t;do{const i=r.prev,o=r.next.next;!y0(i,o)&&z3(i,r,r.next,o)&&Ad(i,o)&&Ad(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Cd(r),Cd(r.next),r=t=o),r=r.next}while(r!==t);return Rl(r)}function lH(t,e,n,r,i,o){let s=t;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&vH(s,a)){let l=B3(s,a);s=Rl(s,s.next),l=Rl(l,l.next),Td(s,e,n,r,i,o,0),Td(l,e,n,r,i,o,0);return}a=a.next}s=s.next}while(s!==t)}function cH(t,e,n,r){const i=[];let o,s,a,l,u;for(o=0,s=e.length;o=n.next.y&&n.next.y!==n.y){const p=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=o&&p>r&&(r=p,i=n.x=n.x&&n.x>=l&&o!==n.x&&Wc(si.x||n.x===i.x&&hH(i,n)))&&(i=n,d=h)),n=n.next;while(n!==a);return i}function hH(t,e){return Pn(t.prev,t,e.prev)<0&&Pn(e.next,t,t.next)<0}function pH(t,e,n,r){let i=t;do i.z===0&&(i.z=jx(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,mH(i)}function mH(t){let e,n,r,i,o,s,a,l,u=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(s>1);return t}function jx(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function gH(t){let e=t,n=t;do(e.x=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function vH(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!yH(t,e)&&(Ad(t,e)&&Ad(e,t)&&_H(t,e)&&(Pn(t.prev,t,e.prev)||Pn(t,e.prev,e))||y0(t,e)&&Pn(t.prev,t,t.next)>0&&Pn(e.prev,e,e.next)>0)}function Pn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function y0(t,e){return t.x===e.x&&t.y===e.y}function z3(t,e,n,r){const i=sm(Pn(t,e,n)),o=sm(Pn(t,e,r)),s=sm(Pn(n,r,t)),a=sm(Pn(n,r,e));return!!(i!==o&&s!==a||i===0&&om(t,n,e)||o===0&&om(t,r,e)||s===0&&om(n,t,r)||a===0&&om(n,e,r))}function om(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function sm(t){return t>0?1:t<0?-1:0}function yH(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&z3(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Ad(t,e){return Pn(t.prev,t,t.next)<0?Pn(t,e,t.next)>=0&&Pn(t,t.prev,e)>=0:Pn(t,e,t.prev)<0||Pn(t,t.next,e)<0}function _H(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function B3(t,e){const n=new Xx(t.i,t.x,t.y),r=new Xx(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function kT(t,e,n,r){const i=new Xx(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Cd(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Xx(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function xH(t,e,n,r){let i=0;for(let o=e,s=n-r;o2&&t[e-1].equals(t[0])&&t.pop()}function FT(t,e){for(let n=0;nNumber.EPSILON){const U=Math.sqrt(qt),ue=Math.sqrt(dt*dt+xt*xt),Ie=Le.x-et/U,Re=Le.y+je/U,Ne=we.x-xt/ue,Ze=we.y+dt/ue,Be=((Ne-Ie)*xt-(Ze-Re)*dt)/(je*xt-et*dt);De=Ie+je*Be-Q.x,Ae=Re+et*Be-Q.y;const $e=De*De+Ae*Ae;if($e<=2)return new Te(De,Ae);lt=Math.sqrt($e/2)}else{let U=!1;je>Number.EPSILON?dt>Number.EPSILON&&(U=!0):je<-Number.EPSILON?dt<-Number.EPSILON&&(U=!0):Math.sign(et)===Math.sign(xt)&&(U=!0),U?(De=-et,Ae=je,lt=Math.sqrt(qt)):(De=je,Ae=et,lt=Math.sqrt(qt/2))}return new Te(De/lt,Ae/lt)}const $=[];for(let Q=0,Le=V.length,we=Le-1,De=Q+1;Q=0;Q--){const Le=Q/x,we=g*Math.cos(Le*Math.PI/2),De=y*Math.sin(Le*Math.PI/2)+w;for(let Ae=0,lt=V.length;Ae=0;){const De=we;let Ae=we-1;Ae<0&&(Ae=Q.length-1);for(let lt=0,je=d+x*2;lt0)&&g.push(S,M,A),(m!==r-1||l0!=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 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.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 G3 extends vr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new tt(16777215),this.specular=new tt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Aa,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=jd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(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.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.flatShading=e.flatShading,this.fog=e.fog,this}}class $3 extends vr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new tt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Aa,this.normalScale=new Te(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 j3 extends vr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Aa,this.normalScale=new Te(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 X3 extends vr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Aa,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=jd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(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.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.flatShading=e.flatShading,this.fog=e.fog,this}}class Y3 extends vr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new tt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Aa,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.flatShading=e.flatShading,this.fog=e.fog,this}}class q3 extends Xr{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}}function fl(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function Z3(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function K3(t){function e(i,o){return t[i]-t[o]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function Yx(t,e,n){const r=t.length,i=new t.constructor(r);for(let o=0,s=0;s!==r;++o){const a=n[o]*e;for(let l=0;l!==e;++l)i[s++]=t[a+l]}return i}function rw(t,e,n,r){let i=1,o=t[0];for(;o!==void 0&&o[r]===void 0;)o=t[i++];if(o===void 0)return;let s=o[r];if(s!==void 0)if(Array.isArray(s))do s=o[r],s!==void 0&&(e.push(o.time),n.push.apply(n,s)),o=t[i++];while(o!==void 0);else if(s.toArray!==void 0)do s=o[r],s!==void 0&&(e.push(o.time),s.toArray(n,n.length)),o=t[i++];while(o!==void 0);else do s=o[r],s!==void 0&&(e.push(o.time),n.push(s)),o=t[i++];while(o!==void 0)}function MH(t,e,n,r,i=30){const o=t.clone();o.name=e;const s=[];for(let l=0;l=r)){h.push(u.times[g]);for(let w=0;wo.tracks[l].times[0]&&(a=o.tracks[l].times[0]);for(let l=0;l=a.times[y]){const m=y*h+d,_=m+h-d;w=a.values.slice(m,_)}else{const m=a.createInterpolant(),_=d,S=h-d;m.evaluate(o),w=m.resultBuffer.slice(_,S)}l==="quaternion"&&new mr().fromArray(w).normalize().conjugate().toArray(w);const x=u.times.length;for(let m=0;m=o)){const a=n[1];e=o)break t}s=r,r=0;break n}break e}for(;r>>1;en;)--s;if(++s,o!==0||s!==i){o>=s&&(s=Math.max(s,1),o=s-1);const a=this.getValueSize();this.times=r.slice(o,s),this.values=this.values.slice(o*a,s*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,o=r.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let a=0;a!==o;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(s!==null&&s>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,s),e=!1;break}s=l}if(i!==void 0&&Z3(i))for(let a=0,l=i.length;a!==l;++a){const u=i[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===Vm,o=e.length-1;let s=1;for(let a=1;a0){e[s]=e[o];for(let a=o*r,l=s*r,u=0;u!==r;++u)n[l+u]=n[a+u];++s}return s!==e.length?(this.times=e.slice(0,s),this.values=n.slice(0,s*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}yo.prototype.TimeBufferType=Float32Array;yo.prototype.ValueBufferType=Float32Array;yo.prototype.DefaultInterpolation=gd;class Ul extends yo{}Ul.prototype.ValueTypeName="bool";Ul.prototype.ValueBufferType=Array;Ul.prototype.DefaultInterpolation=md;Ul.prototype.InterpolantFactoryMethodLinear=void 0;Ul.prototype.InterpolantFactoryMethodSmooth=void 0;class ow extends yo{}ow.prototype.ValueTypeName="color";class Rd extends yo{}Rd.prototype.ValueTypeName="number";class eI extends nh{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let u=e*a;for(let d=u+a;u!==d;u+=4)mr.slerpFlat(o,0,s,u-a,s,u,l);return o}}class wu extends yo{InterpolantFactoryMethodLinear(e){return new eI(this.times,this.values,this.getValueSize(),e)}}wu.prototype.ValueTypeName="quaternion";wu.prototype.DefaultInterpolation=gd;wu.prototype.InterpolantFactoryMethodSmooth=void 0;class Fl extends yo{}Fl.prototype.ValueTypeName="string";Fl.prototype.ValueBufferType=Array;Fl.prototype.DefaultInterpolation=md;Fl.prototype.InterpolantFactoryMethodLinear=void 0;Fl.prototype.InterpolantFactoryMethodSmooth=void 0;class Pd extends yo{}Pd.prototype.ValueTypeName="vector";class Id{constructor(e,n=-1,r,i=r0){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Si(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let s=0,a=r.length;s!==a;++s)n.push(CH(r[s]).scale(i));const o=new this(e.name,e.duration,n,e.blendMode);return o.uuid=e.uuid,o}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let o=0,s=r.length;o!==s;++o)n.push(yo.toJSON(r[o]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const o=n.length,s=[];for(let a=0;a1){const h=d[1];let p=i[h];p||(i[h]=p=[]),p.push(u)}}const s=[];for(const a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return s}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(h,p,g,y,w){if(g.length!==0){const x=[],m=[];rw(g,x,m,y),x.length!==0&&w.push(new h(p,x,m))}},i=[],o=e.name||"default",s=e.fps||30,a=e.blendMode;let l=e.length||-1;const u=e.hierarchy||[];for(let h=0;h{n&&n(o),this.manager.itemEnd(e)},0),o;if(os[e]!==void 0){os[e].push({onLoad:n,onProgress:r,onError:i});return}os[e]=[],os[e].push({onLoad:n,onProgress:r,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(s).then(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;const d=os[e],h=u.body.getReader(),p=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),g=p?parseInt(p):0,y=g!==0;let w=0;const x=new ReadableStream({start(m){_();function _(){h.read().then(({done:S,value:M})=>{if(S)m.close();else{w+=M.byteLength;const T=new ProgressEvent("progress",{lengthComputable:y,loaded:w,total:g});for(let A=0,R=d.length;A{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return u.json();default:if(a===void 0)return u.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),p=h&&h[1]?h[1].toLowerCase():void 0,g=new TextDecoder(p);return u.arrayBuffer().then(y=>g.decode(y))}}}).then(u=>{Pl.add(e,u);const d=os[e];delete os[e];for(let h=0,p=d.length;h{const d=os[e];if(d===void 0)throw this.manager.itemError(e),u;delete os[e];for(let h=0,p=d.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class PH extends ci{constructor(e){super(e)}load(e,n,r,i){const o=this,s=new Es(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(a){try{n(o.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const s=e.uniforms[o];switch(i.uniforms[o]={},s.type){case"t":i.uniforms[o].value=r(s.value);break;case"c":i.uniforms[o].value=new tt().setHex(s.value);break;case"v2":i.uniforms[o].value=new Te().fromArray(s.value);break;case"v3":i.uniforms[o].value=new G().fromArray(s.value);break;case"v4":i.uniforms[o].value=new tn().fromArray(s.value);break;case"m3":i.uniforms[o].value=new Ft().fromArray(s.value);break;case"m4":i.uniforms[o].value=new wt().fromArray(s.value);break;default:i.uniforms[o].value=s.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new Te().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Te().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const n={ShadowMaterial:V3,SpriteMaterial:jS,RawShaderMaterial:W3,ShaderMaterial:Xi,PointsMaterial:YS,MeshPhysicalMaterial:nw,MeshStandardMaterial:tw,MeshPhongMaterial:G3,MeshToonMaterial:$3,MeshNormalMaterial:j3,MeshLambertMaterial:X3,MeshDepthMaterial:VS,MeshDistanceMaterial:WS,MeshBasicMaterial:Ca,MeshMatcapMaterial:Y3,LineDashedMaterial:q3,LineBasicMaterial:Xr,Material:vr};return new n[e]}}class qx{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r0){const l=new sw(n);o=new Ld(l),o.setCrossOrigin(this.crossOrigin);for(let u=0,d=e.length;u0){i=new Ld(this.manager),i.setCrossOrigin(this.crossOrigin);for(let s=0,a=e.length;s"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,s=Pl.get(e);if(s!==void 0)return o.manager.itemStart(e),setTimeout(function(){n&&n(s),o.manager.itemEnd(e)},0),s;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(l){Pl.add(e,l),n&&n(l),o.manager.itemEnd(e)}).catch(function(l){i&&i(l),o.manager.itemError(e),o.manager.itemEnd(e)}),o.manager.itemStart(e)}}let am;class uw{static getContext(){return am===void 0&&(am=new(window.AudioContext||window.webkitAudioContext)),am}static setContext(e){am=e}}class FH extends ci{constructor(e){super(e)}load(e,n,r,i){const o=this,s=new Es(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(l){try{const u=l.slice(0);uw.getContext().decodeAudioData(u,function(h){n(h)},a)}catch(u){a(u)}},r,i);function a(l){i?i(l):console.error(l),o.manager.itemError(e)}}}const jT=new wt,XT=new wt,ja=new wt;class zH{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Bn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Bn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,ja.copy(e.projectionMatrix);const i=n.eyeSep/2,o=i*n.near/n.focus,s=n.near*Math.tan(vl*n.fov*.5)/n.zoom;let a,l;XT.elements[12]=-i,jT.elements[12]=i,a=-s*n.aspect+o,l=s*n.aspect+o,ja.elements[0]=2*n.near/(l-a),ja.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(ja),a=-s*n.aspect-o,l=s*n.aspect-o,ja.elements[0]=2*n.near/(l-a),ja.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(ja)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(XT),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(jT)}}class fw{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=YT(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=YT();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function YT(){return(typeof performance>"u"?Date:performance).now()}const Xa=new G,qT=new mr,BH=new G,Ya=new G;class HH extends Qt{constructor(){super(),this.type="AudioListener",this.context=uw.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new fw}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xa,qT,BH),Ya.set(0,0,-1).applyQuaternion(qT),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Xa.x,i),n.positionY.linearRampToValueAtTime(Xa.y,i),n.positionZ.linearRampToValueAtTime(Xa.z,i),n.forwardX.linearRampToValueAtTime(Ya.x,i),n.forwardY.linearRampToValueAtTime(Ya.y,i),n.forwardZ.linearRampToValueAtTime(Ya.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Xa.x,Xa.y,Xa.z),n.setOrientation(Ya.x,Ya.y,Ya.z,r.x,r.y,r.z)}}class dI extends Qt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(r,i,this._addIndex*n,1,n);for(let l=n,u=n+n;l!==u;++l)if(r[l]!==r[l+n]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let o=r,s=i;o!==s;++o)n[o]=n[i+o%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r=.5)for(let s=0;s!==o;++s)e[n+s]=e[r+s]}_slerp(e,n,r,i){mr.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,o){const s=this._workIndex*o;mr.multiplyQuaternionsFlat(e,s,e,n,e,r),mr.slerpFlat(e,n,e,n,e,s,i)}_lerp(e,n,r,i,o){const s=1-i;for(let a=0;a!==o;++a){const l=n+a;e[l]=e[l]*s+e[r+a]*i}}_lerpAdditive(e,n,r,i,o){for(let s=0;s!==o;++s){const a=n+s;e[a]=e[a]+e[r+s]*i}}}const dw="\\[\\]\\.:\\/",$H=new RegExp("["+dw+"]","g"),hw="[^"+dw+"]",jH="[^"+dw.replace("\\.","")+"]",XH=/((?:WC+[\/:])*)/.source.replace("WC",hw),YH=/(WCOD+)?/.source.replace("WCOD",jH),qH=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",hw),ZH=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",hw),KH=new RegExp("^"+XH+YH+qH+ZH+"$"),JH=["material","materials","bones","map"];class QH{constructor(e,n,r){const i=r||Xt.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=r.length;i!==o;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class Xt{constructor(e,n,r){this.path=n,this.parsedPath=r||Xt.parseTrackName(n),this.node=Xt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new Xt.Composite(e,n,r):new Xt(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($H,"")}static parseTrackName(e){const n=KH.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=r.nodeName.substring(i+1);JH.indexOf(o)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=o)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(o){for(let s=0;s=o){const h=o++,p=e[h];n[p.uuid]=d,e[d]=p,n[u]=h,e[h]=l;for(let g=0,y=i;g!==y;++g){const w=r[g],x=w[h],m=w[d];w[d]=x,w[h]=m}}}this.nCachedObjects_=o}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let o=this.nCachedObjects_,s=e.length;for(let a=0,l=arguments.length;a!==l;++a){const u=arguments[a],d=u.uuid,h=n[d];if(h!==void 0)if(delete n[d],h0&&(n[g.uuid]=h),e[h]=g,e.pop();for(let y=0,w=i;y!==w;++y){const x=r[y];x[h]=x[p],x.pop()}}}this.nCachedObjects_=o}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const o=this._bindings;if(i!==void 0)return o[i];const s=this._paths,a=this._parsedPaths,l=this._objects,u=l.length,d=this.nCachedObjects_,h=new Array(u);i=o.length,r[e]=i,s.push(e),a.push(n),o.push(h);for(let p=d,g=l.length;p!==g;++p){const y=l[p];h[p]=new Xt(y,e,n)}return h}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,o=this._parsedPaths,s=this._bindings,a=s.length-1,l=s[a],u=e[a];n[u]=r,s[r]=l,s.pop(),o[r]=o[a],o.pop(),i[r]=i[a],i.pop()}}}class pI{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const o=n.tracks,s=o.length,a=new Array(s),l={endingStart:al,endingEnd:al};for(let u=0;u!==s;++u){const d=o[u].createInterpolant(null);a[u]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qP,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,o=e._clip.duration,s=o/i,a=i/o;e.warp(1,s,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,o=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,u=a.sampleValues;return l[0]=o,l[1]=o+r,u[0]=e/s,u[1]=n/s,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const l=(e-o)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const s=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case LS:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(s),u[d].accumulateAdditive(a);break;case r0:default:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(s),u[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,o=this._loopCount;const s=r===ZP;if(e===0)return o===-1?i:s&&(o&1)===1?n-i:i;if(r===YP){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,s)):this._setEndings(this.repetitions===0,!0,s)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,o+=Math.abs(a);const l=this.repetitions-o;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const u=e<0;this._setEndings(u,!u,s)}else this._setEndings(!1,!1,s);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(s&&(o&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=ll,i.endingEnd=ll):(e?i.endingStart=this.zeroSlopeAtStart?ll:al:i.endingStart=vd,n?i.endingEnd=this.zeroSlopeAtEnd?ll:al:i.endingEnd=vd)}_scheduleFading(e,n,r){const i=this._mixer,o=i.time;let s=this._weightInterpolant;s===null&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=o,l[0]=n,a[1]=o+e,l[1]=r,this}}const t6=new Float32Array(1);class n6 extends $o{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,o=i.length,s=e._propertyBindings,a=e._interpolants,l=r.uuid,u=this._bindingsByRootAndName;let d=u[l];d===void 0&&(d={},u[l]=d);for(let h=0;h!==o;++h){const p=i[h],g=p.name;let y=d[g];if(y!==void 0)++y.referenceCount,s[h]=y;else{if(y=s[h],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,l,g));continue}const w=n&&n._propertyBindings[h].binding.parsedPath;y=new hI(Xt.create(r,g,w),p.ValueTypeName,p.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,l,g),s[h]=y}a[h].resultBuffer=y.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const o=n[r];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const o=n[r];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,o=Math.sign(e),s=this._accuIndex^=1;for(let u=0;u!==r;++u)n[u]._update(i,e,o,s);const a=this._bindings,l=this._nActiveBindings;for(let u=0;u!==l;++u)a[u].apply(s);return this}setTime(e){this.time=0;for(let n=0;nthis.max.x||e.ythis.max.y)}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}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,JT).distanceTo(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}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const QT=new G,lm=new G;class c6{constructor(e=new G,n=new G){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){QT.subVectors(e,this.start),lm.subVectors(this.end,this.start);const r=lm.dot(lm);let o=lm.dot(QT)/r;return n&&(o=zn(o,0,1)),o}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const eA=new G;class u6 extends Qt{constructor(e,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new zt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,a=1,l=32;s1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{oA.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(oA,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class E6 extends Xo{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new zt;i.setAttribute("position",new ut(n,3)),i.setAttribute("color",new ut(r,3));const o=new Xr({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,n,r){const i=new tt,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(n),i.toArray(o,6),i.toArray(o,9),i.set(r),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class M6{constructor(){this.type="ShapePath",this.color=new tt,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new bd,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,o,s){return this.currentPath.bezierCurveTo(e,n,r,i,o,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(m){const _=[];for(let S=0,M=m.length;SNumber.EPSILON){if(P<0&&(R=_[A],C=-C,O=_[T],P=-P),m.yO.y)continue;if(m.y===R.y){if(m.x===R.x)return!0}else{const k=P*(m.x-R.x)-C*(m.y-R.y);if(k===0)return!0;if(k<0)continue;M=!M}}else{if(m.y!==R.y)continue;if(O.x<=m.x&&m.x<=R.x||R.x<=m.x&&m.x<=O.x)return!0}}return M}const i=zo.isClockWise,o=this.subPaths;if(o.length===0)return[];let s,a,l;const u=[];if(o.length===1)return a=o[0],l=new pa,l.curves=a.curves,u.push(l),u;let d=!i(o[0].getPoints());d=e?!d:d;const h=[],p=[];let g=[],y=0,w;p[y]=void 0,g[y]=[];for(let m=0,_=o.length;m<_;m++)a=o[m],w=a.getPoints(),s=i(w),s=e?!s:s,s?(!d&&p[y]&&y++,p[y]={s:new pa,p:w},p[y].s.curves=a.curves,d&&y++,g[y]=[]):g[y].push({h:a,p:w[0]});if(!p[0])return n(o);if(p.length>1){let m=!1,_=0;for(let S=0,M=p.length;S0&&m===!1&&(g=h)}let x;for(let m=0,_=p.length;m<_;m++){l=p[m].s,u.push(l),x=g[m];for(let S=0,M=x.length;S{const h=typeof u=="function"?u(e):u;if(h!==e){const p=e;e=d?h:Object.assign({},e,h),n.forEach(g=>g(e,p))}},i=()=>e,o=(u,d=i,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=d(e);function g(){const y=d(e);if(!h(p,y)){const w=p;u(p=y,w)}}return n.add(g),()=>n.delete(g)},l={setState:r,getState:i,subscribe:(u,d,h)=>d||h?o(u,d,h):(n.add(u),()=>n.delete(u)),destroy:()=>n.clear()};return e=t(r,i,l),l}const A6=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),sA=A6?L.useEffect:L.useLayoutEffect;function gw(t){const e=typeof t=="function"?T6(t):t,n=(r=e.getState,i=Object.is)=>{const[,o]=L.useReducer(x=>x+1,0),s=e.getState(),a=L.useRef(s),l=L.useRef(r),u=L.useRef(i),d=L.useRef(!1),h=L.useRef();h.current===void 0&&(h.current=r(s));let p,g=!1;(a.current!==s||l.current!==r||u.current!==i||d.current)&&(p=r(s),g=!i(h.current,p)),sA(()=>{g&&(h.current=p),a.current=s,l.current=r,u.current=i,d.current=!1});const y=L.useRef(s);sA(()=>{const x=()=>{try{const _=e.getState(),S=l.current(_);u.current(h.current,S)||(a.current=_,h.current=S,o())}catch{d.current=!0,o()}},m=e.subscribe(x);return e.getState()!==y.current&&x(),m},[]);const w=g?p:h.current;return L.useDebugValue(w),w};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var vI={exports:{}},jy={exports:{}},Xy={};/** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var aA;function C6(){return aA||(aA=1,function(t){function e(F,$){var j=F.length;F.push($);e:for(;0>>1,Z=F[H];if(0>>1;Hi(Ee,j))Sei(We,Ee)?(F[H]=We,F[Se]=j,H=Se):(F[H]=Ee,F[xe]=j,H=xe);else if(Sei(We,j))F[H]=We,F[Se]=j,H=Se;else break e}}return $}function i(F,$){var j=F.sortIndex-$.sortIndex;return j!==0?j:F.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var l=[],u=[],d=1,h=null,p=3,g=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(F){for(var $=n(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=F)r(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=n(u)}}function M(F){if(w=!1,S(F),!y)if(n(l)!==null)y=!0,J(T);else{var $=n(u);$!==null&&se(M,$.startTime-F)}}function T(F,$){y=!1,w&&(w=!1,m(O),O=-1),g=!0;var j=p;try{for(S($),h=n(l);h!==null&&(!(h.expirationTime>$)||F&&!k());){var H=h.callback;if(typeof H=="function"){h.callback=null,p=h.priorityLevel;var Z=H(h.expirationTime<=$);$=t.unstable_now(),typeof Z=="function"?h.callback=Z:h===n(l)&&r(l),S($)}else r(l);h=n(l)}if(h!==null)var ge=!0;else{var xe=n(u);xe!==null&&se(M,xe.startTime-$),ge=!1}return ge}finally{h=null,p=j,g=!1}}var A=!1,R=null,O=-1,C=5,P=-1;function k(){return!(t.unstable_now()-PF||125H?(F.sortIndex=j,e(u,F),n(l)===null&&F===n(u)&&(w?(m(O),O=-1):w=!0,se(M,j-H))):(F.sortIndex=Z,e(l,F),y||g||(y=!0,J(T))),F},t.unstable_shouldYield=k,t.unstable_wrapCallback=function(F){var $=p;return function(){var j=p;p=$;try{return F.apply(this,arguments)}finally{p=j}}}}(Xy)),Xy}var lA;function R6(){return lA||(lA=1,jy.exports=C6()),jy.exports}/** * @license React * react-reconciler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var P6=function(e){var n={},r=L,i=R6(),o=Object.assign;function s(c){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+c,v=1;vle||b[q]!==I[le]){var _e=` `+b[q].replace(" at new "," at ");return c.displayName&&_e.includes("")&&(_e=_e.replace("",c.displayName)),_e}while(1<=q&&0<=le);break}}}finally{Oe=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?nt(c):""}var it=Object.prototype.hasOwnProperty,mt=[],vt=-1;function Ct(c){return{current:c}}function rt(c){0>vt||(c.current=mt[vt],mt[vt]=null,vt--)}function Xe(c,f){vt++,mt[vt]=c.current,c.current=f}var Bt={},Et=Ct(Bt),Mt=Ct(!1),nn=Bt;function Nn(c,f){var v=c.type.contextTypes;if(!v)return Bt;var E=c.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===f)return E.__reactInternalMemoizedMaskedChildContext;var b={},I;for(I in v)b[I]=f[I];return E&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=b),b}function xn(c){return c=c.childContextTypes,c!=null}function jt(){rt(Mt),rt(Et)}function Vt(c,f,v){if(Et.current!==Bt)throw Error(s(168));Xe(Et,f),Xe(Mt,v)}function bn(c,f,v){var E=c.stateNode;if(f=f.childContextTypes,typeof E.getChildContext!="function")return v;E=E.getChildContext();for(var b in E)if(!(b in f))throw Error(s(108,O(c)||"Unknown",b));return o({},v,E)}function Rt(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Bt,nn=Et.current,Xe(Et,c),Xe(Mt,Mt.current),!0}function Wt(c,f,v){var E=c.stateNode;if(!E)throw Error(s(169));v?(c=bn(c,f,nn),E.__reactInternalMemoizedMergedChildContext=c,rt(Mt),rt(Et),Xe(Et,c)):rt(Mt),Xe(Mt,v)}var fn=Math.clz32?Math.clz32:So,Ai=Math.log,Nr=Math.LN2;function So(c){return c>>>=0,c===0?32:31-(Ai(c)/Nr|0)|0}var mh=64,gh=4194304;function Lu(c){switch(c&-c){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: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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function vh(c,f){var v=c.pendingLanes;if(v===0)return 0;var E=0,b=c.suspendedLanes,I=c.pingedLanes,q=v&268435455;if(q!==0){var le=q&~b;le!==0?E=Lu(le):(I&=q,I!==0&&(E=Lu(I)))}else q=v&~b,q!==0?E=Lu(q):I!==0&&(E=Lu(I));if(E===0)return 0;if(f!==0&&f!==E&&!(f&b)&&(b=E&-E,I=f&-f,b>=I||b===16&&(I&4194240)!==0))return f;if(E&4&&(E|=v&16),f=c.entangledLanes,f!==0)for(c=c.entanglements,f&=E;0v;v++)f.push(c);return f}function Du(c,f,v){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-fn(f),c[f]=v}function UD(c,f){var v=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var E=c.eventTimes;for(c=c.expirationTimes;0>=q,b-=q,Zo=1<<32-fn(f)+b|v<Kt?(or=It,It=null):or=It.sibling;var Jt=yt(fe,It,me[Kt],Ke);if(Jt===null){It===null&&(It=or);break}c&&It&&Jt.alternate===null&&f(fe,It),ce=I(Jt,ce,Kt),Ut===null?ht=Jt:Ut.sibling=Jt,Ut=Jt,It=or}if(Kt===me.length)return v(fe,It),Sn&&Oa(fe,Kt),ht;if(It===null){for(;KtKt?(or=It,It=null):or=It.sibling;var Fs=yt(fe,It,Jt.value,Ke);if(Fs===null){It===null&&(It=or);break}c&&It&&Fs.alternate===null&&f(fe,It),ce=I(Fs,ce,Kt),Ut===null?ht=Fs:Ut.sibling=Fs,Ut=Fs,It=or}if(Jt.done)return v(fe,It),Sn&&Oa(fe,Kt),ht;if(It===null){for(;!Jt.done;Kt++,Jt=me.next())Jt=Pt(fe,Jt.value,Ke),Jt!==null&&(ce=I(Jt,ce,Kt),Ut===null?ht=Jt:Ut.sibling=Jt,Ut=Jt);return Sn&&Oa(fe,Kt),ht}for(It=E(fe,It);!Jt.done;Kt++,Jt=me.next())Jt=cn(It,fe,Kt,Jt.value,Ke),Jt!==null&&(c&&Jt.alternate!==null&&It.delete(Jt.key===null?Kt:Jt.key),ce=I(Jt,ce,Kt),Ut===null?ht=Jt:Ut.sibling=Jt,Ut=Jt);return c&&It.forEach(function(wO){return f(fe,wO)}),Sn&&Oa(fe,Kt),ht}function Ni(fe,ce,me,Ke){if(typeof me=="object"&&me!==null&&me.type===d&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case l:e:{for(var ht=me.key,Ut=ce;Ut!==null;){if(Ut.key===ht){if(ht=me.type,ht===d){if(Ut.tag===7){v(fe,Ut.sibling),ce=b(Ut,me.props.children),ce.return=fe,fe=ce;break e}}else if(Ut.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===S&&lE(ht)===Ut.type){v(fe,Ut.sibling),ce=b(Ut,me.props),ce.ref=ku(fe,Ut,me),ce.return=fe,fe=ce;break e}v(fe,Ut);break}else f(fe,Ut);Ut=Ut.sibling}me.type===d?(ce=Ha(me.props.children,fe.mode,Ke,me.key),ce.return=fe,fe=ce):(Ke=op(me.type,me.key,me.props,null,fe.mode,Ke),Ke.ref=ku(fe,ce,me),Ke.return=fe,fe=Ke)}return q(fe);case u:e:{for(Ut=me.key;ce!==null;){if(ce.key===Ut)if(ce.tag===4&&ce.stateNode.containerInfo===me.containerInfo&&ce.stateNode.implementation===me.implementation){v(fe,ce.sibling),ce=b(ce,me.children||[]),ce.return=fe,fe=ce;break e}else{v(fe,ce);break}else f(fe,ce);ce=ce.sibling}ce=Uv(me,fe.mode,Ke),ce.return=fe,fe=ce}return q(fe);case S:return Ut=me._init,Ni(fe,ce,Ut(me._payload),Ke)}if(K(me))return pt(fe,ce,me,Ke);if(A(me))return Sr(fe,ce,me,Ke);Ch(fe,me)}return typeof me=="string"&&me!==""||typeof me=="number"?(me=""+me,ce!==null&&ce.tag===6?(v(fe,ce.sibling),ce=b(ce,me),ce.return=fe,fe=ce):(v(fe,ce),ce=kv(me,fe.mode,Ke),ce.return=fe,fe=ce),q(fe)):v(fe,ce)}return Ni}var Xl=cE(!0),uE=cE(!1),Uu={},Ii=Ct(Uu),Fu=Ct(Uu),Yl=Ct(Uu);function To(c){if(c===Uu)throw Error(s(174));return c}function ev(c,f){Xe(Yl,f),Xe(Fu,c),Xe(Ii,Uu),c=se(f),rt(Ii),Xe(Ii,c)}function ql(){rt(Ii),rt(Fu),rt(Yl)}function fE(c){var f=To(Yl.current),v=To(Ii.current);f=F(v,c.type,f),v!==f&&(Xe(Fu,c),Xe(Ii,f))}function tv(c){Fu.current===c&&(rt(Ii),rt(Fu))}var Tn=Ct(0);function Rh(c){for(var f=c;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||xo(v)||Ia(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var nv=[];function rv(){for(var c=0;cv?v:4,c(!0);var E=Li.transition;Li.transition={};try{c(!1),f()}finally{Zt=v,Li.transition=E}}function bE(){return Ao().memoizedState}function qD(c,f,v){var E=Ns(c);v={lane:E,action:v,hasEagerState:!1,eagerState:null,next:null},TE(c)?AE(f,v):(CE(c,f,v),v=Ur(),c=Di(c,E,v),c!==null&&RE(c,f,E))}function ZD(c,f,v){var E=Ns(c),b={lane:E,action:v,hasEagerState:!1,eagerState:null,next:null};if(TE(c))AE(f,b);else{CE(c,f,b);var I=c.alternate;if(c.lanes===0&&(I===null||I.lanes===0)&&(I=f.lastRenderedReducer,I!==null))try{var q=f.lastRenderedState,le=I(q,v);if(b.hasEagerState=!0,b.eagerState=le,Eo(le,q))return}catch{}finally{}v=Ur(),c=Di(c,E,v),c!==null&&RE(c,f,E)}}function TE(c){var f=c.alternate;return c===kn||f!==null&&f===kn}function AE(c,f){zu=Ih=!0;var v=c.pending;v===null?f.next=f:(f.next=v.next,v.next=f),c.pending=f}function CE(c,f,v){jn!==null&&c.mode&1&&!(Ht&2)?(c=f.interleaved,c===null?(v.next=v,bo===null?bo=[f]:bo.push(f)):(v.next=c.next,c.next=v),f.interleaved=v):(c=f.pending,c===null?v.next=v:(v.next=c.next,c.next=v),f.pending=v)}function RE(c,f,v){if(v&4194240){var E=f.lanes;E&=c.pendingLanes,v|=E,f.lanes=v,U0(c,v)}}var kh={readContext:Ci,useCallback:_r,useContext:_r,useEffect:_r,useImperativeHandle:_r,useInsertionEffect:_r,useLayoutEffect:_r,useMemo:_r,useReducer:_r,useRef:_r,useState:_r,useDebugValue:_r,useDeferredValue:_r,useTransition:_r,useMutableSource:_r,useSyncExternalStore:_r,useId:_r,unstable_isNewReconciler:!1},KD={readContext:Ci,useCallback:function(c,f){return Jo().memoizedState=[c,f===void 0?null:f],c},useContext:Ci,useEffect:lv,useImperativeHandle:function(c,f,v){return v=v!=null?v.concat([c]):null,Oh(4194308,4,SE.bind(null,f,c),v)},useLayoutEffect:function(c,f){return Oh(4194308,4,c,f)},useInsertionEffect:function(c,f){return Oh(4,2,c,f)},useMemo:function(c,f){var v=Jo();return f=f===void 0?null:f,c=c(),v.memoizedState=[c,f],c},useReducer:function(c,f,v){var E=Jo();return f=v!==void 0?v(f):f,E.memoizedState=E.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},E.queue=c,c=c.dispatch=qD.bind(null,kn,c),[E.memoizedState,c]},useRef:function(c){var f=Jo();return c={current:c},f.memoizedState=c},useState:av,useDebugValue:cv,useDeferredValue:function(c){var f=av(c),v=f[0],E=f[1];return lv(function(){var b=Li.transition;Li.transition={};try{E(c)}finally{Li.transition=b}},[c]),v},useTransition:function(){var c=av(!1),f=c[0];return c=YD.bind(null,c[1]),Jo().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,v){var E=kn,b=Jo();if(Sn){if(v===void 0)throw Error(s(407));v=v()}else{if(v=f(),jn===null)throw Error(s(349));Zl&30||pE(E,f,v)}b.memoizedState=v;var I={value:v,getSnapshot:f};return b.queue=I,lv(gE.bind(null,E,I,c),[c]),E.flags|=2048,Hu(9,mE.bind(null,E,I,v,f),void 0,null),v},useId:function(){var c=Jo(),f=jn.identifierPrefix;if(Sn){var v=Ko,E=Zo;v=(E&~(1<<32-fn(E)-1)).toString(32)+v,f=":"+f+"R"+v,v=Bu++,0Cv&&(f.flags|=128,E=!0,$u(b,!1),f.lanes=4194304)}else{if(!E)if(c=Rh(I),c!==null){if(f.flags|=128,E=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),$u(b,!0),b.tail===null&&b.tailMode==="hidden"&&!I.alternate&&!Sn)return xr(f),null}else 2*rr()-b.renderingStartTime>Cv&&v!==1073741824&&(f.flags|=128,E=!0,$u(b,!1),f.lanes=4194304);b.isBackwards?(I.sibling=f.child,f.child=I):(c=b.last,c!==null?c.sibling=I:f.child=I,b.last=I)}return b.tail!==null?(f=b.tail,b.rendering=f,b.tail=f.sibling,b.renderingStartTime=rr(),f.sibling=null,c=Tn.current,Xe(Tn,E?c&1|2:c&1),f):(xr(f),null);case 22:case 23:return Dv(),E=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==E&&(f.flags|=8192),E&&f.mode&1?hi&1073741824&&(xr(f),Qe&&f.subtreeFlags&6&&(f.flags|=8192)):xr(f),null;case 24:return null;case 25:return null}throw Error(s(156,f.tag))}var nO=a.ReactCurrentOwner,di=!1;function kr(c,f,v,E){f.child=c===null?uE(f,null,v,E):Xl(f,c.child,v,E)}function UE(c,f,v,E,b){v=v.render;var I=f.ref;return Wl(f,b),E=ov(c,f,v,E,I,b),v=sv(),c!==null&&!di?(f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~b,Qo(c,f,b)):(Sn&&v&&q0(f),f.flags|=1,kr(c,f,E,b),f.child)}function FE(c,f,v,E,b){if(c===null){var I=v.type;return typeof I=="function"&&!Nv(I)&&I.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(f.tag=15,f.type=I,zE(c,f,I,E,b)):(c=op(v.type,null,E,f,f.mode,b),c.ref=f.ref,c.return=f,f.child=c)}if(I=c.child,!(c.lanes&b)){var q=I.memoizedProps;if(v=v.compare,v=v!==null?v:xh,v(q,E)&&c.ref===f.ref)return Qo(c,f,b)}return f.flags|=1,c=Us(I,E),c.ref=f.ref,c.return=f,f.child=c}function zE(c,f,v,E,b){if(c!==null&&xh(c.memoizedProps,E)&&c.ref===f.ref)if(di=!1,(c.lanes&b)!==0)c.flags&131072&&(di=!0);else return f.lanes=c.lanes,Qo(c,f,b);return dv(c,f,v,E,b)}function BE(c,f,v){var E=f.pendingProps,b=E.children,I=c!==null?c.memoizedState:null;if(E.mode==="hidden")if(!(f.mode&1))f.memoizedState={baseLanes:0,cachePool:null},Xe(Kl,hi),hi|=v;else if(v&1073741824)f.memoizedState={baseLanes:0,cachePool:null},E=I!==null?I.baseLanes:v,Xe(Kl,hi),hi|=E;else return c=I!==null?I.baseLanes|v:v,f.lanes=f.childLanes=1073741824,f.memoizedState={baseLanes:c,cachePool:null},f.updateQueue=null,Xe(Kl,hi),hi|=c,null;else I!==null?(E=I.baseLanes|v,f.memoizedState=null):E=v,Xe(Kl,hi),hi|=E;return kr(c,f,b,v),f.child}function HE(c,f){var v=f.ref;(c===null&&v!==null||c!==null&&c.ref!==v)&&(f.flags|=512,f.flags|=2097152)}function dv(c,f,v,E,b){var I=xn(v)?nn:Et.current;return I=Nn(f,I),Wl(f,b),v=ov(c,f,v,E,I,b),E=sv(),c!==null&&!di?(f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~b,Qo(c,f,b)):(Sn&&E&&q0(f),f.flags|=1,kr(c,f,v,b),f.child)}function VE(c,f,v,E,b){if(xn(v)){var I=!0;Rt(f)}else I=!1;if(Wl(f,b),f.stateNode===null)c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),nE(f,v,E),Y0(f,v,E,b),E=!0;else if(c===null){var q=f.stateNode,le=f.memoizedProps;q.props=le;var _e=q.context,Ve=v.contextType;typeof Ve=="object"&&Ve!==null?Ve=Ci(Ve):(Ve=xn(v)?nn:Et.current,Ve=Nn(f,Ve));var st=v.getDerivedStateFromProps,Pt=typeof st=="function"||typeof q.getSnapshotBeforeUpdate=="function";Pt||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(le!==E||_e!==Ve)&&rE(f,q,E,Ve),Is=!1;var yt=f.memoizedState;q.state=yt,Mh(f,E,q,b),_e=f.memoizedState,le!==E||yt!==_e||Mt.current||Is?(typeof st=="function"&&(X0(f,v,st,E),_e=f.memoizedState),(le=Is||tE(f,v,le,E,yt,_e,Ve))?(Pt||typeof q.UNSAFE_componentWillMount!="function"&&typeof q.componentWillMount!="function"||(typeof q.componentWillMount=="function"&&q.componentWillMount(),typeof q.UNSAFE_componentWillMount=="function"&&q.UNSAFE_componentWillMount()),typeof q.componentDidMount=="function"&&(f.flags|=4194308)):(typeof q.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=E,f.memoizedState=_e),q.props=E,q.state=_e,q.context=Ve,E=le):(typeof q.componentDidMount=="function"&&(f.flags|=4194308),E=!1)}else{q=f.stateNode,Kw(c,f),le=f.memoizedProps,Ve=f.type===f.elementType?le:Zi(f.type,le),q.props=Ve,Pt=f.pendingProps,yt=q.context,_e=v.contextType,typeof _e=="object"&&_e!==null?_e=Ci(_e):(_e=xn(v)?nn:Et.current,_e=Nn(f,_e));var cn=v.getDerivedStateFromProps;(st=typeof cn=="function"||typeof q.getSnapshotBeforeUpdate=="function")||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(le!==Pt||yt!==_e)&&rE(f,q,E,_e),Is=!1,yt=f.memoizedState,q.state=yt,Mh(f,E,q,b);var pt=f.memoizedState;le!==Pt||yt!==pt||Mt.current||Is?(typeof cn=="function"&&(X0(f,v,cn,E),pt=f.memoizedState),(Ve=Is||tE(f,v,Ve,E,yt,pt,_e)||!1)?(st||typeof q.UNSAFE_componentWillUpdate!="function"&&typeof q.componentWillUpdate!="function"||(typeof q.componentWillUpdate=="function"&&q.componentWillUpdate(E,pt,_e),typeof q.UNSAFE_componentWillUpdate=="function"&&q.UNSAFE_componentWillUpdate(E,pt,_e)),typeof q.componentDidUpdate=="function"&&(f.flags|=4),typeof q.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof q.componentDidUpdate!="function"||le===c.memoizedProps&&yt===c.memoizedState||(f.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||le===c.memoizedProps&&yt===c.memoizedState||(f.flags|=1024),f.memoizedProps=E,f.memoizedState=pt),q.props=E,q.state=pt,q.context=_e,E=Ve):(typeof q.componentDidUpdate!="function"||le===c.memoizedProps&&yt===c.memoizedState||(f.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||le===c.memoizedProps&&yt===c.memoizedState||(f.flags|=1024),E=!1)}return hv(c,f,v,E,I,b)}function hv(c,f,v,E,b,I){HE(c,f);var q=(f.flags&128)!==0;if(!E&&!q)return b&&Wt(f,v,!1),Qo(c,f,I);E=f.stateNode,nO.current=f;var le=q&&typeof v.getDerivedStateFromError!="function"?null:E.render();return f.flags|=1,c!==null&&q?(f.child=Xl(f,c.child,null,I),f.child=Xl(f,null,le,I)):kr(c,f,le,I),f.memoizedState=E.state,b&&Wt(f,v,!0),f.child}function WE(c){var f=c.stateNode;f.pendingContext?Vt(c,f.pendingContext,f.pendingContext!==f.context):f.context&&Vt(c,f.context,!1),ev(c,f.containerInfo)}function GE(c,f,v,E,b){return jl(),Q0(b),f.flags|=256,kr(c,f,v,E),f.child}var zh={dehydrated:null,treeContext:null,retryLane:0};function Bh(c){return{baseLanes:c,cachePool:null}}function $E(c,f,v){var E=f.pendingProps,b=Tn.current,I=!1,q=(f.flags&128)!==0,le;if((le=q)||(le=c!==null&&c.memoizedState===null?!1:(b&2)!==0),le?(I=!0,f.flags&=-129):(c===null||c.memoizedState!==null)&&(b|=1),Xe(Tn,b&1),c===null)return J0(f),c=f.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?(f.mode&1?Ia(c)?f.lanes=8:f.lanes=1073741824:f.lanes=1,null):(b=E.children,c=E.fallback,I?(E=f.mode,I=f.child,b={mode:"hidden",children:b},!(E&1)&&I!==null?(I.childLanes=0,I.pendingProps=b):I=sp(b,E,0,null),c=Ha(c,E,v,null),I.return=f,c.return=f,I.sibling=c,f.child=I,f.child.memoizedState=Bh(v),f.memoizedState=zh,c):pv(f,b));if(b=c.memoizedState,b!==null){if(le=b.dehydrated,le!==null){if(q)return f.flags&256?(f.flags&=-257,Hh(c,f,v,Error(s(422)))):f.memoizedState!==null?(f.child=c.child,f.flags|=128,null):(I=E.fallback,b=f.mode,E=sp({mode:"visible",children:E.children},b,0,null),I=Ha(I,b,v,null),I.flags|=2,E.return=f,I.return=f,E.sibling=I,f.child=E,f.mode&1&&Xl(f,c.child,null,v),f.child.memoizedState=Bh(v),f.memoizedState=zh,I);if(!(f.mode&1))f=Hh(c,f,v,null);else if(Ia(le))f=Hh(c,f,v,Error(s(419)));else if(E=(v&c.childLanes)!==0,di||E){if(E=jn,E!==null){switch(v&-v){case 4:I=2;break;case 16:I=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:I=32;break;case 536870912:I=268435456;break;default:I=0}E=I&(E.suspendedLanes|v)?0:I,E!==0&&E!==b.retryLane&&(b.retryLane=E,Di(c,E,-1))}Ov(),f=Hh(c,f,v,Error(s(421)))}else xo(le)?(f.flags|=128,f.child=c.child,f=mO.bind(null,c),Ti(le,f),f=null):(v=b.treeContext,Le&&(fi=Hl(le),ui=f,Sn=!0,Ki=null,Ou=!1,v!==null&&(Ri[Pi++]=Zo,Ri[Pi++]=Ko,Ri[Pi++]=Da,Zo=v.id,Ko=v.overflow,Da=f)),f=pv(f,f.pendingProps.children),f.flags|=4096);return f}return I?(E=XE(c,f,E.children,E.fallback,v),I=f.child,b=c.child.memoizedState,I.memoizedState=b===null?Bh(v):{baseLanes:b.baseLanes|v,cachePool:null},I.childLanes=c.childLanes&~v,f.memoizedState=zh,E):(v=jE(c,f,E.children,v),f.memoizedState=null,v)}return I?(E=XE(c,f,E.children,E.fallback,v),I=f.child,b=c.child.memoizedState,I.memoizedState=b===null?Bh(v):{baseLanes:b.baseLanes|v,cachePool:null},I.childLanes=c.childLanes&~v,f.memoizedState=zh,E):(v=jE(c,f,E.children,v),f.memoizedState=null,v)}function pv(c,f){return f=sp({mode:"visible",children:f},c.mode,0,null),f.return=c,c.child=f}function jE(c,f,v,E){var b=c.child;return c=b.sibling,v=Us(b,{mode:"visible",children:v}),!(f.mode&1)&&(v.lanes=E),v.return=f,v.sibling=null,c!==null&&(E=f.deletions,E===null?(f.deletions=[c],f.flags|=16):E.push(c)),f.child=v}function XE(c,f,v,E,b){var I=f.mode;c=c.child;var q=c.sibling,le={mode:"hidden",children:v};return!(I&1)&&f.child!==c?(v=f.child,v.childLanes=0,v.pendingProps=le,f.deletions=null):(v=Us(c,le),v.subtreeFlags=c.subtreeFlags&14680064),q!==null?E=Us(q,E):(E=Ha(E,I,b,null),E.flags|=2),E.return=f,v.return=f,v.sibling=E,f.child=v,E}function Hh(c,f,v,E){return E!==null&&Q0(E),Xl(f,c.child,null,v),c=pv(f,f.pendingProps.children),c.flags|=2,f.memoizedState=null,c}function YE(c,f,v){c.lanes|=f;var E=c.alternate;E!==null&&(E.lanes|=f),$0(c.return,f,v)}function mv(c,f,v,E,b){var I=c.memoizedState;I===null?c.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:E,tail:v,tailMode:b}:(I.isBackwards=f,I.rendering=null,I.renderingStartTime=0,I.last=E,I.tail=v,I.tailMode=b)}function qE(c,f,v){var E=f.pendingProps,b=E.revealOrder,I=E.tail;if(kr(c,f,E.children,v),E=Tn.current,E&2)E=E&1|2,f.flags|=128;else{if(c!==null&&c.flags&128)e:for(c=f.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&YE(c,v,f);else if(c.tag===19)YE(c,v,f);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===f)break e;for(;c.sibling===null;){if(c.return===null||c.return===f)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}E&=1}if(Xe(Tn,E),!(f.mode&1))f.memoizedState=null;else switch(b){case"forwards":for(v=f.child,b=null;v!==null;)c=v.alternate,c!==null&&Rh(c)===null&&(b=v),v=v.sibling;v=b,v===null?(b=f.child,f.child=null):(b=v.sibling,v.sibling=null),mv(f,!1,b,v,I);break;case"backwards":for(v=null,b=f.child,f.child=null;b!==null;){if(c=b.alternate,c!==null&&Rh(c)===null){f.child=b;break}c=b.sibling,b.sibling=v,v=b,b=c}mv(f,!0,v,null,I);break;case"together":mv(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function Qo(c,f,v){if(c!==null&&(f.dependencies=c.dependencies),Jl|=f.lanes,!(v&f.childLanes))return null;if(c!==null&&f.child!==c.child)throw Error(s(153));if(f.child!==null){for(c=f.child,v=Us(c,c.pendingProps),f.child=v,v.return=f;c.sibling!==null;)c=c.sibling,v=v.sibling=Us(c,c.pendingProps),v.return=f;v.sibling=null}return f.child}function rO(c,f,v){switch(f.tag){case 3:WE(f),jl();break;case 5:fE(f);break;case 1:xn(f.type)&&Rt(f);break;case 4:ev(f,f.stateNode.containerInfo);break;case 10:Zw(f,f.type._context,f.memoizedProps.value);break;case 13:var E=f.memoizedState;if(E!==null)return E.dehydrated!==null?(Xe(Tn,Tn.current&1),f.flags|=128,null):v&f.child.childLanes?$E(c,f,v):(Xe(Tn,Tn.current&1),c=Qo(c,f,v),c!==null?c.sibling:null);Xe(Tn,Tn.current&1);break;case 19:if(E=(v&f.childLanes)!==0,c.flags&128){if(E)return qE(c,f,v);f.flags|=128}var b=f.memoizedState;if(b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),Xe(Tn,Tn.current),E)break;return null;case 22:case 23:return f.lanes=0,BE(c,f,v)}return Qo(c,f,v)}function iO(c,f){switch(Z0(f),f.tag){case 1:return xn(f.type)&&jt(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return ql(),rt(Mt),rt(Et),rv(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return tv(f),null;case 13:if(rt(Tn),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(s(340));jl()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return rt(Tn),null;case 4:return ql(),null;case 10:return G0(f.type._context),null;case 22:case 23:return Dv(),null;case 24:return null;default:return null}}var Vh=!1,ka=!1,oO=typeof WeakSet=="function"?WeakSet:Set,qe=null;function Wh(c,f){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(E){Jr(c,f,E)}else v.current=null}function gv(c,f,v){try{v()}catch(E){Jr(c,f,E)}}var ZE=!1;function sO(c,f){for($(c.containerInfo),qe=f;qe!==null;)if(c=qe,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,qe=f;else for(;qe!==null;){c=qe;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var E=v.memoizedProps,b=v.memoizedState,I=c.stateNode,q=I.getSnapshotBeforeUpdate(c.elementType===c.type?E:Zi(c.type,E),b);I.__reactInternalSnapshotBeforeUpdate=q}break;case 3:Qe&&Ge(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(le){Jr(c,c.return,le)}if(f=c.sibling,f!==null){f.return=c.return,qe=f;break}qe=c.return}return v=ZE,ZE=!1,v}function Ua(c,f,v){var E=f.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var b=E=E.next;do{if((b.tag&c)===c){var I=b.destroy;b.destroy=void 0,I!==void 0&&gv(f,v,I)}b=b.next}while(b!==E)}}function ju(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&c)===c){var E=v.create;v.destroy=E()}v=v.next}while(v!==f)}}function vv(c){var f=c.ref;if(f!==null){var v=c.stateNode;switch(c.tag){case 5:c=J(v);break;default:c=v}typeof f=="function"?f(c):f.current=c}}function KE(c,f,v){if(wo&&typeof wo.onCommitFiberUnmount=="function")try{wo.onCommitFiberUnmount(yh,f)}catch{}switch(f.tag){case 0:case 11:case 14:case 15:if(c=f.updateQueue,c!==null&&(c=c.lastEffect,c!==null)){var E=c=c.next;do{var b=E,I=b.destroy;b=b.tag,I!==void 0&&(b&2||b&4)&&gv(f,v,I),E=E.next}while(E!==c)}break;case 1:if(Wh(f,v),c=f.stateNode,typeof c.componentWillUnmount=="function")try{c.props=f.memoizedProps,c.state=f.memoizedState,c.componentWillUnmount()}catch(q){Jr(f,v,q)}break;case 5:Wh(f,v);break;case 4:Qe?rM(c,f,v):Q&&Q&&(f=f.stateNode.containerInfo,v=Me(f),Ot(f,v))}}function JE(c,f,v){for(var E=f;;)if(KE(c,E,v),E.child===null||Qe&&E.tag===4){if(E===f)break;for(;E.sibling===null;){if(E.return===null||E.return===f)return;E=E.return}E.sibling.return=E.return,E=E.sibling}else E.child.return=E,E=E.child}function QE(c){var f=c.alternate;f!==null&&(c.alternate=null,QE(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&<(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function eM(c){return c.tag===5||c.tag===3||c.tag===4}function tM(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||eM(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function nM(c){if(Qe){e:{for(var f=c.return;f!==null;){if(eM(f))break e;f=f.return}throw Error(s(160))}var v=f;switch(v.tag){case 5:f=v.stateNode,v.flags&32&&(he(f),v.flags&=-33),v=tM(c),_v(c,v,f);break;case 3:case 4:f=v.stateNode.containerInfo,v=tM(c),yv(c,v,f);break;default:throw Error(s(161))}}}function yv(c,f,v){var E=c.tag;if(E===5||E===6)c=c.stateNode,f?Pe(v,c,f):Ze(v,c);else if(E!==4&&(c=c.child,c!==null))for(yv(c,f,v),c=c.sibling;c!==null;)yv(c,f,v),c=c.sibling}function _v(c,f,v){var E=c.tag;if(E===5||E===6)c=c.stateNode,f?bt(v,c,f):Ne(v,c);else if(E!==4&&(c=c.child,c!==null))for(_v(c,f,v),c=c.sibling;c!==null;)_v(c,f,v),c=c.sibling}function rM(c,f,v){for(var E=f,b=!1,I,q;;){if(!b){b=E.return;e:for(;;){if(b===null)throw Error(s(160));switch(I=b.stateNode,b.tag){case 5:q=!1;break e;case 3:I=I.containerInfo,q=!0;break e;case 4:I=I.containerInfo,q=!0;break e}b=b.return}b=!0}if(E.tag===5||E.tag===6)JE(c,E,v),q?re(I,E.stateNode):Dt(I,E.stateNode);else if(E.tag===18)q?ee(I,E.stateNode):ne(I,E.stateNode);else if(E.tag===4){if(E.child!==null){I=E.stateNode.containerInfo,q=!0,E.child.return=E,E=E.child;continue}}else if(KE(c,E,v),E.child!==null){E.child.return=E,E=E.child;continue}if(E===f)break;for(;E.sibling===null;){if(E.return===null||E.return===f)return;E=E.return,E.tag===4&&(b=!1)}E.sibling.return=E.return,E=E.sibling}}function xv(c,f){if(Qe){switch(f.tag){case 0:case 11:case 14:case 15:Ua(3,f,f.return),ju(3,f),Ua(5,f,f.return);return;case 1:return;case 5:var v=f.stateNode;if(v!=null){var E=f.memoizedProps;c=c!==null?c.memoizedProps:E;var b=f.type,I=f.updateQueue;f.updateQueue=null,I!==null&>(v,I,b,c,E,f)}return;case 6:if(f.stateNode===null)throw Error(s(162));v=f.memoizedProps,Be(f.stateNode,c!==null?c.memoizedProps:v,v);return;case 3:Le&&c!==null&&c.memoizedState.isDehydrated&&W(f.stateNode.containerInfo);return;case 12:return;case 13:Gh(f);return;case 19:Gh(f);return;case 17:return}throw Error(s(163))}switch(f.tag){case 0:case 11:case 14:case 15:Ua(3,f,f.return),ju(3,f),Ua(5,f,f.return);return;case 12:return;case 13:Gh(f);return;case 19:Gh(f);return;case 3:Le&&c!==null&&c.memoizedState.isDehydrated&&W(f.stateNode.containerInfo);break;case 22:case 23:return}e:if(Q){switch(f.tag){case 1:case 5:case 6:break e;case 3:case 4:f=f.stateNode,Ot(f.containerInfo,f.pendingChildren);break e}throw Error(s(163))}}function Gh(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new oO),f.forEach(function(E){var b=gO.bind(null,c,E);v.has(E)||(v.add(E),E.then(b,b))})}}function aO(c,f){for(qe=f;qe!==null;){f=qe;var v=f.deletions;if(v!==null)for(var E=0;E";case jh:return":has("+(Ev(c)||"")+")";case Xh:return'[role="'+c.value+'"]';case qh:return'"'+c.value+'"';case Yh:return'[data-testname="'+c.value+'"]';default:throw Error(s(365))}}function lM(c,f){var v=[];c=[c,0];for(var E=0;Eb&&(b=q),E&=~I}if(E=b,E=rr()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*cO(E/1960))-E,10c?16:c,Os===null)var E=!1;else{if(c=Os,Os=null,ep=0,Ht&6)throw Error(s(331));var b=Ht;for(Ht|=4,qe=c.current;qe!==null;){var I=qe,q=I.child;if(qe.flags&16){var le=I.deletions;if(le!==null){for(var _e=0;_err()-Av?Fa(c,0):Tv|=v),Kr(c,f)}function vM(c,f){f===0&&(c.mode&1?(f=gh,gh<<=1,!(gh&130023424)&&(gh=4194304)):f=1);var v=Ur();c=rp(c,f),c!==null&&(Du(c,f,v),Kr(c,v))}function mO(c){var f=c.memoizedState,v=0;f!==null&&(v=f.retryLane),vM(c,v)}function gO(c,f){var v=0;switch(c.tag){case 13:var E=c.stateNode,b=c.memoizedState;b!==null&&(v=b.retryLane);break;case 19:E=c.stateNode;break;default:throw Error(s(314))}E!==null&&E.delete(f),vM(c,v)}var yM;yM=function(c,f,v){if(c!==null)if(c.memoizedProps!==f.pendingProps||Mt.current)di=!0;else{if(!(c.lanes&v)&&!(f.flags&128))return di=!1,rO(c,f,v);di=!!(c.flags&131072)}else di=!1,Sn&&f.flags&1048576&&iE(f,Ah,f.index);switch(f.lanes=0,f.tag){case 2:var E=f.type;c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),c=f.pendingProps;var b=Nn(f,Et.current);Wl(f,v),b=ov(null,f,E,c,b,v);var I=sv();return f.flags|=1,typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,xn(E)?(I=!0,Rt(f)):I=!1,f.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,j0(f),b.updater=bh,f.stateNode=b,b._reactInternals=f,Y0(f,E,c,v),f=hv(null,f,E,!0,I,v)):(f.tag=0,Sn&&I&&q0(f),kr(null,f,b,v),f=f.child),f;case 16:E=f.elementType;e:{switch(c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),c=f.pendingProps,b=E._init,E=b(E._payload),f.type=E,b=f.tag=yO(E),c=Zi(E,c),b){case 0:f=dv(null,f,E,c,v);break e;case 1:f=VE(null,f,E,c,v);break e;case 11:f=UE(null,f,E,c,v);break e;case 14:f=FE(null,f,E,Zi(E.type,c),v);break e}throw Error(s(306,E,""))}return f;case 0:return E=f.type,b=f.pendingProps,b=f.elementType===E?b:Zi(E,b),dv(c,f,E,b,v);case 1:return E=f.type,b=f.pendingProps,b=f.elementType===E?b:Zi(E,b),VE(c,f,E,b,v);case 3:e:{if(WE(f),c===null)throw Error(s(387));E=f.pendingProps,I=f.memoizedState,b=I.element,Kw(c,f),Mh(f,E,null,v);var q=f.memoizedState;if(E=q.element,Le&&I.isDehydrated)if(I={element:E,isDehydrated:!1,cache:q.cache,transitions:q.transitions},f.updateQueue.baseState=I,f.memoizedState=I,f.flags&256){b=Error(s(423)),f=GE(c,f,E,v,b);break e}else if(E!==b){b=Error(s(424)),f=GE(c,f,E,v,b);break e}else for(Le&&(fi=La(f.stateNode.containerInfo),ui=f,Sn=!0,Ki=null,Ou=!1),v=uE(f,null,E,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(jl(),E===b){f=Qo(c,f,v);break e}kr(c,f,E,v)}f=f.child}return f;case 5:return fE(f),c===null&&J0(f),E=f.type,b=f.pendingProps,I=c!==null?c.memoizedProps:null,q=b.children,Ee(E,b)?q=null:I!==null&&Ee(E,I)&&(f.flags|=32),HE(c,f),kr(c,f,q,v),f.child;case 6:return c===null&&J0(f),null;case 13:return $E(c,f,v);case 4:return ev(f,f.stateNode.containerInfo),E=f.pendingProps,c===null?f.child=Xl(f,null,E,v):kr(c,f,E,v),f.child;case 11:return E=f.type,b=f.pendingProps,b=f.elementType===E?b:Zi(E,b),UE(c,f,E,b,v);case 7:return kr(c,f,f.pendingProps,v),f.child;case 8:return kr(c,f,f.pendingProps.children,v),f.child;case 12:return kr(c,f,f.pendingProps.children,v),f.child;case 10:e:{if(E=f.type._context,b=f.pendingProps,I=f.memoizedProps,q=b.value,Zw(f,E,q),I!==null)if(Eo(I.value,q)){if(I.children===b.children&&!Mt.current){f=Qo(c,f,v);break e}}else for(I=f.child,I!==null&&(I.return=f);I!==null;){var le=I.dependencies;if(le!==null){q=I.child;for(var _e=le.firstContext;_e!==null;){if(_e.context===E){if(I.tag===1){_e=qo(-1,v&-v),_e.tag=2;var Ve=I.updateQueue;if(Ve!==null){Ve=Ve.shared;var st=Ve.pending;st===null?_e.next=_e:(_e.next=st.next,st.next=_e),Ve.pending=_e}}I.lanes|=v,_e=I.alternate,_e!==null&&(_e.lanes|=v),$0(I.return,v,f),le.lanes|=v;break}_e=_e.next}}else if(I.tag===10)q=I.type===f.type?null:I.child;else if(I.tag===18){if(q=I.return,q===null)throw Error(s(341));q.lanes|=v,le=q.alternate,le!==null&&(le.lanes|=v),$0(q,v,f),q=I.sibling}else q=I.child;if(q!==null)q.return=I;else for(q=I;q!==null;){if(q===f){q=null;break}if(I=q.sibling,I!==null){I.return=q.return,q=I;break}q=q.return}I=q}kr(c,f,b.children,v),f=f.child}return f;case 9:return b=f.type,E=f.pendingProps.children,Wl(f,v),b=Ci(b),E=E(b),f.flags|=1,kr(c,f,E,v),f.child;case 14:return E=f.type,b=Zi(E,f.pendingProps),b=Zi(E.type,b),FE(c,f,E,b,v);case 15:return zE(c,f,f.type,f.pendingProps,v);case 17:return E=f.type,b=f.pendingProps,b=f.elementType===E?b:Zi(E,b),c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),f.tag=1,xn(E)?(c=!0,Rt(f)):c=!1,Wl(f,v),nE(f,E,b),Y0(f,E,b,v),hv(null,f,E,!0,c,v);case 19:return qE(c,f,v);case 22:return BE(c,f,v)}throw Error(s(156,f.tag))};function _M(c,f){return F0(c,f)}function vO(c,f,v,E){this.tag=c,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Oi(c,f,v,E){return new vO(c,f,v,E)}function Nv(c){return c=c.prototype,!(!c||!c.isReactComponent)}function yO(c){if(typeof c=="function")return Nv(c)?1:0;if(c!=null){if(c=c.$$typeof,c===w)return 11;if(c===_)return 14}return 2}function Us(c,f){var v=c.alternate;return v===null?(v=Oi(c.tag,f,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=f,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,f=c.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function op(c,f,v,E,b,I){var q=2;if(E=c,typeof c=="function")Nv(c)&&(q=1);else if(typeof c=="string")q=5;else e:switch(c){case d:return Ha(v.children,b,I,f);case h:q=8,b|=8;break;case p:return c=Oi(12,v,f,b|2),c.elementType=p,c.lanes=I,c;case x:return c=Oi(13,v,f,b),c.elementType=x,c.lanes=I,c;case m:return c=Oi(19,v,f,b),c.elementType=m,c.lanes=I,c;case M:return sp(v,b,I,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case g:q=10;break e;case y:q=9;break e;case w:q=11;break e;case _:q=14;break e;case S:q=16,E=null;break e}throw Error(s(130,c==null?c:typeof c,""))}return f=Oi(q,v,f,b),f.elementType=c,f.type=E,f.lanes=I,f}function Ha(c,f,v,E){return c=Oi(7,c,E,f),c.lanes=v,c}function sp(c,f,v,E){return c=Oi(22,c,E,f),c.elementType=M,c.lanes=v,c.stateNode={},c}function kv(c,f,v){return c=Oi(6,c,null,f),c.lanes=v,c}function Uv(c,f,v){return f=Oi(4,c.children!==null?c.children:[],c.key,f),f.lanes=v,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function _O(c,f,v,E,b){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ft,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=k0(0),this.expirationTimes=k0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=k0(0),this.identifierPrefix=E,this.onRecoverableError=b,Le&&(this.mutableSourceEagerHydrationData=null)}function xM(c,f,v,E,b,I,q,le,_e){return c=new _O(c,f,v,le,_e),f===1?(f=1,I===!0&&(f|=8)):f=0,I=Oi(3,null,null,f),c.current=I,I.stateNode=c,I.memoizedState={element:E,isDehydrated:v,cache:null,transitions:null},j0(I),c}function SM(c){if(!c)return Bt;c=c._reactInternals;e:{if(C(c)!==c||c.tag!==1)throw Error(s(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(xn(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(s(171))}if(c.tag===1){var v=c.type;if(xn(v))return bn(c,v,f)}return f}function wM(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(s(188)):(c=Object.keys(c).join(","),Error(s(268,c)));return c=X(f),c===null?null:c.stateNode}function EM(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v=Ve&&I>=Pt&&b<=st&&q<=yt){c.splice(f,1);break}else if(E!==Ve||v.width!==_e.width||ytq){if(!(I!==Pt||v.height!==_e.height||stb)){Ve>E&&(_e.width+=Ve-E,_e.x=E),stI&&(_e.height+=Pt-I,_e.y=I),ytv&&(v=q)),q ")+` No matching component was found for: `)+c.join(" > ")}return null},n.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return J(c.child.stateNode);default:return c.child.stateNode}},n.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:xO,findFiberByHostInstance:c.findFiberByHostInstance||SO,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{yh=f.inject(c),wo=f}catch{}c=!!f.checkDCE}}return c},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(c,f,v,E){if(!dt)throw Error(s(363));c=Mv(c,f);var b=Re(c,v,E).disconnect;return{disconnect:function(){b()}}},n.registerMutableSourceForHydration=function(c,f){var v=f._getVersion;v=v(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,v]:c.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(c,f){var v=Zt;try{return Zt=c,f()}finally{Zt=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(c,f,v,E){var b=f.current,I=Ur(),q=Ns(b);return v=SM(v),f.context===null?f.context=v:f.pendingContext=v,f=qo(I,q),f.payload={element:c},E=E===void 0?null:E,E!==null&&(f.callback=E),Ls(b,f),c=Di(b,q,I),c!==null&&Eh(c,b,q),q},n};vI.exports=P6;var I6=vI.exports;const L6=mu(I6);var yI={exports:{}},_I={};/** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */(function(t){function e(F,$){var j=F.length;F.push($);e:for(;0>>1,Z=F[H];if(0>>1;Hi(Ee,j))Sei(We,Ee)?(F[H]=We,F[Se]=j,H=Se):(F[H]=Ee,F[xe]=j,H=xe);else if(Sei(We,j))F[H]=We,F[Se]=j,H=Se;else break e}}return $}function i(F,$){var j=F.sortIndex-$.sortIndex;return j!==0?j:F.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var l=[],u=[],d=1,h=null,p=3,g=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(F){for(var $=n(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=F)r(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=n(u)}}function M(F){if(w=!1,S(F),!y)if(n(l)!==null)y=!0,J(T);else{var $=n(u);$!==null&&se(M,$.startTime-F)}}function T(F,$){y=!1,w&&(w=!1,m(O),O=-1),g=!0;var j=p;try{for(S($),h=n(l);h!==null&&(!(h.expirationTime>$)||F&&!k());){var H=h.callback;if(typeof H=="function"){h.callback=null,p=h.priorityLevel;var Z=H(h.expirationTime<=$);$=t.unstable_now(),typeof Z=="function"?h.callback=Z:h===n(l)&&r(l),S($)}else r(l);h=n(l)}if(h!==null)var ge=!0;else{var xe=n(u);xe!==null&&se(M,xe.startTime-$),ge=!1}return ge}finally{h=null,p=j,g=!1}}var A=!1,R=null,O=-1,C=5,P=-1;function k(){return!(t.unstable_now()-PF||125H?(F.sortIndex=j,e(u,F),n(l)===null&&F===n(u)&&(w?(m(O),O=-1):w=!0,se(M,j-H))):(F.sortIndex=Z,e(l,F),y||g||(y=!0,J(T))),F},t.unstable_shouldYield=k,t.unstable_wrapCallback=function(F){var $=p;return function(){var j=p;p=$;try{return F.apply(this,arguments)}finally{p=j}}}})(_I);yI.exports=_I;var cA=yI.exports;const D6=t=>typeof t=="object"&&typeof t.then=="function",dl=[];function xI(t,e,n=(r,i)=>r===i){if(t===e)return!0;if(!t||!e)return!1;const r=t.length;if(e.length!==r)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,r.lifespan)),o.response;if(!n)throw o.promise}const i={keys:e,equal:r.equal,remove:()=>{const o=dl.indexOf(i);o!==-1&&dl.splice(o,1)},promise:(D6(t)?t:t(...e)).then(o=>{i.response=o,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(o=>i.error=o)};if(dl.push(i),!n)throw i.promise}const O6=(t,e,n)=>SI(t,e,!1,n),N6=(t,e,n)=>void SI(t,e,!0,n),k6=t=>{if(t===void 0||t.length===0)dl.splice(0,dl.length);else{const e=dl.find(n=>xI(t,n.keys,n.equal));e&&e.remove()}},vw={},rh=t=>void Object.assign(vw,t);function U6(t,e){function n(d,{args:h=[],attach:p,...g},y){let w=`${d[0].toUpperCase()}${d.slice(1)}`,x;if(d==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const m=g.object;x=Tc(m,{type:d,root:y,attach:p,primitive:!0})}else{const m=vw[w];if(!m)throw new Error(`R3F: ${w} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");x=Tc(new m(...h),{type:d,root:y,attach:p,memoizedProps:{args:h}})}return x.__r3f.attach===void 0&&(x instanceof zt?x.__r3f.attach="geometry":x instanceof vr&&(x.__r3f.attach="material")),w!=="inject"&&Zy(x,g),x}function r(d,h){let p=!1;if(h){var g,y;(g=h.__r3f)!=null&&g.attach?qy(d,h,h.__r3f.attach):h.isObject3D&&d.isObject3D&&(d.add(h),p=!0),p||(y=d.__r3f)==null||y.objects.push(h),h.__r3f||Tc(h,{}),h.__r3f.parent=d,Qx(h),Ac(h)}}function i(d,h,p){let g=!1;if(h){var y,w;if((y=h.__r3f)!=null&&y.attach)qy(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){h.parent=d,h.dispatchEvent({type:"added"});const x=d.children.filter(_=>_!==h),m=x.indexOf(p);d.children=[...x.slice(0,m),h,...x.slice(m)],g=!0}g||(w=d.__r3f)==null||w.objects.push(h),h.__r3f||Tc(h,{}),h.__r3f.parent=d,Qx(h),Ac(h)}}function o(d,h,p=!1){d&&[...d].forEach(g=>s(h,g,p))}function s(d,h,p){if(h){var g,y,w;if(h.__r3f&&(h.__r3f.parent=null),(g=d.__r3f)!=null&&g.objects&&(d.__r3f.objects=d.__r3f.objects.filter(M=>M!==h)),(y=h.__r3f)!=null&&y.attach)pA(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){var x;d.remove(h),(x=h.__r3f)!=null&&x.root&&$6(h.__r3f.root,h)}const _=(w=h.__r3f)==null?void 0:w.primitive,S=!_&&(p===void 0?h.dispose!==null:p);if(!_){var m;o((m=h.__r3f)==null?void 0:m.objects,h,S),o(h.children,h,S)}if(delete h.__r3f,S&&h.dispose&&h.type!=="Scene"){const M=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?cA.unstable_scheduleCallback(cA.unstable_IdlePriority,M):M()}Ac(d)}}function a(d,h,p,g){var y;const w=(y=d.__r3f)==null?void 0:y.parent;if(!w)return;const x=n(h,p,d.__r3f.root);if(d.children){for(const m of d.children)m.__r3f&&r(x,m);d.children=d.children.filter(m=>!m.__r3f)}d.__r3f.objects.forEach(m=>r(x,m)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||s(w,d),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),r(w,x),x.raycast&&x.__r3f.eventCount&&x.__r3f.root.getState().internal.interaction.push(x),[g,g.alternate].forEach(m=>{m!==null&&(m.stateNode=x,m.ref&&(typeof m.ref=="function"?m.ref(x):m.ref.current=x))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:L6({createInstance:n,removeChild:s,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,h)=>{if(!h)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,r(p,h))},removeChildFromContainer:(d,h)=>{h&&s(d.getState().scene,h)},insertInContainerBefore:(d,h,p)=>{if(!h||!p)return;const g=d.getState().scene;g.__r3f&&i(g,h,p)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var h;return!!((h=d==null?void 0:d.__r3f)!=null?h:{}).handlers},prepareUpdate(d,h,p,g){var y;if(((y=d==null?void 0:d.__r3f)!=null?y:{}).primitive&&g.object&&g.object!==d)return[!0];{const{args:x=[],children:m,..._}=g,{args:S=[],children:M,...T}=p;if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((R,O)=>R!==S[O]))return[!0];const A=CI(d,_,T,!0);return A.changes.length?[!1,A]:null}},commitUpdate(d,[h,p],g,y,w,x){h?a(d,g,w,x):Zy(d,p)},commitMount(d,h,p,g){var y;const w=(y=d.__r3f)!=null?y:{};d.raycast&&w.handlers&&w.eventCount&&d.__r3f.root.getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Tc(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var h;const{attach:p,parent:g}=(h=d.__r3f)!=null?h:{};p&&g&&pA(g,d,p),d.isObject3D&&(d.visible=!1),Ac(d)},unhideInstance(d,h){var p;const{attach:g,parent:y}=(p=d.__r3f)!=null?p:{};g&&y&&qy(y,d,g),(d.isObject3D&&h.visible==null||h.visible)&&(d.visible=!0),Ac(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Gc.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&gn.fun(performance.now)?performance.now:gn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:gn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:gn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Zy}}var uA,fA;const Yy=t=>"colorSpace"in t||"outputColorSpace"in t,wI=()=>{var t;return(t=vw.ColorManagement)!=null?t:null},EI=t=>t&&t.isOrthographicCamera,F6=t=>t&&t.hasOwnProperty("current"),ih=typeof window<"u"&&((uA=window.document)!=null&&uA.createElement||((fA=window.navigator)==null?void 0:fA.product)==="ReactNative")?L.useLayoutEffect:L.useEffect;function MI(t){const e=L.useRef(t);return ih(()=>void(e.current=t),[t]),e}function z6({set:t}){return ih(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class bI extends L.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}bI.getDerivedStateFromError=()=>({error:!0});const TI="__default",dA=new Map,B6=t=>t&&!!t.memoized&&!!t.changes;function AI(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const gf=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()},gn={obj:t=>t===Object(t)&&!gn.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(gn.str(t)||gn.num(t))return t===e;const o=gn.obj(t);if(o&&r==="reference")return t===e;const s=gn.arr(t);if(s&&n==="reference")return t===e;if((s||o)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(o&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!gn.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(gn.und(a)){if(s&&t.length===0&&e.length===0||o&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function H6(t){const e={nodes:{},materials:{}};return t&&t.traverse(n=>{n.name&&(e.nodes[n.name]=n),n.material&&!e.materials[n.material.name]&&(e.materials[n.material.name]=n.material)}),e}function V6(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Tc(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function Jx(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((o,s)=>o[s],t),{target:n,key:i}}else return{target:n,key:e}}const hA=/-\d+$/;function qy(t,e,n){if(gn.str(n)){if(hA.test(n)){const o=n.replace(hA,""),{target:s,key:a}=Jx(t,o);Array.isArray(s[a])||(s[a]=[])}const{target:r,key:i}=Jx(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function pA(t,e,n){var r,i;if(gn.str(n)){const{target:o,key:s}=Jx(t,n),a=e.__r3f.previousAttach;a===void 0?delete o[s]:o[s]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function CI(t,{children:e,key:n,ref:r,...i},{children:o,key:s,ref:a,...l}={},u=!1){var d;const h=(d=t==null?void 0:t.__r3f)!=null?d:{},p=Object.entries(i),g=[];if(u){const w=Object.keys(l);for(let x=0;x{var m;if((m=t.__r3f)!=null&&m.primitive&&w==="object"||gn.equ(x,l[w]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(w))return g.push([w,x,!0,[]]);let _=[];w.includes("-")&&(_=w.split("-")),g.push([w,x,!1,_]);for(const S in i){const M=i[S];S.startsWith(`${w}-`)&&g.push([S,M,!1,S.split("-")])}});const y={...i};return h.memoizedProps&&h.memoizedProps.args&&(y.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(y.attach=h.memoizedProps.attach),{memoized:y,changes:g}}const W6=typeof process<"u"&&!1;function Zy(t,e){var n,r,i;const o=(n=t.__r3f)!=null?n:{},s=o.root,a=(r=s==null||s.getState==null?void 0:s.getState())!=null?r:{},{memoized:l,changes:u}=B6(e)?e:CI(t,e),d=o.eventCount;t.__r3f&&(t.__r3f.memoizedProps=l);for(let p=0;pS[M],t),!(_&&_.set))){const[S,...M]=x.reverse();m=M.reverse().reduce((T,A)=>T[A],t),g=S}if(y===TI+"remove")if(m.constructor){let S=dA.get(m.constructor);S||(S=new m.constructor,dA.set(m.constructor,S)),y=S[g]}else y=0;if(w)y?o.handlers[g]=y:delete o.handlers[g],o.eventCount=Object.keys(o.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof yl)){if(Array.isArray(y))_.fromArray?_.fromArray(y):_.set(...y);else if(_.copy&&y&&y.constructor&&(W6?_.constructor.name===y.constructor.name:_.constructor===y.constructor))_.copy(y);else if(y!==void 0){const S=_ instanceof tt;!S&&_.setScalar?_.setScalar(y):_ instanceof yl&&y instanceof yl?_.mask=y.mask:_.set(y),!wI()&&!a.linear&&S&&_.convertSRGBToLinear()}}else if(m[g]=y,m[g]instanceof Dn&&m[g].format===Rr&&m[g].type===Fo){const S=m[g];Yy(S)&&Yy(a.gl)?S.colorSpace=a.gl.outputColorSpace:S.encoding=a.gl.outputEncoding}Ac(t)}if(o.parent&&a.internal&&t.raycast&&d!==o.eventCount){const p=a.internal.interaction.indexOf(t);p>-1&&a.internal.interaction.splice(p,1),o.eventCount&&a.internal.interaction.push(t)}return!(u.length===1&&u[0][0]==="onUpdate")&&u.length&&(i=t.__r3f)!=null&&i.parent&&Qx(t),t}function Ac(t){var e,n;const r=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();r&&r.internal.frames===0&&r.invalidate()}function Qx(t){t.onUpdate==null||t.onUpdate(t)}function RI(t,e){t.manual||(EI(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function pm(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function G6(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Gc.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Gc.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Gc.ContinuousEventPriority;default:return Gc.DefaultEventPriority}}function PI(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function $6(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{PI(n.capturedMap,e,r,i)})}function j6(t){function e(l){const{internal:u}=t.getState(),d=l.offsetX-u.initialClick[0],h=l.offsetY-u.initialClick[1];return Math.round(Math.sqrt(d*d+h*h))}function n(l){return l.filter(u=>["Move","Over","Enter","Out","Leave"].some(d=>{var h;return(h=u.__r3f)==null?void 0:h.handlers["onPointer"+d]}))}function r(l,u){const d=t.getState(),h=new Set,p=[],g=u?u(d.internal.interaction):d.internal.interaction;for(let m=0;m{const S=gf(m.object),M=gf(_.object);return!S||!M?m.distance-_.distance:M.events.priority-S.events.priority||m.distance-_.distance}).filter(m=>{const _=pm(m);return h.has(_)?!1:(h.add(_),!0)});d.events.filter&&(w=d.events.filter(w,d));for(const m of w){let _=m.object;for(;_;){var x;(x=_.__r3f)!=null&&x.eventCount&&p.push({...m,eventObject:_}),_=_.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let m of d.internal.capturedMap.get(l.pointerId).values())h.has(pm(m.intersection))||p.push(m.intersection);return p}function i(l,u,d,h){const p=t.getState();if(l.length){const g={stopped:!1};for(const y of l){const w=gf(y.object)||p,{raycaster:x,pointer:m,camera:_,internal:S}=w,M=new G(m.x,m.y,0).unproject(_),T=P=>{var k,X;return(k=(X=S.capturedMap.get(P))==null?void 0:X.has(y.eventObject))!=null?k:!1},A=P=>{const k={intersection:y,target:u.target};S.capturedMap.has(P)?S.capturedMap.get(P).set(y.eventObject,k):S.capturedMap.set(P,new Map([[y.eventObject,k]])),u.target.setPointerCapture(P)},R=P=>{const k=S.capturedMap.get(P);k&&PI(S.capturedMap,y.eventObject,k,P)};let O={};for(let P in u){let k=u[P];typeof k!="function"&&(O[P]=k)}let C={...y,...O,pointer:m,intersections:l,stopped:g.stopped,delta:d,unprojectedPoint:M,ray:x.ray,camera:_,stopPropagation(){const P="pointerId"in u&&S.capturedMap.get(u.pointerId);if((!P||P.has(y.eventObject))&&(C.stopped=g.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(k=>k.eventObject===y.eventObject))){const k=l.slice(0,l.indexOf(y));o([...k,y])}},target:{hasPointerCapture:T,setPointerCapture:A,releasePointerCapture:R},currentTarget:{hasPointerCapture:T,setPointerCapture:A,releasePointerCapture:R},nativeEvent:u};if(h(C),g.stopped===!0)break}}return l}function o(l){const{internal:u}=t.getState();for(const d of u.hovered.values())if(!l.length||!l.find(h=>h.object===d.object&&h.index===d.index&&h.instanceId===d.instanceId)){const p=d.eventObject.__r3f,g=p==null?void 0:p.handlers;if(u.hovered.delete(pm(d)),p!=null&&p.eventCount){const y={...d,intersections:l};g.onPointerOut==null||g.onPointerOut(y),g.onPointerLeave==null||g.onPointerLeave(y)}}}function s(l,u){for(let d=0;do([]);case"onLostPointerCapture":return u=>{const{internal:d}=t.getState();"pointerId"in u&&d.capturedMap.has(u.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(u.pointerId)&&(d.capturedMap.delete(u.pointerId),o([]))})}}return function(d){const{onPointerMissed:h,internal:p}=t.getState();p.lastEvent.current=d;const g=l==="onPointerMove",y=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",x=r(d,g?n:void 0),m=y?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=x.map(S=>S.eventObject)),y&&!x.length&&m<=2&&(s(d,p.interaction),h&&h(d)),g&&o(x);function _(S){const M=S.eventObject,T=M.__r3f,A=T==null?void 0:T.handlers;if(T!=null&&T.eventCount)if(g){if(A.onPointerOver||A.onPointerEnter||A.onPointerOut||A.onPointerLeave){const R=pm(S),O=p.hovered.get(R);O?O.stopped&&S.stopPropagation():(p.hovered.set(R,S),A.onPointerOver==null||A.onPointerOver(S),A.onPointerEnter==null||A.onPointerEnter(S))}A.onPointerMove==null||A.onPointerMove(S)}else{const R=A[l];R?(!y||p.initialHits.includes(M))&&(s(d,p.interaction.filter(O=>!p.initialHits.includes(O))),R(S)):y&&p.initialHits.includes(M)&&s(d,p.interaction.filter(O=>!p.initialHits.includes(O)))}}i(x,d,m,_)}}return{handlePointer:a}}const X6=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],II=t=>!!(t!=null&&t.render),yw=L.createContext(null),Y6=(t,e)=>{const n=gw((a,l)=>{const u=new G,d=new G,h=new G;function p(m=l().camera,_=d,S=l().size){const{width:M,height:T,top:A,left:R}=S,O=M/T;_ instanceof G?h.copy(_):h.set(..._);const C=m.getWorldPosition(u).distanceTo(h);if(EI(m))return{width:M/m.zoom,height:T/m.zoom,top:A,left:R,factor:1,distance:C,aspect:O};{const P=m.fov*Math.PI/180,k=2*Math.tan(P/2)*C,X=k*(M/T);return{width:X,height:k,top:A,left:R,factor:M/X,distance:C,aspect:O}}}let g;const y=m=>a(_=>({performance:{..._.performance,current:m}})),w=new Te;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(m=1)=>t(l(),m),advance:(m,_)=>e(m,_,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new fw,pointer:w,mouse:w,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const m=l();g&&clearTimeout(g),m.performance.current!==m.performance.min&&y(m.performance.min),g=setTimeout(()=>y(l().performance.max),m.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:m=>a(_=>({..._,events:{..._.events,...m}})),setSize:(m,_,S,M,T)=>{const A=l().camera,R={width:m,height:_,top:M||0,left:T||0,updateStyle:S};a(O=>({size:R,viewport:{...O.viewport,...p(A,d,R)}}))},setDpr:m=>a(_=>{const S=AI(m);return{viewport:{..._.viewport,dpr:S,initialDpr:_.viewport.initialDpr||S}}}),setFrameloop:(m="always")=>{const _=l().clock;_.stop(),_.elapsedTime=0,m!=="never"&&(_.start(),_.elapsedTime=0),a(()=>({frameloop:m}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:L.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(m,_,S)=>{const M=l().internal;return M.priority=M.priority+(_>0?1:0),M.subscribers.push({ref:m,priority:_,store:S}),M.subscribers=M.subscribers.sort((T,A)=>T.priority-A.priority),()=>{const T=l().internal;T!=null&&T.subscribers&&(T.priority=T.priority-(_>0?1:0),T.subscribers=T.subscribers.filter(A=>A.ref!==m))}}}}}),r=n.getState();let i=r.size,o=r.viewport.dpr,s=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:u,gl:d,set:h}=n.getState();if(l.width!==i.width||l.height!==i.height||u.dpr!==o){var p;i=l,o=u.dpr,RI(a,l),d.setPixelRatio(u.dpr);const g=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,g)}a!==s&&(s=a,h(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let mm,q6=new Set,Z6=new Set,K6=new Set;function Ky(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function vf(t,e){switch(t){case"before":return Ky(q6,e);case"after":return Ky(Z6,e);case"tail":return Ky(K6,e)}}let Jy,Qy;function e_(t,e,n){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),Jy=e.internal.subscribers,mm=0;mm0)&&!((u=i.gl.xr)!=null&&u.isPresenting)&&(n+=e_(l,i))}if(vf("after",l),n===0)return vf("tail",l),e=!1,cancelAnimationFrame(r)}function s(l,u=1){var d;if(!l)return t.forEach(h=>s(h.store.getState()),u);(d=l.gl.xr)!=null&&d.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+u),e||(e=!0,requestAnimationFrame(o)))}function a(l,u=!0,d,h){if(u&&vf("before",l),d)e_(l,d,h);else for(const p of t.values())e_(l,p.store.getState());u&&vf("after",l)}return{loop:o,invalidate:s,advance:a}}function _w(){const t=L.useContext(yw);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function Tr(t=n=>n,e){return _w()(t,e)}function oh(t,e=0){const n=_w(),r=n.getState().internal.subscribe,i=MI(t);return ih(()=>r(i,e,n),[e,r,n]),null}const mA=new WeakMap;function LI(t,e){return function(n,...r){let i=mA.get(n);return i||(i=new n,mA.set(n,i)),t&&t(i),Promise.all(r.map(o=>new Promise((s,a)=>i.load(o,l=>{l.scene&&Object.assign(l,H6(l.scene)),s(l)},e,l=>a(new Error(`Could not load ${o}: ${l==null?void 0:l.message}`)))))).finally(()=>i.dispose==null?void 0:i.dispose())}}function Eu(t,e,n,r){const i=Array.isArray(e)?e:[e],o=O6(LI(n,r),[t,...i],{equal:gn.equ});return Array.isArray(e)?o:o[0]}Eu.preload=function(t,e,n){const r=Array.isArray(e)?e:[e];return N6(LI(n),[t,...r])};Eu.clear=function(t,e){const n=Array.isArray(e)?e:[e];return k6([t,...n])};const fu=new Map,{invalidate:gA,advance:vA}=J6(fu),{reconciler:Dd,applyProps:Sc}=U6(fu,G6),wc={objects:"shallow",strict:!1},Q6=(t,e)=>{const n=typeof t=="function"?t(e):t;return II(n)?n:new $S({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function eV(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:o,left:s,updateStyle:a=n}=e;return{width:r,height:i,top:o,left:s,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:o,left:s}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:o,left:s,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function tV(t){const e=fu.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=r||Y6(gA,vA),s=n||Dd.createContainer(o,Gc.ConcurrentRoot,null,!1,null,"",i,null);e||fu.set(t,{fiber:s,store:o});let a,l=!1,u;return{configure(d={}){let{gl:h,size:p,scene:g,events:y,onCreated:w,shadows:x=!1,linear:m=!1,flat:_=!1,legacy:S=!1,orthographic:M=!1,frameloop:T="always",dpr:A=[1,2],performance:R,raycaster:O,camera:C,onPointerMissed:P}=d,k=o.getState(),X=k.gl;k.gl||k.set({gl:X=Q6(h,t)});let oe=k.raycaster;oe||k.set({raycaster:oe=new mw});const{params:V,...K}=O||{};if(gn.equ(K,oe,wc)||Sc(oe,{...K}),gn.equ(V,oe.params,wc)||Sc(oe,{params:{...oe.params,...V}}),!k.camera||k.camera===u&&!gn.equ(u,C,wc)){u=C;const Z=C instanceof qd,ge=Z?C:M?new ms(0,0,0,0,.1,1e3):new Bn(75,0,.1,1e3);Z||(ge.position.z=5,C&&Sc(ge,C),!k.camera&&!(C!=null&&C.rotation)&&ge.lookAt(0,0,0)),k.set({camera:ge}),oe.camera=ge}if(!k.scene){let Z;g instanceof Md?Z=g:(Z=new Md,g&&Sc(Z,g)),k.set({scene:Tc(Z)})}if(!k.xr){var J;const Z=(Ee,Se)=>{const We=o.getState();We.frameloop!=="never"&&vA(Ee,!0,We,Se)},ge=()=>{const Ee=o.getState();Ee.gl.xr.enabled=Ee.gl.xr.isPresenting,Ee.gl.xr.setAnimationLoop(Ee.gl.xr.isPresenting?Z:null),Ee.gl.xr.isPresenting||gA(Ee)},xe={connect(){const Ee=o.getState().gl;Ee.xr.addEventListener("sessionstart",ge),Ee.xr.addEventListener("sessionend",ge)},disconnect(){const Ee=o.getState().gl;Ee.xr.removeEventListener("sessionstart",ge),Ee.xr.removeEventListener("sessionend",ge)}};typeof((J=X.xr)==null?void 0:J.addEventListener)=="function"&&xe.connect(),k.set({xr:xe})}if(X.shadowMap){const Z=X.shadowMap.enabled,ge=X.shadowMap.type;if(X.shadowMap.enabled=!!x,gn.boo(x))X.shadowMap.type=Ff;else if(gn.str(x)){var se;const xe={basic:fP,percentage:Qg,soft:Ff,variance:io};X.shadowMap.type=(se=xe[x])!=null?se:Ff}else gn.obj(x)&&Object.assign(X.shadowMap,x);(Z!==X.shadowMap.enabled||ge!==X.shadowMap.type)&&(X.shadowMap.needsUpdate=!0)}const F=wI();F&&("enabled"in F?F.enabled=!S:"legacyMode"in F&&(F.legacyMode=S)),Sc(X,{outputEncoding:m?3e3:3001,toneMapping:_?fo:MS}),k.legacy!==S&&k.set(()=>({legacy:S})),k.linear!==m&&k.set(()=>({linear:m})),k.flat!==_&&k.set(()=>({flat:_})),h&&!gn.fun(h)&&!II(h)&&!gn.equ(h,X,wc)&&Sc(X,h),y&&!k.events.handlers&&k.set({events:y(o)});const H=eV(t,p);return gn.equ(H,k.size,wc)||k.setSize(H.width,H.height,H.updateStyle,H.top,H.left),A&&k.viewport.dpr!==AI(A)&&k.setDpr(A),k.frameloop!==T&&k.setFrameloop(T),k.onPointerMissed||k.set({onPointerMissed:P}),R&&!gn.equ(R,k.performance,wc)&&k.set(Z=>({performance:{...Z.performance,...R}})),a=w,l=!0,this},render(d){return l||this.configure(),Dd.updateContainer(L.createElement(nV,{store:o,children:d,onCreated:a,rootElement:t}),s,null,()=>{}),o},unmount(){DI(t)}}}function nV({store:t,children:e,onCreated:n,rootElement:r}){return ih(()=>{const i=t.getState();i.set(o=>({internal:{...o.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),L.createElement(yw.Provider,{value:t},e)}function DI(t,e){const n=fu.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),Dd.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var o,s,a,l;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(s=o.renderLists)==null||s.dispose==null||s.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),V6(i),fu.delete(t),e&&e(t)}catch{}},500)})}}function rV(t,e,n){return L.createElement(iV,{key:e.uuid,children:t,container:e,state:n})}function iV({state:t={},children:e,container:n}){const{events:r,size:i,...o}=t,s=_w(),[a]=L.useState(()=>new mw),[l]=L.useState(()=>new Te),u=L.useCallback((h,p)=>{const g={...h};Object.keys(h).forEach(w=>{(X6.includes(w)||h[w]!==p[w]&&p[w])&&delete g[w]});let y;if(p&&i){const w=p.camera;y=h.viewport.getCurrentViewport(w,new G,i),w!==h.camera&&RI(w,i)}return{...g,scene:n,raycaster:a,pointer:l,mouse:l,previousRoot:s,events:{...h.events,...p==null?void 0:p.events,...r},size:{...h.size,...i},viewport:{...h.viewport,...y},...o}},[t]),[d]=L.useState(()=>{const h=s.getState();return gw((g,y)=>({...h,scene:n,raycaster:a,pointer:l,mouse:l,previousRoot:s,events:{...h.events,...r},size:{...h.size,...i},...o,set:g,get:y,setEvents:w=>g(x=>({...x,events:{...x.events,...w}}))}))});return L.useEffect(()=>{const h=s.subscribe(p=>d.setState(g=>u(p,g)));return()=>{h(),d.destroy()}},[]),L.useEffect(()=>{d.setState(h=>u(s.getState(),h))},[u]),L.createElement(L.Fragment,null,Dd.createPortal(L.createElement(yw.Provider,{value:d},e),d,null))}Dd.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:L.version});function _n(){return _n=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0?r=setTimeout(l,e-d):(r=null,n||(a=t.apply(o,i),o=i=null))}var u=function(){o=this,i=arguments,s=Date.now();var d=n&&!r;return r||(r=setTimeout(l,e)),d&&(a=t.apply(o,i),o=i=null),a};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(a=t.apply(o,i),o=i=null,clearTimeout(r),r=null)},u}e1.debounce=e1;var oV=e1;const yA=mu(oV);function sV(t){let{debounce:e,scroll:n,polyfill:r,offsetSize:i}=t===void 0?{debounce:0,scroll:!1,offsetSize:!1}:t;const o=r||(typeof window>"u"?class{}:window.ResizeObserver);if(!o)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=L.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=L.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s}),u=e?typeof e=="number"?e:e.scroll:null,d=e?typeof e=="number"?e:e.resize:null,h=L.useRef(!1);L.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[p,g,y]=L.useMemo(()=>{const _=()=>{if(!l.current.element)return;const{left:S,top:M,width:T,height:A,bottom:R,right:O,x:C,y:P}=l.current.element.getBoundingClientRect(),k={left:S,top:M,width:T,height:A,bottom:R,right:O,x:C,y:P};l.current.element instanceof HTMLElement&&i&&(k.height=l.current.element.offsetHeight,k.width=l.current.element.offsetWidth),Object.freeze(k),h.current&&!uV(l.current.lastBounds,k)&&a(l.current.lastBounds=k)};return[_,d?yA(_,d):_,u?yA(_,u):_]},[a,i,u,d]);function w(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",y,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function x(){l.current.element&&(l.current.resizeObserver=new o(y),l.current.resizeObserver.observe(l.current.element),n&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",y,{capture:!0,passive:!0})))}const m=_=>{!_||_===l.current.element||(w(),l.current.element=_,l.current.scrollContainers=OI(_),x())};return lV(y,!!n),aV(g),L.useEffect(()=>{w(),x()},[n,y,g]),L.useEffect(()=>w,[]),[m,s,p]}function aV(t){L.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function lV(t,e){L.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function OI(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(o=>o==="auto"||o==="scroll")&&e.push(t),[...e,...OI(t.parentElement)]}const cV=["x","y","top","bottom","left","right","width","height"],uV=(t,e)=>cV.every(n=>t[n]===e[n]);var fV=Object.defineProperty,dV=Object.defineProperties,hV=Object.getOwnPropertyDescriptors,_A=Object.getOwnPropertySymbols,pV=Object.prototype.hasOwnProperty,mV=Object.prototype.propertyIsEnumerable,xA=(t,e,n)=>e in t?fV(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,SA=(t,e)=>{for(var n in e||(e={}))pV.call(e,n)&&xA(t,n,e[n]);if(_A)for(var n of _A(e))mV.call(e,n)&&xA(t,n,e[n]);return t},gV=(t,e)=>dV(t,hV(e));function NI(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=NI(r,e,n);if(i)return i;r=e?null:r.sibling}}function kI(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const xw=kI(L.createContext(null));class UI extends L.Component{render(){return L.createElement(xw.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:wA,ReactCurrentDispatcher:EA}=L.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function vV(){const t=L.useContext(xw);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=L.useId();return L.useMemo(()=>{for(const r of[wA==null?void 0:wA.current,t,t==null?void 0:t.alternate]){if(!r)continue;const i=NI(r,!1,o=>{let s=o.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}});if(i)return i}},[t,e])}function yV(){var t,e;const n=vV(),[r]=L.useState(()=>new Map);r.clear();let i=n;for(;i;){const o=(t=i.type)==null?void 0:t._context;o&&o!==xw&&!r.has(o)&&r.set(o,(e=EA==null?void 0:EA.current)==null?void 0:e.readContext(kI(o))),i=i.return}return r}function _V(){const t=yV();return L.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>L.createElement(e,null,L.createElement(n.Provider,gV(SA({},r),{value:t.get(n)}))),e=>L.createElement(UI,SA({},e))),[t])}const t_={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function xV(t){const{handlePointer:e}=j6(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(t_).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:o}=t.getState();o.disconnect==null||o.disconnect(),i(s=>({events:{...s.events,connected:n}})),Object.entries((r=o.handlers)!=null?r:[]).forEach(([s,a])=>{const[l,u]=t_[s];n.addEventListener(l,a,{passive:u})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([o,s])=>{if(r&&r.connected instanceof HTMLElement){const[a]=t_[o];r.connected.removeEventListener(a,s)}}),n(o=>({events:{...o.events,connected:void 0}}))}}}}const SV=L.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:o,events:s=xV,eventSource:a,eventPrefix:l,shadows:u,linear:d,flat:h,legacy:p,orthographic:g,frameloop:y,dpr:w,performance:x,raycaster:m,camera:_,scene:S,onPointerMissed:M,onCreated:T,...A},R){L.useMemo(()=>rh(b6),[]);const O=_V(),[C,P]=sV({scroll:!0,debounce:{scroll:50,resize:0},...r}),k=L.useRef(null),X=L.useRef(null);L.useImperativeHandle(R,()=>k.current);const oe=MI(M),[V,K]=L.useState(!1),[J,se]=L.useState(!1);if(V)throw V;if(J)throw J;const F=L.useRef(null);ih(()=>{const j=k.current;P.width>0&&P.height>0&&j&&(F.current||(F.current=tV(j)),F.current.configure({gl:o,events:s,shadows:u,linear:d,flat:h,legacy:p,orthographic:g,frameloop:y,dpr:w,performance:x,raycaster:m,camera:_,scene:S,size:P,onPointerMissed:(...H)=>oe.current==null?void 0:oe.current(...H),onCreated:H=>{H.events.connect==null||H.events.connect(a?F6(a)?a.current:a:X.current),l&&H.setEvents({compute:(Z,ge)=>{const xe=Z[l+"X"],Ee=Z[l+"Y"];ge.pointer.set(xe/ge.size.width*2-1,-(Ee/ge.size.height)*2+1),ge.raycaster.setFromCamera(ge.pointer,ge.camera)}}),T==null||T(H)}}),F.current.render(L.createElement(O,null,L.createElement(bI,{set:se},L.createElement(L.Suspense,{fallback:L.createElement(z6,{set:K})},e)))))}),L.useEffect(()=>{const j=k.current;if(j)return()=>DI(j)},[]);const $=a?"none":"auto";return L.createElement("div",_n({ref:X,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:$,...i}},A),L.createElement("div",{ref:C,style:{width:"100%",height:"100%"}},L.createElement("canvas",{ref:k,style:{display:"block"}},n)))}),wV=L.forwardRef(function(e,n){return L.createElement(UI,null,L.createElement(SV,_n({},e,{ref:n})))});function EV(t,e,n){return Math.max(e,Math.min(t,n))}const Ir={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function MA(t,e,n){return e===0||Math.abs(e)===1/0?Math.pow(t,n*5):t*e*n/(e+n*t)}function bA(t,e,n,r=.15){return r===0?EV(t,e,n):tn?+MA(t-n,n-e,r)+n:t}function MV(t,[e,n],[r,i]){const[[o,s],[a,l]]=t;return[bA(e,o,s,r),bA(n,a,l,i)]}function bV(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function TV(t){var e=bV(t,"string");return typeof e=="symbol"?e:String(e)}function ei(t,e,n){return e=TV(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function TA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function In(t){for(var e=1;e{var n,r;return e.target===t.currentTarget||((n=t.currentTarget)===null||n===void 0||(r=n.contains)===null||r===void 0?void 0:r.call(n,e.target))})}function OV(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function BI(t){return C0(t)?OV(t)[0]:t}function NV(t){return DV(t).map(e=>e.identifier)}function n_(t){const e=BI(t);return C0(t)?e.identifier:e.pointerId}function CA(t){const e=BI(t);return[e.clientX,e.clientY]}function kV(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:n,altKey:r,metaKey:i,ctrlKey:o}=t;Object.assign(e,{shiftKey:n,altKey:r,metaKey:i,ctrlKey:o})}return e}function wg(t,...e){return typeof t=="function"?t(...e):t}function UV(){}function FV(...t){return t.length===0?UV:t.length===1?t[0]:function(){let e;for(const n of t)e=n.apply(this,arguments)||e;return e}}function RA(t,e){return Object.assign({},e,t||{})}const zV=32;class BV{constructor(e,n,r){this.ctrl=e,this.args=n,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:n,ingKey:r,args:i}=this;n[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const n=this.state,r=this.config;n._active||(this.reset(),this.computeInitial(),n._active=!0,n.target=e.target,n.currentTarget=e.currentTarget,n.lastOffset=r.from?wg(r.from,n):n.offset,n.offset=n.lastOffset,n.startTime=n.timeStamp=e.timeStamp)}computeValues(e){const n=this.state;n._values=e,n.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:n,config:r,shared:i}=this;n.args=this.args;let o=0;if(e&&(n.event=e,r.preventDefault&&e.cancelable&&n.event.preventDefault(),n.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,kV(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,o=e.timeStamp-n.timeStamp,n.timeStamp=e.timeStamp,n.elapsedTime=n.timeStamp-n.startTime),n._active){const A=n._delta.map(Math.abs);Ir.addTo(n._distance,A)}this.axisIntent&&this.axisIntent(e);const[s,a]=n._movement,[l,u]=r.threshold,{_step:d,values:h}=n;if(r.hasCustomTransform?(d[0]===!1&&(d[0]=Math.abs(s)>=l&&h[0]),d[1]===!1&&(d[1]=Math.abs(a)>=u&&h[1])):(d[0]===!1&&(d[0]=Math.abs(s)>=l&&Math.sign(s)*l),d[1]===!1&&(d[1]=Math.abs(a)>=u&&Math.sign(a)*u)),n.intentional=d[0]!==!1||d[1]!==!1,!n.intentional)return;const p=[0,0];if(r.hasCustomTransform){const[A,R]=h;p[0]=d[0]!==!1?A-d[0]:0,p[1]=d[1]!==!1?R-d[1]:0}else p[0]=d[0]!==!1?s-d[0]:0,p[1]=d[1]!==!1?a-d[1]:0;this.restrictToAxis&&!n._blocked&&this.restrictToAxis(p);const g=n.offset,y=n._active&&!n._blocked||n.active;y&&(n.first=n._active&&!n.active,n.last=!n._active&&n.active,n.active=i[this.ingKey]=n._active,e&&(n.first&&("bounds"in r&&(n._bounds=wg(r.bounds,n)),this.setup&&this.setup()),n.movement=p,this.computeOffset()));const[w,x]=n.offset,[[m,_],[S,M]]=n._bounds;n.overflow=[w_?1:0,xM?1:0],n._movementBound[0]=n.overflow[0]?n._movementBound[0]===!1?n._movement[0]:n._movementBound[0]:!1,n._movementBound[1]=n.overflow[1]?n._movementBound[1]===!1?n._movement[1]:n._movementBound[1]:!1;const T=n._active?r.rubberband||[0,0]:[0,0];if(n.offset=MV(n._bounds,n.offset,T),n.delta=Ir.sub(n.offset,g),this.computeMovement(),y&&(!n.last||o>zV)){n.delta=Ir.sub(n.offset,g);const A=n.delta.map(Math.abs);Ir.addTo(n.distance,A),n.direction=n.delta.map(Math.sign),n._direction=n._delta.map(Math.sign),!n.first&&o>0&&(n.velocity=[A[0]/o,A[1]/o],n.timeDelta=o)}}emit(){const e=this.state,n=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const i=this.handler(In(In(In({},n),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function HV([t,e],n){const r=Math.abs(t),i=Math.abs(e);if(r>i&&r>n)return"x";if(i>r&&i>n)return"y"}class VV extends BV{constructor(...e){super(...e),ei(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Ir.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Ir.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const n=this.state,r=this.config;if(!n.axis&&e){const i=typeof r.axisThreshold=="object"?r.axisThreshold[zI(e)]:r.axisThreshold;n.axis=HV(n._movement,i)}n._blocked=(r.lockDirection||!!r.axis)&&!n.axis||!!r.axis&&r.axis!==n.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const WV=t=>t,PA=.15,HI={enabled(t=!0){return t},eventOptions(t,e,n){return In(In({},n.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[PA,PA];case!1:return[0,0];default:return Ir.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return Ir.toVector(t)},transform(t,e,n){const r=t||n.shared.transform;return this.hasCustomTransform=!!r,r||WV},threshold(t){return Ir.toVector(t,0)}},GV=0,sh=In(In({},HI),{},{axis(t,e,{axis:n}){if(this.lockDirection=n==="lock",!this.lockDirection)return n},axisThreshold(t=GV){return t},bounds(t={}){if(typeof t=="function")return o=>sh.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:n=1/0,top:r=-1/0,bottom:i=1/0}=t;return[[e,n],[r,i]]}}),IA={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class $V extends VV{constructor(...e){super(...e),ei(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const n=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),i={left:n.left-r.left+e.offset[0],right:n.right-r.right+e.offset[0],top:n.top-r.top+e.offset[1],bottom:n.bottom-r.bottom+e.offset[1]};e._bounds=sh.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const n=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(n.pointerButtons)?!n.pointerButtons.includes(e.buttons):n.pointerButtons!==-1&&n.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);n.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=n_(e),r._pointerActive=!0,this.computeValues(CA(e)),this.computeInitial(),n.preventScrollAxis&&zI(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):n.delay>0?(this.setupDelayTrigger(e),n.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const n=this.state;n._active=!0,n._preventScroll=!0,n._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const n=this.state,r=this.config;if(!n._pointerActive)return;const i=n_(e);if(n._pointerId!==void 0&&i!==n._pointerId)return;const o=CA(e);if(document.pointerLockElement===e.target?n._delta=[e.movementX,e.movementY]:(n._delta=Ir.sub(o,n._values),this.computeValues(o)),Ir.addTo(n._movement,n._delta),this.compute(e),n._delayed&&n.intentional){this.timeoutStore.remove("dragDelay"),n.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!n._preventScroll)if(n.axis)if(n.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){n._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const n=this.state,r=this.config;if(!n._active||!n._pointerActive)return;const i=n_(e);if(n._pointerId!==void 0&&i!==n._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,s]=n._distance;if(n.tap=o<=r.tapsThreshold&&s<=r.tapsThreshold,n.tap&&r.filterTaps)n._force=!0;else{const[a,l]=n._delta,[u,d]=n._movement,[h,p]=r.swipe.velocity,[g,y]=r.swipe.distance,w=r.swipe.duration;if(n.elapsedTimeh&&Math.abs(u)>g&&(n.swipe[0]=Math.sign(a)),m>p&&Math.abs(d)>y&&(n.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const n=this.config,r=n.device;n.pointerLock&&e.currentTarget.requestPointerLock(),n.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,jV(e);const n=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",n),this.eventStore.add(this.sharedConfig.window,"touch","cancel",n),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const n=IA[e.key];if(n){const r=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=n(this.config.keyboardDisplacement,i),r._keyboardActive=!0,Ir.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in IA&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const n=this.config.device;e(n,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(n,"change",this.pointerMove.bind(this)),e(n,"end",this.pointerUp.bind(this)),e(n,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function jV(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const ah=typeof window<"u"&&window.document&&window.document.createElement;function VI(){return ah&&"ontouchstart"in window}function XV(){return VI()||ah&&window.navigator.maxTouchPoints>1}function YV(){return ah&&"onpointerdown"in window}function qV(){return ah&&"exitPointerLock"in window.document}function ZV(){try{return"constructor"in GestureEvent}catch{return!1}}const zi={isBrowser:ah,gesture:ZV(),touch:VI(),touchscreen:XV(),pointer:YV(),pointerLock:qV()},KV=250,JV=180,QV=.5,e8=50,t8=250,n8=10,LA={mouse:0,touch:0,pen:8},r8=In(In({},sh),{},{device(t,e,{pointer:{touch:n=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&zi.pointerLock,zi.touch&&n?"touch":this.pointerLock?"mouse":zi.pointer&&!i?"pointer":zi.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:n}){if(this.preventScrollDelay=typeof n=="number"?n:n||n===void 0&&t?KV:void 0,!(!zi.touchscreen||n===!1))return t||(n!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:n=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&this.device==="pointer"&&n},threshold(t,e,{filterTaps:n=!1,tapsThreshold:r=3,axis:i=void 0}){const o=Ir.toVector(t,n?r:i?1:0);return this.filterTaps=n,this.tapsThreshold=r,o},swipe({velocity:t=QV,distance:e=e8,duration:n=t8}={}){return{velocity:this.transform(Ir.toVector(t)),distance:this.transform(Ir.toVector(e)),duration:n}},delay(t=0){switch(t){case!0:return JV;case!1:return 0;default:return t}},axisThreshold(t){return t?In(In({},LA),t):LA},keyboardDisplacement(t=n8){return t}});In(In({},HI),{},{device(t,e,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!zi.touch&&zi.gesture)return"gesture";if(zi.touch&&r)return"touch";if(zi.touchscreen){if(zi.pointer)return"pointer";if(zi.touch)return"touch"}},bounds(t,e,{scaleBounds:n={},angleBounds:r={}}){const i=s=>{const a=RA(wg(n,s),{min:-1/0,max:1/0});return[a.min,a.max]},o=s=>{const a=RA(wg(r,s),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof n!="function"&&typeof r!="function"?[i(),o()]:s=>[i(s),o(s)]},threshold(t,e,n){return this.lockDirection=n.axis==="lock",Ir.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});In(In({},sh),{},{mouseOnly:(t=!0)=>t});In(In({},sh),{},{mouseOnly:(t=!0)=>t});const WI=new Map,t1=new Map;function i8(t){WI.set(t.key,t.engine),t1.set(t.key,t.resolver)}const o8={key:"drag",engine:$V,resolver:r8};function s8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function a8(t,e){if(t==null)return{};var n=s8(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}const l8={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=zi.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},c8=["target","eventOptions","window","enabled","transform"];function Gm(t={},e){const n={};for(const[r,i]of Object.entries(e))switch(typeof i){case"function":n[r]=i.call(n,t[r],r,t);break;case"object":n[r]=Gm(t[r],i);break;case"boolean":i&&(n[r]=t[r]);break}return n}function u8(t,e,n={}){const r=t,{target:i,eventOptions:o,window:s,enabled:a,transform:l}=r,u=a8(r,c8);if(n.shared=Gm({target:i,eventOptions:o,window:s,enabled:a,transform:l},l8),e){const d=t1.get(e);n[e]=Gm(In({shared:n.shared},u),d)}else for(const d in u){const h=t1.get(d);h&&(n[d]=Gm(In({shared:n.shared},u[d]),h))}return n}class GI{constructor(e,n){ei(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=n}add(e,n,r,i,o){const s=this._listeners,a=LV(n,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=In(In({},l),o);e.addEventListener(a,i,u);const d=()=>{e.removeEventListener(a,i,u),s.delete(d)};return s.add(d),d}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class f8{constructor(){ei(this,"_timeouts",new Map)}add(e,n,r=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(n,r,...i))}remove(e){const n=this._timeouts.get(e);n&&window.clearTimeout(n)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class d8{constructor(e){ei(this,"gestures",new Set),ei(this,"_targetEventStore",new GI(this)),ei(this,"gestureEventStores",{}),ei(this,"gestureTimeoutStores",{}),ei(this,"handlers",{}),ei(this,"config",{}),ei(this,"pointerIds",new Set),ei(this,"touchIds",new Set),ei(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),h8(this,e)}setEventIds(e){if(C0(e))return this.touchIds=new Set(NV(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,n){this.handlers=e,this.nativeHandlers=n}applyConfig(e,n){this.config=u8(e,n,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const n=this.config.shared,r={};let i;if(!(n.target&&(i=n.target(),!i))){if(n.enabled){for(const s of this.gestures){const a=this.config[s],l=DA(r,a.eventOptions,!!i);if(a.enabled){const u=WI.get(s);new u(this,e,s).bind(l)}}const o=DA(r,n.eventOptions,!!i);for(const s in this.nativeHandlers)o(s,"",a=>this.nativeHandlers[s](In(In({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const o in r)r[o]=FV(...r[o]);if(!i)return r;for(const o in r){const{device:s,capture:a,passive:l}=IV(o);this._targetEventStore.add(i,s,"",r[o],{capture:a,passive:l})}}}}function Ec(t,e){t.gestures.add(e),t.gestureEventStores[e]=new GI(t,e),t.gestureTimeoutStores[e]=new f8}function h8(t,e){e.drag&&Ec(t,"drag"),e.wheel&&Ec(t,"wheel"),e.scroll&&Ec(t,"scroll"),e.move&&Ec(t,"move"),e.pinch&&Ec(t,"pinch"),e.hover&&Ec(t,"hover")}const DA=(t,e,n)=>(r,i,o,s={},a=!1)=>{var l,u;const d=(l=s.capture)!==null&&l!==void 0?l:e.capture,h=(u=s.passive)!==null&&u!==void 0?u:e.passive;let p=a?r:RV(r,i,d);n&&h&&(p+="Passive"),t[p]=t[p]||[],t[p].push(o)};function p8(t,e={},n,r){const i=te.useMemo(()=>new d8(t),[]);if(i.applyHandlers(t,r),i.applyConfig(e,n),te.useEffect(i.effect.bind(i)),te.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function m8(t,e){return i8(o8),p8({drag:t},e||{},"drag")}const g8=t=>(e,n,r)=>{const i=r.subscribe;return r.subscribe=(s,a,l)=>{let u=s;if(a){const d=(l==null?void 0:l.equalityFn)||Object.is;let h=s(r.getState());u=p=>{const g=s(p);if(!d(h,g)){const y=h;a(h=g,y)}},l!=null&&l.fireImmediately&&a(h,h)}return i(u)},t(e,n,r)};function v8(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new G,new G,new G],o=new G,s=new G,a=new G,l=new G;function u(w){const x=~~(w.x*r),m=~~(w.y*r),_=~~(w.z*r);return`${x},${m},${_}`}const d=t.index?t.toNonIndexed():t,h=d.attributes.position,p={};for(let w=0,x=h.count/3;wn&&l.add(k)}l.normalize(),y.setXYZ(m+T,l.x,l.y,l.z)}}return d.setAttribute("normal",y),d}var Bi=Uint8Array,ta=Uint16Array,n1=Uint32Array,$I=new Bi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),jI=new Bi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),y8=new Bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),XI=function(t,e){for(var n=new ta(31),r=0;r<31;++r)n[r]=e+=1<>>1|(vn&21845)<<1;js=(js&52428)>>>2|(js&13107)<<2,js=(js&61680)>>>4|(js&3855)<<4,r1[vn]=((js&65280)>>>8|(js&255)<<8)>>>1}var Gf=function(t,e,n){for(var r=t.length,i=0,o=new ta(e);i>>l]=u}else for(a=new ta(r),i=0;i>>15-t[i]);return a},lh=new Bi(288);for(var vn=0;vn<144;++vn)lh[vn]=8;for(var vn=144;vn<256;++vn)lh[vn]=9;for(var vn=256;vn<280;++vn)lh[vn]=7;for(var vn=280;vn<288;++vn)lh[vn]=8;var ZI=new Bi(32);for(var vn=0;vn<32;++vn)ZI[vn]=5;var w8=Gf(lh,9,1),E8=Gf(ZI,5,1),r_=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},no=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(e&7)&n},i_=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},M8=function(t){return(t/8|0)+(t&7&&1)},b8=function(t,e,n){(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof ta?ta:t instanceof n1?n1:Bi)(n-e);return r.set(t.subarray(e,n)),r},T8=function(t,e,n){var r=t.length;if(!r||n&&!n.l&&r<5)return e||new Bi(0);var i=!e||n,o=!n||n.i;n||(n={}),e||(e=new Bi(r*3));var s=function(Se){var We=e.length;if(Se>We){var Je=new Bi(Math.max(We*2,Se));Je.set(e),e=Je}},a=n.f||0,l=n.p||0,u=n.b||0,d=n.l,h=n.d,p=n.m,g=n.n,y=r*8;do{if(!d){n.f=a=no(t,l,1);var w=no(t,l+1,3);if(l+=3,w)if(w==1)d=w8,h=E8,p=9,g=5;else if(w==2){var S=no(t,l,31)+257,M=no(t,l+10,15)+4,T=S+no(t,l+5,31)+1;l+=14;for(var A=new Bi(T),R=new Bi(19),O=0;O>>4;if(x<16)A[O++]=x;else{var oe=0,V=0;for(x==16?(V=3+no(t,l,3),l+=2,oe=A[O-1]):x==17?(V=3+no(t,l,7),l+=3):x==18&&(V=11+no(t,l,127),l+=7);V--;)A[O++]=oe}}var K=A.subarray(0,S),J=A.subarray(S);p=r_(K),g=r_(J),d=Gf(K,p,1),h=Gf(J,g,1)}else throw"invalid block type";else{var x=M8(l)+4,m=t[x-4]|t[x-3]<<8,_=x+m;if(_>r){if(o)throw"unexpected EOF";break}i&&s(u+m),e.set(t.subarray(x,_),u),n.b=u+=m,n.p=l=_*8;continue}if(l>y){if(o)throw"unexpected EOF";break}}i&&s(u+131072);for(var se=(1<>>4;if(l+=oe&15,l>y){if(o)throw"unexpected EOF";break}if(!oe)throw"invalid length/literal";if(j<256)e[u++]=j;else if(j==256){$=l,d=null;break}else{var H=j-254;if(j>264){var O=j-257,Z=$I[O];H=no(t,l,(1<>>4;if(!ge)throw"invalid distance";l+=ge&15;var J=S8[xe];if(xe>3){var Z=jI[xe];J+=i_(t,l)&(1<y){if(o)throw"unexpected EOF";break}i&&s(u+131072);for(var Ee=u+H;u>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(t[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function gm(t,e){return T8((C8(t),t.subarray(2,-4)),e)}var R8=typeof TextDecoder<"u"&&new TextDecoder,P8=0;try{R8.decode(A8,{stream:!0}),P8=1}catch{}const I8=t=>t&&t.isCubeTexture;class L8 extends ur{constructor(e,n){var r,i;const o=I8(e),a=((i=o?(r=e.image[0])==null?void 0:r.width:e.image.width)!=null?i:1024)/4,l=Math.floor(Math.log2(a)),u=Math.pow(2,l),d=3*Math.max(u,16*7),h=4*u,p=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/d}`,`#define CUBEUV_TEXEL_HEIGHT ${1/h}`,`#define CUBEUV_MAX_MIP ${l}.0`],g=` varying vec3 vWorldPosition; void main() { vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); vWorldPosition = worldPosition.xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } `,y=p.join(` `)+` #define ENVMAP_TYPE_CUBE_UV varying vec3 vWorldPosition; uniform float radius; uniform float height; uniform float angle; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube map; #else uniform sampler2D map; #endif // From: https://www.shadertoy.com/view/4tsBD7 float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) { float d = dot ( rd, n ); if( d > 0.0 ) { return 1e6; } vec3 o = ro - c; float t = - dot( n, o ) / d; vec3 q = o + rd * t; return ( dot( q, q ) < r * r ) ? t : 1e6; } // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) { vec3 oc = ro - ce; float b = dot( oc, rd ); float c = dot( oc, oc ) - ra * ra; float h = b * b - c; if( h < 0.0 ) { return -1.0; } h = sqrt( h ); return - b + h; } vec3 project() { vec3 p = normalize( vWorldPosition ); vec3 camPos = cameraPosition; camPos.y -= height; float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); if( intersection > 0.0 ) { vec3 h = vec3( 0.0, - height, 0.0 ); float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); p = ( camPos + min( intersection, intersection2 ) * p ) / radius; } else { p = vec3( 0.0, 1.0, 0.0 ); } return p; } #include #include void main() { vec3 projectedWorldPosition = project(); #ifdef ENVMAP_TYPE_CUBE vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; #else vec3 direction = normalize( projectedWorldPosition ); vec2 uv = equirectUv( direction ); vec3 outcolor = texture2D( map, uv ).rgb; #endif gl_FragColor = vec4( outcolor, 1.0 ); #include #include <${parseInt($d.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}> } `,w={map:{value:e},height:{value:(n==null?void 0:n.height)||15},radius:{value:(n==null?void 0:n.radius)||100}},x=new Qd(1,16),m=new Xi({uniforms:w,fragmentShader:y,vertexShader:g,side:lo});super(x,m)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}var D8=Object.defineProperty,O8=(t,e,n)=>e in t?D8(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Tt=(t,e,n)=>(O8(t,typeof e!="symbol"?e+"":e,n),n);const vm=new Nl,OA=new cs,N8=Math.cos(70*(Math.PI/180)),NA=(t,e)=>(t%e+e)%e;let k8=class extends $o{constructor(e,n){super(),Tt(this,"object"),Tt(this,"domElement"),Tt(this,"enabled",!0),Tt(this,"target",new G),Tt(this,"minDistance",0),Tt(this,"maxDistance",1/0),Tt(this,"minZoom",0),Tt(this,"maxZoom",1/0),Tt(this,"minPolarAngle",0),Tt(this,"maxPolarAngle",Math.PI),Tt(this,"minAzimuthAngle",-1/0),Tt(this,"maxAzimuthAngle",1/0),Tt(this,"enableDamping",!1),Tt(this,"dampingFactor",.05),Tt(this,"enableZoom",!0),Tt(this,"zoomSpeed",1),Tt(this,"enableRotate",!0),Tt(this,"rotateSpeed",1),Tt(this,"enablePan",!0),Tt(this,"panSpeed",1),Tt(this,"screenSpacePanning",!0),Tt(this,"keyPanSpeed",7),Tt(this,"zoomToCursor",!1),Tt(this,"autoRotate",!1),Tt(this,"autoRotateSpeed",2),Tt(this,"reverseOrbit",!1),Tt(this,"reverseHorizontalOrbit",!1),Tt(this,"reverseVerticalOrbit",!1),Tt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Tt(this,"mouseButtons",{LEFT:Qa.ROTATE,MIDDLE:Qa.DOLLY,RIGHT:Qa.PAN}),Tt(this,"touches",{ONE:el.ROTATE,TWO:el.DOLLY_PAN}),Tt(this,"target0"),Tt(this,"position0"),Tt(this,"zoom0"),Tt(this,"_domElementKeyEvents",null),Tt(this,"getPolarAngle"),Tt(this,"getAzimuthalAngle"),Tt(this,"setPolarAngle"),Tt(this,"setAzimuthalAngle"),Tt(this,"getDistance"),Tt(this,"listenToKeyEvents"),Tt(this,"stopListenToKeyEvents"),Tt(this,"saveState"),Tt(this,"reset"),Tt(this,"update"),Tt(this,"connect"),Tt(this,"dispose"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=re=>{let he=NA(re,2*Math.PI),Ce=d.phi;Ce<0&&(Ce+=2*Math.PI),he<0&&(he+=2*Math.PI);let ke=Math.abs(he-Ce);2*Math.PI-ke{let he=NA(re,2*Math.PI),Ce=d.theta;Ce<0&&(Ce+=2*Math.PI),he<0&&(he+=2*Math.PI);let ke=Math.abs(he-Ce);2*Math.PI-ker.object.position.distanceTo(r.target),this.listenToKeyEvents=re=>{re.addEventListener("keydown",Ne),this._domElementKeyEvents=re},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Ne),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const re=new G,he=new G(0,1,0),Ce=new mr().setFromUnitVectors(e.up,he),ke=Ce.clone().invert(),be=new G,ae=new mr,Ge=2*Math.PI;return function(){const Me=r.object.position;Ce.setFromUnitVectors(e.up,he),ke.copy(Ce).invert(),re.copy(Me).sub(r.target),re.applyQuaternion(Ce),d.setFromVector3(re),r.autoRotate&&l===a.NONE&&V(X()),r.enableDamping?(d.theta+=h.theta*r.dampingFactor,d.phi+=h.phi*r.dampingFactor):(d.theta+=h.theta,d.phi+=h.phi);let Fe=r.minAzimuthAngle,ct=r.maxAzimuthAngle;isFinite(Fe)&&isFinite(ct)&&(Fe<-Math.PI?Fe+=Ge:Fe>Math.PI&&(Fe-=Ge),ct<-Math.PI?ct+=Ge:ct>Math.PI&&(ct-=Ge),Fe<=ct?d.theta=Math.max(Fe,Math.min(ct,d.theta)):d.theta=d.theta>(Fe+ct)/2?Math.max(Fe,d.theta):Math.min(ct,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(g,r.dampingFactor):r.target.add(g),r.zoomToCursor&&C||r.object.isOrthographicCamera?d.radius=Z(d.radius):d.radius=Z(d.radius*p),re.setFromSpherical(d),re.applyQuaternion(ke),Me.copy(r.target).add(re),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(h.theta*=1-r.dampingFactor,h.phi*=1-r.dampingFactor,g.multiplyScalar(1-r.dampingFactor)):(h.set(0,0,0),g.set(0,0,0));let Ot=!1;if(r.zoomToCursor&&C){let en=null;if(r.object instanceof Bn&&r.object.isPerspectiveCamera){const Mn=re.length();en=Z(Mn*p);const $t=Mn-en;r.object.position.addScaledVector(R,$t),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const Mn=new G(O.x,O.y,0);Mn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),Ot=!0;const $t=new G(O.x,O.y,0);$t.unproject(r.object),r.object.position.sub($t).add(Mn),r.object.updateMatrixWorld(),en=re.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;en!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(en).add(r.object.position):(vm.origin.copy(r.object.position),vm.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(vm.direction))u||8*(1-ae.dot(r.object.quaternion))>u?(r.dispatchEvent(i),be.copy(r.object.position),ae.copy(r.object.quaternion),Ot=!1,!0):!1}})(),this.connect=re=>{re===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),r.domElement=re,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",$e),r.domElement.addEventListener("pointerdown",xt),r.domElement.addEventListener("pointercancel",U),r.domElement.addEventListener("wheel",Re)},this.dispose=()=>{var re,he,Ce,ke,be,ae;(re=r.domElement)==null||re.removeEventListener("contextmenu",$e),(he=r.domElement)==null||he.removeEventListener("pointerdown",xt),(Ce=r.domElement)==null||Ce.removeEventListener("pointercancel",U),(ke=r.domElement)==null||ke.removeEventListener("wheel",Re),(be=r.domElement)==null||be.ownerDocument.removeEventListener("pointermove",qt),(ae=r.domElement)==null||ae.ownerDocument.removeEventListener("pointerup",z),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",Ne)};const r=this,i={type:"change"},o={type:"start"},s={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const u=1e-6,d=new Kx,h=new Kx;let p=1;const g=new G,y=new Te,w=new Te,x=new Te,m=new Te,_=new Te,S=new Te,M=new Te,T=new Te,A=new Te,R=new G,O=new Te;let C=!1;const P=[],k={};function X(){return 2*Math.PI/60/60*r.autoRotateSpeed}function oe(){return Math.pow(.95,r.zoomSpeed)}function V(re){r.reverseOrbit||r.reverseHorizontalOrbit?h.theta+=re:h.theta-=re}function K(re){r.reverseOrbit||r.reverseVerticalOrbit?h.phi+=re:h.phi-=re}const J=(()=>{const re=new G;return function(Ce,ke){re.setFromMatrixColumn(ke,0),re.multiplyScalar(-Ce),g.add(re)}})(),se=(()=>{const re=new G;return function(Ce,ke){r.screenSpacePanning===!0?re.setFromMatrixColumn(ke,1):(re.setFromMatrixColumn(ke,0),re.crossVectors(r.object.up,re)),re.multiplyScalar(Ce),g.add(re)}})(),F=(()=>{const re=new G;return function(Ce,ke){const be=r.domElement;if(be&&r.object instanceof Bn&&r.object.isPerspectiveCamera){const ae=r.object.position;re.copy(ae).sub(r.target);let Ge=re.length();Ge*=Math.tan(r.object.fov/2*Math.PI/180),J(2*Ce*Ge/be.clientHeight,r.object.matrix),se(2*ke*Ge/be.clientHeight,r.object.matrix)}else be&&r.object instanceof ms&&r.object.isOrthographicCamera?(J(Ce*(r.object.right-r.object.left)/r.object.zoom/be.clientWidth,r.object.matrix),se(ke*(r.object.top-r.object.bottom)/r.object.zoom/be.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function $(re){r.object instanceof Bn&&r.object.isPerspectiveCamera||r.object instanceof ms&&r.object.isOrthographicCamera?p/=re:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function j(re){r.object instanceof Bn&&r.object.isPerspectiveCamera||r.object instanceof ms&&r.object.isOrthographicCamera?p*=re:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function H(re){if(!r.zoomToCursor||!r.domElement)return;C=!0;const he=r.domElement.getBoundingClientRect(),Ce=re.clientX-he.left,ke=re.clientY-he.top,be=he.width,ae=he.height;O.x=Ce/be*2-1,O.y=-(ke/ae)*2+1,R.set(O.x,O.y,1).unproject(r.object).sub(r.object.position).normalize()}function Z(re){return Math.max(r.minDistance,Math.min(r.maxDistance,re))}function ge(re){y.set(re.clientX,re.clientY)}function xe(re){H(re),M.set(re.clientX,re.clientY)}function Ee(re){m.set(re.clientX,re.clientY)}function Se(re){w.set(re.clientX,re.clientY),x.subVectors(w,y).multiplyScalar(r.rotateSpeed);const he=r.domElement;he&&(V(2*Math.PI*x.x/he.clientHeight),K(2*Math.PI*x.y/he.clientHeight)),y.copy(w),r.update()}function We(re){T.set(re.clientX,re.clientY),A.subVectors(T,M),A.y>0?$(oe()):A.y<0&&j(oe()),M.copy(T),r.update()}function Je(re){_.set(re.clientX,re.clientY),S.subVectors(_,m).multiplyScalar(r.panSpeed),F(S.x,S.y),m.copy(_),r.update()}function ft(re){H(re),re.deltaY<0?j(oe()):re.deltaY>0&&$(oe()),r.update()}function At(re){let he=!1;switch(re.code){case r.keys.UP:F(0,r.keyPanSpeed),he=!0;break;case r.keys.BOTTOM:F(0,-r.keyPanSpeed),he=!0;break;case r.keys.LEFT:F(r.keyPanSpeed,0),he=!0;break;case r.keys.RIGHT:F(-r.keyPanSpeed,0),he=!0;break}he&&(re.preventDefault(),r.update())}function Qe(){if(P.length==1)y.set(P[0].pageX,P[0].pageY);else{const re=.5*(P[0].pageX+P[1].pageX),he=.5*(P[0].pageY+P[1].pageY);y.set(re,he)}}function Q(){if(P.length==1)m.set(P[0].pageX,P[0].pageY);else{const re=.5*(P[0].pageX+P[1].pageX),he=.5*(P[0].pageY+P[1].pageY);m.set(re,he)}}function Le(){const re=P[0].pageX-P[1].pageX,he=P[0].pageY-P[1].pageY,Ce=Math.sqrt(re*re+he*he);M.set(0,Ce)}function we(){r.enableZoom&&Le(),r.enablePan&&Q()}function De(){r.enableZoom&&Le(),r.enableRotate&&Qe()}function Ae(re){if(P.length==1)w.set(re.pageX,re.pageY);else{const Ce=Dt(re),ke=.5*(re.pageX+Ce.x),be=.5*(re.pageY+Ce.y);w.set(ke,be)}x.subVectors(w,y).multiplyScalar(r.rotateSpeed);const he=r.domElement;he&&(V(2*Math.PI*x.x/he.clientHeight),K(2*Math.PI*x.y/he.clientHeight)),y.copy(w)}function lt(re){if(P.length==1)_.set(re.pageX,re.pageY);else{const he=Dt(re),Ce=.5*(re.pageX+he.x),ke=.5*(re.pageY+he.y);_.set(Ce,ke)}S.subVectors(_,m).multiplyScalar(r.panSpeed),F(S.x,S.y),m.copy(_)}function je(re){const he=Dt(re),Ce=re.pageX-he.x,ke=re.pageY-he.y,be=Math.sqrt(Ce*Ce+ke*ke);T.set(0,be),A.set(0,Math.pow(T.y/M.y,r.zoomSpeed)),$(A.y),M.copy(T)}function et(re){r.enableZoom&&je(re),r.enablePan&<(re)}function dt(re){r.enableZoom&&je(re),r.enableRotate&&Ae(re)}function xt(re){var he,Ce;r.enabled!==!1&&(P.length===0&&((he=r.domElement)==null||he.ownerDocument.addEventListener("pointermove",qt),(Ce=r.domElement)==null||Ce.ownerDocument.addEventListener("pointerup",z)),gt(re),re.pointerType==="touch"?Ze(re):ue(re))}function qt(re){r.enabled!==!1&&(re.pointerType==="touch"?Be(re):Ie(re))}function z(re){var he,Ce,ke;bt(re),P.length===0&&((he=r.domElement)==null||he.releasePointerCapture(re.pointerId),(Ce=r.domElement)==null||Ce.ownerDocument.removeEventListener("pointermove",qt),(ke=r.domElement)==null||ke.ownerDocument.removeEventListener("pointerup",z)),r.dispatchEvent(s),l=a.NONE}function U(re){bt(re)}function ue(re){let he;switch(re.button){case 0:he=r.mouseButtons.LEFT;break;case 1:he=r.mouseButtons.MIDDLE;break;case 2:he=r.mouseButtons.RIGHT;break;default:he=-1}switch(he){case Qa.DOLLY:if(r.enableZoom===!1)return;xe(re),l=a.DOLLY;break;case Qa.ROTATE:if(re.ctrlKey||re.metaKey||re.shiftKey){if(r.enablePan===!1)return;Ee(re),l=a.PAN}else{if(r.enableRotate===!1)return;ge(re),l=a.ROTATE}break;case Qa.PAN:if(re.ctrlKey||re.metaKey||re.shiftKey){if(r.enableRotate===!1)return;ge(re),l=a.ROTATE}else{if(r.enablePan===!1)return;Ee(re),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(o)}function Ie(re){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Se(re);break;case a.DOLLY:if(r.enableZoom===!1)return;We(re);break;case a.PAN:if(r.enablePan===!1)return;Je(re);break}}function Re(re){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(re.preventDefault(),r.dispatchEvent(o),ft(re),r.dispatchEvent(s))}function Ne(re){r.enabled===!1||r.enablePan===!1||At(re)}function Ze(re){switch(Pe(re),P.length){case 1:switch(r.touches.ONE){case el.ROTATE:if(r.enableRotate===!1)return;Qe(),l=a.TOUCH_ROTATE;break;case el.PAN:if(r.enablePan===!1)return;Q(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case el.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;we(),l=a.TOUCH_DOLLY_PAN;break;case el.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;De(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(o)}function Be(re){switch(Pe(re),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Ae(re),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;lt(re),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;et(re),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;dt(re),r.update();break;default:l=a.NONE}}function $e(re){r.enabled!==!1&&re.preventDefault()}function gt(re){P.push(re)}function bt(re){delete k[re.pointerId];for(let he=0;he(O=k.indexOf(h))&&C=S.byteLength||!(P=p(S)))return a(1,"no header found");if(!(k=P.match(M)))return a(3,"bad initial token");for(C.valid|=1,C.programtype=k[1],C.string+=P+` `;P=p(S),P!==!1;){if(C.string+=P+` `,P.charAt(0)==="#"){C.comments+=P+` `;continue}if((k=P.match(T))&&(C.gamma=parseFloat(k[1])),(k=P.match(A))&&(C.exposure=parseFloat(k[1])),(k=P.match(R))&&(C.valid|=2,C.format=k[1]),(k=P.match(O))&&(C.valid|=4,C.height=parseInt(k[1],10),C.width=parseInt(k[2],10)),C.valid&2&&C.valid&4)break}return C.valid&2?C.valid&4?C:a(3,"missing image size specifier"):a(3,"missing format specifier")},y=function(S,M,T){const A=M;if(A<8||A>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);if(A!==(S[2]<<8|S[3]))return a(3,"wrong scanline width");const R=new Uint8Array(4*M*T);if(!R.length)return a(4,"unable to allocate buffer space");let O=0,C=0;const P=4*A,k=new Uint8Array(4),X=new Uint8Array(P);let oe=T;for(;oe>0&&CS.byteLength)return a(1);if(k[0]=S[C++],k[1]=S[C++],k[2]=S[C++],k[3]=S[C++],k[0]!=2||k[1]!=2||(k[2]<<8|k[3])!=A)return a(3,"bad rgbe scanline format");let V=0,K;for(;V128;if(se&&(K-=128),K===0||V+K>P)return a(3,"bad scanline data");if(se){const F=S[C++];for(let $=0;$>3]&1<<(D&7))&&(B[ie++]=D);for(var W=ie-1;ie<65536;)B[ie++]=0;return W}function k(N){for(var B=0;B<16384;B++)N[B]={},N[B].len=0,N[B].lit=0,N[B].p=null}const X={l:0,c:0,lc:0};function oe(N,B,ie,D,W){for(;ie>ie&(1<0;--B){var D=ie+V[B]>>1;V[B]=ie,ie=D}for(var B=0;B<65537;++B){var W=N[B];W>0&&(N[B]=W|V[W]++<<6)}}function J(N,B,ie,D,W,Y,ne){for(var ee=ie,de=0,pe=0;W<=Y;W++){if(ee.value-ie.value>D)return!1;oe(6,de,pe,N,ee);var ye=X.l;if(de=X.c,pe=X.lc,ne[W]=ye,ye==63){if(ee.value-ie.value>D)throw"Something wrong with hufUnpackEncTable";oe(8,de,pe,N,ee);var ve=X.l+6;if(de=X.c,pe=X.lc,W+ve>Y+1)throw"Something wrong with hufUnpackEncTable";for(;ve--;)ne[W++]=0;W--}else if(ye>=59){var ve=ye-59+2;if(W+ve>Y+1)throw"Something wrong with hufUnpackEncTable";for(;ve--;)ne[W++]=0;W--}}K(ne)}function se(N){return N&63}function F(N){return N>>6}function $(N,B,ie,D){for(;B<=ie;B++){var W=F(N[B]),Y=se(N[B]);if(W>>Y)throw"Invalid table entry";if(Y>14){var ne=D[W>>Y-14];if(ne.len)throw"Invalid table entry";if(ne.lit++,ne.p){var ee=ne.p;ne.p=new Array(ne.lit);for(var de=0;de0;de--){var ne=D[(W<<14-Y)+pe];if(ne.len||ne.p)throw"Invalid table entry";ne.len=Y,ne.lit=B,pe++}}return!0}const j={c:0,lc:0};function H(N,B,ie,D){N=N<<8|Dt(ie,D),B+=8,j.c=N,j.lc=B}const Z={c:0,lc:0};function ge(N,B,ie,D,W,Y,ne,ee,de,pe){if(N==B){D<8&&(H(ie,D,W,ne),ie=j.c,D=j.lc),D-=8;var ye=ie>>D,ye=new Uint8Array([ye])[0];if(de.value+ye>pe)return!1;for(var ve=ee[de.value-1];ye-- >0;)ee[de.value++]=ve}else if(de.value32767?B-65536:B}const Se={a:0,b:0};function We(N,B){var ie=Ee(N),D=Ee(B),W=D,Y=ie+(W&1)+(W>>1),ne=Y,ee=Y-W;Se.a=ne,Se.b=ee}function Je(N,B){var ie=xe(N),D=xe(B),W=ie-(D>>1)&65535,Y=D+W-32768&65535;Se.a=Y,Se.b=W}function ft(N,B,ie,D,W,Y,ne){for(var ee=ne<16384,de=ie>W?W:ie,pe=1,ye;pe<=de;)pe<<=1;for(pe>>=1,ye=pe,pe>>=1;pe>=1;){for(var ve=0,nt=ve+Y*(W-ye),Oe=Y*pe,Ue=Y*ye,it=D*pe,mt=D*ye,vt,Ct,rt,Xe;ve<=nt;ve+=Ue){for(var Bt=ve,Et=ve+D*(ie-ye);Bt<=Et;Bt+=mt){var Mt=Bt+it,nn=Bt+Oe,Nn=nn+it;ee?(We(N[Bt+B],N[nn+B]),vt=Se.a,rt=Se.b,We(N[Mt+B],N[Nn+B]),Ct=Se.a,Xe=Se.b,We(vt,Ct),N[Bt+B]=Se.a,N[Mt+B]=Se.b,We(rt,Xe),N[nn+B]=Se.a,N[Nn+B]=Se.b):(Je(N[Bt+B],N[nn+B]),vt=Se.a,rt=Se.b,Je(N[Mt+B],N[Nn+B]),Ct=Se.a,Xe=Se.b,Je(vt,Ct),N[Bt+B]=Se.a,N[Mt+B]=Se.b,Je(rt,Xe),N[nn+B]=Se.a,N[Nn+B]=Se.b)}if(ie&pe){var nn=Bt+Oe;ee?We(N[Bt+B],N[nn+B]):Je(N[Bt+B],N[nn+B]),vt=Se.a,N[nn+B]=Se.b,N[Bt+B]=vt}}if(W&pe)for(var Bt=ve,Et=ve+D*(ie-ye);Bt<=Et;Bt+=mt){var Mt=Bt+it;ee?We(N[Bt+B],N[Mt+B]):Je(N[Bt+B],N[Mt+B]),vt=Se.a,N[Mt+B]=Se.b,N[Bt+B]=vt}ye=pe,pe>>=1}return ve}function At(N,B,ie,D,W,Y,ne,ee,de,pe){for(var ye=0,ve=0,nt=ee,Oe=Math.trunc(W.value+(Y+7)/8);W.value=14;){var Ue=ye>>ve-14&16383,it=B[Ue];if(it.len)ve-=it.len,ge(it.lit,ne,ye,ve,ie,D,W,de,pe,nt),ye=Z.c,ve=Z.lc;else{if(!it.p)throw"hufDecode issues";var mt;for(mt=0;mt=vt&&F(N[it.p[mt]])==(ye>>ve-vt&(1<>=Ct,ve-=Ct;ve>0;){var it=B[ye<<14-ve&16383];if(it.len)ve-=it.len,ge(it.lit,ne,ye,ve,ie,D,W,de,pe,nt),ye=Z.c,ve=Z.lc;else throw"hufDecode issues"}return!0}function Qe(N,B,ie,D,W,Y){var ne={value:0},ee=ie.value,de=Pe(B,ie),pe=Pe(B,ie);ie.value+=4;var ye=Pe(B,ie);if(ie.value+=4,de<0||de>=65537||pe<0||pe>=65537)throw"Something wrong with HUF_ENCSIZE";var ve=new Array(65537),nt=new Array(16384);k(nt);var Oe=D-(ie.value-ee);if(J(N,B,ie,Oe,de,pe,ve),ye>8*(D-(ie.value-ee)))throw"Something wrong with hufUncompress";$(ve,de,pe,nt),At(ve,nt,N,B,ie,ye,pe,Y,W,ne)}function Q(N,B,ie){for(var D=0;DY||(B[W++]=N[ie++],W>Y));)B[W++]=N[D++]}function De(N){for(var B=N.byteLength,ie=new Array,D=0,W=new DataView(N);B>0;){var Y=W.getInt8(D++);if(Y<0){var ne=-Y;B-=ne+1;for(var ee=0;ee>8==255?W+=D&255:(ie[W]=D,W++),N.value++}function je(N,B){B[0]=be(N[0]),B[1]=be(N[1]),B[2]=be(N[5]),B[3]=be(N[6]),B[4]=be(N[14]),B[5]=be(N[15]),B[6]=be(N[27]),B[7]=be(N[28]),B[8]=be(N[2]),B[9]=be(N[4]),B[10]=be(N[7]),B[11]=be(N[13]),B[12]=be(N[16]),B[13]=be(N[26]),B[14]=be(N[29]),B[15]=be(N[42]),B[16]=be(N[3]),B[17]=be(N[8]),B[18]=be(N[12]),B[19]=be(N[17]),B[20]=be(N[25]),B[21]=be(N[30]),B[22]=be(N[41]),B[23]=be(N[43]),B[24]=be(N[9]),B[25]=be(N[11]),B[26]=be(N[18]),B[27]=be(N[24]),B[28]=be(N[31]),B[29]=be(N[40]),B[30]=be(N[44]),B[31]=be(N[53]),B[32]=be(N[10]),B[33]=be(N[19]),B[34]=be(N[23]),B[35]=be(N[32]),B[36]=be(N[39]),B[37]=be(N[45]),B[38]=be(N[52]),B[39]=be(N[54]),B[40]=be(N[20]),B[41]=be(N[22]),B[42]=be(N[33]),B[43]=be(N[38]),B[44]=be(N[46]),B[45]=be(N[51]),B[46]=be(N[55]),B[47]=be(N[60]),B[48]=be(N[21]),B[49]=be(N[34]),B[50]=be(N[37]),B[51]=be(N[47]),B[52]=be(N[50]),B[53]=be(N[56]),B[54]=be(N[59]),B[55]=be(N[61]),B[56]=be(N[35]),B[57]=be(N[36]),B[58]=be(N[48]),B[59]=be(N[49]),B[60]=be(N[57]),B[61]=be(N[58]),B[62]=be(N[62]),B[63]=be(N[63])}function et(N){const B=.5*Math.cos(.7853975),ie=.5*Math.cos(3.14159/16),D=.5*Math.cos(3.14159/8),W=.5*Math.cos(3*3.14159/16),Y=.5*Math.cos(5*3.14159/16),ne=.5*Math.cos(3*3.14159/8),ee=.5*Math.cos(7*3.14159/16);for(var de=new Array(4),pe=new Array(4),ye=new Array(4),ve=new Array(4),nt=0;nt<8;++nt){var Oe=nt*8;de[0]=D*N[Oe+2],de[1]=ne*N[Oe+2],de[2]=D*N[Oe+6],de[3]=ne*N[Oe+6],pe[0]=ie*N[Oe+1]+W*N[Oe+3]+Y*N[Oe+5]+ee*N[Oe+7],pe[1]=W*N[Oe+1]-ee*N[Oe+3]-ie*N[Oe+5]-Y*N[Oe+7],pe[2]=Y*N[Oe+1]-ie*N[Oe+3]+ee*N[Oe+5]+W*N[Oe+7],pe[3]=ee*N[Oe+1]-Y*N[Oe+3]+W*N[Oe+5]-ie*N[Oe+7],ye[0]=B*(N[Oe+0]+N[Oe+4]),ye[3]=B*(N[Oe+0]-N[Oe+4]),ye[1]=de[0]+de[3],ye[2]=de[1]-de[2],ve[0]=ye[0]+ye[1],ve[1]=ye[3]+ye[2],ve[2]=ye[3]-ye[2],ve[3]=ye[0]-ye[1],N[Oe+0]=ve[0]+pe[0],N[Oe+1]=ve[1]+pe[1],N[Oe+2]=ve[2]+pe[2],N[Oe+3]=ve[3]+pe[3],N[Oe+4]=ve[3]-pe[3],N[Oe+5]=ve[2]-pe[2],N[Oe+6]=ve[1]-pe[1],N[Oe+7]=ve[0]-pe[0]}for(var Ue=0;Ue<8;++Ue)de[0]=D*N[16+Ue],de[1]=ne*N[16+Ue],de[2]=D*N[48+Ue],de[3]=ne*N[48+Ue],pe[0]=ie*N[8+Ue]+W*N[24+Ue]+Y*N[40+Ue]+ee*N[56+Ue],pe[1]=W*N[8+Ue]-ee*N[24+Ue]-ie*N[40+Ue]-Y*N[56+Ue],pe[2]=Y*N[8+Ue]-ie*N[24+Ue]+ee*N[40+Ue]+W*N[56+Ue],pe[3]=ee*N[8+Ue]-Y*N[24+Ue]+W*N[40+Ue]-ie*N[56+Ue],ye[0]=B*(N[Ue]+N[32+Ue]),ye[3]=B*(N[Ue]-N[32+Ue]),ye[1]=de[0]+de[3],ye[2]=de[1]-de[2],ve[0]=ye[0]+ye[1],ve[1]=ye[3]+ye[2],ve[2]=ye[3]-ye[2],ve[3]=ye[0]-ye[1],N[0+Ue]=ve[0]+pe[0],N[8+Ue]=ve[1]+pe[1],N[16+Ue]=ve[2]+pe[2],N[24+Ue]=ve[3]+pe[3],N[32+Ue]=ve[3]-pe[3],N[40+Ue]=ve[2]-pe[2],N[48+Ue]=ve[1]-pe[1],N[56+Ue]=ve[0]-pe[0]}function dt(N){for(var B=0;B<64;++B){var ie=N[0][B],D=N[1][B],W=N[2][B];N[0][B]=ie+1.5747*W,N[1][B]=ie-.1873*D-.4682*W,N[2][B]=ie+1.8556*D}}function xt(N,B,ie){for(var D=0;D<64;++D)B[ie+D]=ul.toHalfFloat(qt(N[D]))}function qt(N){return N<=1?Math.sign(N)*Math.pow(Math.abs(N),2.2):Math.sign(N)*Math.pow(C,Math.abs(N)-1)}function z(N){return new DataView(N.array.buffer,N.offset.value,N.size)}function U(N){var B=N.viewer.buffer.slice(N.offset.value,N.offset.value+N.size),ie=new Uint8Array(De(B)),D=new Uint8Array(ie.length);return Le(ie),we(ie,D),new DataView(D.buffer)}function ue(N){var B=N.array.slice(N.offset.value,N.offset.value+N.size),ie=gm(B),D=new Uint8Array(ie.length);return Le(ie),we(ie,D),new DataView(D.buffer)}function Ie(N){for(var B=N.viewer,ie={value:N.offset.value},D=new Uint16Array(N.width*N.scanlineBlockSize*(N.channels*N.type)),W=new Uint8Array(8192),Y=0,ne=new Array(N.channels),ee=0;ee=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(de<=pe)for(var ee=0;ee0;){var ee=Ze(B.buffer,ie),de=re(B,ie),pe=de>>2&3,ye=(de>>4)-1,ve=new Int8Array([ye])[0],nt=re(B,ie);Y.push({name:ee,index:ve,type:nt,compression:pe}),ne-=ee.length+3}for(var Oe=qr.channels,Ue=new Array(N.channels),it=0;it=0&&(Ct.idx[Xe.index]=rt),mt.offset=rt)}if(W.acCompressedSize>0)switch(W.acCompression){case 0:var Mt=new Uint16Array(W.totalAcUncompressedCount);Qe(N.array,B,ie,W.acCompressedSize,Mt,W.totalAcUncompressedCount);break;case 1:var Bt=N.array.slice(ie.value,ie.value+W.totalAcUncompressedCount),Et=gm(Bt),Mt=new Uint16Array(Et.buffer);ie.value+=W.totalAcUncompressedCount;break}if(W.dcCompressedSize>0){var nn={array:N.array,offset:ie,size:W.dcCompressedSize},Nn=new Uint16Array(ue(nn).buffer);ie.value+=W.dcCompressedSize}if(W.rleRawSize>0){var Bt=N.array.slice(ie.value,ie.value+W.rleCompressedSize),Et=gm(Bt),xn=De(Et.buffer);ie.value+=W.rleCompressedSize}for(var jt=0,Vt=new Array(Ue.length),it=0;it>10,ie=N&1023;return(N>>15?-1:1)*(B?B===31?ie?NaN:1/0:Math.pow(2,B-15)*(1+ie/1024):6103515625e-14*(ie/1024))}function ae(N,B){var ie=N.getUint16(B.value,!0);return B.value+=2,ie}function Ge(N,B){return be(ae(N,B))}function He(N,B,ie,D){for(var W=ie.value,Y=[];ie.valueLt.height?Lt.height-B:Lt.scanlineBlockSize;const D=Lt.size=Lt.height)break;for(let ne=0;ne{const h=zS.clone({[u]:{value:d}});return{...l,...h}},{}),vertexShader:e,fragmentShader:n}),this.key="",a.forEach(([l])=>Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:u=>this.uniforms[l].value=u})),Object.assign(this,s),r&&r(this)}};return i.key=u3.generateUUID(),i}const kA=t=>t===Object(t)&&!Array.isArray(t)&&typeof t!="function";function ww(t,e){const n=Tr(i=>i.gl),r=Eu(T0,kA(t)?Object.values(t):t);if(L.useLayoutEffect(()=>{e==null||e(r)},[e]),L.useEffect(()=>{"initTexture"in n&&(Array.isArray(r)?r:[r]).forEach(n.initTexture)},[n,r]),kA(t)){const i=Object.keys(t),o={};return i.forEach(s=>Object.assign(o,{[s]:r[i.indexOf(s)]})),o}else return r}ww.preload=t=>Eu.preload(T0,t);ww.clear=t=>Eu.clear(T0,t);function i1(t,e,n){const r=Tr(p=>p.size),i=Tr(p=>p.viewport),o=typeof t=="number"?t:r.width*i.dpr,s=typeof e=="number"?e:r.height*i.dpr,a=(typeof t=="number"?n:t)||{},{samples:l=0,depth:u,...d}=a,h=L.useMemo(()=>{const p=new ji(o,s,{minFilter:un,magFilter:un,type:Pr,...d});return u&&(p.depthTexture=new GS(o,s,cr)),p.samples=l,p},[]);return L.useLayoutEffect(()=>{h.setSize(o,s),l&&(h.samples=l)},[l,h,o,s]),L.useEffect(()=>()=>h.dispose(),[]),h}const z8=L.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:o=!1,onChange:s,onStart:a,onEnd:l,...u},d)=>{const h=Tr(A=>A.invalidate),p=Tr(A=>A.camera),g=Tr(A=>A.gl),y=Tr(A=>A.events),w=Tr(A=>A.setEvents),x=Tr(A=>A.set),m=Tr(A=>A.get),_=Tr(A=>A.performance),S=e||p,M=r||y.connected||g.domElement,T=L.useMemo(()=>new k8(S),[S]);return oh(()=>{T.enabled&&T.update()},-1),L.useEffect(()=>(o&&T.connect(o===!0?M:o),T.connect(M),()=>void T.dispose()),[o,M,n,T,h]),L.useEffect(()=>{const A=C=>{h(),n&&_.regress(),s&&s(C)},R=C=>{a&&a(C)},O=C=>{l&&l(C)};return T.addEventListener("change",A),T.addEventListener("start",R),T.addEventListener("end",O),()=>{T.removeEventListener("start",R),T.removeEventListener("end",O),T.removeEventListener("change",A)}},[s,a,l,T,h,w]),L.useEffect(()=>{if(t){const A=m().controls;return x({controls:T}),()=>x({controls:A})}},[t,T]),L.createElement("primitive",_n({ref:d,object:T,enableDamping:i},u))}),B8=Sw({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");class H8 extends nw{constructor(e=6,n=!1){super(),this.uniforms={chromaticAberration:{value:.05},transmission:{value:0},_transmission:{value:1},transmissionMap:{value:null},roughness:{value:0},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:1/0},attenuationColor:{value:new tt("white")},anisotropicBlur:{value:.1},time:{value:0},distortion:{value:0},distortionScale:{value:.5},temporalDistortion:{value:0},buffer:{value:null}},this.onBeforeCompile=r=>{r.uniforms={...r.uniforms,...this.uniforms},this.anisotropy>0&&(r.defines.USE_ANISOTROPY=""),n?r.defines.USE_SAMPLER="":r.defines.USE_TRANSMISSION="",r.fragmentShader=` uniform float chromaticAberration; uniform float anisotropicBlur; uniform float time; uniform float distortion; uniform float distortionScale; uniform float temporalDistortion; uniform sampler2D buffer; vec3 random3(vec3 c) { float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); vec3 r; r.z = fract(512.0*j); j *= .125; r.x = fract(512.0*j); j *= .125; r.y = fract(512.0*j); return r-0.5; } float seed = 0.0; uint hash( uint x ) { x += ( x << 10u ); x ^= ( x >> 6u ); x += ( x << 3u ); x ^= ( x >> 11u ); x += ( x << 15u ); return x; } // Compound versions of the hashing algorithm I whipped together. uint hash( uvec2 v ) { return hash( v.x ^ hash(v.y) ); } uint hash( uvec3 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ); } uint hash( uvec4 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ^ hash(v.w) ); } // Construct a float with half-open range [0:1] using low 23 bits. // All zeroes yields 0.0, all ones yields the next smallest representable value below 1.0. float floatConstruct( uint m ) { const uint ieeeMantissa = 0x007FFFFFu; // binary32 mantissa bitmask const uint ieeeOne = 0x3F800000u; // 1.0 in IEEE binary32 m &= ieeeMantissa; // Keep only mantissa bits (fractional part) m |= ieeeOne; // Add fractional part to 1.0 float f = uintBitsToFloat( m ); // Range [1:2] return f - 1.0; // Range [0:1] } // Pseudo-random value in half-open range [0:1]. float random( float x ) { return floatConstruct(hash(floatBitsToUint(x))); } float random( vec2 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float random( vec3 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float random( vec4 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float rand() { float result = random(vec3(gl_FragCoord.xy, seed)); seed += 1.0; return result; } const float F3 = 0.3333333; const float G3 = 0.1666667; float snoise(vec3 p) { vec3 s = floor(p + dot(p, vec3(F3))); vec3 x = p - s + dot(s, vec3(G3)); vec3 e = step(vec3(0.0), x - x.yzx); vec3 i1 = e*(1.0 - e.zxy); vec3 i2 = 1.0 - e.zxy*(1.0 - e); vec3 x1 = x - i1 + G3; vec3 x2 = x - i2 + 2.0*G3; vec3 x3 = x - 1.0 + 3.0*G3; vec4 w, d; w.x = dot(x, x); w.y = dot(x1, x1); w.z = dot(x2, x2); w.w = dot(x3, x3); w = max(0.6 - w, 0.0); d.x = dot(random3(s), x); d.y = dot(random3(s + i1), x1); d.z = dot(random3(s + i2), x2); d.w = dot(random3(s + 1.0), x3); w *= w; w *= w; d *= w; return dot(d, vec4(52.0)); } float snoiseFractal(vec3 m) { return 0.5333333* snoise(m) +0.2666667* snoise(2.0*m) +0.1333333* snoise(4.0*m) +0.0666667* snoise(8.0*m); } `+r.fragmentShader,r.fragmentShader=r.fragmentShader.replace("#include ",` #ifdef USE_TRANSMISSION // Transmission code is based on glTF-Sampler-Viewer // https://github.com/KhronosGroup/glTF-Sample-Viewer uniform float _transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { // Direction of refracted light. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); // Compute rotation-independant scaling of the model matrix. vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); // The thickness is specified in local space. return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and // an IOR of 1.5 results in the default amount of microfacet refraction. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); #ifdef USE_SAMPLER #ifdef texture2DLodEXT return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod); #else return texture2D(transmissionSamplerMap, fragCoord.xy, framebufferLod); #endif #else return texture2D(buffer, fragCoord.xy); #endif } vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { // Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all. return radiance; } else { // Compute light attenuation using Beer's law. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law return transmittance * radiance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; // Sample framebuffer to get pixel the refracted ray hits. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); // Get the specular component. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } #endif `),r.fragmentShader=r.fragmentShader.replace("#include ",` // Improve the refraction to use the world pos material.transmission = _transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec3 transmission = vec3(0.0); float transmissionR, transmissionB, transmissionG; float randomCoords = rand(); float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropicBlur); vec3 distortionNormal = vec3(0.0); vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion; if (distortion > 0.0) { distortionNormal = distortion * vec3(snoiseFractal(vec3((pos * distortionScale + temporalOffset))), snoiseFractal(vec3(pos.zxy * distortionScale - temporalOffset)), snoiseFractal(vec3(pos.yxz * distortionScale + temporalOffset))); } for (float i = 0.0; i < ${e}.0; i ++) { vec3 sampleNorm = normalize(n + roughnessFactor * roughnessFactor * 2.0 * normalize(vec3(rand() - 0.5, rand() - 0.5, rand() - 0.5)) * pow(rand(), 0.33) + distortionNormal); transmissionR = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).r; transmissionG = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + chromaticAberration * (i + randomCoords) / float(${e})) , material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).g; transmissionB = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + 2.0 * chromaticAberration * (i + randomCoords) / float(${e})), material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).b; transmission.r += transmissionR; transmission.g += transmissionG; transmission.b += transmissionB; } transmission /= ${e}.0; totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); `)},Object.keys(this.uniforms).forEach(r=>Object.defineProperty(this,r,{get:()=>this.uniforms[r].value,set:i=>this.uniforms[r].value=i}))}}const V8=L.forwardRef(({buffer:t,transmissionSampler:e=!1,backside:n=!1,side:r=Bo,transmission:i=1,thickness:o=0,backsideThickness:s=0,samples:a=10,resolution:l,backsideResolution:u,background:d,anisotropy:h,anisotropicBlur:p,...g},y)=>{rh({MeshTransmissionMaterial:H8});const w=L.useRef(null),[x]=L.useState(()=>new B8),m=i1(u||l),_=i1(l);let S,M,T;return oh(A=>{w.current.time=A.clock.getElapsedTime(),w.current.buffer===_.texture&&!e&&(T=w.current.__r3f.parent,T&&(M=A.gl.toneMapping,S=A.scene.background,A.gl.toneMapping=fo,d&&(A.scene.background=d),T.material=x,n&&(A.gl.setRenderTarget(m),A.gl.render(A.scene,A.camera),T.material=w.current,T.material.buffer=m.texture,T.material.thickness=s,T.material.side=Lr),A.gl.setRenderTarget(_),A.gl.render(A.scene,A.camera),T.material=w.current,T.material.thickness=o,T.material.side=r,T.material.buffer=_.texture,A.scene.background=S,A.gl.setRenderTarget(null),A.gl.toneMapping=M))}),L.useImperativeHandle(y,()=>w.current,[]),L.createElement("meshTransmissionMaterial",_n({args:[a,e],ref:w},g,{buffer:t||_.texture,_transmission:i,anisotropicBlur:p??h,transmission:e?i:0,thickness:o,side:r}))}),Io=1e-5;function W8(t,e,n){const r=new pa,i=n-Io;return r.absarc(Io,Io,Io,-Math.PI/2,-Math.PI,!0),r.absarc(Io,e-i*2,Io,Math.PI,Math.PI/2,!0),r.absarc(t-i*2,e-i*2,Io,Math.PI/2,0,!0),r.absarc(t-i*2,Io,Io,0,-Math.PI/2,!0),r}const G8=L.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:o=1,smoothness:s=4,bevelSegments:a=4,creaseAngle:l=.4,children:u,...d},h){const p=L.useMemo(()=>W8(e,n,i),[e,n,i]),g=L.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:a*2,steps:o,bevelSize:i-Io,bevelThickness:i,curveSegments:s}),[r,i,s]),y=L.useRef(null);return L.useLayoutEffect(()=>{y.current&&(y.current.center(),v8(y.current,l))},[p,g]),L.createElement("mesh",_n({ref:h},d),L.createElement("extrudeGeometry",{ref:y,args:[p,g]}),u)}),o_={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},$8="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",UA=t=>Array.isArray(t);function KI({files:t=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],path:e="",preset:n=void 0,encoding:r=void 0,extensions:i}={}){var o;let s=null,a=!1,l;if(n){if(!(n in o_))throw new Error("Preset must be one of: "+Object.keys(o_).join(", "));t=o_[n],e=$8}if(a=UA(t),l=UA(t)?"cube":t.startsWith("data:application/exr")?"exr":t.startsWith("data:application/hdr")?"hdr":(o=t.split(".").pop())==null||(o=o.split("?"))==null||(o=o.shift())==null?void 0:o.toLowerCase(),s=a?nI:l==="hdr"?U8:l==="exr"?F8:null,!s)throw new Error("useEnvironment: Unrecognized file extension: "+t);const u=Eu(s,a?[t]:t,g=>{g.setPath==null||g.setPath(e),i&&i(g)}),d=a?u[0]:u;d.mapping=a?Ho:lu;const h=3001,p=3e3;return"colorSpace"in d?d.colorSpace=r??a?"srgb":"srgb-linear":d.encoding=r??a?h:p,d}const j8=t=>t.current&&t.current.isScene,X8=t=>j8(t)?t.current:t;function Ew(t,e,n,r,i=0){const o=X8(e||n),s=o.background,a=o.environment,l=o.backgroundBlurriness||0;return t!=="only"&&(o.environment=r),t&&(o.background=r),t&&o.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=i),()=>{t!=="only"&&(o.environment=a),t&&(o.background=s),t&&o.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=l)}}function Mw({scene:t,background:e=!1,blur:n,map:r}){const i=Tr(o=>o.scene);return L.useLayoutEffect(()=>{if(r)return Ew(e,t,i,r,n)},[i,t,r,e,n]),null}function JI({background:t=!1,scene:e,blur:n,...r}){const i=KI(r),o=Tr(s=>s.scene);return L.useLayoutEffect(()=>Ew(t,e,o,i,n),[i,t,e,o,n]),null}function Y8({children:t,near:e=1,far:n=1e3,resolution:r=256,frames:i=1,map:o,background:s=!1,blur:a,scene:l,files:u,path:d,preset:h=void 0,extensions:p}){const g=Tr(S=>S.gl),y=Tr(S=>S.scene),w=L.useRef(null),[x]=L.useState(()=>new Md),m=L.useMemo(()=>{const S=new BS(r);return S.texture.type=Pr,S},[r]);L.useLayoutEffect(()=>(i===1&&w.current.update(g,x),Ew(s,l,y,m.texture,a)),[t,x,m.texture,l,y,s,i,g]);let _=1;return oh(()=>{(i===1/0||_rh({GroundProjectedEnvImpl:L8}),[]);const a=L.useMemo(()=>[s],[s]),l=(e=t.ground)==null?void 0:e.height,u=(n=t.ground)==null?void 0:n.radius,d=(r=(i=t.ground)==null?void 0:i.scale)!==null&&r!==void 0?r:1e3;return L.createElement(L.Fragment,null,L.createElement(Mw,_n({},t,{map:s})),L.createElement("groundProjectedEnvImpl",{args:a,scale:d,height:l,radius:u}))}function Z8(t){return t.ground?L.createElement(q8,t):t.map?L.createElement(Mw,t):t.children?L.createElement(Y8,t):L.createElement(JI,t)}var QI={exports:{}},K8="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",J8=K8,Q8=J8;function eL(){}function tL(){}tL.resetWarningCache=eL;var eW=function(){function t(r,i,o,s,a,l){if(l!==Q8){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:tL,resetWarningCache:eL};return n.PropTypes=n,n};QI.exports=eW();var tW=QI.exports;const dn=mu(tW),nW=Sw({viewport:new Float32Array([1980,1080]),focal:1e3,centerAndScaleTexture:null,covAndColorTexture:null,gsProjectionMatrix:new wt,gsModelViewMatrix:new wt},` precision highp sampler2D; precision highp usampler2D; out vec4 vColor; out vec2 vPosition; uniform vec2 viewport; uniform float focal; uniform mat4 gsProjectionMatrix; uniform mat4 gsModelViewMatrix; attribute uint splatIndex; uniform sampler2D centerAndScaleTexture; uniform usampler2D covAndColorTexture; vec2 unpackInt16(in uint value) { int v = int(value); int v0 = v >> 16; int v1 = (v & 0xFFFF); if((v & 0x8000) != 0) v1 |= 0xFFFF0000; return vec2(float(v1), float(v0)); } void main () { ivec2 texSize = textureSize(centerAndScaleTexture, 0); ivec2 texPos = ivec2(splatIndex%uint(texSize.x), splatIndex/uint(texSize.x)); vec4 centerAndScaleData = texelFetch(centerAndScaleTexture, texPos, 0); vec4 center = vec4(centerAndScaleData.xyz, 1); vec4 camspace = gsModelViewMatrix * center; vec4 pos2d = gsProjectionMatrix * camspace; float bounds = 1.2 * pos2d.w; if (pos2d.z < -pos2d.w || pos2d.x < -bounds || pos2d.x > bounds || pos2d.y < -bounds || pos2d.y > bounds) { gl_Position = vec4(0.0, 0.0, 2.0, 1.0); return; } uvec4 covAndColorData = texelFetch(covAndColorTexture, texPos, 0); vec2 cov3D_M11_M12 = unpackInt16(covAndColorData.x) * centerAndScaleData.w; vec2 cov3D_M13_M22 = unpackInt16(covAndColorData.y) * centerAndScaleData.w; vec2 cov3D_M23_M33 = unpackInt16(covAndColorData.z) * centerAndScaleData.w; mat3 Vrk = mat3( cov3D_M11_M12.x, cov3D_M11_M12.y, cov3D_M13_M22.x, cov3D_M11_M12.y, cov3D_M13_M22.y, cov3D_M23_M33.x, cov3D_M13_M22.x, cov3D_M23_M33.x, cov3D_M23_M33.y ); mat3 J = mat3( focal / camspace.z, 0., -(focal * camspace.x) / (camspace.z * camspace.z), 0., -focal / camspace.z, (focal * camspace.y) / (camspace.z * camspace.z), 0., 0., 0. ); mat3 W = transpose(mat3(gsModelViewMatrix)); mat3 T = W * J; mat3 cov = transpose(T) * Vrk * T; vec2 vCenter = vec2(pos2d) / pos2d.w; float diagonal1 = cov[0][0] + 0.3; float offDiagonal = cov[0][1]; float diagonal2 = cov[1][1] + 0.3; float mid = 0.5 * (diagonal1 + diagonal2); float radius = length(vec2((diagonal1 - diagonal2) / 2.0, offDiagonal)); float lambda1 = mid + radius; float lambda2 = max(mid - radius, 0.1); vec2 diagonalVector = normalize(vec2(offDiagonal, lambda1 - diagonal1)); vec2 v1 = min(sqrt(2.0 * lambda1), 1024.0) * diagonalVector; vec2 v2 = min(sqrt(2.0 * lambda2), 1024.0) * vec2(diagonalVector.y, -diagonalVector.x); uint colorUint = covAndColorData.w; vColor = vec4( float(colorUint & uint(0xFF)) / 255.0, float((colorUint >> uint(8)) & uint(0xFF)) / 255.0, float((colorUint >> uint(16)) & uint(0xFF)) / 255.0, float(colorUint >> uint(24)) / 255.0 ); vPosition = position.xy; gl_Position = vec4( vCenter + position.x * v2 / viewport * 2.0 + position.y * v1 / viewport * 2.0, pos2d.z / pos2d.w, 1.0); } `,` in vec4 vColor; in vec2 vPosition; void main () { float A = -dot(vPosition, vPosition); if (A < -4.0) discard; float B = exp(A) * vColor.a; gl_FragColor = vec4(vColor.rgb, B); } `);function rW(t){let e;const n=function(s,a,l,u){const d=1/(s[3]*a+s[7]*l+s[11]*u+s[15]);return[(s[0]*a+s[4]*l+s[8]*u+s[12])*d,(s[1]*a+s[5]*l+s[9]*u+s[13])*d,(s[2]*a+s[6]*l+s[10]*u+s[14])*d]},r=function(s,a){return s[0]*a[0]+s[1]*a[1]+s[2]*a[2]},i=function(s,a,l=void 0){const u=s.length/16;let d=-1e-4,h=-1/0,p=1/0,g=new Float32Array(u),y=new Int32Array(g.buffer),w=new Int32Array(u),x=0;for(let T=0;T.5||k[1]<-.5||k[1]>.5||k[2]<-.5||k[2]>.5)&&(R=!1)}A<0&&s[T*16+15]>d*A&&R&&(g[x]=A,w[x]=T,x++,A>h&&(h=A),A{if(o.data.method=="clear"&&(e=void 0),o.data.method=="push"){const s=new Float32Array(o.data.matrices);e===void 0?e=s:(resized=new Float32Array(e.length+s.length),resized.set(e),resized.set(s,e.length),e=resized)}if(o.data.method=="sort")if(e===void 0){const s=new Uint32Array(1);t.postMessage({sortedIndexes:s},[s.buffer])}else{const s=new Float32Array(o.data.view),a=i(e,s,void 0);t.postMessage({sortedIndexes:a},[a.buffer])}}}let iW=L.forwardRef(function({src:e,...n},r){rh({SplatMaterial:nW});const i=L.useMemo(()=>new Worker(URL.createObjectURL(new Blob(["(",rW.toString(),")(self)"],{type:"application/javascript"}))),[e]),o=L.useRef(),{gl:s,camera:a}=Tr(),[l]=L.useState(()=>s.getContext()),u=L.useMemo(()=>({ready:!1,loadedVertexCount:0,rowLength:3*4+3*4+4+4,maxVertexes:0,bufferTextureWidth:0,bufferTextureHeight:0,centerAndScaleData:null,covAndColorData:null,centerAndScaleTexture:null}),[e]);L.useEffect(()=>{i.postMessage({method:"clear"});async function x(){const M=await fetch(e),T=M.body.getReader();let A=!1,R=0,O=0,C=M.headers.get("Content-Length"),P=C?parseInt(C):void 0;if(P!=null){let K=Math.floor(P/u.rowLength);await m(K),A=!0}const k=[],X=Date.now();let oe=0,V=e.endsWith(".ply");for(;;)try{const{value:K,done:J}=await T.read();if(J)break;if(R+=K.length,P!=null){const F=R/1024/1024/((Date.now()-X)/1e3),$=R/P*100;$-oe>1&&(oe=$)}k.push(K);const se=R-O;if(!V&&P!=null&&se>u.rowLength){let F=Math.floor(se/u.rowLength);const $=new Uint8Array(se);let j=0;for(const Z of k)$.set(Z,j),j+=Z.length;if(k.length=0,se>F*u.rowLength){const Z=new Uint8Array(se-F*u.rowLength);Z.set($.subarray(se-Z.length,se),0),k.push(Z)}const H=new Uint8Array(F*u.rowLength);H.set($.subarray(0,H.byteLength),0),_(H.buffer,F),O+=F*u.rowLength}}catch(K){console.error(K);break}if(R-O>0){let K=new Uint8Array(k.reduce((F,$)=>F+$.length,0)),J=0;for(const F of k)K.set(F,J),J+=F.length;V&&(K=new Uint8Array(S(K.buffer)));let se=Math.floor(K.byteLength/u.rowLength);A||(await m(se),A=!0),_(K.buffer,se)}}async function m(M){let T=l.getParameter(l.MAX_TEXTURE_SIZE);u.maxVertexes=T*T,M>u.maxVertexes&&(M=u.maxVertexes),u.bufferTextureWidth=T,u.bufferTextureHeight=Math.floor((M-1)/T)+1,u.centerAndScaleData=new Float32Array(u.bufferTextureWidth*u.bufferTextureHeight*4),u.covAndColorData=new Uint32Array(u.bufferTextureWidth*u.bufferTextureHeight*4),u.centerAndScaleTexture=new ha(u.centerAndScaleData,u.bufferTextureWidth,u.bufferTextureHeight,Rr,cr),u.centerAndScaleTexture.needsUpdate=!0,u.covAndColorTexture=new ha(u.covAndColorData,u.bufferTextureWidth,u.bufferTextureHeight,n0,Oo),u.covAndColorTexture.internalFormat="RGBA32UI",u.covAndColorTexture.needsUpdate=!0;let A=new Uint32Array(u.bufferTextureWidth*u.bufferTextureHeight);const R=new Cl(A,1,!1);R.setUsage(l3);const O=new cw,C=new Float32Array(6*3),P=new sn(C,3);for(O.setAttribute("position",P),P.setXYZ(2,-2,2,0),P.setXYZ(1,2,2,0),P.setXYZ(0,-2,-2,0),P.setXYZ(5,-2,-2,0),P.setXYZ(4,2,2,0),P.setXYZ(3,2,-2,0),P.needsUpdate=!0,O.setAttribute("splatIndex",R),O.instanceCount=1,r.current.geometry=O,r.current.material.centerAndScaleTexture=u.centerAndScaleTexture,r.current.material.covAndColorTexture=u.covAndColorTexture,i.onmessage=k=>{if(r.current){let X=new Uint32Array(k.data.sortedIndexes);r.current.geometry.attributes.splatIndex.set(X),r.current.geometry.attributes.splatIndex.needsUpdate=!0,r.current.geometry.instanceCount=X.length,u.sortReady=!0}};;){const k=s.properties.get(u.centerAndScaleTexture);if(s.properties.get(u.covAndColorTexture),k!=null&&k.__webglTexture&&(k!=null&&k.__webglTexture))break;await new Promise(X=>setTimeout(X,10))}u.sortReady=!0}function _(M,T){if(u.loadedVertexCount+T>u.maxVertexes&&(T=u.maxVertexes-u.loadedVertexCount),T<=0)return;let A=new Uint8Array(M),R=new Float32Array(M),O=new Float32Array(T*16);const C=new Uint8Array(u.covAndColorData.buffer),P=new Int16Array(u.covAndColorData.buffer);for(let k=0;kF&&(F=Math.abs(K.elements[se[j]]));let $=u.loadedVertexCount*4+k*4;u.centerAndScaleData[$+0]=oe.x,u.centerAndScaleData[$+1]=oe.y,u.centerAndScaleData[$+2]=oe.z,u.centerAndScaleData[$+3]=F/32767,$=u.loadedVertexCount*8+k*4*2;for(let j=0;j0;){let k=0,X=0,oe=u.loadedVertexCount%u.bufferTextureWidth,V=Math.floor(u.loadedVertexCount/u.bufferTextureWidth);u.loadedVertexCount%u.bufferTextureWidth!=0?(k=Math.min(u.bufferTextureWidth,oe+T)-oe,X=1):Math.floor(T/u.bufferTextureWidth)>0?(k=u.bufferTextureWidth,X=Math.floor(T/u.bufferTextureWidth)):(k=T%u.bufferTextureWidth,X=1);const K=s.properties.get(u.centerAndScaleTexture);l.bindTexture(l.TEXTURE_2D,K.__webglTexture),l.texSubImage2D(l.TEXTURE_2D,0,oe,V,k,X,l.RGBA,l.FLOAT,u.centerAndScaleData,u.loadedVertexCount*4);const J=s.properties.get(u.covAndColorTexture);l.bindTexture(l.TEXTURE_2D,J.__webglTexture),l.texSubImage2D(l.TEXTURE_2D,0,oe,V,k,X,l.RGBA_INTEGER,l.UNSIGNED_INT,u.covAndColorData,u.loadedVertexCount*4),u.loadedVertexCount+=k*X,T-=k*X}i.postMessage({method:"push",matrices:O.buffer},[O.buffer])}function S(M){const T=new Uint8Array(M),A=new TextDecoder().decode(T.slice(0,1024*10)),R=`end_header `,O=A.indexOf(R);if(O<0)throw new Error("Unable to read .ply file header");const C=parseInt(/element vertex (\d+)\n/.exec(A)[1]);let P=0,k={},X={};const oe={double:"getFloat64",int:"getInt32",uint:"getUint32",float:"getFloat32",short:"getInt16",ushort:"getUint16",uchar:"getUint8"};for(let H of A.slice(0,O).split(` `).filter(Z=>Z.startsWith("property "))){const[Z,ge,xe]=H.split(" "),Ee=oe[ge]||"getInt8";X[xe]=Ee,k[xe]=P,P+=parseInt(Ee.replace(/[^\d]/g,""))/8}let V=new DataView(M,O+R.length),K=0;const J=new Proxy({},{get(H,Z){if(!X[Z])throw new Error(Z+" not found");return V[X[Z]](K*P+k[Z],!0)}});console.time("calculate importance");let se=new Float32Array(C),F=new Uint32Array(C);for(K=0;Kse[Z]-se[H]),console.timeEnd("sort");const $=3*4+3*4+4+4,j=new ArrayBuffer($*C);console.time("build buffer");for(let H=0;H{a.updateMatrixWorld();let _=h();r.current.material.gsProjectionMatrix=_,r.current.material.gsModelViewMatrix=y(),s.getCurrentViewport(w);const S=w.w/2*Math.abs(_.elements[5]);if(r.current.material.viewport[0]=w.z,r.current.material.viewport[1]=w.w,r.current.material.focal=S,u.sortReady){u.sortReady=!1;let M=y().elements,T=new Float32Array([M[2],M[6],M[10],M[14]]);i.postMessage({method:"sort",view:T.buffer,cutout:void 0},[T.buffer])}}),wn.jsx("group",{ref:o,frustumCulled:!1,...n,children:wn.jsx("mesh",{ref:r,frustumCulled:!1,children:wn.jsx("splatMaterial",{transparent:!0,depthWrite:!1,depthTest:!0,blending:wS,blendSrcAlpha:ES})})})});function oW(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function nL(...t){return e=>t.forEach(n=>oW(n,e))}function Mu(...t){return L.useCallback(nL(...t),t)}const rL=L.forwardRef((t,e)=>{const{children:n,...r}=t,i=L.Children.toArray(n),o=i.find(sW);if(o){const s=o.props.children,a=i.map(l=>l===o?L.Children.count(s)>1?L.Children.only(null):L.isValidElement(s)?s.props.children:null:l);return L.createElement(o1,_n({},r,{ref:e}),L.isValidElement(s)?L.cloneElement(s,void 0,a):null)}return L.createElement(o1,_n({},r,{ref:e}),n)});rL.displayName="Slot";const o1=L.forwardRef((t,e)=>{const{children:n,...r}=t;return L.isValidElement(n)?L.cloneElement(n,{...aW(r,n.props),ref:e?nL(e,n.ref):n.ref}):L.Children.count(n)>1?L.Children.only(null):null});o1.displayName="SlotClone";const iL=({children:t})=>L.createElement(L.Fragment,null,t);function sW(t){return L.isValidElement(t)&&t.type===iL}function aW(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}const lW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Bl=lW.reduce((t,e)=>{const n=L.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?rL:e;return L.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),L.createElement(a,_n({},s,{ref:i}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function cW(t,e){t&&Gd.flushSync(()=>t.dispatchEvent(e))}const uW=L.forwardRef((t,e)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=t;return r?lP.createPortal(L.createElement(Bl.div,_n({},i,{ref:e})),r):null}),fW=uW;var FA=Object.prototype.hasOwnProperty;function Od(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Od(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(FA.call(t,n)&&++r&&!FA.call(e,n)||!(n in e)||!Od(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var R0=function(e,n,r,i){this.name=e,this.fn=n,this.args=r,this.modifiers=i};R0.prototype._test=function(e){var n=this.fn;try{Qc(this.modifiers.slice(),n,this)(e)}catch{n=function(){return!1}}try{return Qc(this.modifiers.slice(),n,this)(e)}catch{return!1}};R0.prototype._check=function(e){try{Qc(this.modifiers.slice(),this.fn,this)(e)}catch{if(Qc(this.modifiers.slice(),function(r){return r},this)(!1))return}if(!Qc(this.modifiers.slice(),this.fn,this)(e))throw null};R0.prototype._testAsync=function(e){var n=this;return new Promise(function(r,i){sL(n.modifiers.slice(),n.fn,n)(e).then(function(o){o?r(e):i(null)}).catch(function(o){return i(o)})})};function oL(t,e){return e===void 0&&(e="simple"),typeof t=="object"?t[e]:t}function Qc(t,e,n){if(t.length){var r=t.shift(),i=Qc(t,e,n);return r.perform(i,n)}else return oL(e)}function sL(t,e,n){if(t.length){var r=t.shift(),i=sL(t,e,n);return r.performAsync(i,n)}else return function(o){return Promise.resolve(oL(e,"async")(o))}}var dW=function(e,n,r){this.name=e,this.perform=n,this.performAsync=r},bw=function(t){function e(n,r,i,o){for(var s=[],a=arguments.length-4;a-- >0;)s[a]=arguments[a+4];t.call(this,s),t.captureStackTrace&&t.captureStackTrace(this,e),this.rule=n,this.value=r,this.cause=i,this.target=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Wo=function(e,n){e===void 0&&(e=[]),n===void 0&&(n=[]),this.chain=e,this.nextRuleModifiers=n};Wo.prototype._applyRule=function(e,n){var r=this;return function(){for(var i=[],o=arguments.length;o--;)i[o]=arguments[o];return r.chain.push(new R0(n,e.apply(r,i),i,r.nextRuleModifiers)),r.nextRuleModifiers=[],r}};Wo.prototype._applyModifier=function(e,n){return this.nextRuleModifiers.push(new dW(n,e.simple,e.async)),this};Wo.prototype._clone=function(){return new Wo(this.chain.slice(),this.nextRuleModifiers.slice())};Wo.prototype.test=function(e){return this.chain.every(function(n){return n._test(e)})};Wo.prototype.testAll=function(e){var n=[];return this.chain.forEach(function(r){try{r._check(e)}catch(i){n.push(new bw(r,e,i))}}),n};Wo.prototype.check=function(e){this.chain.forEach(function(n){try{n._check(e)}catch(r){throw new bw(n,e,r)}})};Wo.prototype.testAsync=function(e){var n=this;return new Promise(function(r,i){aL(e,n.chain.slice(),r,i)})};function aL(t,e,n,r){if(e.length){var i=e.shift();i._testAsync(t).then(function(){aL(t,e,n,r)},function(o){r(new bw(i,t,o))})}else n(t)}var zA=function(t,e){return e&&typeof t=="string"&&t.trim().length===0?!0:t==null};function hW(t,e){return e===void 0&&(e=!1),{simple:function(n){return zA(n,e)||t.check(n)===void 0},async:function(n){return zA(n,e)||t.testAsync(n)}}}function oi(){return typeof Proxy<"u"?lL(new Wo):s1(new Wo)}var Nd={};oi.extend=function(t){Object.assign(Nd,t)};oi.clearCustomRules=function(){Nd={}};function lL(t){return new Proxy(t,{get:function(n,r){if(r in n)return n[r];var i=lL(t._clone());if(r in Eg)return i._applyModifier(Eg[r],r);if(r in Nd)return i._applyRule(Nd[r],r);if(r in a1)return i._applyRule(a1[r],r)}})}function s1(t){var e=function(i,o){return Object.keys(i).forEach(function(s){o[s]=function(){for(var a=[],l=arguments.length;l--;)a[l]=arguments[l];var u=s1(o._clone()),d=u._applyRule(i[s],s).apply(void 0,a);return d}}),o},n=e(a1,t),r=e(Nd,n);return Object.keys(Eg).forEach(function(i){Object.defineProperty(r,i,{get:function(){var o=s1(r._clone());return o._applyModifier(Eg[i],i)}})}),r}var Eg={not:{simple:function(t){return function(e){return!t(e)}},async:function(t){return function(e){return Promise.resolve(t(e)).then(function(n){return!n}).catch(function(){return!0})}}},some:{simple:function(t){return function(e){return ym(e).some(function(n){try{return t(n)}catch{return!1}})}},async:function(t){return function(e){return Promise.all(ym(e).map(function(n){try{return t(n).catch(function(){return!1})}catch{return!1}})).then(function(n){return n.some(Boolean)})}}},every:{simple:function(t){return function(e){return e!==!1&&ym(e).every(t)}},async:function(t){return function(e){return Promise.all(ym(e).map(t)).then(function(n){return n.every(Boolean)})}}},strict:{simple:function(t,e){return function(n){return BA(e)&&n&&typeof n=="object"?Object.keys(e.args[0]).length===Object.keys(n).length&&t(n):t(n)}},async:function(t,e){return function(n){return Promise.resolve(t(n)).then(function(r){return BA(e)&&n&&typeof n=="object"?Object.keys(e.args[0]).length===Object.keys(n).length&&r:r}).catch(function(){return!1})}}}};function BA(t){return t&&t.name==="schema"&&t.args.length>0&&typeof t.args[0]=="object"}function ym(t){return typeof t=="string"?t.split(""):t}var a1={equal:function(t){return function(e){return e==t}},exact:function(t){return function(e){return e===t}},number:function(t){return t===void 0&&(t=!0),function(e){return typeof e=="number"&&(t||isFinite(e))}},integer:function(){return function(t){var e=Number.isInteger||pW;return e(t)}},numeric:function(){return function(t){return!isNaN(parseFloat(t))&&isFinite(t)}},string:function(){return Mc("string")},boolean:function(){return Mc("boolean")},undefined:function(){return Mc("undefined")},null:function(){return Mc("null")},array:function(){return Mc("array")},object:function(){return Mc("object")},instanceOf:function(t){return function(e){return e instanceof t}},pattern:function(t){return function(e){return t.test(e)}},lowercase:function(){return function(t){return typeof t=="boolean"||t===t.toLowerCase()&&t.trim()!==""}},uppercase:function(){return function(t){return t===t.toUpperCase()&&t.trim()!==""}},vowel:function(){return function(t){return/^[aeiou]+$/i.test(t)}},consonant:function(){return function(t){return/^(?=[^aeiou])([a-z]+)$/i.test(t)}},first:function(t){return function(e){return e[0]==t}},last:function(t){return function(e){return e[e.length-1]==t}},empty:function(){return function(t){return t.length===0}},length:function(t,e){return function(n){return n.length>=t&&n.length<=(e||t)}},minLength:function(t){return function(e){return e.length>=t}},maxLength:function(t){return function(e){return e.length<=t}},negative:function(){return function(t){return t<0}},positive:function(){return function(t){return t>=0}},between:function(t,e){return function(n){return n>=t&&n<=e}},range:function(t,e){return function(n){return n>=t&&n<=e}},lessThan:function(t){return function(e){return et}},greaterThanOrEqual:function(t){return function(e){return e>=t}},even:function(){return function(t){return t%2===0}},odd:function(){return function(t){return t%2!==0}},includes:function(t){return function(e){return~e.indexOf(t)}},schema:function(t){return mW(t)},passesAnyOf:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(n){return t.some(function(r){return r.test(n)})}},optional:hW};function Mc(t){return function(e){return Array.isArray(e)&&t==="array"||e===null&&t==="null"||typeof e===t}}function pW(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}function mW(t){return{simple:function(e){var n=[];if(Object.keys(t).forEach(function(r){var i=t[r];try{i.check((e||{})[r])}catch(o){o.target=r,n.push(o)}}),n.length>0)throw n;return!0},async:function(e){var n=[],r=Object.keys(t).map(function(i){var o=t[i];return o.testAsync((e||{})[i]).catch(function(s){s.target=i,n.push(s)})});return Promise.all(r).then(function(){if(n.length>0)throw n;return!0})}}}var an="colors",zr="sizes",at="space",gW={gap:at,gridGap:at,columnGap:at,gridColumnGap:at,rowGap:at,gridRowGap:at,inset:at,insetBlock:at,insetBlockEnd:at,insetBlockStart:at,insetInline:at,insetInlineEnd:at,insetInlineStart:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,marginBlock:at,marginBlockEnd:at,marginBlockStart:at,marginInline:at,marginInlineEnd:at,marginInlineStart:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,paddingBlock:at,paddingBlockEnd:at,paddingBlockStart:at,paddingInline:at,paddingInlineEnd:at,paddingInlineStart:at,top:at,right:at,bottom:at,left:at,scrollMargin:at,scrollMarginTop:at,scrollMarginRight:at,scrollMarginBottom:at,scrollMarginLeft:at,scrollMarginX:at,scrollMarginY:at,scrollMarginBlock:at,scrollMarginBlockEnd:at,scrollMarginBlockStart:at,scrollMarginInline:at,scrollMarginInlineEnd:at,scrollMarginInlineStart:at,scrollPadding:at,scrollPaddingTop:at,scrollPaddingRight:at,scrollPaddingBottom:at,scrollPaddingLeft:at,scrollPaddingX:at,scrollPaddingY:at,scrollPaddingBlock:at,scrollPaddingBlockEnd:at,scrollPaddingBlockStart:at,scrollPaddingInline:at,scrollPaddingInlineEnd:at,scrollPaddingInlineStart:at,fontSize:"fontSizes",background:an,backgroundColor:an,backgroundImage:an,borderImage:an,border:an,borderBlock:an,borderBlockEnd:an,borderBlockStart:an,borderBottom:an,borderBottomColor:an,borderColor:an,borderInline:an,borderInlineEnd:an,borderInlineStart:an,borderLeft:an,borderLeftColor:an,borderRight:an,borderRightColor:an,borderTop:an,borderTopColor:an,caretColor:an,color:an,columnRuleColor:an,fill:an,outline:an,outlineColor:an,stroke:an,textDecorationColor:an,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:zr,minBlockSize:zr,maxBlockSize:zr,inlineSize:zr,minInlineSize:zr,maxInlineSize:zr,width:zr,minWidth:zr,maxWidth:zr,height:zr,minHeight:zr,maxHeight:zr,flexBasis:zr,gridTemplateColumns:zr,gridTemplateRows:zr,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},vW=(t,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,bu=()=>{const t=Object.create(null);return(e,n,...r)=>{const i=(o=>JSON.stringify(o,vW))(e);return i in t?t[i]:t[i]=n(e,...r)}},_l=Symbol.for("sxs.internal"),Tw=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),HA=t=>{for(const e in t)return!0;return!1},{hasOwnProperty:yW}=Object.prototype,l1=t=>t.includes("-")?t:t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),_W=/\s+(?![^()]*\))/,bc=t=>e=>t(...typeof e=="string"?String(e).split(_W):[e]),VA={appearance:t=>({WebkitAppearance:t,appearance:t}),backfaceVisibility:t=>({WebkitBackfaceVisibility:t,backfaceVisibility:t}),backdropFilter:t=>({WebkitBackdropFilter:t,backdropFilter:t}),backgroundClip:t=>({WebkitBackgroundClip:t,backgroundClip:t}),boxDecorationBreak:t=>({WebkitBoxDecorationBreak:t,boxDecorationBreak:t}),clipPath:t=>({WebkitClipPath:t,clipPath:t}),content:t=>({content:t.includes('"')||t.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(t)?t:`"${t}"`}),hyphens:t=>({WebkitHyphens:t,hyphens:t}),maskImage:t=>({WebkitMaskImage:t,maskImage:t}),maskSize:t=>({WebkitMaskSize:t,maskSize:t}),tabSize:t=>({MozTabSize:t,tabSize:t}),textSizeAdjust:t=>({WebkitTextSizeAdjust:t,textSizeAdjust:t}),userSelect:t=>({WebkitUserSelect:t,userSelect:t}),marginBlock:bc((t,e)=>({marginBlockStart:t,marginBlockEnd:e||t})),marginInline:bc((t,e)=>({marginInlineStart:t,marginInlineEnd:e||t})),maxSize:bc((t,e)=>({maxBlockSize:t,maxInlineSize:e||t})),minSize:bc((t,e)=>({minBlockSize:t,minInlineSize:e||t})),paddingBlock:bc((t,e)=>({paddingBlockStart:t,paddingBlockEnd:e||t})),paddingInline:bc((t,e)=>({paddingInlineStart:t,paddingInlineEnd:e||t}))},s_=/([\d.]+)([^]*)/,xW=(t,e)=>t.length?t.reduce((n,r)=>(n.push(...e.map(i=>i.includes("&")?i.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(i)?`:is(${r})`:r):r+" "+i)),n),[]):e,SW=(t,e)=>t in wW&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,(n,r,i,o)=>r+(i==="stretch"?`-moz-available${o};${l1(t)}:${r}-webkit-fill-available`:`-moz-fit-content${o};${l1(t)}:${r}fit-content`)+o):String(e),wW={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},Ms=t=>t?t+"-":"",cL=(t,e,n)=>t.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,(r,i,o,s,a)=>s=="$"==!!o?r:(i||s=="--"?"calc(":"")+"var(--"+(s==="$"?Ms(e)+(a.includes("$")?"":Ms(n))+a.replace(/\$/g,"-"):a)+")"+(i||s=="--"?"*"+(i||"")+(o||"1")+")":"")),EW=/\s*,\s*(?![^()]*\))/,MW=Object.prototype.toString,$c=(t,e,n,r,i)=>{let o,s,a;const l=(u,d,h)=>{let p,g;const y=w=>{for(p in w){const _=p.charCodeAt(0)===64,S=_&&Array.isArray(w[p])?w[p]:[w[p]];for(g of S){const M=/[A-Z]/.test(m=p)?m:m.replace(/-[^]/g,A=>A[1].toUpperCase()),T=typeof g=="object"&&g&&g.toString===MW&&(!r.utils[M]||!d.length);if(M in r.utils&&!T){const A=r.utils[M];if(A!==s){s=A,y(A(g)),s=null;continue}}else if(M in VA){const A=VA[M];if(A!==a){a=A,y(A(g)),a=null;continue}}if(_&&(x=p.slice(1)in r.media?"@media "+r.media[p.slice(1)]:p,p=x.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,(A,R,O,C,P,k)=>{const X=s_.test(R),oe=.0625*(X?-1:1),[V,K]=X?[C,R]:[R,C];return"("+(O[0]==="="?"":O[0]===">"===X?"max-":"min-")+V+":"+(O[0]!=="="&&O.length===1?K.replace(s_,(J,se,F)=>Number(se)+oe*(O===">"?1:-1)+F):K)+(P?") and ("+(P[0]===">"?"min-":"max-")+V+":"+(P.length===1?k.replace(s_,(J,se,F)=>Number(se)+oe*(P===">"?-1:1)+F):k):"")+")"})),T){const A=_?h.concat(p):[...h],R=_?[...d]:xW(d,p.split(EW));o!==void 0&&i(WA(...o)),o=void 0,l(g,R,A)}else o===void 0&&(o=[[],d,h]),p=_||p.charCodeAt(0)!==36?p:`--${Ms(r.prefix)}${p.slice(1).replace(/\$/g,"-")}`,g=T?g:typeof g=="number"?g&&M in bW?String(g)+"px":String(g):cL(SW(M,g??""),r.prefix,r.themeMap[M]),o[0].push(`${_?`${p} `:`${l1(p)}:`}${g}`)}}var x,m};y(u),o!==void 0&&i(WA(...o)),o=void 0};l(t,e,n)},WA=(t,e,n)=>`${n.map(r=>`${r}{`).join("")}${e.length?`${e.join(",")}{`:""}${t.join(";")}${e.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,bW={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},GA=t=>String.fromCharCode(t+(t>25?39:97)),xl=t=>(e=>{let n,r="";for(n=Math.abs(e);n>52;n=n/52|0)r=GA(n%52)+r;return GA(n%52)+r})(((e,n)=>{let r=n.length;for(;r;)e=33*e^n.charCodeAt(--r);return e})(5381,JSON.stringify(t))>>>0),Cf=["themed","global","styled","onevar","resonevar","allvar","inline"],TW=t=>{if(t.href&&!t.href.startsWith(location.origin))return!1;try{return!!t.cssRules}catch{return!1}},AW=t=>{let e;const n=()=>{const{cssRules:i}=e.sheet;return[].map.call(i,(o,s)=>{const{cssText:a}=o;let l="";if(a.startsWith("--sxs"))return"";if(i[s-1]&&(l=i[s-1].cssText).startsWith("--sxs")){if(!o.cssRules.length)return"";for(const u in e.rules)if(e.rules[u].group===o)return`--sxs{--sxs:${[...e.rules[u].cache].join(" ")}}${a}`;return o.cssRules.length?`${l}${a}`:""}return a}).join("")},r=()=>{if(e){const{rules:a,sheet:l}=e;if(!l.deleteRule){for(;Object(Object(l.cssRules)[0]).type===3;)l.cssRules.splice(0,1);l.cssRules=[]}for(const u in a)delete a[u]}const i=Object(t).styleSheets||[];for(const a of i)if(TW(a)){for(let l=0,u=a.cssRules;u[l];++l){const d=Object(u[l]);if(d.type!==1)continue;const h=Object(u[l+1]);if(h.type!==4)continue;++l;const{cssText:p}=d;if(!p.startsWith("--sxs"))continue;const g=p.slice(14,-3).trim().split(/\s+/),y=Cf[g[0]];y&&(e||(e={sheet:a,reset:r,rules:{},toString:n}),e.rules[y]={group:h,index:l,cache:new Set(g)})}if(e)break}if(!e){const a=(l,u)=>({type:u,cssRules:[],insertRule(d,h){this.cssRules.splice(h,0,a(d,{import:3,undefined:1}[(d.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,d=>d.cssText).join("")}}`:l}});e={sheet:t?(t.head||t).appendChild(document.createElement("style")).sheet:a("","text/css"),rules:{},reset:r,toString:n}}const{sheet:o,rules:s}=e;for(let a=Cf.length-1;a>=0;--a){const l=Cf[a];if(!s[l]){const u=Cf[a+1],d=s[u]?s[u].index:o.cssRules.length;o.insertRule("@media{}",d),o.insertRule(`--sxs{--sxs:${a}}`,d),s[l]={group:o.cssRules[d+1],index:d,cache:new Set([a])}}CW(s[l])}};return r(),e},CW=t=>{const e=t.group;let n=e.cssRules.length;t.apply=r=>{try{e.insertRule(r,n),++n}catch{}}},_f=Symbol(),RW=bu(),$A=(t,e)=>RW(t,()=>(...n)=>{let r={type:null,composers:new Set};for(const i of n)if(i!=null)if(i[_l]){r.type==null&&(r.type=i[_l].type);for(const o of i[_l].composers)r.composers.add(o)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(PW(i,t));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),IW(t,r,e)}),PW=({variants:t,compoundVariants:e,defaultVariants:n,...r},i)=>{const o=`${Ms(i.prefix)}c-${xl(r)}`,s=[],a=[],l=Object.create(null),u=[];for(const p in n)l[p]=String(n[p]);if(typeof t=="object"&&t)for(const p in t){d=l,h=p,yW.call(d,h)||(l[p]="undefined");const g=t[p];for(const y in g){const w={[p]:String(y)};String(y)==="undefined"&&u.push(p);const x=g[y],m=[w,x,!HA(x)];s.push(m)}}var d,h;if(typeof e=="object"&&e)for(const p of e){let{css:g,...y}=p;g=typeof g=="object"&&g||{};for(const x in y)y[x]=String(y[x]);const w=[y,g,!HA(g)];a.push(w)}return[o,r,s,a,l,u]},IW=(t,e,n)=>{const[r,i,o,s]=LW(e.composers),a=typeof e.type=="function"||e.type.$$typeof?(h=>{function p(){for(let g=0;gp.rules[g]={apply:y=>p[_f].push([g,y])}),p})(n):null,l=(a||n).rules,u=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,d=h=>{h=typeof h=="object"&&h||DW;const{css:p,...g}=h,y={};for(const m in o)if(delete g[m],m in h){let _=h[m];typeof _=="object"&&_?y[m]={"@initial":o[m],..._}:(_=String(_),y[m]=_!=="undefined"||s.has(m)?_:o[m])}else y[m]=o[m];const w=new Set([...i]);for(const[m,_,S,M]of e.composers){n.rules.styled.cache.has(m)||(n.rules.styled.cache.add(m),$c(_,[`.${m}`],[],t,R=>{l.styled.apply(R)}));const T=jA(S,y,t.media),A=jA(M,y,t.media,!0);for(const R of T)if(R!==void 0)for(const[O,C,P]of R){const k=`${m}-${xl(C)}-${O}`;w.add(k);const X=(P?n.rules.resonevar:n.rules.onevar).cache,oe=P?l.resonevar:l.onevar;X.has(k)||(X.add(k),$c(C,[`.${k}`],[],t,V=>{oe.apply(V)}))}for(const R of A)if(R!==void 0)for(const[O,C]of R){const P=`${m}-${xl(C)}-${O}`;w.add(P),n.rules.allvar.cache.has(P)||(n.rules.allvar.cache.add(P),$c(C,[`.${P}`],[],t,k=>{l.allvar.apply(k)}))}}if(typeof p=="object"&&p){const m=`${r}-i${xl(p)}-css`;w.add(m),n.rules.inline.cache.has(m)||(n.rules.inline.cache.add(m),$c(p,[`.${m}`],[],t,_=>{l.inline.apply(_)}))}for(const m of String(h.className||"").trim().split(/\s+/))m&&w.add(m);const x=g.className=[...w].join(" ");return{type:e.type,className:x,selector:u,props:g,toString:()=>x,deferredInjector:a}};return Tw(d,{className:r,selector:u,[_l]:e,toString:()=>(n.rules.styled.cache.has(r)||d(),r)})},LW=t=>{let e="";const n=[],r={},i=[];for(const[o,,,,s,a]of t){e===""&&(e=o),n.push(o),i.push(...a);for(const l in s){const u=s[l];(r[l]===void 0||u!=="undefined"||a.includes(u))&&(r[l]=u)}}return[e,n,r,new Set(i)]},jA=(t,e,n,r)=>{const i=[];e:for(let[o,s,a]of t){if(a)continue;let l,u=0,d=!1;for(l in o){const h=o[l];let p=e[l];if(p!==h){if(typeof p!="object"||!p)continue e;{let g,y,w=0;for(const x in p){if(h===String(p[x])){if(x!=="@initial"){const m=x.slice(1);(y=y||[]).push(m in n?n[m]:x.replace(/^@media ?/,"")),d=!0}u+=w,g=!0}++w}if(y&&y.length&&(s={["@media "+y.join(", ")]:s}),!g)continue e}}}(i[u]=i[u]||[]).push([r?"cv":`${l}-${o[l]}`,s,d])}return i},DW={},OW=bu(),NW=(t,e)=>OW(t,()=>(...n)=>{const r=()=>{for(let i of n){i=typeof i=="object"&&i||{};let o=xl(i);if(!e.rules.global.cache.has(o)){if(e.rules.global.cache.add(o),"@import"in i){let s=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let a of[].concat(i["@import"]))a=a.includes('"')||a.includes("'")?a:`"${a}"`,e.sheet.insertRule(`@import ${a};`,s++);delete i["@import"]}$c(i,[],[],t,s=>{e.rules.global.apply(s)})}}return""};return Tw(r,{toString:r})}),kW=bu(),UW=(t,e)=>kW(t,()=>n=>{const r=`${Ms(t.prefix)}k-${xl(n)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const o=[];$c(n,[],[],t,a=>o.push(a));const s=`@keyframes ${r}{${o.join("")}}`;e.rules.global.apply(s)}return r};return Tw(i,{get name(){return i()},toString:i})}),FW=class{constructor(t,e,n,r){this.token=t==null?"":String(t),this.value=e==null?"":String(e),this.scale=n==null?"":String(n),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+Ms(this.prefix)+Ms(this.scale)+this.token}toString(){return this.computedValue}},zW=bu(),BW=(t,e)=>zW(t,()=>(n,r)=>{r=typeof n=="object"&&n||Object(r);const i=`.${n=(n=typeof n=="string"?n:"")||`${Ms(t.prefix)}t-${xl(r)}`}`,o={},s=[];for(const l in r){o[l]={};for(const u in r[l]){const d=`--${Ms(t.prefix)}${l}-${u}`,h=cL(String(r[l][u]),t.prefix,l);o[l][u]=new FW(u,h,l,t.prefix),s.push(`${d}:${h}`)}}const a=()=>{if(s.length&&!e.rules.themed.cache.has(n)){e.rules.themed.cache.add(n);const l=`${r===t.theme?":root,":""}.${n}{${s.join(";")}}`;e.rules.themed.apply(l)}return n};return{...o,get className(){return a()},selector:i,toString:a}}),HW=bu(),VW=bu(),WW=t=>{const e=(n=>{let r=!1;const i=HW(n,o=>{r=!0;const s="prefix"in(o=typeof o=="object"&&o||{})?String(o.prefix):"",a=typeof o.media=="object"&&o.media||{},l=typeof o.root=="object"?o.root||null:globalThis.document||null,u=typeof o.theme=="object"&&o.theme||{},d={prefix:s,media:a,theme:u,themeMap:typeof o.themeMap=="object"&&o.themeMap||{...gW},utils:typeof o.utils=="object"&&o.utils||{}},h=AW(l),p={css:$A(d,h),globalCss:NW(d,h),keyframes:UW(d,h),createTheme:BW(d,h),reset(){h.reset(),p.theme.toString()},theme:{},sheet:h,config:d,prefix:s,getCssText:h.toString,toString:h.toString};return String(p.theme=p.createTheme(u)),p});return r||i.reset(),i})(t);return e.styled=(({config:n,sheet:r})=>VW(n,()=>{const i=$A(n,r);return(...o)=>{const s=i(...o),a=s[_l].type,l=te.forwardRef((u,d)=>{const h=u&&u.as||a,{props:p,deferredInjector:g}=s(u);return delete p.as,p.ref=d,g?te.createElement(te.Fragment,null,te.createElement(h,p),te.createElement(g,null)):te.createElement(h,p)});return l.className=s.className,l.displayName=`Styled.${a.displayName||a.name||a}`,l.selector=s.selector,l.toString=()=>s.selector,l[_l]=s[_l],l}}))(e),e};function us(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function uL(t,e=[]){let n=[];function r(o,s){const a=L.createContext(s),l=n.length;n=[...n,s];function u(h){const{scope:p,children:g,...y}=h,w=(p==null?void 0:p[t][l])||a,x=L.useMemo(()=>y,Object.values(y));return L.createElement(w.Provider,{value:x},g)}function d(h,p){const g=(p==null?void 0:p[t][l])||a,y=L.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${h}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>L.createContext(s));return function(a){const l=(a==null?void 0:a[t])||o;return L.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,GW(i,...e)]}function GW(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const h=l(o)[`__scope${u}`];return{...a,...h}},{});return L.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function Tu(t){const e=L.useRef(t);return L.useEffect(()=>{e.current=t}),L.useMemo(()=>(...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function $W(t,e=globalThis==null?void 0:globalThis.document){const n=Tu(t);L.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[n,e])}const c1="dismissableLayer.update",jW="dismissableLayer.pointerDownOutside",XW="dismissableLayer.focusOutside";let XA;const YW=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qW=L.forwardRef((t,e)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...u}=t,d=L.useContext(YW),[h,p]=L.useState(null),g=(n=h==null?void 0:h.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,y]=L.useState({}),w=Mu(e,O=>p(O)),x=Array.from(d.layers),[m]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(m),S=h?x.indexOf(h):-1,M=d.layersWithOutsidePointerEventsDisabled.size>0,T=S>=_,A=ZW(O=>{const C=O.target,P=[...d.branches].some(k=>k.contains(C));!T||P||(o==null||o(O),a==null||a(O),O.defaultPrevented||l==null||l())},g),R=KW(O=>{const C=O.target;[...d.branches].some(k=>k.contains(C))||(s==null||s(O),a==null||a(O),O.defaultPrevented||l==null||l())},g);return $W(O=>{S===d.layers.size-1&&(i==null||i(O),!O.defaultPrevented&&l&&(O.preventDefault(),l()))},g),L.useEffect(()=>{if(h)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(XA=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),YA(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=XA)}},[h,g,r,d]),L.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),YA())},[h,d]),L.useEffect(()=>{const O=()=>y({});return document.addEventListener(c1,O),()=>document.removeEventListener(c1,O)},[]),L.createElement(Bl.div,_n({},u,{ref:w,style:{pointerEvents:M?T?"auto":"none":void 0,...t.style},onFocusCapture:us(t.onFocusCapture,R.onFocusCapture),onBlurCapture:us(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:us(t.onPointerDownCapture,A.onPointerDownCapture)}))});function ZW(t,e=globalThis==null?void 0:globalThis.document){const n=Tu(t),r=L.useRef(!1),i=L.useRef(()=>{});return L.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let d=function(){fL(jW,n,u,{discrete:!0})};var l=d;const u={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=d,e.addEventListener("click",i.current,{once:!0})):d()}else e.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function KW(t,e=globalThis==null?void 0:globalThis.document){const n=Tu(t),r=L.useRef(!1);return L.useEffect(()=>{const i=o=>{o.target&&!r.current&&fL(XW,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function YA(){const t=new CustomEvent(c1);document.dispatchEvent(t)}function fL(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?cW(i,o):i.dispatchEvent(o)}const du=globalThis!=null&&globalThis.document?L.useLayoutEffect:()=>{},JW=zO.useId||(()=>{});let QW=0;function eG(t){const[e,n]=L.useState(JW());return du(()=>{t||n(r=>r??String(QW++))},[t]),t||(e?`radix-${e}`:"")}const tG=["top","right","bottom","left"],xa=Math.min,vi=Math.max,Mg=Math.round,_m=Math.floor,Sa=t=>({x:t,y:t}),nG={left:"right",right:"left",bottom:"top",top:"bottom"},rG={start:"end",end:"start"};function u1(t,e,n){return vi(t,xa(e,n))}function bs(t,e){return typeof t=="function"?t(e):t}function Ts(t){return t.split("-")[0]}function Au(t){return t.split("-")[1]}function Aw(t){return t==="x"?"y":"x"}function Cw(t){return t==="y"?"height":"width"}function Cu(t){return["top","bottom"].includes(Ts(t))?"y":"x"}function Rw(t){return Aw(Cu(t))}function iG(t,e,n){n===void 0&&(n=!1);const r=Au(t),i=Rw(t),o=Cw(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=bg(s)),[s,bg(s)]}function oG(t){const e=bg(t);return[f1(t),e,f1(e)]}function f1(t){return t.replace(/start|end/g,e=>rG[e])}function sG(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function aG(t,e,n,r){const i=Au(t);let o=sG(Ts(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(f1)))),o}function bg(t){return t.replace(/left|right|bottom|top/g,e=>nG[e])}function lG(t){return{top:0,right:0,bottom:0,left:0,...t}}function dL(t){return typeof t!="number"?lG(t):{top:t,right:t,bottom:t,left:t}}function Tg(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function qA(t,e,n){let{reference:r,floating:i}=t;const o=Cu(e),s=Rw(e),a=Cw(s),l=Ts(e),u=o==="y",d=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let g;switch(l){case"top":g={x:d,y:r.y-i.height};break;case"bottom":g={x:d,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:h};break;case"left":g={x:r.x-i.width,y:h};break;default:g={x:r.x,y:r.y}}switch(Au(e)){case"start":g[s]-=p*(n&&u?-1:1);break;case"end":g[s]+=p*(n&&u?-1:1);break}return g}const cG=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:h}=qA(u,r,l),p=r,g={},y=0;for(let w=0;w({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:u,padding:d=0}=bs(t,e)||{};if(u==null)return{};const h=dL(d),p={x:n,y:r},g=Rw(i),y=Cw(g),w=await s.getDimensions(u),x=g==="y",m=x?"top":"left",_=x?"bottom":"right",S=x?"clientHeight":"clientWidth",M=o.reference[y]+o.reference[g]-p[g]-o.floating[y],T=p[g]-o.reference[g],A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let R=A?A[S]:0;(!R||!await(s.isElement==null?void 0:s.isElement(A)))&&(R=a.floating[S]||o.floating[y]);const O=M/2-T/2,C=R/2-w[y]/2-1,P=xa(h[m],C),k=xa(h[_],C),X=P,oe=R-w[y]-k,V=R/2-w[y]/2+O,K=u1(X,V,oe),J=!l.arrow&&Au(i)!=null&&V!=K&&o.reference[y]/2-(VX<=0)){var C,P;const X=(((C=o.flip)==null?void 0:C.index)||0)+1,oe=T[X];if(oe)return{data:{index:X,overflows:O},reset:{placement:oe}};let V=(P=O.filter(K=>K.overflows[0]<=0).sort((K,J)=>K.overflows[1]-J.overflows[1])[0])==null?void 0:P.placement;if(!V)switch(g){case"bestFit":{var k;const K=(k=O.map(J=>[J.placement,J.overflows.filter(se=>se>0).reduce((se,F)=>se+F,0)]).sort((J,se)=>J[1]-se[1])[0])==null?void 0:k[0];K&&(V=K);break}case"initialPlacement":V=a;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function KA(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function JA(t){return tG.some(e=>t[e]>=0)}const fG=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=bs(t,e);switch(r){case"referenceHidden":{const o=await kd(e,{...i,elementContext:"reference"}),s=KA(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:JA(s)}}}case"escaped":{const o=await kd(e,{...i,altBoundary:!0}),s=KA(o,n.floating);return{data:{escapedOffsets:s,escaped:JA(s)}}}default:return{}}}}};async function dG(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Ts(n),a=Au(n),l=Cu(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,h=bs(e,t);let{mainAxis:p,crossAxis:g,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&typeof y=="number"&&(g=a==="end"?y*-1:y),l?{x:g*d,y:p*u}:{x:p*u,y:g*d}}const hG=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){const{x:n,y:r}=e,i=await dG(e,t);return{x:n+i.x,y:r+i.y,data:i}}}},pG=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:m,y:_}=x;return{x:m,y:_}}},...l}=bs(t,e),u={x:n,y:r},d=await kd(e,l),h=Cu(Ts(i)),p=Aw(h);let g=u[p],y=u[h];if(o){const x=p==="y"?"top":"left",m=p==="y"?"bottom":"right",_=g+d[x],S=g-d[m];g=u1(_,g,S)}if(s){const x=h==="y"?"top":"left",m=h==="y"?"bottom":"right",_=y+d[x],S=y-d[m];y=u1(_,y,S)}const w=a.fn({...e,[p]:g,[h]:y});return{...w,data:{x:w.x-n,y:w.y-r}}}}},mG=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=bs(t,e),d={x:n,y:r},h=Cu(i),p=Aw(h);let g=d[p],y=d[h];const w=bs(a,e),x=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(l){const S=p==="y"?"height":"width",M=o.reference[p]-o.floating[S]+x.mainAxis,T=o.reference[p]+o.reference[S]-x.mainAxis;gT&&(g=T)}if(u){var m,_;const S=p==="y"?"width":"height",M=["top","left"].includes(Ts(i)),T=o.reference[h]-o.floating[S]+(M&&((m=s.offset)==null?void 0:m[h])||0)+(M?0:x.crossAxis),A=o.reference[h]+o.reference[S]+(M?0:((_=s.offset)==null?void 0:_[h])||0)-(M?x.crossAxis:0);yA&&(y=A)}return{[p]:g,[h]:y}}}},gG=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:o}=e,{apply:s=()=>{},...a}=bs(t,e),l=await kd(e,a),u=Ts(n),d=Au(n),h=Cu(n)==="y",{width:p,height:g}=r.floating;let y,w;u==="top"||u==="bottom"?(y=u,w=d===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(w=u,y=d==="end"?"top":"bottom");const x=g-l[y],m=p-l[w],_=!e.middlewareData.shift;let S=x,M=m;if(h){const A=p-l.left-l.right;M=d||_?xa(m,A):A}else{const A=g-l.top-l.bottom;S=d||_?xa(x,A):A}if(_&&!d){const A=vi(l.left,0),R=vi(l.right,0),O=vi(l.top,0),C=vi(l.bottom,0);h?M=p-2*(A!==0||R!==0?A+R:vi(l.left,l.right)):S=g-2*(O!==0||C!==0?O+C:vi(l.top,l.bottom))}await s({...e,availableWidth:M,availableHeight:S});const T=await i.getDimensions(o.floating);return p!==T.width||g!==T.height?{reset:{rects:!0}}:{}}}};function wa(t){return hL(t)?(t.nodeName||"").toLowerCase():"#document"}function wi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Rs(t){var e;return(e=(hL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hL(t){return t instanceof Node||t instanceof wi(t).Node}function As(t){return t instanceof Element||t instanceof wi(t).Element}function Go(t){return t instanceof HTMLElement||t instanceof wi(t).HTMLElement}function QA(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof wi(t).ShadowRoot}function uh(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Yi(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function vG(t){return["table","td","th"].includes(wa(t))}function Pw(t){const e=Iw(),n=Yi(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function yG(t){let e=hu(t);for(;Go(e)&&!P0(e);){if(Pw(e))return e;e=hu(e)}return null}function Iw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function P0(t){return["html","body","#document"].includes(wa(t))}function Yi(t){return wi(t).getComputedStyle(t)}function I0(t){return As(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function hu(t){if(wa(t)==="html")return t;const e=t.assignedSlot||t.parentNode||QA(t)&&t.host||Rs(t);return QA(e)?e.host:e}function pL(t){const e=hu(t);return P0(e)?t.ownerDocument?t.ownerDocument.body:t.body:Go(e)&&uh(e)?e:pL(e)}function Ud(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=pL(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=wi(i);return o?e.concat(s,s.visualViewport||[],uh(i)?i:[],s.frameElement&&n?Ud(s.frameElement):[]):e.concat(i,Ud(i,[],n))}function mL(t){const e=Yi(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Go(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Mg(n)!==o||Mg(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Lw(t){return As(t)?t:t.contextElement}function eu(t){const e=Lw(t);if(!Go(e))return Sa(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=mL(e);let s=(o?Mg(n.width):n.width)/r,a=(o?Mg(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const _G=Sa(0);function gL(t){const e=wi(t);return!Iw()||!e.visualViewport?_G:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function xG(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==wi(t)?!1:e}function Il(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Lw(t);let s=Sa(1);e&&(r?As(r)&&(s=eu(r)):s=eu(t));const a=xG(o,n,r)?gL(o):Sa(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,d=i.width/s.x,h=i.height/s.y;if(o){const p=wi(o),g=r&&As(r)?wi(r):r;let y=p.frameElement;for(;y&&r&&g!==p;){const w=eu(y),x=y.getBoundingClientRect(),m=Yi(y),_=x.left+(y.clientLeft+parseFloat(m.paddingLeft))*w.x,S=x.top+(y.clientTop+parseFloat(m.paddingTop))*w.y;l*=w.x,u*=w.y,d*=w.x,h*=w.y,l+=_,u+=S,y=wi(y).frameElement}}return Tg({width:d,height:h,x:l,y:u})}function SG(t){let{rect:e,offsetParent:n,strategy:r}=t;const i=Go(n),o=Rs(n);if(n===o)return e;let s={scrollLeft:0,scrollTop:0},a=Sa(1);const l=Sa(0);if((i||!i&&r!=="fixed")&&((wa(n)!=="body"||uh(o))&&(s=I0(n)),Go(n))){const u=Il(n);a=eu(n),l.x=u.x+n.clientLeft,l.y=u.y+n.clientTop}return{width:e.width*a.x,height:e.height*a.y,x:e.x*a.x-s.scrollLeft*a.x+l.x,y:e.y*a.y-s.scrollTop*a.y+l.y}}function wG(t){return Array.from(t.getClientRects())}function vL(t){return Il(Rs(t)).left+I0(t).scrollLeft}function EG(t){const e=Rs(t),n=I0(t),r=t.ownerDocument.body,i=vi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=vi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+vL(t);const a=-n.scrollTop;return Yi(r).direction==="rtl"&&(s+=vi(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function MG(t,e){const n=wi(t),r=Rs(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=Iw();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function bG(t,e){const n=Il(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Go(t)?eu(t):Sa(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:a,x:l,y:u}}function eC(t,e,n){let r;if(e==="viewport")r=MG(t,n);else if(e==="document")r=EG(Rs(t));else if(As(e))r=bG(e,n);else{const i=gL(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Tg(r)}function yL(t,e){const n=hu(t);return n===e||!As(n)||P0(n)?!1:Yi(n).position==="fixed"||yL(n,e)}function TG(t,e){const n=e.get(t);if(n)return n;let r=Ud(t,[],!1).filter(a=>As(a)&&wa(a)!=="body"),i=null;const o=Yi(t).position==="fixed";let s=o?hu(t):t;for(;As(s)&&!P0(s);){const a=Yi(s),l=Pw(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||uh(s)&&!l&&yL(t,s))?r=r.filter(d=>d!==s):i=a,s=hu(s)}return e.set(t,r),r}function AG(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?TG(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((u,d)=>{const h=eC(e,d,i);return u.top=vi(h.top,u.top),u.right=xa(h.right,u.right),u.bottom=xa(h.bottom,u.bottom),u.left=vi(h.left,u.left),u},eC(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function CG(t){return mL(t)}function RG(t,e,n){const r=Go(e),i=Rs(e),o=n==="fixed",s=Il(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=Sa(0);if(r||!r&&!o)if((wa(e)!=="body"||uh(i))&&(a=I0(e)),r){const u=Il(e,!0,o,e);l.x=u.x+e.clientLeft,l.y=u.y+e.clientTop}else i&&(l.x=vL(i));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function tC(t,e){return!Go(t)||Yi(t).position==="fixed"?null:e?e(t):t.offsetParent}function _L(t,e){const n=wi(t);if(!Go(t))return n;let r=tC(t,e);for(;r&&vG(r)&&Yi(r).position==="static";)r=tC(r,e);return r&&(wa(r)==="html"||wa(r)==="body"&&Yi(r).position==="static"&&!Pw(r))?n:r||yG(t)||n}const PG=async function(t){let{reference:e,floating:n,strategy:r}=t;const i=this.getOffsetParent||_L,o=this.getDimensions;return{reference:RG(e,await i(n),r),floating:{x:0,y:0,...await o(n)}}};function IG(t){return Yi(t).direction==="rtl"}const LG={convertOffsetParentRelativeRectToViewportRelativeRect:SG,getDocumentElement:Rs,getClippingRect:AG,getOffsetParent:_L,getElementRects:PG,getClientRects:wG,getDimensions:CG,getScale:eu,isElement:As,isRTL:IG};function DG(t,e){let n=null,r;const i=Rs(t);function o(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const{left:u,top:d,width:h,height:p}=t.getBoundingClientRect();if(a||e(),!h||!p)return;const g=_m(d),y=_m(i.clientWidth-(u+h)),w=_m(i.clientHeight-(d+p)),x=_m(u),_={rootMargin:-g+"px "+-y+"px "+-w+"px "+-x+"px",threshold:vi(0,xa(1,l))||1};let S=!0;function M(T){const A=T[0].intersectionRatio;if(A!==l){if(!S)return s();A?s(!1,A):r=setTimeout(()=>{s(!1,1e-7)},100)}S=!1}try{n=new IntersectionObserver(M,{..._,root:i.ownerDocument})}catch{n=new IntersectionObserver(M,_)}n.observe(t)}return s(!0),o}function OG(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Lw(t),d=i||o?[...u?Ud(u):[],...Ud(e)]:[];d.forEach(m=>{i&&m.addEventListener("scroll",n,{passive:!0}),o&&m.addEventListener("resize",n)});const h=u&&a?DG(u,n):null;let p=-1,g=null;s&&(g=new ResizeObserver(m=>{let[_]=m;_&&_.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{g&&g.observe(e)})),n()}),u&&!l&&g.observe(u),g.observe(e));let y,w=l?Il(t):null;l&&x();function x(){const m=Il(t);w&&(m.x!==w.x||m.y!==w.y||m.width!==w.width||m.height!==w.height)&&n(),w=m,y=requestAnimationFrame(x)}return n(),()=>{d.forEach(m=>{i&&m.removeEventListener("scroll",n),o&&m.removeEventListener("resize",n)}),h&&h(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(y)}}const NG=(t,e,n)=>{const r=new Map,i={platform:LG,...n},o={...i.platform,_c:r};return cG(t,e,{...i,platform:o})},kG=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?ZA({element:r.current,padding:i}).fn(n):{}:r?ZA({element:r,padding:i}).fn(n):{}}}};var $m=typeof document<"u"?L.useLayoutEffect:L.useEffect;function Ag(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Ag(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!Ag(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function xL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function nC(t,e){const n=xL(t);return Math.round(e*n)/n}function rC(t){const e=L.useRef(t);return $m(()=>{e.current=t}),e}function UG(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:u}=t,[d,h]=L.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[p,g]=L.useState(r);Ag(p,r)||g(r);const[y,w]=L.useState(null),[x,m]=L.useState(null),_=L.useCallback(J=>{J!=A.current&&(A.current=J,w(J))},[w]),S=L.useCallback(J=>{J!==R.current&&(R.current=J,m(J))},[m]),M=o||y,T=s||x,A=L.useRef(null),R=L.useRef(null),O=L.useRef(d),C=rC(l),P=rC(i),k=L.useCallback(()=>{if(!A.current||!R.current)return;const J={placement:e,strategy:n,middleware:p};P.current&&(J.platform=P.current),NG(A.current,R.current,J).then(se=>{const F={...se,isPositioned:!0};X.current&&!Ag(O.current,F)&&(O.current=F,Gd.flushSync(()=>{h(F)}))})},[p,e,n,P]);$m(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(J=>({...J,isPositioned:!1})))},[u]);const X=L.useRef(!1);$m(()=>(X.current=!0,()=>{X.current=!1}),[]),$m(()=>{if(M&&(A.current=M),T&&(R.current=T),M&&T){if(C.current)return C.current(M,T,k);k()}},[M,T,k,C]);const oe=L.useMemo(()=>({reference:A,floating:R,setReference:_,setFloating:S}),[_,S]),V=L.useMemo(()=>({reference:M,floating:T}),[M,T]),K=L.useMemo(()=>{const J={position:n,left:0,top:0};if(!V.floating)return J;const se=nC(V.floating,d.x),F=nC(V.floating,d.y);return a?{...J,transform:"translate("+se+"px, "+F+"px)",...xL(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:se,top:F}},[n,a,V.floating,d.x,d.y]);return L.useMemo(()=>({...d,update:k,refs:oe,elements:V,floatingStyles:K}),[d,k,oe,V,K])}const FG=L.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return L.createElement(Bl.svg,_n({},o,{ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),t.asChild?n:L.createElement("polygon",{points:"0,0 30,0 15,10"}))}),zG=FG;function BG(t){const[e,n]=L.useState(void 0);return du(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=t.offsetWidth,a=t.offsetHeight;n({width:s,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const SL="Popper",[wL,EL]=uL(SL),[HG,ML]=wL(SL),VG=t=>{const{__scopePopper:e,children:n}=t,[r,i]=L.useState(null);return L.createElement(HG,{scope:e,anchor:r,onAnchorChange:i},n)},WG="PopperAnchor",GG=L.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=ML(WG,n),s=L.useRef(null),a=Mu(e,s);return L.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:L.createElement(Bl.div,_n({},i,{ref:a}))}),bL="PopperContent",[$G,jG]=wL(bL),XG=L.forwardRef((t,e)=>{var n,r,i,o,s,a,l,u;const{__scopePopper:d,side:h="bottom",sideOffset:p=0,align:g="center",alignOffset:y=0,arrowPadding:w=0,avoidCollisions:x=!0,collisionBoundary:m=[],collisionPadding:_=0,sticky:S="partial",hideWhenDetached:M=!1,updatePositionStrategy:T="optimized",onPlaced:A,...R}=t,O=ML(bL,d),[C,P]=L.useState(null),k=Mu(e,De=>P(De)),[X,oe]=L.useState(null),V=BG(X),K=(n=V==null?void 0:V.width)!==null&&n!==void 0?n:0,J=(r=V==null?void 0:V.height)!==null&&r!==void 0?r:0,se=h+(g!=="center"?"-"+g:""),F=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},$=Array.isArray(m)?m:[m],j=$.length>0,H={padding:F,boundary:$.filter(KG),altBoundary:j},{refs:Z,floatingStyles:ge,placement:xe,isPositioned:Ee,middlewareData:Se}=UG({strategy:"fixed",placement:se,whileElementsMounted:(...De)=>OG(...De,{animationFrame:T==="always"}),elements:{reference:O.anchor},middleware:[hG({mainAxis:p+J,alignmentAxis:y}),x&&pG({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?mG():void 0,...H}),x&&uG({...H}),gG({...H,apply:({elements:De,rects:Ae,availableWidth:lt,availableHeight:je})=>{const{width:et,height:dt}=Ae.reference,xt=De.floating.style;xt.setProperty("--radix-popper-available-width",`${lt}px`),xt.setProperty("--radix-popper-available-height",`${je}px`),xt.setProperty("--radix-popper-anchor-width",`${et}px`),xt.setProperty("--radix-popper-anchor-height",`${dt}px`)}}),X&&kG({element:X,padding:w}),JG({arrowWidth:K,arrowHeight:J}),M&&fG({strategy:"referenceHidden",...H})]}),[We,Je]=TL(xe),ft=Tu(A);du(()=>{Ee&&(ft==null||ft())},[Ee,ft]);const At=(i=Se.arrow)===null||i===void 0?void 0:i.x,Qe=(o=Se.arrow)===null||o===void 0?void 0:o.y,Q=((s=Se.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[Le,we]=L.useState();return du(()=>{C&&we(window.getComputedStyle(C).zIndex)},[C]),L.createElement("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...ge,transform:Ee?ge.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Le,"--radix-popper-transform-origin":[(a=Se.transformOrigin)===null||a===void 0?void 0:a.x,(l=Se.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:t.dir},L.createElement($G,{scope:d,placedSide:We,onArrowChange:oe,arrowX:At,arrowY:Qe,shouldHideArrow:Q},L.createElement(Bl.div,_n({"data-side":We,"data-align":Je},R,{ref:k,style:{...R.style,animation:Ee?void 0:"none",opacity:(u=Se.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))}),YG="PopperArrow",qG={top:"bottom",right:"left",bottom:"top",left:"right"},ZG=L.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=jG(YG,r),s=qG[o.placedSide];return L.createElement("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0}},L.createElement(zG,_n({},i,{ref:n,style:{...i.style,display:"block"}})))});function KG(t){return t!==null}const JG=t=>({name:"transformOrigin",options:t,fn(e){var n,r,i,o,s;const{placement:a,rects:l,middlewareData:u}=e,h=((n=u.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,p=h?0:t.arrowWidth,g=h?0:t.arrowHeight,[y,w]=TL(a),x={start:"0%",center:"50%",end:"100%"}[w],m=((r=(i=u.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+p/2,_=((o=(s=u.arrow)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:0)+g/2;let S="",M="";return y==="bottom"?(S=h?x:`${m}px`,M=`${-g}px`):y==="top"?(S=h?x:`${m}px`,M=`${l.floating.height+g}px`):y==="right"?(S=`${-g}px`,M=h?x:`${_}px`):y==="left"&&(S=`${l.floating.width+g}px`,M=h?x:`${_}px`),{data:{x:S,y:M}}}});function TL(t){const[e,n="center"]=t.split("-");return[e,n]}const QG=VG,e$=GG,t$=XG,n$=ZG;function r$(t,e){return L.useReducer((n,r)=>{const i=e[n][r];return i??n},t)}const AL=t=>{const{present:e,children:n}=t,r=i$(e),i=typeof n=="function"?n({present:r.isPresent}):L.Children.only(n),o=Mu(r.ref,i.ref);return typeof n=="function"||r.isPresent?L.cloneElement(i,{ref:o}):null};AL.displayName="Presence";function i$(t){const[e,n]=L.useState(),r=L.useRef({}),i=L.useRef(t),o=L.useRef("none"),s=t?"mounted":"unmounted",[a,l]=r$(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return L.useEffect(()=>{const u=xm(r.current);o.current=a==="mounted"?u:"none"},[a]),du(()=>{const u=r.current,d=i.current;if(d!==t){const p=o.current,g=xm(u);t?l("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&p!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),du(()=>{if(e){const u=h=>{const g=xm(r.current).includes(h.animationName);h.target===e&&g&&Gd.flushSync(()=>l("ANIMATION_END"))},d=h=>{h.target===e&&(o.current=xm(r.current))};return e.addEventListener("animationstart",d),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{e.removeEventListener("animationstart",d),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:L.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function xm(t){return(t==null?void 0:t.animationName)||"none"}function o$({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=s$({defaultProp:e,onChange:n}),o=t!==void 0,s=o?t:r,a=Tu(n),l=L.useCallback(u=>{if(o){const h=typeof u=="function"?u(t):u;h!==t&&a(h)}else i(u)},[o,t,i,a]);return[s,l]}function s$({defaultProp:t,onChange:e}){const n=L.useState(t),[r]=n,i=L.useRef(r),o=Tu(e);return L.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}const a$=L.forwardRef((t,e)=>L.createElement(Bl.span,_n({},t,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}))),l$=a$,[L0,ZY]=uL("Tooltip",[EL]),D0=EL(),c$="TooltipProvider",d1="tooltip.open",[KY,Dw]=L0(c$),Ow="Tooltip",[u$,O0]=L0(Ow),f$=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i=!1,onOpenChange:o,disableHoverableContent:s,delayDuration:a}=t,l=Dw(Ow,t.__scopeTooltip),u=D0(e),[d,h]=L.useState(null),p=eG(),g=L.useRef(0),y=s??l.disableHoverableContent,w=a??l.delayDuration,x=L.useRef(!1),[m=!1,_]=o$({prop:r,defaultProp:i,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(d1))):l.onClose(),o==null||o(R)}}),S=L.useMemo(()=>m?x.current?"delayed-open":"instant-open":"closed",[m]),M=L.useCallback(()=>{window.clearTimeout(g.current),x.current=!1,_(!0)},[_]),T=L.useCallback(()=>{window.clearTimeout(g.current),_(!1)},[_]),A=L.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,_(!0)},w)},[w,_]);return L.useEffect(()=>()=>window.clearTimeout(g.current),[]),L.createElement(QG,u,L.createElement(u$,{scope:e,contentId:p,open:m,stateAttribute:S,trigger:d,onTriggerChange:h,onTriggerEnter:L.useCallback(()=>{l.isOpenDelayed?A():M()},[l.isOpenDelayed,A,M]),onTriggerLeave:L.useCallback(()=>{y?T():window.clearTimeout(g.current)},[T,y]),onOpen:M,onClose:T,disableHoverableContent:y},n))},iC="TooltipTrigger",d$=L.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=O0(iC,n),o=Dw(iC,n),s=D0(n),a=L.useRef(null),l=Mu(e,a,i.onTriggerChange),u=L.useRef(!1),d=L.useRef(!1),h=L.useCallback(()=>u.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),L.createElement(e$,_n({asChild:!0},s),L.createElement(Bl.button,_n({"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute},r,{ref:l,onPointerMove:us(t.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:us(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:us(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:us(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:us(t.onBlur,i.onClose),onClick:us(t.onClick,i.onClose)})))}),h$="TooltipPortal",[JY,p$]=L0(h$,{forceMount:void 0}),Fd="TooltipContent",m$=L.forwardRef((t,e)=>{const n=p$(Fd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=O0(Fd,t.__scopeTooltip);return L.createElement(AL,{present:r||s.open},s.disableHoverableContent?L.createElement(CL,_n({side:i},o,{ref:e})):L.createElement(g$,_n({side:i},o,{ref:e})))}),g$=L.forwardRef((t,e)=>{const n=O0(Fd,t.__scopeTooltip),r=Dw(Fd,t.__scopeTooltip),i=L.useRef(null),o=Mu(e,i),[s,a]=L.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:h}=r,p=L.useCallback(()=>{a(null),h(!1)},[h]),g=L.useCallback((y,w)=>{const x=y.currentTarget,m={x:y.clientX,y:y.clientY},_=S$(m,x.getBoundingClientRect()),S=w$(m,_),M=E$(w.getBoundingClientRect()),T=b$([...S,...M]);a(T),h(!0)},[h]);return L.useEffect(()=>()=>p(),[p]),L.useEffect(()=>{if(l&&d){const y=x=>g(x,d),w=x=>g(x,l);return l.addEventListener("pointerleave",y),d.addEventListener("pointerleave",w),()=>{l.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",w)}}},[l,d,g,p]),L.useEffect(()=>{if(s){const y=w=>{const x=w.target,m={x:w.clientX,y:w.clientY},_=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),S=!M$(m,s);_?p():S&&(p(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,d,s,u,p]),L.createElement(CL,_n({},t,{ref:o}))}),[v$,y$]=L0(Ow,{isInside:!1}),CL=L.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=t,l=O0(Fd,n),u=D0(n),{onClose:d}=l;return L.useEffect(()=>(document.addEventListener(d1,d),()=>document.removeEventListener(d1,d)),[d]),L.useEffect(()=>{if(l.trigger){const h=p=>{const g=p.target;g!=null&&g.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),L.createElement(qW,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:d},L.createElement(t$,_n({"data-state":l.stateAttribute},u,a,{ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),L.createElement(iL,null,r),L.createElement(v$,{scope:n,isInside:!0},L.createElement(l$,{id:l.contentId,role:"tooltip"},i||r))))}),_$="TooltipArrow",x$=L.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=D0(n);return y$(_$,n).isInside?null:L.createElement(n$,_n({},i,r,{ref:e}))});function S$(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function w$(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function E$(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function M$(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-a)*(r-l)/(d-l)+a&&(i=!i)}return i}function b$(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),T$(e)}function T$(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}const A$=f$,C$=d$,R$=m$,P$=x$;function I$(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function ln(t,e){if(t==null)return{};var n=I$(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}let Cn;(function(t){t[t.UNSUPPORTED_INPUT=0]="UNSUPPORTED_INPUT",t[t.NO_COMPONENT_FOR_TYPE=1]="NO_COMPONENT_FOR_TYPE",t[t.UNKNOWN_INPUT=2]="UNKNOWN_INPUT",t[t.DUPLICATE_KEYS=3]="DUPLICATE_KEYS",t[t.ALREADY_REGISTERED_TYPE=4]="ALREADY_REGISTERED_TYPE",t[t.CLIPBOARD_ERROR=5]="CLIPBOARD_ERROR",t[t.THEME_ERROR=6]="THEME_ERROR",t[t.PATH_DOESNT_EXIST=7]="PATH_DOESNT_EXIST",t[t.INPUT_TYPE_OVERRIDE=8]="INPUT_TYPE_OVERRIDE",t[t.EMPTY_KEY=9]="EMPTY_KEY"})(Cn||(Cn={}));const L$={[Cn.UNSUPPORTED_INPUT]:(t,e)=>[`An input with type \`${t}\` input was found at path \`${e}\` but it's not supported yet.`],[Cn.NO_COMPONENT_FOR_TYPE]:(t,e)=>[`Type \`${t}\` found at path \`${e}\` can't be displayed in panel because no component supports it yet.`],[Cn.UNKNOWN_INPUT]:(t,e)=>[`input at path \`${t}\` is not recognized.`,e],[Cn.DUPLICATE_KEYS]:(t,e,n)=>[`Key \`${t}\` of path \`${e}\` already exists at path \`${n}\`. Even nested keys need to be unique. Rename one of the keys.`],[Cn.ALREADY_REGISTERED_TYPE]:t=>[`Type ${t} has already been registered. You can't register a component with the same type.`],[Cn.CLIPBOARD_ERROR]:t=>["Error copying the value",t],[Cn.THEME_ERROR]:(t,e)=>[`Error accessing the theme \`${t}.${e}\` value.`],[Cn.PATH_DOESNT_EXIST]:t=>[`Error getting the value at path \`${t}\`. There is probably an error in your \`render\` function.`],[Cn.PATH_DOESNT_EXIST]:t=>[`Error accessing the value at path \`${t}\``],[Cn.INPUT_TYPE_OVERRIDE]:(t,e,n)=>[`Input at path \`${t}\` already exists with type: \`${e}\`. Its type cannot be overridden with type \`${n}\`.`],[Cn.EMPTY_KEY]:()=>["Keys can not be empty, if you want to hide a label use whitespace."]};function RL(t,e,...n){const[r,...i]=L$[e](...n);console[t]("LEVA: "+r,...i)}const ds=RL.bind(null,"warn"),D$=RL.bind(null,"log"),O$=["value"],N$=["schema"],k$=["value"],PL=[],Ll={};function oC(t){let{value:e}=t,n=ln(t,O$);for(let r of PL){const i=r(e,n);if(i)return i}}function Ps(t,e){let{schema:n}=e,r=ln(e,N$);if(t in Ll){ds(Cn.ALREADY_REGISTERED_TYPE,t);return}PL.push((i,o)=>n(i,o)&&t),Ll[t]=r}function a_(t,e,n,r){const{normalize:i}=Ll[t];if(i)return i(e,n,r);if(typeof e!="object"||!("value"in e))return{value:e};const{value:o}=e,s=ln(e,k$);return{value:o,settings:s}}function U$(t,e,n,r,i,o){const{sanitize:s}=Ll[t];return s?s(e,n,r,i,o):e}function sC(t,e,n){const{format:r}=Ll[t];return r?r(e,n):e}function F$(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aC(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function St(t){for(var e=1;et>n?n:t{if(t===""||typeof t=="number")return t;try{const e=Xs(t);if(!isNaN(e))return e}catch{}return parseFloat(t)},B$=Math.log(10);function lC(t){let e=Math.abs(+String(t).replace(".",""));if(e===0)return .01;for(;e!==0&&e%10===0;)e/=10;const n=Math.floor(Math.log(e)/B$)+1,r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,r-n);return Math.max(i,.001)}const Cg=(t,e,n)=>n===e?0:(Ea(t,e,n)-e)/(n-e),Rg=(t,e,n)=>t*(n-e)+e,H$=()=>"_"+Math.random().toString(36).substr(2,9),cC=/\(([0-9+\-*/^ .]+)\)/,uC=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,fC=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,dC=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,hC=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,pC=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function Xs(t){if(isNaN(Number(t)))if(cC.test(t)){const e=t.replace(cC,(n,r)=>String(Xs(r)));return Xs(e)}else if(uC.test(t)){const e=t.replace(uC,(n,r,i)=>String(Math.pow(Number(r),Number(i))));return Xs(e)}else if(fC.test(t)){const e=t.replace(fC,(n,r,i)=>String(Number(r)*Number(i)));return Xs(e)}else if(dC.test(t)){const e=t.replace(dC,(n,r,i)=>{if(i!=0)return String(Number(r)/Number(i));throw new Error("Division by zero")});return Xs(e)}else if(hC.test(t)){const e=t.replace(hC,(n,r,i)=>String(Number(r)+Number(i)));return Xs(e)}else if(pC.test(t)){const e=t.replace(pC,(n,r,i)=>String(Number(r)-Number(i)));return Xs(e)}else return Number(t);return Number(t)}function V$(t,e){return e.reduce((n,r)=>(t&&t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}function W$(t,e){const n=St({},t);return e.forEach(r=>r in t&&delete n[r]),n}function G$(t,e){return t.reduce((n,r,i)=>Object.assign(n,{[e[i]]:r}),{})}function IL(t){return Object.prototype.toString.call(t)==="[object Object]"}const $$=t=>IL(t)&&Object.keys(t).length===0;let ho;(function(t){t.BUTTON="BUTTON",t.BUTTON_GROUP="BUTTON_GROUP",t.MONITOR="MONITOR",t.FOLDER="FOLDER"})(ho||(ho={}));let mo;(function(t){t.SELECT="SELECT",t.IMAGE="IMAGE",t.NUMBER="NUMBER",t.COLOR="COLOR",t.STRING="STRING",t.BOOLEAN="BOOLEAN",t.INTERVAL="INTERVAL",t.VECTOR3D="VECTOR3D",t.VECTOR2D="VECTOR2D"})(mo||(mo={}));const j$=["type","__customInput"],X$=["render","label","optional","order","disabled","hint","onChange","onEditStart","onEditEnd","transient"],Y$=["type"];function LL(t,e,n={},r){var i,o;if(typeof t!="object"||Array.isArray(t))return{type:r,input:t,options:St({key:e,label:e,optional:!1,disabled:!1,order:0},n)};if("__customInput"in t){const{type:T,__customInput:A}=t,R=ln(t,j$);return LL(A,e,R,T)}const{render:s,label:a,optional:l,order:u=0,disabled:d,hint:h,onChange:p,onEditStart:g,onEditEnd:y,transient:w}=t,x=ln(t,X$),m=St({render:s,key:e,label:a??e,hint:h,transient:w??!!p,onEditStart:g,onEditEnd:y,disabled:d,optional:l,order:u},n);let{type:_}=x,S=ln(x,Y$);if(_=r??_,_ in ho)return{type:_,input:S,options:m};let M;return r&&IL(S)&&"value"in S?M=S.value:M=$$(S)?void 0:S,{type:_,input:M,options:St(St({},m),{},{onChange:p,optional:(i=m.optional)!==null&&i!==void 0?i:!1,disabled:(o=m.disabled)!==null&&o!==void 0?o:!1})}}function q$(t,e,n,r){const i=LL(t,e),{type:o,input:s,options:a}=i;if(o)return o in ho?i:{type:o,input:a_(o,s,n,r),options:a};let l=oC(s);return l?{type:l,input:a_(l,s,n,r),options:a}:(l=oC({value:s}),l?{type:l,input:a_(l,{value:s},n,r),options:a}:!1)}function mC(t,e,n,r,i){const{value:o,type:s,settings:a}=t;t.value=DL({type:s,value:o,settings:a},e,n,r),t.fromPanel=i}const Z$=function(e,n,r){this.type="LEVA_ERROR",this.message="LEVA: "+e,this.previousValue=n,this.error=r};function DL({type:t,value:e,settings:n},r,i,o){const s=t!=="SELECT"&&typeof r=="function"?r(e):r;let a;try{a=U$(t,s,n,e,i,o)}catch(l){throw new Z$(`The value \`${r}\` did not result in a correct value.`,e,l)}return Od(a,e)?e:a}const OL=(t,e,n=!1)=>{let r=0;return function(){const i=arguments,o=n&&!r,s=()=>t.apply(this,i);window.clearTimeout(r),r=window.setTimeout(s,e),o&&s()}},NL=t=>t.shiftKey?5:t.altKey?1/5:1;function K$(t,e){const n=console.error;console.error=()=>{},lP.render(t,e),console.error=n}const J$=["value"],Q$=["min","max"],e9=t=>{if(typeof t=="number")return!0;if(typeof t=="string"){const e=parseFloat(t);return isNaN(e)?!1:t.substring((""+e).length).trim().length<4}return!1},kL=(t,{min:e=-1/0,max:n=1/0,suffix:r})=>{const i=parseFloat(t);if(t===""||isNaN(i))throw Error("Invalid number");const o=Ea(i,e,n);return r?o+r:o},t9=(t,{pad:e=0,suffix:n})=>{const r=parseFloat(t).toFixed(e);return n?r+n:r},UL=t=>{let{value:e}=t,n=ln(t,J$);const{min:r=-1/0,max:i=1/0}=n,o=ln(n,Q$);let s=parseFloat(e);const a=typeof e=="string"?e.substring((""+s).length):void 0;s=Ea(s,r,i);let l=n.step;l||(Number.isFinite(r)?Number.isFinite(i)?l=+(Math.abs(i-r)/100).toPrecision(1):l=+(Math.abs(s-r)/100).toPrecision(1):Number.isFinite(i)&&(l=+(Math.abs(i-s)/100).toPrecision(1)));const u=l?lC(l)*10:lC(s);l=l||u/10;const d=Math.round(Ea(Math.log10(1/u),0,2));return{value:a?s+a:s,settings:St({initialValue:s,step:l,pad:d,min:r,max:i,suffix:a},o)}},FL=(t,{step:e,initialValue:n})=>{const r=Math.round((t-n)/e);return n+r*e};var zL=Object.freeze({__proto__:null,schema:e9,sanitize:kL,format:t9,normalize:UL,sanitizeStep:FL});function Hn(){return Hn=Object.assign?Object.assign.bind():function(t){for(var e=1;e({colors:{elevation1:"#292d39",elevation2:"#181c20",elevation3:"#373c4b",accent1:"#0066dc",accent2:"#007bff",accent3:"#3c93ff",highlight1:"#535760",highlight2:"#8c92a4",highlight3:"#fefefe",vivid1:"#ffcc00",folderWidgetColor:"$highlight2",folderTextColor:"$highlight3",toolTipBackground:"$highlight3",toolTipText:"$elevation2"},radii:{xs:"2px",sm:"3px",lg:"10px"},space:{xs:"3px",sm:"6px",md:"10px",rowGap:"7px",colGap:"7px"},fonts:{mono:"ui-monospace, SFMono-Regular, Menlo, 'Roboto Mono', monospace",sans:"system-ui, sans-serif"},fontSizes:{root:"11px",toolTip:"$root"},sizes:{rootWidth:"280px",controlWidth:"160px",numberInputMinWidth:"38px",scrubberWidth:"8px",scrubberHeight:"16px",rowHeight:"24px",folderTitleHeight:"20px",checkboxSize:"16px",joystickWidth:"100px",joystickHeight:"100px",colorPickerWidth:"$controlWidth",colorPickerHeight:"100px",imagePreviewWidth:"$controlWidth",imagePreviewHeight:"100px",monitorHeight:"60px",titleBarHeight:"39px"},shadows:{level1:"0 0 9px 0 #00000088",level2:"0 4px 14px #00000033"},borderWidths:{root:"0px",input:"1px",focus:"1px",hover:"1px",active:"1px",folder:"1px"},fontWeights:{label:"normal",folder:"normal",button:"normal"}});function Sm(t,e){const[n,r]=t.split(" "),i={};return n!=="none"&&(i.boxShadow=`${e.inset?"inset ":""}0 0 0 $borderWidths${[e.key]} $colors${n!=="default"&&n||e.borderColor}`),r&&(i.backgroundColor=r),i}const xf={$inputStyle:()=>t=>Sm(t,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>t=>Sm(t,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>t=>Sm(t,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>t=>Sm(t,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:_t,css:QY,createTheme:r9,globalCss:i9,keyframes:eq}=WW({prefix:"leva",theme:WL(),utils:St(St({},xf),{},{$flex:()=>({display:"flex",alignItems:"center"}),$flexCenter:()=>({display:"flex",alignItems:"center",justifyContent:"center"}),$reset:()=>({outline:"none",fontSize:"inherit",fontWeight:"inherit",color:"inherit",fontFamily:"inherit",border:"none",backgroundColor:"transparent",appearance:"none"}),$draggable:()=>({touchAction:"none",WebkitUserDrag:"none",userSelect:"none"}),$focus:t=>({"&:focus":xf.$focusStyle()(t)}),$focusWithin:t=>({"&:focus-within":xf.$focusStyle()(t)}),$hover:t=>({"&:hover":xf.$hoverStyle()(t)}),$active:t=>({"&:active":xf.$activeStyle()(t)})})}),o9=i9({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});function s9(t){const e=WL();if(!t)return{theme:e,className:""};Object.keys(t).forEach(r=>{Object.assign(e[r],t[r])});const n=r9(e);return{theme:e,className:n.className}}function ys(t,e){const{theme:n}=L.useContext(Nw);if(!(t in n)||!(e in n[t]))return ds(Cn.THEME_ERROR,t,e),"";let r=e;for(;;){let i=n[t][r];if(typeof i=="string"&&i.charAt(0)==="$")r=i.substr(1);else return i}}const GL=_t("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),$L=_t("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${GL}`]:{paddingLeft:0}}),a9=_t($L,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),l9=_t("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),c9=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],u9=["onUpdate"];function kw(t){let{innerLabel:e,value:n,onUpdate:r,onChange:i,onKeyDown:o,type:s,id:a,inputType:l="text",rows:u=0}=t,d=ln(t,c9);const{id:h,emitOnEditStart:p,emitOnEditEnd:g,disabled:y}=Or(),w=a||h,x=L.useRef(null),m=u>0,_=m?"textarea":"input",S=L.useCallback(A=>R=>{const O=R.currentTarget.value;A(O)},[]);te.useEffect(()=>{const A=x.current,R=S(O=>{r(O),g()});return A==null||A.addEventListener("blur",R),()=>A==null?void 0:A.removeEventListener("blur",R)},[S,r,g]);const M=L.useCallback(A=>{A.key==="Enter"&&S(r)(A)},[S,r]),T=Object.assign({as:_},m?{rows:u}:{},d);return te.createElement(l9,{textArea:m},e&&typeof e=="string"?te.createElement($L,null,e):e,te.createElement(GL,Hn({levaType:s,ref:x,id:w,type:l,autoComplete:"off",spellCheck:"false",value:n,onChange:S(i),onFocus:()=>p(),onKeyPress:M,onKeyDown:o,disabled:y},T)))}function f9(t){let{onUpdate:e}=t,n=ln(t,u9);const r=L.useCallback(o=>e(z$(o)),[e]),i=L.useCallback(o=>{const s=o.key==="ArrowUp"?1:o.key==="ArrowDown"?-1:0;if(s){o.preventDefault();const a=o.altKey?.1:o.shiftKey?10:1;e(l=>parseFloat(l)+s*a)}},[e]);return te.createElement(kw,Hn({},n,{onUpdate:r,onKeyDown:i,type:"number"}))}const Pg=_t("div",{}),h1=_t("div",{position:"relative",background:"$elevation2",transition:"height 300ms ease",variants:{fill:{true:{},false:{}},flat:{false:{},true:{}},isRoot:{true:{},false:{paddingLeft:"$md","&::after":{content:'""',position:"absolute",left:0,top:0,width:"$borderWidths$folder",height:"100%",backgroundColor:"$folderWidgetColor",opacity:.4,transform:"translateX(-50%)"}}}},compoundVariants:[{isRoot:!0,fill:!1,css:{overflowY:"auto",maxHeight:"calc(100vh - 20px - $$titleBarHeight)"}},{isRoot:!0,flat:!1,css:{borderRadius:"$lg"}}]}),d9=_t("div",{$flex:"",color:"$folderTextColor",userSelect:"none",cursor:"pointer",height:"$folderTitleHeight",fontWeight:"$folder","> svg":{marginLeft:-4,marginRight:4,cursor:"pointer",fill:"$folderWidgetColor",opacity:.6},"&:hover > svg":{fill:"$folderWidgetColor"},[`&:hover + ${h1}::after`]:{opacity:.6},[`${Pg}:hover > & + ${h1}::after`]:{opacity:.6},[`${Pg}:hover > & > svg`]:{opacity:1}}),jL=_t("div",{position:"relative",display:"grid",gridTemplateColumns:"100%",rowGap:"$rowGap",transition:"opacity 250ms ease",variants:{toggled:{true:{opacity:1,transitionDelay:"250ms"},false:{opacity:0,transitionDelay:"0ms",pointerEvents:"none"}},isRoot:{true:{"& > div":{paddingLeft:"$md",paddingRight:"$md"},"& > div:first-of-type":{paddingTop:"$sm"},"& > div:last-of-type":{paddingBottom:"$sm"},[`> ${Pg}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),XL=_t("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${jL} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),YL=_t(XL,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),h9=_t("div",{$flex:"",height:"100%",position:"relative",overflow:"hidden","& > div":{marginLeft:"$colGap",padding:"0 $xs",opacity:.4},"& > div:hover":{opacity:.8},"& > div > svg":{display:"none",cursor:"pointer",width:13,minWidth:13,height:13,backgroundColor:"$elevation2"},"&:hover > div > svg":{display:"block"},variants:{align:{top:{height:"100%",alignItems:"flex-start",paddingTop:"$sm"}}}}),p9=_t("input",{$reset:"",height:0,width:0,opacity:0,margin:0,"& + label":{position:"relative",$flexCenter:"",height:"100%",userSelect:"none",cursor:"pointer",paddingLeft:2,paddingRight:"$sm",pointerEvents:"auto"},"& + label:after":{content:'""',width:6,height:6,backgroundColor:"$elevation3",borderRadius:"50%",$activeStyle:""},"&:focus + label:after":{$focusStyle:""},"& + label:active:after":{backgroundColor:"$accent1",$focusStyle:""},"&:checked + label:after":{backgroundColor:"$accent1"}}),p1=_t("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}}),m9=_t("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${p1}`]:{pointerEvents:"auto"}}}}}),qL=_t("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"}),g9=_t("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),v9=_t(P$,{fill:"$toolTipBackground"});function Uw({children:t}){const{className:e}=L.useContext(Nw);return te.createElement(fW,{className:e},t)}const y9=["align"];function _9(){const{id:t,disable:e,disabled:n}=Or();return te.createElement(te.Fragment,null,te.createElement(p9,{id:t+"__disable",type:"checkbox",checked:!n,onChange:()=>e(!n)}),te.createElement("label",{htmlFor:t+"__disable"}))}function x9(t){const{id:e,optional:n,hint:r}=Or(),i=t.htmlFor||(e?{htmlFor:e}:null),o=!r&&typeof t.children=="string"?{title:t.children}:null;return te.createElement(te.Fragment,null,n&&te.createElement(_9,null),r!==void 0?te.createElement(A$,null,te.createElement(C$,{asChild:!0},te.createElement(p1,Hn({},i,t))),te.createElement(R$,{side:"top",sideOffset:2},te.createElement(g9,null,r,te.createElement(v9,null)))):te.createElement(p1,Hn({},i,o,t)))}function _o(t){let{align:e}=t,n=ln(t,y9);const{value:r,label:i,key:o,disabled:s}=Or(),{hideCopyButton:a}=n9(),l=!a&&o!==void 0,[u,d]=L.useState(!1),h=async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[o]:r??""})),d(!0)}catch{ds(Cn.CLIPBOARD_ERROR,{[o]:r})}};return te.createElement(h9,{align:e,onPointerLeave:()=>d(!1)},te.createElement(x9,n),l&&!s&&te.createElement("div",{title:`Click to copy ${typeof i=="string"?i:o} value`},u?te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},te.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),te.createElement("path",{fillRule:"evenodd",d:"M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})):te.createElement("svg",{onClick:h,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},te.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),te.createElement("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"}))))}const S9=["toggled"],w9=_t("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function Fw(t){let{toggled:e}=t,n=ln(t,S9);return te.createElement(w9,Hn({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e?0:-90}deg)`}},n),te.createElement("path",{d:"M3.8 4.4c.4.3 1 .3 1.4 0L8 1.7A1 1 0 007.4 0H1.6a1 1 0 00-.7 1.7l3 2.7z"}))}const E9=["input"];function qi(t){let{input:e}=t,n=ln(t,E9);return e?te.createElement(YL,n):te.createElement(XL,n)}function ZL({value:t,type:e,settings:n,setValue:r}){const[i,o]=L.useState(sC(e,t,n)),s=L.useRef(t),a=L.useRef(n);a.current=n;const l=L.useCallback(d=>o(sC(e,d,a.current)),[e]),u=L.useCallback(d=>{try{r(d)}catch(h){const{type:p,previousValue:g}=h;if(p!=="LEVA_ERROR")throw h;l(g)}},[l,r]);return L.useEffect(()=>{Od(t,s.current)||l(t),s.current=t},[t,l]),{displayValue:i,onChange:o,onUpdate:u}}function dh(t,e){const{emitOnEditStart:n,emitOnEditEnd:r}=Or();return m8(i=>{i.first&&(document.body.classList.add("leva__panel__dragged"),n==null||n());const o=t(i);return i.last&&(document.body.classList.remove("leva__panel__dragged"),r==null||r()),o},e)}function M9(t){const e=L.useRef(null),n=L.useRef(null),r=L.useRef(!1);return L.useEffect(()=>{const i=OL(()=>{e.current.width=e.current.offsetWidth*window.devicePixelRatio,e.current.height=e.current.offsetHeight*window.devicePixelRatio,t(e.current,n.current)},250);return window.addEventListener("resize",i),r.current||(i(),r.current=!0),()=>window.removeEventListener("resize",i)},[t]),L.useEffect(()=>{n.current=e.current.getContext("2d")},[]),[e,n]}function KL(){const t=L.useRef(null),e=L.useRef({x:0,y:0}),n=L.useCallback(r=>{Object.assign(e.current,r),t.current&&(t.current.style.transform=`translate3d(${e.current.x}px, ${e.current.y}px, 0)`)},[]);return[t,n]}const b9=["__refCount"],l_=(t,e)=>{if(!t[e])return null;const n=t[e];return ln(n,b9)};function T9(t){const e=fh(),[n,r]=L.useState(l_(e.getData(),t)),i=L.useCallback(u=>e.setValueAtPath(t,u,!0),[t,e]),o=L.useCallback(u=>e.setSettingsAtPath(t,u),[t,e]),s=L.useCallback(u=>e.disableInputAtPath(t,u),[t,e]),a=L.useCallback(()=>e.emitOnEditStart(t),[t,e]),l=L.useCallback(()=>e.emitOnEditEnd(t),[t,e]);return L.useEffect(()=>{r(l_(e.getData(),t));const u=e.useStore.subscribe(d=>l_(d.data,t),r,{equalityFn:ch});return()=>u()},[e,t]),[n,{set:i,setSettings:o,disable:s,storeId:e.storeId,emitOnEditStart:a,emitOnEditEnd:l}]}const A9=_t("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),JL=_t("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),m1=_t("div",{position:"absolute",width:"$scrubberWidth",height:"$scrubberHeight",borderRadius:"$xs",boxShadow:"0 0 0 2px $colors$elevation2",backgroundColor:"$accent2",cursor:"pointer",$active:"none $accent1",$hover:"none $accent3",variants:{position:{left:{borderTopRightRadius:0,borderBottomRightRadius:0,transform:"translateX(calc(-0.5 * ($sizes$scrubberWidth + 4px)))"},right:{borderTopLeftRadius:0,borderBottomLeftRadius:0,transform:"translateX(calc(0.5 * ($sizes$scrubberWidth + 4px)))"}}}}),QL=_t("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),eD=_t("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function C9({value:t,min:e,max:n,onDrag:r,step:i,initialValue:o}){const s=L.useRef(null),a=L.useRef(null),l=L.useRef(0),u=ys("sizes","scrubberWidth"),d=dh(({event:p,first:g,xy:[y],movement:[w],memo:x})=>{if(g){const{width:_,left:S}=s.current.getBoundingClientRect();l.current=_-parseFloat(u),x=(p==null?void 0:p.target)===a.current?t:Rg((y-S)/_,e,n)}const m=x+Rg(w/l.current,0,n-e);return r(FL(m,{step:i,initialValue:o})),x}),h=Cg(t,e,n);return te.createElement(QL,Hn({ref:s},d()),te.createElement(JL,null,te.createElement(eD,{style:{left:0,right:`${(1-h)*100}%`}})),te.createElement(m1,{ref:a,style:{left:`calc(${h} * (100% - ${u}))`}}))}const R9=te.memo(({label:t,onUpdate:e,step:n,innerLabelTrim:r})=>{const[i,o]=L.useState(!1),s=dh(({active:a,delta:[l],event:u,memo:d=0})=>(o(a),d+=l/2,Math.abs(d)>=1&&(e(h=>parseFloat(h)+Math.floor(d)*n*NL(u)),d=0),d));return te.createElement(a9,Hn({dragging:i,title:t.length>1?t:""},s()),t.slice(0,r))});function tD({label:t,id:e,displayValue:n,onUpdate:r,onChange:i,settings:o,innerLabelTrim:s=1}){const a=s>0&&te.createElement(R9,{label:t,step:o.step,onUpdate:r,innerLabelTrim:s});return te.createElement(f9,{id:e,value:String(n),onUpdate:r,onChange:i,innerLabel:a})}function P9(){const t=Or(),{label:e,value:n,onUpdate:r,settings:i,id:o}=t,{min:s,max:a}=i,l=a!==1/0&&s!==-1/0;return te.createElement(qi,{input:!0},te.createElement(_o,null,e),te.createElement(A9,{hasRange:l},l&&te.createElement(C9,Hn({value:parseFloat(n),onDrag:r},i)),te.createElement(tD,Hn({},t,{id:o,label:"value",innerLabelTrim:l?0:1}))))}const{sanitizeStep:I9}=zL,L9=ln(zL,["sanitizeStep"]);var D9=St({component:P9},L9);const O9=(t,e)=>oi().schema({options:oi().passesAnyOf(oi().object(),oi().array())}).test(e),N9=(t,{values:e})=>{if(e.indexOf(t)<0)throw Error("Selected value doesn't match Select options");return t},k9=(t,{values:e})=>e.indexOf(t),U9=t=>{let{value:e,options:n}=t,r,i;return Array.isArray(n)?(i=n,r=n.map(o=>String(o))):(i=Object.values(n),r=Object.keys(n)),"value"in t?i.includes(e)||(r.unshift(String(e)),i.unshift(e)):e=i[0],Object.values(n).includes(e)||(n[String(e)]=e),{value:e,settings:{keys:r,values:i}}};var F9=Object.freeze({__proto__:null,schema:O9,sanitize:N9,format:k9,normalize:U9});const z9=_t("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),g1=_t("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),B9=_t("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${g1}:focus + &`]:{$focusStyle:""},[`${g1}:hover + &`]:{$hoverStyle:""}});function H9({displayValue:t,value:e,onUpdate:n,id:r,settings:i,disabled:o}){const{keys:s,values:a}=i,l=L.useRef();return e===a[t]&&(l.current=s[t]),te.createElement(z9,null,te.createElement(g1,{id:r,value:t,onChange:u=>n(a[Number(u.currentTarget.value)]),disabled:o},s.map((u,d)=>te.createElement("option",{key:u,value:d},u))),te.createElement(B9,null,l.current),te.createElement(Fw,{toggled:!0}))}function V9(){const{label:t,value:e,displayValue:n,onUpdate:r,id:i,disabled:o,settings:s}=Or();return te.createElement(qi,{input:!0},te.createElement(_o,null,t),te.createElement(H9,{id:i,value:e,displayValue:n,onUpdate:r,settings:s,disabled:o}))}var W9=St({component:V9},F9);const G9=t=>oi().string().test(t),$9=t=>{if(typeof t!="string")throw Error("Invalid string");return t},j9=({value:t,editable:e=!0,rows:n=!1})=>({value:t,settings:{editable:e,rows:typeof n=="number"?n:n?5:0}});var X9=Object.freeze({__proto__:null,schema:G9,sanitize:$9,normalize:j9});const Y9=["displayValue","onUpdate","onChange","editable"],q9=_t("div",{whiteSpace:"pre-wrap"});function Z9(t){let{displayValue:e,onUpdate:n,onChange:r,editable:i=!0}=t,o=ln(t,Y9);return i?te.createElement(kw,Hn({value:e,onUpdate:n,onChange:r},o)):te.createElement(q9,null,e)}function K9(){const{label:t,settings:e,displayValue:n,onUpdate:r,onChange:i}=Or();return te.createElement(qi,{input:!0},te.createElement(_o,null,t),te.createElement(Z9,Hn({displayValue:n,onUpdate:r,onChange:i},e)))}var J9=St({component:K9},X9);const Q9=t=>oi().boolean().test(t),e7=t=>{if(typeof t!="boolean")throw Error("Invalid boolean");return t};var t7=Object.freeze({__proto__:null,schema:Q9,sanitize:e7});const n7=_t("div",{position:"relative",$flex:"",height:"$rowHeight",input:{$reset:"",height:0,width:0,opacity:0,margin:0},label:{position:"relative",$flexCenter:"",userSelect:"none",cursor:"pointer",height:"$checkboxSize",width:"$checkboxSize",backgroundColor:"$elevation3",borderRadius:"$sm",$hover:""},"input:focus + label":{$focusStyle:""},"input:focus:checked + label, input:checked + label:hover":{$hoverStyle:"$accent3"},"input + label:active":{backgroundColor:"$accent1"},"input:checked + label:active":{backgroundColor:"$accent1"},"label > svg":{display:"none",width:"90%",height:"90%",stroke:"$highlight3"},"input:checked + label":{backgroundColor:"$accent2"},"input:checked + label > svg":{display:"block"}});function r7({value:t,onUpdate:e,id:n,disabled:r}){return te.createElement(n7,null,te.createElement("input",{id:n,type:"checkbox",checked:t,onChange:i=>e(i.currentTarget.checked),disabled:r}),te.createElement("label",{htmlFor:n},te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},te.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}function i7(){const{label:t,value:e,onUpdate:n,disabled:r,id:i}=Or();return te.createElement(qi,{input:!0},te.createElement(_o,null,t),te.createElement(r7,{value:e,onUpdate:n,id:i,disabled:r}))}var o7=St({component:i7},t7);const s7=["locked"];function a7({value:t,id:e,valueKey:n,settings:r,onUpdate:i,innerLabelTrim:o}){const s=L.useRef(t[n]);s.current=t[n];const a=L.useCallback(u=>i({[n]:DL({type:"NUMBER",value:s.current,settings:r},u)}),[i,r,n]),l=ZL({type:"NUMBER",value:t[n],settings:r,setValue:a});return te.createElement(tD,{id:e,label:n,value:t[n],displayValue:l.displayValue,onUpdate:l.onUpdate,onChange:l.onChange,settings:r,innerLabelTrim:o})}const l7=_t("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});function c7(t){let{locked:e}=t,n=ln(t,s7);return te.createElement("svg",Hn({width:"10",height:"10",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),e?te.createElement("path",{d:"M5 4.63601C5 3.76031 5.24219 3.1054 5.64323 2.67357C6.03934 2.24705 6.64582 1.9783 7.5014 1.9783C8.35745 1.9783 8.96306 2.24652 9.35823 2.67208C9.75838 3.10299 10 3.75708 10 4.63325V5.99999H5V4.63601ZM4 5.99999V4.63601C4 3.58148 4.29339 2.65754 4.91049 1.99307C5.53252 1.32329 6.42675 0.978302 7.5014 0.978302C8.57583 0.978302 9.46952 1.32233 10.091 1.99162C10.7076 2.65557 11 3.57896 11 4.63325V5.99999H12C12.5523 5.99999 13 6.44771 13 6.99999V13C13 13.5523 12.5523 14 12 14H3C2.44772 14 2 13.5523 2 13V6.99999C2 6.44771 2.44772 5.99999 3 5.99999H4ZM3 6.99999H12V13H3V6.99999Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}):te.createElement("path",{d:"M9 3.63601C9 2.76044 9.24207 2.11211 9.64154 1.68623C10.0366 1.26502 10.6432 1 11.5014 1C12.4485 1 13.0839 1.30552 13.4722 1.80636C13.8031 2.23312 14 2.84313 14 3.63325H15C15 2.68242 14.7626 1.83856 14.2625 1.19361C13.6389 0.38943 12.6743 0 11.5014 0C10.4294 0 9.53523 0.337871 8.91218 1.0021C8.29351 1.66167 8 2.58135 8 3.63601V6H1C0.447715 6 0 6.44772 0 7V13C0 13.5523 0.447715 14 1 14H10C10.5523 14 11 13.5523 11 13V7C11 6.44772 10.5523 6 10 6H9V3.63601ZM1 7H10V13H1V7Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function zw({value:t,onUpdate:e,settings:n,innerLabelTrim:r}){const{id:i,setSettings:o}=Or(),{lock:s,locked:a}=n;return te.createElement(l7,{withLock:s},s&&te.createElement(c7,{locked:a,onClick:()=>o({locked:!a})}),Object.keys(t).map((l,u)=>te.createElement(a7,{id:u===0?i:`${i}.${l}`,key:l,valueKey:l,value:t,settings:n[l],onUpdate:e,innerLabelTrim:r})))}const nD=(t,e)=>{const n={};let r=0,i=1/0;Object.entries(t).forEach(([o,s])=>{n[o]=UL(St({value:s},e[o])).settings,r=Math.max(r,n[o].step),i=Math.min(i,n[o].pad)});for(let o in n){const{step:s,min:a,max:l}=e[o]||{};!isFinite(s)&&(!isFinite(a)||!isFinite(l))&&(n[o].step=r,n[o].pad=i)}return n},u7=["lock"],f7=["value"];function d7(t){const e=oi().array().length(t).every.number(),n=r=>{if(!r||typeof r!="object")return!1;const i=Object.values(r);return i.length===t&&i.every(o=>isFinite(o))};return r=>e.test(r)||n(r)}function h7(t){return Array.isArray(t)?"array":"object"}function $f(t,e,n){return h7(t)===e?t:e==="array"?Object.values(t):G$(t,n)}const p7=(t,e,n)=>{const r=$f(t,"object",e.keys);for(let s in r)r[s]=kL(r[s],e[s]);const i=Object.keys(r);let o={};if(i.length===e.keys.length)o=r;else{const s=$f(n,"object",e.keys);if(i.length===1&&e.locked){const a=i[0],l=r[a],u=s[a],d=u!==0?l/u:1;for(let h in s)h===a?o[a]=l:o[h]=s[h]*d}else o=St(St({},s),r)}return $f(o,e.format,e.keys)},m7=(t,e)=>$f(t,"object",e.keys),g7=t=>!!t&&("step"in t||"min"in t||"max"in t);function v7(t,e,n=[]){const{lock:r=!1}=e,i=ln(e,u7),o=Array.isArray(t)?"array":"object",s=o==="object"?Object.keys(t):n,a=$f(t,"object",s),l=g7(i)?s.reduce((d,h)=>Object.assign(d,{[h]:i}),{}):i,u=nD(a,l);return{value:o==="array"?t:a,settings:St(St({},u),{},{format:o,keys:s,lock:r,locked:!1})}}function rD(t){return{schema:d7(t.length),normalize:e=>{let{value:n}=e,r=ln(e,f7);return v7(n,r,t)},format:(e,n)=>m7(e,n),sanitize:(e,n,r)=>p7(e,n,r)}}var y7={grad:.9,turn:360,rad:360/(2*Math.PI)},ss=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},lr=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},Vi=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},iD=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},gC=function(t){return{r:Vi(t.r,0,255),g:Vi(t.g,0,255),b:Vi(t.b,0,255),a:Vi(t.a)}},c_=function(t){return{r:lr(t.r),g:lr(t.g),b:lr(t.b),a:lr(t.a,3)}},_7=/^#([0-9a-f]{3,8})$/i,wm=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},oD=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),a=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},sD=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),s=r*(1-n),a=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),u=o%6;return{r:255*[r,a,s,s,l,r][u],g:255*[l,r,r,a,s,s][u],b:255*[s,s,l,r,r,a][u],a:i}},vC=function(t){return{h:iD(t.h),s:Vi(t.s,0,100),l:Vi(t.l,0,100),a:Vi(t.a)}},yC=function(t){return{h:lr(t.h),s:lr(t.s),l:lr(t.l),a:lr(t.a,3)}},_C=function(t){return sD((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},jf=function(t){return{h:(e=oD(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},x7=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,S7=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w7=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,E7=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v1={string:[[function(t){var e=_7.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?lr(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?lr(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=w7.exec(t)||E7.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:gC({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=x7.exec(t)||S7.exec(t);if(!e)return null;var n,r,i=vC({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(y7[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return _C(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=i===void 0?1:i;return ss(e)&&ss(n)&&ss(r)?gC({r:Number(e),g:Number(n),b:Number(r),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,o=i===void 0?1:i;if(!ss(e)||!ss(n)||!ss(r))return null;var s=vC({h:Number(e),s:Number(n),l:Number(r),a:Number(o)});return _C(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,o=i===void 0?1:i;if(!ss(e)||!ss(n)||!ss(r))return null;var s=function(a){return{h:iD(a.h),s:Vi(a.s,0,100),v:Vi(a.v,0,100),a:Vi(a.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(o)});return sD(s)},"hsv"]]},xC=function(t,e){for(var n=0;n=.5},t.prototype.toHex=function(){return e=c_(this.rgba),n=e.r,r=e.g,i=e.b,s=(o=e.a)<1?wm(lr(255*o)):"","#"+wm(n)+wm(r)+wm(i)+s;var e,n,r,i,o,s},t.prototype.toRgb=function(){return c_(this.rgba)},t.prototype.toRgbString=function(){return e=c_(this.rgba),n=e.r,r=e.g,i=e.b,(o=e.a)<1?"rgba("+n+", "+r+", "+i+", "+o+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,o},t.prototype.toHsl=function(){return yC(jf(this.rgba))},t.prototype.toHslString=function(){return e=yC(jf(this.rgba)),n=e.h,r=e.s,i=e.l,(o=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+o+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,o},t.prototype.toHsv=function(){return e=oD(this.rgba),{h:lr(e.h),s:lr(e.s),v:lr(e.v),a:lr(e.a,3)};var e},t.prototype.invert=function(){return Vr({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),Vr(u_(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Vr(u_(this.rgba,-e))},t.prototype.grayscale=function(){return Vr(u_(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Vr(SC(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Vr(SC(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?Vr({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):lr(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=jf(this.rgba);return typeof e=="number"?Vr({h:e,s:n.s,l:n.l,a:n.a}):lr(n.h)},t.prototype.isEqual=function(e){return this.toHex()===Vr(e).toHex()},t}(),Vr=function(t){return t instanceof y1?t:new y1(t)},wC=[],b7=function(t){t.forEach(function(e){wC.indexOf(e)<0&&(e(y1,v1),wC.push(e))})};function T7(t,e){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in n)r[n[i]]=i;var o={};t.prototype.toName=function(s){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=r[this.toHex()];if(u)return u;if(s!=null&&s.closest){var d=this.toRgb(),h=1/0,p="black";if(!o.length)for(var g in n)o[g]=new t(n[g]).toRgb();for(var y in n){var w=(a=d,l=o[y],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));w=0||(i[n]=t[n]);return i}function _1(t){var e=L.useRef(t),n=L.useRef(function(r){e.current&&e.current(r)});return e.current=t,n.current}var pu=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t0:x.buttons>0)&&i.current?o(EC(i.current,x,a.current)):w(!1)},y=function(){return w(!1)};function w(x){var m=l.current,_=x1(i.current),S=x?_.addEventListener:_.removeEventListener;S(m?"touchmove":"mousemove",g),S(m?"touchend":"mouseup",y)}return[function(x){var m=x.nativeEvent,_=i.current;if(_&&(MC(m),!function(M,T){return T&&!Xf(M)}(m,l.current)&&_)){if(Xf(m)){l.current=!0;var S=m.changedTouches||[];S.length&&(a.current=S[0].identifier)}_.focus(),o(EC(_,m,a.current)),w(!0)}},function(x){var m=x.which||x.keyCode;m<37||m>40||(x.preventDefault(),s({left:m===39?.05:m===37?-.05:0,top:m===40?.05:m===38?-.05:0}))},w]},[s,o]),d=u[0],h=u[1],p=u[2];return L.useEffect(function(){return p},[p]),te.createElement("div",Ru({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:i,onKeyDown:h,tabIndex:0,role:"slider"}))}),hh=function(t){return t.filter(Boolean).join(" ")},Vw=function(t){var e=t.color,n=t.left,r=t.top,i=r===void 0?.5:r,o=hh(["react-colorful__pointer",t.className]);return te.createElement("div",{className:o,style:{top:100*i+"%",left:100*n+"%"}},te.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Wr=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},lD=function(t){var e=t.s,n=t.v,r=t.a,i=(200-e)*n/100;return{h:Wr(t.h),s:Wr(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:Wr(i/2),a:Wr(r,2)}},S1=function(t){var e=lD(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},d_=function(t){var e=lD(t);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},cD=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),s=r*(1-n),a=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),u=o%6;return{r:Wr(255*[r,a,s,s,l,r][u]),g:Wr(255*[l,r,r,a,s,s][u]),b:Wr(255*[s,s,l,r,r,a][u]),a:Wr(i,2)}},uD=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),a=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:Wr(60*(a<0?a+6:a)),s:Wr(o?s/o*100:0),v:Wr(o/255*100),a:i}},fD=te.memo(function(t){var e=t.hue,n=t.onChange,r=hh(["react-colorful__hue",t.className]);return te.createElement("div",{className:r},te.createElement(Hw,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:pu(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":Wr(e),"aria-valuemax":"360","aria-valuemin":"0"},te.createElement(Vw,{className:"react-colorful__hue-pointer",left:e/360,color:S1({h:e,s:100,v:100,a:1})})))}),dD=te.memo(function(t){var e=t.hsva,n=t.onChange,r={backgroundColor:S1({h:e.h,s:100,v:100,a:1})};return te.createElement("div",{className:"react-colorful__saturation",style:r},te.createElement(Hw,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:pu(e.s+100*i.left,0,100),v:pu(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Wr(e.s)+"%, Brightness "+Wr(e.v)+"%"},te.createElement(Vw,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:S1(e)})))}),Ww=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0};function hD(t,e,n){var r=_1(n),i=L.useState(function(){return t.toHsva(e)}),o=i[0],s=i[1],a=L.useRef({color:e,hsva:o});L.useEffect(function(){if(!t.equal(e,a.current.color)){var u=t.toHsva(e);a.current={hsva:u,color:e},s(u)}},[e,t]),L.useEffect(function(){var u;Ww(o,a.current.hsva)||t.equal(u=t.fromHsva(o),a.current.color)||(a.current={hsva:o,color:u},r(u))},[o,t,r]);var l=L.useCallback(function(u){s(function(d){return Object.assign({},d,u)})},[]);return[o,l]}var A7=typeof window<"u"?L.useLayoutEffect:L.useEffect,C7=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},bC=new Map,pD=function(t){A7(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!bC.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,bC.set(e,n);var r=C7();r&&n.setAttribute("nonce",r),e.head.appendChild(n)}},[])},R7=function(t){var e=t.className,n=t.colorModel,r=t.color,i=r===void 0?n.defaultColor:r,o=t.onChange,s=Bw(t,["className","colorModel","color","onChange"]),a=L.useRef(null);pD(a);var l=hD(n,i,o),u=l[0],d=l[1],h=hh(["react-colorful",e]);return te.createElement("div",Ru({},s,{ref:a,className:h}),te.createElement(dD,{hsva:u,onChange:d}),te.createElement(fD,{hue:u.h,onChange:d,className:"react-colorful__last-control"}))},P7=function(t){var e=t.className,n=t.hsva,r=t.onChange,i={backgroundImage:"linear-gradient(90deg, "+d_(Object.assign({},n,{a:0}))+", "+d_(Object.assign({},n,{a:1}))+")"},o=hh(["react-colorful__alpha",e]),s=Wr(100*n.a);return te.createElement("div",{className:o},te.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),te.createElement(Hw,{onMove:function(a){r({a:a.left})},onKey:function(a){r({a:pu(n.a+a.left)})},"aria-label":"Alpha","aria-valuetext":s+"%","aria-valuenow":s,"aria-valuemin":"0","aria-valuemax":"100"},te.createElement(Vw,{className:"react-colorful__alpha-pointer",left:n.a,color:d_(n)})))},I7=function(t){var e=t.className,n=t.colorModel,r=t.color,i=r===void 0?n.defaultColor:r,o=t.onChange,s=Bw(t,["className","colorModel","color","onChange"]),a=L.useRef(null);pD(a);var l=hD(n,i,o),u=l[0],d=l[1],h=hh(["react-colorful",e]);return te.createElement("div",Ru({},s,{ref:a,className:h}),te.createElement(dD,{hsva:u,onChange:d}),te.createElement(fD,{hue:u.h,onChange:d}),te.createElement(P7,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},L7={defaultColor:{r:0,g:0,b:0,a:1},toHsva:uD,fromHsva:cD,equal:Ww},D7=function(t){return te.createElement(I7,Ru({},t,{colorModel:L7}))},O7={defaultColor:{r:0,g:0,b:0},toHsva:function(t){return uD({r:t.r,g:t.g,b:t.b,a:1})},fromHsva:function(t){return{r:(e=cD(t)).r,g:e.g,b:e.b};var e},equal:Ww},N7=function(t){return te.createElement(R7,Ru({},t,{colorModel:O7}))};function Pu(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(d){try{u(r.next(d))}catch(h){s(h)}}function l(d){try{u(r.throw(d))}catch(h){s(h)}}function u(d){d.done?o(d.value):i(d.value).then(a,l)}u((r=r.apply(t,e||[])).next())})}function Iu(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function U7(){for(var t=[],e=0;e0?r:t.name,writable:!1,configurable:!1,enumerable:!0})}return n}function z7(t){var e=t.name,n=e&&e.lastIndexOf(".")!==-1;if(n&&!t.type){var r=e.split(".").pop().toLowerCase(),i=F7.get(r);i&&Object.defineProperty(t,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return t}var B7=[".DS_Store","Thumbs.db"];function H7(t){return Pu(this,void 0,void 0,function(){return Iu(this,function(e){return Ig(t)&&V7(t)?[2,j7(t.dataTransfer,t.type)]:W7(t)?[2,G7(t)]:Array.isArray(t)&&t.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,$7(t)]:[2,[]]})})}function V7(t){return Ig(t.dataTransfer)}function W7(t){return Ig(t)&&Ig(t.target)}function Ig(t){return typeof t=="object"&&t!==null}function G7(t){return w1(t.target.files).map(function(e){return ph(e)})}function $7(t){return Pu(this,void 0,void 0,function(){var e;return Iu(this,function(n){switch(n.label){case 0:return[4,Promise.all(t.map(function(r){return r.getFile()}))];case 1:return e=n.sent(),[2,e.map(function(r){return ph(r)})]}})})}function j7(t,e){return Pu(this,void 0,void 0,function(){var n,r;return Iu(this,function(i){switch(i.label){case 0:return t===null?[2,[]]:t.items?(n=w1(t.items).filter(function(o){return o.kind==="file"}),e!=="drop"?[2,n]:[4,Promise.all(n.map(X7))]):[3,2];case 1:return r=i.sent(),[2,TC(mD(r))];case 2:return[2,TC(w1(t.files).map(function(o){return ph(o)}))]}})})}function TC(t){return t.filter(function(e){return B7.indexOf(e.name)===-1})}function w1(t){if(t===null)return[];for(var e=[],n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nn)return[!1,LC(n)];if(t.sizen)return[!1,LC(n)]}return[!0,null]}function Sf(t){return t!=null}function aj(t){var e=t.files,n=t.accept,r=t.minSize,i=t.maxSize,o=t.multiple,s=t.maxFiles;return!o&&e.length>1||o&&s>=1&&e.length>s?!1:e.every(function(a){var l=yD(a,n),u=PC(l,1),d=u[0],h=_D(a,r,i),p=PC(h,1),g=p[0];return d&&g})}function Lg(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function Em(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!t.target&&!!t.target.files}function OC(t){t.preventDefault()}function lj(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function cj(t){return t.indexOf("Edge/")!==-1}function uj(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return lj(t)||cj(t)}function Po(){for(var t=arguments.length,e=new Array(t),n=0;n1?i-1:0),s=1;st.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Tj(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}var Gw=L.forwardRef(function(t,e){var n=t.children,r=Dg(t,mj),i=wD(r),o=i.open,s=Dg(i,gj);return L.useImperativeHandle(e,function(){return{open:o}},[o]),te.createElement(L.Fragment,null,n(An(An({},s),{},{open:o})))});Gw.displayName="Dropzone";var SD={disabled:!1,getFilesFromEvent:H7,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};Gw.defaultProps=SD;Gw.propTypes={children:dn.func,accept:dn.oneOfType([dn.string,dn.arrayOf(dn.string)]),multiple:dn.bool,preventDropOnDocument:dn.bool,noClick:dn.bool,noKeyboard:dn.bool,noDrag:dn.bool,noDragEventsBubbling:dn.bool,minSize:dn.number,maxSize:dn.number,maxFiles:dn.number,disabled:dn.bool,getFilesFromEvent:dn.func,onFileDialogCancel:dn.func,onFileDialogOpen:dn.func,useFsAccessApi:dn.bool,onDragEnter:dn.func,onDragLeave:dn.func,onDragOver:dn.func,onDrop:dn.func,onDropAccepted:dn.func,onDropRejected:dn.func,validator:dn.func};var b1={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function wD(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=An(An({},SD),t),n=e.accept,r=e.disabled,i=e.getFilesFromEvent,o=e.maxSize,s=e.minSize,a=e.multiple,l=e.maxFiles,u=e.onDragEnter,d=e.onDragLeave,h=e.onDragOver,p=e.onDrop,g=e.onDropAccepted,y=e.onDropRejected,w=e.onFileDialogCancel,x=e.onFileDialogOpen,m=e.useFsAccessApi,_=e.preventDropOnDocument,S=e.noClick,M=e.noKeyboard,T=e.noDrag,A=e.noDragEventsBubbling,R=e.validator,O=L.useMemo(function(){return typeof x=="function"?x:kC},[x]),C=L.useMemo(function(){return typeof w=="function"?w:kC},[w]),P=L.useRef(null),k=L.useRef(null),X=L.useReducer(Aj,b1),oe=h_(X,2),V=oe[0],K=oe[1],J=V.isFocused,se=V.isFileDialogActive,F=V.draggedFiles,$=L.useRef(typeof window<"u"&&window.isSecureContext&&m&&fj()),j=function(){!$.current&&se&&setTimeout(function(){if(k.current){var U=k.current.files;U.length||(K({type:"closeDialog"}),C())}},300)};L.useEffect(function(){return window.addEventListener("focus",j,!1),function(){window.removeEventListener("focus",j,!1)}},[k,se,C,$]);var H=L.useRef([]),Z=function(U){P.current&&P.current.contains(U.target)||(U.preventDefault(),H.current=[])};L.useEffect(function(){return _&&(document.addEventListener("dragover",OC,!1),document.addEventListener("drop",Z,!1)),function(){_&&(document.removeEventListener("dragover",OC),document.removeEventListener("drop",Z))}},[P,_]);var ge=L.useCallback(function(z){z.preventDefault(),z.persist(),Ae(z),H.current=[].concat(_j(H.current),[z.target]),Em(z)&&Promise.resolve(i(z)).then(function(U){Lg(z)&&!A||(K({draggedFiles:U,isDragActive:!0,type:"setDraggedFiles"}),u&&u(z))})},[i,u,A]),xe=L.useCallback(function(z){z.preventDefault(),z.persist(),Ae(z);var U=Em(z);if(U&&z.dataTransfer)try{z.dataTransfer.dropEffect="copy"}catch{}return U&&h&&h(z),!1},[h,A]),Ee=L.useCallback(function(z){z.preventDefault(),z.persist(),Ae(z);var U=H.current.filter(function(Ie){return P.current&&P.current.contains(Ie)}),ue=U.indexOf(z.target);ue!==-1&&U.splice(ue,1),H.current=U,!(U.length>0)&&(K({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),Em(z)&&d&&d(z))},[P,d,A]),Se=L.useCallback(function(z,U){var ue=[],Ie=[];z.forEach(function(Re){var Ne=yD(Re,n),Ze=h_(Ne,2),Be=Ze[0],$e=Ze[1],gt=_D(Re,s,o),bt=h_(gt,2),Pe=bt[0],Dt=bt[1],re=R?R(Re):null;if(Be&&Pe&&!re)ue.push(Re);else{var he=[$e,Dt];re&&(he=he.concat(re)),Ie.push({file:Re,errors:he.filter(function(Ce){return Ce})})}}),(!a&&ue.length>1||a&&l>=1&&ue.length>l)&&(ue.forEach(function(Re){Ie.push({file:Re,errors:[sj]})}),ue.splice(0)),K({acceptedFiles:ue,fileRejections:Ie,type:"setFiles"}),p&&p(ue,Ie,U),Ie.length>0&&y&&y(Ie,U),ue.length>0&&g&&g(ue,U)},[K,a,n,s,o,l,p,g,y,R]),We=L.useCallback(function(z){z.preventDefault(),z.persist(),Ae(z),H.current=[],Em(z)&&Promise.resolve(i(z)).then(function(U){Lg(z)&&!A||Se(U,z)}),K({type:"reset"})},[i,Se,A]),Je=L.useCallback(function(){if($.current){K({type:"openDialog"}),O();var z={multiple:a,types:dj(n)};window.showOpenFilePicker(z).then(function(U){return i(U)}).then(function(U){Se(U,null),K({type:"closeDialog"})}).catch(function(U){hj(U)?(C(U),K({type:"closeDialog"})):pj(U)&&($.current=!1,k.current&&(k.current.value=null,k.current.click()))});return}k.current&&(K({type:"openDialog"}),O(),k.current.value=null,k.current.click())},[K,O,C,m,Se,n,a]),ft=L.useCallback(function(z){!P.current||!P.current.isEqualNode(z.target)||(z.key===" "||z.key==="Enter"||z.keyCode===32||z.keyCode===13)&&(z.preventDefault(),Je())},[P,Je]),At=L.useCallback(function(){K({type:"focus"})},[]),Qe=L.useCallback(function(){K({type:"blur"})},[]),Q=L.useCallback(function(){S||(uj()?setTimeout(Je,0):Je())},[S,Je]),Le=function(U){return r?null:U},we=function(U){return M?null:Le(U)},De=function(U){return T?null:Le(U)},Ae=function(U){A&&U.stopPropagation()},lt=L.useMemo(function(){return function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=z.refKey,ue=U===void 0?"ref":U,Ie=z.role,Re=z.onKeyDown,Ne=z.onFocus,Ze=z.onBlur,Be=z.onClick,$e=z.onDragEnter,gt=z.onDragOver,bt=z.onDragLeave,Pe=z.onDrop,Dt=Dg(z,vj);return An(An(M1({onKeyDown:we(Po(Re,ft)),onFocus:we(Po(Ne,At)),onBlur:we(Po(Ze,Qe)),onClick:Le(Po(Be,Q)),onDragEnter:De(Po($e,ge)),onDragOver:De(Po(gt,xe)),onDragLeave:De(Po(bt,Ee)),onDrop:De(Po(Pe,We)),role:typeof Ie=="string"&&Ie!==""?Ie:"button"},ue,P),!r&&!M?{tabIndex:0}:{}),Dt)}},[P,ft,At,Qe,Q,ge,xe,Ee,We,M,T,r]),je=L.useCallback(function(z){z.stopPropagation()},[]),et=L.useMemo(function(){return function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=z.refKey,ue=U===void 0?"ref":U,Ie=z.onChange,Re=z.onClick,Ne=Dg(z,yj),Ze=M1({accept:n,multiple:a,type:"file",style:{display:"none"},onChange:Le(Po(Ie,We)),onClick:Le(Po(Re,je)),tabIndex:-1},ue,k);return An(An({},Ze),Ne)}},[k,n,a,We,r]),dt=F.length,xt=dt>0&&aj({files:F,accept:n,minSize:s,maxSize:o,multiple:a,maxFiles:l}),qt=dt>0&&!xt;return An(An({},V),{},{isDragAccept:xt,isDragReject:qt,isFocused:J&&!r,getRootProps:lt,getInputProps:et,rootRef:P,inputRef:k,open:Le(Je)})}function Aj(t,e){switch(e.type){case"focus":return An(An({},t),{},{isFocused:!0});case"blur":return An(An({},t),{},{isFocused:!1});case"openDialog":return An(An({},b1),{},{isFileDialogActive:!0});case"closeDialog":return An(An({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":var n=e.isDragActive,r=e.draggedFiles;return An(An({},t),{},{draggedFiles:r,isDragActive:n});case"setFiles":return An(An({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections});case"reset":return An({},b1);default:return t}}function kC(){}/*! * isobject * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var Cj=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1};/*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var Rj=Cj;function UC(t){return Rj(t)===!0&&Object.prototype.toString.call(t)==="[object Object]"}var ED=function(e){var n,r;return!(UC(e)===!1||(n=e.constructor,typeof n!="function")||(r=n.prototype,UC(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*! * is-extendable * * Copyright (c) 2015-2017, Jon Schlinkert. * Released under the MIT License. */var Pj=ED,$w=function(e){return Pj(e)||typeof e=="function"||Array.isArray(e)};/*! * for-in * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var Ij=function(e,n,r){for(var i in e)if(n.call(r,e[i],i,e)===!1)break},Lj=$w,Dj=Ij;function MD(t,e){for(var n=arguments.length,r=0;++r * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */var Uj=function(t,e,n,r,i){if(!Fj(t)||!e)return t;if(e=Mm(e),n&&(e+="."+Mm(n)),r&&(e+="."+Mm(r)),i&&(e+="."+Mm(i)),e in t)return t[e];for(var o=e.split("."),s=o.length,a=-1;t&&++a * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */var zj=function(t,e){if(t===null||typeof t>"u")throw new TypeError("expected first argument to be an object.");if(typeof e>"u"||typeof Symbol>"u"||typeof Object.getOwnPropertySymbols!="function")return t;for(var n=Object.prototype.propertyIsEnumerable,r=Object(t),i=arguments.length,o=0;++o"u")throw new TypeError("Cannot convert undefined or null to object");FC(t)||(t={});for(var e=1;e * * Copyright (c) 2015-2017, Jon Schlinkert. * Released under the MIT License. */var Xj=Vj,Yj=function(t,e,n){if(typeof t!="string")throw new TypeError("expected a string");typeof e=="function"&&(n=e,e=null),typeof e=="string"&&(e={sep:e});var r=Xj({sep:"."},e),i=r.quotes||['"',"'","`"],o;r.brackets===!0?o={"<":">","(":")","[":"]","{":"}"}:r.brackets&&(o=r.brackets);var s=[],a=[],l=[""],u=r.sep,d=t.length,h=-1,p;function g(){if(o&&a.length)return o[a[a.length-1]]}for(;++h * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */var Kj=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")},zC=Kj,Jj=function(e){zC(e)||(e={});for(var n=arguments.length,r=1;r * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */var tX=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")};/*! * set-value * * Copyright (c) 2014-2015, 2017, Jon Schlinkert. * Released under the MIT License. */var nX=Yj,rX=Jj,BC=ED,HC=tX,iX=function(t,e,n){if(!HC(t)||(Array.isArray(e)&&(e=[].concat.apply([],e).join(".")),typeof e!="string"))return t;for(var r=nX(e,{sep:".",brackets:!0}).filter(oX),i=r.length,o=-1,s=t;++ot.filter(Boolean).join(".");function cX(t){const e=t.split(".");return[e.pop(),e.join(".")||void 0]}function uX(t,e){return Object.entries(V$(t,e)).reduce((n,[,{value:r,disabled:i,key:o}])=>(n[o]=i?void 0:r,n),{})}function fX(t,e){const n=L.useRef();return(e?Od:ch)(t,n.current)||(n.current=t),n.current}function bD(t,e){return L.useMemo(t,fX(e,!0))}function dX(t){const e=L.useRef(null),n=L.useRef(null),r=L.useRef(!0);return L.useLayoutEffect(()=>{t||(e.current.style.height="0px",e.current.style.overflow="hidden")},[]),L.useEffect(()=>{if(r.current){r.current=!1;return}let i;const o=e.current,s=()=>{t&&(o.style.removeProperty("height"),o.style.removeProperty("overflow"),n.current.scrollIntoView({behavior:"smooth",block:"nearest"}))};o.addEventListener("transitionend",s,{once:!0});const{height:a}=n.current.getBoundingClientRect();return o.style.height=a+"px",t||(o.style.overflow="hidden",i=window.setTimeout(()=>o.style.height="0px",50)),()=>{o.removeEventListener("transitionend",s),clearTimeout(i)}},[t]),{wrapperRef:e,contentRef:n}}const hX=t=>{const[e,n]=L.useState(t.getVisiblePaths());return L.useEffect(()=>{n(t.getVisiblePaths());const r=t.useStore.subscribe(t.getVisiblePaths,n,{equalityFn:ch});return()=>r()},[t]),e};function pX(t,e,n){return t.useStore(i=>{const o=St(St({},n),i.data);return uX(o,e)},ch)}function TD(t=3){const e=L.useRef(null),n=L.useRef(null),[r,i]=L.useState(!1),o=L.useCallback(()=>i(!0),[]),s=L.useCallback(()=>i(!1),[]);return L.useLayoutEffect(()=>{if(r){const{bottom:a,top:l,left:u}=e.current.getBoundingClientRect(),{height:d}=n.current.getBoundingClientRect(),h=a+d>window.innerHeight-40?"up":"down";n.current.style.position="fixed",n.current.style.zIndex="10000",n.current.style.left=u+"px",h==="down"?n.current.style.top=a+t+"px":n.current.style.bottom=window.innerHeight-l+t+"px"}},[t,r]),{popinRef:e,wrapperRef:n,shown:r,show:o,hide:s}}b7([T7]);const mX={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};oi.extend({color:()=>t=>Vr(t).isValid()});const gX=t=>oi().color().test(t);function AD(t,{format:e,hasAlpha:n,isString:r}){const i=mX[e]+(r&&e!=="hex"?"String":""),o=t[i]();return typeof o=="object"&&!n?W$(o,["a"]):o}const CD=(t,e)=>{const n=Vr(t);if(!n.isValid())throw Error("Invalid color");return AD(n,e)},vX=(t,e)=>AD(Vr(t),St(St({},e),{},{isString:!0,format:"hex"})),yX=({value:t})=>{const e=M7(t),n=e==="name"?"hex":e,r=typeof t=="object"?"a"in t:e==="hex"&&t.length===8||/^(rgba)|(hsla)|(hsva)/.test(t),i={format:n,hasAlpha:r,isString:typeof t=="string"};return{value:CD(t,i),settings:i}};var _X=Object.freeze({__proto__:null,schema:gX,sanitize:CD,format:vX,normalize:yX});const xX=_t("div",{position:"relative",boxSizing:"border-box",borderRadius:"$sm",overflow:"hidden",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",backgroundColor:"#fff",backgroundImage:`url('data:image/svg+xml;charset=utf-8,')`,$inputStyle:"",$hover:"",zIndex:1,variants:{active:{true:{$inputStyle:"$accent1"}}},"&::before":{content:'""',position:"absolute",top:0,bottom:0,right:0,left:0,backgroundColor:"currentColor",zIndex:1}}),SX=_t("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),wX=_t("div",{width:"$colorPickerWidth",height:"$colorPickerHeight",".react-colorful":{width:"100%",height:"100%",boxShadow:"$level2",cursor:"crosshair"},".react-colorful__saturation":{borderRadius:"$sm $sm 0 0"},".react-colorful__alpha, .react-colorful__hue":{height:10},".react-colorful__last-control":{borderRadius:"0 0 $sm $sm"},".react-colorful__pointer":{height:12,width:12}});function GC(t,e){return e!=="rgb"?Vr(t).toRgb():t}function EX({value:t,displayValue:e,settings:n,onUpdate:r}){const{emitOnEditStart:i,emitOnEditEnd:o}=Or(),{format:s,hasAlpha:a}=n,{popinRef:l,wrapperRef:u,shown:d,show:h,hide:p}=TD(),g=L.useRef(0),[y,w]=L.useState(()=>GC(t,s)),x=a?D7:N7,m=()=>{w(GC(t,s)),h(),i()},_=()=>{p(),o(),window.clearTimeout(g.current)},S=()=>{g.current=window.setTimeout(_,500)};return L.useEffect(()=>()=>window.clearTimeout(g.current),[]),te.createElement(te.Fragment,null,te.createElement(xX,{ref:l,active:d,onClick:()=>m(),style:{color:e}}),d&&te.createElement(Uw,null,te.createElement(qL,{onPointerUp:_}),te.createElement(wX,{ref:u,onMouseEnter:()=>window.clearTimeout(g.current),onMouseLeave:M=>M.buttons===0&&S()},te.createElement(x,{color:y,onChange:r}))))}function MX(){const{value:t,displayValue:e,label:n,onChange:r,onUpdate:i,settings:o}=Or();return te.createElement(qi,{input:!0},te.createElement(_o,null,n),te.createElement(SX,null,te.createElement(EX,{value:t,displayValue:e,onChange:r,onUpdate:i,settings:o}),te.createElement(kw,{value:e,onChange:r,onUpdate:i})))}var bX=St({component:MX},_X);function TX(){const{label:t,displayValue:e,onUpdate:n,settings:r}=Or();return te.createElement(qi,{input:!0},te.createElement(_o,null,t),te.createElement(zw,{value:e,settings:r,onUpdate:n}))}var AX=St({component:TX},rD(["x","y","z"]));const CX=_t("div",{$flexCenter:"",position:"relative",backgroundColor:"$elevation3",borderRadius:"$sm",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",touchAction:"none",$draggable:"",$hover:"","&:active":{cursor:"none"},"&::after":{content:'""',backgroundColor:"$accent2",height:4,width:4,borderRadius:2}}),RX=_t("div",{$flexCenter:"",width:"$joystickWidth",height:"$joystickHeight",borderRadius:"$sm",boxShadow:"$level2",position:"fixed",zIndex:1e4,overflow:"hidden",$draggable:"",transform:"translate(-50%, -50%)",variants:{isOutOfBounds:{true:{backgroundColor:"$elevation1"},false:{backgroundColor:"$elevation3"}}},"> div":{position:"absolute",$flexCenter:"",borderStyle:"solid",borderWidth:1,borderColor:"$highlight1",backgroundColor:"$elevation3",width:"80%",height:"80%","&::after,&::before":{content:'""',position:"absolute",zindex:10,backgroundColor:"$highlight1"},"&::before":{width:"100%",height:1},"&::after":{height:"100%",width:1}},"> span":{position:"relative",zindex:100,width:10,height:10,backgroundColor:"$accent2",borderRadius:"50%"}});function PX({value:t,settings:e,onUpdate:n}){const r=L.useRef(),i=L.useRef(0),o=L.useRef(0),s=L.useRef(1),[a,l]=L.useState(!1),[u,d]=L.useState(!1),[h,p]=KL(),g=L.useRef(null),y=L.useRef(null);L.useLayoutEffect(()=>{if(a){const{top:X,left:oe,width:V,height:K}=g.current.getBoundingClientRect();y.current.style.left=oe+V/2+"px",y.current.style.top=X+K/2+"px"}},[a]);const{keys:[w,x],joystick:m}=e,_=m==="invertY"?1:-1,{[w]:{step:S},[x]:{step:M}}=e,T=ys("sizes","joystickWidth"),A=ys("sizes","joystickHeight"),R=parseFloat(T)*.8/2,O=parseFloat(A)*.8/2,C=L.useCallback(()=>{r.current||(d(!0),i.current&&p({x:i.current*R}),o.current&&p({y:o.current*-O}),r.current=window.setInterval(()=>{n(X=>{const oe=S*i.current*s.current,V=_*M*o.current*s.current;return Array.isArray(X)?{[w]:X[0]+oe,[x]:X[1]+V}:{[w]:X[w]+oe,[x]:X[x]+V}})},16))},[R,O,n,p,S,M,w,x,_]),P=L.useCallback(()=>{window.clearTimeout(r.current),r.current=void 0,d(!1)},[]);L.useEffect(()=>{function X(oe){s.current=NL(oe)}return window.addEventListener("keydown",X),window.addEventListener("keyup",X),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",X),window.removeEventListener("keyup",X)}},[]);const k=dh(({first:X,active:oe,delta:[V,K],movement:[J,se]})=>{X&&l(!0);const F=Ea(J,-R,R),$=Ea(se,-O,O);i.current=Math.abs(J)>Math.abs(F)?Math.sign(J-F):0,o.current=Math.abs(se)>Math.abs($)?Math.sign($-se):0;let j=t[w],H=t[x];oe?(i.current||(j+=V*S*s.current,p({x:F})),o.current||(H-=_*K*M*s.current,p({y:$})),i.current||o.current?C():P(),n({[w]:j,[x]:H})):(l(!1),i.current=0,o.current=0,p({x:0,y:0}),P())});return te.createElement(CX,Hn({ref:g},k()),a&&te.createElement(Uw,null,te.createElement(RX,{ref:y,isOutOfBounds:u},te.createElement("div",null),te.createElement("span",{ref:h}))))}const IX=_t("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function LX(){const{label:t,displayValue:e,onUpdate:n,settings:r}=Or();return te.createElement(qi,{input:!0},te.createElement(_o,null,t),te.createElement(IX,{withJoystick:!!r.joystick},r.joystick&&te.createElement(PX,{value:e,settings:r,onUpdate:n}),te.createElement(zw,{value:e,settings:r,onUpdate:n})))}const DX=["joystick"],RD=rD(["x","y"]),OX=t=>{let{joystick:e=!0}=t,n=ln(t,DX);const{value:r,settings:i}=RD.normalize(n);return{value:r,settings:St(St({},i),{},{joystick:e})}};var NX=St(St({component:LX},RD),{},{normalize:OX});const kX=t=>{if(t!==void 0){if(t instanceof File)try{return URL.createObjectURL(t)}catch{return}if(typeof t=="string"&&t.indexOf("blob:")===0)return t;throw Error("Invalid image format [undefined | blob | File].")}},UX=(t,e)=>typeof e=="object"&&"image"in e,FX=({image:t})=>({value:t});var zX=Object.freeze({__proto__:null,sanitize:kX,schema:UX,normalize:FX});const BX=_t("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),HX=_t("div",{$flexCenter:"",overflow:"hidden",height:"$rowHeight",background:"$elevation3",textAlign:"center",color:"inherit",borderRadius:"$sm",outline:"none",userSelect:"none",cursor:"pointer",$inputStyle:"",$hover:"",$focusWithin:"",$active:"$accent1 $elevation1",variants:{isDragAccept:{true:{$inputStyle:"$accent1",backgroundColor:"$elevation1"}}}}),VX=_t("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),WX=_t("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),GX=_t("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),$X=_t("div",{$flexCenter:"",top:"0",right:"0",marginRight:"$sm",height:"100%",cursor:"pointer",variants:{disabled:{true:{color:"$elevation3",cursor:"default"}}},"&::after,&::before":{content:'""',position:"absolute",height:2,width:10,borderRadius:1,backgroundColor:"currentColor"},"&::after":{transform:"rotate(45deg)"},"&::before":{transform:"rotate(-45deg)"}});function jX(){const{label:t,value:e,onUpdate:n,disabled:r}=Or(),{popinRef:i,wrapperRef:o,shown:s,show:a,hide:l}=TD(),u=L.useCallback(y=>{y.length&&n(y[0])},[n]),d=L.useCallback(y=>{y.stopPropagation(),n(void 0)},[n]),{getRootProps:h,getInputProps:p,isDragAccept:g}=wD({maxFiles:1,accept:"image/*",onDrop:u,disabled:r});return te.createElement(qi,{input:!0},te.createElement(_o,null,t),te.createElement(BX,null,te.createElement(VX,{ref:i,hasImage:!!e,onPointerDown:()=>!!e&&a(),onPointerUp:l,style:{backgroundImage:e?`url(${e})`:"none"}}),s&&!!e&&te.createElement(Uw,null,te.createElement(qL,{onPointerUp:l,style:{cursor:"pointer"}}),te.createElement(WX,{ref:o,style:{backgroundImage:`url(${e})`}})),te.createElement(HX,h({isDragAccept:g}),te.createElement("input",p()),te.createElement(GX,null,g?"drop image":"click or drop")),te.createElement($X,{onClick:d,disabled:!e})))}var XX=St({component:jX},zX);const $C=oi().number(),YX=(t,e)=>oi().array().length(2).every.number().test(t)&&oi().schema({min:$C,max:$C}).test(e),Og=t=>({min:t[0],max:t[1]}),PD=(t,{bounds:[e,n]},r)=>{const i=Array.isArray(t)?Og(t):t,o={min:r[0],max:r[1]},{min:s,max:a}=St(St({},o),i);return[Ea(Number(s),e,Math.max(e,a)),Ea(Number(a),Math.min(n,s),n)]},qX=({value:t,min:e,max:n})=>{const r={min:e,max:n},i=nD(Og(t),{min:r,max:r}),o=[e,n],s=St(St({},i),{},{bounds:o});return{value:PD(Og(t),s,t),settings:s}};var ZX=Object.freeze({__proto__:null,schema:YX,format:Og,sanitize:PD,normalize:qX});const KX=["value","bounds","onDrag"],JX=["bounds"],QX=_t("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function eY(t){let{value:e,bounds:[n,r],onDrag:i}=t,o=ln(t,KX);const s=L.useRef(null),a=L.useRef(null),l=L.useRef(null),u=L.useRef(0),d=ys("sizes","scrubberWidth"),h=dh(({event:y,first:w,xy:[x],movement:[m],memo:_={}})=>{if(w){const{width:M,left:T}=s.current.getBoundingClientRect();u.current=M-parseFloat(d);const A=(y==null?void 0:y.target)===a.current||(y==null?void 0:y.target)===l.current;_.pos=Rg((x-T)/M,n,r);const R=Math.abs(_.pos-e.min)-Math.abs(_.pos-e.max);_.key=R<0||R===0&&_.pos<=e.min?"min":"max",A&&(_.pos=e[_.key])}const S=_.pos+Rg(m/u.current,0,r-n);return i({[_.key]:I9(S,o[_.key])}),_}),p=`calc(${Cg(e.min,n,r)} * (100% - ${d} - 8px) + 4px)`,g=`calc(${1-Cg(e.max,n,r)} * (100% - ${d} - 8px) + 4px)`;return te.createElement(QL,Hn({ref:s},h()),te.createElement(JL,null,te.createElement(eD,{style:{left:p,right:g}})),te.createElement(m1,{position:"left",ref:a,style:{left:p}}),te.createElement(m1,{position:"right",ref:l,style:{right:g}}))}function tY(){const{label:t,displayValue:e,onUpdate:n,settings:r}=Or(),i=ln(r,JX);return te.createElement(te.Fragment,null,te.createElement(qi,{input:!0},te.createElement(_o,null,t),te.createElement(QX,null,te.createElement(eY,Hn({value:e},r,{onDrag:n})),te.createElement(zw,{value:e,settings:i,onUpdate:n,innerLabelTrim:0}))))}var nY=St({component:tY},ZX);const rY=()=>{const t=new Map;return{on:(e,n)=>{let r=t.get(e);r===void 0&&(r=new Set,t.set(e,r)),r.add(n)},off:(e,n)=>{const r=t.get(e);r!==void 0&&(r.delete(n),r.size===0&&t.delete(e))},emit:(e,...n)=>{const r=t.get(e);if(r!==void 0)for(const i of r)i(...n)}}},iY=["type","value"],oY=["onChange","transient","onEditStart","onEditEnd"],sY=function(){const e=gw(g8(()=>({data:{}}))),n=rY();this.storeId=H$(),this.useStore=e;const r={},i=new Set;this.getVisiblePaths=()=>{const s=this.getData(),a=Object.keys(s),l=[];Object.entries(r).forEach(([d,h])=>{h.render&&a.some(p=>p.indexOf(d)===0)&&!h.render(this.get)&&l.push(d+".")});const u=[];return i.forEach(d=>{d in s&&s[d].__refCount>0&&l.every(h=>d.indexOf(h)===-1)&&(!s[d].render||s[d].render(this.get))&&u.push(d)}),u},this.setOrderedPaths=s=>{s.forEach(a=>i.add(a))},this.orderPaths=s=>(this.setOrderedPaths(s),s),this.disposePaths=s=>{e.setState(a=>{const l=a.data;return s.forEach(u=>{if(u in l){const d=l[u];d.__refCount--,d.__refCount===0&&d.type in ho&&delete l[u]}}),{data:l}})},this.dispose=()=>{e.setState(()=>({data:{}}))},this.getFolderSettings=s=>r[s]||{},this.getData=()=>e.getState().data,this.addData=(s,a)=>{e.setState(l=>{const u=l.data;return Object.entries(s).forEach(([d,h])=>{let p=u[d];if(p){const{type:g,value:y}=h,w=ln(h,iY);g!==p.type?ds(Cn.INPUT_TYPE_OVERRIDE,g):((p.__refCount===0||a)&&Object.assign(p,w),p.__refCount++)}else u[d]=St(St({},h),{},{__refCount:1})}),{data:u}})},this.setValueAtPath=(s,a,l)=>{e.setState(u=>{const d=u.data;return mC(d[s],a,s,this,l),{data:d}})},this.setSettingsAtPath=(s,a)=>{e.setState(l=>{const u=l.data;return u[s].settings=St(St({},u[s].settings),a),{data:u}})},this.disableInputAtPath=(s,a)=>{e.setState(l=>{const u=l.data;return u[s].disabled=a,{data:u}})},this.set=(s,a)=>{e.setState(l=>{const u=l.data;return Object.entries(s).forEach(([d,h])=>{try{mC(u[d],h,void 0,void 0,a)}catch{}}),{data:u}})},this.getInput=s=>{try{return this.getData()[s]}catch{ds(Cn.PATH_DOESNT_EXIST,s)}},this.get=s=>{var a;return(a=this.getInput(s))===null||a===void 0?void 0:a.value},this.emitOnEditStart=s=>{n.emit(`onEditStart:${s}`,this.get(s),s,St(St({},this.getInput(s)),{},{get:this.get}))},this.emitOnEditEnd=s=>{n.emit(`onEditEnd:${s}`,this.get(s),s,St(St({},this.getInput(s)),{},{get:this.get}))},this.subscribeToEditStart=(s,a)=>{const l=`onEditStart:${s}`;return n.on(l,a),()=>n.off(l,a)},this.subscribeToEditEnd=(s,a)=>{const l=`onEditEnd:${s}`;return n.on(l,a),()=>n.off(l,a)};const o=(s,a,l)=>{const u={};return Object.entries(s).forEach(([d,h])=>{if(d==="")return ds(Cn.EMPTY_KEY);let p=jw(a,d);if(h.type===ho.FOLDER){const g=o(h.schema,p,l);Object.assign(u,g),p in r||(r[p]=h.settings)}else if(d in l)ds(Cn.DUPLICATE_KEYS,d,p,l[d].path);else{const g=q$(h,d,p,u);if(g){const{type:y,options:w,input:x}=g,{onChange:m,transient:_,onEditStart:S,onEditEnd:M}=w,T=ln(w,oY);u[p]=St(St(St({type:y},T),x),{},{fromPanel:!0}),l[d]={path:p,onChange:m,transient:_,onEditStart:S,onEditEnd:M}}else ds(Cn.UNKNOWN_INPUT,p,h)}}),u};this.getDataFromSchema=s=>{const a={};return[o(s,"",a),a]}},ID=new sY,aY={collapsed:!1};function lY(t,e){return{type:ho.FOLDER,schema:t,settings:St(St({},aY),e)}}const jC=t=>"__levaInput"in t,cY=(t,e)=>{const n={},r=e?e.toLowerCase():null;return t.forEach(i=>{const[o,s]=cX(i);(!r||o.toLowerCase().indexOf(r)>-1)&&lX(n,s,{[o]:{__levaInput:!0,path:i}})}),n},uY=["type","label","path","valueKey","value","settings","setValue","disabled"];function fY(t){let{type:e,label:n,path:r,valueKey:i,value:o,settings:s,setValue:a,disabled:l}=t,u=ln(t,uY);const{displayValue:d,onChange:h,onUpdate:p}=ZL({type:e,value:o,settings:s,setValue:a}),g=Ll[e].component;return g?te.createElement(BL.Provider,{value:St({key:i,path:r,id:""+r,label:n,displayValue:d,value:o,onChange:h,onUpdate:p,settings:s,setValue:a,disabled:l},u)},te.createElement(m9,{disabled:l},te.createElement(g,null))):(ds(Cn.NO_COMPONENT_FOR_TYPE,e,r),null)}const dY=_t("button",{display:"block",$reset:"",fontWeight:"$button",height:"$rowHeight",borderStyle:"none",borderRadius:"$sm",backgroundColor:"$elevation1",color:"$highlight1","&:not(:disabled)":{color:"$highlight3",backgroundColor:"$accent2",cursor:"pointer",$hover:"$accent3",$active:"$accent3 $accent1",$focus:""}});function hY({onClick:t,settings:e,label:n}){const r=fh();return te.createElement(qi,null,te.createElement(dY,{disabled:e.disabled,onClick:()=>t(r.get)},n))}const pY=_t("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),mY=_t("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),gY=({label:t,opts:e})=>{let n=typeof t=="string"&&t.trim()===""?null:t,r=e;return typeof e.opts=="object"&&(r.label!==void 0&&(n=e.label),r=e.opts),{label:n,opts:r}};function vY(t){const{label:e,opts:n}=gY(t),r=fh();return te.createElement(qi,{input:!!e},e&&te.createElement(_o,null,e),te.createElement(pY,null,Object.entries(n).map(([i,o])=>te.createElement(mY,{key:i,onClick:()=>o(r.get)},i))))}const yY=_t("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),LD=100;function _Y(t,e){t.push(e),t.length>LD&&t.shift()}const xY=L.forwardRef(function({initialValue:t},e){const n=ys("colors","highlight3"),r=ys("colors","elevation2"),i=ys("colors","highlight1"),[o,s]=L.useMemo(()=>[Vr(i).alpha(.4).toRgbString(),Vr(i).alpha(.1).toRgbString()],[i]),a=L.useRef([t]),l=L.useRef(t),u=L.useRef(t),d=L.useRef(),h=L.useCallback((y,w)=>{if(!y)return;const{width:x,height:m}=y,_=new Path2D,S=x/LD,M=m*.05;for(let R=0;R({frame:y=>{(l.current===void 0||yu.current)&&(u.current=y),_Y(a.current,y),d.current=requestAnimationFrame(()=>h(p.current,g.current))}}),[p,g,h]),L.useEffect(()=>()=>cancelAnimationFrame(d.current),[]),te.createElement(yY,{ref:p})}),XC=t=>Number.isFinite(t)?t.toPrecision(2):t.toString(),SY=L.forwardRef(function({initialValue:t},e){const[n,r]=L.useState(XC(t));return L.useImperativeHandle(e,()=>({frame:i=>r(XC(i))}),[]),te.createElement("div",null,n)});function YC(t){return typeof t=="function"?t():t.current}function wY({label:t,objectOrFn:e,settings:n}){const r=L.useRef(),i=L.useRef(YC(e));return L.useEffect(()=>{const o=window.setInterval(()=>{var s;document.hidden||(s=r.current)===null||s===void 0||s.frame(YC(e))},n.interval);return()=>window.clearInterval(o)},[e,n.interval]),te.createElement(qi,{input:!0},te.createElement(_o,{align:"top"},t),n.graph?te.createElement(xY,{ref:r,initialValue:i.current}):te.createElement(SY,{ref:r,initialValue:i.current}))}const EY=["type","label","key"],MY={[ho.BUTTON]:hY,[ho.BUTTON_GROUP]:vY,[ho.MONITOR]:wY},bY=te.memo(({path:t})=>{const[e,{set:n,setSettings:r,disable:i,storeId:o,emitOnEditStart:s,emitOnEditEnd:a}]=T9(t);if(!e)return null;const{type:l,label:u,key:d}=e,h=ln(e,EY);if(l in ho){const p=MY[l];return te.createElement(p,Hn({label:u,path:t},h))}return l in Ll?te.createElement(fY,Hn({key:o+t,type:l,label:u,storeId:o,path:t,valueKey:d,setValue:n,setSettings:r,disable:i,emitOnEditStart:s,emitOnEditEnd:a},h)):(D$(Cn.UNSUPPORTED_INPUT,l,t),null)});function TY({toggle:t,toggled:e,name:n}){return te.createElement(d9,{onClick:()=>t()},te.createElement(Fw,{toggled:e}),te.createElement("div",null,n))}const AY=({name:t,path:e,tree:n})=>{const r=fh(),i=jw(e,t),{collapsed:o,color:s}=r.getFolderSettings(i),[a,l]=L.useState(!o),u=L.useRef(null),d=ys("colors","folderWidgetColor"),h=ys("colors","folderTextColor");return L.useLayoutEffect(()=>{u.current.style.setProperty("--leva-colors-folderWidgetColor",s||d),u.current.style.setProperty("--leva-colors-folderTextColor",s||h)},[s,d,h]),te.createElement(Pg,{ref:u},te.createElement(TY,{name:t,toggled:a,toggle:()=>l(p=>!p)}),te.createElement(DD,{parent:i,tree:n,toggled:a}))},DD=te.memo(({isRoot:t=!1,fill:e=!1,flat:n=!1,parent:r,tree:i,toggled:o})=>{const{wrapperRef:s,contentRef:a}=dX(o),l=fh(),u=([h,p])=>{var g;return(jC(p)?(g=l.getInput(p.path))===null||g===void 0?void 0:g.order:l.getFolderSettings(jw(r,h)).order)||0},d=Object.entries(i).sort((h,p)=>u(h)-u(p));return te.createElement(h1,{ref:s,isRoot:t,fill:e,flat:n},te.createElement(jL,{ref:a,isRoot:t,toggled:o},d.map(([h,p])=>jC(p)?te.createElement(bY,{key:p.path,valueKey:p.valueKey,path:p.path}):te.createElement(AY,{key:h,name:h,path:r,tree:p}))))}),CY=_t("div",{position:"relative",fontFamily:"$mono",fontSize:"$root",color:"$rootText",backgroundColor:"$elevation1",variants:{fill:{false:{position:"fixed",top:"10px",right:"10px",zIndex:1e3,width:"$rootWidth"},true:{position:"relative",width:"100%"}},flat:{false:{borderRadius:"$lg",boxShadow:"$level1"}},oneLineLabels:{true:{[`${YL}`]:{gridTemplateColumns:"auto",gridAutoColumns:"minmax(max-content, 1fr)",gridAutoRows:"minmax($sizes$rowHeight), auto)",rowGap:0,columnGap:0,marginTop:"$rowGap"}}},hideTitleBar:{true:{$$titleBarHeight:"0px"},false:{$$titleBarHeight:"$sizes$titleBarHeight"}}},"&,*,*:after,*:before":{boxSizing:"border-box"},"*::selection":{backgroundColor:"$accent2"}}),OD=40,Ng=_t("i",{$flexCenter:"",width:OD,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),RY=_t("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),PY=_t("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${Ng}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),IY=_t("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),LY=_t("div",{touchAction:"none",$flexCenter:"",flex:1,"> svg":{fill:"$highlight1"},color:"$highlight1",variants:{drag:{true:{$draggable:"","> svg":{transition:"fill 250ms ease"},"&:hover":{color:"$highlight3"},"&:hover > svg":{fill:"$highlight3"}}},filterEnabled:{false:{paddingRight:OD}}}}),DY=te.forwardRef(({setFilter:t,toggle:e},n)=>{const[r,i]=L.useState(""),o=L.useMemo(()=>OL(t,250),[t]),s=()=>{t(""),i("")},a=l=>{const u=l.currentTarget.value;e(!0),i(u)};return L.useEffect(()=>{o(r)},[r,o]),te.createElement(te.Fragment,null,te.createElement(IY,{ref:n,value:r,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:l=>l.stopPropagation(),onChange:a}),te.createElement(Ng,{onClick:()=>s(),style:{visibility:r?"visible":"hidden"}},te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},te.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))))});function OY({setFilter:t,onDrag:e,onDragStart:n,onDragEnd:r,toggle:i,toggled:o,title:s,drag:a,filterEnabled:l,from:u}){const[d,h]=L.useState(!1),p=L.useRef(null);L.useEffect(()=>{var y,w;d?(y=p.current)===null||y===void 0||y.focus():(w=p.current)===null||w===void 0||w.blur()},[d]);const g=dh(({offset:[y,w],first:x,last:m})=>{e({x:y,y:w}),x&&n({x:y,y:w}),m&&r({x:y,y:w})},{filterTaps:!0,from:({offset:[y,w]})=>[(u==null?void 0:u.x)||y,(u==null?void 0:u.y)||w]});return L.useEffect(()=>{const y=w=>{w.key==="L"&&w.shiftKey&&w.metaKey&&h(x=>!x)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[]),te.createElement(te.Fragment,null,te.createElement(RY,{mode:a?"drag":void 0},te.createElement(Ng,{active:!o,onClick:()=>i()},te.createElement(Fw,{toggled:o,width:12,height:8})),te.createElement(LY,Hn({},a?g():{},{drag:a,filterEnabled:l}),s===void 0&&a?te.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},te.createElement("circle",{cx:"2",cy:"2",r:"2"}),te.createElement("circle",{cx:"14",cy:"2",r:"2"}),te.createElement("circle",{cx:"26",cy:"2",r:"2"}),te.createElement("circle",{cx:"2",cy:"12",r:"2"}),te.createElement("circle",{cx:"14",cy:"12",r:"2"}),te.createElement("circle",{cx:"26",cy:"12",r:"2"})):s),l&&te.createElement(Ng,{active:d,onClick:()=>h(y=>!y)},te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},te.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),te.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-13a4 4 0 00-3.446 6.032l-2.261 2.26a1 1 0 101.414 1.415l2.261-2.261A4 4 0 1011 5z",clipRule:"evenodd"})))),te.createElement(PY,{toggled:d},te.createElement(DY,{ref:p,setFilter:t,toggle:i})))}const NY=["store","hidden","theme","collapsed"];function kY(t){let{store:e,hidden:n=!1,theme:r,collapsed:i=!1}=t,o=ln(t,NY);const s=bD(()=>s9(r),[r]),[a,l]=L.useState(!i),u=typeof i=="object"?!i.collapsed:a,d=L.useMemo(()=>typeof i=="object"?h=>{typeof h=="function"?i.onChange(!h(!i.collapsed)):i.onChange(!h)}:l,[i]);return!e||n?null:te.createElement(Nw.Provider,{value:s},te.createElement(UY,Hn({store:e},o,{toggled:u,setToggle:d,rootClass:s.className})))}const UY=te.memo(({store:t,rootClass:e,fill:n=!1,flat:r=!1,neverHide:i=!1,oneLineLabels:o=!1,titleBar:s={title:void 0,drag:!0,filter:!0,position:void 0,onDrag:void 0,onDragStart:void 0,onDragEnd:void 0},hideCopyButton:a=!1,toggled:l,setToggle:u})=>{var d,h;const p=hX(t),[g,y]=L.useState(""),w=L.useMemo(()=>cY(p,g),[p,g]),[x,m]=KL(),_=i||p.length>0,S=typeof s=="object"&&s.title||void 0,M=typeof s=="object"&&(d=s.drag)!==null&&d!==void 0?d:!0,T=typeof s=="object"&&(h=s.filter)!==null&&h!==void 0?h:!0,A=typeof s=="object"&&s.position||void 0,R=typeof s=="object"&&s.onDrag||void 0,O=typeof s=="object"&&s.onDragStart||void 0,C=typeof s=="object"&&s.onDragEnd||void 0;return te.useEffect(()=>{m({x:A==null?void 0:A.x,y:A==null?void 0:A.y})},[A,m]),o9(),te.createElement(VL.Provider,{value:{hideCopyButton:a}},te.createElement(CY,{ref:x,className:e,fill:n,flat:r,oneLineLabels:o,hideTitleBar:!s,style:{display:_?"block":"none"}},s&&te.createElement(OY,{onDrag:P=>{m(P),R==null||R(P)},onDragStart:P=>O==null?void 0:O(P),onDragEnd:P=>C==null?void 0:C(P),setFilter:y,toggle:P=>u(k=>P??!k),toggled:l,title:S,drag:M,filterEnabled:T,from:A}),_&&te.createElement(HL.Provider,{value:t},te.createElement(DD,{isRoot:!0,fill:n,flat:r,tree:w,toggled:l}))))}),FY=["isRoot"];let kg=!1,hl=null;function zY(t){let{isRoot:e=!1}=t,n=ln(t,FY);return L.useEffect(()=>(kg=!0,!e&&hl&&(hl.remove(),hl=null),()=>{e||(kg=!1)}),[e]),te.createElement(kY,Hn({store:ID},n))}function BY(t){L.useEffect(()=>{t&&!kg&&(hl||(hl=document.getElementById("leva__root")||Object.assign(document.createElement("div"),{id:"leva__root"}),document.body&&(document.body.appendChild(hl),K$(te.createElement(zY,{isRoot:!0}),hl))),kg=!0)},[t])}function HY(t,e,n,r,i){let o,s,a,l,u;return typeof t=="string"?(s=t,o=e,Array.isArray(n)?u=n:n&&("store"in n?(l=n,u=r):(a=n,Array.isArray(r)?u=r:(l=r,u=i)))):(o=t,Array.isArray(e)?u=e:(l=e,u=n)),{schema:o,folderName:s,folderSettings:a,hookSettings:l,deps:u||[]}}function VY(t,e,n,r,i){const{folderName:o,schema:s,folderSettings:a,hookSettings:l,deps:u}=HY(t,e,n,r,i),d=typeof s=="function",h=L.useRef(!1),p=L.useRef(!0),g=bD(()=>{h.current=!0;const k=typeof s=="function"?s():s;return o?{[o]:lY(k,a)}:k},u),y=!(l!=null&&l.store);BY(y);const[w]=L.useState(()=>(l==null?void 0:l.store)||ID),[x,m]=L.useMemo(()=>w.getDataFromSchema(g),[w,g]),[_,S,M,T,A]=L.useMemo(()=>{const k=[],X=[],oe={},V={},K={};return Object.values(m).forEach(({path:J,onChange:se,onEditStart:F,onEditEnd:$,transient:j})=>{k.push(J),se?(oe[J]=se,j||X.push(J)):X.push(J),F&&(V[J]=F),$&&(K[J]=$)}),[k,X,oe,V,K]},[m]),R=L.useMemo(()=>w.orderPaths(_),[_,w]),O=pX(w,S,x),C=L.useCallback(k=>{const X=Object.entries(k).reduce((oe,[V,K])=>Object.assign(oe,{[m[V].path]:K}),{});w.set(X,!1)},[w,m]),P=L.useCallback(k=>w.get(m[k].path),[w,m]);return L.useEffect(()=>{const k=!p.current&&h.current;return w.addData(x,k),p.current=!1,h.current=!1,()=>w.disposePaths(R)},[w,R,x]),L.useEffect(()=>{const k=[];return Object.entries(M).forEach(([X,oe])=>{oe(w.get(X),X,St({initial:!0,get:w.get},w.getInput(X)));const V=w.useStore.subscribe(K=>{const J=K.data[X];return[J.disabled?void 0:J.value,J]},([K,J])=>oe(K,X,St({initial:!1,get:w.get},J)),{equalityFn:ch});k.push(V)}),()=>k.forEach(X=>X())},[w,M]),L.useEffect(()=>{const k=[];return Object.entries(T).forEach(([X,oe])=>k.push(w.subscribeToEditStart(X,oe))),Object.entries(A).forEach(([X,oe])=>k.push(w.subscribeToEditEnd(X,oe))),()=>k.forEach(X=>X())},[T,A,w]),d?[O,C,P]:O}Ps(mo.SELECT,W9);Ps(mo.IMAGE,XX);Ps(mo.NUMBER,D9);Ps(mo.COLOR,bX);Ps(mo.STRING,J9);Ps(mo.BOOLEAN,o7);Ps(mo.INTERVAL,nY);Ps(mo.VECTOR3D,AX);Ps(mo.VECTOR2D,NX);function WY(){const t=Sw({},` varying vec2 vUv; varying vec3 vPosition; void main() { vUv = uv; vPosition = position; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } `,` uniform float time; uniform vec3 color; varying vec2 vUv; varying vec3 vPosition; void main() { float stripes = smoothstep(0.95,1., sin(vPosition.z * 30.0 )); float fadeOut = smoothstep(-0.9, 0.1, vPosition.z); gl_FragColor.rgba = vec4(fadeOut*0.2*vec3(stripes), 1.0); } `);return rh({StripeMaterial:t}),wn.jsxs("mesh",{children:[wn.jsx("boxGeometry",{position:[0,0,.8],args:[1.5,2,1.5]}),wn.jsx("stripeMaterial",{side:1})]})}function GY(){const{roughness:t,transmission:e,rotation:n,showOriginal:r,color:i}=VY({roughness:{value:.05,min:0,max:1},transmission:{value:1,min:0,max:1},rotation:{value:1.4*Math.PI,min:0,max:2*Math.PI},showOriginal:{value:!1},color:{value:"#fff"}}),o=i1(),s=L.useRef(),a=L.useRef(),l=L.useRef(),u=L.useRef(),d=ww("glass1.jpg");return d.wrapS=d.wrapT=1e3,oh(h=>{s.current.visible=!0,l.current.visible=!1,h.gl.setRenderTarget(o),h.gl.render(h.scene,h.camera),h.gl.setRenderTarget(null),s.current.visible=r,l.current.visible=!0}),wn.jsxs(wn.Fragment,{children:[wn.jsxs("group",{ref:s,children:[wn.jsx(WY,{}),wn.jsx(iW,{ref:a,scale:1.4,rotation:[0,n,0],position:[0,-.4,.2],src:"maty.splat"})]}),wn.jsx(G8,{ref:l,position:[0,0,.8],args:[1.5,2,.2],radius:.04,children:wn.jsx(V8,{ref:u,transmission:e,roughness:t,thickness:.1,normalMap:d,normalScale:[.1,.1],color:i,buffer:o.texture})})]})}function $Y(){return wn.jsx(wn.Fragment,{children:wn.jsxs(wV,{camera:{position:[0,0,3],fov:75},children:[wn.jsx("color",{attach:"background",args:["#111111"]}),wn.jsx(Z8,{preset:"warehouse",blur:1}),wn.jsx(z8,{}),wn.jsx("ambientLight",{}),wn.jsx("pointLight",{position:[10,10,10]}),wn.jsx(GY,{})]})})}m_.createRoot(document.getElementById("root")).render(wn.jsx(te.StrictMode,{children:wn.jsx($Y,{})}));