@streamoji/avatar-widget 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ var StreamojiLeadsAvatarWidget=(function(Oy){"use strict";var fl={env:{NODE_ENV:
|
|
|
6
6
|
`+ce[m].replace(" at new "," at ");return a.displayName&&ke.includes("<anonymous>")&&(ke=ke.replace("<anonymous>",a.displayName)),ke}while(1<=m&&0<=A);break}}}finally{nt=!1,Error.prepareStackTrace=f}return(f=a?a.displayName||a.name:"")?Ve(f):""}function ft(a,r){switch(a.tag){case 26:case 27:case 5:return Ve(a.type);case 16:return Ve("Lazy");case 13:return a.child!==r&&r!==null?Ve("Suspense Fallback"):Ve("Suspense");case 19:return Ve("SuspenseList");case 0:case 15:return Ge(a.type,!1);case 11:return Ge(a.type.render,!1);case 1:return Ge(a.type,!0);case 31:return Ve("Activity");default:return""}}function ee(a){try{var r="",f=null;do r+=ft(a,f),f=a,a=a.return;while(a);return r}catch(m){return`
|
|
7
7
|
Error generating stack: `+m.message+`
|
|
8
8
|
`+m.stack}}var Nt=Object.prototype.hasOwnProperty,pt=s.unstable_scheduleCallback,Lt=s.unstable_cancelCallback,gt=s.unstable_shouldYield,Z=s.unstable_requestPaint,P=s.unstable_now,me=s.unstable_getCurrentPriorityLevel,Le=s.unstable_ImmediatePriority,Xe=s.unstable_UserBlockingPriority,Fe=s.unstable_NormalPriority,Bt=s.unstable_LowPriority,_t=s.unstable_IdlePriority,Ot=s.log,kt=s.unstable_setDisableYieldValue,Ke=null,Qe=null;function St(a){if(typeof Ot=="function"&&kt(a),Qe&&typeof Qe.setStrictMode=="function")try{Qe.setStrictMode(Ke,a)}catch{}}var yt=Math.clz32?Math.clz32:pe,lt=Math.log,Ft=Math.LN2;function pe(a){return a>>>=0,a===0?32:31-(lt(a)/Ft|0)|0}var De=256,ot=262144,bt=4194304;function it(a){var r=a&42;if(r!==0)return r;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function qe(a,r,f){var m=a.pendingLanes;if(m===0)return 0;var A=0,E=a.suspendedLanes,L=a.pingedLanes;a=a.warmLanes;var Y=m&134217727;return Y!==0?(m=Y&~E,m!==0?A=it(m):(L&=Y,L!==0?A=it(L):f||(f=Y&~a,f!==0&&(A=it(f))))):(Y=m&~E,Y!==0?A=it(Y):L!==0?A=it(L):f||(f=m&~a,f!==0&&(A=it(f)))),A===0?0:r!==0&&r!==A&&(r&E)===0&&(E=A&-A,f=r&-r,E>=f||E===32&&(f&4194048)!==0)?r:A}function mt(a,r){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&r)===0}function zt(a,r){switch(a){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hn(){var a=bt;return bt<<=1,(bt&62914560)===0&&(bt=4194304),a}function dn(a){for(var r=[],f=0;31>f;f++)r.push(a);return r}function Di(a,r){a.pendingLanes|=r,r!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Ra(a,r,f,m,A,E){var L=a.pendingLanes;a.pendingLanes=f,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=f,a.entangledLanes&=f,a.errorRecoveryDisabledLanes&=f,a.shellSuspendCounter=0;var Y=a.entanglements,ce=a.expirationTimes,Ce=a.hiddenUpdates;for(f=L&~f;0<f;){var ke=31-yt(f),$e=1<<ke;Y[ke]=0,ce[ke]=-1;var Ne=Ce[ke];if(Ne!==null)for(Ce[ke]=null,ke=0;ke<Ne.length;ke++){var He=Ne[ke];He!==null&&(He.lane&=-536870913)}f&=~$e}m!==0&&eo(a,m,0),E!==0&&A===0&&a.tag!==0&&(a.suspendedLanes|=E&~(L&~r))}function eo(a,r,f){a.pendingLanes|=r,a.suspendedLanes&=~r;var m=31-yt(r);a.entangledLanes|=r,a.entanglements[m]=a.entanglements[m]|1073741824|f&261930}function ir(a,r){var f=a.entangledLanes|=r;for(a=a.entanglements;f;){var m=31-yt(f),A=1<<m;A&r|a[m]&r&&(a[m]|=r),f&=~A}}function ma(a,r){var f=r&-r;return f=(f&42)!==0?1:wa(f),(f&(a.suspendedLanes|r))!==0?0:f}function wa(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Ga(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function gi(){var a=K.p;return a!==0?a:(a=window.event,a===void 0?32:tR(a.type))}function qt(a,r){var f=K.p;try{return K.p=a,r()}finally{K.p=f}}var ki=Math.random().toString(36).slice(2),ln="__reactFiber$"+ki,G="__reactProps$"+ki,q="__reactContainer$"+ki,j="__reactEvents$"+ki,de="__reactListeners$"+ki,ye="__reactHandles$"+ki,xe="__reactResources$"+ki,Ue="__reactMarker$"+ki;function Ie(a){delete a[ln],delete a[G],delete a[j],delete a[de],delete a[ye]}function ze(a){var r=a[ln];if(r)return r;for(var f=a.parentNode;f;){if(r=f[q]||f[ln]){if(f=r.alternate,r.child!==null||f!==null&&f.child!==null)for(a=PC(a);a!==null;){if(f=a[ln])return f;a=PC(a)}return r}a=f,f=a.parentNode}return null}function Pe(a){if(a=a[ln]||a[q]){var r=a.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return a}return null}function at(a){var r=a.tag;if(r===5||r===26||r===27||r===6)return a.stateNode;throw Error(n(33))}function Je(a){var r=a[xe];return r||(r=a[xe]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function V(a){a[Ue]=!0}var te=new Set,fe={};function he(a,r){oe(a,r),oe(a+"Capture",r)}function oe(a,r){for(fe[a]=r,a=0;a<r.length;a++)te.add(r[a])}var We=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),je={},tt={};function ht(a){return Nt.call(tt,a)?!0:Nt.call(je,a)?!1:We.test(a)?tt[a]=!0:(je[a]=!0,!1)}function ct(a,r,f){if(ht(r))if(f===null)a.removeAttribute(r);else{switch(typeof f){case"undefined":case"function":case"symbol":a.removeAttribute(r);return;case"boolean":var m=r.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){a.removeAttribute(r);return}}a.setAttribute(r,""+f)}}function It(a,r,f){if(f===null)a.removeAttribute(r);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(r);return}a.setAttribute(r,""+f)}}function dt(a,r,f,m){if(m===null)a.removeAttribute(f);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(f);return}a.setAttributeNS(r,f,""+m)}}function Dt(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function gn(a){var r=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Xn(a,r,f){var m=Object.getOwnPropertyDescriptor(a.constructor.prototype,r);if(!a.hasOwnProperty(r)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var A=m.get,E=m.set;return Object.defineProperty(a,r,{configurable:!0,get:function(){return A.call(this)},set:function(L){f=""+L,E.call(this,L)}}),Object.defineProperty(a,r,{enumerable:m.enumerable}),{getValue:function(){return f},setValue:function(L){f=""+L},stopTracking:function(){a._valueTracker=null,delete a[r]}}}}function xn(a){if(!a._valueTracker){var r=gn(a)?"checked":"value";a._valueTracker=Xn(a,r,""+a[r])}}function Xt(a){if(!a)return!1;var r=a._valueTracker;if(!r)return!0;var f=r.getValue(),m="";return a&&(m=gn(a)?a.checked?"true":"false":a.value),a=m,a!==f?(r.setValue(a),!0):!1}function Tt(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var Kt=/[\n"\\]/g;function Ct(a){return a.replace(Kt,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Yn(a,r,f,m,A,E,L,Y){a.name="",L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?a.type=L:a.removeAttribute("type"),r!=null?L==="number"?(r===0&&a.value===""||a.value!=r)&&(a.value=""+Dt(r)):a.value!==""+Dt(r)&&(a.value=""+Dt(r)):L!=="submit"&&L!=="reset"||a.removeAttribute("value"),r!=null?kn(a,L,Dt(r)):f!=null?kn(a,L,Dt(f)):m!=null&&a.removeAttribute("value"),A==null&&E!=null&&(a.defaultChecked=!!E),A!=null&&(a.checked=A&&typeof A!="function"&&typeof A!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?a.name=""+Dt(Y):a.removeAttribute("name")}function aa(a,r,f,m,A,E,L,Y){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.type=E),r!=null||f!=null){if(!(E!=="submit"&&E!=="reset"||r!=null)){xn(a);return}f=f!=null?""+Dt(f):"",r=r!=null?""+Dt(r):f,Y||r===a.value||(a.value=r),a.defaultValue=r}m=m??A,m=typeof m!="function"&&typeof m!="symbol"&&!!m,a.checked=Y?a.checked:!!m,a.defaultChecked=!!m,L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(a.name=L),xn(a)}function kn(a,r,f){r==="number"&&Tt(a.ownerDocument)===a||a.defaultValue===""+f||(a.defaultValue=""+f)}function Ui(a,r,f,m){if(a=a.options,r){r={};for(var A=0;A<f.length;A++)r["$"+f[A]]=!0;for(f=0;f<a.length;f++)A=r.hasOwnProperty("$"+a[f].value),a[f].selected!==A&&(a[f].selected=A),A&&m&&(a[f].defaultSelected=!0)}else{for(f=""+Dt(f),r=null,A=0;A<a.length;A++){if(a[A].value===f){a[A].selected=!0,m&&(a[A].defaultSelected=!0);return}r!==null||a[A].disabled||(r=a[A])}r!==null&&(r.selected=!0)}}function Kn(a,r,f){if(r!=null&&(r=""+Dt(r),r!==a.value&&(a.value=r),f==null)){a.defaultValue!==r&&(a.defaultValue=r);return}a.defaultValue=f!=null?""+Dt(f):""}function Mi(a,r,f,m){if(r==null){if(m!=null){if(f!=null)throw Error(n(92));if(_e(m)){if(1<m.length)throw Error(n(93));m=m[0]}f=m}f==null&&(f=""),r=f}f=Dt(r),a.defaultValue=f,m=a.textContent,m===f&&m!==""&&m!==null&&(a.value=m),xn(a)}function Xi(a,r){if(r){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=r;return}}a.textContent=r}var Yi=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ji(a,r,f){var m=r.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?m?a.setProperty(r,""):r==="float"?a.cssFloat="":a[r]="":m?a.setProperty(r,f):typeof f!="number"||f===0||Yi.has(r)?r==="float"?a.cssFloat=f:a[r]=(""+f).trim():a[r]=f+"px"}function Bl(a,r,f){if(r!=null&&typeof r!="object")throw Error(n(62));if(a=a.style,f!=null){for(var m in f)!f.hasOwnProperty(m)||r!=null&&r.hasOwnProperty(m)||(m.indexOf("--")===0?a.setProperty(m,""):m==="float"?a.cssFloat="":a[m]="");for(var A in r)m=r[A],r.hasOwnProperty(A)&&f[A]!==m&&Ji(a,A,m)}else for(var E in r)r.hasOwnProperty(E)&&Ji(a,E,r[E])}function _s(a){if(a.indexOf("-")===-1)return!1;switch(a){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 g_=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),v_=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function af(a){return v_.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function br(){}var sf=null;function Xh(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Dl=null,No=null;function am(a){var r=Pe(a);if(r&&(a=r.stateNode)){var f=a[G]||null;e:switch(a=r.stateNode,r.type){case"input":if(Yn(a,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),r=f.name,f.type==="radio"&&r!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+Ct(""+r)+'"][type="radio"]'),r=0;r<f.length;r++){var m=f[r];if(m!==a&&m.form===a.form){var A=m[G]||null;if(!A)throw Error(n(90));Yn(m,A.value,A.defaultValue,A.defaultValue,A.checked,A.defaultChecked,A.type,A.name)}}for(r=0;r<f.length;r++)m=f[r],m.form===a.form&&Xt(m)}break e;case"textarea":Kn(a,f.value,f.defaultValue);break e;case"select":r=f.value,r!=null&&Ui(a,!!f.multiple,r,!1)}}}var Yh=!1;function sm(a,r,f){if(Yh)return a(r,f);Yh=!0;try{var m=a(r);return m}finally{if(Yh=!1,(Dl!==null||No!==null)&&(J(),Dl&&(r=Dl,a=No,No=Dl=null,am(r),a)))for(r=0;r<a.length;r++)am(a[r])}}function Ul(a,r){var f=a.stateNode;if(f===null)return null;var m=f[G]||null;if(m===null)return null;f=m[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(a=a.type,m=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!m;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(n(231,r,typeof f));return f}var Er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jh=!1;if(Er)try{var rf={};Object.defineProperty(rf,"passive",{get:function(){Jh=!0}}),window.addEventListener("test",rf,rf),window.removeEventListener("test",rf,rf)}catch{Jh=!1}var Lo=null,qh=null,Oo=null;function Kh(){if(Oo)return Oo;var a,r=qh,f=r.length,m,A="value"in Lo?Lo.value:Lo.textContent,E=A.length;for(a=0;a<f&&r[a]===A[a];a++);var L=f-a;for(m=1;m<=L&&r[f-m]===A[E-m];m++);return Oo=A.slice(a,1<m?1-m:void 0)}function Nl(a){var r=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&r===13&&(a=13)):a=r,a===10&&(a=13),32<=a||a===13?a:0}function of(){return!0}function rm(){return!1}function Ba(a){function r(f,m,A,E,L){this._reactName=f,this._targetInst=A,this.type=m,this.nativeEvent=E,this.target=L,this.currentTarget=null;for(var Y in a)a.hasOwnProperty(Y)&&(f=a[Y],this[Y]=f?f(E):E[Y]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?of:rm,this.isPropagationStopped=rm,this}return v(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=of)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=of)},persist:function(){},isPersistent:of}),r}var Io={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lf=Ba(Io),ar=v({},Io,{view:0,detail:0}),Wh=Ba(ar),jh,cf,Dc,uf=v({},ar,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hf,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==Dc&&(Dc&&a.type==="mousemove"?(jh=a.screenX-Dc.screenX,cf=a.screenY-Dc.screenY):cf=jh=0,Dc=a),jh)},movementY:function(a){return"movementY"in a?a.movementY:cf}}),__=Ba(uf),ga=v({},uf,{dataTransfer:0}),y_=Ba(ga),x_=v({},ar,{relatedTarget:0}),Zh=Ba(x_),A_=v({},Io,{animationName:0,elapsedTime:0,pseudoElement:0}),S_=Ba(A_),ff=v({},Io,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),om=Ba(ff),M_=v({},Io,{data:0}),lm=Ba(M_),b_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cm={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},um={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function E_(a){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(a):(a=um[a])?!!r[a]:!1}function hf(){return E_}var fm=v({},ar,{key:function(a){if(a.key){var r=b_[a.key]||a.key;if(r!=="Unidentified")return r}return a.type==="keypress"?(a=Nl(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?cm[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hf,charCode:function(a){return a.type==="keypress"?Nl(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?Nl(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),hm=Ba(fm),T_=v({},uf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qh=Ba(T_),C_=v({},ar,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hf}),to=Ba(C_),dm=v({},Io,{propertyName:0,elapsedTime:0,pseudoElement:0}),GS=Ba(dm),R_=v({},uf,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),Fo=Ba(R_),no=v({},Io,{newState:0,oldState:0}),pm=Ba(no),mm=[9,13,27,32],Ll=Er&&"CompositionEvent"in window,Ho=null;Er&&"documentMode"in document&&(Ho=document.documentMode);var Ol=Er&&"TextEvent"in window&&!Ho,va=Er&&(!Ll||Ho&&8<Ho&&11>=Ho),df=" ",gm=!1;function $h(a,r){switch(a){case"keyup":return mm.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uc(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Po=!1;function ed(a,r){switch(a){case"compositionend":return Uc(r);case"keypress":return r.which!==32?null:(gm=!0,df);case"textInput":return a=r.data,a===df&&gm?null:a;default:return null}}function w_(a,r){if(Po)return a==="compositionend"||!Ll&&$h(a,r)?(a=Kh(),Oo=qh=Lo=null,Po=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return va&&r.locale!=="ko"?null:r.data;default:return null}}var ys={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function vm(a){var r=a&&a.nodeName&&a.nodeName.toLowerCase();return r==="input"?!!ys[a.type]:r==="textarea"}function td(a,r,f,m){Dl?No?No.push(m):No=[m]:Dl=m,r=xy(r,"onChange"),0<r.length&&(f=new lf("onChange","change",null,f,m),a.push({event:f,listeners:r}))}var Nc=null,Lc=null;function _m(a){EC(a,0)}function Oc(a){var r=at(a);if(Xt(r))return a}function ym(a,r){if(a==="change")return r}var pf=!1;if(Er){var Il;if(Er){var ui="oninput"in document;if(!ui){var B_=document.createElement("div");B_.setAttribute("oninput","return;"),ui=typeof B_.oninput=="function"}Il=ui}else Il=!1;pf=Il&&(!document.documentMode||9<document.documentMode)}function D_(){Nc&&(Nc.detachEvent("onpropertychange",xm),Lc=Nc=null)}function xm(a){if(a.propertyName==="value"&&Oc(Lc)){var r=[];td(r,Lc,a,Xh(a)),sm(_m,r)}}function mf(a,r,f){a==="focusin"?(D_(),Nc=r,Lc=f,Nc.attachEvent("onpropertychange",xm)):a==="focusout"&&D_()}function Go(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Oc(Lc)}function U_(a,r){if(a==="click")return Oc(r)}function N_(a,r){if(a==="input"||a==="change")return Oc(r)}function Fl(a,r){return a===r&&(a!==0||1/a===1/r)||a!==a&&r!==r}var fi=typeof Object.is=="function"?Object.is:Fl;function Ic(a,r){if(fi(a,r))return!0;if(typeof a!="object"||a===null||typeof r!="object"||r===null)return!1;var f=Object.keys(a),m=Object.keys(r);if(f.length!==m.length)return!1;for(m=0;m<f.length;m++){var A=f[m];if(!Nt.call(r,A)||!fi(a[A],r[A]))return!1}return!0}function Am(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Sm(a,r){var f=Am(a);a=0;for(var m;f;){if(f.nodeType===3){if(m=a+f.textContent.length,a<=r&&m>=r)return{node:f,offset:r-a};a=m}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=Am(f)}}function nd(a,r){return a&&r?a===r?!0:a&&a.nodeType===3?!1:r&&r.nodeType===3?nd(a,r.parentNode):"contains"in a?a.contains(r):a.compareDocumentPosition?!!(a.compareDocumentPosition(r)&16):!1:!1}function id(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var r=Tt(a.document);r instanceof a.HTMLIFrameElement;){try{var f=typeof r.contentWindow.location.href=="string"}catch{f=!1}if(f)a=r.contentWindow;else break;r=Tt(a.document)}return r}function Fc(a){var r=a&&a.nodeName&&a.nodeName.toLowerCase();return r&&(r==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||r==="textarea"||a.contentEditable==="true")}var L_=Er&&"documentMode"in document&&11>=document.documentMode,Hc=null,ad=null,Pc=null,xs=!1;function sd(a,r,f){var m=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;xs||Hc==null||Hc!==Tt(m)||(m=Hc,"selectionStart"in m&&Fc(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Pc&&Ic(Pc,m)||(Pc=m,m=xy(ad,"onSelect"),0<m.length&&(r=new lf("onSelect","select",null,r,f),a.push({event:r,listeners:m}),r.target=Hc)))}function zo(a,r){var f={};return f[a.toLowerCase()]=r.toLowerCase(),f["Webkit"+a]="webkit"+r,f["Moz"+a]="moz"+r,f}var Gc={animationend:zo("Animation","AnimationEnd"),animationiteration:zo("Animation","AnimationIteration"),animationstart:zo("Animation","AnimationStart"),transitionrun:zo("Transition","TransitionRun"),transitionstart:zo("Transition","TransitionStart"),transitioncancel:zo("Transition","TransitionCancel"),transitionend:zo("Transition","TransitionEnd")},gf={},za={};Er&&(za=document.createElement("div").style,"AnimationEvent"in window||(delete Gc.animationend.animation,delete Gc.animationiteration.animation,delete Gc.animationstart.animation),"TransitionEvent"in window||delete Gc.transitionend.transition);function Vo(a){if(gf[a])return gf[a];if(!Gc[a])return a;var r=Gc[a],f;for(f in r)if(r.hasOwnProperty(f)&&f in za)return gf[a]=r[f];return a}var es=Vo("animationend"),Mm=Vo("animationiteration"),Tr=Vo("animationstart"),zc=Vo("transitionrun"),ko=Vo("transitionstart"),bm=Vo("transitioncancel"),rd=Vo("transitionend"),io=new Map,od="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");od.push("scrollEnd");function Da(a,r){io.set(a,r),he(r,[a])}var Xo=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(r))return}else if(typeof fl=="object"&&typeof fl.emit=="function"){fl.emit("uncaughtException",a);return}console.error(a)},sa=[],Hl=0,ld=0;function Yo(){for(var a=Hl,r=ld=Hl=0;r<a;){var f=sa[r];sa[r++]=null;var m=sa[r];sa[r++]=null;var A=sa[r];sa[r++]=null;var E=sa[r];if(sa[r++]=null,m!==null&&A!==null){var L=m.pending;L===null?A.next=A:(A.next=L.next,L.next=A),m.pending=A}E!==0&&cd(f,A,E)}}function vf(a,r,f,m){sa[Hl++]=a,sa[Hl++]=r,sa[Hl++]=f,sa[Hl++]=m,ld|=m,a.lanes|=m,a=a.alternate,a!==null&&(a.lanes|=m)}function Vc(a,r,f,m){return vf(a,r,f,m),kc(a)}function Jo(a,r){return vf(a,null,null,r),kc(a)}function cd(a,r,f){a.lanes|=f;var m=a.alternate;m!==null&&(m.lanes|=f);for(var A=!1,E=a.return;E!==null;)E.childLanes|=f,m=E.alternate,m!==null&&(m.childLanes|=f),E.tag===22&&(a=E.stateNode,a===null||a._visibility&1||(A=!0)),a=E,E=E.return;return a.tag===3?(E=a.stateNode,A&&r!==null&&(A=31-yt(f),a=E.hiddenUpdates,m=a[A],m===null?a[A]=[r]:m.push(r),r.lane=f|536870912),E):null}function kc(a){if(50<tc)throw tc=0,nc=null,Error(n(185));for(var r=a.return;r!==null;)a=r,r=a.return;return a.tag===3?a.stateNode:null}var qo={};function O_(a,r,f,m){this.tag=a,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Va(a,r,f,m){return new O_(a,r,f,m)}function ka(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Cr(a,r){var f=a.alternate;return f===null?(f=Va(a.tag,r,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=r,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&65011712,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,r=a.dependencies,f.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f.refCleanup=a.refCleanup,f}function Ua(a,r){a.flags&=65011714;var f=a.alternate;return f===null?(a.childLanes=0,a.lanes=r,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=f.childLanes,a.lanes=f.lanes,a.child=f.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=f.memoizedProps,a.memoizedState=f.memoizedState,a.updateQueue=f.updateQueue,a.type=f.type,r=f.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),a}function _f(a,r,f,m,A,E){var L=0;if(m=a,typeof a=="function")ka(a)&&(L=1);else if(typeof a=="string")L=E4(a,f,Re.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case N:return a=Va(31,f,r,A),a.elementType=N,a.lanes=E,a;case R:return ao(f.children,A,E,r);case T:L=8,A|=24;break;case M:return a=Va(12,f,r,A|2),a.elementType=M,a.lanes=E,a;case F:return a=Va(13,f,r,A),a.elementType=F,a.lanes=E,a;case O:return a=Va(19,f,r,A),a.elementType=O,a.lanes=E,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case D:L=10;break e;case w:L=9;break e;case U:L=11;break e;case z:L=14;break e;case k:L=16,m=null;break e}L=29,f=Error(n(130,a===null?"null":typeof a,"")),m=null}return r=Va(L,f,r,A),r.elementType=a,r.type=m,r.lanes=E,r}function ao(a,r,f,m){return a=Va(7,a,m,r),a.lanes=f,a}function ud(a,r,f){return a=Va(6,a,null,r),a.lanes=f,a}function I_(a){var r=Va(18,null,null,0);return r.stateNode=a,r}function sr(a,r,f){return r=Va(4,a.children!==null?a.children:[],a.key,r),r.lanes=f,r.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},r}var Em=new WeakMap;function ts(a,r){if(typeof a=="object"&&a!==null){var f=Em.get(a);return f!==void 0?f:(r={value:a,source:r,stack:ee(r)},Em.set(a,r),r)}return{value:a,source:r,stack:ee(r)}}var rr=[],Pl=0,yf=null,Xc=0,As=[],ns=0,Rr=null,wr=1,Br="";function so(a,r){rr[Pl++]=Xc,rr[Pl++]=yf,yf=a,Xc=r}function Tm(a,r,f){As[ns++]=wr,As[ns++]=Br,As[ns++]=Rr,Rr=a;var m=wr;a=Br;var A=32-yt(m)-1;m&=~(1<<A),f+=1;var E=32-yt(r)+A;if(30<E){var L=A-A%5;E=(m&(1<<L)-1).toString(32),m>>=L,A-=L,wr=1<<32-yt(r)+A|f<<A|m,Br=E+a}else wr=1<<E|f<<A|m,Br=a}function fd(a){a.return!==null&&(so(a,1),Tm(a,1,0))}function Ko(a){for(;a===yf;)yf=rr[--Pl],rr[Pl]=null,Xc=rr[--Pl],rr[Pl]=null;for(;a===Rr;)Rr=As[--ns],As[ns]=null,Br=As[--ns],As[ns]=null,wr=As[--ns],As[ns]=null}function xf(a,r){As[ns++]=wr,As[ns++]=Br,As[ns++]=Rr,wr=r.id,Br=r.overflow,Rr=a}var ra=null,si=null,Un=!1,ro=null,oa=!1,hd=Error(n(519));function Cn(a){var r=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Af(ts(r,a)),hd}function dd(a){var r=a.stateNode,f=a.type,m=a.memoizedProps;switch(r[ln]=a,r[G]=m,f){case"dialog":Nn("cancel",r),Nn("close",r);break;case"iframe":case"object":case"embed":Nn("load",r);break;case"video":case"audio":for(f=0;f<_g.length;f++)Nn(_g[f],r);break;case"source":Nn("error",r);break;case"img":case"image":case"link":Nn("error",r),Nn("load",r);break;case"details":Nn("toggle",r);break;case"input":Nn("invalid",r),aa(r,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":Nn("invalid",r);break;case"textarea":Nn("invalid",r),Mi(r,m.value,m.defaultValue,m.children)}f=m.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||r.textContent===""+f||m.suppressHydrationWarning===!0||wC(r.textContent,f)?(m.popover!=null&&(Nn("beforetoggle",r),Nn("toggle",r)),m.onScroll!=null&&Nn("scroll",r),m.onScrollEnd!=null&&Nn("scrollend",r),m.onClick!=null&&(r.onclick=br),r=!0):r=!1,r||Cn(a,!0)}function F_(a){for(ra=a.return;ra;)switch(ra.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:ra=ra.return}}function Gl(a){if(a!==ra)return!1;if(!Un)return F_(a),Un=!0,!1;var r=a.tag,f;if((f=r!==3&&r!==27)&&((f=r===5)&&(f=a.type,f=!(f!=="form"&&f!=="button")||rM(a.type,a.memoizedProps)),f=!f),f&&si&&Cn(a),F_(a),r===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));si=HC(a)}else if(r===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));si=HC(a)}else r===27?(r=si,cu(a.type)?(a=fM,fM=null,si=a):si=r):si=ra?zr(a.stateNode.nextSibling):null;return!0}function zl(){si=ra=null,Un=!1}function Cm(){var a=ro;return a!==null&&(Ha===null?Ha=a:Ha.push.apply(Ha,a),ro=null),a}function Af(a){ro===null?ro=[a]:ro.push(a)}var Rm=X(null),oo=null,Na=null;function lo(a,r,f){Ae(Rm,r._currentValue),r._currentValue=f}function zs(a){a._currentValue=Rm.current,ne(Rm)}function co(a,r,f){for(;a!==null;){var m=a.alternate;if((a.childLanes&r)!==r?(a.childLanes|=r,m!==null&&(m.childLanes|=r)):m!==null&&(m.childLanes&r)!==r&&(m.childLanes|=r),a===f)break;a=a.return}}function pd(a,r,f,m){var A=a.child;for(A!==null&&(A.return=a);A!==null;){var E=A.dependencies;if(E!==null){var L=A.child;E=E.firstContext;e:for(;E!==null;){var Y=E;E=A;for(var ce=0;ce<r.length;ce++)if(Y.context===r[ce]){E.lanes|=f,Y=E.alternate,Y!==null&&(Y.lanes|=f),co(E.return,f,a),m||(L=null);break e}E=Y.next}}else if(A.tag===18){if(L=A.return,L===null)throw Error(n(341));L.lanes|=f,E=L.alternate,E!==null&&(E.lanes|=f),co(L,f,a),L=null}else L=A.child;if(L!==null)L.return=A;else for(L=A;L!==null;){if(L===a){L=null;break}if(A=L.sibling,A!==null){A.return=L.return,L=A;break}L=L.return}A=L}}function Wo(a,r,f,m){a=null;for(var A=r,E=!1;A!==null;){if(!E){if((A.flags&524288)!==0)E=!0;else if((A.flags&262144)!==0)break}if(A.tag===10){var L=A.alternate;if(L===null)throw Error(n(387));if(L=L.memoizedProps,L!==null){var Y=A.type;fi(A.pendingProps.value,L.value)||(a!==null?a.push(Y):a=[Y])}}else if(A===Be.current){if(L=A.alternate,L===null)throw Error(n(387));L.memoizedState.memoizedState!==A.memoizedState.memoizedState&&(a!==null?a.push(Mg):a=[Mg])}A=A.return}a!==null&&pd(r,a,f,m),r.flags|=262144}function Yc(a){for(a=a.firstContext;a!==null;){if(!fi(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Vl(a){oo=a,Na=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function la(a){return wm(oo,a)}function Sf(a,r){return oo===null&&Vl(a),wm(a,r)}function wm(a,r){var f=r._currentValue;if(r={context:r,memoizedValue:f,next:null},Na===null){if(a===null)throw Error(n(308));Na=r,a.dependencies={lanes:0,firstContext:r},a.flags|=524288}else Na=Na.next=r;return f}var H_=typeof AbortController<"u"?AbortController:function(){var a=[],r=this.signal={aborted:!1,addEventListener:function(f,m){a.push(m)}};this.abort=function(){r.aborted=!0,a.forEach(function(f){return f()})}},P_=s.unstable_scheduleCallback,Bm=s.unstable_NormalPriority,jt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dm(){return{controller:new H_,data:new Map,refCount:0}}function _a(a){a.refCount--,a.refCount===0&&P_(Bm,function(){a.controller.abort()})}var kl=null,Um=0,uo=0,or=null;function Jc(a,r){if(kl===null){var f=kl=[];Um=0,uo=ZS(),or={status:"pending",value:void 0,then:function(m){f.push(m)}}}return Um++,r.then(Nm,Nm),r}function Nm(){if(--Um===0&&kl!==null){or!==null&&(or.status="fulfilled");var a=kl;kl=null,uo=0,or=null;for(var r=0;r<a.length;r++)(0,a[r])()}}function Lm(a,r){var f=[],m={status:"pending",value:null,reason:null,then:function(A){f.push(A)}};return a.then(function(){m.status="fulfilled",m.value=r;for(var A=0;A<f.length;A++)(0,f[A])(r)},function(A){for(m.status="rejected",m.reason=A,A=0;A<f.length;A++)(0,f[A])(void 0)}),m}var G_=H.S;H.S=function(a,r){ru=P(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&Jc(a,r),G_!==null&&G_(a,r)};var jo=X(null);function Dr(){var a=jo.current;return a!==null?a:jn.pooledCache}function qc(a,r){r===null?Ae(jo,jo.current):Ae(jo,r.pool)}function md(){var a=Dr();return a===null?null:{parent:jt._currentValue,pool:a}}var Zo=Error(n(460)),Mf=Error(n(474)),lr=Error(n(542)),bf={then:function(){}};function z_(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Om(a,r,f){switch(f=a[f],f===void 0?a.push(r):f!==r&&(r.then(br,br),r=f),r.status){case"fulfilled":return r.value;case"rejected":throw a=r.reason,Im(a),a;default:if(typeof r.status=="string")r.then(br,br);else{if(a=jn,a!==null&&100<a.shellSuspendCounter)throw Error(n(482));a=r,a.status="pending",a.then(function(m){if(r.status==="pending"){var A=r;A.status="fulfilled",A.value=m}},function(m){if(r.status==="pending"){var A=r;A.status="rejected",A.reason=m}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw a=r.reason,Im(a),a}throw tn=r,Zo}}function Xl(a){try{var r=a._init;return r(a._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(tn=f,Zo):f}}var tn=null;function gd(){if(tn===null)throw Error(n(459));var a=tn;return tn=null,a}function Im(a){if(a===Zo||a===lr)throw Error(n(483))}var Qo=null,$o=0;function vd(a){var r=$o;return $o+=1,Qo===null&&(Qo=[]),Om(Qo,a,r)}function Ef(a,r){r=r.props.ref,a.ref=r!==void 0?r:null}function Tf(a,r){throw r.$$typeof===y?Error(n(525)):(a=Object.prototype.toString.call(r),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":a)))}function Kc(a){function r(Me,ge){if(a){var Te=Me.deletions;Te===null?(Me.deletions=[ge],Me.flags|=16):Te.push(ge)}}function f(Me,ge){if(!a)return null;for(;ge!==null;)r(Me,ge),ge=ge.sibling;return null}function m(Me){for(var ge=new Map;Me!==null;)Me.key!==null?ge.set(Me.key,Me):ge.set(Me.index,Me),Me=Me.sibling;return ge}function A(Me,ge){return Me=Cr(Me,ge),Me.index=0,Me.sibling=null,Me}function E(Me,ge,Te){return Me.index=Te,a?(Te=Me.alternate,Te!==null?(Te=Te.index,Te<ge?(Me.flags|=67108866,ge):Te):(Me.flags|=67108866,ge)):(Me.flags|=1048576,ge)}function L(Me){return a&&Me.alternate===null&&(Me.flags|=67108866),Me}function Y(Me,ge,Te,Ze){return ge===null||ge.tag!==6?(ge=ud(Te,Me.mode,Ze),ge.return=Me,ge):(ge=A(ge,Te),ge.return=Me,ge)}function ce(Me,ge,Te,Ze){var en=Te.type;return en===R?ke(Me,ge,Te.props.children,Ze,Te.key):ge!==null&&(ge.elementType===en||typeof en=="object"&&en!==null&&en.$$typeof===k&&Xl(en)===ge.type)?(ge=A(ge,Te.props),Ef(ge,Te),ge.return=Me,ge):(ge=_f(Te.type,Te.key,Te.props,null,Me.mode,Ze),Ef(ge,Te),ge.return=Me,ge)}function Ce(Me,ge,Te,Ze){return ge===null||ge.tag!==4||ge.stateNode.containerInfo!==Te.containerInfo||ge.stateNode.implementation!==Te.implementation?(ge=sr(Te,Me.mode,Ze),ge.return=Me,ge):(ge=A(ge,Te.children||[]),ge.return=Me,ge)}function ke(Me,ge,Te,Ze,en){return ge===null||ge.tag!==7?(ge=ao(Te,Me.mode,Ze,en),ge.return=Me,ge):(ge=A(ge,Te),ge.return=Me,ge)}function $e(Me,ge,Te){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ge=ud(""+ge,Me.mode,Te),ge.return=Me,ge;if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case x:return Te=_f(ge.type,ge.key,ge.props,null,Me.mode,Te),Ef(Te,ge),Te.return=Me,Te;case b:return ge=sr(ge,Me.mode,Te),ge.return=Me,ge;case k:return ge=Xl(ge),$e(Me,ge,Te)}if(_e(ge)||ae(ge))return ge=ao(ge,Me.mode,Te,null),ge.return=Me,ge;if(typeof ge.then=="function")return $e(Me,vd(ge),Te);if(ge.$$typeof===D)return $e(Me,Sf(Me,ge),Te);Tf(Me,ge)}return null}function Ne(Me,ge,Te,Ze){var en=ge!==null?ge.key:null;if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return en!==null?null:Y(Me,ge,""+Te,Ze);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case x:return Te.key===en?ce(Me,ge,Te,Ze):null;case b:return Te.key===en?Ce(Me,ge,Te,Ze):null;case k:return Te=Xl(Te),Ne(Me,ge,Te,Ze)}if(_e(Te)||ae(Te))return en!==null?null:ke(Me,ge,Te,Ze,null);if(typeof Te.then=="function")return Ne(Me,ge,vd(Te),Ze);if(Te.$$typeof===D)return Ne(Me,ge,Sf(Me,Te),Ze);Tf(Me,Te)}return null}function He(Me,ge,Te,Ze,en){if(typeof Ze=="string"&&Ze!==""||typeof Ze=="number"||typeof Ze=="bigint")return Me=Me.get(Te)||null,Y(ge,Me,""+Ze,en);if(typeof Ze=="object"&&Ze!==null){switch(Ze.$$typeof){case x:return Me=Me.get(Ze.key===null?Te:Ze.key)||null,ce(ge,Me,Ze,en);case b:return Me=Me.get(Ze.key===null?Te:Ze.key)||null,Ce(ge,Me,Ze,en);case k:return Ze=Xl(Ze),He(Me,ge,Te,Ze,en)}if(_e(Ze)||ae(Ze))return Me=Me.get(Te)||null,ke(ge,Me,Ze,en,null);if(typeof Ze.then=="function")return He(Me,ge,Te,vd(Ze),en);if(Ze.$$typeof===D)return He(Me,ge,Te,Sf(ge,Ze),en);Tf(ge,Ze)}return null}function Gt(Me,ge,Te,Ze){for(var en=null,Qn=null,Yt=ge,Mn=ge=0,Fn=null;Yt!==null&&Mn<Te.length;Mn++){Yt.index>Mn?(Fn=Yt,Yt=null):Fn=Yt.sibling;var $n=Ne(Me,Yt,Te[Mn],Ze);if($n===null){Yt===null&&(Yt=Fn);break}a&&Yt&&$n.alternate===null&&r(Me,Yt),ge=E($n,ge,Mn),Qn===null?en=$n:Qn.sibling=$n,Qn=$n,Yt=Fn}if(Mn===Te.length)return f(Me,Yt),Un&&so(Me,Mn),en;if(Yt===null){for(;Mn<Te.length;Mn++)Yt=$e(Me,Te[Mn],Ze),Yt!==null&&(ge=E(Yt,ge,Mn),Qn===null?en=Yt:Qn.sibling=Yt,Qn=Yt);return Un&&so(Me,Mn),en}for(Yt=m(Yt);Mn<Te.length;Mn++)Fn=He(Yt,Me,Mn,Te[Mn],Ze),Fn!==null&&(a&&Fn.alternate!==null&&Yt.delete(Fn.key===null?Mn:Fn.key),ge=E(Fn,ge,Mn),Qn===null?en=Fn:Qn.sibling=Fn,Qn=Fn);return a&&Yt.forEach(function(pu){return r(Me,pu)}),Un&&so(Me,Mn),en}function nn(Me,ge,Te,Ze){if(Te==null)throw Error(n(151));for(var en=null,Qn=null,Yt=ge,Mn=ge=0,Fn=null,$n=Te.next();Yt!==null&&!$n.done;Mn++,$n=Te.next()){Yt.index>Mn?(Fn=Yt,Yt=null):Fn=Yt.sibling;var pu=Ne(Me,Yt,$n.value,Ze);if(pu===null){Yt===null&&(Yt=Fn);break}a&&Yt&&pu.alternate===null&&r(Me,Yt),ge=E(pu,ge,Mn),Qn===null?en=pu:Qn.sibling=pu,Qn=pu,Yt=Fn}if($n.done)return f(Me,Yt),Un&&so(Me,Mn),en;if(Yt===null){for(;!$n.done;Mn++,$n=Te.next())$n=$e(Me,$n.value,Ze),$n!==null&&(ge=E($n,ge,Mn),Qn===null?en=$n:Qn.sibling=$n,Qn=$n);return Un&&so(Me,Mn),en}for(Yt=m(Yt);!$n.done;Mn++,$n=Te.next())$n=He(Yt,Me,Mn,$n.value,Ze),$n!==null&&(a&&$n.alternate!==null&&Yt.delete($n.key===null?Mn:$n.key),ge=E($n,ge,Mn),Qn===null?en=$n:Qn.sibling=$n,Qn=$n);return a&&Yt.forEach(function(I4){return r(Me,I4)}),Un&&so(Me,Mn),en}function li(Me,ge,Te,Ze){if(typeof Te=="object"&&Te!==null&&Te.type===R&&Te.key===null&&(Te=Te.props.children),typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case x:e:{for(var en=Te.key;ge!==null;){if(ge.key===en){if(en=Te.type,en===R){if(ge.tag===7){f(Me,ge.sibling),Ze=A(ge,Te.props.children),Ze.return=Me,Me=Ze;break e}}else if(ge.elementType===en||typeof en=="object"&&en!==null&&en.$$typeof===k&&Xl(en)===ge.type){f(Me,ge.sibling),Ze=A(ge,Te.props),Ef(Ze,Te),Ze.return=Me,Me=Ze;break e}f(Me,ge);break}else r(Me,ge);ge=ge.sibling}Te.type===R?(Ze=ao(Te.props.children,Me.mode,Ze,Te.key),Ze.return=Me,Me=Ze):(Ze=_f(Te.type,Te.key,Te.props,null,Me.mode,Ze),Ef(Ze,Te),Ze.return=Me,Me=Ze)}return L(Me);case b:e:{for(en=Te.key;ge!==null;){if(ge.key===en)if(ge.tag===4&&ge.stateNode.containerInfo===Te.containerInfo&&ge.stateNode.implementation===Te.implementation){f(Me,ge.sibling),Ze=A(ge,Te.children||[]),Ze.return=Me,Me=Ze;break e}else{f(Me,ge);break}else r(Me,ge);ge=ge.sibling}Ze=sr(Te,Me.mode,Ze),Ze.return=Me,Me=Ze}return L(Me);case k:return Te=Xl(Te),li(Me,ge,Te,Ze)}if(_e(Te))return Gt(Me,ge,Te,Ze);if(ae(Te)){if(en=ae(Te),typeof en!="function")throw Error(n(150));return Te=en.call(Te),nn(Me,ge,Te,Ze)}if(typeof Te.then=="function")return li(Me,ge,vd(Te),Ze);if(Te.$$typeof===D)return li(Me,ge,Sf(Me,Te),Ze);Tf(Me,Te)}return typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint"?(Te=""+Te,ge!==null&&ge.tag===6?(f(Me,ge.sibling),Ze=A(ge,Te),Ze.return=Me,Me=Ze):(f(Me,ge),Ze=ud(Te,Me.mode,Ze),Ze.return=Me,Me=Ze),L(Me)):f(Me,ge)}return function(Me,ge,Te,Ze){try{$o=0;var en=li(Me,ge,Te,Ze);return Qo=null,en}catch(Yt){if(Yt===Zo||Yt===lr)throw Yt;var Qn=Va(29,Yt,null,Me.mode);return Qn.lanes=Ze,Qn.return=Me,Qn}}}var Yl=Kc(!0),V_=Kc(!1),el=!1;function Fm(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hm(a,r){a=a.updateQueue,r.updateQueue===a&&(r.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Ur(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function fo(a,r,f){var m=a.updateQueue;if(m===null)return null;if(m=m.shared,(On&2)!==0){var A=m.pending;return A===null?r.next=r:(r.next=A.next,A.next=r),m.pending=r,r=kc(a),cd(a,null,f),r}return vf(a,m,r,f),kc(a)}function tl(a,r,f){if(r=r.updateQueue,r!==null&&(r=r.shared,(f&4194048)!==0)){var m=r.lanes;m&=a.pendingLanes,f|=m,r.lanes=f,ir(a,f)}}function _d(a,r){var f=a.updateQueue,m=a.alternate;if(m!==null&&(m=m.updateQueue,f===m)){var A=null,E=null;if(f=f.firstBaseUpdate,f!==null){do{var L={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};E===null?A=E=L:E=E.next=L,f=f.next}while(f!==null);E===null?A=E=r:E=E.next=r}else A=E=r;f={baseState:m.baseState,firstBaseUpdate:A,lastBaseUpdate:E,shared:m.shared,callbacks:m.callbacks},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=r:a.next=r,f.lastBaseUpdate=r}var Pm=!1;function Cf(){if(Pm){var a=or;if(a!==null)throw a}}function Jl(a,r,f,m){Pm=!1;var A=a.updateQueue;el=!1;var E=A.firstBaseUpdate,L=A.lastBaseUpdate,Y=A.shared.pending;if(Y!==null){A.shared.pending=null;var ce=Y,Ce=ce.next;ce.next=null,L===null?E=Ce:L.next=Ce,L=ce;var ke=a.alternate;ke!==null&&(ke=ke.updateQueue,Y=ke.lastBaseUpdate,Y!==L&&(Y===null?ke.firstBaseUpdate=Ce:Y.next=Ce,ke.lastBaseUpdate=ce))}if(E!==null){var $e=A.baseState;L=0,ke=Ce=ce=null,Y=E;do{var Ne=Y.lane&-536870913,He=Ne!==Y.lane;if(He?(Rn&Ne)===Ne:(m&Ne)===Ne){Ne!==0&&Ne===uo&&(Pm=!0),ke!==null&&(ke=ke.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var Gt=a,nn=Y;Ne=r;var li=f;switch(nn.tag){case 1:if(Gt=nn.payload,typeof Gt=="function"){$e=Gt.call(li,$e,Ne);break e}$e=Gt;break e;case 3:Gt.flags=Gt.flags&-65537|128;case 0:if(Gt=nn.payload,Ne=typeof Gt=="function"?Gt.call(li,$e,Ne):Gt,Ne==null)break e;$e=v({},$e,Ne);break e;case 2:el=!0}}Ne=Y.callback,Ne!==null&&(a.flags|=64,He&&(a.flags|=8192),He=A.callbacks,He===null?A.callbacks=[Ne]:He.push(Ne))}else He={lane:Ne,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},ke===null?(Ce=ke=He,ce=$e):ke=ke.next=He,L|=Ne;if(Y=Y.next,Y===null){if(Y=A.shared.pending,Y===null)break;He=Y,Y=He.next,He.next=null,A.lastBaseUpdate=He,A.shared.pending=null}}while(!0);ke===null&&(ce=$e),A.baseState=ce,A.firstBaseUpdate=Ce,A.lastBaseUpdate=ke,E===null&&(A.shared.lanes=0),Us|=L,a.lanes=L,a.memoizedState=$e}}function Nr(a,r){if(typeof a!="function")throw Error(n(191,a));a.call(r)}function ya(a,r){var f=a.callbacks;if(f!==null)for(a.callbacks=null,a=0;a<f.length;a++)Nr(f[a],r)}var Ss=X(null),Xa=X(0);function Gm(a,r){a=Fi,Ae(Xa,a),Ae(Ss,r),Fi=a|r.baseLanes}function zm(){Ae(Xa,Fi),Ae(Ss,Ss.current)}function La(){Fi=Xa.current,ne(Ss),ne(Xa)}var Qi=X(null),Vs=null;function nl(a){var r=a.alternate;Ae(bi,bi.current&1),Ae(Qi,a),Vs===null&&(r===null||Ss.current!==null||r.memoizedState!==null)&&(Vs=a)}function Vm(a){Ae(bi,bi.current),Ae(Qi,a),Vs===null&&(Vs=a)}function k_(a){a.tag===22?(Ae(bi,bi.current),Ae(Qi,a),Vs===null&&(Vs=a)):ho()}function ho(){Ae(bi,bi.current),Ae(Qi,Qi.current)}function Ms(a){ne(Qi),Vs===a&&(Vs=null),ne(bi)}var bi=X(0);function yd(a){for(var r=a;r!==null;){if(r.tag===13){var f=r.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||cM(f)||uM(f)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break;for(;r.sibling===null;){if(r.return===null||r.return===a)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var is=0,an=null,ni=null,qi=null,xd=!1,Lr=!1,ql=!1,Ad=0,Rf=0,Or=null,zS=0;function Ei(){throw Error(n(321))}function km(a,r){if(r===null)return!1;for(var f=0;f<r.length&&f<a.length;f++)if(!fi(a[f],r[f]))return!1;return!0}function Xm(a,r,f,m,A,E){return is=E,an=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,H.H=a===null||a.memoizedState===null?cy:Zc,ql=!1,E=f(m,A),ql=!1,Lr&&(E=Y_(r,f,m,A)),X_(a),E}function X_(a){H.H=Nf;var r=ni!==null&&ni.next!==null;if(is=0,qi=ni=an=null,xd=!1,Rf=0,Or=null,r)throw Error(n(300));a===null||hi||(a=a.dependencies,a!==null&&Yc(a)&&(hi=!0))}function Y_(a,r,f,m){an=a;var A=0;do{if(Lr&&(Or=null),Rf=0,Lr=!1,25<=A)throw Error(n(301));if(A+=1,qi=ni=null,a.updateQueue!=null){var E=a.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}H.H=Lf,E=r(f,m)}while(Lr);return E}function VS(){var a=H.H,r=a.useState()[0];return r=typeof r.then=="function"?Bf(r):r,a=a.useState()[0],(ni!==null?ni.memoizedState:null)!==a&&(an.flags|=1024),r}function Ym(){var a=Ad!==0;return Ad=0,a}function Jm(a,r,f){r.updateQueue=a.updateQueue,r.flags&=-2053,a.lanes&=~f}function qm(a){if(xd){for(a=a.memoizedState;a!==null;){var r=a.queue;r!==null&&(r.pending=null),a=a.next}xd=!1}is=0,qi=ni=an=null,Lr=!1,Rf=Ad=0,Or=null}function Ya(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qi===null?an.memoizedState=qi=a:qi=qi.next=a,qi}function Ni(){if(ni===null){var a=an.alternate;a=a!==null?a.memoizedState:null}else a=ni.next;var r=qi===null?an.memoizedState:qi.next;if(r!==null)qi=r,ni=a;else{if(a===null)throw an.alternate===null?Error(n(467)):Error(n(310));ni=a,a={memoizedState:ni.memoizedState,baseState:ni.baseState,baseQueue:ni.baseQueue,queue:ni.queue,next:null},qi===null?an.memoizedState=qi=a:qi=qi.next=a}return qi}function wf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bf(a){var r=Rf;return Rf+=1,Or===null&&(Or=[]),a=Om(Or,a,r),r=an,(qi===null?r.memoizedState:qi.next)===null&&(r=r.alternate,H.H=r===null||r.memoizedState===null?cy:Zc),a}function Sd(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Bf(a);if(a.$$typeof===D)return la(a)}throw Error(n(438,String(a)))}function Km(a){var r=null,f=an.updateQueue;if(f!==null&&(r=f.memoCache),r==null){var m=an.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(r={data:m.data.map(function(A){return A.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),f===null&&(f=wf(),an.updateQueue=f),f.memoCache=r,f=r.data[r.index],f===void 0)for(f=r.data[r.index]=Array(a),m=0;m<a;m++)f[m]=I;return r.index++,f}function po(a,r){return typeof r=="function"?r(a):r}function Md(a){var r=Ni();return Wm(r,ni,a)}function Wm(a,r,f){var m=a.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=f;var A=a.baseQueue,E=m.pending;if(E!==null){if(A!==null){var L=A.next;A.next=E.next,E.next=L}r.baseQueue=A=E,m.pending=null}if(E=a.baseState,A===null)a.memoizedState=E;else{r=A.next;var Y=L=null,ce=null,Ce=r,ke=!1;do{var $e=Ce.lane&-536870913;if($e!==Ce.lane?(Rn&$e)===$e:(is&$e)===$e){var Ne=Ce.revertLane;if(Ne===0)ce!==null&&(ce=ce.next={lane:0,revertLane:0,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null}),$e===uo&&(ke=!0);else if((is&Ne)===Ne){Ce=Ce.next,Ne===uo&&(ke=!0);continue}else $e={lane:0,revertLane:Ce.revertLane,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},ce===null?(Y=ce=$e,L=E):ce=ce.next=$e,an.lanes|=Ne,Us|=Ne;$e=Ce.action,ql&&f(E,$e),E=Ce.hasEagerState?Ce.eagerState:f(E,$e)}else Ne={lane:$e,revertLane:Ce.revertLane,gesture:Ce.gesture,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},ce===null?(Y=ce=Ne,L=E):ce=ce.next=Ne,an.lanes|=$e,Us|=$e;Ce=Ce.next}while(Ce!==null&&Ce!==r);if(ce===null?L=E:ce.next=Y,!fi(E,a.memoizedState)&&(hi=!0,ke&&(f=or,f!==null)))throw f;a.memoizedState=E,a.baseState=L,a.baseQueue=ce,m.lastRenderedState=E}return A===null&&(m.lanes=0),[a.memoizedState,m.dispatch]}function bd(a){var r=Ni(),f=r.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=a;var m=f.dispatch,A=f.pending,E=r.memoizedState;if(A!==null){f.pending=null;var L=A=A.next;do E=a(E,L.action),L=L.next;while(L!==A);fi(E,r.memoizedState)||(hi=!0),r.memoizedState=E,r.baseQueue===null&&(r.baseState=E),f.lastRenderedState=E}return[E,m]}function jm(a,r,f){var m=an,A=Ni(),E=Un;if(E){if(f===void 0)throw Error(n(407));f=f()}else f=r();var L=!fi((ni||A).memoizedState,f);if(L&&(A.memoizedState=f,hi=!0),A=A.queue,tg(Qm.bind(null,m,A,a),[a]),A.getSnapshot!==r||L||qi!==null&&qi.memoizedState.tag&1){if(m.flags|=2048,Wc(9,{destroy:void 0},Zm.bind(null,m,A,f,r),null),jn===null)throw Error(n(349));E||(is&127)!==0||J_(m,r,f)}return f}function J_(a,r,f){a.flags|=16384,a={getSnapshot:r,value:f},r=an.updateQueue,r===null?(r=wf(),an.updateQueue=r,r.stores=[a]):(f=r.stores,f===null?r.stores=[a]:f.push(a))}function Zm(a,r,f,m){r.value=f,r.getSnapshot=m,$m(r)&&Ed(a)}function Qm(a,r,f){return f(function(){$m(r)&&Ed(a)})}function $m(a){var r=a.getSnapshot;a=a.value;try{var f=r();return!fi(a,f)}catch{return!0}}function Ed(a){var r=Jo(a,2);r!==null&&u(r,a,2)}function Df(a){var r=Ya();if(typeof a=="function"){var f=a;if(a=f(),ql){St(!0);try{f()}finally{St(!1)}}}return r.memoizedState=r.baseState=a,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:po,lastRenderedState:a},r}function q_(a,r,f,m){return a.baseState=f,Wm(a,ni,typeof m=="function"?m:po)}function kS(a,r,f,m,A){if(mo(a))throw Error(n(485));if(a=r.action,a!==null){var E={payload:A,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(L){E.listeners.push(L)}};H.T!==null?f(!0):E.isTransition=!1,m(E),f=r.pending,f===null?(E.next=r.pending=E,K_(r,E)):(E.next=f.next,r.pending=f.next=E)}}function K_(a,r){var f=r.action,m=r.payload,A=a.state;if(r.isTransition){var E=H.T,L={};H.T=L;try{var Y=f(A,m),ce=H.S;ce!==null&&ce(L,Y),W_(a,r,Y)}catch(Ce){Td(a,r,Ce)}finally{E!==null&&L.types!==null&&(E.types=L.types),H.T=E}}else try{E=f(A,m),W_(a,r,E)}catch(Ce){Td(a,r,Ce)}}function W_(a,r,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(m){eg(a,r,m)},function(m){return Td(a,r,m)}):eg(a,r,f)}function eg(a,r,f){r.status="fulfilled",r.value=f,j_(r),a.state=f,r=a.pending,r!==null&&(f=r.next,f===r?a.pending=null:(f=f.next,r.next=f,K_(a,f)))}function Td(a,r,f){var m=a.pending;if(a.pending=null,m!==null){m=m.next;do r.status="rejected",r.reason=f,j_(r),r=r.next;while(r!==m)}a.action=null}function j_(a){a=a.listeners;for(var r=0;r<a.length;r++)(0,a[r])()}function Z_(a,r){return r}function Q_(a,r){if(Un){var f=jn.formState;if(f!==null){e:{var m=an;if(Un){if(si){t:{for(var A=si,E=oa;A.nodeType!==8;){if(!E){A=null;break t}if(A=zr(A.nextSibling),A===null){A=null;break t}}E=A.data,A=E==="F!"||E==="F"?A:null}if(A){si=zr(A.nextSibling),m=A.data==="F!";break e}}Cn(m)}m=!1}m&&(r=f[0])}}return f=Ya(),f.memoizedState=f.baseState=r,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Z_,lastRenderedState:r},f.queue=m,f=ly.bind(null,an,m),m.dispatch=f,m=Df(!1),E=Uf.bind(null,an,!1,m.queue),m=Ya(),A={state:r,dispatch:null,action:a,pending:null},m.queue=A,f=kS.bind(null,an,A,E,f),A.dispatch=f,m.memoizedState=a,[r,f,!1]}function $_(a){var r=Ni();return ey(r,ni,a)}function ey(a,r,f){if(r=Wm(a,r,Z_)[0],a=Md(po)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var m=Bf(r)}catch(L){throw L===Zo?lr:L}else m=r;r=Ni();var A=r.queue,E=A.dispatch;return f!==r.memoizedState&&(an.flags|=2048,Wc(9,{destroy:void 0},XS.bind(null,A,f),null)),[m,E,a]}function XS(a,r){a.action=r}function ty(a){var r=Ni(),f=ni;if(f!==null)return ey(r,f,a);Ni(),r=r.memoizedState,f=Ni();var m=f.queue.dispatch;return f.memoizedState=a,[r,m,!1]}function Wc(a,r,f,m){return a={tag:a,create:f,deps:m,inst:r,next:null},r=an.updateQueue,r===null&&(r=wf(),an.updateQueue=r),f=r.lastEffect,f===null?r.lastEffect=a.next=a:(m=f.next,f.next=a,a.next=m,r.lastEffect=a),a}function ny(){return Ni().memoizedState}function Cd(a,r,f,m){var A=Ya();an.flags|=a,A.memoizedState=Wc(1|r,{destroy:void 0},f,m===void 0?null:m)}function Rd(a,r,f,m){var A=Ni();m=m===void 0?null:m;var E=A.memoizedState.inst;ni!==null&&m!==null&&km(m,ni.memoizedState.deps)?A.memoizedState=Wc(r,E,f,m):(an.flags|=a,A.memoizedState=Wc(1|r,E,f,m))}function iy(a,r){Cd(8390656,8,a,r)}function tg(a,r){Rd(2048,8,a,r)}function ay(a){an.flags|=4;var r=an.updateQueue;if(r===null)r=wf(),an.updateQueue=r,r.events=[a];else{var f=r.events;f===null?r.events=[a]:f.push(a)}}function sy(a){var r=Ni().memoizedState;return ay({ref:r,nextImpl:a}),function(){if((On&2)!==0)throw Error(n(440));return r.impl.apply(void 0,arguments)}}function ry(a,r){return Rd(4,2,a,r)}function bs(a,r){return Rd(4,4,a,r)}function ng(a,r){if(typeof r=="function"){a=a();var f=r(a);return function(){typeof f=="function"?f():r(null)}}if(r!=null)return a=a(),r.current=a,function(){r.current=null}}function wd(a,r,f){f=f!=null?f.concat([a]):null,Rd(4,4,ng.bind(null,r,a),f)}function Bd(){}function ig(a,r){var f=Ni();r=r===void 0?null:r;var m=f.memoizedState;return r!==null&&km(r,m[1])?m[0]:(f.memoizedState=[a,r],a)}function ag(a,r){var f=Ni();r=r===void 0?null:r;var m=f.memoizedState;if(r!==null&&km(r,m[1]))return m[0];if(m=a(),ql){St(!0);try{a()}finally{St(!1)}}return f.memoizedState=[m,r],m}function sg(a,r,f){return f===void 0||(is&1073741824)!==0&&(Rn&261930)===0?a.memoizedState=r:(a.memoizedState=f,a=c(),an.lanes|=a,Us|=a,f)}function rg(a,r,f,m){return fi(f,r)?f:Ss.current!==null?(a=sg(a,f,m),fi(a,r)||(hi=!0),a):(is&42)===0||(is&1073741824)!==0&&(Rn&261930)===0?(hi=!0,a.memoizedState=f):(a=c(),an.lanes|=a,Us|=a,r)}function og(a,r,f,m,A){var E=K.p;K.p=E!==0&&8>E?E:8;var L=H.T,Y={};H.T=Y,Uf(a,!1,r,f);try{var ce=A(),Ce=H.S;if(Ce!==null&&Ce(Y,ce),ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var ke=Lm(ce,m);jc(a,r,ke,qa(a))}else jc(a,r,m,qa(a))}catch($e){jc(a,r,{then:function(){},status:"rejected",reason:$e},qa())}finally{K.p=E,L!==null&&Y.types!==null&&(L.types=Y.types),H.T=L}}function YS(){}function lg(a,r,f,m){if(a.tag!==5)throw Error(n(476));var A=oy(a).queue;og(a,A,r,$,f===null?YS:function(){return cg(a),f(m)})}function oy(a){var r=a.memoizedState;if(r!==null)return r;r={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:po,lastRenderedState:$},next:null};var f={};return r.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:po,lastRenderedState:f},next:null},a.memoizedState=r,a=a.alternate,a!==null&&(a.memoizedState=r),r}function cg(a){var r=oy(a);r.next===null&&(r=a.alternate.memoizedState),jc(a,r.next.queue,{},qa())}function ug(){return la(Mg)}function xa(){return Ni().memoizedState}function fg(){return Ni().memoizedState}function JS(a){for(var r=a.return;r!==null;){switch(r.tag){case 24:case 3:var f=qa();a=Ur(f);var m=fo(r,a,f);m!==null&&(u(m,r,f),tl(m,r,f)),r={cache:Dm()},a.payload=r;return}r=r.return}}function qS(a,r,f){var m=qa();f={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},mo(a)?Kl(r,f):(f=Vc(a,r,f,m),f!==null&&(u(f,a,m),as(f,r,m)))}function ly(a,r,f){var m=qa();jc(a,r,f,m)}function jc(a,r,f,m){var A={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(mo(a))Kl(r,A);else{var E=a.alternate;if(a.lanes===0&&(E===null||E.lanes===0)&&(E=r.lastRenderedReducer,E!==null))try{var L=r.lastRenderedState,Y=E(L,f);if(A.hasEagerState=!0,A.eagerState=Y,fi(Y,L))return vf(a,r,A,0),jn===null&&Yo(),!1}catch{}if(f=Vc(a,r,A,m),f!==null)return u(f,a,m),as(f,r,m),!0}return!1}function Uf(a,r,f,m){if(m={lane:2,revertLane:ZS(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},mo(a)){if(r)throw Error(n(479))}else r=Vc(a,f,m,2),r!==null&&u(r,a,2)}function mo(a){var r=a.alternate;return a===an||r!==null&&r===an}function Kl(a,r){Lr=xd=!0;var f=a.pending;f===null?r.next=r:(r.next=f.next,f.next=r),a.pending=r}function as(a,r,f){if((f&4194048)!==0){var m=r.lanes;m&=a.pendingLanes,f|=m,r.lanes=f,ir(a,f)}}var Nf={readContext:la,use:Sd,useCallback:Ei,useContext:Ei,useEffect:Ei,useImperativeHandle:Ei,useLayoutEffect:Ei,useInsertionEffect:Ei,useMemo:Ei,useReducer:Ei,useRef:Ei,useState:Ei,useDebugValue:Ei,useDeferredValue:Ei,useTransition:Ei,useSyncExternalStore:Ei,useId:Ei,useHostTransitionStatus:Ei,useFormState:Ei,useActionState:Ei,useOptimistic:Ei,useMemoCache:Ei,useCacheRefresh:Ei};Nf.useEffectEvent=Ei;var cy={readContext:la,use:Sd,useCallback:function(a,r){return Ya().memoizedState=[a,r===void 0?null:r],a},useContext:la,useEffect:iy,useImperativeHandle:function(a,r,f){f=f!=null?f.concat([a]):null,Cd(4194308,4,ng.bind(null,r,a),f)},useLayoutEffect:function(a,r){return Cd(4194308,4,a,r)},useInsertionEffect:function(a,r){Cd(4,2,a,r)},useMemo:function(a,r){var f=Ya();r=r===void 0?null:r;var m=a();if(ql){St(!0);try{a()}finally{St(!1)}}return f.memoizedState=[m,r],m},useReducer:function(a,r,f){var m=Ya();if(f!==void 0){var A=f(r);if(ql){St(!0);try{f(r)}finally{St(!1)}}}else A=r;return m.memoizedState=m.baseState=A,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:A},m.queue=a,a=a.dispatch=qS.bind(null,an,a),[m.memoizedState,a]},useRef:function(a){var r=Ya();return a={current:a},r.memoizedState=a},useState:function(a){a=Df(a);var r=a.queue,f=ly.bind(null,an,r);return r.dispatch=f,[a.memoizedState,f]},useDebugValue:Bd,useDeferredValue:function(a,r){var f=Ya();return sg(f,a,r)},useTransition:function(){var a=Df(!1);return a=og.bind(null,an,a.queue,!0,!1),Ya().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,r,f){var m=an,A=Ya();if(Un){if(f===void 0)throw Error(n(407));f=f()}else{if(f=r(),jn===null)throw Error(n(349));(Rn&127)!==0||J_(m,r,f)}A.memoizedState=f;var E={value:f,getSnapshot:r};return A.queue=E,iy(Qm.bind(null,m,E,a),[a]),m.flags|=2048,Wc(9,{destroy:void 0},Zm.bind(null,m,E,f,r),null),f},useId:function(){var a=Ya(),r=jn.identifierPrefix;if(Un){var f=Br,m=wr;f=(m&~(1<<32-yt(m)-1)).toString(32)+f,r="_"+r+"R_"+f,f=Ad++,0<f&&(r+="H"+f.toString(32)),r+="_"}else f=zS++,r="_"+r+"r_"+f.toString(32)+"_";return a.memoizedState=r},useHostTransitionStatus:ug,useFormState:Q_,useActionState:Q_,useOptimistic:function(a){var r=Ya();r.memoizedState=r.baseState=a;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=f,r=Uf.bind(null,an,!0,f),f.dispatch=r,[a,r]},useMemoCache:Km,useCacheRefresh:function(){return Ya().memoizedState=JS.bind(null,an)},useEffectEvent:function(a){var r=Ya(),f={impl:a};return r.memoizedState=f,function(){if((On&2)!==0)throw Error(n(440));return f.impl.apply(void 0,arguments)}}},Zc={readContext:la,use:Sd,useCallback:ig,useContext:la,useEffect:tg,useImperativeHandle:wd,useInsertionEffect:ry,useLayoutEffect:bs,useMemo:ag,useReducer:Md,useRef:ny,useState:function(){return Md(po)},useDebugValue:Bd,useDeferredValue:function(a,r){var f=Ni();return rg(f,ni.memoizedState,a,r)},useTransition:function(){var a=Md(po)[0],r=Ni().memoizedState;return[typeof a=="boolean"?a:Bf(a),r]},useSyncExternalStore:jm,useId:xa,useHostTransitionStatus:ug,useFormState:$_,useActionState:$_,useOptimistic:function(a,r){var f=Ni();return q_(f,ni,a,r)},useMemoCache:Km,useCacheRefresh:fg};Zc.useEffectEvent=sy;var Lf={readContext:la,use:Sd,useCallback:ig,useContext:la,useEffect:tg,useImperativeHandle:wd,useInsertionEffect:ry,useLayoutEffect:bs,useMemo:ag,useReducer:bd,useRef:ny,useState:function(){return bd(po)},useDebugValue:Bd,useDeferredValue:function(a,r){var f=Ni();return ni===null?sg(f,a,r):rg(f,ni.memoizedState,a,r)},useTransition:function(){var a=bd(po)[0],r=Ni().memoizedState;return[typeof a=="boolean"?a:Bf(a),r]},useSyncExternalStore:jm,useId:xa,useHostTransitionStatus:ug,useFormState:ty,useActionState:ty,useOptimistic:function(a,r){var f=Ni();return ni!==null?q_(f,ni,a,r):(f.baseState=a,[a,f.queue.dispatch])},useMemoCache:Km,useCacheRefresh:fg};Lf.useEffectEvent=sy;function Qc(a,r,f,m){r=a.memoizedState,f=f(m,r),f=f==null?r:v({},r,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var Of={enqueueSetState:function(a,r,f){a=a._reactInternals;var m=qa(),A=Ur(m);A.payload=r,f!=null&&(A.callback=f),r=fo(a,A,m),r!==null&&(u(r,a,m),tl(r,a,m))},enqueueReplaceState:function(a,r,f){a=a._reactInternals;var m=qa(),A=Ur(m);A.tag=1,A.payload=r,f!=null&&(A.callback=f),r=fo(a,A,m),r!==null&&(u(r,a,m),tl(r,a,m))},enqueueForceUpdate:function(a,r){a=a._reactInternals;var f=qa(),m=Ur(f);m.tag=2,r!=null&&(m.callback=r),r=fo(a,m,f),r!==null&&(u(r,a,f),tl(r,a,f))}};function uy(a,r,f,m,A,E,L){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(m,E,L):r.prototype&&r.prototype.isPureReactComponent?!Ic(f,m)||!Ic(A,E):!0}function fy(a,r,f,m){a=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(f,m),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(f,m),r.state!==a&&Of.enqueueReplaceState(r,r.state,null)}function Aa(a,r){var f=r;if("ref"in r){f={};for(var m in r)m!=="ref"&&(f[m]=r[m])}if(a=a.defaultProps){f===r&&(f=v({},f));for(var A in a)f[A]===void 0&&(f[A]=a[A])}return f}function hg(a){Xo(a)}function hy(a){console.error(a)}function Dd(a){Xo(a)}function Ud(a,r){try{var f=a.onUncaughtError;f(r.value,{componentStack:r.stack})}catch(m){setTimeout(function(){throw m})}}function dy(a,r,f){try{var m=a.onCaughtError;m(f.value,{componentStack:f.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(A){setTimeout(function(){throw A})}}function dg(a,r,f){return f=Ur(f),f.tag=3,f.payload={element:null},f.callback=function(){Ud(a,r)},f}function $c(a){return a=Ur(a),a.tag=3,a}function ss(a,r,f,m){var A=f.type.getDerivedStateFromError;if(typeof A=="function"){var E=m.value;a.payload=function(){return A(E)},a.callback=function(){dy(r,f,m)}}var L=f.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(a.callback=function(){dy(r,f,m),typeof A!="function"&&(Gr===null?Gr=new Set([this]):Gr.add(this));var Y=m.stack;this.componentDidCatch(m.value,{componentStack:Y!==null?Y:""})})}function Es(a,r,f,m,A){if(f.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(r=f.alternate,r!==null&&Wo(r,f,A,!0),f=Qi.current,f!==null){switch(f.tag){case 31:case 13:return Vs===null?cn():f.alternate===null&&Zn===0&&(Zn=3),f.flags&=-257,f.flags|=65536,f.lanes=A,m===bf?f.flags|=16384:(r=f.updateQueue,r===null?f.updateQueue=new Set([m]):r.add(m),KS(a,m,A)),!1;case 22:return f.flags|=65536,m===bf?f.flags|=16384:(r=f.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([m])},f.updateQueue=r):(f=r.retryQueue,f===null?r.retryQueue=new Set([m]):f.add(m)),KS(a,m,A)),!1}throw Error(n(435,f.tag))}return KS(a,m,A),cn(),!1}if(Un)return r=Qi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=A,m!==hd&&(a=Error(n(422),{cause:m}),Af(ts(a,f)))):(m!==hd&&(r=Error(n(423),{cause:m}),Af(ts(r,f))),a=a.current.alternate,a.flags|=65536,A&=-A,a.lanes|=A,m=ts(m,f),A=dg(a.stateNode,m,A),_d(a,A),Zn!==4&&(Zn=2)),!1;var E=Error(n(520),{cause:m});if(E=ts(E,f),dr===null?dr=[E]:dr.push(E),Zn!==4&&(Zn=2),r===null)return!0;m=ts(m,f),f=r;do{switch(f.tag){case 3:return f.flags|=65536,a=A&-A,f.lanes|=a,a=dg(f.stateNode,m,a),_d(f,a),!1;case 1:if(r=f.type,E=f.stateNode,(f.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(Gr===null||!Gr.has(E))))return f.flags|=65536,A&=-A,f.lanes|=A,A=$c(A),ss(A,a,f,m),_d(f,A),!1}f=f.return}while(f!==null);return!1}var Nd=Error(n(461)),hi=!1;function Ti(a,r,f,m){r.child=a===null?V_(r,null,f,m):Yl(r,a.child,f,m)}function If(a,r,f,m,A){f=f.render;var E=r.ref;if("ref"in m){var L={};for(var Y in m)Y!=="ref"&&(L[Y]=m[Y])}else L=m;return Vl(r),m=Xm(a,r,f,L,E,A),Y=Ym(),a!==null&&!hi?(Jm(a,r,A),fr(a,r,A)):(Un&&Y&&fd(r),r.flags|=1,Ti(a,r,m,A),r.child)}function Ff(a,r,f,m,A){if(a===null){var E=f.type;return typeof E=="function"&&!ka(E)&&E.defaultProps===void 0&&f.compare===null?(r.tag=15,r.type=E,Ts(a,r,E,m,A)):(a=_f(f.type,null,m,r,r.mode,A),a.ref=r.ref,a.return=r,r.child=a)}if(E=a.child,!al(a,A)){var L=E.memoizedProps;if(f=f.compare,f=f!==null?f:Ic,f(L,m)&&a.ref===r.ref)return fr(a,r,A)}return r.flags|=1,a=Cr(E,m),a.ref=r.ref,a.return=r,r.child=a}function Ts(a,r,f,m,A){if(a!==null){var E=a.memoizedProps;if(Ic(E,m)&&a.ref===r.ref)if(hi=!1,r.pendingProps=m=E,al(a,A))(a.flags&131072)!==0&&(hi=!0);else return r.lanes=a.lanes,fr(a,r,A)}return eu(a,r,f,m,A)}function Cs(a,r,f,m){var A=m.children,E=a!==null?a.memoizedState:null;if(a===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((r.flags&128)!==0){if(E=E!==null?E.baseLanes|f:f,a!==null){for(m=r.child=a.child,A=0;m!==null;)A=A|m.lanes|m.childLanes,m=m.sibling;m=A&~E}else m=0,r.child=null;return Ir(a,r,E,f,m)}if((f&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},a!==null&&qc(r,E!==null?E.cachePool:null),E!==null?Gm(r,E):zm(),k_(r);else return m=r.lanes=536870912,Ir(a,r,E!==null?E.baseLanes|f:f,f,m)}else E!==null?(qc(r,E.cachePool),Gm(r,E),ho(),r.memoizedState=null):(a!==null&&qc(r,null),zm(),ho());return Ti(a,r,A,f),r.child}function cr(a,r){return a!==null&&a.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Ir(a,r,f,m,A){var E=Dr();return E=E===null?null:{parent:jt._currentValue,pool:E},r.memoizedState={baseLanes:f,cachePool:E},a!==null&&qc(r,null),zm(),k_(r),a!==null&&Wo(a,r,m,!0),r.childLanes=A,null}function ks(a,r){return r=tu({mode:r.mode,children:r.children},a.mode),r.ref=a.ref,a.child=r,r.return=a,r}function ca(a,r,f){return Yl(r,a.child,null,f),a=ks(r,r.pendingProps),a.flags|=2,Ms(r),r.memoizedState=null,a}function Hf(a,r,f){var m=r.pendingProps,A=(r.flags&128)!==0;if(r.flags&=-129,a===null){if(Un){if(m.mode==="hidden")return a=ks(r,m),r.lanes=536870912,cr(null,a);if(Vm(r),(a=si)?(a=FC(a,oa),a=a!==null&&a.data==="&"?a:null,a!==null&&(r.memoizedState={dehydrated:a,treeContext:Rr!==null?{id:wr,overflow:Br}:null,retryLane:536870912,hydrationErrors:null},f=I_(a),f.return=r,r.child=f,ra=r,si=null)):a=null,a===null)throw Cn(r);return r.lanes=536870912,null}return ks(r,m)}var E=a.memoizedState;if(E!==null){var L=E.dehydrated;if(Vm(r),A)if(r.flags&256)r.flags&=-257,r=ca(a,r,f);else if(r.memoizedState!==null)r.child=a.child,r.flags|=128,r=null;else throw Error(n(558));else if(hi||Wo(a,r,f,!1),A=(f&a.childLanes)!==0,hi||A){if(m=jn,m!==null&&(L=ma(m,f),L!==0&&L!==E.retryLane))throw E.retryLane=L,Jo(a,L),u(m,a,L),Nd;cn(),r=ca(a,r,f)}else a=E.treeContext,si=zr(L.nextSibling),ra=r,Un=!0,ro=null,oa=!1,a!==null&&xf(r,a),r=ks(r,m),r.flags|=4096;return r}return a=Cr(a.child,{mode:m.mode,children:m.children}),a.ref=r.ref,r.child=a,a.return=r,a}function ur(a,r){var f=r.ref;if(f===null)a!==null&&a.ref!==null&&(r.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(n(284));(a===null||a.ref!==f)&&(r.flags|=4194816)}}function eu(a,r,f,m,A){return Vl(r),f=Xm(a,r,f,m,void 0,A),m=Ym(),a!==null&&!hi?(Jm(a,r,A),fr(a,r,A)):(Un&&m&&fd(r),r.flags|=1,Ti(a,r,f,A),r.child)}function Oa(a,r,f,m,A,E){return Vl(r),r.updateQueue=null,f=Y_(r,m,f,A),X_(a),m=Ym(),a!==null&&!hi?(Jm(a,r,E),fr(a,r,E)):(Un&&m&&fd(r),r.flags|=1,Ti(a,r,f,E),r.child)}function Sa(a,r,f,m,A){if(Vl(r),r.stateNode===null){var E=qo,L=f.contextType;typeof L=="object"&&L!==null&&(E=la(L)),E=new f(m,E),r.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Of,r.stateNode=E,E._reactInternals=r,E=r.stateNode,E.props=m,E.state=r.memoizedState,E.refs={},Fm(r),L=f.contextType,E.context=typeof L=="object"&&L!==null?la(L):qo,E.state=r.memoizedState,L=f.getDerivedStateFromProps,typeof L=="function"&&(Qc(r,f,L,m),E.state=r.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(L=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),L!==E.state&&Of.enqueueReplaceState(E,E.state,null),Jl(r,m,E,A),Cf(),E.state=r.memoizedState),typeof E.componentDidMount=="function"&&(r.flags|=4194308),m=!0}else if(a===null){E=r.stateNode;var Y=r.memoizedProps,ce=Aa(f,Y);E.props=ce;var Ce=E.context,ke=f.contextType;L=qo,typeof ke=="object"&&ke!==null&&(L=la(ke));var $e=f.getDerivedStateFromProps;ke=typeof $e=="function"||typeof E.getSnapshotBeforeUpdate=="function",Y=r.pendingProps!==Y,ke||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(Y||Ce!==L)&&fy(r,E,m,L),el=!1;var Ne=r.memoizedState;E.state=Ne,Jl(r,m,E,A),Cf(),Ce=r.memoizedState,Y||Ne!==Ce||el?(typeof $e=="function"&&(Qc(r,f,$e,m),Ce=r.memoizedState),(ce=el||uy(r,f,ce,m,Ne,Ce,L))?(ke||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(r.flags|=4194308)):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=m,r.memoizedState=Ce),E.props=m,E.state=Ce,E.context=L,m=ce):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),m=!1)}else{E=r.stateNode,Hm(a,r),L=r.memoizedProps,ke=Aa(f,L),E.props=ke,$e=r.pendingProps,Ne=E.context,Ce=f.contextType,ce=qo,typeof Ce=="object"&&Ce!==null&&(ce=la(Ce)),Y=f.getDerivedStateFromProps,(Ce=typeof Y=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(L!==$e||Ne!==ce)&&fy(r,E,m,ce),el=!1,Ne=r.memoizedState,E.state=Ne,Jl(r,m,E,A),Cf();var He=r.memoizedState;L!==$e||Ne!==He||el||a!==null&&a.dependencies!==null&&Yc(a.dependencies)?(typeof Y=="function"&&(Qc(r,f,Y,m),He=r.memoizedState),(ke=el||uy(r,f,ke,m,Ne,He,ce)||a!==null&&a.dependencies!==null&&Yc(a.dependencies))?(Ce||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(m,He,ce),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(m,He,ce)),typeof E.componentDidUpdate=="function"&&(r.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof E.componentDidUpdate!="function"||L===a.memoizedProps&&Ne===a.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||L===a.memoizedProps&&Ne===a.memoizedState||(r.flags|=1024),r.memoizedProps=m,r.memoizedState=He),E.props=m,E.state=He,E.context=ce,m=ke):(typeof E.componentDidUpdate!="function"||L===a.memoizedProps&&Ne===a.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||L===a.memoizedProps&&Ne===a.memoizedState||(r.flags|=1024),m=!1)}return E=m,ur(a,r),m=(r.flags&128)!==0,E||m?(E=r.stateNode,f=m&&typeof f.getDerivedStateFromError!="function"?null:E.render(),r.flags|=1,a!==null&&m?(r.child=Yl(r,a.child,null,A),r.child=Yl(r,null,f,A)):Ti(a,r,f,A),r.memoizedState=E.state,a=r.child):a=fr(a,r,A),a}function Pn(a,r,f,m){return zl(),r.flags|=256,Ti(a,r,f,m),r.child}var Rs={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xs(a){return{baseLanes:a,cachePool:md()}}function Pf(a,r,f){return a=a!==null?a.childLanes&~f:0,r&&(a|=In),a}function ws(a,r,f){var m=r.pendingProps,A=!1,E=(r.flags&128)!==0,L;if((L=E)||(L=a!==null&&a.memoizedState===null?!1:(bi.current&2)!==0),L&&(A=!0,r.flags&=-129),L=(r.flags&32)!==0,r.flags&=-33,a===null){if(Un){if(A?nl(r):ho(),(a=si)?(a=FC(a,oa),a=a!==null&&a.data!=="&"?a:null,a!==null&&(r.memoizedState={dehydrated:a,treeContext:Rr!==null?{id:wr,overflow:Br}:null,retryLane:536870912,hydrationErrors:null},f=I_(a),f.return=r,r.child=f,ra=r,si=null)):a=null,a===null)throw Cn(r);return uM(a)?r.lanes=32:r.lanes=536870912,null}var Y=m.children;return m=m.fallback,A?(ho(),A=r.mode,Y=tu({mode:"hidden",children:Y},A),m=ao(m,A,f,null),Y.return=r,m.return=r,Y.sibling=m,r.child=Y,m=r.child,m.memoizedState=Xs(f),m.childLanes=Pf(a,L,f),r.memoizedState=Rs,cr(null,m)):(nl(r),il(r,Y))}var ce=a.memoizedState;if(ce!==null&&(Y=ce.dehydrated,Y!==null)){if(E)r.flags&256?(nl(r),r.flags&=-257,r=nu(a,r,f)):r.memoizedState!==null?(ho(),r.child=a.child,r.flags|=128,r=null):(ho(),Y=m.fallback,A=r.mode,m=tu({mode:"visible",children:m.children},A),Y=ao(Y,A,f,null),Y.flags|=2,m.return=r,Y.return=r,m.sibling=Y,r.child=m,Yl(r,a.child,null,f),m=r.child,m.memoizedState=Xs(f),m.childLanes=Pf(a,L,f),r.memoizedState=Rs,r=cr(null,m));else if(nl(r),uM(Y)){if(L=Y.nextSibling&&Y.nextSibling.dataset,L)var Ce=L.dgst;L=Ce,m=Error(n(419)),m.stack="",m.digest=L,Af({value:m,source:null,stack:null}),r=nu(a,r,f)}else if(hi||Wo(a,r,f,!1),L=(f&a.childLanes)!==0,hi||L){if(L=jn,L!==null&&(m=ma(L,f),m!==0&&m!==ce.retryLane))throw ce.retryLane=m,Jo(a,m),u(L,a,m),Nd;cM(Y)||cn(),r=nu(a,r,f)}else cM(Y)?(r.flags|=192,r.child=a.child,r=null):(a=ce.treeContext,si=zr(Y.nextSibling),ra=r,Un=!0,ro=null,oa=!1,a!==null&&xf(r,a),r=il(r,m.children),r.flags|=4096);return r}return A?(ho(),Y=m.fallback,A=r.mode,ce=a.child,Ce=ce.sibling,m=Cr(ce,{mode:"hidden",children:m.children}),m.subtreeFlags=ce.subtreeFlags&65011712,Ce!==null?Y=Cr(Ce,Y):(Y=ao(Y,A,f,null),Y.flags|=2),Y.return=r,m.return=r,m.sibling=Y,r.child=m,cr(null,m),m=r.child,Y=a.child.memoizedState,Y===null?Y=Xs(f):(A=Y.cachePool,A!==null?(ce=jt._currentValue,A=A.parent!==ce?{parent:ce,pool:ce}:A):A=md(),Y={baseLanes:Y.baseLanes|f,cachePool:A}),m.memoizedState=Y,m.childLanes=Pf(a,L,f),r.memoizedState=Rs,cr(a.child,m)):(nl(r),f=a.child,a=f.sibling,f=Cr(f,{mode:"visible",children:m.children}),f.return=r,f.sibling=null,a!==null&&(L=r.deletions,L===null?(r.deletions=[a],r.flags|=16):L.push(a)),r.child=f,r.memoizedState=null,f)}function il(a,r){return r=tu({mode:"visible",children:r},a.mode),r.return=a,a.child=r}function tu(a,r){return a=Va(22,a,null,r),a.lanes=0,a}function nu(a,r,f){return Yl(r,a.child,null,f),a=il(r,r.pendingProps.children),a.flags|=2,r.memoizedState=null,a}function Wl(a,r,f){a.lanes|=r;var m=a.alternate;m!==null&&(m.lanes|=r),co(a.return,r,f)}function Gf(a,r,f,m,A,E){var L=a.memoizedState;L===null?a.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:A,treeForkCount:E}:(L.isBackwards=r,L.rendering=null,L.renderingStartTime=0,L.last=m,L.tail=f,L.tailMode=A,L.treeForkCount=E)}function zf(a,r,f){var m=r.pendingProps,A=m.revealOrder,E=m.tail;m=m.children;var L=bi.current,Y=(L&2)!==0;if(Y?(L=L&1|2,r.flags|=128):L&=1,Ae(bi,L),Ti(a,r,m,f),m=Un?Xc:0,!Y&&a!==null&&(a.flags&128)!==0)e:for(a=r.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Wl(a,f,r);else if(a.tag===19)Wl(a,f,r);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break e;for(;a.sibling===null;){if(a.return===null||a.return===r)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(A){case"forwards":for(f=r.child,A=null;f!==null;)a=f.alternate,a!==null&&yd(a)===null&&(A=f),f=f.sibling;f=A,f===null?(A=r.child,r.child=null):(A=f.sibling,f.sibling=null),Gf(r,!1,A,f,E,m);break;case"backwards":case"unstable_legacy-backwards":for(f=null,A=r.child,r.child=null;A!==null;){if(a=A.alternate,a!==null&&yd(a)===null){r.child=A;break}a=A.sibling,A.sibling=f,f=A,A=a}Gf(r,!0,f,null,E,m);break;case"together":Gf(r,!1,null,null,void 0,m);break;default:r.memoizedState=null}return r.child}function fr(a,r,f){if(a!==null&&(r.dependencies=a.dependencies),Us|=r.lanes,(f&r.childLanes)===0)if(a!==null){if(Wo(a,r,f,!1),(f&r.childLanes)===0)return null}else return null;if(a!==null&&r.child!==a.child)throw Error(n(153));if(r.child!==null){for(a=r.child,f=Cr(a,a.pendingProps),r.child=f,f.return=r;a.sibling!==null;)a=a.sibling,f=f.sibling=Cr(a,a.pendingProps),f.return=r;f.sibling=null}return r.child}function al(a,r){return(a.lanes&r)!==0?!0:(a=a.dependencies,!!(a!==null&&Yc(a)))}function Vf(a,r,f){switch(r.tag){case 3:st(r,r.stateNode.containerInfo),lo(r,jt,a.memoizedState.cache),zl();break;case 27:case 5:Mt(r);break;case 4:st(r,r.stateNode.containerInfo);break;case 10:lo(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Vm(r),null;break;case 13:var m=r.memoizedState;if(m!==null)return m.dehydrated!==null?(nl(r),r.flags|=128,null):(f&r.child.childLanes)!==0?ws(a,r,f):(nl(r),a=fr(a,r,f),a!==null?a.sibling:null);nl(r);break;case 19:var A=(a.flags&128)!==0;if(m=(f&r.childLanes)!==0,m||(Wo(a,r,f,!1),m=(f&r.childLanes)!==0),A){if(m)return zf(a,r,f);r.flags|=128}if(A=r.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),Ae(bi,bi.current),m)break;return null;case 22:return r.lanes=0,Cs(a,r,f,r.pendingProps);case 24:lo(r,jt,a.memoizedState.cache)}return fr(a,r,f)}function Ld(a,r,f){if(a!==null)if(a.memoizedProps!==r.pendingProps)hi=!0;else{if(!al(a,f)&&(r.flags&128)===0)return hi=!1,Vf(a,r,f);hi=(a.flags&131072)!==0}else hi=!1,Un&&(r.flags&1048576)!==0&&Tm(r,Xc,r.index);switch(r.lanes=0,r.tag){case 16:e:{var m=r.pendingProps;if(a=Xl(r.elementType),r.type=a,typeof a=="function")ka(a)?(m=Aa(a,m),r.tag=1,r=Sa(null,r,a,m,f)):(r.tag=0,r=eu(null,r,a,m,f));else{if(a!=null){var A=a.$$typeof;if(A===U){r.tag=11,r=If(null,r,a,m,f);break e}else if(A===z){r.tag=14,r=Ff(null,r,a,m,f);break e}}throw r=se(a)||a,Error(n(306,r,""))}}return r;case 0:return eu(a,r,r.type,r.pendingProps,f);case 1:return m=r.type,A=Aa(m,r.pendingProps),Sa(a,r,m,A,f);case 3:e:{if(st(r,r.stateNode.containerInfo),a===null)throw Error(n(387));m=r.pendingProps;var E=r.memoizedState;A=E.element,Hm(a,r),Jl(r,m,null,f);var L=r.memoizedState;if(m=L.cache,lo(r,jt,m),m!==E.cache&&pd(r,[jt],f,!0),Cf(),m=L.element,E.isDehydrated)if(E={element:m,isDehydrated:!1,cache:L.cache},r.updateQueue.baseState=E,r.memoizedState=E,r.flags&256){r=Pn(a,r,m,f);break e}else if(m!==A){A=ts(Error(n(424)),r),Af(A),r=Pn(a,r,m,f);break e}else for(a=r.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,si=zr(a.firstChild),ra=r,Un=!0,ro=null,oa=!0,f=V_(r,null,m,f),r.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(zl(),m===A){r=fr(a,r,f);break e}Ti(a,r,m,f)}r=r.child}return r;case 26:return ur(a,r),a===null?(f=kC(r.type,null,r.pendingProps,null))?r.memoizedState=f:Un||(f=r.type,a=r.pendingProps,m=Ay(ve.current).createElement(f),m[ln]=r,m[G]=a,Ka(m,f,a),V(m),r.stateNode=m):r.memoizedState=kC(r.type,a.memoizedProps,r.pendingProps,a.memoizedState),null;case 27:return Mt(r),a===null&&Un&&(m=r.stateNode=GC(r.type,r.pendingProps,ve.current),ra=r,oa=!0,A=si,cu(r.type)?(fM=A,si=zr(m.firstChild)):si=A),Ti(a,r,r.pendingProps.children,f),ur(a,r),a===null&&(r.flags|=4194304),r.child;case 5:return a===null&&Un&&((A=m=si)&&(m=h4(m,r.type,r.pendingProps,oa),m!==null?(r.stateNode=m,ra=r,si=zr(m.firstChild),oa=!1,A=!0):A=!1),A||Cn(r)),Mt(r),A=r.type,E=r.pendingProps,L=a!==null?a.memoizedProps:null,m=E.children,rM(A,E)?m=null:L!==null&&rM(A,L)&&(r.flags|=32),r.memoizedState!==null&&(A=Xm(a,r,VS,null,null,f),Mg._currentValue=A),ur(a,r),Ti(a,r,m,f),r.child;case 6:return a===null&&Un&&((a=f=si)&&(f=d4(f,r.pendingProps,oa),f!==null?(r.stateNode=f,ra=r,si=null,a=!0):a=!1),a||Cn(r)),null;case 13:return ws(a,r,f);case 4:return st(r,r.stateNode.containerInfo),m=r.pendingProps,a===null?r.child=Yl(r,null,m,f):Ti(a,r,m,f),r.child;case 11:return If(a,r,r.type,r.pendingProps,f);case 7:return Ti(a,r,r.pendingProps,f),r.child;case 8:return Ti(a,r,r.pendingProps.children,f),r.child;case 12:return Ti(a,r,r.pendingProps.children,f),r.child;case 10:return m=r.pendingProps,lo(r,r.type,m.value),Ti(a,r,m.children,f),r.child;case 9:return A=r.type._context,m=r.pendingProps.children,Vl(r),A=la(A),m=m(A),r.flags|=1,Ti(a,r,m,f),r.child;case 14:return Ff(a,r,r.type,r.pendingProps,f);case 15:return Ts(a,r,r.type,r.pendingProps,f);case 19:return zf(a,r,f);case 31:return Hf(a,r,f);case 22:return Cs(a,r,f,r.pendingProps);case 24:return Vl(r),m=la(jt),a===null?(A=Dr(),A===null&&(A=jn,E=Dm(),A.pooledCache=E,E.refCount++,E!==null&&(A.pooledCacheLanes|=f),A=E),r.memoizedState={parent:m,cache:A},Fm(r),lo(r,jt,A)):((a.lanes&f)!==0&&(Hm(a,r),Jl(r,null,null,f),Cf()),A=a.memoizedState,E=r.memoizedState,A.parent!==m?(A={parent:m,cache:m},r.memoizedState=A,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=A),lo(r,jt,m)):(m=E.cache,lo(r,jt,m),m!==A.cache&&pd(r,[jt],f,!0))),Ti(a,r,r.pendingProps.children,f),r.child;case 29:throw r.pendingProps}throw Error(n(156,r.tag))}function rs(a){a.flags|=4}function sl(a,r,f,m,A){if((r=(a.mode&32)!==0)&&(r=!1),r){if(a.flags|=16777216,(A&335544128)===A)if(a.stateNode.complete)a.flags|=8192;else if(vt())a.flags|=8192;else throw tn=bf,Mf}else a.flags&=-16777217}function go(a,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!KC(r))if(vt())a.flags|=8192;else throw tn=bf,Mf}function iu(a,r){r!==null&&(a.flags|=4),a.flags&16384&&(r=a.tag!==22?hn():536870912,a.lanes|=r,Ns|=r)}function kf(a,r){if(!Un)switch(a.tailMode){case"hidden":r=a.tail;for(var f=null;r!==null;)r.alternate!==null&&(f=r),r=r.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?r||a.tail===null?a.tail=null:a.tail.sibling=null:m.sibling=null}}function ei(a){var r=a.alternate!==null&&a.alternate.child===a.child,f=0,m=0;if(r)for(var A=a.child;A!==null;)f|=A.lanes|A.childLanes,m|=A.subtreeFlags&65011712,m|=A.flags&65011712,A.return=a,A=A.sibling;else for(A=a.child;A!==null;)f|=A.lanes|A.childLanes,m|=A.subtreeFlags,m|=A.flags,A.return=a,A=A.sibling;return a.subtreeFlags|=m,a.childLanes=f,r}function pg(a,r,f){var m=r.pendingProps;switch(Ko(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ei(r),null;case 1:return ei(r),null;case 3:return f=r.stateNode,m=null,a!==null&&(m=a.memoizedState.cache),r.memoizedState.cache!==m&&(r.flags|=2048),zs(jt),xt(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(a===null||a.child===null)&&(Gl(r)?rs(r):a===null||a.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Cm())),ei(r),null;case 26:var A=r.type,E=r.memoizedState;return a===null?(rs(r),E!==null?(ei(r),go(r,E)):(ei(r),sl(r,A,null,m,f))):E?E!==a.memoizedState?(rs(r),ei(r),go(r,E)):(ei(r),r.flags&=-16777217):(a=a.memoizedProps,a!==m&&rs(r),ei(r),sl(r,A,a,m,f)),null;case 27:if($t(r),f=ve.current,A=r.type,a!==null&&r.stateNode!=null)a.memoizedProps!==m&&rs(r);else{if(!m){if(r.stateNode===null)throw Error(n(166));return ei(r),null}a=Re.current,Gl(r)?dd(r):(a=GC(A,m,f),r.stateNode=a,rs(r))}return ei(r),null;case 5:if($t(r),A=r.type,a!==null&&r.stateNode!=null)a.memoizedProps!==m&&rs(r);else{if(!m){if(r.stateNode===null)throw Error(n(166));return ei(r),null}if(E=Re.current,Gl(r))dd(r);else{var L=Ay(ve.current);switch(E){case 1:E=L.createElementNS("http://www.w3.org/2000/svg",A);break;case 2:E=L.createElementNS("http://www.w3.org/1998/Math/MathML",A);break;default:switch(A){case"svg":E=L.createElementNS("http://www.w3.org/2000/svg",A);break;case"math":E=L.createElementNS("http://www.w3.org/1998/Math/MathML",A);break;case"script":E=L.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof m.is=="string"?L.createElement("select",{is:m.is}):L.createElement("select"),m.multiple?E.multiple=!0:m.size&&(E.size=m.size);break;default:E=typeof m.is=="string"?L.createElement(A,{is:m.is}):L.createElement(A)}}E[ln]=r,E[G]=m;e:for(L=r.child;L!==null;){if(L.tag===5||L.tag===6)E.appendChild(L.stateNode);else if(L.tag!==4&&L.tag!==27&&L.child!==null){L.child.return=L,L=L.child;continue}if(L===r)break e;for(;L.sibling===null;){if(L.return===null||L.return===r)break e;L=L.return}L.sibling.return=L.return,L=L.sibling}r.stateNode=E;e:switch(Ka(E,A,m),A){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&rs(r)}}return ei(r),sl(r,r.type,a===null?null:a.memoizedProps,r.pendingProps,f),null;case 6:if(a&&r.stateNode!=null)a.memoizedProps!==m&&rs(r);else{if(typeof m!="string"&&r.stateNode===null)throw Error(n(166));if(a=ve.current,Gl(r)){if(a=r.stateNode,f=r.memoizedProps,m=null,A=ra,A!==null)switch(A.tag){case 27:case 5:m=A.memoizedProps}a[ln]=r,a=!!(a.nodeValue===f||m!==null&&m.suppressHydrationWarning===!0||wC(a.nodeValue,f)),a||Cn(r,!0)}else a=Ay(a).createTextNode(m),a[ln]=r,r.stateNode=a}return ei(r),null;case 31:if(f=r.memoizedState,a===null||a.memoizedState!==null){if(m=Gl(r),f!==null){if(a===null){if(!m)throw Error(n(318));if(a=r.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(557));a[ln]=r}else zl(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ei(r),a=!1}else f=Cm(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=f),a=!0;if(!a)return r.flags&256?(Ms(r),r):(Ms(r),null);if((r.flags&128)!==0)throw Error(n(558))}return ei(r),null;case 13:if(m=r.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(A=Gl(r),m!==null&&m.dehydrated!==null){if(a===null){if(!A)throw Error(n(318));if(A=r.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(n(317));A[ln]=r}else zl(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ei(r),A=!1}else A=Cm(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=A),A=!0;if(!A)return r.flags&256?(Ms(r),r):(Ms(r),null)}return Ms(r),(r.flags&128)!==0?(r.lanes=f,r):(f=m!==null,a=a!==null&&a.memoizedState!==null,f&&(m=r.child,A=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(A=m.alternate.memoizedState.cachePool.pool),E=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(E=m.memoizedState.cachePool.pool),E!==A&&(m.flags|=2048)),f!==a&&f&&(r.child.flags|=8192),iu(r,r.updateQueue),ei(r),null);case 4:return xt(),a===null&&tM(r.stateNode.containerInfo),ei(r),null;case 10:return zs(r.type),ei(r),null;case 19:if(ne(bi),m=r.memoizedState,m===null)return ei(r),null;if(A=(r.flags&128)!==0,E=m.rendering,E===null)if(A)kf(m,!1);else{if(Zn!==0||a!==null&&(a.flags&128)!==0)for(a=r.child;a!==null;){if(E=yd(a),E!==null){for(r.flags|=128,kf(m,!1),a=E.updateQueue,r.updateQueue=a,iu(r,a),r.subtreeFlags=0,a=f,f=r.child;f!==null;)Ua(f,a),f=f.sibling;return Ae(bi,bi.current&1|2),Un&&so(r,m.treeForkCount),r.child}a=a.sibling}m.tail!==null&&P()>Ls&&(r.flags|=128,A=!0,kf(m,!1),r.lanes=4194304)}else{if(!A)if(a=yd(E),a!==null){if(r.flags|=128,A=!0,a=a.updateQueue,r.updateQueue=a,iu(r,a),kf(m,!0),m.tail===null&&m.tailMode==="hidden"&&!E.alternate&&!Un)return ei(r),null}else 2*P()-m.renderingStartTime>Ls&&f!==536870912&&(r.flags|=128,A=!0,kf(m,!1),r.lanes=4194304);m.isBackwards?(E.sibling=r.child,r.child=E):(a=m.last,a!==null?a.sibling=E:r.child=E,m.last=E)}return m.tail!==null?(a=m.tail,m.rendering=a,m.tail=a.sibling,m.renderingStartTime=P(),a.sibling=null,f=bi.current,Ae(bi,A?f&1|2:f&1),Un&&so(r,m.treeForkCount),a):(ei(r),null);case 22:case 23:return Ms(r),La(),m=r.memoizedState!==null,a!==null?a.memoizedState!==null!==m&&(r.flags|=8192):m&&(r.flags|=8192),m?(f&536870912)!==0&&(r.flags&128)===0&&(ei(r),r.subtreeFlags&6&&(r.flags|=8192)):ei(r),f=r.updateQueue,f!==null&&iu(r,f.retryQueue),f=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),m=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(m=r.memoizedState.cachePool.pool),m!==f&&(r.flags|=2048),a!==null&&ne(jo),null;case 24:return f=null,a!==null&&(f=a.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),zs(jt),ei(r),null;case 25:return null;case 30:return null}throw Error(n(156,r.tag))}function Od(a,r){switch(Ko(r),r.tag){case 1:return a=r.flags,a&65536?(r.flags=a&-65537|128,r):null;case 3:return zs(jt),xt(),a=r.flags,(a&65536)!==0&&(a&128)===0?(r.flags=a&-65537|128,r):null;case 26:case 27:case 5:return $t(r),null;case 31:if(r.memoizedState!==null){if(Ms(r),r.alternate===null)throw Error(n(340));zl()}return a=r.flags,a&65536?(r.flags=a&-65537|128,r):null;case 13:if(Ms(r),a=r.memoizedState,a!==null&&a.dehydrated!==null){if(r.alternate===null)throw Error(n(340));zl()}return a=r.flags,a&65536?(r.flags=a&-65537|128,r):null;case 19:return ne(bi),null;case 4:return xt(),null;case 10:return zs(r.type),null;case 22:case 23:return Ms(r),La(),a!==null&&ne(jo),a=r.flags,a&65536?(r.flags=a&-65537|128,r):null;case 24:return zs(jt),null;case 25:return null;default:return null}}function jl(a,r){switch(Ko(r),r.tag){case 3:zs(jt),xt();break;case 26:case 27:case 5:$t(r);break;case 4:xt();break;case 31:r.memoizedState!==null&&Ms(r);break;case 13:Ms(r);break;case 19:ne(bi);break;case 10:zs(r.type);break;case 22:case 23:Ms(r),La(),a!==null&&ne(jo);break;case 24:zs(jt)}}function Fr(a,r){try{var f=r.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var A=m.next;f=A;do{if((f.tag&a)===a){m=void 0;var E=f.create,L=f.inst;m=E(),L.destroy=m}f=f.next}while(f!==A)}}catch(Y){ai(r,r.return,Y)}}function Ys(a,r,f){try{var m=r.updateQueue,A=m!==null?m.lastEffect:null;if(A!==null){var E=A.next;m=E;do{if((m.tag&a)===a){var L=m.inst,Y=L.destroy;if(Y!==void 0){L.destroy=void 0,A=r;var ce=f,Ce=Y;try{Ce()}catch(ke){ai(A,ce,ke)}}}m=m.next}while(m!==E)}}catch(ke){ai(r,r.return,ke)}}function rl(a){var r=a.updateQueue;if(r!==null){var f=a.stateNode;try{ya(r,f)}catch(m){ai(a,a.return,m)}}}function mg(a,r,f){f.props=Aa(a.type,a.memoizedProps),f.state=a.memoizedState;try{f.componentWillUnmount()}catch(m){ai(a,r,m)}}function Hr(a,r){try{var f=a.ref;if(f!==null){switch(a.tag){case 26:case 27:case 5:var m=a.stateNode;break;case 30:m=a.stateNode;break;default:m=a.stateNode}typeof f=="function"?a.refCleanup=f(m):f.current=m}}catch(A){ai(a,r,A)}}function Bs(a,r){var f=a.ref,m=a.refCleanup;if(f!==null)if(typeof m=="function")try{m()}catch(A){ai(a,r,A)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(A){ai(a,r,A)}else f.current=null}function Ds(a){var r=a.type,f=a.memoizedProps,m=a.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":f.autoFocus&&m.focus();break e;case"img":f.src?m.src=f.src:f.srcSet&&(m.srcset=f.srcSet)}}catch(A){ai(a,a.return,A)}}function Js(a,r,f){try{var m=a.stateNode;r4(m,a.type,f,r),m[G]=r}catch(A){ai(a,a.return,A)}}function Ki(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&cu(a.type)||a.tag===4}function Pr(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Ki(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&cu(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function vn(a,r,f){var m=a.tag;if(m===5||m===6)a=a.stateNode,r?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(a,r):(r=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,r.appendChild(a),f=f._reactRootContainer,f!=null||r.onclick!==null||(r.onclick=br));else if(m!==4&&(m===27&&cu(a.type)&&(f=a.stateNode,r=null),a=a.child,a!==null))for(vn(a,r,f),a=a.sibling;a!==null;)vn(a,r,f),a=a.sibling}function Jn(a,r,f){var m=a.tag;if(m===5||m===6)a=a.stateNode,r?f.insertBefore(a,r):f.appendChild(a);else if(m!==4&&(m===27&&cu(a.type)&&(f=a.stateNode),a=a.child,a!==null))for(Jn(a,r,f),a=a.sibling;a!==null;)Jn(a,r,f),a=a.sibling}function Li(a){var r=a.stateNode,f=a.memoizedProps;try{for(var m=a.type,A=r.attributes;A.length;)r.removeAttributeNode(A[0]);Ka(r,m,f),r[ln]=a,r[G]=f}catch(E){ai(a,a.return,E)}}var qs=!1,di=!1,vo=!1,Xf=typeof WeakSet=="function"?WeakSet:Set,Ci=null;function au(a,r){if(a=a.containerInfo,aM=Ry,a=id(a),Fc(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var m=f.getSelection&&f.getSelection();if(m&&m.rangeCount!==0){f=m.anchorNode;var A=m.anchorOffset,E=m.focusNode;m=m.focusOffset;try{f.nodeType,E.nodeType}catch{f=null;break e}var L=0,Y=-1,ce=-1,Ce=0,ke=0,$e=a,Ne=null;t:for(;;){for(var He;$e!==f||A!==0&&$e.nodeType!==3||(Y=L+A),$e!==E||m!==0&&$e.nodeType!==3||(ce=L+m),$e.nodeType===3&&(L+=$e.nodeValue.length),(He=$e.firstChild)!==null;)Ne=$e,$e=He;for(;;){if($e===a)break t;if(Ne===f&&++Ce===A&&(Y=L),Ne===E&&++ke===m&&(ce=L),(He=$e.nextSibling)!==null)break;$e=Ne,Ne=$e.parentNode}$e=He}f=Y===-1||ce===-1?null:{start:Y,end:ce}}else f=null}f=f||{start:0,end:0}}else f=null;for(sM={focusedElem:a,selectionRange:f},Ry=!1,Ci=r;Ci!==null;)if(r=Ci,a=r.child,(r.subtreeFlags&1028)!==0&&a!==null)a.return=r,Ci=a;else for(;Ci!==null;){switch(r=Ci,E=r.alternate,a=r.flags,r.tag){case 0:if((a&4)!==0&&(a=r.updateQueue,a=a!==null?a.events:null,a!==null))for(f=0;f<a.length;f++)A=a[f],A.ref.impl=A.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&E!==null){a=void 0,f=r,A=E.memoizedProps,E=E.memoizedState,m=f.stateNode;try{var Gt=Aa(f.type,A);a=m.getSnapshotBeforeUpdate(Gt,E),m.__reactInternalSnapshotBeforeUpdate=a}catch(nn){ai(f,f.return,nn)}}break;case 3:if((a&1024)!==0){if(a=r.stateNode.containerInfo,f=a.nodeType,f===9)lM(a);else if(f===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":lM(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(n(163))}if(a=r.sibling,a!==null){a.return=r.return,Ci=a;break}Ci=r.return}}function py(a,r,f){var m=f.flags;switch(f.tag){case 0:case 11:case 15:_o(a,f),m&4&&Fr(5,f);break;case 1:if(_o(a,f),m&4)if(a=f.stateNode,r===null)try{a.componentDidMount()}catch(L){ai(f,f.return,L)}else{var A=Aa(f.type,r.memoizedProps);r=r.memoizedState;try{a.componentDidUpdate(A,r,a.__reactInternalSnapshotBeforeUpdate)}catch(L){ai(f,f.return,L)}}m&64&&rl(f),m&512&&Hr(f,f.return);break;case 3:if(_o(a,f),m&64&&(a=f.updateQueue,a!==null)){if(r=null,f.child!==null)switch(f.child.tag){case 27:case 5:r=f.child.stateNode;break;case 1:r=f.child.stateNode}try{ya(a,r)}catch(L){ai(f,f.return,L)}}break;case 27:r===null&&m&4&&Li(f);case 26:case 5:_o(a,f),r===null&&m&4&&Ds(f),m&512&&Hr(f,f.return);break;case 12:_o(a,f);break;case 31:_o(a,f),m&4&&Fd(a,f);break;case 13:_o(a,f),m&4&&gg(a,f),m&64&&(a=f.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(f=KF.bind(null,f),p4(a,f))));break;case 22:if(m=f.memoizedState!==null||qs,!m){r=r!==null&&r.memoizedState!==null||di,A=qs;var E=di;qs=m,(di=r)&&!E?Wn(a,f,(f.subtreeFlags&8772)!==0):_o(a,f),qs=A,di=E}break;case 30:break;default:_o(a,f)}}function Id(a){var r=a.alternate;r!==null&&(a.alternate=null,Id(r)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(r=a.stateNode,r!==null&&Ie(r)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var Gn=null,Wi=!1;function Ia(a,r,f){for(f=f.child;f!==null;)ol(a,r,f),f=f.sibling}function ol(a,r,f){if(Qe&&typeof Qe.onCommitFiberUnmount=="function")try{Qe.onCommitFiberUnmount(Ke,f)}catch{}switch(f.tag){case 26:di||Bs(f,r),Ia(a,r,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:di||Bs(f,r);var m=Gn,A=Wi;cu(f.type)&&(Gn=f.stateNode,Wi=!1),Ia(a,r,f),xg(f.stateNode),Gn=m,Wi=A;break;case 5:di||Bs(f,r);case 6:if(m=Gn,A=Wi,Gn=null,Ia(a,r,f),Gn=m,Wi=A,Gn!==null)if(Wi)try{(Gn.nodeType===9?Gn.body:Gn.nodeName==="HTML"?Gn.ownerDocument.body:Gn).removeChild(f.stateNode)}catch(E){ai(f,r,E)}else try{Gn.removeChild(f.stateNode)}catch(E){ai(f,r,E)}break;case 18:Gn!==null&&(Wi?(a=Gn,OC(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,f.stateNode),Kd(a)):OC(Gn,f.stateNode));break;case 4:m=Gn,A=Wi,Gn=f.stateNode.containerInfo,Wi=!0,Ia(a,r,f),Gn=m,Wi=A;break;case 0:case 11:case 14:case 15:Ys(2,f,r),di||Ys(4,f,r),Ia(a,r,f);break;case 1:di||(Bs(f,r),m=f.stateNode,typeof m.componentWillUnmount=="function"&&mg(f,r,m)),Ia(a,r,f);break;case 21:Ia(a,r,f);break;case 22:di=(m=di)||f.memoizedState!==null,Ia(a,r,f),di=m;break;default:Ia(a,r,f)}}function Fd(a,r){if(r.memoizedState===null&&(a=r.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Kd(a)}catch(f){ai(r,r.return,f)}}}function gg(a,r){if(r.memoizedState===null&&(a=r.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Kd(a)}catch(f){ai(r,r.return,f)}}function my(a){switch(a.tag){case 31:case 13:case 19:var r=a.stateNode;return r===null&&(r=a.stateNode=new Xf),r;case 22:return a=a.stateNode,r=a._retryCache,r===null&&(r=a._retryCache=new Xf),r;default:throw Error(n(435,a.tag))}}function Oi(a,r){var f=my(a);r.forEach(function(m){if(!f.has(m)){f.add(m);var A=WF.bind(null,a,m);m.then(A,A)}})}function Fa(a,r){var f=r.deletions;if(f!==null)for(var m=0;m<f.length;m++){var A=f[m],E=a,L=r,Y=L;e:for(;Y!==null;){switch(Y.tag){case 27:if(cu(Y.type)){Gn=Y.stateNode,Wi=!1;break e}break;case 5:Gn=Y.stateNode,Wi=!1;break e;case 3:case 4:Gn=Y.stateNode.containerInfo,Wi=!0;break e}Y=Y.return}if(Gn===null)throw Error(n(160));ol(E,L,A),Gn=null,Wi=!1,E=A.alternate,E!==null&&(E.return=null),A.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)ll(r,a),r=r.sibling}var os=null;function ll(a,r){var f=a.alternate,m=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:Fa(r,a),Ri(a),m&4&&(Ys(3,a,a.return),Fr(3,a),Ys(5,a,a.return));break;case 1:Fa(r,a),Ri(a),m&512&&(di||f===null||Bs(f,f.return)),m&64&&qs&&(a=a.updateQueue,a!==null&&(m=a.callbacks,m!==null&&(f=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=f===null?m:f.concat(m))));break;case 26:var A=os;if(Fa(r,a),Ri(a),m&512&&(di||f===null||Bs(f,f.return)),m&4){var E=f!==null?f.memoizedState:null;if(m=a.memoizedState,f===null)if(m===null)if(a.stateNode===null){e:{m=a.type,f=a.memoizedProps,A=A.ownerDocument||A;t:switch(m){case"title":E=A.getElementsByTagName("title")[0],(!E||E[Ue]||E[ln]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=A.createElement(m),A.head.insertBefore(E,A.querySelector("head > title"))),Ka(E,m,f),E[ln]=a,V(E),m=E;break e;case"link":var L=JC("link","href",A).get(m+(f.href||""));if(L){for(var Y=0;Y<L.length;Y++)if(E=L[Y],E.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&E.getAttribute("rel")===(f.rel==null?null:f.rel)&&E.getAttribute("title")===(f.title==null?null:f.title)&&E.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){L.splice(Y,1);break t}}E=A.createElement(m),Ka(E,m,f),A.head.appendChild(E);break;case"meta":if(L=JC("meta","content",A).get(m+(f.content||""))){for(Y=0;Y<L.length;Y++)if(E=L[Y],E.getAttribute("content")===(f.content==null?null:""+f.content)&&E.getAttribute("name")===(f.name==null?null:f.name)&&E.getAttribute("property")===(f.property==null?null:f.property)&&E.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&E.getAttribute("charset")===(f.charSet==null?null:f.charSet)){L.splice(Y,1);break t}}E=A.createElement(m),Ka(E,m,f),A.head.appendChild(E);break;default:throw Error(n(468,m))}E[ln]=a,V(E),m=E}a.stateNode=m}else qC(A,a.type,a.stateNode);else a.stateNode=YC(A,m,a.memoizedProps);else E!==m?(E===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):E.count--,m===null?qC(A,a.type,a.stateNode):YC(A,m,a.memoizedProps)):m===null&&a.stateNode!==null&&Js(a,a.memoizedProps,f.memoizedProps)}break;case 27:Fa(r,a),Ri(a),m&512&&(di||f===null||Bs(f,f.return)),f!==null&&m&4&&Js(a,a.memoizedProps,f.memoizedProps);break;case 5:if(Fa(r,a),Ri(a),m&512&&(di||f===null||Bs(f,f.return)),a.flags&32){A=a.stateNode;try{Xi(A,"")}catch(Gt){ai(a,a.return,Gt)}}m&4&&a.stateNode!=null&&(A=a.memoizedProps,Js(a,A,f!==null?f.memoizedProps:A)),m&1024&&(vo=!0);break;case 6:if(Fa(r,a),Ri(a),m&4){if(a.stateNode===null)throw Error(n(162));m=a.memoizedProps,f=a.stateNode;try{f.nodeValue=m}catch(Gt){ai(a,a.return,Gt)}}break;case 3:if(by=null,A=os,os=Sy(r.containerInfo),Fa(r,a),os=A,Ri(a),m&4&&f!==null&&f.memoizedState.isDehydrated)try{Kd(r.containerInfo)}catch(Gt){ai(a,a.return,Gt)}vo&&(vo=!1,gy(a));break;case 4:m=os,os=Sy(a.stateNode.containerInfo),Fa(r,a),Ri(a),os=m;break;case 12:Fa(r,a),Ri(a);break;case 31:Fa(r,a),Ri(a),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,Oi(a,m)));break;case 13:Fa(r,a),Ri(a),a.child.flags&8192&&a.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(Ao=P()),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,Oi(a,m)));break;case 22:A=a.memoizedState!==null;var ce=f!==null&&f.memoizedState!==null,Ce=qs,ke=di;if(qs=Ce||A,di=ke||ce,Fa(r,a),di=ke,qs=Ce,Ri(a),m&8192)e:for(r=a.stateNode,r._visibility=A?r._visibility&-2:r._visibility|1,A&&(f===null||ce||qs||di||Zl(a)),f=null,r=a;;){if(r.tag===5||r.tag===26){if(f===null){ce=f=r;try{if(E=ce.stateNode,A)L=E.style,typeof L.setProperty=="function"?L.setProperty("display","none","important"):L.display="none";else{Y=ce.stateNode;var $e=ce.memoizedProps.style,Ne=$e!=null&&$e.hasOwnProperty("display")?$e.display:null;Y.style.display=Ne==null||typeof Ne=="boolean"?"":(""+Ne).trim()}}catch(Gt){ai(ce,ce.return,Gt)}}}else if(r.tag===6){if(f===null){ce=r;try{ce.stateNode.nodeValue=A?"":ce.memoizedProps}catch(Gt){ai(ce,ce.return,Gt)}}}else if(r.tag===18){if(f===null){ce=r;try{var He=ce.stateNode;A?IC(He,!0):IC(ce.stateNode,!1)}catch(Gt){ai(ce,ce.return,Gt)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===a)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break e;for(;r.sibling===null;){if(r.return===null||r.return===a)break e;f===r&&(f=null),r=r.return}f===r&&(f=null),r.sibling.return=r.return,r=r.sibling}m&4&&(m=a.updateQueue,m!==null&&(f=m.retryQueue,f!==null&&(m.retryQueue=null,Oi(a,f))));break;case 19:Fa(r,a),Ri(a),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,Oi(a,m)));break;case 30:break;case 21:break;default:Fa(r,a),Ri(a)}}function Ri(a){var r=a.flags;if(r&2){try{for(var f,m=a.return;m!==null;){if(Ki(m)){f=m;break}m=m.return}if(f==null)throw Error(n(160));switch(f.tag){case 27:var A=f.stateNode,E=Pr(a);Jn(a,E,A);break;case 5:var L=f.stateNode;f.flags&32&&(Xi(L,""),f.flags&=-33);var Y=Pr(a);Jn(a,Y,L);break;case 3:case 4:var ce=f.stateNode.containerInfo,Ce=Pr(a);vn(a,Ce,ce);break;default:throw Error(n(161))}}catch(ke){ai(a,a.return,ke)}a.flags&=-3}r&4096&&(a.flags&=-4097)}function gy(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var r=a;gy(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),a=a.sibling}}function _o(a,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)py(a,r.alternate,r),r=r.sibling}function Zl(a){for(a=a.child;a!==null;){var r=a;switch(r.tag){case 0:case 11:case 14:case 15:Ys(4,r,r.return),Zl(r);break;case 1:Bs(r,r.return);var f=r.stateNode;typeof f.componentWillUnmount=="function"&&mg(r,r.return,f),Zl(r);break;case 27:xg(r.stateNode);case 26:case 5:Bs(r,r.return),Zl(r);break;case 22:r.memoizedState===null&&Zl(r);break;case 30:Zl(r);break;default:Zl(r)}a=a.sibling}}function Wn(a,r,f){for(f=f&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var m=r.alternate,A=a,E=r,L=E.flags;switch(E.tag){case 0:case 11:case 15:Wn(A,E,f),Fr(4,E);break;case 1:if(Wn(A,E,f),m=E,A=m.stateNode,typeof A.componentDidMount=="function")try{A.componentDidMount()}catch(Ce){ai(m,m.return,Ce)}if(m=E,A=m.updateQueue,A!==null){var Y=m.stateNode;try{var ce=A.shared.hiddenCallbacks;if(ce!==null)for(A.shared.hiddenCallbacks=null,A=0;A<ce.length;A++)Nr(ce[A],Y)}catch(Ce){ai(m,m.return,Ce)}}f&&L&64&&rl(E),Hr(E,E.return);break;case 27:Li(E);case 26:case 5:Wn(A,E,f),f&&m===null&&L&4&&Ds(E),Hr(E,E.return);break;case 12:Wn(A,E,f);break;case 31:Wn(A,E,f),f&&L&4&&Fd(A,E);break;case 13:Wn(A,E,f),f&&L&4&&gg(A,E);break;case 22:E.memoizedState===null&&Wn(A,E,f),Hr(E,E.return);break;case 30:break;default:Wn(A,E,f)}r=r.sibling}}function Hd(a,r){var f=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==f&&(a!=null&&a.refCount++,f!=null&&_a(f))}function yo(a,r){a=null,r.alternate!==null&&(a=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==a&&(r.refCount++,a!=null&&_a(a))}function $i(a,r,f,m){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)vi(a,r,f,m),r=r.sibling}function vi(a,r,f,m){var A=r.flags;switch(r.tag){case 0:case 11:case 15:$i(a,r,f,m),A&2048&&Fr(9,r);break;case 1:$i(a,r,f,m);break;case 3:$i(a,r,f,m),A&2048&&(a=null,r.alternate!==null&&(a=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==a&&(r.refCount++,a!=null&&_a(a)));break;case 12:if(A&2048){$i(a,r,f,m),a=r.stateNode;try{var E=r.memoizedProps,L=E.id,Y=E.onPostCommit;typeof Y=="function"&&Y(L,r.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(ce){ai(r,r.return,ce)}}else $i(a,r,f,m);break;case 31:$i(a,r,f,m);break;case 13:$i(a,r,f,m);break;case 23:break;case 22:E=r.stateNode,L=r.alternate,r.memoizedState!==null?E._visibility&2?$i(a,r,f,m):su(a,r):E._visibility&2?$i(a,r,f,m):(E._visibility|=2,cl(a,r,f,m,(r.subtreeFlags&10256)!==0||!1)),A&2048&&Hd(L,r);break;case 24:$i(a,r,f,m),A&2048&&yo(r.alternate,r);break;default:$i(a,r,f,m)}}function cl(a,r,f,m,A){for(A=A&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var E=a,L=r,Y=f,ce=m,Ce=L.flags;switch(L.tag){case 0:case 11:case 15:cl(E,L,Y,ce,A),Fr(8,L);break;case 23:break;case 22:var ke=L.stateNode;L.memoizedState!==null?ke._visibility&2?cl(E,L,Y,ce,A):su(E,L):(ke._visibility|=2,cl(E,L,Y,ce,A)),A&&Ce&2048&&Hd(L.alternate,L);break;case 24:cl(E,L,Y,ce,A),A&&Ce&2048&&yo(L.alternate,L);break;default:cl(E,L,Y,ce,A)}r=r.sibling}}function su(a,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var f=a,m=r,A=m.flags;switch(m.tag){case 22:su(f,m),A&2048&&Hd(m.alternate,m);break;case 24:su(f,m),A&2048&&yo(m.alternate,m);break;default:su(f,m)}r=r.sibling}}var wi=8192;function Ql(a,r,f){if(a.subtreeFlags&wi)for(a=a.child;a!==null;)Ii(a,r,f),a=a.sibling}function Ii(a,r,f){switch(a.tag){case 26:Ql(a,r,f),a.flags&wi&&a.memoizedState!==null&&T4(f,os,a.memoizedState,a.memoizedProps);break;case 5:Ql(a,r,f);break;case 3:case 4:var m=os;os=Sy(a.stateNode.containerInfo),Ql(a,r,f),os=m;break;case 22:a.memoizedState===null&&(m=a.alternate,m!==null&&m.memoizedState!==null?(m=wi,wi=16777216,Ql(a,r,f),wi=m):Ql(a,r,f));break;default:Ql(a,r,f)}}function ls(a){var r=a.alternate;if(r!==null&&(a=r.child,a!==null)){r.child=null;do r=a.sibling,a.sibling=null,a=r;while(a!==null)}}function Ja(a){var r=a.deletions;if((a.flags&16)!==0){if(r!==null)for(var f=0;f<r.length;f++){var m=r[f];Ci=m,Yf(m,a)}ls(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)$l(a),a=a.sibling}function $l(a){switch(a.tag){case 0:case 11:case 15:Ja(a),a.flags&2048&&Ys(9,a,a.return);break;case 3:Ja(a);break;case 12:Ja(a);break;case 22:var r=a.stateNode;a.memoizedState!==null&&r._visibility&2&&(a.return===null||a.return.tag!==13)?(r._visibility&=-3,Pd(a)):Ja(a);break;default:Ja(a)}}function Pd(a){var r=a.deletions;if((a.flags&16)!==0){if(r!==null)for(var f=0;f<r.length;f++){var m=r[f];Ci=m,Yf(m,a)}ls(a)}for(a=a.child;a!==null;){switch(r=a,r.tag){case 0:case 11:case 15:Ys(8,r,r.return),Pd(r);break;case 22:f=r.stateNode,f._visibility&2&&(f._visibility&=-3,Pd(r));break;default:Pd(r)}a=a.sibling}}function Yf(a,r){for(;Ci!==null;){var f=Ci;switch(f.tag){case 0:case 11:case 15:Ys(8,f,r);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var m=f.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:_a(f.memoizedState.cache)}if(m=f.child,m!==null)m.return=f,Ci=m;else e:for(f=a;Ci!==null;){m=Ci;var A=m.sibling,E=m.return;if(Id(m),m===f){Ci=null;break e}if(A!==null){A.return=E,Ci=A;break e}Ci=E}}}var Gd={getCacheForType:function(a){var r=la(jt),f=r.data.get(a);return f===void 0&&(f=a(),r.data.set(a,f)),f},cacheSignal:function(){return la(jt).controller.signal}},zd=typeof WeakMap=="function"?WeakMap:Map,On=0,jn=null,_n=null,Rn=0,Zt=0,En=null,fn=!1,Sn=!1,ii=!1,Fi=0,Zn=0,Us=0,xo=0,hr=0,In=0,Ns=0,dr=null,Ha=null,cs=!1,Ao=0,ru=0,Ls=1/0,ou=null,Gr=null,_i=0,pr=null,Os=null,Ks=0,So=0,ec=null,Vd=null,tc=0,nc=null;function qa(){return(On&2)!==0&&Rn!==0?Rn&-Rn:H.T!==null?ZS():gi()}function c(){if(In===0)if((Rn&536870912)===0||Un){var a=ot;ot<<=1,(ot&3932160)===0&&(ot=262144),In=a}else In=536870912;return a=Qi.current,a!==null&&(a.flags|=32),In}function u(a,r,f){(a===jn&&(Zt===2||Zt===9)||a.cancelPendingCommit!==null)&&(be(a,0),B(a,Rn,In,!1)),Di(a,f),((On&2)===0||a!==jn)&&(a===jn&&((On&2)===0&&(xo|=f),Zn===4&&B(a,Rn,In,!1)),ul(a))}function g(a,r,f){if((On&6)!==0)throw Error(n(327));var m=!f&&(r&127)===0&&(r&a.expiredLanes)===0||mt(a,r),A=m?ic(a,r):us(a,r,!0),E=m;do{if(A===0){Sn&&!m&&B(a,r,0,!1);break}else{if(f=a.current.alternate,E&&!C(f)){A=us(a,r,!1),E=!1;continue}if(A===2){if(E=r,a.errorRecoveryDisabledLanes&E)var L=0;else L=a.pendingLanes&-536870913,L=L!==0?L:L&536870912?536870912:0;if(L!==0){r=L;e:{var Y=a;A=dr;var ce=Y.current.memoizedState.isDehydrated;if(ce&&(be(Y,L).flags|=256),L=us(Y,L,!1),L!==2){if(ii&&!ce){Y.errorRecoveryDisabledLanes|=E,xo|=E,A=4;break e}E=Ha,Ha=A,E!==null&&(Ha===null?Ha=E:Ha.push.apply(Ha,E))}A=L}if(E=!1,A!==2)continue}}if(A===1){be(a,0),B(a,r,0,!0);break}e:{switch(m=a,E=A,E){case 0:case 1:throw Error(n(345));case 4:if((r&4194048)!==r)break;case 6:B(m,r,In,!fn);break e;case 2:Ha=null;break;case 3:case 5:break;default:throw Error(n(329))}if((r&62914560)===r&&(A=Ao+300-P(),10<A)){if(B(m,r,In,!fn),qe(m,0,!0)!==0)break e;Ks=r,m.timeoutHandle=NC(S.bind(null,m,f,Ha,ou,cs,r,In,xo,Ns,fn,E,"Throttled",-0,0),A);break e}S(m,f,Ha,ou,cs,r,In,xo,Ns,fn,E,null,-0,0)}}break}while(!0);ul(a)}function S(a,r,f,m,A,E,L,Y,ce,Ce,ke,$e,Ne,He){if(a.timeoutHandle=-1,$e=r.subtreeFlags,$e&8192||($e&16785408)===16785408){$e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:br},Ii(r,E,$e);var Gt=(E&62914560)===E?Ao-P():(E&4194048)===E?ru-P():0;if(Gt=C4($e,Gt),Gt!==null){Ks=E,a.cancelPendingCommit=Gt(sn.bind(null,a,r,E,f,m,A,L,Y,ce,ke,$e,null,Ne,He)),B(a,E,L,!Ce);return}}sn(a,r,E,f,m,A,L,Y,ce)}function C(a){for(var r=a;;){var f=r.tag;if((f===0||f===11||f===15)&&r.flags&16384&&(f=r.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var m=0;m<f.length;m++){var A=f[m],E=A.getSnapshot;A=A.value;try{if(!fi(E(),A))return!1}catch{return!1}}if(f=r.child,r.subtreeFlags&16384&&f!==null)f.return=r,r=f;else{if(r===a)break;for(;r.sibling===null;){if(r.return===null||r.return===a)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function B(a,r,f,m){r&=~hr,r&=~xo,a.suspendedLanes|=r,a.pingedLanes&=~r,m&&(a.warmLanes|=r),m=a.expirationTimes;for(var A=r;0<A;){var E=31-yt(A),L=1<<E;m[E]=-1,A&=~L}f!==0&&eo(a,f,r)}function J(){return(On&6)===0?(vg(0),!1):!0}function le(){if(_n!==null){if(Zt===0)var a=_n.return;else a=_n,Na=oo=null,qm(a),Qo=null,$o=0,a=_n;for(;a!==null;)jl(a.alternate,a),a=a.return;_n=null}}function be(a,r){var f=a.timeoutHandle;f!==-1&&(a.timeoutHandle=-1,c4(f)),f=a.cancelPendingCommit,f!==null&&(a.cancelPendingCommit=null,f()),Ks=0,le(),jn=a,_n=f=Cr(a.current,null),Rn=r,Zt=0,En=null,fn=!1,Sn=mt(a,r),ii=!1,Ns=In=hr=xo=Us=Zn=0,Ha=dr=null,cs=!1,(r&8)!==0&&(r|=r&32);var m=a.entangledLanes;if(m!==0)for(a=a.entanglements,m&=r;0<m;){var A=31-yt(m),E=1<<A;r|=a[A],m&=~E}return Fi=r,Yo(),f}function Ye(a,r){an=null,H.H=Nf,r===Zo||r===lr?(r=gd(),Zt=3):r===Mf?(r=gd(),Zt=4):Zt=r===Nd?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,En=r,_n===null&&(Zn=1,Ud(a,ts(r,a.current)))}function vt(){var a=Qi.current;return a===null?!0:(Rn&4194048)===Rn?Vs===null:(Rn&62914560)===Rn||(Rn&536870912)!==0?a===Vs:!1}function wt(){var a=H.H;return H.H=Nf,a===null?Nf:a}function Ut(){var a=H.A;return H.A=Gd,a}function cn(){Zn=4,fn||(Rn&4194048)!==Rn&&Qi.current!==null||(Sn=!0),(Us&134217727)===0&&(xo&134217727)===0||jn===null||B(jn,Rn,In,!1)}function us(a,r,f){var m=On;On|=2;var A=wt(),E=Ut();(jn!==a||Rn!==r)&&(ou=null,be(a,r)),r=!1;var L=Zn;e:do try{if(Zt!==0&&_n!==null){var Y=_n,ce=En;switch(Zt){case 8:le(),L=6;break e;case 3:case 2:case 9:case 6:Qi.current===null&&(r=!0);var Ce=Zt;if(Zt=0,En=null,ut(a,Y,ce,Ce),f&&Sn){L=0;break e}break;default:Ce=Zt,Zt=0,En=null,ut(a,Y,ce,Ce)}}Jf(),L=Zn;break}catch(ke){Ye(a,ke)}while(!0);return r&&a.shellSuspendCounter++,Na=oo=null,On=m,H.H=A,H.A=E,_n===null&&(jn=null,Rn=0,Yo()),L}function Jf(){for(;_n!==null;)Se(_n)}function ic(a,r){var f=On;On|=2;var m=wt(),A=Ut();jn!==a||Rn!==r?(ou=null,Ls=P()+500,be(a,r)):Sn=mt(a,r);e:do try{if(Zt!==0&&_n!==null){r=_n;var E=En;t:switch(Zt){case 1:Zt=0,En=null,ut(a,r,E,1);break;case 2:case 9:if(z_(E)){Zt=0,En=null,Oe(r);break}r=function(){Zt!==2&&Zt!==9||jn!==a||(Zt=7),ul(a)},E.then(r,r);break e;case 3:Zt=7;break e;case 4:Zt=5;break e;case 7:z_(E)?(Zt=0,En=null,Oe(r)):(Zt=0,En=null,ut(a,r,E,7));break;case 5:var L=null;switch(_n.tag){case 26:L=_n.memoizedState;case 5:case 27:var Y=_n;if(L?KC(L):Y.stateNode.complete){Zt=0,En=null;var ce=Y.sibling;if(ce!==null)_n=ce;else{var Ce=Y.return;Ce!==null?(_n=Ce,Jt(Ce)):_n=null}break t}}Zt=0,En=null,ut(a,r,E,5);break;case 6:Zt=0,En=null,ut(a,r,E,6);break;case 8:le(),Zn=6;break e;default:throw Error(n(462))}}we();break}catch(ke){Ye(a,ke)}while(!0);return Na=oo=null,H.H=m,H.A=A,On=f,_n!==null?0:(jn=null,Rn=0,Yo(),Zn)}function we(){for(;_n!==null&&!gt();)Se(_n)}function Se(a){var r=Ld(a.alternate,a,Fi);a.memoizedProps=a.pendingProps,r===null?Jt(a):_n=r}function Oe(a){var r=a,f=r.alternate;switch(r.tag){case 15:case 0:r=Oa(f,r,r.pendingProps,r.type,void 0,Rn);break;case 11:r=Oa(f,r,r.pendingProps,r.type.render,r.ref,Rn);break;case 5:qm(r);default:jl(f,r),r=_n=Ua(r,Fi),r=Ld(f,r,Fi)}a.memoizedProps=a.pendingProps,r===null?Jt(a):_n=r}function ut(a,r,f,m){Na=oo=null,qm(r),Qo=null,$o=0;var A=r.return;try{if(Es(a,A,r,f,Rn)){Zn=1,Ud(a,ts(f,a.current)),_n=null;return}}catch(E){if(A!==null)throw _n=A,E;Zn=1,Ud(a,ts(f,a.current)),_n=null;return}r.flags&32768?(Un||m===1?a=!0:Sn||(Rn&536870912)!==0?a=!1:(fn=a=!0,(m===2||m===9||m===3||m===6)&&(m=Qi.current,m!==null&&m.tag===13&&(m.flags|=16384))),ri(r,a)):Jt(r)}function Jt(a){var r=a;do{if((r.flags&32768)!==0){ri(r,fn);return}a=r.return;var f=pg(r.alternate,r,Fi);if(f!==null){_n=f;return}if(r=r.sibling,r!==null){_n=r;return}_n=r=a}while(r!==null);Zn===0&&(Zn=5)}function ri(a,r){do{var f=Od(a.alternate,a);if(f!==null){f.flags&=32767,_n=f;return}if(f=a.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!r&&(a=a.sibling,a!==null)){_n=a;return}_n=a=f}while(a!==null);Zn=6,_n=null}function sn(a,r,f,m,A,E,L,Y,ce){a.cancelPendingCommit=null;do kd();while(_i!==0);if((On&6)!==0)throw Error(n(327));if(r!==null){if(r===a.current)throw Error(n(177));if(E=r.lanes|r.childLanes,E|=ld,Ra(a,f,E,L,Y,ce),a===jn&&(_n=jn=null,Rn=0),Os=r,pr=a,Ks=f,So=E,ec=A,Vd=m,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,jF(Fe,function(){return gC(),null})):(a.callbackNode=null,a.callbackPriority=0),m=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||m){m=H.T,H.T=null,A=K.p,K.p=2,L=On,On|=4;try{au(a,r,f)}finally{On=L,K.p=A,H.T=m}}_i=1,zn(),ea(),Vn()}}function zn(){if(_i===1){_i=0;var a=pr,r=Os,f=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||f){f=H.T,H.T=null;var m=K.p;K.p=2;var A=On;On|=4;try{ll(r,a);var E=sM,L=id(a.containerInfo),Y=E.focusedElem,ce=E.selectionRange;if(L!==Y&&Y&&Y.ownerDocument&&nd(Y.ownerDocument.documentElement,Y)){if(ce!==null&&Fc(Y)){var Ce=ce.start,ke=ce.end;if(ke===void 0&&(ke=Ce),"selectionStart"in Y)Y.selectionStart=Ce,Y.selectionEnd=Math.min(ke,Y.value.length);else{var $e=Y.ownerDocument||document,Ne=$e&&$e.defaultView||window;if(Ne.getSelection){var He=Ne.getSelection(),Gt=Y.textContent.length,nn=Math.min(ce.start,Gt),li=ce.end===void 0?nn:Math.min(ce.end,Gt);!He.extend&&nn>li&&(L=li,li=nn,nn=L);var Me=Sm(Y,nn),ge=Sm(Y,li);if(Me&&ge&&(He.rangeCount!==1||He.anchorNode!==Me.node||He.anchorOffset!==Me.offset||He.focusNode!==ge.node||He.focusOffset!==ge.offset)){var Te=$e.createRange();Te.setStart(Me.node,Me.offset),He.removeAllRanges(),nn>li?(He.addRange(Te),He.extend(ge.node,ge.offset)):(Te.setEnd(ge.node,ge.offset),He.addRange(Te))}}}}for($e=[],He=Y;He=He.parentNode;)He.nodeType===1&&$e.push({element:He,left:He.scrollLeft,top:He.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Y<$e.length;Y++){var Ze=$e[Y];Ze.element.scrollLeft=Ze.left,Ze.element.scrollTop=Ze.top}}Ry=!!aM,sM=aM=null}finally{On=A,K.p=m,H.T=f}}a.current=r,_i=2}}function ea(){if(_i===2){_i=0;var a=pr,r=Os,f=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||f){f=H.T,H.T=null;var m=K.p;K.p=2;var A=On;On|=4;try{py(a,r.alternate,r)}finally{On=A,K.p=m,H.T=f}}_i=3}}function Vn(){if(_i===4||_i===3){_i=0,Z();var a=pr,r=Os,f=Ks,m=Vd;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?_i=5:(_i=0,Os=pr=null,Mo(a,a.pendingLanes));var A=a.pendingLanes;if(A===0&&(Gr=null),Ga(f),r=r.stateNode,Qe&&typeof Qe.onCommitFiberRoot=="function")try{Qe.onCommitFiberRoot(Ke,r,void 0,(r.current.flags&128)===128)}catch{}if(m!==null){r=H.T,A=K.p,K.p=2,H.T=null;try{for(var E=a.onRecoverableError,L=0;L<m.length;L++){var Y=m[L];E(Y.value,{componentStack:Y.stack})}}finally{H.T=r,K.p=A}}(Ks&3)!==0&&kd(),ul(a),A=a.pendingLanes,(f&261930)!==0&&(A&42)!==0?a===nc?tc++:(tc=0,nc=a):tc=0,vg(0)}}function Mo(a,r){(a.pooledCacheLanes&=r)===0&&(r=a.pooledCache,r!=null&&(a.pooledCache=null,_a(r)))}function kd(){return zn(),ea(),Vn(),gC()}function gC(){if(_i!==5)return!1;var a=pr,r=So;So=0;var f=Ga(Ks),m=H.T,A=K.p;try{K.p=32>f?32:f,H.T=null,f=ec,ec=null;var E=pr,L=Ks;if(_i=0,Os=pr=null,Ks=0,(On&6)!==0)throw Error(n(331));var Y=On;if(On|=4,$l(E.current),vi(E,E.current,L,f),On=Y,vg(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot=="function")try{Qe.onPostCommitFiberRoot(Ke,E)}catch{}return!0}finally{K.p=A,H.T=m,Mo(a,r)}}function vC(a,r,f){r=ts(f,r),r=dg(a.stateNode,r,2),a=fo(a,r,2),a!==null&&(Di(a,2),ul(a))}function ai(a,r,f){if(a.tag===3)vC(a,a,f);else for(;r!==null;){if(r.tag===3){vC(r,a,f);break}else if(r.tag===1){var m=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Gr===null||!Gr.has(m))){a=ts(f,a),f=$c(2),m=fo(r,f,2),m!==null&&(ss(f,m,r,a),Di(m,2),ul(m));break}}r=r.return}}function KS(a,r,f){var m=a.pingCache;if(m===null){m=a.pingCache=new zd;var A=new Set;m.set(r,A)}else A=m.get(r),A===void 0&&(A=new Set,m.set(r,A));A.has(f)||(ii=!0,A.add(f),a=qF.bind(null,a,r,f),r.then(a,a))}function qF(a,r,f){var m=a.pingCache;m!==null&&m.delete(r),a.pingedLanes|=a.suspendedLanes&f,a.warmLanes&=~f,jn===a&&(Rn&f)===f&&(Zn===4||Zn===3&&(Rn&62914560)===Rn&&300>P()-Ao?(On&2)===0&&be(a,0):hr|=f,Ns===Rn&&(Ns=0)),ul(a)}function _C(a,r){r===0&&(r=hn()),a=Jo(a,r),a!==null&&(Di(a,r),ul(a))}function KF(a){var r=a.memoizedState,f=0;r!==null&&(f=r.retryLane),_C(a,f)}function WF(a,r){var f=0;switch(a.tag){case 31:case 13:var m=a.stateNode,A=a.memoizedState;A!==null&&(f=A.retryLane);break;case 19:m=a.stateNode;break;case 22:m=a.stateNode._retryCache;break;default:throw Error(n(314))}m!==null&&m.delete(r),_C(a,f)}function jF(a,r){return pt(a,r)}var vy=null,Xd=null,WS=!1,_y=!1,jS=!1,lu=0;function ul(a){a!==Xd&&a.next===null&&(Xd===null?vy=Xd=a:Xd=Xd.next=a),_y=!0,WS||(WS=!0,QF())}function vg(a,r){if(!jS&&_y){jS=!0;do for(var f=!1,m=vy;m!==null;){if(a!==0){var A=m.pendingLanes;if(A===0)var E=0;else{var L=m.suspendedLanes,Y=m.pingedLanes;E=(1<<31-yt(42|a)+1)-1,E&=A&~(L&~Y),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(f=!0,SC(m,E))}else E=Rn,E=qe(m,m===jn?E:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(E&3)===0||mt(m,E)||(f=!0,SC(m,E));m=m.next}while(f);jS=!1}}function ZF(){yC()}function yC(){_y=WS=!1;var a=0;lu!==0&&l4()&&(a=lu);for(var r=P(),f=null,m=vy;m!==null;){var A=m.next,E=xC(m,r);E===0?(m.next=null,f===null?vy=A:f.next=A,A===null&&(Xd=f)):(f=m,(a!==0||(E&3)!==0)&&(_y=!0)),m=A}_i!==0&&_i!==5||vg(a),lu!==0&&(lu=0)}function xC(a,r){for(var f=a.suspendedLanes,m=a.pingedLanes,A=a.expirationTimes,E=a.pendingLanes&-62914561;0<E;){var L=31-yt(E),Y=1<<L,ce=A[L];ce===-1?((Y&f)===0||(Y&m)!==0)&&(A[L]=zt(Y,r)):ce<=r&&(a.expiredLanes|=Y),E&=~Y}if(r=jn,f=Rn,f=qe(a,a===r?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),m=a.callbackNode,f===0||a===r&&(Zt===2||Zt===9)||a.cancelPendingCommit!==null)return m!==null&&m!==null&&Lt(m),a.callbackNode=null,a.callbackPriority=0;if((f&3)===0||mt(a,f)){if(r=f&-f,r===a.callbackPriority)return r;switch(m!==null&&Lt(m),Ga(f)){case 2:case 8:f=Xe;break;case 32:f=Fe;break;case 268435456:f=_t;break;default:f=Fe}return m=AC.bind(null,a),f=pt(f,m),a.callbackPriority=r,a.callbackNode=f,r}return m!==null&&m!==null&&Lt(m),a.callbackPriority=2,a.callbackNode=null,2}function AC(a,r){if(_i!==0&&_i!==5)return a.callbackNode=null,a.callbackPriority=0,null;var f=a.callbackNode;if(kd()&&a.callbackNode!==f)return null;var m=Rn;return m=qe(a,a===jn?m:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),m===0?null:(g(a,m,r),xC(a,P()),a.callbackNode!=null&&a.callbackNode===f?AC.bind(null,a):null)}function SC(a,r){if(kd())return null;g(a,r,!0)}function QF(){u4(function(){(On&6)!==0?pt(Le,ZF):yC()})}function ZS(){if(lu===0){var a=uo;a===0&&(a=De,De<<=1,(De&261888)===0&&(De=256)),lu=a}return lu}function MC(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:af(""+a)}function bC(a,r){var f=r.ownerDocument.createElement("input");return f.name=r.name,f.value=r.value,a.id&&f.setAttribute("form",a.id),r.parentNode.insertBefore(f,r),a=new FormData(a),f.parentNode.removeChild(f),a}function $F(a,r,f,m,A){if(r==="submit"&&f&&f.stateNode===A){var E=MC((A[G]||null).action),L=m.submitter;L&&(r=(r=L[G]||null)?MC(r.formAction):L.getAttribute("formAction"),r!==null&&(E=r,L=null));var Y=new lf("action","action",null,m,A);a.push({event:Y,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(lu!==0){var ce=L?bC(A,L):new FormData(A);lg(f,{pending:!0,data:ce,method:A.method,action:E},null,ce)}}else typeof E=="function"&&(Y.preventDefault(),ce=L?bC(A,L):new FormData(A),lg(f,{pending:!0,data:ce,method:A.method,action:E},E,ce))},currentTarget:A}]})}}for(var QS=0;QS<od.length;QS++){var $S=od[QS],e4=$S.toLowerCase(),t4=$S[0].toUpperCase()+$S.slice(1);Da(e4,"on"+t4)}Da(es,"onAnimationEnd"),Da(Mm,"onAnimationIteration"),Da(Tr,"onAnimationStart"),Da("dblclick","onDoubleClick"),Da("focusin","onFocus"),Da("focusout","onBlur"),Da(zc,"onTransitionRun"),Da(ko,"onTransitionStart"),Da(bm,"onTransitionCancel"),Da(rd,"onTransitionEnd"),oe("onMouseEnter",["mouseout","mouseover"]),oe("onMouseLeave",["mouseout","mouseover"]),oe("onPointerEnter",["pointerout","pointerover"]),oe("onPointerLeave",["pointerout","pointerover"]),he("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),he("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),he("onBeforeInput",["compositionend","keypress","textInput","paste"]),he("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),he("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),he("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _g="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),n4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_g));function EC(a,r){r=(r&4)!==0;for(var f=0;f<a.length;f++){var m=a[f],A=m.event;m=m.listeners;e:{var E=void 0;if(r)for(var L=m.length-1;0<=L;L--){var Y=m[L],ce=Y.instance,Ce=Y.currentTarget;if(Y=Y.listener,ce!==E&&A.isPropagationStopped())break e;E=Y,A.currentTarget=Ce;try{E(A)}catch(ke){Xo(ke)}A.currentTarget=null,E=ce}else for(L=0;L<m.length;L++){if(Y=m[L],ce=Y.instance,Ce=Y.currentTarget,Y=Y.listener,ce!==E&&A.isPropagationStopped())break e;E=Y,A.currentTarget=Ce;try{E(A)}catch(ke){Xo(ke)}A.currentTarget=null,E=ce}}}}function Nn(a,r){var f=r[j];f===void 0&&(f=r[j]=new Set);var m=a+"__bubble";f.has(m)||(TC(r,a,2,!1),f.add(m))}function eM(a,r,f){var m=0;r&&(m|=4),TC(f,a,m,r)}var yy="_reactListening"+Math.random().toString(36).slice(2);function tM(a){if(!a[yy]){a[yy]=!0,te.forEach(function(f){f!=="selectionchange"&&(n4.has(f)||eM(f,!1,a),eM(f,!0,a))});var r=a.nodeType===9?a:a.ownerDocument;r===null||r[yy]||(r[yy]=!0,eM("selectionchange",!1,r))}}function TC(a,r,f,m){switch(tR(r)){case 2:var A=B4;break;case 8:A=D4;break;default:A=gM}f=A.bind(null,r,f,a),A=void 0,!Jh||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(A=!0),m?A!==void 0?a.addEventListener(r,f,{capture:!0,passive:A}):a.addEventListener(r,f,!0):A!==void 0?a.addEventListener(r,f,{passive:A}):a.addEventListener(r,f,!1)}function nM(a,r,f,m,A){var E=m;if((r&1)===0&&(r&2)===0&&m!==null)e:for(;;){if(m===null)return;var L=m.tag;if(L===3||L===4){var Y=m.stateNode.containerInfo;if(Y===A)break;if(L===4)for(L=m.return;L!==null;){var ce=L.tag;if((ce===3||ce===4)&&L.stateNode.containerInfo===A)return;L=L.return}for(;Y!==null;){if(L=ze(Y),L===null)return;if(ce=L.tag,ce===5||ce===6||ce===26||ce===27){m=E=L;continue e}Y=Y.parentNode}}m=m.return}sm(function(){var Ce=E,ke=Xh(f),$e=[];e:{var Ne=io.get(a);if(Ne!==void 0){var He=lf,Gt=a;switch(a){case"keypress":if(Nl(f)===0)break e;case"keydown":case"keyup":He=hm;break;case"focusin":Gt="focus",He=Zh;break;case"focusout":Gt="blur",He=Zh;break;case"beforeblur":case"afterblur":He=Zh;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":He=__;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":He=y_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":He=to;break;case es:case Mm:case Tr:He=S_;break;case rd:He=GS;break;case"scroll":case"scrollend":He=Wh;break;case"wheel":He=Fo;break;case"copy":case"cut":case"paste":He=om;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":He=Qh;break;case"toggle":case"beforetoggle":He=pm}var nn=(r&4)!==0,li=!nn&&(a==="scroll"||a==="scrollend"),Me=nn?Ne!==null?Ne+"Capture":null:Ne;nn=[];for(var ge=Ce,Te;ge!==null;){var Ze=ge;if(Te=Ze.stateNode,Ze=Ze.tag,Ze!==5&&Ze!==26&&Ze!==27||Te===null||Me===null||(Ze=Ul(ge,Me),Ze!=null&&nn.push(yg(ge,Ze,Te))),li)break;ge=ge.return}0<nn.length&&(Ne=new He(Ne,Gt,null,f,ke),$e.push({event:Ne,listeners:nn}))}}if((r&7)===0){e:{if(Ne=a==="mouseover"||a==="pointerover",He=a==="mouseout"||a==="pointerout",Ne&&f!==sf&&(Gt=f.relatedTarget||f.fromElement)&&(ze(Gt)||Gt[q]))break e;if((He||Ne)&&(Ne=ke.window===ke?ke:(Ne=ke.ownerDocument)?Ne.defaultView||Ne.parentWindow:window,He?(Gt=f.relatedTarget||f.toElement,He=Ce,Gt=Gt?ze(Gt):null,Gt!==null&&(li=o(Gt),nn=Gt.tag,Gt!==li||nn!==5&&nn!==27&&nn!==6)&&(Gt=null)):(He=null,Gt=Ce),He!==Gt)){if(nn=__,Ze="onMouseLeave",Me="onMouseEnter",ge="mouse",(a==="pointerout"||a==="pointerover")&&(nn=Qh,Ze="onPointerLeave",Me="onPointerEnter",ge="pointer"),li=He==null?Ne:at(He),Te=Gt==null?Ne:at(Gt),Ne=new nn(Ze,ge+"leave",He,f,ke),Ne.target=li,Ne.relatedTarget=Te,Ze=null,ze(ke)===Ce&&(nn=new nn(Me,ge+"enter",Gt,f,ke),nn.target=Te,nn.relatedTarget=li,Ze=nn),li=Ze,He&&Gt)t:{for(nn=i4,Me=He,ge=Gt,Te=0,Ze=Me;Ze;Ze=nn(Ze))Te++;Ze=0;for(var en=ge;en;en=nn(en))Ze++;for(;0<Te-Ze;)Me=nn(Me),Te--;for(;0<Ze-Te;)ge=nn(ge),Ze--;for(;Te--;){if(Me===ge||ge!==null&&Me===ge.alternate){nn=Me;break t}Me=nn(Me),ge=nn(ge)}nn=null}else nn=null;He!==null&&CC($e,Ne,He,nn,!1),Gt!==null&&li!==null&&CC($e,li,Gt,nn,!0)}}e:{if(Ne=Ce?at(Ce):window,He=Ne.nodeName&&Ne.nodeName.toLowerCase(),He==="select"||He==="input"&&Ne.type==="file")var Qn=ym;else if(vm(Ne))if(pf)Qn=N_;else{Qn=Go;var Yt=mf}else He=Ne.nodeName,!He||He.toLowerCase()!=="input"||Ne.type!=="checkbox"&&Ne.type!=="radio"?Ce&&_s(Ce.elementType)&&(Qn=ym):Qn=U_;if(Qn&&(Qn=Qn(a,Ce))){td($e,Qn,f,ke);break e}Yt&&Yt(a,Ne,Ce),a==="focusout"&&Ce&&Ne.type==="number"&&Ce.memoizedProps.value!=null&&kn(Ne,"number",Ne.value)}switch(Yt=Ce?at(Ce):window,a){case"focusin":(vm(Yt)||Yt.contentEditable==="true")&&(Hc=Yt,ad=Ce,Pc=null);break;case"focusout":Pc=ad=Hc=null;break;case"mousedown":xs=!0;break;case"contextmenu":case"mouseup":case"dragend":xs=!1,sd($e,f,ke);break;case"selectionchange":if(L_)break;case"keydown":case"keyup":sd($e,f,ke)}var Mn;if(Ll)e:{switch(a){case"compositionstart":var Fn="onCompositionStart";break e;case"compositionend":Fn="onCompositionEnd";break e;case"compositionupdate":Fn="onCompositionUpdate";break e}Fn=void 0}else Po?$h(a,f)&&(Fn="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(Fn="onCompositionStart");Fn&&(va&&f.locale!=="ko"&&(Po||Fn!=="onCompositionStart"?Fn==="onCompositionEnd"&&Po&&(Mn=Kh()):(Lo=ke,qh="value"in Lo?Lo.value:Lo.textContent,Po=!0)),Yt=xy(Ce,Fn),0<Yt.length&&(Fn=new lm(Fn,a,null,f,ke),$e.push({event:Fn,listeners:Yt}),Mn?Fn.data=Mn:(Mn=Uc(f),Mn!==null&&(Fn.data=Mn)))),(Mn=Ol?ed(a,f):w_(a,f))&&(Fn=xy(Ce,"onBeforeInput"),0<Fn.length&&(Yt=new lm("onBeforeInput","beforeinput",null,f,ke),$e.push({event:Yt,listeners:Fn}),Yt.data=Mn)),$F($e,a,Ce,f,ke)}EC($e,r)})}function yg(a,r,f){return{instance:a,listener:r,currentTarget:f}}function xy(a,r){for(var f=r+"Capture",m=[];a!==null;){var A=a,E=A.stateNode;if(A=A.tag,A!==5&&A!==26&&A!==27||E===null||(A=Ul(a,f),A!=null&&m.unshift(yg(a,A,E)),A=Ul(a,r),A!=null&&m.push(yg(a,A,E))),a.tag===3)return m;a=a.return}return[]}function i4(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function CC(a,r,f,m,A){for(var E=r._reactName,L=[];f!==null&&f!==m;){var Y=f,ce=Y.alternate,Ce=Y.stateNode;if(Y=Y.tag,ce!==null&&ce===m)break;Y!==5&&Y!==26&&Y!==27||Ce===null||(ce=Ce,A?(Ce=Ul(f,E),Ce!=null&&L.unshift(yg(f,Ce,ce))):A||(Ce=Ul(f,E),Ce!=null&&L.push(yg(f,Ce,ce)))),f=f.return}L.length!==0&&a.push({event:r,listeners:L})}var a4=/\r\n?/g,s4=/\u0000|\uFFFD/g;function RC(a){return(typeof a=="string"?a:""+a).replace(a4,`
|
|
9
|
-
`).replace(s4,"")}function wC(a,r){return r=RC(r),RC(a)===r}function oi(a,r,f,m,A,E){switch(f){case"children":typeof m=="string"?r==="body"||r==="textarea"&&m===""||Xi(a,m):(typeof m=="number"||typeof m=="bigint")&&r!=="body"&&Xi(a,""+m);break;case"className":It(a,"class",m);break;case"tabIndex":It(a,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":It(a,f,m);break;case"style":Bl(a,m,E);break;case"data":if(r!=="object"){It(a,"data",m);break}case"src":case"href":if(m===""&&(r!=="a"||f!=="href")){a.removeAttribute(f);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){a.removeAttribute(f);break}m=af(""+m),a.setAttribute(f,m);break;case"action":case"formAction":if(typeof m=="function"){a.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof E=="function"&&(f==="formAction"?(r!=="input"&&oi(a,r,"name",A.name,A,null),oi(a,r,"formEncType",A.formEncType,A,null),oi(a,r,"formMethod",A.formMethod,A,null),oi(a,r,"formTarget",A.formTarget,A,null)):(oi(a,r,"encType",A.encType,A,null),oi(a,r,"method",A.method,A,null),oi(a,r,"target",A.target,A,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){a.removeAttribute(f);break}m=af(""+m),a.setAttribute(f,m);break;case"onClick":m!=null&&(a.onclick=br);break;case"onScroll":m!=null&&Nn("scroll",a);break;case"onScrollEnd":m!=null&&Nn("scrollend",a);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(f=m.__html,f!=null){if(A.children!=null)throw Error(n(60));a.innerHTML=f}}break;case"multiple":a.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":a.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){a.removeAttribute("xlink:href");break}f=af(""+m),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,""+m):a.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":m===!0?a.setAttribute(f,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,m):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?a.setAttribute(f,m):a.removeAttribute(f);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?a.removeAttribute(f):a.setAttribute(f,m);break;case"popover":Nn("beforetoggle",a),Nn("toggle",a),ct(a,"popover",m);break;case"xlinkActuate":dt(a,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":dt(a,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":dt(a,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":dt(a,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":dt(a,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":dt(a,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":dt(a,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":dt(a,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":dt(a,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":ct(a,"is",m);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=g_.get(f)||f,ct(a,f,m))}}function iM(a,r,f,m,A,E){switch(f){case"style":Bl(a,m,E);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(f=m.__html,f!=null){if(A.children!=null)throw Error(n(60));a.innerHTML=f}}break;case"children":typeof m=="string"?Xi(a,m):(typeof m=="number"||typeof m=="bigint")&&Xi(a,""+m);break;case"onScroll":m!=null&&Nn("scroll",a);break;case"onScrollEnd":m!=null&&Nn("scrollend",a);break;case"onClick":m!=null&&(a.onclick=br);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fe.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(A=f.endsWith("Capture"),r=f.slice(2,A?f.length-7:void 0),E=a[G]||null,E=E!=null?E[f]:null,typeof E=="function"&&a.removeEventListener(r,E,A),typeof m=="function")){typeof E!="function"&&E!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(r,m,A);break e}f in a?a[f]=m:m===!0?a.setAttribute(f,""):ct(a,f,m)}}}function Ka(a,r,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Nn("error",a),Nn("load",a);var m=!1,A=!1,E;for(E in f)if(f.hasOwnProperty(E)){var L=f[E];if(L!=null)switch(E){case"src":m=!0;break;case"srcSet":A=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:oi(a,r,E,L,f,null)}}A&&oi(a,r,"srcSet",f.srcSet,f,null),m&&oi(a,r,"src",f.src,f,null);return;case"input":Nn("invalid",a);var Y=E=L=A=null,ce=null,Ce=null;for(m in f)if(f.hasOwnProperty(m)){var ke=f[m];if(ke!=null)switch(m){case"name":A=ke;break;case"type":L=ke;break;case"checked":ce=ke;break;case"defaultChecked":Ce=ke;break;case"value":E=ke;break;case"defaultValue":Y=ke;break;case"children":case"dangerouslySetInnerHTML":if(ke!=null)throw Error(n(137,r));break;default:oi(a,r,m,ke,f,null)}}aa(a,E,Y,ce,Ce,L,A,!1);return;case"select":Nn("invalid",a),m=L=E=null;for(A in f)if(f.hasOwnProperty(A)&&(Y=f[A],Y!=null))switch(A){case"value":E=Y;break;case"defaultValue":L=Y;break;case"multiple":m=Y;default:oi(a,r,A,Y,f,null)}r=E,f=L,a.multiple=!!m,r!=null?Ui(a,!!m,r,!1):f!=null&&Ui(a,!!m,f,!0);return;case"textarea":Nn("invalid",a),E=A=m=null;for(L in f)if(f.hasOwnProperty(L)&&(Y=f[L],Y!=null))switch(L){case"value":m=Y;break;case"defaultValue":A=Y;break;case"children":E=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(n(91));break;default:oi(a,r,L,Y,f,null)}Mi(a,m,A,E);return;case"option":for(ce in f)f.hasOwnProperty(ce)&&(m=f[ce],m!=null)&&(ce==="selected"?a.selected=m&&typeof m!="function"&&typeof m!="symbol":oi(a,r,ce,m,f,null));return;case"dialog":Nn("beforetoggle",a),Nn("toggle",a),Nn("cancel",a),Nn("close",a);break;case"iframe":case"object":Nn("load",a);break;case"video":case"audio":for(m=0;m<_g.length;m++)Nn(_g[m],a);break;case"image":Nn("error",a),Nn("load",a);break;case"details":Nn("toggle",a);break;case"embed":case"source":case"link":Nn("error",a),Nn("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Ce in f)if(f.hasOwnProperty(Ce)&&(m=f[Ce],m!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:oi(a,r,Ce,m,f,null)}return;default:if(_s(r)){for(ke in f)f.hasOwnProperty(ke)&&(m=f[ke],m!==void 0&&iM(a,r,ke,m,f,void 0));return}}for(Y in f)f.hasOwnProperty(Y)&&(m=f[Y],m!=null&&oi(a,r,Y,m,f,null))}function r4(a,r,f,m){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var A=null,E=null,L=null,Y=null,ce=null,Ce=null,ke=null;for(He in f){var $e=f[He];if(f.hasOwnProperty(He)&&$e!=null)switch(He){case"checked":break;case"value":break;case"defaultValue":ce=$e;default:m.hasOwnProperty(He)||oi(a,r,He,null,m,$e)}}for(var Ne in m){var He=m[Ne];if($e=f[Ne],m.hasOwnProperty(Ne)&&(He!=null||$e!=null))switch(Ne){case"type":E=He;break;case"name":A=He;break;case"checked":Ce=He;break;case"defaultChecked":ke=He;break;case"value":L=He;break;case"defaultValue":Y=He;break;case"children":case"dangerouslySetInnerHTML":if(He!=null)throw Error(n(137,r));break;default:He!==$e&&oi(a,r,Ne,He,m,$e)}}Yn(a,L,Y,ce,Ce,ke,E,A);return;case"select":He=L=Y=Ne=null;for(E in f)if(ce=f[E],f.hasOwnProperty(E)&&ce!=null)switch(E){case"value":break;case"multiple":He=ce;default:m.hasOwnProperty(E)||oi(a,r,E,null,m,ce)}for(A in m)if(E=m[A],ce=f[A],m.hasOwnProperty(A)&&(E!=null||ce!=null))switch(A){case"value":Ne=E;break;case"defaultValue":Y=E;break;case"multiple":L=E;default:E!==ce&&oi(a,r,A,E,m,ce)}r=Y,f=L,m=He,Ne!=null?Ui(a,!!f,Ne,!1):!!m!=!!f&&(r!=null?Ui(a,!!f,r,!0):Ui(a,!!f,f?[]:"",!1));return;case"textarea":He=Ne=null;for(Y in f)if(A=f[Y],f.hasOwnProperty(Y)&&A!=null&&!m.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:oi(a,r,Y,null,m,A)}for(L in m)if(A=m[L],E=f[L],m.hasOwnProperty(L)&&(A!=null||E!=null))switch(L){case"value":Ne=A;break;case"defaultValue":He=A;break;case"children":break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(n(91));break;default:A!==E&&oi(a,r,L,A,m,E)}Kn(a,Ne,He);return;case"option":for(var Gt in f)Ne=f[Gt],f.hasOwnProperty(Gt)&&Ne!=null&&!m.hasOwnProperty(Gt)&&(Gt==="selected"?a.selected=!1:oi(a,r,Gt,null,m,Ne));for(ce in m)Ne=m[ce],He=f[ce],m.hasOwnProperty(ce)&&Ne!==He&&(Ne!=null||He!=null)&&(ce==="selected"?a.selected=Ne&&typeof Ne!="function"&&typeof Ne!="symbol":oi(a,r,ce,Ne,m,He));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var nn in f)Ne=f[nn],f.hasOwnProperty(nn)&&Ne!=null&&!m.hasOwnProperty(nn)&&oi(a,r,nn,null,m,Ne);for(Ce in m)if(Ne=m[Ce],He=f[Ce],m.hasOwnProperty(Ce)&&Ne!==He&&(Ne!=null||He!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(n(137,r));break;default:oi(a,r,Ce,Ne,m,He)}return;default:if(_s(r)){for(var li in f)Ne=f[li],f.hasOwnProperty(li)&&Ne!==void 0&&!m.hasOwnProperty(li)&&iM(a,r,li,void 0,m,Ne);for(ke in m)Ne=m[ke],He=f[ke],!m.hasOwnProperty(ke)||Ne===He||Ne===void 0&&He===void 0||iM(a,r,ke,Ne,m,He);return}}for(var Me in f)Ne=f[Me],f.hasOwnProperty(Me)&&Ne!=null&&!m.hasOwnProperty(Me)&&oi(a,r,Me,null,m,Ne);for($e in m)Ne=m[$e],He=f[$e],!m.hasOwnProperty($e)||Ne===He||Ne==null&&He==null||oi(a,r,$e,Ne,m,He)}function BC(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o4(){if(typeof performance.getEntriesByType=="function"){for(var a=0,r=0,f=performance.getEntriesByType("resource"),m=0;m<f.length;m++){var A=f[m],E=A.transferSize,L=A.initiatorType,Y=A.duration;if(E&&Y&&BC(L)){for(L=0,Y=A.responseEnd,m+=1;m<f.length;m++){var ce=f[m],Ce=ce.startTime;if(Ce>Y)break;var ke=ce.transferSize,$e=ce.initiatorType;ke&&BC($e)&&(ce=ce.responseEnd,L+=ke*(ce<Y?1:(Y-Ce)/(ce-Ce)))}if(--m,r+=8*(E+L)/(A.duration/1e3),a++,10<a)break}}if(0<a)return r/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var aM=null,sM=null;function Ay(a){return a.nodeType===9?a:a.ownerDocument}function DC(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function UC(a,r){if(a===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&r==="foreignObject"?0:a}function rM(a,r){return a==="textarea"||a==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var oM=null;function l4(){var a=window.event;return a&&a.type==="popstate"?a===oM?!1:(oM=a,!0):(oM=null,!1)}var NC=typeof setTimeout=="function"?setTimeout:void 0,c4=typeof clearTimeout=="function"?clearTimeout:void 0,LC=typeof Promise=="function"?Promise:void 0,u4=typeof queueMicrotask=="function"?queueMicrotask:typeof LC<"u"?function(a){return LC.resolve(null).then(a).catch(f4)}:NC;function f4(a){setTimeout(function(){throw a})}function cu(a){return a==="head"}function OC(a,r){var f=r,m=0;do{var A=f.nextSibling;if(a.removeChild(f),A&&A.nodeType===8)if(f=A.data,f==="/$"||f==="/&"){if(m===0){a.removeChild(A),Kd(r);return}m--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")m++;else if(f==="html")xg(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,xg(f);for(var E=f.firstChild;E;){var L=E.nextSibling,Y=E.nodeName;E[Ue]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&E.rel.toLowerCase()==="stylesheet"||f.removeChild(E),E=L}}else f==="body"&&xg(a.ownerDocument.body);f=A}while(f);Kd(r)}function IC(a,r){var f=a;a=0;do{var m=f.nextSibling;if(f.nodeType===1?r?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(r?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),m&&m.nodeType===8)if(f=m.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=m}while(f)}function lM(a){var r=a.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var f=r;switch(r=r.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":lM(f),Ie(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function h4(a,r,f,m){for(;a.nodeType===1;){var A=f;if(a.nodeName.toLowerCase()!==r.toLowerCase()){if(!m&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(m){if(!a[Ue])switch(r){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(E=a.getAttribute("rel"),E==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(E!==A.rel||a.getAttribute("href")!==(A.href==null||A.href===""?null:A.href)||a.getAttribute("crossorigin")!==(A.crossOrigin==null?null:A.crossOrigin)||a.getAttribute("title")!==(A.title==null?null:A.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(E=a.getAttribute("src"),(E!==(A.src==null?null:A.src)||a.getAttribute("type")!==(A.type==null?null:A.type)||a.getAttribute("crossorigin")!==(A.crossOrigin==null?null:A.crossOrigin))&&E&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(r==="input"&&a.type==="hidden"){var E=A.name==null?null:""+A.name;if(A.type==="hidden"&&a.getAttribute("name")===E)return a}else return a;if(a=zr(a.nextSibling),a===null)break}return null}function d4(a,r,f){if(r==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=zr(a.nextSibling),a===null))return null;return a}function FC(a,r){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!r||(a=zr(a.nextSibling),a===null))return null;return a}function cM(a){return a.data==="$?"||a.data==="$~"}function uM(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function p4(a,r){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=r;else if(a.data!=="$?"||f.readyState!=="loading")r();else{var m=function(){r(),f.removeEventListener("DOMContentLoaded",m)};f.addEventListener("DOMContentLoaded",m),a._reactRetry=m}}function zr(a){for(;a!=null;a=a.nextSibling){var r=a.nodeType;if(r===1||r===3)break;if(r===8){if(r=a.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return a}var fM=null;function HC(a){a=a.nextSibling;for(var r=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(r===0)return zr(a.nextSibling);r--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||r++}a=a.nextSibling}return null}function PC(a){a=a.previousSibling;for(var r=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(r===0)return a;r--}else f!=="/$"&&f!=="/&"||r++}a=a.previousSibling}return null}function GC(a,r,f){switch(r=Ay(f),a){case"html":if(a=r.documentElement,!a)throw Error(n(452));return a;case"head":if(a=r.head,!a)throw Error(n(453));return a;case"body":if(a=r.body,!a)throw Error(n(454));return a;default:throw Error(n(451))}}function xg(a){for(var r=a.attributes;r.length;)a.removeAttributeNode(r[0]);Ie(a)}var Vr=new Map,zC=new Set;function Sy(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var ac=K.d;K.d={f:m4,r:g4,D:v4,C:_4,L:y4,m:x4,X:S4,S:A4,M:M4};function m4(){var a=ac.f(),r=J();return a||r}function g4(a){var r=Pe(a);r!==null&&r.tag===5&&r.type==="form"?cg(r):ac.r(a)}var Yd=typeof document>"u"?null:document;function VC(a,r,f){var m=Yd;if(m&&typeof r=="string"&&r){var A=Ct(r);A='link[rel="'+a+'"][href="'+A+'"]',typeof f=="string"&&(A+='[crossorigin="'+f+'"]'),zC.has(A)||(zC.add(A),a={rel:a,crossOrigin:f,href:r},m.querySelector(A)===null&&(r=m.createElement("link"),Ka(r,"link",a),V(r),m.head.appendChild(r)))}}function v4(a){ac.D(a),VC("dns-prefetch",a,null)}function _4(a,r){ac.C(a,r),VC("preconnect",a,r)}function y4(a,r,f){ac.L(a,r,f);var m=Yd;if(m&&a&&r){var A='link[rel="preload"][as="'+Ct(r)+'"]';r==="image"&&f&&f.imageSrcSet?(A+='[imagesrcset="'+Ct(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(A+='[imagesizes="'+Ct(f.imageSizes)+'"]')):A+='[href="'+Ct(a)+'"]';var E=A;switch(r){case"style":E=Jd(a);break;case"script":E=qd(a)}Vr.has(E)||(a=v({rel:"preload",href:r==="image"&&f&&f.imageSrcSet?void 0:a,as:r},f),Vr.set(E,a),m.querySelector(A)!==null||r==="style"&&m.querySelector(Ag(E))||r==="script"&&m.querySelector(Sg(E))||(r=m.createElement("link"),Ka(r,"link",a),V(r),m.head.appendChild(r)))}}function x4(a,r){ac.m(a,r);var f=Yd;if(f&&a){var m=r&&typeof r.as=="string"?r.as:"script",A='link[rel="modulepreload"][as="'+Ct(m)+'"][href="'+Ct(a)+'"]',E=A;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=qd(a)}if(!Vr.has(E)&&(a=v({rel:"modulepreload",href:a},r),Vr.set(E,a),f.querySelector(A)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sg(E)))return}m=f.createElement("link"),Ka(m,"link",a),V(m),f.head.appendChild(m)}}}function A4(a,r,f){ac.S(a,r,f);var m=Yd;if(m&&a){var A=Je(m).hoistableStyles,E=Jd(a);r=r||"default";var L=A.get(E);if(!L){var Y={loading:0,preload:null};if(L=m.querySelector(Ag(E)))Y.loading=5;else{a=v({rel:"stylesheet",href:a,"data-precedence":r},f),(f=Vr.get(E))&&hM(a,f);var ce=L=m.createElement("link");V(ce),Ka(ce,"link",a),ce._p=new Promise(function(Ce,ke){ce.onload=Ce,ce.onerror=ke}),ce.addEventListener("load",function(){Y.loading|=1}),ce.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,My(L,r,m)}L={type:"stylesheet",instance:L,count:1,state:Y},A.set(E,L)}}}function S4(a,r){ac.X(a,r);var f=Yd;if(f&&a){var m=Je(f).hoistableScripts,A=qd(a),E=m.get(A);E||(E=f.querySelector(Sg(A)),E||(a=v({src:a,async:!0},r),(r=Vr.get(A))&&dM(a,r),E=f.createElement("script"),V(E),Ka(E,"link",a),f.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},m.set(A,E))}}function M4(a,r){ac.M(a,r);var f=Yd;if(f&&a){var m=Je(f).hoistableScripts,A=qd(a),E=m.get(A);E||(E=f.querySelector(Sg(A)),E||(a=v({src:a,async:!0,type:"module"},r),(r=Vr.get(A))&&dM(a,r),E=f.createElement("script"),V(E),Ka(E,"link",a),f.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},m.set(A,E))}}function kC(a,r,f,m){var A=(A=ve.current)?Sy(A):null;if(!A)throw Error(n(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(r=Jd(f.href),f=Je(A).hoistableStyles,m=f.get(r),m||(m={type:"style",instance:null,count:0,state:null},f.set(r,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=Jd(f.href);var E=Je(A).hoistableStyles,L=E.get(a);if(L||(A=A.ownerDocument||A,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(a,L),(E=A.querySelector(Ag(a)))&&!E._p&&(L.instance=E,L.state.loading=5),Vr.has(a)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},Vr.set(a,f),E||b4(A,a,f,L.state))),r&&m===null)throw Error(n(528,""));return L}if(r&&m!==null)throw Error(n(529,""));return null;case"script":return r=f.async,f=f.src,typeof f=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=qd(f),f=Je(A).hoistableScripts,m=f.get(r),m||(m={type:"script",instance:null,count:0,state:null},f.set(r,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,a))}}function Jd(a){return'href="'+Ct(a)+'"'}function Ag(a){return'link[rel="stylesheet"]['+a+"]"}function XC(a){return v({},a,{"data-precedence":a.precedence,precedence:null})}function b4(a,r,f,m){a.querySelector('link[rel="preload"][as="style"]['+r+"]")?m.loading=1:(r=a.createElement("link"),m.preload=r,r.addEventListener("load",function(){return m.loading|=1}),r.addEventListener("error",function(){return m.loading|=2}),Ka(r,"link",f),V(r),a.head.appendChild(r))}function qd(a){return'[src="'+Ct(a)+'"]'}function Sg(a){return"script[async]"+a}function YC(a,r,f){if(r.count++,r.instance===null)switch(r.type){case"style":var m=a.querySelector('style[data-href~="'+Ct(f.href)+'"]');if(m)return r.instance=m,V(m),m;var A=v({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return m=(a.ownerDocument||a).createElement("style"),V(m),Ka(m,"style",A),My(m,f.precedence,a),r.instance=m;case"stylesheet":A=Jd(f.href);var E=a.querySelector(Ag(A));if(E)return r.state.loading|=4,r.instance=E,V(E),E;m=XC(f),(A=Vr.get(A))&&hM(m,A),E=(a.ownerDocument||a).createElement("link"),V(E);var L=E;return L._p=new Promise(function(Y,ce){L.onload=Y,L.onerror=ce}),Ka(E,"link",m),r.state.loading|=4,My(E,f.precedence,a),r.instance=E;case"script":return E=qd(f.src),(A=a.querySelector(Sg(E)))?(r.instance=A,V(A),A):(m=f,(A=Vr.get(E))&&(m=v({},f),dM(m,A)),a=a.ownerDocument||a,A=a.createElement("script"),V(A),Ka(A,"link",m),a.head.appendChild(A),r.instance=A);case"void":return null;default:throw Error(n(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(m=r.instance,r.state.loading|=4,My(m,f.precedence,a));return r.instance}function My(a,r,f){for(var m=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),A=m.length?m[m.length-1]:null,E=A,L=0;L<m.length;L++){var Y=m[L];if(Y.dataset.precedence===r)E=Y;else if(E!==A)break}E?E.parentNode.insertBefore(a,E.nextSibling):(r=f.nodeType===9?f.head:f,r.insertBefore(a,r.firstChild))}function hM(a,r){a.crossOrigin==null&&(a.crossOrigin=r.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=r.referrerPolicy),a.title==null&&(a.title=r.title)}function dM(a,r){a.crossOrigin==null&&(a.crossOrigin=r.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=r.referrerPolicy),a.integrity==null&&(a.integrity=r.integrity)}var by=null;function JC(a,r,f){if(by===null){var m=new Map,A=by=new Map;A.set(f,m)}else A=by,m=A.get(f),m||(m=new Map,A.set(f,m));if(m.has(a))return m;for(m.set(a,null),f=f.getElementsByTagName(a),A=0;A<f.length;A++){var E=f[A];if(!(E[Ue]||E[ln]||a==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var L=E.getAttribute(r)||"";L=a+L;var Y=m.get(L);Y?Y.push(E):m.set(L,[E])}}return m}function qC(a,r,f){a=a.ownerDocument||a,a.head.insertBefore(f,r==="title"?a.querySelector("head > title"):null)}function E4(a,r,f){if(f===1||r.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(a=r.disabled,typeof r.precedence=="string"&&a==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function KC(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function T4(a,r,f,m){if(f.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var A=Jd(m.href),E=r.querySelector(Ag(A));if(E){r=E._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(a.count++,a=Ey.bind(a),r.then(a,a)),f.state.loading|=4,f.instance=E,V(E);return}E=r.ownerDocument||r,m=XC(m),(A=Vr.get(A))&&hM(m,A),E=E.createElement("link"),V(E);var L=E;L._p=new Promise(function(Y,ce){L.onload=Y,L.onerror=ce}),Ka(E,"link",m),f.instance=E}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,r),(r=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=Ey.bind(a),r.addEventListener("load",f),r.addEventListener("error",f))}}var pM=0;function C4(a,r){return a.stylesheets&&a.count===0&&Cy(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var m=setTimeout(function(){if(a.stylesheets&&Cy(a,a.stylesheets),a.unsuspend){var E=a.unsuspend;a.unsuspend=null,E()}},6e4+r);0<a.imgBytes&&pM===0&&(pM=62500*o4());var A=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Cy(a,a.stylesheets),a.unsuspend)){var E=a.unsuspend;a.unsuspend=null,E()}},(a.imgBytes>pM?50:800)+r);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(m),clearTimeout(A)}}:null}function Ey(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cy(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Ty=null;function Cy(a,r){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Ty=new Map,r.forEach(R4,a),Ty=null,Ey.call(a))}function R4(a,r){if(!(r.state.loading&4)){var f=Ty.get(a);if(f)var m=f.get(null);else{f=new Map,Ty.set(a,f);for(var A=a.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<A.length;E++){var L=A[E];(L.nodeName==="LINK"||L.getAttribute("media")!=="not all")&&(f.set(L.dataset.precedence,L),m=L)}m&&f.set(null,m)}A=r.instance,L=A.getAttribute("data-precedence"),E=f.get(L)||m,E===m&&f.set(null,A),f.set(L,A),this.count++,m=Ey.bind(this),A.addEventListener("load",m),A.addEventListener("error",m),E?E.parentNode.insertBefore(A,E.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(A,a.firstChild)),r.state.loading|=4}}var Mg={$$typeof:D,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function w4(a,r,f,m,A,E,L,Y,ce){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=dn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dn(0),this.hiddenUpdates=dn(null),this.identifierPrefix=m,this.onUncaughtError=A,this.onCaughtError=E,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ce,this.incompleteTransitions=new Map}function WC(a,r,f,m,A,E,L,Y,ce,Ce,ke,$e){return a=new w4(a,r,f,L,ce,Ce,ke,$e,Y),r=1,E===!0&&(r|=24),E=Va(3,null,null,r),a.current=E,E.stateNode=a,r=Dm(),r.refCount++,a.pooledCache=r,r.refCount++,E.memoizedState={element:m,isDehydrated:f,cache:r},Fm(E),a}function jC(a){return a?(a=qo,a):qo}function ZC(a,r,f,m,A,E){A=jC(A),m.context===null?m.context=A:m.pendingContext=A,m=Ur(r),m.payload={element:f},E=E===void 0?null:E,E!==null&&(m.callback=E),f=fo(a,m,r),f!==null&&(u(f,a,r),tl(f,a,r))}function QC(a,r){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<r?f:r}}function mM(a,r){QC(a,r),(a=a.alternate)&&QC(a,r)}function $C(a){if(a.tag===13||a.tag===31){var r=Jo(a,67108864);r!==null&&u(r,a,67108864),mM(a,67108864)}}function eR(a){if(a.tag===13||a.tag===31){var r=qa();r=wa(r);var f=Jo(a,r);f!==null&&u(f,a,r),mM(a,r)}}var Ry=!0;function B4(a,r,f,m){var A=H.T;H.T=null;var E=K.p;try{K.p=2,gM(a,r,f,m)}finally{K.p=E,H.T=A}}function D4(a,r,f,m){var A=H.T;H.T=null;var E=K.p;try{K.p=8,gM(a,r,f,m)}finally{K.p=E,H.T=A}}function gM(a,r,f,m){if(Ry){var A=vM(m);if(A===null)nM(a,r,m,wy,f),nR(a,m);else if(N4(A,a,r,f,m))m.stopPropagation();else if(nR(a,m),r&4&&-1<U4.indexOf(a)){for(;A!==null;){var E=Pe(A);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var L=it(E.pendingLanes);if(L!==0){var Y=E;for(Y.pendingLanes|=2,Y.entangledLanes|=2;L;){var ce=1<<31-yt(L);Y.entanglements[1]|=ce,L&=~ce}ul(E),(On&6)===0&&(Ls=P()+500,vg(0))}}break;case 31:case 13:Y=Jo(E,2),Y!==null&&u(Y,E,2),J(),mM(E,2)}if(E=vM(m),E===null&&nM(a,r,m,wy,f),E===A)break;A=E}A!==null&&m.stopPropagation()}else nM(a,r,m,null,f)}}function vM(a){return a=Xh(a),_M(a)}var wy=null;function _M(a){if(wy=null,a=ze(a),a!==null){var r=o(a);if(r===null)a=null;else{var f=r.tag;if(f===13){if(a=l(r),a!==null)return a;a=null}else if(f===31){if(a=h(r),a!==null)return a;a=null}else if(f===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;a=null}else r!==a&&(a=null)}}return wy=a,null}function tR(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(me()){case Le:return 2;case Xe:return 8;case Fe:case Bt:return 32;case _t:return 268435456;default:return 32}default:return 32}}var yM=!1,uu=null,fu=null,hu=null,bg=new Map,Eg=new Map,du=[],U4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function nR(a,r){switch(a){case"focusin":case"focusout":uu=null;break;case"dragenter":case"dragleave":fu=null;break;case"mouseover":case"mouseout":hu=null;break;case"pointerover":case"pointerout":bg.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Eg.delete(r.pointerId)}}function Tg(a,r,f,m,A,E){return a===null||a.nativeEvent!==E?(a={blockedOn:r,domEventName:f,eventSystemFlags:m,nativeEvent:E,targetContainers:[A]},r!==null&&(r=Pe(r),r!==null&&$C(r)),a):(a.eventSystemFlags|=m,r=a.targetContainers,A!==null&&r.indexOf(A)===-1&&r.push(A),a)}function N4(a,r,f,m,A){switch(r){case"focusin":return uu=Tg(uu,a,r,f,m,A),!0;case"dragenter":return fu=Tg(fu,a,r,f,m,A),!0;case"mouseover":return hu=Tg(hu,a,r,f,m,A),!0;case"pointerover":var E=A.pointerId;return bg.set(E,Tg(bg.get(E)||null,a,r,f,m,A)),!0;case"gotpointercapture":return E=A.pointerId,Eg.set(E,Tg(Eg.get(E)||null,a,r,f,m,A)),!0}return!1}function iR(a){var r=ze(a.target);if(r!==null){var f=o(r);if(f!==null){if(r=f.tag,r===13){if(r=l(f),r!==null){a.blockedOn=r,qt(a.priority,function(){eR(f)});return}}else if(r===31){if(r=h(f),r!==null){a.blockedOn=r,qt(a.priority,function(){eR(f)});return}}else if(r===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function By(a){if(a.blockedOn!==null)return!1;for(var r=a.targetContainers;0<r.length;){var f=vM(a.nativeEvent);if(f===null){f=a.nativeEvent;var m=new f.constructor(f.type,f);sf=m,f.target.dispatchEvent(m),sf=null}else return r=Pe(f),r!==null&&$C(r),a.blockedOn=f,!1;r.shift()}return!0}function aR(a,r,f){By(a)&&f.delete(r)}function L4(){yM=!1,uu!==null&&By(uu)&&(uu=null),fu!==null&&By(fu)&&(fu=null),hu!==null&&By(hu)&&(hu=null),bg.forEach(aR),Eg.forEach(aR)}function Dy(a,r){a.blockedOn===r&&(a.blockedOn=null,yM||(yM=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,L4)))}var Uy=null;function sR(a){Uy!==a&&(Uy=a,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Uy===a&&(Uy=null);for(var r=0;r<a.length;r+=3){var f=a[r],m=a[r+1],A=a[r+2];if(typeof m!="function"){if(_M(m||f)===null)continue;break}var E=Pe(f);E!==null&&(a.splice(r,3),r-=3,lg(E,{pending:!0,data:A,method:f.method,action:m},m,A))}}))}function Kd(a){function r(ce){return Dy(ce,a)}uu!==null&&Dy(uu,a),fu!==null&&Dy(fu,a),hu!==null&&Dy(hu,a),bg.forEach(r),Eg.forEach(r);for(var f=0;f<du.length;f++){var m=du[f];m.blockedOn===a&&(m.blockedOn=null)}for(;0<du.length&&(f=du[0],f.blockedOn===null);)iR(f),f.blockedOn===null&&du.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(m=0;m<f.length;m+=3){var A=f[m],E=f[m+1],L=A[G]||null;if(typeof E=="function")L||sR(f);else if(L){var Y=null;if(E&&E.hasAttribute("formAction")){if(A=E,L=E[G]||null)Y=L.formAction;else if(_M(A)!==null)continue}else Y=L.action;typeof Y=="function"?f[m+1]=Y:(f.splice(m,3),m-=3),sR(f)}}}function rR(){function a(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(L){return A=L})},focusReset:"manual",scroll:"manual"})}function r(){A!==null&&(A(),A=null),m||setTimeout(f,20)}function f(){if(!m&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,A=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(f,100),function(){m=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),A!==null&&(A(),A=null)}}}function xM(a){this._internalRoot=a}Ny.prototype.render=xM.prototype.render=function(a){var r=this._internalRoot;if(r===null)throw Error(n(409));var f=r.current,m=qa();ZC(f,m,a,r,null,null)},Ny.prototype.unmount=xM.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var r=a.containerInfo;ZC(a.current,2,null,a,null,null),J(),r[q]=null}};function Ny(a){this._internalRoot=a}Ny.prototype.unstable_scheduleHydration=function(a){if(a){var r=gi();a={blockedOn:null,target:a,priority:r};for(var f=0;f<du.length&&r!==0&&r<du[f].priority;f++);du.splice(f,0,a),f===0&&iR(a)}};var oR=e.version;if(oR!=="19.2.3")throw Error(n(527,oR,"19.2.3"));K.findDOMNode=function(a){var r=a._reactInternals;if(r===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=p(r),a=a!==null?_(a):null,a=a===null?null:a.stateNode,a};var O4={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ly=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ly.isDisabled&&Ly.supportsFiber)try{Ke=Ly.inject(O4),Qe=Ly}catch{}}return Wd.createRoot=function(a,r){if(!i(a))throw Error(n(299));var f=!1,m="",A=hg,E=hy,L=Dd;return r!=null&&(r.unstable_strictMode===!0&&(f=!0),r.identifierPrefix!==void 0&&(m=r.identifierPrefix),r.onUncaughtError!==void 0&&(A=r.onUncaughtError),r.onCaughtError!==void 0&&(E=r.onCaughtError),r.onRecoverableError!==void 0&&(L=r.onRecoverableError)),r=WC(a,1,!1,null,null,f,m,null,A,E,L,rR),a[q]=r.current,tM(a),new xM(r)},Wd.hydrateRoot=function(a,r,f){if(!i(a))throw Error(n(299));var m=!1,A="",E=hg,L=hy,Y=Dd,ce=null;return f!=null&&(f.unstable_strictMode===!0&&(m=!0),f.identifierPrefix!==void 0&&(A=f.identifierPrefix),f.onUncaughtError!==void 0&&(E=f.onUncaughtError),f.onCaughtError!==void 0&&(L=f.onCaughtError),f.onRecoverableError!==void 0&&(Y=f.onRecoverableError),f.formState!==void 0&&(ce=f.formState)),r=WC(a,1,!0,r,f??null,m,A,ce,E,L,Y,rR),r.context=jC(null),f=r.current,m=qa(),m=wa(m),A=Ur(m),A.callback=null,fo(f,A,m),f=m,r.current.lanes=f,Di(r,f),ul(r),a[q]=r.current,tM(a),new Ny(r)},Wd.version="19.2.3",Wd}var wM;function pR(){if(wM)return Hy.exports;wM=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),Hy.exports=dR(),Hy.exports}var mR=pR(),Vy={exports:{}},jd={};var BM;function gR(){if(BM)return jd;BM=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,o){var l=null;if(o!==void 0&&(l=""+o),i.key!==void 0&&(l=""+i.key),"key"in i){o={};for(var h in i)h!=="key"&&(o[h]=i[h])}else o=i;return i=o.ref,{$$typeof:s,type:n,key:l,ref:i!==void 0?i:null,props:o}}return jd.Fragment=e,jd.jsx=t,jd.jsxs=t,jd}var DM;function vR(){return DM||(DM=1,Vy.exports=gR()),Vy.exports}var Pt=vR();function ky(){return ky=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},ky.apply(null,arguments)}const Zd="182",_R={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yR={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},UM=0,Xy=1,NM=2,xR=3,LM=0,Kf=1,Qd=2,mu=3,kr=0,fs=1,Ws=2,Xr=0,gu=1,Yy=2,Jy=3,qy=4,OM=5,sc=100,IM=101,FM=102,HM=103,PM=104,GM=200,zM=201,VM=202,kM=203,Cg=204,Rg=205,XM=206,YM=207,JM=208,qM=209,KM=210,WM=211,jM=212,ZM=213,QM=214,wg=0,Bg=1,Dg=2,vu=3,Ug=4,Ng=5,Lg=6,Og=7,$d=0,$M=1,eb=2,mr=0,Ky=1,Wy=2,jy=3,Ig=4,Zy=5,Qy=6,$y=7,ex="attached",tb="detached",rc=300,Yr=301,oc=302,Wf=303,ep=304,jf=306,Jr=1e3,yi=1001,_u=1002,xi=1003,tp=1004,AR=1004,lc=1005,SR=1005,bn=1006,yu=1007,MR=1007,Is=1008,tx=1008,Ma=1009,Fg=1010,Hg=1011,Zf=1012,np=1013,js=1014,Ai=1015,Hi=1016,Pg=1017,Gg=1018,Qf=1020,nx=35902,ix=35899,ax=1021,sx=1022,ji=1023,bo=1026,cc=1027,ip=1028,ap=1029,xu=1030,zg=1031,bR=1032,Vg=1033,sp=33776,rp=33777,op=33778,lp=33779,kg=35840,Xg=35841,Yg=35842,Jg=35843,qg=36196,Kg=37492,Wg=37496,jg=37488,Zg=37489,Qg=37490,$g=37491,e0=37808,t0=37809,n0=37810,i0=37811,a0=37812,s0=37813,r0=37814,o0=37815,l0=37816,c0=37817,u0=37818,f0=37819,h0=37820,d0=37821,p0=36492,m0=36494,g0=36495,v0=36283,_0=36284,y0=36285,x0=36286,cp=2200,nb=2201,ib=2202,Au=2300,uc=2301,A0=2302,Su=2400,Mu=2401,up=2402,S0=2500,rx=2501,ox=0,fp=1,bu=2,ab=3200,ER=3201,TR=3202,CR=3203,fc=0,sb=1,hl="",Pi="srgb",ta="srgb-linear",hp="linear",ti="srgb",RR="",wR="rg",BR="ga",DR=0,Eu=7680,UR=7681,NR=7682,LR=7683,OR=34055,IR=34056,FR=5386,HR=512,PR=513,GR=514,zR=515,VR=516,kR=517,XR=518,lx=519,rb=512,ob=513,lb=514,M0=515,cb=516,ub=517,b0=518,fb=519,dp=35044,YR=35048,JR=35040,qR=35045,KR=35049,WR=35041,jR=35046,ZR=35050,QR=35042,$R="100",cx="300 es",Zs=2e3,$f=2001,e2={COMPUTE:"compute",RENDER:"render"},t2={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},n2={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function hb(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const i2={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function eh(s,e){return new i2[s](e)}function db(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function pp(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function pb(){const s=pp("canvas");return s.style.display="block",s}const mb={};let hc=null;function a2(s){hc=s}function s2(){return hc}function mp(...s){const e="THREE."+s.shift();hc?hc("log",e,...s):console.log(e,...s)}function Et(...s){const e="THREE."+s.shift();hc?hc("warn",e,...s):console.warn(e,...s)}function Wt(...s){const e="THREE."+s.shift();hc?hc("error",e,...s):console.error(e,...s)}function th(...s){const e=s.join(" ");e in mb||(mb[e]=!0,Et(...s))}function r2(s,e,t){return new Promise(function(n,i){function o(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}class Eo{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o<l;o++)i[o].call(this,e);e.target=null}}}const ja=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let gb=1234567;const Tu=Math.PI/180,nh=180/Math.PI;function Qs(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ja[s&255]+ja[s>>8&255]+ja[s>>16&255]+ja[s>>24&255]+"-"+ja[e&255]+ja[e>>8&255]+"-"+ja[e>>16&15|64]+ja[e>>24&255]+"-"+ja[t&63|128]+ja[t>>8&255]+"-"+ja[t>>16&255]+ja[t>>24&255]+ja[n&255]+ja[n>>8&255]+ja[n>>16&255]+ja[n>>24&255]).toLowerCase()}function rn(s,e,t){return Math.max(e,Math.min(t,s))}function ux(s,e){return(s%e+e)%e}function o2(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function l2(s,e,t){return s!==e?(t-s)/(e-s):0}function gp(s,e,t){return(1-t)*s+t*e}function c2(s,e,t,n){return gp(s,e,1-Math.exp(-t*n))}function u2(s,e=1){return e-Math.abs(ux(s,e*2)-e)}function f2(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function h2(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function d2(s,e){return s+Math.floor(Math.random()*(e-s+1))}function p2(s,e){return s+Math.random()*(e-s)}function m2(s){return s*(.5-Math.random())}function g2(s){s!==void 0&&(gb=s);let e=gb+=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 v2(s){return s*Tu}function _2(s){return s*nh}function y2(s){return(s&s-1)===0&&s!==0}function x2(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function A2(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function S2(s,e,t,n,i){const o=Math.cos,l=Math.sin,h=o(t/2),d=l(t/2),p=o((e+n)/2),_=l((e+n)/2),v=o((e-n)/2),y=l((e-n)/2),x=o((n-e)/2),b=l((n-e)/2);switch(i){case"XYX":s.set(h*_,d*v,d*y,h*p);break;case"YZY":s.set(d*y,h*_,d*v,h*p);break;case"ZXZ":s.set(d*v,d*y,h*_,h*p);break;case"XZX":s.set(h*_,d*b,d*x,h*p);break;case"YXY":s.set(d*x,h*_,d*b,h*p);break;case"ZYZ":s.set(d*b,d*x,h*_,h*p);break;default:Et("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function hs(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function yn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const E0={DEG2RAD:Tu,RAD2DEG:nh,generateUUID:Qs,clamp:rn,euclideanModulo:ux,mapLinear:o2,inverseLerp:l2,lerp:gp,damp:c2,pingpong:u2,smoothstep:f2,smootherstep:h2,randInt:d2,randFloat:p2,randFloatSpread:m2,seededRandom:g2,degToRad:v2,radToDeg:_2,isPowerOfTwo:y2,ceilPowerOfTwo:x2,floorPowerOfTwo:A2,setQuaternionFromProperEuler:S2,normalize:yn,denormalize:hs};class et{constructor(e=0,t=0){et.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=rn(this.x,e.x,t.x),this.y=rn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=rn(this.x,e,t),this.y=rn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(rn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ba{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,h){let d=n[i+0],p=n[i+1],_=n[i+2],v=n[i+3],y=o[l+0],x=o[l+1],b=o[l+2],R=o[l+3];if(h<=0){e[t+0]=d,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(h>=1){e[t+0]=y,e[t+1]=x,e[t+2]=b,e[t+3]=R;return}if(v!==R||d!==y||p!==x||_!==b){let T=d*y+p*x+_*b+v*R;T<0&&(y=-y,x=-x,b=-b,R=-R,T=-T);let M=1-h;if(T<.9995){const w=Math.acos(T),D=Math.sin(w);M=Math.sin(M*w)/D,h=Math.sin(h*w)/D,d=d*M+y*h,p=p*M+x*h,_=_*M+b*h,v=v*M+R*h}else{d=d*M+y*h,p=p*M+x*h,_=_*M+b*h,v=v*M+R*h;const w=1/Math.sqrt(d*d+p*p+_*_+v*v);d*=w,p*=w,_*=w,v*=w}}e[t]=d,e[t+1]=p,e[t+2]=_,e[t+3]=v}static multiplyQuaternionsFlat(e,t,n,i,o,l){const h=n[i],d=n[i+1],p=n[i+2],_=n[i+3],v=o[l],y=o[l+1],x=o[l+2],b=o[l+3];return e[t]=h*b+_*v+d*x-p*y,e[t+1]=d*b+_*y+p*v-h*x,e[t+2]=p*b+_*x+h*y-d*v,e[t+3]=_*b-h*v-d*y-p*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,h=Math.cos,d=Math.sin,p=h(n/2),_=h(i/2),v=h(o/2),y=d(n/2),x=d(i/2),b=d(o/2);switch(l){case"XYZ":this._x=y*_*v+p*x*b,this._y=p*x*v-y*_*b,this._z=p*_*b+y*x*v,this._w=p*_*v-y*x*b;break;case"YXZ":this._x=y*_*v+p*x*b,this._y=p*x*v-y*_*b,this._z=p*_*b-y*x*v,this._w=p*_*v+y*x*b;break;case"ZXY":this._x=y*_*v-p*x*b,this._y=p*x*v+y*_*b,this._z=p*_*b+y*x*v,this._w=p*_*v-y*x*b;break;case"ZYX":this._x=y*_*v-p*x*b,this._y=p*x*v+y*_*b,this._z=p*_*b-y*x*v,this._w=p*_*v+y*x*b;break;case"YZX":this._x=y*_*v+p*x*b,this._y=p*x*v+y*_*b,this._z=p*_*b-y*x*v,this._w=p*_*v-y*x*b;break;case"XZY":this._x=y*_*v-p*x*b,this._y=p*x*v-y*_*b,this._z=p*_*b+y*x*v,this._w=p*_*v+y*x*b;break;default:Et("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],h=t[5],d=t[9],p=t[2],_=t[6],v=t[10],y=n+h+v;if(y>0){const x=.5/Math.sqrt(y+1);this._w=.25/x,this._x=(_-d)*x,this._y=(o-p)*x,this._z=(l-i)*x}else if(n>h&&n>v){const x=2*Math.sqrt(1+n-h-v);this._w=(_-d)/x,this._x=.25*x,this._y=(i+l)/x,this._z=(o+p)/x}else if(h>v){const x=2*Math.sqrt(1+h-n-v);this._w=(o-p)/x,this._x=(i+l)/x,this._y=.25*x,this._z=(d+_)/x}else{const x=2*Math.sqrt(1+v-n-h);this._w=(l-i)/x,this._x=(o+p)/x,this._y=(d+_)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(rn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,h=t._x,d=t._y,p=t._z,_=t._w;return this._x=n*_+l*h+i*p-o*d,this._y=i*_+l*d+o*h-n*p,this._z=o*_+l*p+n*d-i*h,this._w=l*_-n*h-i*d-o*p,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,o=e._z,l=e._w,h=this.dot(e);h<0&&(n=-n,i=-i,o=-o,l=-l,h=-h);let d=1-t;if(h<.9995){const p=Math.acos(h),_=Math.sin(p);d=Math.sin(d*p)/_,t=Math.sin(t*p)/_,this._x=this._x*d+n*t,this._y=this._y*d+i*t,this._z=this._z*d+o*t,this._w=this._w*d+l*t,this._onChangeCallback()}else this._x=this._x*d+n*t,this._y=this._y*d+i*t,this._z=this._z*d+o*t,this._w=this._w*d+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Q{constructor(e=0,t=0,n=0){Q.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(vb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(vb.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,h=e.z,d=e.w,p=2*(l*i-h*n),_=2*(h*t-o*i),v=2*(o*n-l*t);return this.x=t+d*p+l*v-h*_,this.y=n+d*_+h*p-o*v,this.z=i+d*v+o*_-l*p,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+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,t){return this.x=rn(this.x,e.x,t.x),this.y=rn(this.y,e.y,t.y),this.z=rn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=rn(this.x,e,t),this.y=rn(this.y,e,t),this.z=rn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,h=t.y,d=t.z;return this.x=i*d-o*h,this.y=o*l-n*d,this.z=n*h-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return fx.copy(this).projectOnVector(e),this.sub(fx)}reflect(e){return this.sub(fx.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(rn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const fx=new Q,vb=new ba;class mn{constructor(e,t,n,i,o,l,h,d,p){mn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,h,d,p)}set(e,t,n,i,o,l,h,d,p){const _=this.elements;return _[0]=e,_[1]=i,_[2]=h,_[3]=t,_[4]=o,_[5]=d,_[6]=n,_[7]=l,_[8]=p,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],h=n[3],d=n[6],p=n[1],_=n[4],v=n[7],y=n[2],x=n[5],b=n[8],R=i[0],T=i[3],M=i[6],w=i[1],D=i[4],U=i[7],F=i[2],O=i[5],z=i[8];return o[0]=l*R+h*w+d*F,o[3]=l*T+h*D+d*O,o[6]=l*M+h*U+d*z,o[1]=p*R+_*w+v*F,o[4]=p*T+_*D+v*O,o[7]=p*M+_*U+v*z,o[2]=y*R+x*w+b*F,o[5]=y*T+x*D+b*O,o[8]=y*M+x*U+b*z,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],h=e[5],d=e[6],p=e[7],_=e[8];return t*l*_-t*h*p-n*o*_+n*h*d+i*o*p-i*l*d}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],h=e[5],d=e[6],p=e[7],_=e[8],v=_*l-h*p,y=h*d-_*o,x=p*o-l*d,b=t*v+n*y+i*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/b;return e[0]=v*R,e[1]=(i*p-_*n)*R,e[2]=(h*n-i*l)*R,e[3]=y*R,e[4]=(_*t-i*d)*R,e[5]=(i*o-h*t)*R,e[6]=x*R,e[7]=(n*d-p*t)*R,e[8]=(l*t-n*o)*R,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,h){const d=Math.cos(o),p=Math.sin(o);return this.set(n*d,n*p,-n*(d*l+p*h)+l+e,-i*p,i*d,-i*(-p*l+d*h)+h+t,0,0,1),this}scale(e,t){return this.premultiply(hx.makeScale(e,t)),this}rotate(e){return this.premultiply(hx.makeRotation(-e)),this}translate(e,t){return this.premultiply(hx.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const hx=new mn,_b=new mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),yb=new mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function M2(){const s={enabled:!0,workingColorSpace:ta,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===ti&&(i.r=dl(i.r),i.g=dl(i.g),i.b=dl(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===ti&&(i.r=ih(i.r),i.g=ih(i.g),i.b=ih(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===hl?hp:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return th("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return th("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[ta]:{primaries:e,whitePoint:n,transfer:hp,toXYZ:_b,fromXYZ:yb,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Pi},outputColorSpaceConfig:{drawingBufferColorSpace:Pi}},[Pi]:{primaries:e,whitePoint:n,transfer:ti,toXYZ:_b,fromXYZ:yb,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Pi}}}),s}const Tn=M2();function dl(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function ih(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let ah;class xb{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ah===void 0&&(ah=pp("canvas")),ah.width=e.width,ah.height=e.height;const i=ah.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=ah}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=pp("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l<o.length;l++)o[l]=dl(o[l]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(dl(t[n]/255)*255):t[n]=dl(t[n]);return{data:t,width:e.width,height:e.height}}else return Et("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let b2=0;class dc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:b2++}),this.uuid=Qs(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let o;if(Array.isArray(i)){o=[];for(let l=0,h=i.length;l<h;l++)i[l].isDataTexture?o.push(dx(i[l].image)):o.push(dx(i[l]))}else o=dx(i);n.url=o}return t||(e.images[this.uuid]=n),n}}function dx(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?xb.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(Et("Texture: Unable to serialize Texture."),{})}let E2=0;const px=new Q;class qn extends Eo{constructor(e=qn.DEFAULT_IMAGE,t=qn.DEFAULT_MAPPING,n=yi,i=yi,o=bn,l=Is,h=ji,d=Ma,p=qn.DEFAULT_ANISOTROPY,_=hl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:E2++}),this.uuid=Qs(),this.name="",this.source=new dc(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=o,this.minFilter=l,this.anisotropy=p,this.format=h,this.internalFormat=null,this.type=d,this.offset=new et(0,0),this.repeat=new et(1,1),this.center=new et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new mn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=_,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(px).x}get height(){return this.source.getSize(px).y}get depth(){return this.source.getSize(px).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Et(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Et(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==rc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jr:e.x=e.x-Math.floor(e.x);break;case yi:e.x=e.x<0?0:1;break;case _u: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 Jr:e.y=e.y-Math.floor(e.y);break;case yi:e.y=e.y<0?0:1;break;case _u:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}qn.DEFAULT_IMAGE=null,qn.DEFAULT_MAPPING=rc,qn.DEFAULT_ANISOTROPY=1;class ci{constructor(e=0,t=0,n=0,i=1){ci.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const d=e.elements,p=d[0],_=d[4],v=d[8],y=d[1],x=d[5],b=d[9],R=d[2],T=d[6],M=d[10];if(Math.abs(_-y)<.01&&Math.abs(v-R)<.01&&Math.abs(b-T)<.01){if(Math.abs(_+y)<.1&&Math.abs(v+R)<.1&&Math.abs(b+T)<.1&&Math.abs(p+x+M-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const D=(p+1)/2,U=(x+1)/2,F=(M+1)/2,O=(_+y)/4,z=(v+R)/4,k=(b+T)/4;return D>U&&D>F?D<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(D),i=O/n,o=z/n):U>F?U<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(U),n=O/i,o=k/i):F<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(F),n=z/o,i=k/o),this.set(n,i,o,t),this}let w=Math.sqrt((T-b)*(T-b)+(v-R)*(v-R)+(y-_)*(y-_));return Math.abs(w)<.001&&(w=1),this.x=(T-b)/w,this.y=(v-R)/w,this.z=(y-_)/w,this.w=Math.acos((p+x+M-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=rn(this.x,e.x,t.x),this.y=rn(this.y,e.y,t.y),this.z=rn(this.z,e.z,t.z),this.w=rn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=rn(this.x,e,t),this.y=rn(this.y,e,t),this.z=rn(this.z,e,t),this.w=rn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class mx extends Eo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ci(0,0,e,t),this.scissorTest=!1,this.viewport=new ci(0,0,e,t);const i={width:e,height:t,depth:n.depth},o=new qn(i);this.textures=[];const l=n.count;for(let h=0;h<l;h++)this.textures[h]=o.clone(),this.textures[h].isRenderTargetTexture=!0,this.textures[h].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:bn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,o=this.textures.length;i<o;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new dc(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ds extends mx{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class T0 extends qn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xi,this.minFilter=xi,this.wrapR=yi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class T2 extends ds{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new T0(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class C0 extends qn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xi,this.minFilter=xi,this.wrapR=yi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class C2 extends ds{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new C0(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ea{constructor(e=new Q(1/0,1/0,1/0),t=new Q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const o=n.getAttribute("position");if(t===!0&&o!==void 0&&e.isInstancedMesh!==!0)for(let l=0,h=o.count;l<h;l++)e.isMesh===!0?e.getVertexPosition(l,qr):qr.fromBufferAttribute(o,l),qr.applyMatrix4(e.matrixWorld),this.expandByPoint(qr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),R0.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),R0.copy(n.boundingBox)),R0.applyMatrix4(e.matrixWorld),this.union(R0)}const i=e.children;for(let o=0,l=i.length;o<l;o++)this.expandByObject(i[o],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qr),qr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(vp),w0.subVectors(this.max,vp),sh.subVectors(e.a,vp),rh.subVectors(e.b,vp),oh.subVectors(e.c,vp),pc.subVectors(rh,sh),mc.subVectors(oh,rh),Cu.subVectors(sh,oh);let t=[0,-pc.z,pc.y,0,-mc.z,mc.y,0,-Cu.z,Cu.y,pc.z,0,-pc.x,mc.z,0,-mc.x,Cu.z,0,-Cu.x,-pc.y,pc.x,0,-mc.y,mc.x,0,-Cu.y,Cu.x,0];return!gx(t,sh,rh,oh,w0)||(t=[1,0,0,0,1,0,0,0,1],!gx(t,sh,rh,oh,w0))?!1:(B0.crossVectors(pc,mc),t=[B0.x,B0.y,B0.z],gx(t,sh,rh,oh,w0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qr).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:(pl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),pl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),pl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),pl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),pl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),pl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),pl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),pl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(pl),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const pl=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],qr=new Q,R0=new Ea,sh=new Q,rh=new Q,oh=new Q,pc=new Q,mc=new Q,Cu=new Q,vp=new Q,w0=new Q,B0=new Q,Ru=new Q;function gx(s,e,t,n,i){for(let o=0,l=s.length-3;o<=l;o+=3){Ru.fromArray(s,o);const h=i.x*Math.abs(Ru.x)+i.y*Math.abs(Ru.y)+i.z*Math.abs(Ru.z),d=e.dot(Ru),p=t.dot(Ru),_=n.dot(Ru);if(Math.max(-Math.max(d,p,_),Math.min(d,p,_))>h)return!1}return!0}const R2=new Ea,_p=new Q,vx=new Q;class ua{constructor(e=new Q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):R2.setFromPoints(e).getCenter(n);let i=0;for(let o=0,l=e.length;o<l;o++)i=Math.max(i,n.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_p.subVectors(e,this.center);const t=_p.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(_p,i/n),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):(vx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_p.copy(e.center).add(vx)),this.expandByPoint(_p.copy(e.center).sub(vx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const ml=new Q,_x=new Q,D0=new Q,gc=new Q,yx=new Q,U0=new Q,xx=new Q;class lh{constructor(e=new Q,t=new Q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ml)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ml.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ml.copy(this.origin).addScaledVector(this.direction,t),ml.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){_x.copy(e).add(t).multiplyScalar(.5),D0.copy(t).sub(e).normalize(),gc.copy(this.origin).sub(_x);const o=e.distanceTo(t)*.5,l=-this.direction.dot(D0),h=gc.dot(this.direction),d=-gc.dot(D0),p=gc.lengthSq(),_=Math.abs(1-l*l);let v,y,x,b;if(_>0)if(v=l*d-h,y=l*h-d,b=o*_,v>=0)if(y>=-b)if(y<=b){const R=1/_;v*=R,y*=R,x=v*(v+l*y+2*h)+y*(l*v+y+2*d)+p}else y=o,v=Math.max(0,-(l*y+h)),x=-v*v+y*(y+2*d)+p;else y=-o,v=Math.max(0,-(l*y+h)),x=-v*v+y*(y+2*d)+p;else y<=-b?(v=Math.max(0,-(-l*o+h)),y=v>0?-o:Math.min(Math.max(-o,-d),o),x=-v*v+y*(y+2*d)+p):y<=b?(v=0,y=Math.min(Math.max(-o,-d),o),x=y*(y+2*d)+p):(v=Math.max(0,-(l*o+h)),y=v>0?o:Math.min(Math.max(-o,-d),o),x=-v*v+y*(y+2*d)+p);else y=l>0?-o:o,v=Math.max(0,-(l*y+h)),x=-v*v+y*(y+2*d)+p;return n&&n.copy(this.origin).addScaledVector(this.direction,v),i&&i.copy(_x).addScaledVector(D0,y),x}intersectSphere(e,t){ml.subVectors(e.center,this.origin);const n=ml.dot(this.direction),i=ml.dot(ml)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),h=n-l,d=n+l;return d<0?null:h<0?this.at(d,t):this.at(h,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,h,d;const p=1/this.direction.x,_=1/this.direction.y,v=1/this.direction.z,y=this.origin;return p>=0?(n=(e.min.x-y.x)*p,i=(e.max.x-y.x)*p):(n=(e.max.x-y.x)*p,i=(e.min.x-y.x)*p),_>=0?(o=(e.min.y-y.y)*_,l=(e.max.y-y.y)*_):(o=(e.max.y-y.y)*_,l=(e.min.y-y.y)*_),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l<i||isNaN(i))&&(i=l),v>=0?(h=(e.min.z-y.z)*v,d=(e.max.z-y.z)*v):(h=(e.max.z-y.z)*v,d=(e.min.z-y.z)*v),n>d||h>i)||((h>n||n!==n)&&(n=h),(d<i||i!==i)&&(i=d),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ml)!==null}intersectTriangle(e,t,n,i,o){yx.subVectors(t,e),U0.subVectors(n,e),xx.crossVectors(yx,U0);let l=this.direction.dot(xx),h;if(l>0){if(i)return null;h=1}else if(l<0)h=-1,l=-l;else return null;gc.subVectors(this.origin,e);const d=h*this.direction.dot(U0.crossVectors(gc,U0));if(d<0)return null;const p=h*this.direction.dot(yx.cross(gc));if(p<0||d+p>l)return null;const _=-h*gc.dot(xx);return _<0?null:this.at(_/l,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 Qt{constructor(e,t,n,i,o,l,h,d,p,_,v,y,x,b,R,T){Qt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,h,d,p,_,v,y,x,b,R,T)}set(e,t,n,i,o,l,h,d,p,_,v,y,x,b,R,T){const M=this.elements;return M[0]=e,M[4]=t,M[8]=n,M[12]=i,M[1]=o,M[5]=l,M[9]=h,M[13]=d,M[2]=p,M[6]=_,M[10]=v,M[14]=y,M[3]=x,M[7]=b,M[11]=R,M[15]=T,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 Qt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/ch.setFromMatrixColumn(e,0).length(),o=1/ch.setFromMatrixColumn(e,1).length(),l=1/ch.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=0,t[8]=n[8]*l,t[9]=n[9]*l,t[10]=n[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,o=e.z,l=Math.cos(n),h=Math.sin(n),d=Math.cos(i),p=Math.sin(i),_=Math.cos(o),v=Math.sin(o);if(e.order==="XYZ"){const y=l*_,x=l*v,b=h*_,R=h*v;t[0]=d*_,t[4]=-d*v,t[8]=p,t[1]=x+b*p,t[5]=y-R*p,t[9]=-h*d,t[2]=R-y*p,t[6]=b+x*p,t[10]=l*d}else if(e.order==="YXZ"){const y=d*_,x=d*v,b=p*_,R=p*v;t[0]=y+R*h,t[4]=b*h-x,t[8]=l*p,t[1]=l*v,t[5]=l*_,t[9]=-h,t[2]=x*h-b,t[6]=R+y*h,t[10]=l*d}else if(e.order==="ZXY"){const y=d*_,x=d*v,b=p*_,R=p*v;t[0]=y-R*h,t[4]=-l*v,t[8]=b+x*h,t[1]=x+b*h,t[5]=l*_,t[9]=R-y*h,t[2]=-l*p,t[6]=h,t[10]=l*d}else if(e.order==="ZYX"){const y=l*_,x=l*v,b=h*_,R=h*v;t[0]=d*_,t[4]=b*p-x,t[8]=y*p+R,t[1]=d*v,t[5]=R*p+y,t[9]=x*p-b,t[2]=-p,t[6]=h*d,t[10]=l*d}else if(e.order==="YZX"){const y=l*d,x=l*p,b=h*d,R=h*p;t[0]=d*_,t[4]=R-y*v,t[8]=b*v+x,t[1]=v,t[5]=l*_,t[9]=-h*_,t[2]=-p*_,t[6]=x*v+b,t[10]=y-R*v}else if(e.order==="XZY"){const y=l*d,x=l*p,b=h*d,R=h*p;t[0]=d*_,t[4]=-v,t[8]=p*_,t[1]=y*v+R,t[5]=l*_,t[9]=x*v-b,t[2]=b*v-x,t[6]=h*_,t[10]=R*v+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(w2,e,B2)}lookAt(e,t,n){const i=this.elements;return $s.subVectors(e,t),$s.lengthSq()===0&&($s.z=1),$s.normalize(),vc.crossVectors(n,$s),vc.lengthSq()===0&&(Math.abs(n.z)===1?$s.x+=1e-4:$s.z+=1e-4,$s.normalize(),vc.crossVectors(n,$s)),vc.normalize(),N0.crossVectors($s,vc),i[0]=vc.x,i[4]=N0.x,i[8]=$s.x,i[1]=vc.y,i[5]=N0.y,i[9]=$s.y,i[2]=vc.z,i[6]=N0.z,i[10]=$s.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],h=n[4],d=n[8],p=n[12],_=n[1],v=n[5],y=n[9],x=n[13],b=n[2],R=n[6],T=n[10],M=n[14],w=n[3],D=n[7],U=n[11],F=n[15],O=i[0],z=i[4],k=i[8],N=i[12],I=i[1],W=i[5],ae=i[9],ie=i[13],se=i[2],_e=i[6],H=i[10],K=i[14],$=i[3],ue=i[7],re=i[11],X=i[15];return o[0]=l*O+h*I+d*se+p*$,o[4]=l*z+h*W+d*_e+p*ue,o[8]=l*k+h*ae+d*H+p*re,o[12]=l*N+h*ie+d*K+p*X,o[1]=_*O+v*I+y*se+x*$,o[5]=_*z+v*W+y*_e+x*ue,o[9]=_*k+v*ae+y*H+x*re,o[13]=_*N+v*ie+y*K+x*X,o[2]=b*O+R*I+T*se+M*$,o[6]=b*z+R*W+T*_e+M*ue,o[10]=b*k+R*ae+T*H+M*re,o[14]=b*N+R*ie+T*K+M*X,o[3]=w*O+D*I+U*se+F*$,o[7]=w*z+D*W+U*_e+F*ue,o[11]=w*k+D*ae+U*H+F*re,o[15]=w*N+D*ie+U*K+F*X,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],o=e[12],l=e[1],h=e[5],d=e[9],p=e[13],_=e[2],v=e[6],y=e[10],x=e[14],b=e[3],R=e[7],T=e[11],M=e[15],w=d*x-p*y,D=h*x-p*v,U=h*y-d*v,F=l*x-p*_,O=l*y-d*_,z=l*v-h*_;return t*(R*w-T*D+M*U)-n*(b*w-T*F+M*O)+i*(b*D-R*F+M*z)-o*(b*U-R*O+T*z)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],h=e[5],d=e[6],p=e[7],_=e[8],v=e[9],y=e[10],x=e[11],b=e[12],R=e[13],T=e[14],M=e[15],w=v*T*p-R*y*p+R*d*x-h*T*x-v*d*M+h*y*M,D=b*y*p-_*T*p-b*d*x+l*T*x+_*d*M-l*y*M,U=_*R*p-b*v*p+b*h*x-l*R*x-_*h*M+l*v*M,F=b*v*d-_*R*d-b*h*y+l*R*y+_*h*T-l*v*T,O=t*w+n*D+i*U+o*F;if(O===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/O;return e[0]=w*z,e[1]=(R*y*o-v*T*o-R*i*x+n*T*x+v*i*M-n*y*M)*z,e[2]=(h*T*o-R*d*o+R*i*p-n*T*p-h*i*M+n*d*M)*z,e[3]=(v*d*o-h*y*o-v*i*p+n*y*p+h*i*x-n*d*x)*z,e[4]=D*z,e[5]=(_*T*o-b*y*o+b*i*x-t*T*x-_*i*M+t*y*M)*z,e[6]=(b*d*o-l*T*o-b*i*p+t*T*p+l*i*M-t*d*M)*z,e[7]=(l*y*o-_*d*o+_*i*p-t*y*p-l*i*x+t*d*x)*z,e[8]=U*z,e[9]=(b*v*o-_*R*o-b*n*x+t*R*x+_*n*M-t*v*M)*z,e[10]=(l*R*o-b*h*o+b*n*p-t*R*p-l*n*M+t*h*M)*z,e[11]=(_*h*o-l*v*o-_*n*p+t*v*p+l*n*x-t*h*x)*z,e[12]=F*z,e[13]=(_*R*i-b*v*i+b*n*y-t*R*y-_*n*T+t*v*T)*z,e[14]=(b*h*i-l*R*i-b*n*d+t*R*d+l*n*T-t*h*T)*z,e[15]=(l*v*i-_*h*i+_*n*d-t*v*d-l*n*y+t*h*y)*z,this}scale(e){const t=this.elements,n=e.x,i=e.y,o=e.z;return t[0]*=n,t[4]*=i,t[8]*=o,t[1]*=n,t[5]*=i,t[9]*=o,t[2]*=n,t[6]*=i,t[10]*=o,t[3]*=n,t[7]*=i,t[11]*=o,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),o=1-n,l=e.x,h=e.y,d=e.z,p=o*l,_=o*h;return this.set(p*l+n,p*h-i*d,p*d+i*h,0,p*h+i*d,_*h+n,_*d-i*l,0,p*d-i*h,_*d+i*l,o*d*d+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,o,l){return this.set(1,n,o,0,e,1,l,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,o=t._x,l=t._y,h=t._z,d=t._w,p=o+o,_=l+l,v=h+h,y=o*p,x=o*_,b=o*v,R=l*_,T=l*v,M=h*v,w=d*p,D=d*_,U=d*v,F=n.x,O=n.y,z=n.z;return i[0]=(1-(R+M))*F,i[1]=(x+U)*F,i[2]=(b-D)*F,i[3]=0,i[4]=(x-U)*O,i[5]=(1-(y+M))*O,i[6]=(T+w)*O,i[7]=0,i[8]=(b+D)*z,i[9]=(T-w)*z,i[10]=(1-(y+R))*z,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let o=ch.set(i[0],i[1],i[2]).length();const l=ch.set(i[4],i[5],i[6]).length(),h=ch.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),Kr.copy(this);const p=1/o,_=1/l,v=1/h;return Kr.elements[0]*=p,Kr.elements[1]*=p,Kr.elements[2]*=p,Kr.elements[4]*=_,Kr.elements[5]*=_,Kr.elements[6]*=_,Kr.elements[8]*=v,Kr.elements[9]*=v,Kr.elements[10]*=v,t.setFromRotationMatrix(Kr),n.x=o,n.y=l,n.z=h,this}makePerspective(e,t,n,i,o,l,h=Zs,d=!1){const p=this.elements,_=2*o/(t-e),v=2*o/(n-i),y=(t+e)/(t-e),x=(n+i)/(n-i);let b,R;if(d)b=o/(l-o),R=l*o/(l-o);else if(h===Zs)b=-(l+o)/(l-o),R=-2*l*o/(l-o);else if(h===$f)b=-l/(l-o),R=-l*o/(l-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return p[0]=_,p[4]=0,p[8]=y,p[12]=0,p[1]=0,p[5]=v,p[9]=x,p[13]=0,p[2]=0,p[6]=0,p[10]=b,p[14]=R,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(e,t,n,i,o,l,h=Zs,d=!1){const p=this.elements,_=2/(t-e),v=2/(n-i),y=-(t+e)/(t-e),x=-(n+i)/(n-i);let b,R;if(d)b=1/(l-o),R=l/(l-o);else if(h===Zs)b=-2/(l-o),R=-(l+o)/(l-o);else if(h===$f)b=-1/(l-o),R=-o/(l-o);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return p[0]=_,p[4]=0,p[8]=0,p[12]=y,p[1]=0,p[5]=v,p[9]=0,p[13]=x,p[2]=0,p[6]=0,p[10]=b,p[14]=R,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const ch=new Q,Kr=new Qt,w2=new Q(0,0,0),B2=new Q(1,1,1),vc=new Q,N0=new Q,$s=new Q,Ab=new Qt,Sb=new ba;class er{constructor(e=0,t=0,n=0,i=er.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,o=i[0],l=i[4],h=i[8],d=i[1],p=i[5],_=i[9],v=i[2],y=i[6],x=i[10];switch(t){case"XYZ":this._y=Math.asin(rn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-_,x),this._z=Math.atan2(-l,o)):(this._x=Math.atan2(y,p),this._z=0);break;case"YXZ":this._x=Math.asin(-rn(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(h,x),this._z=Math.atan2(d,p)):(this._y=Math.atan2(-v,o),this._z=0);break;case"ZXY":this._x=Math.asin(rn(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-v,x),this._z=Math.atan2(-l,p)):(this._y=0,this._z=Math.atan2(d,o));break;case"ZYX":this._y=Math.asin(-rn(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(y,x),this._z=Math.atan2(d,o)):(this._x=0,this._z=Math.atan2(-l,p));break;case"YZX":this._z=Math.asin(rn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-_,p),this._y=Math.atan2(-v,o)):(this._x=0,this._y=Math.atan2(h,x));break;case"XZY":this._z=Math.asin(-rn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(y,p),this._y=Math.atan2(h,o)):(this._x=Math.atan2(-_,x),this._y=0);break;default:Et("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ab.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ab,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Sb.setFromEuler(this),this.setFromQuaternion(Sb,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}er.DEFAULT_ORDER="XYZ";class uh{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let D2=0;const Mb=new Q,fh=new ba,gl=new Qt,L0=new Q,yp=new Q,U2=new Q,N2=new ba,bb=new Q(1,0,0),Eb=new Q(0,1,0),Tb=new Q(0,0,1),Cb={type:"added"},L2={type:"removed"},hh={type:"childadded",child:null},Ax={type:"childremoved",child:null};class wn extends Eo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:D2++}),this.uuid=Qs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wn.DEFAULT_UP.clone();const e=new Q,t=new er,n=new ba,i=new Q(1,1,1);function o(){n.setFromEuler(t,!1)}function l(){t.setFromQuaternion(n,void 0,!1)}t._onChange(o),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Qt},normalMatrix:{value:new mn}}),this.matrix=new Qt,this.matrixWorld=new Qt,this.matrixAutoUpdate=wn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=wn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new uh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return fh.setFromAxisAngle(e,t),this.quaternion.multiply(fh),this}rotateOnWorldAxis(e,t){return fh.setFromAxisAngle(e,t),this.quaternion.premultiply(fh),this}rotateX(e){return this.rotateOnAxis(bb,e)}rotateY(e){return this.rotateOnAxis(Eb,e)}rotateZ(e){return this.rotateOnAxis(Tb,e)}translateOnAxis(e,t){return Mb.copy(e).applyQuaternion(this.quaternion),this.position.add(Mb.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(bb,e)}translateY(e){return this.translateOnAxis(Eb,e)}translateZ(e){return this.translateOnAxis(Tb,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(gl.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?L0.copy(e):L0.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),yp.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gl.lookAt(yp,L0,this.up):gl.lookAt(L0,yp,this.up),this.quaternion.setFromRotationMatrix(gl),i&&(gl.extractRotation(i.matrixWorld),fh.setFromRotationMatrix(gl),this.quaternion.premultiply(fh.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Wt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Cb),hh.child=e,this.dispatchEvent(hh),hh.child=null):Wt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(L2),Ax.child=e,this.dispatchEvent(Ax),Ax.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),gl.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),gl.multiply(e.parent.matrixWorld)),e.applyMatrix4(gl),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Cb),hh.child=e,this.dispatchEvent(hh),hh.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const l=this.children[n].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let o=0,l=i.length;o<l;o++)i[o].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yp,e,U2),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yp,N2,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let o=0,l=i.length;o<l;o++)i[o].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.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())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(h=>({...h,boundingBox:h.boundingBox?h.boundingBox.toJSON():void 0,boundingSphere:h.boundingSphere?h.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(h=>({...h})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(h,d){return h[d.uuid]===void 0&&(h[d.uuid]=d.toJSON(e)),d.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 h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){const d=h.shapes;if(Array.isArray(d))for(let p=0,_=d.length;p<_;p++){const v=d[p];o(e.shapes,v)}else o(e.shapes,d)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const h=[];for(let d=0,p=this.material.length;d<p;d++)h.push(o(e.materials,this.material[d]));i.material=h}else i.material=o(e.materials,this.material);if(this.children.length>0){i.children=[];for(let h=0;h<this.children.length;h++)i.children.push(this.children[h].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let h=0;h<this.animations.length;h++){const d=this.animations[h];i.animations.push(o(e.animations,d))}}if(t){const h=l(e.geometries),d=l(e.materials),p=l(e.textures),_=l(e.images),v=l(e.shapes),y=l(e.skeletons),x=l(e.animations),b=l(e.nodes);h.length>0&&(n.geometries=h),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),_.length>0&&(n.images=_),v.length>0&&(n.shapes=v),y.length>0&&(n.skeletons=y),x.length>0&&(n.animations=x),b.length>0&&(n.nodes=b)}return n.object=i,n;function l(h){const d=[];for(const p in h){const _=h[p];delete _.metadata,d.push(_)}return d}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}wn.DEFAULT_UP=new Q(0,1,0),wn.DEFAULT_MATRIX_AUTO_UPDATE=!0,wn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Wr=new Q,vl=new Q,Sx=new Q,_l=new Q,dh=new Q,ph=new Q,Rb=new Q,Mx=new Q,bx=new Q,Ex=new Q,Tx=new ci,Cx=new ci,Rx=new ci;class Fs{constructor(e=new Q,t=new Q,n=new Q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Wr.subVectors(e,t),i.cross(Wr);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Wr.subVectors(i,t),vl.subVectors(n,t),Sx.subVectors(e,t);const l=Wr.dot(Wr),h=Wr.dot(vl),d=Wr.dot(Sx),p=vl.dot(vl),_=vl.dot(Sx),v=l*p-h*h;if(v===0)return o.set(0,0,0),null;const y=1/v,x=(p*d-h*_)*y,b=(l*_-h*d)*y;return o.set(1-x-b,b,x)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,_l)===null?!1:_l.x>=0&&_l.y>=0&&_l.x+_l.y<=1}static getInterpolation(e,t,n,i,o,l,h,d){return this.getBarycoord(e,t,n,i,_l)===null?(d.x=0,d.y=0,"z"in d&&(d.z=0),"w"in d&&(d.w=0),null):(d.setScalar(0),d.addScaledVector(o,_l.x),d.addScaledVector(l,_l.y),d.addScaledVector(h,_l.z),d)}static getInterpolatedAttribute(e,t,n,i,o,l){return Tx.setScalar(0),Cx.setScalar(0),Rx.setScalar(0),Tx.fromBufferAttribute(e,t),Cx.fromBufferAttribute(e,n),Rx.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(Tx,o.x),l.addScaledVector(Cx,o.y),l.addScaledVector(Rx,o.z),l}static isFrontFacing(e,t,n,i){return Wr.subVectors(n,t),vl.subVectors(e,t),Wr.cross(vl).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 Wr.subVectors(this.c,this.b),vl.subVectors(this.a,this.b),Wr.cross(vl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(.3333333333333333)}getNormal(e){return Fs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Fs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return Fs.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return Fs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Fs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,h;dh.subVectors(i,n),ph.subVectors(o,n),Mx.subVectors(e,n);const d=dh.dot(Mx),p=ph.dot(Mx);if(d<=0&&p<=0)return t.copy(n);bx.subVectors(e,i);const _=dh.dot(bx),v=ph.dot(bx);if(_>=0&&v<=_)return t.copy(i);const y=d*v-_*p;if(y<=0&&d>=0&&_<=0)return l=d/(d-_),t.copy(n).addScaledVector(dh,l);Ex.subVectors(e,o);const x=dh.dot(Ex),b=ph.dot(Ex);if(b>=0&&x<=b)return t.copy(o);const R=x*p-d*b;if(R<=0&&p>=0&&b<=0)return h=p/(p-b),t.copy(n).addScaledVector(ph,h);const T=_*b-x*v;if(T<=0&&v-_>=0&&x-b>=0)return Rb.subVectors(o,i),h=(v-_)/(v-_+(x-b)),t.copy(i).addScaledVector(Rb,h);const M=1/(T+R+y);return l=R*M,h=y*M,t.copy(n).addScaledVector(dh,l).addScaledVector(ph,h)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const wb={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},_c={h:0,s:0,l:0},O0={h:0,s:0,l:0};function wx(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*6*(.6666666666666666-t):s}class At{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Pi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Tn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Tn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Tn.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Tn.workingColorSpace){if(e=ux(e,1),t=rn(t,0,1),n=rn(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=wx(l,o,e+.3333333333333333),this.g=wx(l,o,e),this.b=wx(l,o,e-.3333333333333333)}return Tn.colorSpaceToWorking(this,i),this}setStyle(e,t=Pi){function n(o){o!==void 0&&parseFloat(o)<1&&Et("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],h=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(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,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(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,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:Et("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);Et("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Pi){const n=wb[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Et("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=dl(e.r),this.g=dl(e.g),this.b=dl(e.b),this}copyLinearToSRGB(e){return this.r=ih(e.r),this.g=ih(e.g),this.b=ih(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Pi){return Tn.workingToColorSpace(Za.copy(this),e),Math.round(rn(Za.r*255,0,255))*65536+Math.round(rn(Za.g*255,0,255))*256+Math.round(rn(Za.b*255,0,255))}getHexString(e=Pi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Tn.workingColorSpace){Tn.workingToColorSpace(Za.copy(this),t);const n=Za.r,i=Za.g,o=Za.b,l=Math.max(n,i,o),h=Math.min(n,i,o);let d,p;const _=(h+l)/2;if(h===l)d=0,p=0;else{const v=l-h;switch(p=_<=.5?v/(l+h):v/(2-l-h),l){case n:d=(i-o)/v+(i<o?6:0);break;case i:d=(o-n)/v+2;break;case o:d=(n-i)/v+4;break}d/=6}return e.h=d,e.s=p,e.l=_,e}getRGB(e,t=Tn.workingColorSpace){return Tn.workingToColorSpace(Za.copy(this),t),e.r=Za.r,e.g=Za.g,e.b=Za.b,e}getStyle(e=Pi){Tn.workingToColorSpace(Za.copy(this),e);const t=Za.r,n=Za.g,i=Za.b;return e!==Pi?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(_c),this.setHSL(_c.h+e,_c.s+t,_c.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(_c),e.getHSL(O0);const n=gp(_c.h,O0.h,t),i=gp(_c.s,O0.s,t),o=gp(_c.l,O0.l,t);return this.setHSL(n,i,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,o=e.elements;return this.r=o[0]*t+o[3]*n+o[6]*i,this.g=o[1]*t+o[4]*n+o[7]*i,this.b=o[2]*t+o[5]*n+o[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Za=new At;At.NAMES=wb;let O2=0;class Gi extends Eo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:O2++}),this.uuid=Qs(),this.name="",this.type="Material",this.blending=gu,this.side=kr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Cg,this.blendDst=Rg,this.blendEquation=sc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new At(0,0,0),this.blendAlpha=0,this.depthFunc=vu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=lx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Eu,this.stencilZFail=Eu,this.stencilZPass=Eu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Et(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Et(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==gu&&(n.blending=this.blending),this.side!==kr&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Cg&&(n.blendSrc=this.blendSrc),this.blendDst!==Rg&&(n.blendDst=this.blendDst),this.blendEquation!==sc&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==vu&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==lx&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Eu&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Eu&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Eu&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const h in o){const d=o[h];delete d.metadata,l.push(d)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class fa extends Gi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new At(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=$d,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const yl=I2();function I2(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let d=0;d<256;++d){const p=d-127;p<-27?(n[d]=0,n[d|256]=32768,i[d]=24,i[d|256]=24):p<-14?(n[d]=1024>>-p-14,n[d|256]=1024>>-p-14|32768,i[d]=-p-1,i[d|256]=-p-1):p<=15?(n[d]=p+15<<10,n[d|256]=p+15<<10|32768,i[d]=13,i[d|256]=13):p<128?(n[d]=31744,n[d|256]=64512,i[d]=24,i[d|256]=24):(n[d]=31744,n[d|256]=64512,i[d]=13,i[d|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),h=new Uint32Array(64);for(let d=1;d<1024;++d){let p=d<<13,_=0;for(;(p&8388608)===0;)p<<=1,_-=8388608;p&=-8388609,_+=947912704,o[d]=p|_}for(let d=1024;d<2048;++d)o[d]=939524096+(d-1024<<13);for(let d=1;d<31;++d)l[d]=d<<23;l[31]=1199570944,l[32]=2147483648;for(let d=33;d<63;++d)l[d]=2147483648+(d-32<<23);l[63]=3347054592;for(let d=1;d<64;++d)d!==32&&(h[d]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:h}}function Hs(s){Math.abs(s)>65504&&Et("DataUtils.toHalfFloat(): Value out of range."),s=rn(s,-65504,65504),yl.floatView[0]=s;const e=yl.uint32View[0],t=e>>23&511;return yl.baseTable[t]+((e&8388607)>>yl.shiftTable[t])}function xp(s){const e=s>>10;return yl.uint32View[0]=yl.mantissaTable[yl.offsetTable[e]+(s&1023)]+yl.exponentTable[e],yl.floatView[0]}class wu{static toHalfFloat(e){return Hs(e)}static fromHalfFloat(e){return xp(e)}}const na=new Q,I0=new et;let F2=0;class Ln{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:F2++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=dp,this.updateRanges=[],this.gpuType=Ai,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;i<o;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)I0.fromBufferAttribute(this,t),I0.applyMatrix3(e),this.setXY(t,I0.x,I0.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.applyMatrix3(e),this.setXYZ(t,na.x,na.y,na.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.applyMatrix4(e),this.setXYZ(t,na.x,na.y,na.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.applyNormalMatrix(e),this.setXYZ(t,na.x,na.y,na.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.transformDirection(e),this.setXYZ(t,na.x,na.y,na.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=hs(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=yn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=hs(t,this.array)),t}setX(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=hs(t,this.array)),t}setY(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=hs(t,this.array)),t}setZ(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=hs(t,this.array)),t}setW(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array),o=yn(o,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==dp&&(e.usage=this.usage),e}}class H2 extends Ln{constructor(e,t,n){super(new Int8Array(e),t,n)}}class P2 extends Ln{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class G2 extends Ln{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class z2 extends Ln{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Bx extends Ln{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class V2 extends Ln{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Dx extends Ln{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class k2 extends Ln{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=xp(this.array[e*this.itemSize]);return this.normalized&&(t=hs(t,this.array)),t}setX(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize]=Hs(t),this}getY(e){let t=xp(this.array[e*this.itemSize+1]);return this.normalized&&(t=hs(t,this.array)),t}setY(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+1]=Hs(t),this}getZ(e){let t=xp(this.array[e*this.itemSize+2]);return this.normalized&&(t=hs(t,this.array)),t}setZ(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+2]=Hs(t),this}getW(e){let t=xp(this.array[e*this.itemSize+3]);return this.normalized&&(t=hs(t,this.array)),t}setW(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+3]=Hs(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array)),this.array[e+0]=Hs(t),this.array[e+1]=Hs(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array)),this.array[e+0]=Hs(t),this.array[e+1]=Hs(n),this.array[e+2]=Hs(i),this}setXYZW(e,t,n,i,o){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array),o=yn(o,this.array)),this.array[e+0]=Hs(t),this.array[e+1]=Hs(n),this.array[e+2]=Hs(i),this.array[e+3]=Hs(o),this}}class Ht extends Ln{constructor(e,t,n){super(new Float32Array(e),t,n)}}let X2=0;const gr=new Qt,Ux=new wn,mh=new Q,tr=new Ea,Ap=new Ea,Ta=new Q;class on extends Eo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:X2++}),this.uuid=Qs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(hb(e)?Dx:Bx)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new mn().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return gr.makeRotationFromQuaternion(e),this.applyMatrix4(gr),this}rotateX(e){return gr.makeRotationX(e),this.applyMatrix4(gr),this}rotateY(e){return gr.makeRotationY(e),this.applyMatrix4(gr),this}rotateZ(e){return gr.makeRotationZ(e),this.applyMatrix4(gr),this}translate(e,t,n){return gr.makeTranslation(e,t,n),this.applyMatrix4(gr),this}scale(e,t,n){return gr.makeScale(e,t,n),this.applyMatrix4(gr),this}lookAt(e){return Ux.lookAt(e),Ux.updateMatrix(),this.applyMatrix4(Ux.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(mh).negate(),this.translate(mh.x,mh.y,mh.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;i<o;i++){const l=e[i];n.push(l.x,l.y,l.z||0)}this.setAttribute("position",new Ht(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const o=e[i];t.setXYZ(i,o.x,o.y,o.z||0)}e.length>t.count&&Et("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ea);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Wt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Q(-1/0,-1/0,-1/0),new Q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const o=t[n];tr.setFromBufferAttribute(o),this.morphTargetsRelative?(Ta.addVectors(this.boundingBox.min,tr.min),this.boundingBox.expandByPoint(Ta),Ta.addVectors(this.boundingBox.max,tr.max),this.boundingBox.expandByPoint(Ta)):(this.boundingBox.expandByPoint(tr.min),this.boundingBox.expandByPoint(tr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Wt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ua);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Wt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Q,1/0);return}if(e){const n=this.boundingSphere.center;if(tr.setFromBufferAttribute(e),t)for(let o=0,l=t.length;o<l;o++){const h=t[o];Ap.setFromBufferAttribute(h),this.morphTargetsRelative?(Ta.addVectors(tr.min,Ap.min),tr.expandByPoint(Ta),Ta.addVectors(tr.max,Ap.max),tr.expandByPoint(Ta)):(tr.expandByPoint(Ap.min),tr.expandByPoint(Ap.max))}tr.getCenter(n);let i=0;for(let o=0,l=e.count;o<l;o++)Ta.fromBufferAttribute(e,o),i=Math.max(i,n.distanceToSquared(Ta));if(t)for(let o=0,l=t.length;o<l;o++){const h=t[o],d=this.morphTargetsRelative;for(let p=0,_=h.count;p<_;p++)Ta.fromBufferAttribute(h,p),d&&(mh.fromBufferAttribute(e,p),Ta.add(mh)),i=Math.max(i,n.distanceToSquared(Ta))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Wt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Wt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,o=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ln(new Float32Array(4*n.count),4));const l=this.getAttribute("tangent"),h=[],d=[];for(let k=0;k<n.count;k++)h[k]=new Q,d[k]=new Q;const p=new Q,_=new Q,v=new Q,y=new et,x=new et,b=new et,R=new Q,T=new Q;function M(k,N,I){p.fromBufferAttribute(n,k),_.fromBufferAttribute(n,N),v.fromBufferAttribute(n,I),y.fromBufferAttribute(o,k),x.fromBufferAttribute(o,N),b.fromBufferAttribute(o,I),_.sub(p),v.sub(p),x.sub(y),b.sub(y);const W=1/(x.x*b.y-b.x*x.y);isFinite(W)&&(R.copy(_).multiplyScalar(b.y).addScaledVector(v,-x.y).multiplyScalar(W),T.copy(v).multiplyScalar(x.x).addScaledVector(_,-b.x).multiplyScalar(W),h[k].add(R),h[N].add(R),h[I].add(R),d[k].add(T),d[N].add(T),d[I].add(T))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let k=0,N=w.length;k<N;++k){const I=w[k],W=I.start,ae=I.count;for(let ie=W,se=W+ae;ie<se;ie+=3)M(e.getX(ie+0),e.getX(ie+1),e.getX(ie+2))}const D=new Q,U=new Q,F=new Q,O=new Q;function z(k){F.fromBufferAttribute(i,k),O.copy(F);const N=h[k];D.copy(N),D.sub(F.multiplyScalar(F.dot(N))).normalize(),U.crossVectors(O,N);const W=U.dot(d[k])<0?-1:1;l.setXYZW(k,D.x,D.y,D.z,W)}for(let k=0,N=w.length;k<N;++k){const I=w[k],W=I.start,ae=I.count;for(let ie=W,se=W+ae;ie<se;ie+=3)z(e.getX(ie+0)),z(e.getX(ie+1)),z(e.getX(ie+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ln(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let y=0,x=n.count;y<x;y++)n.setXYZ(y,0,0,0);const i=new Q,o=new Q,l=new Q,h=new Q,d=new Q,p=new Q,_=new Q,v=new Q;if(e)for(let y=0,x=e.count;y<x;y+=3){const b=e.getX(y+0),R=e.getX(y+1),T=e.getX(y+2);i.fromBufferAttribute(t,b),o.fromBufferAttribute(t,R),l.fromBufferAttribute(t,T),_.subVectors(l,o),v.subVectors(i,o),_.cross(v),h.fromBufferAttribute(n,b),d.fromBufferAttribute(n,R),p.fromBufferAttribute(n,T),h.add(_),d.add(_),p.add(_),n.setXYZ(b,h.x,h.y,h.z),n.setXYZ(R,d.x,d.y,d.z),n.setXYZ(T,p.x,p.y,p.z)}else for(let y=0,x=t.count;y<x;y+=3)i.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),l.fromBufferAttribute(t,y+2),_.subVectors(l,o),v.subVectors(i,o),_.cross(v),n.setXYZ(y+0,_.x,_.y,_.z),n.setXYZ(y+1,_.x,_.y,_.z),n.setXYZ(y+2,_.x,_.y,_.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ta.fromBufferAttribute(e,t),Ta.normalize(),e.setXYZ(t,Ta.x,Ta.y,Ta.z)}toNonIndexed(){function e(h,d){const p=h.array,_=h.itemSize,v=h.normalized,y=new p.constructor(d.length*_);let x=0,b=0;for(let R=0,T=d.length;R<T;R++){h.isInterleavedBufferAttribute?x=d[R]*h.data.stride+h.offset:x=d[R]*_;for(let M=0;M<_;M++)y[b++]=p[x++]}return new Ln(y,_,v)}if(this.index===null)return Et("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new on,n=this.index.array,i=this.attributes;for(const h in i){const d=i[h],p=e(d,n);t.setAttribute(h,p)}const o=this.morphAttributes;for(const h in o){const d=[],p=o[h];for(let _=0,v=p.length;_<v;_++){const y=p[_],x=e(y,n);d.push(x)}t.morphAttributes[h]=d}t.morphTargetsRelative=this.morphTargetsRelative;const l=this.groups;for(let h=0,d=l.length;h<d;h++){const p=l[h];t.addGroup(p.start,p.count,p.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const d=this.parameters;for(const p in d)d[p]!==void 0&&(e[p]=d[p]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const d in n){const p=n[d];e.data.attributes[d]=p.toJSON(e.data)}const i={};let o=!1;for(const d in this.morphAttributes){const p=this.morphAttributes[d],_=[];for(let v=0,y=p.length;v<y;v++){const x=p[v];_.push(x.toJSON(e.data))}_.length>0&&(i[d]=_,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const h=this.boundingSphere;return h!==null&&(e.data.boundingSphere=h.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const p in i){const _=i[p];this.setAttribute(p,_.clone(t))}const o=e.morphAttributes;for(const p in o){const _=[],v=o[p];for(let y=0,x=v.length;y<x;y++)_.push(v[y].clone(t));this.morphAttributes[p]=_}this.morphTargetsRelative=e.morphTargetsRelative;const l=e.groups;for(let p=0,_=l.length;p<_;p++){const v=l[p];this.addGroup(v.start,v.count,v.materialIndex)}const h=e.boundingBox;h!==null&&(this.boundingBox=h.clone());const d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Bb=new Qt,Bu=new lh,F0=new ua,Db=new Q,H0=new Q,P0=new Q,G0=new Q,Nx=new Q,z0=new Q,Ub=new Q,V0=new Q;class pi extends wn{constructor(e=new on,t=new fa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o<l;o++){const h=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=o}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const h=this.morphTargetInfluences;if(o&&h){z0.set(0,0,0);for(let d=0,p=o.length;d<p;d++){const _=h[d],v=o[d];_!==0&&(Nx.fromBufferAttribute(v,e),l?z0.addScaledVector(Nx,_):z0.addScaledVector(Nx.sub(t),_))}t.add(z0)}return t}raycast(e,t){const n=this.geometry,i=this.material,o=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),F0.copy(n.boundingSphere),F0.applyMatrix4(o),Bu.copy(e.ray).recast(e.near),!(F0.containsPoint(Bu.origin)===!1&&(Bu.intersectSphere(F0,Db)===null||Bu.origin.distanceToSquared(Db)>(e.far-e.near)**2))&&(Bb.copy(o).invert(),Bu.copy(e.ray).applyMatrix4(Bb),!(n.boundingBox!==null&&Bu.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Bu)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,h=o.index,d=o.attributes.position,p=o.attributes.uv,_=o.attributes.uv1,v=o.attributes.normal,y=o.groups,x=o.drawRange;if(h!==null)if(Array.isArray(l))for(let b=0,R=y.length;b<R;b++){const T=y[b],M=l[T.materialIndex],w=Math.max(T.start,x.start),D=Math.min(h.count,Math.min(T.start+T.count,x.start+x.count));for(let U=w,F=D;U<F;U+=3){const O=h.getX(U),z=h.getX(U+1),k=h.getX(U+2);i=k0(this,M,e,n,p,_,v,O,z,k),i&&(i.faceIndex=Math.floor(U/3),i.face.materialIndex=T.materialIndex,t.push(i))}}else{const b=Math.max(0,x.start),R=Math.min(h.count,x.start+x.count);for(let T=b,M=R;T<M;T+=3){const w=h.getX(T),D=h.getX(T+1),U=h.getX(T+2);i=k0(this,l,e,n,p,_,v,w,D,U),i&&(i.faceIndex=Math.floor(T/3),t.push(i))}}else if(d!==void 0)if(Array.isArray(l))for(let b=0,R=y.length;b<R;b++){const T=y[b],M=l[T.materialIndex],w=Math.max(T.start,x.start),D=Math.min(d.count,Math.min(T.start+T.count,x.start+x.count));for(let U=w,F=D;U<F;U+=3){const O=U,z=U+1,k=U+2;i=k0(this,M,e,n,p,_,v,O,z,k),i&&(i.faceIndex=Math.floor(U/3),i.face.materialIndex=T.materialIndex,t.push(i))}}else{const b=Math.max(0,x.start),R=Math.min(d.count,x.start+x.count);for(let T=b,M=R;T<M;T+=3){const w=T,D=T+1,U=T+2;i=k0(this,l,e,n,p,_,v,w,D,U),i&&(i.faceIndex=Math.floor(T/3),t.push(i))}}}}function Y2(s,e,t,n,i,o,l,h){let d;if(e.side===fs?d=n.intersectTriangle(l,o,i,!0,h):d=n.intersectTriangle(i,o,l,e.side===kr,h),d===null)return null;V0.copy(h),V0.applyMatrix4(s.matrixWorld);const p=t.ray.origin.distanceTo(V0);return p<t.near||p>t.far?null:{distance:p,point:V0.clone(),object:s}}function k0(s,e,t,n,i,o,l,h,d,p){s.getVertexPosition(h,H0),s.getVertexPosition(d,P0),s.getVertexPosition(p,G0);const _=Y2(s,e,t,n,H0,P0,G0,Ub);if(_){const v=new Q;Fs.getBarycoord(Ub,H0,P0,G0,v),i&&(_.uv=Fs.getInterpolatedAttribute(i,h,d,p,v,new et)),o&&(_.uv1=Fs.getInterpolatedAttribute(o,h,d,p,v,new et)),l&&(_.normal=Fs.getInterpolatedAttribute(l,h,d,p,v,new Q),_.normal.dot(n.direction)>0&&_.normal.multiplyScalar(-1));const y={a:h,b:d,c:p,normal:new Q,materialIndex:0};Fs.getNormal(H0,P0,G0,y.normal),_.face=y,_.barycoord=v}return _}class Du extends on{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const h=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const d=[],p=[],_=[],v=[];let y=0,x=0;b("z","y","x",-1,-1,n,t,e,l,o,0),b("z","y","x",1,-1,n,t,-e,l,o,1),b("x","z","y",1,1,e,n,t,i,l,2),b("x","z","y",1,-1,e,n,-t,i,l,3),b("x","y","z",1,-1,e,t,n,i,o,4),b("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(d),this.setAttribute("position",new Ht(p,3)),this.setAttribute("normal",new Ht(_,3)),this.setAttribute("uv",new Ht(v,2));function b(R,T,M,w,D,U,F,O,z,k,N){const I=U/z,W=F/k,ae=U/2,ie=F/2,se=O/2,_e=z+1,H=k+1;let K=0,$=0;const ue=new Q;for(let re=0;re<H;re++){const X=re*W-ie;for(let ne=0;ne<_e;ne++){const Ae=ne*I-ae;ue[R]=Ae*w,ue[T]=X*D,ue[M]=se,p.push(ue.x,ue.y,ue.z),ue[R]=0,ue[T]=0,ue[M]=O>0?1:-1,_.push(ue.x,ue.y,ue.z),v.push(ne/z),v.push(1-re/k),K+=1}}for(let re=0;re<k;re++)for(let X=0;X<z;X++){const ne=y+X+_e*re,Ae=y+X+_e*(re+1),Re=y+(X+1)+_e*(re+1),rt=y+(X+1)+_e*re;d.push(ne,Ae,rt),d.push(Ae,Re,rt),$+=6}h.addGroup(x,$,N),x+=$,y+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Du(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function gh(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(Et("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function ps(s){const e={};for(let t=0;t<s.length;t++){const n=gh(s[t]);for(const i in n)e[i]=n[i]}return e}function J2(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Nb(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Tn.workingColorSpace}const Lb={clone:gh,merge:ps};var q2=`void main() {
|
|
9
|
+
`).replace(s4,"")}function wC(a,r){return r=RC(r),RC(a)===r}function oi(a,r,f,m,A,E){switch(f){case"children":typeof m=="string"?r==="body"||r==="textarea"&&m===""||Xi(a,m):(typeof m=="number"||typeof m=="bigint")&&r!=="body"&&Xi(a,""+m);break;case"className":It(a,"class",m);break;case"tabIndex":It(a,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":It(a,f,m);break;case"style":Bl(a,m,E);break;case"data":if(r!=="object"){It(a,"data",m);break}case"src":case"href":if(m===""&&(r!=="a"||f!=="href")){a.removeAttribute(f);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){a.removeAttribute(f);break}m=af(""+m),a.setAttribute(f,m);break;case"action":case"formAction":if(typeof m=="function"){a.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof E=="function"&&(f==="formAction"?(r!=="input"&&oi(a,r,"name",A.name,A,null),oi(a,r,"formEncType",A.formEncType,A,null),oi(a,r,"formMethod",A.formMethod,A,null),oi(a,r,"formTarget",A.formTarget,A,null)):(oi(a,r,"encType",A.encType,A,null),oi(a,r,"method",A.method,A,null),oi(a,r,"target",A.target,A,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){a.removeAttribute(f);break}m=af(""+m),a.setAttribute(f,m);break;case"onClick":m!=null&&(a.onclick=br);break;case"onScroll":m!=null&&Nn("scroll",a);break;case"onScrollEnd":m!=null&&Nn("scrollend",a);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(f=m.__html,f!=null){if(A.children!=null)throw Error(n(60));a.innerHTML=f}}break;case"multiple":a.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":a.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){a.removeAttribute("xlink:href");break}f=af(""+m),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,""+m):a.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":m===!0?a.setAttribute(f,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,m):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?a.setAttribute(f,m):a.removeAttribute(f);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?a.removeAttribute(f):a.setAttribute(f,m);break;case"popover":Nn("beforetoggle",a),Nn("toggle",a),ct(a,"popover",m);break;case"xlinkActuate":dt(a,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":dt(a,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":dt(a,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":dt(a,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":dt(a,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":dt(a,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":dt(a,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":dt(a,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":dt(a,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":ct(a,"is",m);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=g_.get(f)||f,ct(a,f,m))}}function iM(a,r,f,m,A,E){switch(f){case"style":Bl(a,m,E);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(f=m.__html,f!=null){if(A.children!=null)throw Error(n(60));a.innerHTML=f}}break;case"children":typeof m=="string"?Xi(a,m):(typeof m=="number"||typeof m=="bigint")&&Xi(a,""+m);break;case"onScroll":m!=null&&Nn("scroll",a);break;case"onScrollEnd":m!=null&&Nn("scrollend",a);break;case"onClick":m!=null&&(a.onclick=br);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fe.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(A=f.endsWith("Capture"),r=f.slice(2,A?f.length-7:void 0),E=a[G]||null,E=E!=null?E[f]:null,typeof E=="function"&&a.removeEventListener(r,E,A),typeof m=="function")){typeof E!="function"&&E!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(r,m,A);break e}f in a?a[f]=m:m===!0?a.setAttribute(f,""):ct(a,f,m)}}}function Ka(a,r,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Nn("error",a),Nn("load",a);var m=!1,A=!1,E;for(E in f)if(f.hasOwnProperty(E)){var L=f[E];if(L!=null)switch(E){case"src":m=!0;break;case"srcSet":A=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:oi(a,r,E,L,f,null)}}A&&oi(a,r,"srcSet",f.srcSet,f,null),m&&oi(a,r,"src",f.src,f,null);return;case"input":Nn("invalid",a);var Y=E=L=A=null,ce=null,Ce=null;for(m in f)if(f.hasOwnProperty(m)){var ke=f[m];if(ke!=null)switch(m){case"name":A=ke;break;case"type":L=ke;break;case"checked":ce=ke;break;case"defaultChecked":Ce=ke;break;case"value":E=ke;break;case"defaultValue":Y=ke;break;case"children":case"dangerouslySetInnerHTML":if(ke!=null)throw Error(n(137,r));break;default:oi(a,r,m,ke,f,null)}}aa(a,E,Y,ce,Ce,L,A,!1);return;case"select":Nn("invalid",a),m=L=E=null;for(A in f)if(f.hasOwnProperty(A)&&(Y=f[A],Y!=null))switch(A){case"value":E=Y;break;case"defaultValue":L=Y;break;case"multiple":m=Y;default:oi(a,r,A,Y,f,null)}r=E,f=L,a.multiple=!!m,r!=null?Ui(a,!!m,r,!1):f!=null&&Ui(a,!!m,f,!0);return;case"textarea":Nn("invalid",a),E=A=m=null;for(L in f)if(f.hasOwnProperty(L)&&(Y=f[L],Y!=null))switch(L){case"value":m=Y;break;case"defaultValue":A=Y;break;case"children":E=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(n(91));break;default:oi(a,r,L,Y,f,null)}Mi(a,m,A,E);return;case"option":for(ce in f)f.hasOwnProperty(ce)&&(m=f[ce],m!=null)&&(ce==="selected"?a.selected=m&&typeof m!="function"&&typeof m!="symbol":oi(a,r,ce,m,f,null));return;case"dialog":Nn("beforetoggle",a),Nn("toggle",a),Nn("cancel",a),Nn("close",a);break;case"iframe":case"object":Nn("load",a);break;case"video":case"audio":for(m=0;m<_g.length;m++)Nn(_g[m],a);break;case"image":Nn("error",a),Nn("load",a);break;case"details":Nn("toggle",a);break;case"embed":case"source":case"link":Nn("error",a),Nn("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Ce in f)if(f.hasOwnProperty(Ce)&&(m=f[Ce],m!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:oi(a,r,Ce,m,f,null)}return;default:if(_s(r)){for(ke in f)f.hasOwnProperty(ke)&&(m=f[ke],m!==void 0&&iM(a,r,ke,m,f,void 0));return}}for(Y in f)f.hasOwnProperty(Y)&&(m=f[Y],m!=null&&oi(a,r,Y,m,f,null))}function r4(a,r,f,m){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var A=null,E=null,L=null,Y=null,ce=null,Ce=null,ke=null;for(He in f){var $e=f[He];if(f.hasOwnProperty(He)&&$e!=null)switch(He){case"checked":break;case"value":break;case"defaultValue":ce=$e;default:m.hasOwnProperty(He)||oi(a,r,He,null,m,$e)}}for(var Ne in m){var He=m[Ne];if($e=f[Ne],m.hasOwnProperty(Ne)&&(He!=null||$e!=null))switch(Ne){case"type":E=He;break;case"name":A=He;break;case"checked":Ce=He;break;case"defaultChecked":ke=He;break;case"value":L=He;break;case"defaultValue":Y=He;break;case"children":case"dangerouslySetInnerHTML":if(He!=null)throw Error(n(137,r));break;default:He!==$e&&oi(a,r,Ne,He,m,$e)}}Yn(a,L,Y,ce,Ce,ke,E,A);return;case"select":He=L=Y=Ne=null;for(E in f)if(ce=f[E],f.hasOwnProperty(E)&&ce!=null)switch(E){case"value":break;case"multiple":He=ce;default:m.hasOwnProperty(E)||oi(a,r,E,null,m,ce)}for(A in m)if(E=m[A],ce=f[A],m.hasOwnProperty(A)&&(E!=null||ce!=null))switch(A){case"value":Ne=E;break;case"defaultValue":Y=E;break;case"multiple":L=E;default:E!==ce&&oi(a,r,A,E,m,ce)}r=Y,f=L,m=He,Ne!=null?Ui(a,!!f,Ne,!1):!!m!=!!f&&(r!=null?Ui(a,!!f,r,!0):Ui(a,!!f,f?[]:"",!1));return;case"textarea":He=Ne=null;for(Y in f)if(A=f[Y],f.hasOwnProperty(Y)&&A!=null&&!m.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:oi(a,r,Y,null,m,A)}for(L in m)if(A=m[L],E=f[L],m.hasOwnProperty(L)&&(A!=null||E!=null))switch(L){case"value":Ne=A;break;case"defaultValue":He=A;break;case"children":break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(n(91));break;default:A!==E&&oi(a,r,L,A,m,E)}Kn(a,Ne,He);return;case"option":for(var Gt in f)Ne=f[Gt],f.hasOwnProperty(Gt)&&Ne!=null&&!m.hasOwnProperty(Gt)&&(Gt==="selected"?a.selected=!1:oi(a,r,Gt,null,m,Ne));for(ce in m)Ne=m[ce],He=f[ce],m.hasOwnProperty(ce)&&Ne!==He&&(Ne!=null||He!=null)&&(ce==="selected"?a.selected=Ne&&typeof Ne!="function"&&typeof Ne!="symbol":oi(a,r,ce,Ne,m,He));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var nn in f)Ne=f[nn],f.hasOwnProperty(nn)&&Ne!=null&&!m.hasOwnProperty(nn)&&oi(a,r,nn,null,m,Ne);for(Ce in m)if(Ne=m[Ce],He=f[Ce],m.hasOwnProperty(Ce)&&Ne!==He&&(Ne!=null||He!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(n(137,r));break;default:oi(a,r,Ce,Ne,m,He)}return;default:if(_s(r)){for(var li in f)Ne=f[li],f.hasOwnProperty(li)&&Ne!==void 0&&!m.hasOwnProperty(li)&&iM(a,r,li,void 0,m,Ne);for(ke in m)Ne=m[ke],He=f[ke],!m.hasOwnProperty(ke)||Ne===He||Ne===void 0&&He===void 0||iM(a,r,ke,Ne,m,He);return}}for(var Me in f)Ne=f[Me],f.hasOwnProperty(Me)&&Ne!=null&&!m.hasOwnProperty(Me)&&oi(a,r,Me,null,m,Ne);for($e in m)Ne=m[$e],He=f[$e],!m.hasOwnProperty($e)||Ne===He||Ne==null&&He==null||oi(a,r,$e,Ne,m,He)}function BC(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o4(){if(typeof performance.getEntriesByType=="function"){for(var a=0,r=0,f=performance.getEntriesByType("resource"),m=0;m<f.length;m++){var A=f[m],E=A.transferSize,L=A.initiatorType,Y=A.duration;if(E&&Y&&BC(L)){for(L=0,Y=A.responseEnd,m+=1;m<f.length;m++){var ce=f[m],Ce=ce.startTime;if(Ce>Y)break;var ke=ce.transferSize,$e=ce.initiatorType;ke&&BC($e)&&(ce=ce.responseEnd,L+=ke*(ce<Y?1:(Y-Ce)/(ce-Ce)))}if(--m,r+=8*(E+L)/(A.duration/1e3),a++,10<a)break}}if(0<a)return r/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var aM=null,sM=null;function Ay(a){return a.nodeType===9?a:a.ownerDocument}function DC(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function UC(a,r){if(a===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&r==="foreignObject"?0:a}function rM(a,r){return a==="textarea"||a==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var oM=null;function l4(){var a=window.event;return a&&a.type==="popstate"?a===oM?!1:(oM=a,!0):(oM=null,!1)}var NC=typeof setTimeout=="function"?setTimeout:void 0,c4=typeof clearTimeout=="function"?clearTimeout:void 0,LC=typeof Promise=="function"?Promise:void 0,u4=typeof queueMicrotask=="function"?queueMicrotask:typeof LC<"u"?function(a){return LC.resolve(null).then(a).catch(f4)}:NC;function f4(a){setTimeout(function(){throw a})}function cu(a){return a==="head"}function OC(a,r){var f=r,m=0;do{var A=f.nextSibling;if(a.removeChild(f),A&&A.nodeType===8)if(f=A.data,f==="/$"||f==="/&"){if(m===0){a.removeChild(A),Kd(r);return}m--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")m++;else if(f==="html")xg(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,xg(f);for(var E=f.firstChild;E;){var L=E.nextSibling,Y=E.nodeName;E[Ue]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&E.rel.toLowerCase()==="stylesheet"||f.removeChild(E),E=L}}else f==="body"&&xg(a.ownerDocument.body);f=A}while(f);Kd(r)}function IC(a,r){var f=a;a=0;do{var m=f.nextSibling;if(f.nodeType===1?r?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(r?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),m&&m.nodeType===8)if(f=m.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=m}while(f)}function lM(a){var r=a.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var f=r;switch(r=r.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":lM(f),Ie(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function h4(a,r,f,m){for(;a.nodeType===1;){var A=f;if(a.nodeName.toLowerCase()!==r.toLowerCase()){if(!m&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(m){if(!a[Ue])switch(r){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(E=a.getAttribute("rel"),E==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(E!==A.rel||a.getAttribute("href")!==(A.href==null||A.href===""?null:A.href)||a.getAttribute("crossorigin")!==(A.crossOrigin==null?null:A.crossOrigin)||a.getAttribute("title")!==(A.title==null?null:A.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(E=a.getAttribute("src"),(E!==(A.src==null?null:A.src)||a.getAttribute("type")!==(A.type==null?null:A.type)||a.getAttribute("crossorigin")!==(A.crossOrigin==null?null:A.crossOrigin))&&E&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(r==="input"&&a.type==="hidden"){var E=A.name==null?null:""+A.name;if(A.type==="hidden"&&a.getAttribute("name")===E)return a}else return a;if(a=zr(a.nextSibling),a===null)break}return null}function d4(a,r,f){if(r==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=zr(a.nextSibling),a===null))return null;return a}function FC(a,r){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!r||(a=zr(a.nextSibling),a===null))return null;return a}function cM(a){return a.data==="$?"||a.data==="$~"}function uM(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function p4(a,r){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=r;else if(a.data!=="$?"||f.readyState!=="loading")r();else{var m=function(){r(),f.removeEventListener("DOMContentLoaded",m)};f.addEventListener("DOMContentLoaded",m),a._reactRetry=m}}function zr(a){for(;a!=null;a=a.nextSibling){var r=a.nodeType;if(r===1||r===3)break;if(r===8){if(r=a.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return a}var fM=null;function HC(a){a=a.nextSibling;for(var r=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(r===0)return zr(a.nextSibling);r--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||r++}a=a.nextSibling}return null}function PC(a){a=a.previousSibling;for(var r=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(r===0)return a;r--}else f!=="/$"&&f!=="/&"||r++}a=a.previousSibling}return null}function GC(a,r,f){switch(r=Ay(f),a){case"html":if(a=r.documentElement,!a)throw Error(n(452));return a;case"head":if(a=r.head,!a)throw Error(n(453));return a;case"body":if(a=r.body,!a)throw Error(n(454));return a;default:throw Error(n(451))}}function xg(a){for(var r=a.attributes;r.length;)a.removeAttributeNode(r[0]);Ie(a)}var Vr=new Map,zC=new Set;function Sy(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var ac=K.d;K.d={f:m4,r:g4,D:v4,C:_4,L:y4,m:x4,X:S4,S:A4,M:M4};function m4(){var a=ac.f(),r=J();return a||r}function g4(a){var r=Pe(a);r!==null&&r.tag===5&&r.type==="form"?cg(r):ac.r(a)}var Yd=typeof document>"u"?null:document;function VC(a,r,f){var m=Yd;if(m&&typeof r=="string"&&r){var A=Ct(r);A='link[rel="'+a+'"][href="'+A+'"]',typeof f=="string"&&(A+='[crossorigin="'+f+'"]'),zC.has(A)||(zC.add(A),a={rel:a,crossOrigin:f,href:r},m.querySelector(A)===null&&(r=m.createElement("link"),Ka(r,"link",a),V(r),m.head.appendChild(r)))}}function v4(a){ac.D(a),VC("dns-prefetch",a,null)}function _4(a,r){ac.C(a,r),VC("preconnect",a,r)}function y4(a,r,f){ac.L(a,r,f);var m=Yd;if(m&&a&&r){var A='link[rel="preload"][as="'+Ct(r)+'"]';r==="image"&&f&&f.imageSrcSet?(A+='[imagesrcset="'+Ct(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(A+='[imagesizes="'+Ct(f.imageSizes)+'"]')):A+='[href="'+Ct(a)+'"]';var E=A;switch(r){case"style":E=Jd(a);break;case"script":E=qd(a)}Vr.has(E)||(a=v({rel:"preload",href:r==="image"&&f&&f.imageSrcSet?void 0:a,as:r},f),Vr.set(E,a),m.querySelector(A)!==null||r==="style"&&m.querySelector(Ag(E))||r==="script"&&m.querySelector(Sg(E))||(r=m.createElement("link"),Ka(r,"link",a),V(r),m.head.appendChild(r)))}}function x4(a,r){ac.m(a,r);var f=Yd;if(f&&a){var m=r&&typeof r.as=="string"?r.as:"script",A='link[rel="modulepreload"][as="'+Ct(m)+'"][href="'+Ct(a)+'"]',E=A;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=qd(a)}if(!Vr.has(E)&&(a=v({rel:"modulepreload",href:a},r),Vr.set(E,a),f.querySelector(A)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sg(E)))return}m=f.createElement("link"),Ka(m,"link",a),V(m),f.head.appendChild(m)}}}function A4(a,r,f){ac.S(a,r,f);var m=Yd;if(m&&a){var A=Je(m).hoistableStyles,E=Jd(a);r=r||"default";var L=A.get(E);if(!L){var Y={loading:0,preload:null};if(L=m.querySelector(Ag(E)))Y.loading=5;else{a=v({rel:"stylesheet",href:a,"data-precedence":r},f),(f=Vr.get(E))&&hM(a,f);var ce=L=m.createElement("link");V(ce),Ka(ce,"link",a),ce._p=new Promise(function(Ce,ke){ce.onload=Ce,ce.onerror=ke}),ce.addEventListener("load",function(){Y.loading|=1}),ce.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,My(L,r,m)}L={type:"stylesheet",instance:L,count:1,state:Y},A.set(E,L)}}}function S4(a,r){ac.X(a,r);var f=Yd;if(f&&a){var m=Je(f).hoistableScripts,A=qd(a),E=m.get(A);E||(E=f.querySelector(Sg(A)),E||(a=v({src:a,async:!0},r),(r=Vr.get(A))&&dM(a,r),E=f.createElement("script"),V(E),Ka(E,"link",a),f.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},m.set(A,E))}}function M4(a,r){ac.M(a,r);var f=Yd;if(f&&a){var m=Je(f).hoistableScripts,A=qd(a),E=m.get(A);E||(E=f.querySelector(Sg(A)),E||(a=v({src:a,async:!0,type:"module"},r),(r=Vr.get(A))&&dM(a,r),E=f.createElement("script"),V(E),Ka(E,"link",a),f.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},m.set(A,E))}}function kC(a,r,f,m){var A=(A=ve.current)?Sy(A):null;if(!A)throw Error(n(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(r=Jd(f.href),f=Je(A).hoistableStyles,m=f.get(r),m||(m={type:"style",instance:null,count:0,state:null},f.set(r,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=Jd(f.href);var E=Je(A).hoistableStyles,L=E.get(a);if(L||(A=A.ownerDocument||A,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(a,L),(E=A.querySelector(Ag(a)))&&!E._p&&(L.instance=E,L.state.loading=5),Vr.has(a)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},Vr.set(a,f),E||b4(A,a,f,L.state))),r&&m===null)throw Error(n(528,""));return L}if(r&&m!==null)throw Error(n(529,""));return null;case"script":return r=f.async,f=f.src,typeof f=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=qd(f),f=Je(A).hoistableScripts,m=f.get(r),m||(m={type:"script",instance:null,count:0,state:null},f.set(r,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,a))}}function Jd(a){return'href="'+Ct(a)+'"'}function Ag(a){return'link[rel="stylesheet"]['+a+"]"}function XC(a){return v({},a,{"data-precedence":a.precedence,precedence:null})}function b4(a,r,f,m){a.querySelector('link[rel="preload"][as="style"]['+r+"]")?m.loading=1:(r=a.createElement("link"),m.preload=r,r.addEventListener("load",function(){return m.loading|=1}),r.addEventListener("error",function(){return m.loading|=2}),Ka(r,"link",f),V(r),a.head.appendChild(r))}function qd(a){return'[src="'+Ct(a)+'"]'}function Sg(a){return"script[async]"+a}function YC(a,r,f){if(r.count++,r.instance===null)switch(r.type){case"style":var m=a.querySelector('style[data-href~="'+Ct(f.href)+'"]');if(m)return r.instance=m,V(m),m;var A=v({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return m=(a.ownerDocument||a).createElement("style"),V(m),Ka(m,"style",A),My(m,f.precedence,a),r.instance=m;case"stylesheet":A=Jd(f.href);var E=a.querySelector(Ag(A));if(E)return r.state.loading|=4,r.instance=E,V(E),E;m=XC(f),(A=Vr.get(A))&&hM(m,A),E=(a.ownerDocument||a).createElement("link"),V(E);var L=E;return L._p=new Promise(function(Y,ce){L.onload=Y,L.onerror=ce}),Ka(E,"link",m),r.state.loading|=4,My(E,f.precedence,a),r.instance=E;case"script":return E=qd(f.src),(A=a.querySelector(Sg(E)))?(r.instance=A,V(A),A):(m=f,(A=Vr.get(E))&&(m=v({},f),dM(m,A)),a=a.ownerDocument||a,A=a.createElement("script"),V(A),Ka(A,"link",m),a.head.appendChild(A),r.instance=A);case"void":return null;default:throw Error(n(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(m=r.instance,r.state.loading|=4,My(m,f.precedence,a));return r.instance}function My(a,r,f){for(var m=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),A=m.length?m[m.length-1]:null,E=A,L=0;L<m.length;L++){var Y=m[L];if(Y.dataset.precedence===r)E=Y;else if(E!==A)break}E?E.parentNode.insertBefore(a,E.nextSibling):(r=f.nodeType===9?f.head:f,r.insertBefore(a,r.firstChild))}function hM(a,r){a.crossOrigin==null&&(a.crossOrigin=r.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=r.referrerPolicy),a.title==null&&(a.title=r.title)}function dM(a,r){a.crossOrigin==null&&(a.crossOrigin=r.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=r.referrerPolicy),a.integrity==null&&(a.integrity=r.integrity)}var by=null;function JC(a,r,f){if(by===null){var m=new Map,A=by=new Map;A.set(f,m)}else A=by,m=A.get(f),m||(m=new Map,A.set(f,m));if(m.has(a))return m;for(m.set(a,null),f=f.getElementsByTagName(a),A=0;A<f.length;A++){var E=f[A];if(!(E[Ue]||E[ln]||a==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var L=E.getAttribute(r)||"";L=a+L;var Y=m.get(L);Y?Y.push(E):m.set(L,[E])}}return m}function qC(a,r,f){a=a.ownerDocument||a,a.head.insertBefore(f,r==="title"?a.querySelector("head > title"):null)}function E4(a,r,f){if(f===1||r.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(a=r.disabled,typeof r.precedence=="string"&&a==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function KC(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function T4(a,r,f,m){if(f.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var A=Jd(m.href),E=r.querySelector(Ag(A));if(E){r=E._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(a.count++,a=Ey.bind(a),r.then(a,a)),f.state.loading|=4,f.instance=E,V(E);return}E=r.ownerDocument||r,m=XC(m),(A=Vr.get(A))&&hM(m,A),E=E.createElement("link"),V(E);var L=E;L._p=new Promise(function(Y,ce){L.onload=Y,L.onerror=ce}),Ka(E,"link",m),f.instance=E}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,r),(r=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=Ey.bind(a),r.addEventListener("load",f),r.addEventListener("error",f))}}var pM=0;function C4(a,r){return a.stylesheets&&a.count===0&&Cy(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var m=setTimeout(function(){if(a.stylesheets&&Cy(a,a.stylesheets),a.unsuspend){var E=a.unsuspend;a.unsuspend=null,E()}},6e4+r);0<a.imgBytes&&pM===0&&(pM=62500*o4());var A=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Cy(a,a.stylesheets),a.unsuspend)){var E=a.unsuspend;a.unsuspend=null,E()}},(a.imgBytes>pM?50:800)+r);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(m),clearTimeout(A)}}:null}function Ey(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cy(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Ty=null;function Cy(a,r){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Ty=new Map,r.forEach(R4,a),Ty=null,Ey.call(a))}function R4(a,r){if(!(r.state.loading&4)){var f=Ty.get(a);if(f)var m=f.get(null);else{f=new Map,Ty.set(a,f);for(var A=a.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<A.length;E++){var L=A[E];(L.nodeName==="LINK"||L.getAttribute("media")!=="not all")&&(f.set(L.dataset.precedence,L),m=L)}m&&f.set(null,m)}A=r.instance,L=A.getAttribute("data-precedence"),E=f.get(L)||m,E===m&&f.set(null,A),f.set(L,A),this.count++,m=Ey.bind(this),A.addEventListener("load",m),A.addEventListener("error",m),E?E.parentNode.insertBefore(A,E.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(A,a.firstChild)),r.state.loading|=4}}var Mg={$$typeof:D,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function w4(a,r,f,m,A,E,L,Y,ce){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=dn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dn(0),this.hiddenUpdates=dn(null),this.identifierPrefix=m,this.onUncaughtError=A,this.onCaughtError=E,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ce,this.incompleteTransitions=new Map}function WC(a,r,f,m,A,E,L,Y,ce,Ce,ke,$e){return a=new w4(a,r,f,L,ce,Ce,ke,$e,Y),r=1,E===!0&&(r|=24),E=Va(3,null,null,r),a.current=E,E.stateNode=a,r=Dm(),r.refCount++,a.pooledCache=r,r.refCount++,E.memoizedState={element:m,isDehydrated:f,cache:r},Fm(E),a}function jC(a){return a?(a=qo,a):qo}function ZC(a,r,f,m,A,E){A=jC(A),m.context===null?m.context=A:m.pendingContext=A,m=Ur(r),m.payload={element:f},E=E===void 0?null:E,E!==null&&(m.callback=E),f=fo(a,m,r),f!==null&&(u(f,a,r),tl(f,a,r))}function QC(a,r){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<r?f:r}}function mM(a,r){QC(a,r),(a=a.alternate)&&QC(a,r)}function $C(a){if(a.tag===13||a.tag===31){var r=Jo(a,67108864);r!==null&&u(r,a,67108864),mM(a,67108864)}}function eR(a){if(a.tag===13||a.tag===31){var r=qa();r=wa(r);var f=Jo(a,r);f!==null&&u(f,a,r),mM(a,r)}}var Ry=!0;function B4(a,r,f,m){var A=H.T;H.T=null;var E=K.p;try{K.p=2,gM(a,r,f,m)}finally{K.p=E,H.T=A}}function D4(a,r,f,m){var A=H.T;H.T=null;var E=K.p;try{K.p=8,gM(a,r,f,m)}finally{K.p=E,H.T=A}}function gM(a,r,f,m){if(Ry){var A=vM(m);if(A===null)nM(a,r,m,wy,f),nR(a,m);else if(N4(A,a,r,f,m))m.stopPropagation();else if(nR(a,m),r&4&&-1<U4.indexOf(a)){for(;A!==null;){var E=Pe(A);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var L=it(E.pendingLanes);if(L!==0){var Y=E;for(Y.pendingLanes|=2,Y.entangledLanes|=2;L;){var ce=1<<31-yt(L);Y.entanglements[1]|=ce,L&=~ce}ul(E),(On&6)===0&&(Ls=P()+500,vg(0))}}break;case 31:case 13:Y=Jo(E,2),Y!==null&&u(Y,E,2),J(),mM(E,2)}if(E=vM(m),E===null&&nM(a,r,m,wy,f),E===A)break;A=E}A!==null&&m.stopPropagation()}else nM(a,r,m,null,f)}}function vM(a){return a=Xh(a),_M(a)}var wy=null;function _M(a){if(wy=null,a=ze(a),a!==null){var r=o(a);if(r===null)a=null;else{var f=r.tag;if(f===13){if(a=l(r),a!==null)return a;a=null}else if(f===31){if(a=h(r),a!==null)return a;a=null}else if(f===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;a=null}else r!==a&&(a=null)}}return wy=a,null}function tR(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(me()){case Le:return 2;case Xe:return 8;case Fe:case Bt:return 32;case _t:return 268435456;default:return 32}default:return 32}}var yM=!1,uu=null,fu=null,hu=null,bg=new Map,Eg=new Map,du=[],U4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function nR(a,r){switch(a){case"focusin":case"focusout":uu=null;break;case"dragenter":case"dragleave":fu=null;break;case"mouseover":case"mouseout":hu=null;break;case"pointerover":case"pointerout":bg.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Eg.delete(r.pointerId)}}function Tg(a,r,f,m,A,E){return a===null||a.nativeEvent!==E?(a={blockedOn:r,domEventName:f,eventSystemFlags:m,nativeEvent:E,targetContainers:[A]},r!==null&&(r=Pe(r),r!==null&&$C(r)),a):(a.eventSystemFlags|=m,r=a.targetContainers,A!==null&&r.indexOf(A)===-1&&r.push(A),a)}function N4(a,r,f,m,A){switch(r){case"focusin":return uu=Tg(uu,a,r,f,m,A),!0;case"dragenter":return fu=Tg(fu,a,r,f,m,A),!0;case"mouseover":return hu=Tg(hu,a,r,f,m,A),!0;case"pointerover":var E=A.pointerId;return bg.set(E,Tg(bg.get(E)||null,a,r,f,m,A)),!0;case"gotpointercapture":return E=A.pointerId,Eg.set(E,Tg(Eg.get(E)||null,a,r,f,m,A)),!0}return!1}function iR(a){var r=ze(a.target);if(r!==null){var f=o(r);if(f!==null){if(r=f.tag,r===13){if(r=l(f),r!==null){a.blockedOn=r,qt(a.priority,function(){eR(f)});return}}else if(r===31){if(r=h(f),r!==null){a.blockedOn=r,qt(a.priority,function(){eR(f)});return}}else if(r===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function By(a){if(a.blockedOn!==null)return!1;for(var r=a.targetContainers;0<r.length;){var f=vM(a.nativeEvent);if(f===null){f=a.nativeEvent;var m=new f.constructor(f.type,f);sf=m,f.target.dispatchEvent(m),sf=null}else return r=Pe(f),r!==null&&$C(r),a.blockedOn=f,!1;r.shift()}return!0}function aR(a,r,f){By(a)&&f.delete(r)}function L4(){yM=!1,uu!==null&&By(uu)&&(uu=null),fu!==null&&By(fu)&&(fu=null),hu!==null&&By(hu)&&(hu=null),bg.forEach(aR),Eg.forEach(aR)}function Dy(a,r){a.blockedOn===r&&(a.blockedOn=null,yM||(yM=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,L4)))}var Uy=null;function sR(a){Uy!==a&&(Uy=a,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Uy===a&&(Uy=null);for(var r=0;r<a.length;r+=3){var f=a[r],m=a[r+1],A=a[r+2];if(typeof m!="function"){if(_M(m||f)===null)continue;break}var E=Pe(f);E!==null&&(a.splice(r,3),r-=3,lg(E,{pending:!0,data:A,method:f.method,action:m},m,A))}}))}function Kd(a){function r(ce){return Dy(ce,a)}uu!==null&&Dy(uu,a),fu!==null&&Dy(fu,a),hu!==null&&Dy(hu,a),bg.forEach(r),Eg.forEach(r);for(var f=0;f<du.length;f++){var m=du[f];m.blockedOn===a&&(m.blockedOn=null)}for(;0<du.length&&(f=du[0],f.blockedOn===null);)iR(f),f.blockedOn===null&&du.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(m=0;m<f.length;m+=3){var A=f[m],E=f[m+1],L=A[G]||null;if(typeof E=="function")L||sR(f);else if(L){var Y=null;if(E&&E.hasAttribute("formAction")){if(A=E,L=E[G]||null)Y=L.formAction;else if(_M(A)!==null)continue}else Y=L.action;typeof Y=="function"?f[m+1]=Y:(f.splice(m,3),m-=3),sR(f)}}}function rR(){function a(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(L){return A=L})},focusReset:"manual",scroll:"manual"})}function r(){A!==null&&(A(),A=null),m||setTimeout(f,20)}function f(){if(!m&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,A=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(f,100),function(){m=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),A!==null&&(A(),A=null)}}}function xM(a){this._internalRoot=a}Ny.prototype.render=xM.prototype.render=function(a){var r=this._internalRoot;if(r===null)throw Error(n(409));var f=r.current,m=qa();ZC(f,m,a,r,null,null)},Ny.prototype.unmount=xM.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var r=a.containerInfo;ZC(a.current,2,null,a,null,null),J(),r[q]=null}};function Ny(a){this._internalRoot=a}Ny.prototype.unstable_scheduleHydration=function(a){if(a){var r=gi();a={blockedOn:null,target:a,priority:r};for(var f=0;f<du.length&&r!==0&&r<du[f].priority;f++);du.splice(f,0,a),f===0&&iR(a)}};var oR=e.version;if(oR!=="19.2.3")throw Error(n(527,oR,"19.2.3"));K.findDOMNode=function(a){var r=a._reactInternals;if(r===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=p(r),a=a!==null?_(a):null,a=a===null?null:a.stateNode,a};var O4={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ly=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ly.isDisabled&&Ly.supportsFiber)try{Ke=Ly.inject(O4),Qe=Ly}catch{}}return Wd.createRoot=function(a,r){if(!i(a))throw Error(n(299));var f=!1,m="",A=hg,E=hy,L=Dd;return r!=null&&(r.unstable_strictMode===!0&&(f=!0),r.identifierPrefix!==void 0&&(m=r.identifierPrefix),r.onUncaughtError!==void 0&&(A=r.onUncaughtError),r.onCaughtError!==void 0&&(E=r.onCaughtError),r.onRecoverableError!==void 0&&(L=r.onRecoverableError)),r=WC(a,1,!1,null,null,f,m,null,A,E,L,rR),a[q]=r.current,tM(a),new xM(r)},Wd.hydrateRoot=function(a,r,f){if(!i(a))throw Error(n(299));var m=!1,A="",E=hg,L=hy,Y=Dd,ce=null;return f!=null&&(f.unstable_strictMode===!0&&(m=!0),f.identifierPrefix!==void 0&&(A=f.identifierPrefix),f.onUncaughtError!==void 0&&(E=f.onUncaughtError),f.onCaughtError!==void 0&&(L=f.onCaughtError),f.onRecoverableError!==void 0&&(Y=f.onRecoverableError),f.formState!==void 0&&(ce=f.formState)),r=WC(a,1,!0,r,f??null,m,A,ce,E,L,Y,rR),r.context=jC(null),f=r.current,m=qa(),m=wa(m),A=Ur(m),A.callback=null,fo(f,A,m),f=m,r.current.lanes=f,Di(r,f),ul(r),a[q]=r.current,tM(a),new Ny(r)},Wd.version="19.2.3",Wd}var wM;function pR(){if(wM)return Hy.exports;wM=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),Hy.exports=dR(),Hy.exports}var mR=pR(),Vy={exports:{}},jd={};var BM;function gR(){if(BM)return jd;BM=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,o){var l=null;if(o!==void 0&&(l=""+o),i.key!==void 0&&(l=""+i.key),"key"in i){o={};for(var h in i)h!=="key"&&(o[h]=i[h])}else o=i;return i=o.ref,{$$typeof:s,type:n,key:l,ref:i!==void 0?i:null,props:o}}return jd.Fragment=e,jd.jsx=t,jd.jsxs=t,jd}var DM;function vR(){return DM||(DM=1,Vy.exports=gR()),Vy.exports}var Ht=vR();function ky(){return ky=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},ky.apply(null,arguments)}const Zd="182",_R={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yR={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},UM=0,Xy=1,NM=2,xR=3,LM=0,Kf=1,Qd=2,mu=3,kr=0,fs=1,Ws=2,Xr=0,gu=1,Yy=2,Jy=3,qy=4,OM=5,sc=100,IM=101,FM=102,HM=103,PM=104,GM=200,zM=201,VM=202,kM=203,Cg=204,Rg=205,XM=206,YM=207,JM=208,qM=209,KM=210,WM=211,jM=212,ZM=213,QM=214,wg=0,Bg=1,Dg=2,vu=3,Ug=4,Ng=5,Lg=6,Og=7,$d=0,$M=1,eb=2,mr=0,Ky=1,Wy=2,jy=3,Ig=4,Zy=5,Qy=6,$y=7,ex="attached",tb="detached",rc=300,Yr=301,oc=302,Wf=303,ep=304,jf=306,Jr=1e3,yi=1001,_u=1002,xi=1003,tp=1004,AR=1004,lc=1005,SR=1005,bn=1006,yu=1007,MR=1007,Is=1008,tx=1008,Ma=1009,Fg=1010,Hg=1011,Zf=1012,np=1013,js=1014,Ai=1015,Hi=1016,Pg=1017,Gg=1018,Qf=1020,nx=35902,ix=35899,ax=1021,sx=1022,ji=1023,bo=1026,cc=1027,ip=1028,ap=1029,xu=1030,zg=1031,bR=1032,Vg=1033,sp=33776,rp=33777,op=33778,lp=33779,kg=35840,Xg=35841,Yg=35842,Jg=35843,qg=36196,Kg=37492,Wg=37496,jg=37488,Zg=37489,Qg=37490,$g=37491,e0=37808,t0=37809,n0=37810,i0=37811,a0=37812,s0=37813,r0=37814,o0=37815,l0=37816,c0=37817,u0=37818,f0=37819,h0=37820,d0=37821,p0=36492,m0=36494,g0=36495,v0=36283,_0=36284,y0=36285,x0=36286,cp=2200,nb=2201,ib=2202,Au=2300,uc=2301,A0=2302,Su=2400,Mu=2401,up=2402,S0=2500,rx=2501,ox=0,fp=1,bu=2,ab=3200,ER=3201,TR=3202,CR=3203,fc=0,sb=1,hl="",Pi="srgb",ta="srgb-linear",hp="linear",ti="srgb",RR="",wR="rg",BR="ga",DR=0,Eu=7680,UR=7681,NR=7682,LR=7683,OR=34055,IR=34056,FR=5386,HR=512,PR=513,GR=514,zR=515,VR=516,kR=517,XR=518,lx=519,rb=512,ob=513,lb=514,M0=515,cb=516,ub=517,b0=518,fb=519,dp=35044,YR=35048,JR=35040,qR=35045,KR=35049,WR=35041,jR=35046,ZR=35050,QR=35042,$R="100",cx="300 es",Zs=2e3,$f=2001,e2={COMPUTE:"compute",RENDER:"render"},t2={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},n2={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function hb(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const i2={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function eh(s,e){return new i2[s](e)}function db(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function pp(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function pb(){const s=pp("canvas");return s.style.display="block",s}const mb={};let hc=null;function a2(s){hc=s}function s2(){return hc}function mp(...s){const e="THREE."+s.shift();hc?hc("log",e,...s):console.log(e,...s)}function Et(...s){const e="THREE."+s.shift();hc?hc("warn",e,...s):console.warn(e,...s)}function Wt(...s){const e="THREE."+s.shift();hc?hc("error",e,...s):console.error(e,...s)}function th(...s){const e=s.join(" ");e in mb||(mb[e]=!0,Et(...s))}function r2(s,e,t){return new Promise(function(n,i){function o(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}class Eo{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o<l;o++)i[o].call(this,e);e.target=null}}}const ja=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let gb=1234567;const Tu=Math.PI/180,nh=180/Math.PI;function Qs(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ja[s&255]+ja[s>>8&255]+ja[s>>16&255]+ja[s>>24&255]+"-"+ja[e&255]+ja[e>>8&255]+"-"+ja[e>>16&15|64]+ja[e>>24&255]+"-"+ja[t&63|128]+ja[t>>8&255]+"-"+ja[t>>16&255]+ja[t>>24&255]+ja[n&255]+ja[n>>8&255]+ja[n>>16&255]+ja[n>>24&255]).toLowerCase()}function rn(s,e,t){return Math.max(e,Math.min(t,s))}function ux(s,e){return(s%e+e)%e}function o2(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function l2(s,e,t){return s!==e?(t-s)/(e-s):0}function gp(s,e,t){return(1-t)*s+t*e}function c2(s,e,t,n){return gp(s,e,1-Math.exp(-t*n))}function u2(s,e=1){return e-Math.abs(ux(s,e*2)-e)}function f2(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function h2(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function d2(s,e){return s+Math.floor(Math.random()*(e-s+1))}function p2(s,e){return s+Math.random()*(e-s)}function m2(s){return s*(.5-Math.random())}function g2(s){s!==void 0&&(gb=s);let e=gb+=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 v2(s){return s*Tu}function _2(s){return s*nh}function y2(s){return(s&s-1)===0&&s!==0}function x2(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function A2(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function S2(s,e,t,n,i){const o=Math.cos,l=Math.sin,h=o(t/2),d=l(t/2),p=o((e+n)/2),_=l((e+n)/2),v=o((e-n)/2),y=l((e-n)/2),x=o((n-e)/2),b=l((n-e)/2);switch(i){case"XYX":s.set(h*_,d*v,d*y,h*p);break;case"YZY":s.set(d*y,h*_,d*v,h*p);break;case"ZXZ":s.set(d*v,d*y,h*_,h*p);break;case"XZX":s.set(h*_,d*b,d*x,h*p);break;case"YXY":s.set(d*x,h*_,d*b,h*p);break;case"ZYZ":s.set(d*b,d*x,h*_,h*p);break;default:Et("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function hs(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function yn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const E0={DEG2RAD:Tu,RAD2DEG:nh,generateUUID:Qs,clamp:rn,euclideanModulo:ux,mapLinear:o2,inverseLerp:l2,lerp:gp,damp:c2,pingpong:u2,smoothstep:f2,smootherstep:h2,randInt:d2,randFloat:p2,randFloatSpread:m2,seededRandom:g2,degToRad:v2,radToDeg:_2,isPowerOfTwo:y2,ceilPowerOfTwo:x2,floorPowerOfTwo:A2,setQuaternionFromProperEuler:S2,normalize:yn,denormalize:hs};class et{constructor(e=0,t=0){et.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=rn(this.x,e.x,t.x),this.y=rn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=rn(this.x,e,t),this.y=rn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(rn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ba{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,h){let d=n[i+0],p=n[i+1],_=n[i+2],v=n[i+3],y=o[l+0],x=o[l+1],b=o[l+2],R=o[l+3];if(h<=0){e[t+0]=d,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(h>=1){e[t+0]=y,e[t+1]=x,e[t+2]=b,e[t+3]=R;return}if(v!==R||d!==y||p!==x||_!==b){let T=d*y+p*x+_*b+v*R;T<0&&(y=-y,x=-x,b=-b,R=-R,T=-T);let M=1-h;if(T<.9995){const w=Math.acos(T),D=Math.sin(w);M=Math.sin(M*w)/D,h=Math.sin(h*w)/D,d=d*M+y*h,p=p*M+x*h,_=_*M+b*h,v=v*M+R*h}else{d=d*M+y*h,p=p*M+x*h,_=_*M+b*h,v=v*M+R*h;const w=1/Math.sqrt(d*d+p*p+_*_+v*v);d*=w,p*=w,_*=w,v*=w}}e[t]=d,e[t+1]=p,e[t+2]=_,e[t+3]=v}static multiplyQuaternionsFlat(e,t,n,i,o,l){const h=n[i],d=n[i+1],p=n[i+2],_=n[i+3],v=o[l],y=o[l+1],x=o[l+2],b=o[l+3];return e[t]=h*b+_*v+d*x-p*y,e[t+1]=d*b+_*y+p*v-h*x,e[t+2]=p*b+_*x+h*y-d*v,e[t+3]=_*b-h*v-d*y-p*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,h=Math.cos,d=Math.sin,p=h(n/2),_=h(i/2),v=h(o/2),y=d(n/2),x=d(i/2),b=d(o/2);switch(l){case"XYZ":this._x=y*_*v+p*x*b,this._y=p*x*v-y*_*b,this._z=p*_*b+y*x*v,this._w=p*_*v-y*x*b;break;case"YXZ":this._x=y*_*v+p*x*b,this._y=p*x*v-y*_*b,this._z=p*_*b-y*x*v,this._w=p*_*v+y*x*b;break;case"ZXY":this._x=y*_*v-p*x*b,this._y=p*x*v+y*_*b,this._z=p*_*b+y*x*v,this._w=p*_*v-y*x*b;break;case"ZYX":this._x=y*_*v-p*x*b,this._y=p*x*v+y*_*b,this._z=p*_*b-y*x*v,this._w=p*_*v+y*x*b;break;case"YZX":this._x=y*_*v+p*x*b,this._y=p*x*v+y*_*b,this._z=p*_*b-y*x*v,this._w=p*_*v-y*x*b;break;case"XZY":this._x=y*_*v-p*x*b,this._y=p*x*v-y*_*b,this._z=p*_*b+y*x*v,this._w=p*_*v+y*x*b;break;default:Et("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],h=t[5],d=t[9],p=t[2],_=t[6],v=t[10],y=n+h+v;if(y>0){const x=.5/Math.sqrt(y+1);this._w=.25/x,this._x=(_-d)*x,this._y=(o-p)*x,this._z=(l-i)*x}else if(n>h&&n>v){const x=2*Math.sqrt(1+n-h-v);this._w=(_-d)/x,this._x=.25*x,this._y=(i+l)/x,this._z=(o+p)/x}else if(h>v){const x=2*Math.sqrt(1+h-n-v);this._w=(o-p)/x,this._x=(i+l)/x,this._y=.25*x,this._z=(d+_)/x}else{const x=2*Math.sqrt(1+v-n-h);this._w=(l-i)/x,this._x=(o+p)/x,this._y=(d+_)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(rn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,h=t._x,d=t._y,p=t._z,_=t._w;return this._x=n*_+l*h+i*p-o*d,this._y=i*_+l*d+o*h-n*p,this._z=o*_+l*p+n*d-i*h,this._w=l*_-n*h-i*d-o*p,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,o=e._z,l=e._w,h=this.dot(e);h<0&&(n=-n,i=-i,o=-o,l=-l,h=-h);let d=1-t;if(h<.9995){const p=Math.acos(h),_=Math.sin(p);d=Math.sin(d*p)/_,t=Math.sin(t*p)/_,this._x=this._x*d+n*t,this._y=this._y*d+i*t,this._z=this._z*d+o*t,this._w=this._w*d+l*t,this._onChangeCallback()}else this._x=this._x*d+n*t,this._y=this._y*d+i*t,this._z=this._z*d+o*t,this._w=this._w*d+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Q{constructor(e=0,t=0,n=0){Q.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(vb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(vb.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,h=e.z,d=e.w,p=2*(l*i-h*n),_=2*(h*t-o*i),v=2*(o*n-l*t);return this.x=t+d*p+l*v-h*_,this.y=n+d*_+h*p-o*v,this.z=i+d*v+o*_-l*p,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+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,t){return this.x=rn(this.x,e.x,t.x),this.y=rn(this.y,e.y,t.y),this.z=rn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=rn(this.x,e,t),this.y=rn(this.y,e,t),this.z=rn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,h=t.y,d=t.z;return this.x=i*d-o*h,this.y=o*l-n*d,this.z=n*h-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return fx.copy(this).projectOnVector(e),this.sub(fx)}reflect(e){return this.sub(fx.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(rn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const fx=new Q,vb=new ba;class mn{constructor(e,t,n,i,o,l,h,d,p){mn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,h,d,p)}set(e,t,n,i,o,l,h,d,p){const _=this.elements;return _[0]=e,_[1]=i,_[2]=h,_[3]=t,_[4]=o,_[5]=d,_[6]=n,_[7]=l,_[8]=p,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],h=n[3],d=n[6],p=n[1],_=n[4],v=n[7],y=n[2],x=n[5],b=n[8],R=i[0],T=i[3],M=i[6],w=i[1],D=i[4],U=i[7],F=i[2],O=i[5],z=i[8];return o[0]=l*R+h*w+d*F,o[3]=l*T+h*D+d*O,o[6]=l*M+h*U+d*z,o[1]=p*R+_*w+v*F,o[4]=p*T+_*D+v*O,o[7]=p*M+_*U+v*z,o[2]=y*R+x*w+b*F,o[5]=y*T+x*D+b*O,o[8]=y*M+x*U+b*z,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],h=e[5],d=e[6],p=e[7],_=e[8];return t*l*_-t*h*p-n*o*_+n*h*d+i*o*p-i*l*d}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],h=e[5],d=e[6],p=e[7],_=e[8],v=_*l-h*p,y=h*d-_*o,x=p*o-l*d,b=t*v+n*y+i*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/b;return e[0]=v*R,e[1]=(i*p-_*n)*R,e[2]=(h*n-i*l)*R,e[3]=y*R,e[4]=(_*t-i*d)*R,e[5]=(i*o-h*t)*R,e[6]=x*R,e[7]=(n*d-p*t)*R,e[8]=(l*t-n*o)*R,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,h){const d=Math.cos(o),p=Math.sin(o);return this.set(n*d,n*p,-n*(d*l+p*h)+l+e,-i*p,i*d,-i*(-p*l+d*h)+h+t,0,0,1),this}scale(e,t){return this.premultiply(hx.makeScale(e,t)),this}rotate(e){return this.premultiply(hx.makeRotation(-e)),this}translate(e,t){return this.premultiply(hx.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const hx=new mn,_b=new mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),yb=new mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function M2(){const s={enabled:!0,workingColorSpace:ta,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===ti&&(i.r=dl(i.r),i.g=dl(i.g),i.b=dl(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===ti&&(i.r=ih(i.r),i.g=ih(i.g),i.b=ih(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===hl?hp:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return th("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return th("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[ta]:{primaries:e,whitePoint:n,transfer:hp,toXYZ:_b,fromXYZ:yb,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Pi},outputColorSpaceConfig:{drawingBufferColorSpace:Pi}},[Pi]:{primaries:e,whitePoint:n,transfer:ti,toXYZ:_b,fromXYZ:yb,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Pi}}}),s}const Tn=M2();function dl(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function ih(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let ah;class xb{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ah===void 0&&(ah=pp("canvas")),ah.width=e.width,ah.height=e.height;const i=ah.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=ah}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=pp("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l<o.length;l++)o[l]=dl(o[l]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(dl(t[n]/255)*255):t[n]=dl(t[n]);return{data:t,width:e.width,height:e.height}}else return Et("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let b2=0;class dc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:b2++}),this.uuid=Qs(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let o;if(Array.isArray(i)){o=[];for(let l=0,h=i.length;l<h;l++)i[l].isDataTexture?o.push(dx(i[l].image)):o.push(dx(i[l]))}else o=dx(i);n.url=o}return t||(e.images[this.uuid]=n),n}}function dx(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?xb.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(Et("Texture: Unable to serialize Texture."),{})}let E2=0;const px=new Q;class qn extends Eo{constructor(e=qn.DEFAULT_IMAGE,t=qn.DEFAULT_MAPPING,n=yi,i=yi,o=bn,l=Is,h=ji,d=Ma,p=qn.DEFAULT_ANISOTROPY,_=hl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:E2++}),this.uuid=Qs(),this.name="",this.source=new dc(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=o,this.minFilter=l,this.anisotropy=p,this.format=h,this.internalFormat=null,this.type=d,this.offset=new et(0,0),this.repeat=new et(1,1),this.center=new et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new mn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=_,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(px).x}get height(){return this.source.getSize(px).y}get depth(){return this.source.getSize(px).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Et(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Et(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==rc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jr:e.x=e.x-Math.floor(e.x);break;case yi:e.x=e.x<0?0:1;break;case _u: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 Jr:e.y=e.y-Math.floor(e.y);break;case yi:e.y=e.y<0?0:1;break;case _u:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}qn.DEFAULT_IMAGE=null,qn.DEFAULT_MAPPING=rc,qn.DEFAULT_ANISOTROPY=1;class ci{constructor(e=0,t=0,n=0,i=1){ci.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const d=e.elements,p=d[0],_=d[4],v=d[8],y=d[1],x=d[5],b=d[9],R=d[2],T=d[6],M=d[10];if(Math.abs(_-y)<.01&&Math.abs(v-R)<.01&&Math.abs(b-T)<.01){if(Math.abs(_+y)<.1&&Math.abs(v+R)<.1&&Math.abs(b+T)<.1&&Math.abs(p+x+M-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const D=(p+1)/2,U=(x+1)/2,F=(M+1)/2,O=(_+y)/4,z=(v+R)/4,k=(b+T)/4;return D>U&&D>F?D<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(D),i=O/n,o=z/n):U>F?U<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(U),n=O/i,o=k/i):F<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(F),n=z/o,i=k/o),this.set(n,i,o,t),this}let w=Math.sqrt((T-b)*(T-b)+(v-R)*(v-R)+(y-_)*(y-_));return Math.abs(w)<.001&&(w=1),this.x=(T-b)/w,this.y=(v-R)/w,this.z=(y-_)/w,this.w=Math.acos((p+x+M-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=rn(this.x,e.x,t.x),this.y=rn(this.y,e.y,t.y),this.z=rn(this.z,e.z,t.z),this.w=rn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=rn(this.x,e,t),this.y=rn(this.y,e,t),this.z=rn(this.z,e,t),this.w=rn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(rn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class mx extends Eo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ci(0,0,e,t),this.scissorTest=!1,this.viewport=new ci(0,0,e,t);const i={width:e,height:t,depth:n.depth},o=new qn(i);this.textures=[];const l=n.count;for(let h=0;h<l;h++)this.textures[h]=o.clone(),this.textures[h].isRenderTargetTexture=!0,this.textures[h].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:bn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,o=this.textures.length;i<o;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new dc(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ds extends mx{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class T0 extends qn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xi,this.minFilter=xi,this.wrapR=yi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class T2 extends ds{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new T0(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class C0 extends qn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xi,this.minFilter=xi,this.wrapR=yi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class C2 extends ds{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new C0(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ea{constructor(e=new Q(1/0,1/0,1/0),t=new Q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const o=n.getAttribute("position");if(t===!0&&o!==void 0&&e.isInstancedMesh!==!0)for(let l=0,h=o.count;l<h;l++)e.isMesh===!0?e.getVertexPosition(l,qr):qr.fromBufferAttribute(o,l),qr.applyMatrix4(e.matrixWorld),this.expandByPoint(qr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),R0.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),R0.copy(n.boundingBox)),R0.applyMatrix4(e.matrixWorld),this.union(R0)}const i=e.children;for(let o=0,l=i.length;o<l;o++)this.expandByObject(i[o],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qr),qr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(vp),w0.subVectors(this.max,vp),sh.subVectors(e.a,vp),rh.subVectors(e.b,vp),oh.subVectors(e.c,vp),pc.subVectors(rh,sh),mc.subVectors(oh,rh),Cu.subVectors(sh,oh);let t=[0,-pc.z,pc.y,0,-mc.z,mc.y,0,-Cu.z,Cu.y,pc.z,0,-pc.x,mc.z,0,-mc.x,Cu.z,0,-Cu.x,-pc.y,pc.x,0,-mc.y,mc.x,0,-Cu.y,Cu.x,0];return!gx(t,sh,rh,oh,w0)||(t=[1,0,0,0,1,0,0,0,1],!gx(t,sh,rh,oh,w0))?!1:(B0.crossVectors(pc,mc),t=[B0.x,B0.y,B0.z],gx(t,sh,rh,oh,w0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qr).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:(pl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),pl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),pl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),pl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),pl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),pl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),pl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),pl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(pl),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const pl=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],qr=new Q,R0=new Ea,sh=new Q,rh=new Q,oh=new Q,pc=new Q,mc=new Q,Cu=new Q,vp=new Q,w0=new Q,B0=new Q,Ru=new Q;function gx(s,e,t,n,i){for(let o=0,l=s.length-3;o<=l;o+=3){Ru.fromArray(s,o);const h=i.x*Math.abs(Ru.x)+i.y*Math.abs(Ru.y)+i.z*Math.abs(Ru.z),d=e.dot(Ru),p=t.dot(Ru),_=n.dot(Ru);if(Math.max(-Math.max(d,p,_),Math.min(d,p,_))>h)return!1}return!0}const R2=new Ea,_p=new Q,vx=new Q;class ua{constructor(e=new Q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):R2.setFromPoints(e).getCenter(n);let i=0;for(let o=0,l=e.length;o<l;o++)i=Math.max(i,n.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_p.subVectors(e,this.center);const t=_p.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(_p,i/n),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):(vx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_p.copy(e.center).add(vx)),this.expandByPoint(_p.copy(e.center).sub(vx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const ml=new Q,_x=new Q,D0=new Q,gc=new Q,yx=new Q,U0=new Q,xx=new Q;class lh{constructor(e=new Q,t=new Q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ml)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ml.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ml.copy(this.origin).addScaledVector(this.direction,t),ml.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){_x.copy(e).add(t).multiplyScalar(.5),D0.copy(t).sub(e).normalize(),gc.copy(this.origin).sub(_x);const o=e.distanceTo(t)*.5,l=-this.direction.dot(D0),h=gc.dot(this.direction),d=-gc.dot(D0),p=gc.lengthSq(),_=Math.abs(1-l*l);let v,y,x,b;if(_>0)if(v=l*d-h,y=l*h-d,b=o*_,v>=0)if(y>=-b)if(y<=b){const R=1/_;v*=R,y*=R,x=v*(v+l*y+2*h)+y*(l*v+y+2*d)+p}else y=o,v=Math.max(0,-(l*y+h)),x=-v*v+y*(y+2*d)+p;else y=-o,v=Math.max(0,-(l*y+h)),x=-v*v+y*(y+2*d)+p;else y<=-b?(v=Math.max(0,-(-l*o+h)),y=v>0?-o:Math.min(Math.max(-o,-d),o),x=-v*v+y*(y+2*d)+p):y<=b?(v=0,y=Math.min(Math.max(-o,-d),o),x=y*(y+2*d)+p):(v=Math.max(0,-(l*o+h)),y=v>0?o:Math.min(Math.max(-o,-d),o),x=-v*v+y*(y+2*d)+p);else y=l>0?-o:o,v=Math.max(0,-(l*y+h)),x=-v*v+y*(y+2*d)+p;return n&&n.copy(this.origin).addScaledVector(this.direction,v),i&&i.copy(_x).addScaledVector(D0,y),x}intersectSphere(e,t){ml.subVectors(e.center,this.origin);const n=ml.dot(this.direction),i=ml.dot(ml)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),h=n-l,d=n+l;return d<0?null:h<0?this.at(d,t):this.at(h,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,h,d;const p=1/this.direction.x,_=1/this.direction.y,v=1/this.direction.z,y=this.origin;return p>=0?(n=(e.min.x-y.x)*p,i=(e.max.x-y.x)*p):(n=(e.max.x-y.x)*p,i=(e.min.x-y.x)*p),_>=0?(o=(e.min.y-y.y)*_,l=(e.max.y-y.y)*_):(o=(e.max.y-y.y)*_,l=(e.min.y-y.y)*_),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l<i||isNaN(i))&&(i=l),v>=0?(h=(e.min.z-y.z)*v,d=(e.max.z-y.z)*v):(h=(e.max.z-y.z)*v,d=(e.min.z-y.z)*v),n>d||h>i)||((h>n||n!==n)&&(n=h),(d<i||i!==i)&&(i=d),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ml)!==null}intersectTriangle(e,t,n,i,o){yx.subVectors(t,e),U0.subVectors(n,e),xx.crossVectors(yx,U0);let l=this.direction.dot(xx),h;if(l>0){if(i)return null;h=1}else if(l<0)h=-1,l=-l;else return null;gc.subVectors(this.origin,e);const d=h*this.direction.dot(U0.crossVectors(gc,U0));if(d<0)return null;const p=h*this.direction.dot(yx.cross(gc));if(p<0||d+p>l)return null;const _=-h*gc.dot(xx);return _<0?null:this.at(_/l,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 Qt{constructor(e,t,n,i,o,l,h,d,p,_,v,y,x,b,R,T){Qt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,h,d,p,_,v,y,x,b,R,T)}set(e,t,n,i,o,l,h,d,p,_,v,y,x,b,R,T){const M=this.elements;return M[0]=e,M[4]=t,M[8]=n,M[12]=i,M[1]=o,M[5]=l,M[9]=h,M[13]=d,M[2]=p,M[6]=_,M[10]=v,M[14]=y,M[3]=x,M[7]=b,M[11]=R,M[15]=T,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 Qt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/ch.setFromMatrixColumn(e,0).length(),o=1/ch.setFromMatrixColumn(e,1).length(),l=1/ch.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=0,t[8]=n[8]*l,t[9]=n[9]*l,t[10]=n[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,o=e.z,l=Math.cos(n),h=Math.sin(n),d=Math.cos(i),p=Math.sin(i),_=Math.cos(o),v=Math.sin(o);if(e.order==="XYZ"){const y=l*_,x=l*v,b=h*_,R=h*v;t[0]=d*_,t[4]=-d*v,t[8]=p,t[1]=x+b*p,t[5]=y-R*p,t[9]=-h*d,t[2]=R-y*p,t[6]=b+x*p,t[10]=l*d}else if(e.order==="YXZ"){const y=d*_,x=d*v,b=p*_,R=p*v;t[0]=y+R*h,t[4]=b*h-x,t[8]=l*p,t[1]=l*v,t[5]=l*_,t[9]=-h,t[2]=x*h-b,t[6]=R+y*h,t[10]=l*d}else if(e.order==="ZXY"){const y=d*_,x=d*v,b=p*_,R=p*v;t[0]=y-R*h,t[4]=-l*v,t[8]=b+x*h,t[1]=x+b*h,t[5]=l*_,t[9]=R-y*h,t[2]=-l*p,t[6]=h,t[10]=l*d}else if(e.order==="ZYX"){const y=l*_,x=l*v,b=h*_,R=h*v;t[0]=d*_,t[4]=b*p-x,t[8]=y*p+R,t[1]=d*v,t[5]=R*p+y,t[9]=x*p-b,t[2]=-p,t[6]=h*d,t[10]=l*d}else if(e.order==="YZX"){const y=l*d,x=l*p,b=h*d,R=h*p;t[0]=d*_,t[4]=R-y*v,t[8]=b*v+x,t[1]=v,t[5]=l*_,t[9]=-h*_,t[2]=-p*_,t[6]=x*v+b,t[10]=y-R*v}else if(e.order==="XZY"){const y=l*d,x=l*p,b=h*d,R=h*p;t[0]=d*_,t[4]=-v,t[8]=p*_,t[1]=y*v+R,t[5]=l*_,t[9]=x*v-b,t[2]=b*v-x,t[6]=h*_,t[10]=R*v+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(w2,e,B2)}lookAt(e,t,n){const i=this.elements;return $s.subVectors(e,t),$s.lengthSq()===0&&($s.z=1),$s.normalize(),vc.crossVectors(n,$s),vc.lengthSq()===0&&(Math.abs(n.z)===1?$s.x+=1e-4:$s.z+=1e-4,$s.normalize(),vc.crossVectors(n,$s)),vc.normalize(),N0.crossVectors($s,vc),i[0]=vc.x,i[4]=N0.x,i[8]=$s.x,i[1]=vc.y,i[5]=N0.y,i[9]=$s.y,i[2]=vc.z,i[6]=N0.z,i[10]=$s.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],h=n[4],d=n[8],p=n[12],_=n[1],v=n[5],y=n[9],x=n[13],b=n[2],R=n[6],T=n[10],M=n[14],w=n[3],D=n[7],U=n[11],F=n[15],O=i[0],z=i[4],k=i[8],N=i[12],I=i[1],W=i[5],ae=i[9],ie=i[13],se=i[2],_e=i[6],H=i[10],K=i[14],$=i[3],ue=i[7],re=i[11],X=i[15];return o[0]=l*O+h*I+d*se+p*$,o[4]=l*z+h*W+d*_e+p*ue,o[8]=l*k+h*ae+d*H+p*re,o[12]=l*N+h*ie+d*K+p*X,o[1]=_*O+v*I+y*se+x*$,o[5]=_*z+v*W+y*_e+x*ue,o[9]=_*k+v*ae+y*H+x*re,o[13]=_*N+v*ie+y*K+x*X,o[2]=b*O+R*I+T*se+M*$,o[6]=b*z+R*W+T*_e+M*ue,o[10]=b*k+R*ae+T*H+M*re,o[14]=b*N+R*ie+T*K+M*X,o[3]=w*O+D*I+U*se+F*$,o[7]=w*z+D*W+U*_e+F*ue,o[11]=w*k+D*ae+U*H+F*re,o[15]=w*N+D*ie+U*K+F*X,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],o=e[12],l=e[1],h=e[5],d=e[9],p=e[13],_=e[2],v=e[6],y=e[10],x=e[14],b=e[3],R=e[7],T=e[11],M=e[15],w=d*x-p*y,D=h*x-p*v,U=h*y-d*v,F=l*x-p*_,O=l*y-d*_,z=l*v-h*_;return t*(R*w-T*D+M*U)-n*(b*w-T*F+M*O)+i*(b*D-R*F+M*z)-o*(b*U-R*O+T*z)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],h=e[5],d=e[6],p=e[7],_=e[8],v=e[9],y=e[10],x=e[11],b=e[12],R=e[13],T=e[14],M=e[15],w=v*T*p-R*y*p+R*d*x-h*T*x-v*d*M+h*y*M,D=b*y*p-_*T*p-b*d*x+l*T*x+_*d*M-l*y*M,U=_*R*p-b*v*p+b*h*x-l*R*x-_*h*M+l*v*M,F=b*v*d-_*R*d-b*h*y+l*R*y+_*h*T-l*v*T,O=t*w+n*D+i*U+o*F;if(O===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/O;return e[0]=w*z,e[1]=(R*y*o-v*T*o-R*i*x+n*T*x+v*i*M-n*y*M)*z,e[2]=(h*T*o-R*d*o+R*i*p-n*T*p-h*i*M+n*d*M)*z,e[3]=(v*d*o-h*y*o-v*i*p+n*y*p+h*i*x-n*d*x)*z,e[4]=D*z,e[5]=(_*T*o-b*y*o+b*i*x-t*T*x-_*i*M+t*y*M)*z,e[6]=(b*d*o-l*T*o-b*i*p+t*T*p+l*i*M-t*d*M)*z,e[7]=(l*y*o-_*d*o+_*i*p-t*y*p-l*i*x+t*d*x)*z,e[8]=U*z,e[9]=(b*v*o-_*R*o-b*n*x+t*R*x+_*n*M-t*v*M)*z,e[10]=(l*R*o-b*h*o+b*n*p-t*R*p-l*n*M+t*h*M)*z,e[11]=(_*h*o-l*v*o-_*n*p+t*v*p+l*n*x-t*h*x)*z,e[12]=F*z,e[13]=(_*R*i-b*v*i+b*n*y-t*R*y-_*n*T+t*v*T)*z,e[14]=(b*h*i-l*R*i-b*n*d+t*R*d+l*n*T-t*h*T)*z,e[15]=(l*v*i-_*h*i+_*n*d-t*v*d-l*n*y+t*h*y)*z,this}scale(e){const t=this.elements,n=e.x,i=e.y,o=e.z;return t[0]*=n,t[4]*=i,t[8]*=o,t[1]*=n,t[5]*=i,t[9]*=o,t[2]*=n,t[6]*=i,t[10]*=o,t[3]*=n,t[7]*=i,t[11]*=o,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),o=1-n,l=e.x,h=e.y,d=e.z,p=o*l,_=o*h;return this.set(p*l+n,p*h-i*d,p*d+i*h,0,p*h+i*d,_*h+n,_*d-i*l,0,p*d-i*h,_*d+i*l,o*d*d+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,o,l){return this.set(1,n,o,0,e,1,l,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,o=t._x,l=t._y,h=t._z,d=t._w,p=o+o,_=l+l,v=h+h,y=o*p,x=o*_,b=o*v,R=l*_,T=l*v,M=h*v,w=d*p,D=d*_,U=d*v,F=n.x,O=n.y,z=n.z;return i[0]=(1-(R+M))*F,i[1]=(x+U)*F,i[2]=(b-D)*F,i[3]=0,i[4]=(x-U)*O,i[5]=(1-(y+M))*O,i[6]=(T+w)*O,i[7]=0,i[8]=(b+D)*z,i[9]=(T-w)*z,i[10]=(1-(y+R))*z,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let o=ch.set(i[0],i[1],i[2]).length();const l=ch.set(i[4],i[5],i[6]).length(),h=ch.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),Kr.copy(this);const p=1/o,_=1/l,v=1/h;return Kr.elements[0]*=p,Kr.elements[1]*=p,Kr.elements[2]*=p,Kr.elements[4]*=_,Kr.elements[5]*=_,Kr.elements[6]*=_,Kr.elements[8]*=v,Kr.elements[9]*=v,Kr.elements[10]*=v,t.setFromRotationMatrix(Kr),n.x=o,n.y=l,n.z=h,this}makePerspective(e,t,n,i,o,l,h=Zs,d=!1){const p=this.elements,_=2*o/(t-e),v=2*o/(n-i),y=(t+e)/(t-e),x=(n+i)/(n-i);let b,R;if(d)b=o/(l-o),R=l*o/(l-o);else if(h===Zs)b=-(l+o)/(l-o),R=-2*l*o/(l-o);else if(h===$f)b=-l/(l-o),R=-l*o/(l-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return p[0]=_,p[4]=0,p[8]=y,p[12]=0,p[1]=0,p[5]=v,p[9]=x,p[13]=0,p[2]=0,p[6]=0,p[10]=b,p[14]=R,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(e,t,n,i,o,l,h=Zs,d=!1){const p=this.elements,_=2/(t-e),v=2/(n-i),y=-(t+e)/(t-e),x=-(n+i)/(n-i);let b,R;if(d)b=1/(l-o),R=l/(l-o);else if(h===Zs)b=-2/(l-o),R=-(l+o)/(l-o);else if(h===$f)b=-1/(l-o),R=-o/(l-o);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return p[0]=_,p[4]=0,p[8]=0,p[12]=y,p[1]=0,p[5]=v,p[9]=0,p[13]=x,p[2]=0,p[6]=0,p[10]=b,p[14]=R,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const ch=new Q,Kr=new Qt,w2=new Q(0,0,0),B2=new Q(1,1,1),vc=new Q,N0=new Q,$s=new Q,Ab=new Qt,Sb=new ba;class er{constructor(e=0,t=0,n=0,i=er.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,o=i[0],l=i[4],h=i[8],d=i[1],p=i[5],_=i[9],v=i[2],y=i[6],x=i[10];switch(t){case"XYZ":this._y=Math.asin(rn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-_,x),this._z=Math.atan2(-l,o)):(this._x=Math.atan2(y,p),this._z=0);break;case"YXZ":this._x=Math.asin(-rn(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(h,x),this._z=Math.atan2(d,p)):(this._y=Math.atan2(-v,o),this._z=0);break;case"ZXY":this._x=Math.asin(rn(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-v,x),this._z=Math.atan2(-l,p)):(this._y=0,this._z=Math.atan2(d,o));break;case"ZYX":this._y=Math.asin(-rn(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(y,x),this._z=Math.atan2(d,o)):(this._x=0,this._z=Math.atan2(-l,p));break;case"YZX":this._z=Math.asin(rn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-_,p),this._y=Math.atan2(-v,o)):(this._x=0,this._y=Math.atan2(h,x));break;case"XZY":this._z=Math.asin(-rn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(y,p),this._y=Math.atan2(h,o)):(this._x=Math.atan2(-_,x),this._y=0);break;default:Et("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ab.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ab,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Sb.setFromEuler(this),this.setFromQuaternion(Sb,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}er.DEFAULT_ORDER="XYZ";class uh{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let D2=0;const Mb=new Q,fh=new ba,gl=new Qt,L0=new Q,yp=new Q,U2=new Q,N2=new ba,bb=new Q(1,0,0),Eb=new Q(0,1,0),Tb=new Q(0,0,1),Cb={type:"added"},L2={type:"removed"},hh={type:"childadded",child:null},Ax={type:"childremoved",child:null};class wn extends Eo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:D2++}),this.uuid=Qs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wn.DEFAULT_UP.clone();const e=new Q,t=new er,n=new ba,i=new Q(1,1,1);function o(){n.setFromEuler(t,!1)}function l(){t.setFromQuaternion(n,void 0,!1)}t._onChange(o),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Qt},normalMatrix:{value:new mn}}),this.matrix=new Qt,this.matrixWorld=new Qt,this.matrixAutoUpdate=wn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=wn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new uh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return fh.setFromAxisAngle(e,t),this.quaternion.multiply(fh),this}rotateOnWorldAxis(e,t){return fh.setFromAxisAngle(e,t),this.quaternion.premultiply(fh),this}rotateX(e){return this.rotateOnAxis(bb,e)}rotateY(e){return this.rotateOnAxis(Eb,e)}rotateZ(e){return this.rotateOnAxis(Tb,e)}translateOnAxis(e,t){return Mb.copy(e).applyQuaternion(this.quaternion),this.position.add(Mb.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(bb,e)}translateY(e){return this.translateOnAxis(Eb,e)}translateZ(e){return this.translateOnAxis(Tb,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(gl.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?L0.copy(e):L0.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),yp.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gl.lookAt(yp,L0,this.up):gl.lookAt(L0,yp,this.up),this.quaternion.setFromRotationMatrix(gl),i&&(gl.extractRotation(i.matrixWorld),fh.setFromRotationMatrix(gl),this.quaternion.premultiply(fh.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Wt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Cb),hh.child=e,this.dispatchEvent(hh),hh.child=null):Wt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(L2),Ax.child=e,this.dispatchEvent(Ax),Ax.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),gl.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),gl.multiply(e.parent.matrixWorld)),e.applyMatrix4(gl),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Cb),hh.child=e,this.dispatchEvent(hh),hh.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const l=this.children[n].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let o=0,l=i.length;o<l;o++)i[o].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yp,e,U2),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yp,N2,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let o=0,l=i.length;o<l;o++)i[o].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.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())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(h=>({...h,boundingBox:h.boundingBox?h.boundingBox.toJSON():void 0,boundingSphere:h.boundingSphere?h.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(h=>({...h})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(h,d){return h[d.uuid]===void 0&&(h[d.uuid]=d.toJSON(e)),d.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 h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){const d=h.shapes;if(Array.isArray(d))for(let p=0,_=d.length;p<_;p++){const v=d[p];o(e.shapes,v)}else o(e.shapes,d)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const h=[];for(let d=0,p=this.material.length;d<p;d++)h.push(o(e.materials,this.material[d]));i.material=h}else i.material=o(e.materials,this.material);if(this.children.length>0){i.children=[];for(let h=0;h<this.children.length;h++)i.children.push(this.children[h].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let h=0;h<this.animations.length;h++){const d=this.animations[h];i.animations.push(o(e.animations,d))}}if(t){const h=l(e.geometries),d=l(e.materials),p=l(e.textures),_=l(e.images),v=l(e.shapes),y=l(e.skeletons),x=l(e.animations),b=l(e.nodes);h.length>0&&(n.geometries=h),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),_.length>0&&(n.images=_),v.length>0&&(n.shapes=v),y.length>0&&(n.skeletons=y),x.length>0&&(n.animations=x),b.length>0&&(n.nodes=b)}return n.object=i,n;function l(h){const d=[];for(const p in h){const _=h[p];delete _.metadata,d.push(_)}return d}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}wn.DEFAULT_UP=new Q(0,1,0),wn.DEFAULT_MATRIX_AUTO_UPDATE=!0,wn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Wr=new Q,vl=new Q,Sx=new Q,_l=new Q,dh=new Q,ph=new Q,Rb=new Q,Mx=new Q,bx=new Q,Ex=new Q,Tx=new ci,Cx=new ci,Rx=new ci;class Fs{constructor(e=new Q,t=new Q,n=new Q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Wr.subVectors(e,t),i.cross(Wr);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Wr.subVectors(i,t),vl.subVectors(n,t),Sx.subVectors(e,t);const l=Wr.dot(Wr),h=Wr.dot(vl),d=Wr.dot(Sx),p=vl.dot(vl),_=vl.dot(Sx),v=l*p-h*h;if(v===0)return o.set(0,0,0),null;const y=1/v,x=(p*d-h*_)*y,b=(l*_-h*d)*y;return o.set(1-x-b,b,x)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,_l)===null?!1:_l.x>=0&&_l.y>=0&&_l.x+_l.y<=1}static getInterpolation(e,t,n,i,o,l,h,d){return this.getBarycoord(e,t,n,i,_l)===null?(d.x=0,d.y=0,"z"in d&&(d.z=0),"w"in d&&(d.w=0),null):(d.setScalar(0),d.addScaledVector(o,_l.x),d.addScaledVector(l,_l.y),d.addScaledVector(h,_l.z),d)}static getInterpolatedAttribute(e,t,n,i,o,l){return Tx.setScalar(0),Cx.setScalar(0),Rx.setScalar(0),Tx.fromBufferAttribute(e,t),Cx.fromBufferAttribute(e,n),Rx.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(Tx,o.x),l.addScaledVector(Cx,o.y),l.addScaledVector(Rx,o.z),l}static isFrontFacing(e,t,n,i){return Wr.subVectors(n,t),vl.subVectors(e,t),Wr.cross(vl).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 Wr.subVectors(this.c,this.b),vl.subVectors(this.a,this.b),Wr.cross(vl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(.3333333333333333)}getNormal(e){return Fs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Fs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return Fs.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return Fs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Fs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,h;dh.subVectors(i,n),ph.subVectors(o,n),Mx.subVectors(e,n);const d=dh.dot(Mx),p=ph.dot(Mx);if(d<=0&&p<=0)return t.copy(n);bx.subVectors(e,i);const _=dh.dot(bx),v=ph.dot(bx);if(_>=0&&v<=_)return t.copy(i);const y=d*v-_*p;if(y<=0&&d>=0&&_<=0)return l=d/(d-_),t.copy(n).addScaledVector(dh,l);Ex.subVectors(e,o);const x=dh.dot(Ex),b=ph.dot(Ex);if(b>=0&&x<=b)return t.copy(o);const R=x*p-d*b;if(R<=0&&p>=0&&b<=0)return h=p/(p-b),t.copy(n).addScaledVector(ph,h);const T=_*b-x*v;if(T<=0&&v-_>=0&&x-b>=0)return Rb.subVectors(o,i),h=(v-_)/(v-_+(x-b)),t.copy(i).addScaledVector(Rb,h);const M=1/(T+R+y);return l=R*M,h=y*M,t.copy(n).addScaledVector(dh,l).addScaledVector(ph,h)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const wb={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},_c={h:0,s:0,l:0},O0={h:0,s:0,l:0};function wx(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*6*(.6666666666666666-t):s}class At{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Pi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Tn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Tn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Tn.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Tn.workingColorSpace){if(e=ux(e,1),t=rn(t,0,1),n=rn(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=wx(l,o,e+.3333333333333333),this.g=wx(l,o,e),this.b=wx(l,o,e-.3333333333333333)}return Tn.colorSpaceToWorking(this,i),this}setStyle(e,t=Pi){function n(o){o!==void 0&&parseFloat(o)<1&&Et("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],h=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(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,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(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,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:Et("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);Et("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Pi){const n=wb[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Et("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=dl(e.r),this.g=dl(e.g),this.b=dl(e.b),this}copyLinearToSRGB(e){return this.r=ih(e.r),this.g=ih(e.g),this.b=ih(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Pi){return Tn.workingToColorSpace(Za.copy(this),e),Math.round(rn(Za.r*255,0,255))*65536+Math.round(rn(Za.g*255,0,255))*256+Math.round(rn(Za.b*255,0,255))}getHexString(e=Pi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Tn.workingColorSpace){Tn.workingToColorSpace(Za.copy(this),t);const n=Za.r,i=Za.g,o=Za.b,l=Math.max(n,i,o),h=Math.min(n,i,o);let d,p;const _=(h+l)/2;if(h===l)d=0,p=0;else{const v=l-h;switch(p=_<=.5?v/(l+h):v/(2-l-h),l){case n:d=(i-o)/v+(i<o?6:0);break;case i:d=(o-n)/v+2;break;case o:d=(n-i)/v+4;break}d/=6}return e.h=d,e.s=p,e.l=_,e}getRGB(e,t=Tn.workingColorSpace){return Tn.workingToColorSpace(Za.copy(this),t),e.r=Za.r,e.g=Za.g,e.b=Za.b,e}getStyle(e=Pi){Tn.workingToColorSpace(Za.copy(this),e);const t=Za.r,n=Za.g,i=Za.b;return e!==Pi?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(_c),this.setHSL(_c.h+e,_c.s+t,_c.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(_c),e.getHSL(O0);const n=gp(_c.h,O0.h,t),i=gp(_c.s,O0.s,t),o=gp(_c.l,O0.l,t);return this.setHSL(n,i,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,o=e.elements;return this.r=o[0]*t+o[3]*n+o[6]*i,this.g=o[1]*t+o[4]*n+o[7]*i,this.b=o[2]*t+o[5]*n+o[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Za=new At;At.NAMES=wb;let O2=0;class Gi extends Eo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:O2++}),this.uuid=Qs(),this.name="",this.type="Material",this.blending=gu,this.side=kr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Cg,this.blendDst=Rg,this.blendEquation=sc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new At(0,0,0),this.blendAlpha=0,this.depthFunc=vu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=lx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Eu,this.stencilZFail=Eu,this.stencilZPass=Eu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Et(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Et(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==gu&&(n.blending=this.blending),this.side!==kr&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Cg&&(n.blendSrc=this.blendSrc),this.blendDst!==Rg&&(n.blendDst=this.blendDst),this.blendEquation!==sc&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==vu&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==lx&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Eu&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Eu&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Eu&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const h in o){const d=o[h];delete d.metadata,l.push(d)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class fa extends Gi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new At(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=$d,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const yl=I2();function I2(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let d=0;d<256;++d){const p=d-127;p<-27?(n[d]=0,n[d|256]=32768,i[d]=24,i[d|256]=24):p<-14?(n[d]=1024>>-p-14,n[d|256]=1024>>-p-14|32768,i[d]=-p-1,i[d|256]=-p-1):p<=15?(n[d]=p+15<<10,n[d|256]=p+15<<10|32768,i[d]=13,i[d|256]=13):p<128?(n[d]=31744,n[d|256]=64512,i[d]=24,i[d|256]=24):(n[d]=31744,n[d|256]=64512,i[d]=13,i[d|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),h=new Uint32Array(64);for(let d=1;d<1024;++d){let p=d<<13,_=0;for(;(p&8388608)===0;)p<<=1,_-=8388608;p&=-8388609,_+=947912704,o[d]=p|_}for(let d=1024;d<2048;++d)o[d]=939524096+(d-1024<<13);for(let d=1;d<31;++d)l[d]=d<<23;l[31]=1199570944,l[32]=2147483648;for(let d=33;d<63;++d)l[d]=2147483648+(d-32<<23);l[63]=3347054592;for(let d=1;d<64;++d)d!==32&&(h[d]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:h}}function Hs(s){Math.abs(s)>65504&&Et("DataUtils.toHalfFloat(): Value out of range."),s=rn(s,-65504,65504),yl.floatView[0]=s;const e=yl.uint32View[0],t=e>>23&511;return yl.baseTable[t]+((e&8388607)>>yl.shiftTable[t])}function xp(s){const e=s>>10;return yl.uint32View[0]=yl.mantissaTable[yl.offsetTable[e]+(s&1023)]+yl.exponentTable[e],yl.floatView[0]}class wu{static toHalfFloat(e){return Hs(e)}static fromHalfFloat(e){return xp(e)}}const na=new Q,I0=new et;let F2=0;class Ln{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:F2++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=dp,this.updateRanges=[],this.gpuType=Ai,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;i<o;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)I0.fromBufferAttribute(this,t),I0.applyMatrix3(e),this.setXY(t,I0.x,I0.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.applyMatrix3(e),this.setXYZ(t,na.x,na.y,na.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.applyMatrix4(e),this.setXYZ(t,na.x,na.y,na.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.applyNormalMatrix(e),this.setXYZ(t,na.x,na.y,na.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)na.fromBufferAttribute(this,t),na.transformDirection(e),this.setXYZ(t,na.x,na.y,na.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=hs(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=yn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=hs(t,this.array)),t}setX(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=hs(t,this.array)),t}setY(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=hs(t,this.array)),t}setZ(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=hs(t,this.array)),t}setW(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array),o=yn(o,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==dp&&(e.usage=this.usage),e}}class H2 extends Ln{constructor(e,t,n){super(new Int8Array(e),t,n)}}class P2 extends Ln{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class G2 extends Ln{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class z2 extends Ln{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Bx extends Ln{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class V2 extends Ln{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Dx extends Ln{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class k2 extends Ln{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=xp(this.array[e*this.itemSize]);return this.normalized&&(t=hs(t,this.array)),t}setX(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize]=Hs(t),this}getY(e){let t=xp(this.array[e*this.itemSize+1]);return this.normalized&&(t=hs(t,this.array)),t}setY(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+1]=Hs(t),this}getZ(e){let t=xp(this.array[e*this.itemSize+2]);return this.normalized&&(t=hs(t,this.array)),t}setZ(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+2]=Hs(t),this}getW(e){let t=xp(this.array[e*this.itemSize+3]);return this.normalized&&(t=hs(t,this.array)),t}setW(e,t){return this.normalized&&(t=yn(t,this.array)),this.array[e*this.itemSize+3]=Hs(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array)),this.array[e+0]=Hs(t),this.array[e+1]=Hs(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array)),this.array[e+0]=Hs(t),this.array[e+1]=Hs(n),this.array[e+2]=Hs(i),this}setXYZW(e,t,n,i,o){return e*=this.itemSize,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array),o=yn(o,this.array)),this.array[e+0]=Hs(t),this.array[e+1]=Hs(n),this.array[e+2]=Hs(i),this.array[e+3]=Hs(o),this}}class Pt extends Ln{constructor(e,t,n){super(new Float32Array(e),t,n)}}let X2=0;const gr=new Qt,Ux=new wn,mh=new Q,tr=new Ea,Ap=new Ea,Ta=new Q;class on extends Eo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:X2++}),this.uuid=Qs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(hb(e)?Dx:Bx)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new mn().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return gr.makeRotationFromQuaternion(e),this.applyMatrix4(gr),this}rotateX(e){return gr.makeRotationX(e),this.applyMatrix4(gr),this}rotateY(e){return gr.makeRotationY(e),this.applyMatrix4(gr),this}rotateZ(e){return gr.makeRotationZ(e),this.applyMatrix4(gr),this}translate(e,t,n){return gr.makeTranslation(e,t,n),this.applyMatrix4(gr),this}scale(e,t,n){return gr.makeScale(e,t,n),this.applyMatrix4(gr),this}lookAt(e){return Ux.lookAt(e),Ux.updateMatrix(),this.applyMatrix4(Ux.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(mh).negate(),this.translate(mh.x,mh.y,mh.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;i<o;i++){const l=e[i];n.push(l.x,l.y,l.z||0)}this.setAttribute("position",new Pt(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const o=e[i];t.setXYZ(i,o.x,o.y,o.z||0)}e.length>t.count&&Et("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ea);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Wt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Q(-1/0,-1/0,-1/0),new Q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const o=t[n];tr.setFromBufferAttribute(o),this.morphTargetsRelative?(Ta.addVectors(this.boundingBox.min,tr.min),this.boundingBox.expandByPoint(Ta),Ta.addVectors(this.boundingBox.max,tr.max),this.boundingBox.expandByPoint(Ta)):(this.boundingBox.expandByPoint(tr.min),this.boundingBox.expandByPoint(tr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Wt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ua);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Wt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Q,1/0);return}if(e){const n=this.boundingSphere.center;if(tr.setFromBufferAttribute(e),t)for(let o=0,l=t.length;o<l;o++){const h=t[o];Ap.setFromBufferAttribute(h),this.morphTargetsRelative?(Ta.addVectors(tr.min,Ap.min),tr.expandByPoint(Ta),Ta.addVectors(tr.max,Ap.max),tr.expandByPoint(Ta)):(tr.expandByPoint(Ap.min),tr.expandByPoint(Ap.max))}tr.getCenter(n);let i=0;for(let o=0,l=e.count;o<l;o++)Ta.fromBufferAttribute(e,o),i=Math.max(i,n.distanceToSquared(Ta));if(t)for(let o=0,l=t.length;o<l;o++){const h=t[o],d=this.morphTargetsRelative;for(let p=0,_=h.count;p<_;p++)Ta.fromBufferAttribute(h,p),d&&(mh.fromBufferAttribute(e,p),Ta.add(mh)),i=Math.max(i,n.distanceToSquared(Ta))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Wt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Wt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,o=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ln(new Float32Array(4*n.count),4));const l=this.getAttribute("tangent"),h=[],d=[];for(let k=0;k<n.count;k++)h[k]=new Q,d[k]=new Q;const p=new Q,_=new Q,v=new Q,y=new et,x=new et,b=new et,R=new Q,T=new Q;function M(k,N,I){p.fromBufferAttribute(n,k),_.fromBufferAttribute(n,N),v.fromBufferAttribute(n,I),y.fromBufferAttribute(o,k),x.fromBufferAttribute(o,N),b.fromBufferAttribute(o,I),_.sub(p),v.sub(p),x.sub(y),b.sub(y);const W=1/(x.x*b.y-b.x*x.y);isFinite(W)&&(R.copy(_).multiplyScalar(b.y).addScaledVector(v,-x.y).multiplyScalar(W),T.copy(v).multiplyScalar(x.x).addScaledVector(_,-b.x).multiplyScalar(W),h[k].add(R),h[N].add(R),h[I].add(R),d[k].add(T),d[N].add(T),d[I].add(T))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let k=0,N=w.length;k<N;++k){const I=w[k],W=I.start,ae=I.count;for(let ie=W,se=W+ae;ie<se;ie+=3)M(e.getX(ie+0),e.getX(ie+1),e.getX(ie+2))}const D=new Q,U=new Q,F=new Q,O=new Q;function z(k){F.fromBufferAttribute(i,k),O.copy(F);const N=h[k];D.copy(N),D.sub(F.multiplyScalar(F.dot(N))).normalize(),U.crossVectors(O,N);const W=U.dot(d[k])<0?-1:1;l.setXYZW(k,D.x,D.y,D.z,W)}for(let k=0,N=w.length;k<N;++k){const I=w[k],W=I.start,ae=I.count;for(let ie=W,se=W+ae;ie<se;ie+=3)z(e.getX(ie+0)),z(e.getX(ie+1)),z(e.getX(ie+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ln(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let y=0,x=n.count;y<x;y++)n.setXYZ(y,0,0,0);const i=new Q,o=new Q,l=new Q,h=new Q,d=new Q,p=new Q,_=new Q,v=new Q;if(e)for(let y=0,x=e.count;y<x;y+=3){const b=e.getX(y+0),R=e.getX(y+1),T=e.getX(y+2);i.fromBufferAttribute(t,b),o.fromBufferAttribute(t,R),l.fromBufferAttribute(t,T),_.subVectors(l,o),v.subVectors(i,o),_.cross(v),h.fromBufferAttribute(n,b),d.fromBufferAttribute(n,R),p.fromBufferAttribute(n,T),h.add(_),d.add(_),p.add(_),n.setXYZ(b,h.x,h.y,h.z),n.setXYZ(R,d.x,d.y,d.z),n.setXYZ(T,p.x,p.y,p.z)}else for(let y=0,x=t.count;y<x;y+=3)i.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),l.fromBufferAttribute(t,y+2),_.subVectors(l,o),v.subVectors(i,o),_.cross(v),n.setXYZ(y+0,_.x,_.y,_.z),n.setXYZ(y+1,_.x,_.y,_.z),n.setXYZ(y+2,_.x,_.y,_.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ta.fromBufferAttribute(e,t),Ta.normalize(),e.setXYZ(t,Ta.x,Ta.y,Ta.z)}toNonIndexed(){function e(h,d){const p=h.array,_=h.itemSize,v=h.normalized,y=new p.constructor(d.length*_);let x=0,b=0;for(let R=0,T=d.length;R<T;R++){h.isInterleavedBufferAttribute?x=d[R]*h.data.stride+h.offset:x=d[R]*_;for(let M=0;M<_;M++)y[b++]=p[x++]}return new Ln(y,_,v)}if(this.index===null)return Et("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new on,n=this.index.array,i=this.attributes;for(const h in i){const d=i[h],p=e(d,n);t.setAttribute(h,p)}const o=this.morphAttributes;for(const h in o){const d=[],p=o[h];for(let _=0,v=p.length;_<v;_++){const y=p[_],x=e(y,n);d.push(x)}t.morphAttributes[h]=d}t.morphTargetsRelative=this.morphTargetsRelative;const l=this.groups;for(let h=0,d=l.length;h<d;h++){const p=l[h];t.addGroup(p.start,p.count,p.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const d=this.parameters;for(const p in d)d[p]!==void 0&&(e[p]=d[p]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const d in n){const p=n[d];e.data.attributes[d]=p.toJSON(e.data)}const i={};let o=!1;for(const d in this.morphAttributes){const p=this.morphAttributes[d],_=[];for(let v=0,y=p.length;v<y;v++){const x=p[v];_.push(x.toJSON(e.data))}_.length>0&&(i[d]=_,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const h=this.boundingSphere;return h!==null&&(e.data.boundingSphere=h.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const p in i){const _=i[p];this.setAttribute(p,_.clone(t))}const o=e.morphAttributes;for(const p in o){const _=[],v=o[p];for(let y=0,x=v.length;y<x;y++)_.push(v[y].clone(t));this.morphAttributes[p]=_}this.morphTargetsRelative=e.morphTargetsRelative;const l=e.groups;for(let p=0,_=l.length;p<_;p++){const v=l[p];this.addGroup(v.start,v.count,v.materialIndex)}const h=e.boundingBox;h!==null&&(this.boundingBox=h.clone());const d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Bb=new Qt,Bu=new lh,F0=new ua,Db=new Q,H0=new Q,P0=new Q,G0=new Q,Nx=new Q,z0=new Q,Ub=new Q,V0=new Q;class pi extends wn{constructor(e=new on,t=new fa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o<l;o++){const h=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=o}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const h=this.morphTargetInfluences;if(o&&h){z0.set(0,0,0);for(let d=0,p=o.length;d<p;d++){const _=h[d],v=o[d];_!==0&&(Nx.fromBufferAttribute(v,e),l?z0.addScaledVector(Nx,_):z0.addScaledVector(Nx.sub(t),_))}t.add(z0)}return t}raycast(e,t){const n=this.geometry,i=this.material,o=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),F0.copy(n.boundingSphere),F0.applyMatrix4(o),Bu.copy(e.ray).recast(e.near),!(F0.containsPoint(Bu.origin)===!1&&(Bu.intersectSphere(F0,Db)===null||Bu.origin.distanceToSquared(Db)>(e.far-e.near)**2))&&(Bb.copy(o).invert(),Bu.copy(e.ray).applyMatrix4(Bb),!(n.boundingBox!==null&&Bu.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Bu)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,h=o.index,d=o.attributes.position,p=o.attributes.uv,_=o.attributes.uv1,v=o.attributes.normal,y=o.groups,x=o.drawRange;if(h!==null)if(Array.isArray(l))for(let b=0,R=y.length;b<R;b++){const T=y[b],M=l[T.materialIndex],w=Math.max(T.start,x.start),D=Math.min(h.count,Math.min(T.start+T.count,x.start+x.count));for(let U=w,F=D;U<F;U+=3){const O=h.getX(U),z=h.getX(U+1),k=h.getX(U+2);i=k0(this,M,e,n,p,_,v,O,z,k),i&&(i.faceIndex=Math.floor(U/3),i.face.materialIndex=T.materialIndex,t.push(i))}}else{const b=Math.max(0,x.start),R=Math.min(h.count,x.start+x.count);for(let T=b,M=R;T<M;T+=3){const w=h.getX(T),D=h.getX(T+1),U=h.getX(T+2);i=k0(this,l,e,n,p,_,v,w,D,U),i&&(i.faceIndex=Math.floor(T/3),t.push(i))}}else if(d!==void 0)if(Array.isArray(l))for(let b=0,R=y.length;b<R;b++){const T=y[b],M=l[T.materialIndex],w=Math.max(T.start,x.start),D=Math.min(d.count,Math.min(T.start+T.count,x.start+x.count));for(let U=w,F=D;U<F;U+=3){const O=U,z=U+1,k=U+2;i=k0(this,M,e,n,p,_,v,O,z,k),i&&(i.faceIndex=Math.floor(U/3),i.face.materialIndex=T.materialIndex,t.push(i))}}else{const b=Math.max(0,x.start),R=Math.min(d.count,x.start+x.count);for(let T=b,M=R;T<M;T+=3){const w=T,D=T+1,U=T+2;i=k0(this,l,e,n,p,_,v,w,D,U),i&&(i.faceIndex=Math.floor(T/3),t.push(i))}}}}function Y2(s,e,t,n,i,o,l,h){let d;if(e.side===fs?d=n.intersectTriangle(l,o,i,!0,h):d=n.intersectTriangle(i,o,l,e.side===kr,h),d===null)return null;V0.copy(h),V0.applyMatrix4(s.matrixWorld);const p=t.ray.origin.distanceTo(V0);return p<t.near||p>t.far?null:{distance:p,point:V0.clone(),object:s}}function k0(s,e,t,n,i,o,l,h,d,p){s.getVertexPosition(h,H0),s.getVertexPosition(d,P0),s.getVertexPosition(p,G0);const _=Y2(s,e,t,n,H0,P0,G0,Ub);if(_){const v=new Q;Fs.getBarycoord(Ub,H0,P0,G0,v),i&&(_.uv=Fs.getInterpolatedAttribute(i,h,d,p,v,new et)),o&&(_.uv1=Fs.getInterpolatedAttribute(o,h,d,p,v,new et)),l&&(_.normal=Fs.getInterpolatedAttribute(l,h,d,p,v,new Q),_.normal.dot(n.direction)>0&&_.normal.multiplyScalar(-1));const y={a:h,b:d,c:p,normal:new Q,materialIndex:0};Fs.getNormal(H0,P0,G0,y.normal),_.face=y,_.barycoord=v}return _}class Du extends on{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const h=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const d=[],p=[],_=[],v=[];let y=0,x=0;b("z","y","x",-1,-1,n,t,e,l,o,0),b("z","y","x",1,-1,n,t,-e,l,o,1),b("x","z","y",1,1,e,n,t,i,l,2),b("x","z","y",1,-1,e,n,-t,i,l,3),b("x","y","z",1,-1,e,t,n,i,o,4),b("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(d),this.setAttribute("position",new Pt(p,3)),this.setAttribute("normal",new Pt(_,3)),this.setAttribute("uv",new Pt(v,2));function b(R,T,M,w,D,U,F,O,z,k,N){const I=U/z,W=F/k,ae=U/2,ie=F/2,se=O/2,_e=z+1,H=k+1;let K=0,$=0;const ue=new Q;for(let re=0;re<H;re++){const X=re*W-ie;for(let ne=0;ne<_e;ne++){const Ae=ne*I-ae;ue[R]=Ae*w,ue[T]=X*D,ue[M]=se,p.push(ue.x,ue.y,ue.z),ue[R]=0,ue[T]=0,ue[M]=O>0?1:-1,_.push(ue.x,ue.y,ue.z),v.push(ne/z),v.push(1-re/k),K+=1}}for(let re=0;re<k;re++)for(let X=0;X<z;X++){const ne=y+X+_e*re,Ae=y+X+_e*(re+1),Re=y+(X+1)+_e*(re+1),rt=y+(X+1)+_e*re;d.push(ne,Ae,rt),d.push(Ae,Re,rt),$+=6}h.addGroup(x,$,N),x+=$,y+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Du(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function gh(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(Et("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function ps(s){const e={};for(let t=0;t<s.length;t++){const n=gh(s[t]);for(const i in n)e[i]=n[i]}return e}function J2(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Nb(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Tn.workingColorSpace}const Lb={clone:gh,merge:ps};var q2=`void main() {
|
|
10
10
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
11
11
|
}`,K2=`void main() {
|
|
12
12
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -45,7 +45,7 @@ Error generating stack: `+m.message+`
|
|
|
45
45
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
46
46
|
|
|
47
47
|
}
|
|
48
|
-
`},i=new Du(5,5,5),o=new ms({name:"CubemapFromEquirect",uniforms:gh(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:fs,blending:Xr});o.uniforms.tEquirect.value=t;const l=new pi(i,o),h=t.minFilter;return t.minFilter===Is&&(t.minFilter=bn),new Fb(1,10,this).update(e,l),t.minFilter=h,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}class vr extends wn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const W2={type:"move"};class J0{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vr,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 vr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Q),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,o=null,l=null;const h=this._targetRay,d=this._grip,p=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(p&&e.hand){l=!0;for(const R of e.hand.values()){const T=t.getJointPose(R,n),M=this._getHandJoint(p,R);T!==null&&(M.matrix.fromArray(T.transform.matrix),M.matrix.decompose(M.position,M.rotation,M.scale),M.matrixWorldNeedsUpdate=!0,M.jointRadius=T.radius),M.visible=T!==null}const _=p.joints["index-finger-tip"],v=p.joints["thumb-tip"],y=_.position.distanceTo(v.position),x=.02,b=.005;p.inputState.pinching&&y>x+b?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!p.inputState.pinching&&y<=x-b&&(p.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else d!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(d.matrix.fromArray(o.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,o.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(o.linearVelocity)):d.hasLinearVelocity=!1,o.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(o.angularVelocity)):d.hasAngularVelocity=!1));h!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(h.matrix.fromArray(i.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,i.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(i.linearVelocity)):h.hasLinearVelocity=!1,i.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(i.angularVelocity)):h.hasAngularVelocity=!1,this.dispatchEvent(W2)))}return h!==null&&(h.visible=i!==null),d!==null&&(d.visible=o!==null),p!==null&&(p.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new vr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class q0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new At(e),this.density=t}clone(){return new q0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class K0{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new At(e),this.near=t,this.far=n}clone(){return new K0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Mp extends wn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new er,this.environmentIntensity=1,this.environmentRotation=new er,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class yh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=dp,this.updateRanges=[],this.version=0,this.uuid=Qs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,o=this.stride;i<o;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Qs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Qs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const gs=new Q;class xl{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyMatrix4(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyNormalMatrix(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.transformDirection(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=hs(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=yn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=hs(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=hs(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=hs(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=hs(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e=e*this.data.stride+this.offset,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array),o=yn(o,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=o,this}clone(e){if(e===void 0){mp("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return new Ln(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new xl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){mp("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Lx extends Gi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new At(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let xh;const bp=new Q,Ah=new Q,Sh=new Q,Mh=new et,Ep=new et,Hb=new Qt,W0=new Q,Tp=new Q,j0=new Q,Pb=new et,Ox=new et,Gb=new et;class zb extends wn{constructor(e=new Lx){if(super(),this.isSprite=!0,this.type="Sprite",xh===void 0){xh=new on;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new yh(t,5);xh.setIndex([0,1,2,0,2,3]),xh.setAttribute("position",new xl(n,3,0,!1)),xh.setAttribute("uv",new xl(n,2,3,!1))}this.geometry=xh,this.material=e,this.center=new et(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Wt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ah.setFromMatrixScale(this.matrixWorld),Hb.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Sh.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ah.multiplyScalar(-Sh.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;Z0(W0.set(-.5,-.5,0),Sh,l,Ah,i,o),Z0(Tp.set(.5,-.5,0),Sh,l,Ah,i,o),Z0(j0.set(.5,.5,0),Sh,l,Ah,i,o),Pb.set(0,0),Ox.set(1,0),Gb.set(1,1);let h=e.ray.intersectTriangle(W0,Tp,j0,!1,bp);if(h===null&&(Z0(Tp.set(-.5,.5,0),Sh,l,Ah,i,o),Ox.set(0,1),h=e.ray.intersectTriangle(W0,j0,Tp,!1,bp),h===null))return;const d=e.ray.origin.distanceTo(bp);d<e.near||d>e.far||t.push({distance:d,point:bp.clone(),uv:Fs.getInterpolation(bp,W0,Tp,j0,Pb,Ox,Gb,new et),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Z0(s,e,t,n,i,o){Mh.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Ep.x=o*Mh.x-i*Mh.y,Ep.y=i*Mh.x+o*Mh.y):Ep.copy(Mh),s.copy(e),s.x+=Ep.x,s.y+=Ep.y,s.applyMatrix4(Hb)}const Q0=new Q,Vb=new Q;class kb extends wn{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const o=t[n];this.addLevel(o.object.clone(),o.distance,o.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let o;for(o=0;o<i.length&&!(t<i[o].distance);o++);return i.splice(o,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let o=t[n].distance;if(t[n].object.visible&&(o-=o*t[n].hysteresis),e<o)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Q0.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Q0);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Q0.setFromMatrixPosition(e.matrixWorld),Vb.setFromMatrixPosition(this.matrixWorld);const n=Q0.distanceTo(Vb)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i<o;i++){let l=t[i].distance;if(t[i].object.visible&&(l-=l*t[i].hysteresis),n>=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<o;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,o=n.length;i<o;i++){const l=n[i];t.object.levels.push({object:l.object.uuid,distance:l.distance,hysteresis:l.hysteresis})}return t}}const Xb=new Q,Yb=new ci,Jb=new ci,j2=new Q,qb=new Qt,$0=new Q,Ix=new ua,Kb=new Qt,Fx=new lh;class ev extends pi{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ex,this.bindMatrix=new Qt,this.bindMatrixInverse=new Qt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ea),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,$0),this.boundingBox.expandByPoint($0)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ua),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,$0),this.boundingSphere.expandByPoint($0)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ix.copy(this.boundingSphere),Ix.applyMatrix4(i),e.ray.intersectsSphere(Ix)!==!1&&(Kb.copy(i).invert(),Fx.copy(e.ray).applyMatrix4(Kb),!(this.boundingBox!==null&&Fx.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Fx)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ci,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const o=1/e.manhattanLength();o!==1/0?e.multiplyScalar(o):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===ex?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===tb?this.bindMatrixInverse.copy(this.bindMatrix).invert():Et("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Yb.fromBufferAttribute(i.attributes.skinIndex,e),Jb.fromBufferAttribute(i.attributes.skinWeight,e),Xb.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let o=0;o<4;o++){const l=Jb.getComponent(o);if(l!==0){const h=Yb.getComponent(o);qb.multiplyMatrices(n.bones[h].matrixWorld,n.boneInverses[h]),t.addScaledVector(j2.copy(Xb).applyMatrix4(qb),l)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Cp extends wn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class _r extends qn{constructor(e=null,t=1,n=1,i,o,l,h,d,p=xi,_=xi,v,y){super(null,l,h,d,p,_,i,o,v,y),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Wb=new Qt,Z2=new Qt;class bh{constructor(e=[],t=[]){this.uuid=Qs(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Et("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Qt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Qt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let o=0,l=e.length;o<l;o++){const h=e[o]?e[o].matrixWorld:Z2;Wb.multiplyMatrices(h,t[o]),Wb.toArray(n,o*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new bh(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new _r(t,e,e,ji,Ai);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const o=e.bones[n];let l=t[o];l===void 0&&(Et("Skeleton: No bone found with UUID:",o),l=new Cp),this.bones.push(l),this.boneInverses.push(new Qt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,o=t.length;i<o;i++){const l=t[i];e.bones.push(l.uuid);const h=n[i];e.boneInverses.push(h.toArray())}return e}}class xc extends Ln{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Eh=new Qt,jb=new Qt,tv=[],Zb=new Ea,Q2=new Qt,Rp=new pi,wp=new ua;class nv extends pi{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new xc(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Q2)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ea),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Eh),Zb.copy(e.boundingBox).applyMatrix4(Eh),this.boundingBox.union(Zb)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ua),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Eh),wp.copy(e.boundingSphere).applyMatrix4(Eh),this.boundingSphere.union(wp)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,o=n.length+1,l=e*o+1;for(let h=0;h<n.length;h++)n[h]=i[l+h]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Rp.geometry=this.geometry,Rp.material=this.material,Rp.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),wp.copy(this.boundingSphere),wp.applyMatrix4(n),e.ray.intersectsSphere(wp)!==!1))for(let o=0;o<i;o++){this.getMatrixAt(o,Eh),jb.multiplyMatrices(n,Eh),Rp.matrixWorld=jb,Rp.raycast(e,tv);for(let l=0,h=tv.length;l<h;l++){const d=tv[l];d.instanceId=o,d.object=this,t.push(d)}tv.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new xc(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new _r(new Float32Array(i*this.count),i,this.count,ip,Ai));const o=this.morphTexture.source.data.data;let l=0;for(let p=0;p<n.length;p++)l+=n[p];const h=this.geometry.morphTargetsRelative?1:1-l,d=i*e;o[d]=h,o.set(n,d+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Hx=new Q,$2=new Q,ew=new mn;class Ac{constructor(e=new Q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Hx.subVectors(n,t).cross($2.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Hx),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/i;return o<0||o>1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ew.getNormalMatrix(e),i=this.coplanarPoint(Hx).applyMatrix4(e),o=this.normal.applyMatrix3(n).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 Uu=new ua,tw=new et(.5,.5),iv=new Q;class Th{constructor(e=new Ac,t=new Ac,n=new Ac,i=new Ac,o=new Ac,l=new Ac){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const h=this.planes;return h[0].copy(e),h[1].copy(t),h[2].copy(n),h[3].copy(i),h[4].copy(o),h[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Zs,n=!1){const i=this.planes,o=e.elements,l=o[0],h=o[1],d=o[2],p=o[3],_=o[4],v=o[5],y=o[6],x=o[7],b=o[8],R=o[9],T=o[10],M=o[11],w=o[12],D=o[13],U=o[14],F=o[15];if(i[0].setComponents(p-l,x-_,M-b,F-w).normalize(),i[1].setComponents(p+l,x+_,M+b,F+w).normalize(),i[2].setComponents(p+h,x+v,M+R,F+D).normalize(),i[3].setComponents(p-h,x-v,M-R,F-D).normalize(),n)i[4].setComponents(d,y,T,U).normalize(),i[5].setComponents(p-d,x-y,M-T,F-U).normalize();else if(i[4].setComponents(p-d,x-y,M-T,F-U).normalize(),t===Zs)i[5].setComponents(p+d,x+y,M+T,F+U).normalize();else if(t===$f)i[5].setComponents(d,y,T,U).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Uu.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Uu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Uu)}intersectsSprite(e){Uu.center.set(0,0,0);const t=tw.distanceTo(e.center);return Uu.radius=.7071067811865476+t,Uu.applyMatrix4(e.matrixWorld),this.intersectsSphere(Uu)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(iv.x=i.normal.x>0?e.max.x:e.min.x,iv.y=i.normal.y>0?e.max.y:e.min.y,iv.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(iv)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const To=new Qt,Co=new Th;class av{constructor(){this.coordinateSystem=Zs}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.containsPoint(e))return!0}return!1}clone(){return new av}}function Px(s,e){return s-e}function nw(s,e){return s.z-e.z}function iw(s,e){return e.z-s.z}class aw{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const o=this.pool,l=this.list;this.index>=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const h=o[this.index];l.push(h),this.index++,h.start=e,h.count=t,h.z=n,h.index=i}reset(){this.list.length=0,this.index=0}}const Ps=new Qt,sw=new At(1,1,1),Qb=new Th,rw=new av,sv=new Ea,Nu=new ua,Bp=new Q,$b=new Q,ow=new Q,Gx=new aw,Qa=new pi,rv=[];function lw(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let o=0;o<i;o++)for(let l=0;l<n;l++)e.setComponent(o+t,l,s.getComponent(o,l))}else e.array.set(s.array,t*n);e.needsUpdate=!0}function Lu(s,e){if(s.constructor!==e.constructor){const t=Math.min(s.length,e.length);for(let n=0;n<t;n++)e[n]=s[n]}else{const t=Math.min(s.length,e.length);e.set(new s.constructor(s.buffer,0,t))}}class e1 extends pi{constructor(e,t,n=t*2,i){super(new on,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new _r(t,e,e,ji,Ai);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new _r(t,e,e,ap,js);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new _r(t,e,e,ji,Ai);n.colorSpace=Tn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const o in e.attributes){const l=e.getAttribute(o),{array:h,itemSize:d,normalized:p}=l,_=new h.constructor(n*d),v=new Ln(_,d,p);t.setAttribute(o,v)}if(e.getIndex()!==null){const o=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Ln(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ea);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const o=t[n].geometryIndex;this.getMatrixAt(n,Ps),this.getBoundingBoxAt(o,sv).applyMatrix4(Ps),e.union(sv)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ua);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const o=t[n].geometryIndex;this.getMatrixAt(n,Ps),this.getBoundingSphereAt(o,Nu).applyMatrix4(Ps),e.union(Nu)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Px),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;Ps.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(sw.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let d;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Px),d=this._availableGeometryIds.shift(),o[d]=i):(d=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(d,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,d}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),h=this._geometryInfo[e];if(i&&l.count>h.reservedIndexCount||t.attributes.position.count>h.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const d=h.vertexStart,p=h.reservedVertexCount;h.vertexCount=t.getAttribute("position").count;for(const _ in n.attributes){const v=t.getAttribute(_),y=n.getAttribute(_);lw(v,y,d);const x=v.itemSize;for(let b=v.count,R=p;b<R;b++){const T=d+b;for(let M=0;M<x;M++)y.setComponent(T,M,0)}y.needsUpdate=!0,y.addUpdateRange(d*x,p*x)}if(i){const _=h.indexStart,v=h.reservedIndexCount;h.indexCount=t.getIndex().count;for(let y=0;y<l.count;y++)o.setX(_+y,d+l.getX(y));for(let y=l.count,x=v;y<x;y++)o.setX(_+y,d);o.needsUpdate=!0,o.addUpdateRange(_,h.reservedIndexCount)}return h.start=i?h.indexStart:h.vertexStart,h.count=i?h.indexCount:h.vertexCount,h.boundingBox=null,t.boundingBox!==null&&(h.boundingBox=t.boundingBox.clone()),h.boundingSphere=null,t.boundingSphere!==null&&(h.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;i<o;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((l,h)=>h).sort((l,h)=>n[l].vertexStart-n[h].vertexStart),o=this.geometry;for(let l=0,h=n.length;l<h;l++){const d=i[l],p=n[d];if(p.active!==!1){if(o.index!==null){if(p.indexStart!==t){const{indexStart:_,vertexStart:v,reservedIndexCount:y}=p,x=o.index,b=x.array,R=e-v;for(let T=_;T<_+y;T++)b[T]=b[T]+R;x.array.copyWithin(t,_,_+y),x.addUpdateRange(t,y),x.needsUpdate=!0,p.indexStart=t}t+=p.reservedIndexCount}if(p.vertexStart!==e){const{vertexStart:_,reservedVertexCount:v}=p,y=o.attributes;for(const x in y){const b=y[x],{array:R,itemSize:T}=b;R.copyWithin(e*T,_*T,(_+v)*T),b.addUpdateRange(e*T,v*T),b.needsUpdate=!0}p.vertexStart=e}e+=p.reservedVertexCount,p.start=o.index?p.indexStart:p.vertexStart,this._nextIndexStart=o.index?p.indexStart+p.reservedIndexCount:0,this._nextVertexStart=p.vertexStart+p.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Ea,l=n.index,h=n.attributes.position;for(let d=i.start,p=i.start+i.count;d<p;d++){let _=d;l&&(_=l.getX(_)),o.expandByPoint(Bp.fromBufferAttribute(h,_))}i.boundingBox=o}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new ua;this.getBoundingBoxAt(e,sv),sv.getCenter(o.center);const l=n.index,h=n.attributes.position;let d=0;for(let p=i.start,_=i.start+i.count;p<_;p++){let v=p;l&&(v=l.getX(v)),Bp.fromBufferAttribute(h,v),d=Math.max(d,o.center.distanceToSquared(Bp))}o.radius=Math.sqrt(d),i.boundingSphere=o}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(Px);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),o=new Int32Array(e);Lu(this._multiDrawCounts,i),Lu(this._multiDrawStarts,o),this._multiDrawCounts=i,this._multiDrawStarts=o,this._maxInstanceCount=e;const l=this._indirectTexture,h=this._matricesTexture,d=this._colorsTexture;l.dispose(),this._initIndirectTexture(),Lu(l.image.data,this._indirectTexture.image.data),h.dispose(),this._initMatricesTexture(),Lu(h.image.data,this._matricesTexture.image.data),d&&(d.dispose(),this._initColorsTexture(),Lu(d.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(h=>h.active);if(Math.max(...n.map(h=>h.vertexStart+h.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(d=>d.indexStart+d.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new on,this._initializeGeometry(o));const l=this.geometry;o.index&&Lu(o.index.array,l.index.array);for(const h in o.attributes)Lu(o.attributes[h].array,l.attributes[h].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;Qa.material=this.material,Qa.geometry.index=l.index,Qa.geometry.attributes=l.attributes,Qa.geometry.boundingBox===null&&(Qa.geometry.boundingBox=new Ea),Qa.geometry.boundingSphere===null&&(Qa.geometry.boundingSphere=new ua);for(let h=0,d=n.length;h<d;h++){if(!n[h].visible||!n[h].active)continue;const p=n[h].geometryIndex,_=i[p];Qa.geometry.setDrawRange(_.start,_.count),this.getMatrixAt(h,Qa.matrixWorld).premultiply(o),this.getBoundingBoxAt(p,Qa.geometry.boundingBox),this.getBoundingSphereAt(p,Qa.geometry.boundingSphere),Qa.raycast(e,rv);for(let v=0,y=rv.length;v<y;v++){const x=rv[v];x.object=this,x.batchId=h,t.push(x)}rv.length=0}Qa.material=null,Qa.geometry.index=null,Qa.geometry.attributes={},Qa.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex(),h=l===null?1:l.array.BYTES_PER_ELEMENT,d=this._instanceInfo,p=this._multiDrawStarts,_=this._multiDrawCounts,v=this._geometryInfo,y=this.perObjectFrustumCulled,x=this._indirectTexture,b=x.image.data,R=n.isArrayCamera?rw:Qb;y&&!n.isArrayCamera&&(Ps.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Qb.setFromProjectionMatrix(Ps,n.coordinateSystem,n.reversedDepth));let T=0;if(this.sortObjects){Ps.copy(this.matrixWorld).invert(),Bp.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ps),$b.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ps);for(let D=0,U=d.length;D<U;D++)if(d[D].visible&&d[D].active){const F=d[D].geometryIndex;this.getMatrixAt(D,Ps),this.getBoundingSphereAt(F,Nu).applyMatrix4(Ps);let O=!1;if(y&&(O=!R.intersectsSphere(Nu,n)),!O){const z=v[F],k=ow.subVectors(Nu.center,Bp).dot($b);Gx.push(z.start,z.count,k,D)}}const M=Gx.list,w=this.customSort;w===null?M.sort(o.transparent?iw:nw):w.call(this,M,n);for(let D=0,U=M.length;D<U;D++){const F=M[D];p[T]=F.start*h,_[T]=F.count,b[T]=F.index,T++}Gx.reset()}else for(let M=0,w=d.length;M<w;M++)if(d[M].visible&&d[M].active){const D=d[M].geometryIndex;let U=!1;if(y&&(this.getMatrixAt(M,Ps),this.getBoundingSphereAt(D,Nu).applyMatrix4(Ps),U=!R.intersectsSphere(Nu,n)),!U){const F=v[D];p[T]=F.start*h,_[T]=F.count,b[T]=M,T++}}x.needsUpdate=!0,this._multiDrawCount=T,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,o,l){this.onBeforeRender(e,null,i,o,l)}}class Pa extends Gi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new At(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ov=new Q,lv=new Q,t1=new Qt,Dp=new lh,cv=new ua,zx=new Q,n1=new Q;class Ro extends wn{constructor(e=new on,t=new Pa){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,o=t.count;i<o;i++)ov.fromBufferAttribute(t,i-1),lv.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ov.distanceTo(lv);e.setAttribute("lineDistance",new Ht(n,1))}else Et("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,o=e.params.Line.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),cv.copy(n.boundingSphere),cv.applyMatrix4(i),cv.radius+=o,e.ray.intersectsSphere(cv)===!1)return;t1.copy(i).invert(),Dp.copy(e.ray).applyMatrix4(t1);const h=o/((this.scale.x+this.scale.y+this.scale.z)/3),d=h*h,p=this.isLineSegments?2:1,_=n.index,y=n.attributes.position;if(_!==null){const x=Math.max(0,l.start),b=Math.min(_.count,l.start+l.count);for(let R=x,T=b-1;R<T;R+=p){const M=_.getX(R),w=_.getX(R+1),D=uv(this,e,Dp,d,M,w,R);D&&t.push(D)}if(this.isLineLoop){const R=_.getX(b-1),T=_.getX(x),M=uv(this,e,Dp,d,R,T,b-1);M&&t.push(M)}}else{const x=Math.max(0,l.start),b=Math.min(y.count,l.start+l.count);for(let R=x,T=b-1;R<T;R+=p){const M=uv(this,e,Dp,d,R,R+1,R);M&&t.push(M)}if(this.isLineLoop){const R=uv(this,e,Dp,d,b-1,x,b-1);R&&t.push(R)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o<l;o++){const h=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=o}}}}}function uv(s,e,t,n,i,o,l){const h=s.geometry.attributes.position;if(ov.fromBufferAttribute(h,i),lv.fromBufferAttribute(h,o),t.distanceSqToSegment(ov,lv,zx,n1)>n)return;zx.applyMatrix4(s.matrixWorld);const p=e.ray.origin.distanceTo(zx);if(!(p<e.near||p>e.far))return{distance:p,point:n1.clone().applyMatrix4(s.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:s}}const i1=new Q,a1=new Q;class yr extends Ro{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i<o;i+=2)i1.fromBufferAttribute(t,i),a1.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+i1.distanceTo(a1);e.setAttribute("lineDistance",new Ht(n,1))}else Et("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class fv extends Ro{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Up extends Gi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new At(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const s1=new Qt,Vx=new lh,hv=new ua,dv=new Q;class pv extends wn{constructor(e=new on,t=new Up){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,o=e.params.Points.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),hv.copy(n.boundingSphere),hv.applyMatrix4(i),hv.radius+=o,e.ray.intersectsSphere(hv)===!1)return;s1.copy(i).invert(),Vx.copy(e.ray).applyMatrix4(s1);const h=o/((this.scale.x+this.scale.y+this.scale.z)/3),d=h*h,p=n.index,v=n.attributes.position;if(p!==null){const y=Math.max(0,l.start),x=Math.min(p.count,l.start+l.count);for(let b=y,R=x;b<R;b++){const T=p.getX(b);dv.fromBufferAttribute(v,T),r1(dv,T,d,i,e,t,this)}}else{const y=Math.max(0,l.start),x=Math.min(v.count,l.start+l.count);for(let b=y,R=x;b<R;b++)dv.fromBufferAttribute(v,b),r1(dv,b,d,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o<l;o++){const h=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=o}}}}}function r1(s,e,t,n,i,o,l){const h=Vx.distanceSqToPoint(s);if(h<t){const d=new Q;Vx.closestPointToPoint(s,d),d.applyMatrix4(n);const p=i.ray.origin.distanceTo(d);if(p<i.near||p>i.far)return;o.push({distance:p,distanceToRay:Math.sqrt(h),point:d,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class o1 extends qn{constructor(e,t,n,i,o=bn,l=bn,h,d,p){super(e,t,n,i,o,l,h,d,p),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const _=this;function v(){_.needsUpdate=!0,_._requestVideoFrameCallbackId=e.requestVideoFrameCallback(v)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(v))}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)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class cw extends o1{constructor(e,t,n,i,o,l,h,d){super({},e,t,n,i,o,l,h,d),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class uw extends qn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xi,this.minFilter=xi,this.generateMipmaps=!1,this.needsUpdate=!0}}class mv extends qn{constructor(e,t,n,i,o,l,h,d,p,_,v,y){super(null,l,h,d,p,_,i,o,v,y),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class fw extends mv{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=yi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class hw extends mv{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Yr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class dw extends qn{constructor(e,t,n,i,o,l,h,d,p){super(e,t,n,i,o,l,h,d,p),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ch extends qn{constructor(e,t,n=js,i,o,l,h=xi,d=xi,p,_=bo,v=1){if(_!==bo&&_!==cc)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const y={width:e,height:t,depth:v};super(y,i,o,l,h,d,_,n,p),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new dc(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class l1 extends Ch{constructor(e,t=js,n=Yr,i,o,l=xi,h=xi,d,p=bo){const _={width:e,height:e,depth:1},v=[_,_,_,_,_,_];super(e,e,t,n,i,o,l,h,d,p),this.image=v,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class kx extends qn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class gv extends on{constructor(e=1,t=1,n=4,i=8,o=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:o},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),o=Math.max(1,Math.floor(o));const l=[],h=[],d=[],p=[],_=t/2,v=Math.PI/2*e,y=t,x=2*v+y,b=n*2+o,R=i+1,T=new Q,M=new Q;for(let w=0;w<=b;w++){let D=0,U=0,F=0,O=0;if(w<=n){const N=w/n,I=N*Math.PI/2;U=-_-e*Math.cos(I),F=e*Math.sin(I),O=-e*Math.cos(I),D=N*v}else if(w<=n+o){const N=(w-n)/o;U=-_+N*t,F=e,O=0,D=v+N*y}else{const N=(w-n-o)/n,I=N*Math.PI/2;U=_+e*Math.sin(I),F=e*Math.cos(I),O=e*Math.sin(I),D=v+y+N*v}const z=Math.max(0,Math.min(1,D/x));let k=0;w===0?k=.5/i:w===b&&(k=-.5/i);for(let N=0;N<=i;N++){const I=N/i,W=I*Math.PI*2,ae=Math.sin(W),ie=Math.cos(W);M.x=-F*ie,M.y=U,M.z=F*ae,h.push(M.x,M.y,M.z),T.set(-F*ie,O,F*ae),T.normalize(),d.push(T.x,T.y,T.z),p.push(I+k,z)}if(w>0){const N=(w-1)*R;for(let I=0;I<i;I++){const W=N+I,ae=N+I+1,ie=w*R+I,se=w*R+I+1;l.push(W,ae,ie),l.push(ae,se,ie)}}}this.setIndex(l),this.setAttribute("position",new Ht(h,3)),this.setAttribute("normal",new Ht(d,3)),this.setAttribute("uv",new Ht(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gv(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class vv extends on{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const o=[],l=[],h=[],d=[],p=new Q,_=new et;l.push(0,0,0),h.push(0,0,1),d.push(.5,.5);for(let v=0,y=3;v<=t;v++,y+=3){const x=n+v/t*i;p.x=e*Math.cos(x),p.y=e*Math.sin(x),l.push(p.x,p.y,p.z),h.push(0,0,1),_.x=(l[y]/e+1)/2,_.y=(l[y+1]/e+1)/2,d.push(_.x,_.y)}for(let v=1;v<=t;v++)o.push(v,v+1,0);this.setIndex(o),this.setAttribute("position",new Ht(l,3)),this.setAttribute("normal",new Ht(h,3)),this.setAttribute("uv",new Ht(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vv(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Np extends on{constructor(e=1,t=1,n=1,i=32,o=1,l=!1,h=0,d=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:o,openEnded:l,thetaStart:h,thetaLength:d};const p=this;i=Math.floor(i),o=Math.floor(o);const _=[],v=[],y=[],x=[];let b=0;const R=[],T=n/2;let M=0;w(),l===!1&&(e>0&&D(!0),t>0&&D(!1)),this.setIndex(_),this.setAttribute("position",new Ht(v,3)),this.setAttribute("normal",new Ht(y,3)),this.setAttribute("uv",new Ht(x,2));function w(){const U=new Q,F=new Q;let O=0;const z=(t-e)/n;for(let k=0;k<=o;k++){const N=[],I=k/o,W=I*(t-e)+e;for(let ae=0;ae<=i;ae++){const ie=ae/i,se=ie*d+h,_e=Math.sin(se),H=Math.cos(se);F.x=W*_e,F.y=-I*n+T,F.z=W*H,v.push(F.x,F.y,F.z),U.set(_e,z,H).normalize(),y.push(U.x,U.y,U.z),x.push(ie,1-I),N.push(b++)}R.push(N)}for(let k=0;k<i;k++)for(let N=0;N<o;N++){const I=R[N][k],W=R[N+1][k],ae=R[N+1][k+1],ie=R[N][k+1];(e>0||N!==0)&&(_.push(I,W,ie),O+=3),(t>0||N!==o-1)&&(_.push(W,ae,ie),O+=3)}p.addGroup(M,O,0),M+=O}function D(U){const F=b,O=new et,z=new Q;let k=0;const N=U===!0?e:t,I=U===!0?1:-1;for(let ae=1;ae<=i;ae++)v.push(0,T*I,0),y.push(0,I,0),x.push(.5,.5),b++;const W=b;for(let ae=0;ae<=i;ae++){const se=ae/i*d+h,_e=Math.cos(se),H=Math.sin(se);z.x=N*H,z.y=T*I,z.z=N*_e,v.push(z.x,z.y,z.z),y.push(0,I,0),O.x=_e*.5+.5,O.y=H*.5*I+.5,x.push(O.x,O.y),b++}for(let ae=0;ae<i;ae++){const ie=F+ae,se=W+ae;U===!0?_.push(se,se+1,ie):_.push(se+1,se,ie),k+=3}p.addGroup(M,k,U===!0?1:2),M+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Np(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Lp extends Np{constructor(e=1,t=1,n=32,i=1,o=!1,l=0,h=Math.PI*2){super(0,e,t,n,i,o,l,h),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:l,thetaLength:h}}static fromJSON(e){return new Lp(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Sc extends on{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const o=[],l=[];h(i),p(n),_(),this.setAttribute("position",new Ht(o,3)),this.setAttribute("normal",new Ht(o.slice(),3)),this.setAttribute("uv",new Ht(l,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function h(w){const D=new Q,U=new Q,F=new Q;for(let O=0;O<t.length;O+=3)x(t[O+0],D),x(t[O+1],U),x(t[O+2],F),d(D,U,F,w)}function d(w,D,U,F){const O=F+1,z=[];for(let k=0;k<=O;k++){z[k]=[];const N=w.clone().lerp(U,k/O),I=D.clone().lerp(U,k/O),W=O-k;for(let ae=0;ae<=W;ae++)ae===0&&k===O?z[k][ae]=N:z[k][ae]=N.clone().lerp(I,ae/W)}for(let k=0;k<O;k++)for(let N=0;N<2*(O-k)-1;N++){const I=Math.floor(N/2);N%2===0?(y(z[k][I+1]),y(z[k+1][I]),y(z[k][I])):(y(z[k][I+1]),y(z[k+1][I+1]),y(z[k+1][I]))}}function p(w){const D=new Q;for(let U=0;U<o.length;U+=3)D.x=o[U+0],D.y=o[U+1],D.z=o[U+2],D.normalize().multiplyScalar(w),o[U+0]=D.x,o[U+1]=D.y,o[U+2]=D.z}function _(){const w=new Q;for(let D=0;D<o.length;D+=3){w.x=o[D+0],w.y=o[D+1],w.z=o[D+2];const U=T(w)/2/Math.PI+.5,F=M(w)/Math.PI+.5;l.push(U,1-F)}b(),v()}function v(){for(let w=0;w<l.length;w+=6){const D=l[w+0],U=l[w+2],F=l[w+4],O=Math.max(D,U,F),z=Math.min(D,U,F);O>.9&&z<.1&&(D<.2&&(l[w+0]+=1),U<.2&&(l[w+2]+=1),F<.2&&(l[w+4]+=1))}}function y(w){o.push(w.x,w.y,w.z)}function x(w,D){const U=w*3;D.x=e[U+0],D.y=e[U+1],D.z=e[U+2]}function b(){const w=new Q,D=new Q,U=new Q,F=new Q,O=new et,z=new et,k=new et;for(let N=0,I=0;N<o.length;N+=9,I+=6){w.set(o[N+0],o[N+1],o[N+2]),D.set(o[N+3],o[N+4],o[N+5]),U.set(o[N+6],o[N+7],o[N+8]),O.set(l[I+0],l[I+1]),z.set(l[I+2],l[I+3]),k.set(l[I+4],l[I+5]),F.copy(w).add(D).add(U).divideScalar(3);const W=T(F);R(O,I+0,w,W),R(z,I+2,D,W),R(k,I+4,U,W)}}function R(w,D,U,F){F<0&&w.x===1&&(l[D]=w.x-1),U.x===0&&U.z===0&&(l[D]=F/2/Math.PI+.5)}function T(w){return Math.atan2(w.z,-w.x)}function M(w){return Math.atan2(-w.y,Math.sqrt(w.x*w.x+w.z*w.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sc(e.vertices,e.indices,e.radius,e.detail)}}class _v extends Sc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],l=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(o,l,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new _v(e.radius,e.detail)}}const yv=new Q,xv=new Q,Xx=new Q,Av=new Fs;class c1 extends on{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),o=Math.cos(Tu*t),l=e.getIndex(),h=e.getAttribute("position"),d=l?l.count:h.count,p=[0,0,0],_=["a","b","c"],v=new Array(3),y={},x=[];for(let b=0;b<d;b+=3){l?(p[0]=l.getX(b),p[1]=l.getX(b+1),p[2]=l.getX(b+2)):(p[0]=b,p[1]=b+1,p[2]=b+2);const{a:R,b:T,c:M}=Av;if(R.fromBufferAttribute(h,p[0]),T.fromBufferAttribute(h,p[1]),M.fromBufferAttribute(h,p[2]),Av.getNormal(Xx),v[0]=`${Math.round(R.x*i)},${Math.round(R.y*i)},${Math.round(R.z*i)}`,v[1]=`${Math.round(T.x*i)},${Math.round(T.y*i)},${Math.round(T.z*i)}`,v[2]=`${Math.round(M.x*i)},${Math.round(M.y*i)},${Math.round(M.z*i)}`,!(v[0]===v[1]||v[1]===v[2]||v[2]===v[0]))for(let w=0;w<3;w++){const D=(w+1)%3,U=v[w],F=v[D],O=Av[_[w]],z=Av[_[D]],k=`${U}_${F}`,N=`${F}_${U}`;N in y&&y[N]?(Xx.dot(y[N].normal)<=o&&(x.push(O.x,O.y,O.z),x.push(z.x,z.y,z.z)),y[N]=null):k in y||(y[k]={index0:p[w],index1:p[D],normal:Xx.clone()})}}for(const b in y)if(y[b]){const{index0:R,index1:T}=y[b];yv.fromBufferAttribute(h,R),xv.fromBufferAttribute(h,T),x.push(yv.x,yv.y,yv.z),x.push(xv.x,xv.y,xv.z)}this.setAttribute("position",new Ht(x,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class jr{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Et("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),o=0;t.push(0);for(let l=1;l<=e;l++)n=this.getPoint(l/e),o+=n.distanceTo(i),t.push(o),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const o=n.length;let l;t?l=t:l=e*n[o-1];let h=0,d=o-1,p;for(;h<=d;)if(i=Math.floor(h+(d-h)/2),p=n[i]-l,p<0)h=i+1;else if(p>0)d=i-1;else{d=i;break}if(i=d,n[i]===l)return i/(o-1);const _=n[i],y=n[i+1]-_,x=(l-_)/y;return(i+x)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),h=this.getPoint(o),d=t||(l.isVector2?new et:new Q);return d.copy(h).sub(l).normalize(),d}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new Q,i=[],o=[],l=[],h=new Q,d=new Qt;for(let x=0;x<=e;x++){const b=x/e;i[x]=this.getTangentAt(b,new Q)}o[0]=new Q,l[0]=new Q;let p=Number.MAX_VALUE;const _=Math.abs(i[0].x),v=Math.abs(i[0].y),y=Math.abs(i[0].z);_<=p&&(p=_,n.set(1,0,0)),v<=p&&(p=v,n.set(0,1,0)),y<=p&&n.set(0,0,1),h.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],h),l[0].crossVectors(i[0],o[0]);for(let x=1;x<=e;x++){if(o[x]=o[x-1].clone(),l[x]=l[x-1].clone(),h.crossVectors(i[x-1],i[x]),h.length()>Number.EPSILON){h.normalize();const b=Math.acos(rn(i[x-1].dot(i[x]),-1,1));o[x].applyMatrix4(d.makeRotationAxis(h,b))}l[x].crossVectors(i[x],o[x])}if(t===!0){let x=Math.acos(rn(o[0].dot(o[e]),-1,1));x/=e,i[0].dot(h.crossVectors(o[0],o[e]))>0&&(x=-x);for(let b=1;b<=e;b++)o[b].applyMatrix4(d.makeRotationAxis(i[b],x*b)),l[b].crossVectors(i[b],o[b])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Sv extends jr{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,h=!1,d=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=h,this.aRotation=d}getPoint(e,t=new et){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=i;for(;o>i;)o-=i;o<Number.EPSILON&&(l?o=0:o=i),this.aClockwise===!0&&!l&&(o===i?o=-i:o=o-i);const h=this.aStartAngle+e*o;let d=this.aX+this.xRadius*Math.cos(h),p=this.aY+this.yRadius*Math.sin(h);if(this.aRotation!==0){const _=Math.cos(this.aRotation),v=Math.sin(this.aRotation),y=d-this.aX,x=p-this.aY;d=y*_-x*v+this.aX,p=y*v+x*_+this.aY}return n.set(d,p)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class u1 extends Sv{constructor(e,t,n,i,o,l){super(e,t,n,n,i,o,l),this.isArcCurve=!0,this.type="ArcCurve"}}function Yx(){let s=0,e=0,t=0,n=0;function i(o,l,h,d){s=o,e=h,t=-3*o+3*l-2*h-d,n=2*o-2*l+h+d}return{initCatmullRom:function(o,l,h,d,p){i(l,h,p*(h-o),p*(d-l))},initNonuniformCatmullRom:function(o,l,h,d,p,_,v){let y=(l-o)/p-(h-o)/(p+_)+(h-l)/_,x=(h-l)/_-(d-l)/(_+v)+(d-h)/v;y*=_,x*=_,i(l,h,y,x)},calc:function(o){const l=o*o,h=l*o;return s+e*o+t*l+n*h}}}const Mv=new Q,Jx=new Yx,qx=new Yx,Kx=new Yx;class f1 extends jr{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Q){const n=t,i=this.points,o=i.length,l=(o-(this.closed?0:1))*e;let h=Math.floor(l),d=l-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/o)+1)*o:d===0&&h===o-1&&(h=o-2,d=1);let p,_;this.closed||h>0?p=i[(h-1)%o]:(Mv.subVectors(i[0],i[1]).add(i[0]),p=Mv);const v=i[h%o],y=i[(h+1)%o];if(this.closed||h+2<o?_=i[(h+2)%o]:(Mv.subVectors(i[o-1],i[o-2]).add(i[o-1]),_=Mv),this.curveType==="centripetal"||this.curveType==="chordal"){const x=this.curveType==="chordal"?.5:.25;let b=Math.pow(p.distanceToSquared(v),x),R=Math.pow(v.distanceToSquared(y),x),T=Math.pow(y.distanceToSquared(_),x);R<1e-4&&(R=1),b<1e-4&&(b=R),T<1e-4&&(T=R),Jx.initNonuniformCatmullRom(p.x,v.x,y.x,_.x,b,R,T),qx.initNonuniformCatmullRom(p.y,v.y,y.y,_.y,b,R,T),Kx.initNonuniformCatmullRom(p.z,v.z,y.z,_.z,b,R,T)}else this.curveType==="catmullrom"&&(Jx.initCatmullRom(p.x,v.x,y.x,_.x,this.tension),qx.initCatmullRom(p.y,v.y,y.y,_.y,this.tension),Kx.initCatmullRom(p.z,v.z,y.z,_.z,this.tension));return n.set(Jx.calc(d),qx.calc(d),Kx.calc(d)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new Q().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function h1(s,e,t,n,i){const o=(n-e)*.5,l=(i-t)*.5,h=s*s,d=s*h;return(2*t-2*n+o+l)*d+(-3*t+3*n-2*o-l)*h+o*s+t}function pw(s,e){const t=1-s;return t*t*e}function mw(s,e){return 2*(1-s)*s*e}function gw(s,e){return s*s*e}function Op(s,e,t,n){return pw(s,e)+mw(s,t)+gw(s,n)}function vw(s,e){const t=1-s;return t*t*t*e}function _w(s,e){const t=1-s;return 3*t*t*s*e}function yw(s,e){return 3*(1-s)*s*s*e}function xw(s,e){return s*s*s*e}function Ip(s,e,t,n,i){return vw(s,e)+_w(s,t)+yw(s,n)+xw(s,i)}class Wx extends jr{constructor(e=new et,t=new et,n=new et,i=new et){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new et){const n=t,i=this.v0,o=this.v1,l=this.v2,h=this.v3;return n.set(Ip(e,i.x,o.x,l.x,h.x),Ip(e,i.y,o.y,l.y,h.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class d1 extends jr{constructor(e=new Q,t=new Q,n=new Q,i=new Q){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Q){const n=t,i=this.v0,o=this.v1,l=this.v2,h=this.v3;return n.set(Ip(e,i.x,o.x,l.x,h.x),Ip(e,i.y,o.y,l.y,h.y),Ip(e,i.z,o.z,l.z,h.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class jx extends jr{constructor(e=new et,t=new et){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new et){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new et){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class p1 extends jr{constructor(e=new Q,t=new Q){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Q){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Q){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Zx extends jr{constructor(e=new et,t=new et,n=new et){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new et){const n=t,i=this.v0,o=this.v1,l=this.v2;return n.set(Op(e,i.x,o.x,l.x),Op(e,i.y,o.y,l.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Qx extends jr{constructor(e=new Q,t=new Q,n=new Q){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Q){const n=t,i=this.v0,o=this.v1,l=this.v2;return n.set(Op(e,i.x,o.x,l.x),Op(e,i.y,o.y,l.y),Op(e,i.z,o.z,l.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class $x extends jr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new et){const n=t,i=this.points,o=(i.length-1)*e,l=Math.floor(o),h=o-l,d=i[l===0?l:l-1],p=i[l],_=i[l>i.length-2?i.length-1:l+1],v=i[l>i.length-3?i.length-1:l+2];return n.set(h1(h,d.x,p.x,_.x,v.x),h1(h,d.y,p.y,_.y,v.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new et().fromArray(i))}return this}}var bv=Object.freeze({__proto__:null,ArcCurve:u1,CatmullRomCurve3:f1,CubicBezierCurve:Wx,CubicBezierCurve3:d1,EllipseCurve:Sv,LineCurve:jx,LineCurve3:p1,QuadraticBezierCurve:Zx,QuadraticBezierCurve3:Qx,SplineCurve:$x});class m1 extends jr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new bv[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let o=0;for(;o<i.length;){if(i[o]>=n){const l=i[o]-n,h=this.curves[o],d=h.getLength(),p=d===0?0:1-l/d;return h.getPointAt(p,t)}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 t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,o=this.curves;i<o.length;i++){const l=o[i],h=l.isEllipseCurve?e*2:l.isLineCurve||l.isLineCurve3?1:l.isSplineCurve?e*l.points.length:e,d=l.getPoints(h);for(let p=0;p<d.length;p++){const _=d[p];n&&n.equals(_)||(t.push(_),n=_)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new bv[i.type]().fromJSON(i))}return this}}class Ev extends m1{constructor(e){super(),this.type="Path",this.currentPoint=new et,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new jx(this.currentPoint.clone(),new et(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const o=new Zx(this.currentPoint.clone(),new et(e,t),new et(n,i));return this.curves.push(o),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,o,l){const h=new Wx(this.currentPoint.clone(),new et(e,t),new et(n,i),new et(o,l));return this.curves.push(h),this.currentPoint.set(o,l),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new $x(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,o,l){const h=this.currentPoint.x,d=this.currentPoint.y;return this.absarc(e+h,t+d,n,i,o,l),this}absarc(e,t,n,i,o,l){return this.absellipse(e,t,n,n,i,o,l),this}ellipse(e,t,n,i,o,l,h,d){const p=this.currentPoint.x,_=this.currentPoint.y;return this.absellipse(e+p,t+_,n,i,o,l,h,d),this}absellipse(e,t,n,i,o,l,h,d){const p=new Sv(e,t,n,i,o,l,h,d);if(this.curves.length>0){const v=p.getPoint(0);v.equals(this.currentPoint)||this.lineTo(v.x,v.y)}this.curves.push(p);const _=p.getPoint(1);return this.currentPoint.copy(_),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 Ou extends Ev{constructor(e){super(e),this.uuid=Qs(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Ev().fromJSON(i))}return this}}function Aw(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let o=g1(s,0,i,t,!0);const l=[];if(!o||o.next===o.prev)return l;let h,d,p;if(n&&(o=Tw(s,e,o,t)),s.length>80*t){h=s[0],d=s[1];let _=h,v=d;for(let y=t;y<i;y+=t){const x=s[y],b=s[y+1];x<h&&(h=x),b<d&&(d=b),x>_&&(_=x),b>v&&(v=b)}p=Math.max(_-h,v-d),p=p!==0?32767/p:0}return Fp(o,l,t,h,d,p,0),l}function g1(s,e,t,n,i){let o;if(i===Fw(s,e,t,n)>0)for(let l=e;l<t;l+=n)o=x1(l/n|0,s[l],s[l+1],o);else for(let l=t-n;l>=e;l-=n)o=x1(l/n|0,s[l],s[l+1],o);return o&&Rh(o,o.next)&&(Gp(o),o=o.next),o}function Iu(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(Rh(t,t.next)||Bi(t.prev,t,t.next)===0)){if(Gp(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Fp(s,e,t,n,i,o,l){if(!s)return;!l&&o&&Dw(s,n,i,o);let h=s;for(;s.prev!==s.next;){const d=s.prev,p=s.next;if(o?Mw(s,n,i,o):Sw(s)){e.push(d.i,s.i,p.i),Gp(s),s=p.next,h=p.next;continue}if(s=p,s===h){l?l===1?(s=bw(Iu(s),e),Fp(s,e,t,n,i,o,2)):l===2&&Ew(s,e,t,n,i,o):Fp(Iu(s),e,t,n,i,o,1);break}}}function Sw(s){const e=s.prev,t=s,n=s.next;if(Bi(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,h=e.y,d=t.y,p=n.y,_=Math.min(i,o,l),v=Math.min(h,d,p),y=Math.max(i,o,l),x=Math.max(h,d,p);let b=n.next;for(;b!==e;){if(b.x>=_&&b.x<=y&&b.y>=v&&b.y<=x&&Hp(i,h,o,d,l,p,b.x,b.y)&&Bi(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function Mw(s,e,t,n){const i=s.prev,o=s,l=s.next;if(Bi(i,o,l)>=0)return!1;const h=i.x,d=o.x,p=l.x,_=i.y,v=o.y,y=l.y,x=Math.min(h,d,p),b=Math.min(_,v,y),R=Math.max(h,d,p),T=Math.max(_,v,y),M=eA(x,b,e,t,n),w=eA(R,T,e,t,n);let D=s.prevZ,U=s.nextZ;for(;D&&D.z>=M&&U&&U.z<=w;){if(D.x>=x&&D.x<=R&&D.y>=b&&D.y<=T&&D!==i&&D!==l&&Hp(h,_,d,v,p,y,D.x,D.y)&&Bi(D.prev,D,D.next)>=0||(D=D.prevZ,U.x>=x&&U.x<=R&&U.y>=b&&U.y<=T&&U!==i&&U!==l&&Hp(h,_,d,v,p,y,U.x,U.y)&&Bi(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;D&&D.z>=M;){if(D.x>=x&&D.x<=R&&D.y>=b&&D.y<=T&&D!==i&&D!==l&&Hp(h,_,d,v,p,y,D.x,D.y)&&Bi(D.prev,D,D.next)>=0)return!1;D=D.prevZ}for(;U&&U.z<=w;){if(U.x>=x&&U.x<=R&&U.y>=b&&U.y<=T&&U!==i&&U!==l&&Hp(h,_,d,v,p,y,U.x,U.y)&&Bi(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function bw(s,e){let t=s;do{const n=t.prev,i=t.next.next;!Rh(n,i)&&_1(n,t,t.next,i)&&Pp(n,i)&&Pp(i,n)&&(e.push(n.i,t.i,i.i),Gp(t),Gp(t.next),t=s=i),t=t.next}while(t!==s);return Iu(t)}function Ew(s,e,t,n,i,o){let l=s;do{let h=l.next.next;for(;h!==l.prev;){if(l.i!==h.i&&Lw(l,h)){let d=y1(l,h);l=Iu(l,l.next),d=Iu(d,d.next),Fp(l,e,t,n,i,o,0),Fp(d,e,t,n,i,o,0);return}h=h.next}l=l.next}while(l!==s)}function Tw(s,e,t,n){const i=[];for(let o=0,l=e.length;o<l;o++){const h=e[o]*n,d=o<l-1?e[o+1]*n:s.length,p=g1(s,h,d,n,!1);p===p.next&&(p.steiner=!0),i.push(Nw(p))}i.sort(Cw);for(let o=0;o<i.length;o++)t=Rw(i[o],t);return t}function Cw(s,e){let t=s.x-e.x;if(t===0&&(t=s.y-e.y,t===0)){const n=(s.next.y-s.y)/(s.next.x-s.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function Rw(s,e){const t=ww(s,e);if(!t)return e;const n=y1(t,s);return Iu(n,n.next),Iu(t,t.next)}function ww(s,e){let t=e;const n=s.x,i=s.y;let o=-1/0,l;if(Rh(s,t))return t;do{if(Rh(s,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const v=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(v<=n&&v>o&&(o=v,l=t.x<t.next.x?t:t.next,v===n))return l}t=t.next}while(t!==e);if(!l)return null;const h=l,d=l.x,p=l.y;let _=1/0;t=l;do{if(n>=t.x&&t.x>=d&&n!==t.x&&v1(i<p?n:o,i,d,p,i<p?o:n,i,t.x,t.y)){const v=Math.abs(i-t.y)/(n-t.x);Pp(t,s)&&(v<_||v===_&&(t.x>l.x||t.x===l.x&&Bw(l,t)))&&(l=t,_=v)}t=t.next}while(t!==h);return l}function Bw(s,e){return Bi(s.prev,s,e.prev)<0&&Bi(e.next,s,s.next)<0}function Dw(s,e,t,n){let i=s;do i.z===0&&(i.z=eA(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,Uw(i)}function Uw(s){let e,t=1;do{let n=s,i;s=null;let o=null;for(e=0;n;){e++;let l=n,h=0;for(let p=0;p<t&&(h++,l=l.nextZ,!!l);p++);let d=t;for(;h>0||d>0&&l;)h!==0&&(d===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,h--):(i=l,l=l.nextZ,d--),o?o.nextZ=i:s=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return s}function eA(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function Nw(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function v1(s,e,t,n,i,o,l,h){return(i-l)*(e-h)>=(s-l)*(o-h)&&(s-l)*(n-h)>=(t-l)*(e-h)&&(t-l)*(o-h)>=(i-l)*(n-h)}function Hp(s,e,t,n,i,o,l,h){return!(s===l&&e===h)&&v1(s,e,t,n,i,o,l,h)}function Lw(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!Ow(s,e)&&(Pp(s,e)&&Pp(e,s)&&Iw(s,e)&&(Bi(s.prev,s,e.prev)||Bi(s,e.prev,e))||Rh(s,e)&&Bi(s.prev,s,s.next)>0&&Bi(e.prev,e,e.next)>0)}function Bi(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function Rh(s,e){return s.x===e.x&&s.y===e.y}function _1(s,e,t,n){const i=Cv(Bi(s,e,t)),o=Cv(Bi(s,e,n)),l=Cv(Bi(t,n,s)),h=Cv(Bi(t,n,e));return!!(i!==o&&l!==h||i===0&&Tv(s,t,e)||o===0&&Tv(s,n,e)||l===0&&Tv(t,s,n)||h===0&&Tv(t,e,n))}function Tv(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Cv(s){return s>0?1:s<0?-1:0}function Ow(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&_1(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Pp(s,e){return Bi(s.prev,s,s.next)<0?Bi(s,e,s.next)>=0&&Bi(s,s.prev,e)>=0:Bi(s,e,s.prev)<0||Bi(s,s.next,e)<0}function Iw(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,o=(s.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function y1(s,e){const t=tA(s.i,s.x,s.y),n=tA(e.i,e.x,e.y),i=s.next,o=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function x1(s,e,t,n){const i=tA(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Gp(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function tA(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Fw(s,e,t,n){let i=0;for(let o=e,l=t-n;o<t;o+=n)i+=(s[l]-s[o])*(s[o+1]+s[l+1]),l=o;return i}class Hw{static triangulate(e,t,n=2){return Aw(e,t,n)}}class Zr{static area(e){const t=e.length;let n=0;for(let i=t-1,o=0;o<t;i=o++)n+=e[i].x*e[o].y-e[o].x*e[i].y;return n*.5}static isClockWise(e){return Zr.area(e)<0}static triangulateShape(e,t){const n=[],i=[],o=[];A1(e),S1(n,e);let l=e.length;t.forEach(A1);for(let d=0;d<t.length;d++)i.push(l),l+=t[d].length,S1(n,t[d]);const h=Hw.triangulate(n,i);for(let d=0;d<h.length;d+=3)o.push(h.slice(d,d+3));return o}}function A1(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function S1(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class Rv extends on{constructor(e=new Ou([new et(.5,.5),new et(-.5,.5),new et(-.5,-.5),new et(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],o=[];for(let h=0,d=e.length;h<d;h++){const p=e[h];l(p)}this.setAttribute("position",new Ht(i,3)),this.setAttribute("uv",new Ht(o,2)),this.computeVertexNormals();function l(h){const d=[],p=t.curveSegments!==void 0?t.curveSegments:12,_=t.steps!==void 0?t.steps:1,v=t.depth!==void 0?t.depth:1;let y=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,b=t.bevelSize!==void 0?t.bevelSize:x-.1,R=t.bevelOffset!==void 0?t.bevelOffset:0,T=t.bevelSegments!==void 0?t.bevelSegments:3;const M=t.extrudePath,w=t.UVGenerator!==void 0?t.UVGenerator:Pw;let D,U=!1,F,O,z,k;if(M){D=M.getSpacedPoints(_),U=!0,y=!1;const Ve=M.isCatmullRomCurve3?M.closed:!1;F=M.computeFrenetFrames(_,Ve),O=new Q,z=new Q,k=new Q}y||(T=0,x=0,b=0,R=0);const N=h.extractPoints(p);let I=N.shape;const W=N.holes;if(!Zr.isClockWise(I)){I=I.reverse();for(let Ve=0,nt=W.length;Ve<nt;Ve++){const Ge=W[Ve];Zr.isClockWise(Ge)&&(W[Ve]=Ge.reverse())}}function ie(Ve){const Ge=10000000000000001e-36;let ft=Ve[0];for(let ee=1;ee<=Ve.length;ee++){const Nt=ee%Ve.length,pt=Ve[Nt],Lt=pt.x-ft.x,gt=pt.y-ft.y,Z=Lt*Lt+gt*gt,P=Math.max(Math.abs(pt.x),Math.abs(pt.y),Math.abs(ft.x),Math.abs(ft.y)),me=Ge*P*P;if(Z<=me){Ve.splice(Nt,1),ee--;continue}ft=pt}}ie(I),W.forEach(ie);const se=W.length,_e=I;for(let Ve=0;Ve<se;Ve++){const nt=W[Ve];I=I.concat(nt)}function H(Ve,nt,Ge){return nt||Wt("ExtrudeGeometry: vec does not exist"),Ve.clone().addScaledVector(nt,Ge)}const K=I.length;function $(Ve,nt,Ge){let ft,ee,Nt;const pt=Ve.x-nt.x,Lt=Ve.y-nt.y,gt=Ge.x-Ve.x,Z=Ge.y-Ve.y,P=pt*pt+Lt*Lt,me=pt*Z-Lt*gt;if(Math.abs(me)>Number.EPSILON){const Le=Math.sqrt(P),Xe=Math.sqrt(gt*gt+Z*Z),Fe=nt.x-Lt/Le,Bt=nt.y+pt/Le,_t=Ge.x-Z/Xe,Ot=Ge.y+gt/Xe,kt=((_t-Fe)*Z-(Ot-Bt)*gt)/(pt*Z-Lt*gt);ft=Fe+pt*kt-Ve.x,ee=Bt+Lt*kt-Ve.y;const Ke=ft*ft+ee*ee;if(Ke<=2)return new et(ft,ee);Nt=Math.sqrt(Ke/2)}else{let Le=!1;pt>Number.EPSILON?gt>Number.EPSILON&&(Le=!0):pt<-Number.EPSILON?gt<-Number.EPSILON&&(Le=!0):Math.sign(Lt)===Math.sign(Z)&&(Le=!0),Le?(ft=-Lt,ee=pt,Nt=Math.sqrt(P)):(ft=pt,ee=Lt,Nt=Math.sqrt(P/2))}return new et(ft/Nt,ee/Nt)}const ue=[];for(let Ve=0,nt=_e.length,Ge=nt-1,ft=Ve+1;Ve<nt;Ve++,Ge++,ft++)Ge===nt&&(Ge=0),ft===nt&&(ft=0),ue[Ve]=$(_e[Ve],_e[Ge],_e[ft]);const re=[];let X,ne=ue.concat();for(let Ve=0,nt=se;Ve<nt;Ve++){const Ge=W[Ve];X=[];for(let ft=0,ee=Ge.length,Nt=ee-1,pt=ft+1;ft<ee;ft++,Nt++,pt++)Nt===ee&&(Nt=0),pt===ee&&(pt=0),X[ft]=$(Ge[ft],Ge[Nt],Ge[pt]);re.push(X),ne=ne.concat(X)}let Ae;if(T===0)Ae=Zr.triangulateShape(_e,W);else{const Ve=[],nt=[];for(let Ge=0;Ge<T;Ge++){const ft=Ge/T,ee=x*Math.cos(ft*Math.PI/2),Nt=b*Math.sin(ft*Math.PI/2)+R;for(let pt=0,Lt=_e.length;pt<Lt;pt++){const gt=H(_e[pt],ue[pt],Nt);xt(gt.x,gt.y,-ee),ft===0&&Ve.push(gt)}for(let pt=0,Lt=se;pt<Lt;pt++){const gt=W[pt];X=re[pt];const Z=[];for(let P=0,me=gt.length;P<me;P++){const Le=H(gt[P],X[P],Nt);xt(Le.x,Le.y,-ee),ft===0&&Z.push(Le)}ft===0&&nt.push(Z)}}Ae=Zr.triangulateShape(Ve,nt)}const Re=Ae.length,rt=b+R;for(let Ve=0;Ve<K;Ve++){const nt=y?H(I[Ve],ne[Ve],rt):I[Ve];U?(z.copy(F.normals[0]).multiplyScalar(nt.x),O.copy(F.binormals[0]).multiplyScalar(nt.y),k.copy(D[0]).add(z).add(O),xt(k.x,k.y,k.z)):xt(nt.x,nt.y,0)}for(let Ve=1;Ve<=_;Ve++)for(let nt=0;nt<K;nt++){const Ge=y?H(I[nt],ne[nt],rt):I[nt];U?(z.copy(F.normals[Ve]).multiplyScalar(Ge.x),O.copy(F.binormals[Ve]).multiplyScalar(Ge.y),k.copy(D[Ve]).add(z).add(O),xt(k.x,k.y,k.z)):xt(Ge.x,Ge.y,v/_*Ve)}for(let Ve=T-1;Ve>=0;Ve--){const nt=Ve/T,Ge=x*Math.cos(nt*Math.PI/2),ft=b*Math.sin(nt*Math.PI/2)+R;for(let ee=0,Nt=_e.length;ee<Nt;ee++){const pt=H(_e[ee],ue[ee],ft);xt(pt.x,pt.y,v+Ge)}for(let ee=0,Nt=W.length;ee<Nt;ee++){const pt=W[ee];X=re[ee];for(let Lt=0,gt=pt.length;Lt<gt;Lt++){const Z=H(pt[Lt],X[Lt],ft);U?xt(Z.x,Z.y+D[_-1].y,D[_-1].x+Ge):xt(Z.x,Z.y,v+Ge)}}}ve(),Be();function ve(){const Ve=i.length/3;if(y){let nt=0,Ge=K*nt;for(let ft=0;ft<Re;ft++){const ee=Ae[ft];Mt(ee[2]+Ge,ee[1]+Ge,ee[0]+Ge)}nt=_+T*2,Ge=K*nt;for(let ft=0;ft<Re;ft++){const ee=Ae[ft];Mt(ee[0]+Ge,ee[1]+Ge,ee[2]+Ge)}}else{for(let nt=0;nt<Re;nt++){const Ge=Ae[nt];Mt(Ge[2],Ge[1],Ge[0])}for(let nt=0;nt<Re;nt++){const Ge=Ae[nt];Mt(Ge[0]+K*_,Ge[1]+K*_,Ge[2]+K*_)}}n.addGroup(Ve,i.length/3-Ve,0)}function Be(){const Ve=i.length/3;let nt=0;st(_e,nt),nt+=_e.length;for(let Ge=0,ft=W.length;Ge<ft;Ge++){const ee=W[Ge];st(ee,nt),nt+=ee.length}n.addGroup(Ve,i.length/3-Ve,1)}function st(Ve,nt){let Ge=Ve.length;for(;--Ge>=0;){const ft=Ge;let ee=Ge-1;ee<0&&(ee=Ve.length-1);for(let Nt=0,pt=_+T*2;Nt<pt;Nt++){const Lt=K*Nt,gt=K*(Nt+1),Z=nt+ft+Lt,P=nt+ee+Lt,me=nt+ee+gt,Le=nt+ft+gt;$t(Z,P,me,Le)}}}function xt(Ve,nt,Ge){d.push(Ve),d.push(nt),d.push(Ge)}function Mt(Ve,nt,Ge){un(Ve),un(nt),un(Ge);const ft=i.length/3,ee=w.generateTopUV(n,i,ft-3,ft-2,ft-1);Vt(ee[0]),Vt(ee[1]),Vt(ee[2])}function $t(Ve,nt,Ge,ft){un(Ve),un(nt),un(ft),un(nt),un(Ge),un(ft);const ee=i.length/3,Nt=w.generateSideWallUV(n,i,ee-6,ee-3,ee-2,ee-1);Vt(Nt[0]),Vt(Nt[1]),Vt(Nt[3]),Vt(Nt[1]),Vt(Nt[2]),Vt(Nt[3])}function un(Ve){i.push(d[Ve*3+0]),i.push(d[Ve*3+1]),i.push(d[Ve*3+2])}function Vt(Ve){o.push(Ve.x),o.push(Ve.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Gw(t,n,e)}static fromJSON(e,t){const n=[];for(let o=0,l=e.shapes.length;o<l;o++){const h=t[e.shapes[o]];n.push(h)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new bv[i.type]().fromJSON(i)),new Rv(n,e.options)}}const Pw={generateTopUV:function(s,e,t,n,i){const o=e[t*3],l=e[t*3+1],h=e[n*3],d=e[n*3+1],p=e[i*3],_=e[i*3+1];return[new et(o,l),new et(h,d),new et(p,_)]},generateSideWallUV:function(s,e,t,n,i,o){const l=e[t*3],h=e[t*3+1],d=e[t*3+2],p=e[n*3],_=e[n*3+1],v=e[n*3+2],y=e[i*3],x=e[i*3+1],b=e[i*3+2],R=e[o*3],T=e[o*3+1],M=e[o*3+2];return Math.abs(h-_)<Math.abs(l-p)?[new et(l,1-d),new et(p,1-v),new et(y,1-b),new et(R,1-M)]:[new et(h,1-d),new et(_,1-v),new et(x,1-b),new et(T,1-M)]}};function Gw(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const o=s[n];t.shapes.push(o.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class zp extends Sc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new zp(e.radius,e.detail)}}class wv extends on{constructor(e=[new et(0,-.5),new et(.5,0),new et(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=rn(i,0,Math.PI*2);const o=[],l=[],h=[],d=[],p=[],_=1/t,v=new Q,y=new et,x=new Q,b=new Q,R=new Q;let T=0,M=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:T=e[w+1].x-e[w].x,M=e[w+1].y-e[w].y,x.x=M*1,x.y=-T,x.z=M*0,R.copy(x),x.normalize(),d.push(x.x,x.y,x.z);break;case e.length-1:d.push(R.x,R.y,R.z);break;default:T=e[w+1].x-e[w].x,M=e[w+1].y-e[w].y,x.x=M*1,x.y=-T,x.z=M*0,b.copy(x),x.x+=R.x,x.y+=R.y,x.z+=R.z,x.normalize(),d.push(x.x,x.y,x.z),R.copy(b)}for(let w=0;w<=t;w++){const D=n+w*_*i,U=Math.sin(D),F=Math.cos(D);for(let O=0;O<=e.length-1;O++){v.x=e[O].x*U,v.y=e[O].y,v.z=e[O].x*F,l.push(v.x,v.y,v.z),y.x=w/t,y.y=O/(e.length-1),h.push(y.x,y.y);const z=d[3*O+0]*U,k=d[3*O+1],N=d[3*O+0]*F;p.push(z,k,N)}}for(let w=0;w<t;w++)for(let D=0;D<e.length-1;D++){const U=D+w*e.length,F=U,O=U+e.length,z=U+e.length+1,k=U+1;o.push(F,O,k),o.push(z,k,O)}this.setIndex(o),this.setAttribute("position",new Ht(l,3)),this.setAttribute("uv",new Ht(h,2)),this.setAttribute("normal",new Ht(p,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wv(e.points,e.segments,e.phiStart,e.phiLength)}}class Vp extends Sc{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Vp(e.radius,e.detail)}}class Mc extends on{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const o=e/2,l=t/2,h=Math.floor(n),d=Math.floor(i),p=h+1,_=d+1,v=e/h,y=t/d,x=[],b=[],R=[],T=[];for(let M=0;M<_;M++){const w=M*y-l;for(let D=0;D<p;D++){const U=D*v-o;b.push(U,-w,0),R.push(0,0,1),T.push(D/h),T.push(1-M/d)}}for(let M=0;M<d;M++)for(let w=0;w<h;w++){const D=w+p*M,U=w+p*(M+1),F=w+1+p*(M+1),O=w+1+p*M;x.push(D,U,O),x.push(U,F,O)}this.setIndex(x),this.setAttribute("position",new Ht(b,3)),this.setAttribute("normal",new Ht(R,3)),this.setAttribute("uv",new Ht(T,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mc(e.width,e.height,e.widthSegments,e.heightSegments)}}class Bv extends on{constructor(e=.5,t=1,n=32,i=1,o=0,l=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:l},n=Math.max(3,n),i=Math.max(1,i);const h=[],d=[],p=[],_=[];let v=e;const y=(t-e)/i,x=new Q,b=new et;for(let R=0;R<=i;R++){for(let T=0;T<=n;T++){const M=o+T/n*l;x.x=v*Math.cos(M),x.y=v*Math.sin(M),d.push(x.x,x.y,x.z),p.push(0,0,1),b.x=(x.x/t+1)/2,b.y=(x.y/t+1)/2,_.push(b.x,b.y)}v+=y}for(let R=0;R<i;R++){const T=R*(n+1);for(let M=0;M<n;M++){const w=M+T,D=w,U=w+n+1,F=w+n+2,O=w+1;h.push(D,U,O),h.push(U,F,O)}}this.setIndex(h),this.setAttribute("position",new Ht(d,3)),this.setAttribute("normal",new Ht(p,3)),this.setAttribute("uv",new Ht(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bv(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Dv extends on{constructor(e=new Ou([new et(0,.5),new et(-.5,-.5),new et(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],o=[],l=[];let h=0,d=0;if(Array.isArray(e)===!1)p(e);else for(let _=0;_<e.length;_++)p(e[_]),this.addGroup(h,d,_),h+=d,d=0;this.setIndex(n),this.setAttribute("position",new Ht(i,3)),this.setAttribute("normal",new Ht(o,3)),this.setAttribute("uv",new Ht(l,2));function p(_){const v=i.length/3,y=_.extractPoints(t);let x=y.shape;const b=y.holes;Zr.isClockWise(x)===!1&&(x=x.reverse());for(let T=0,M=b.length;T<M;T++){const w=b[T];Zr.isClockWise(w)===!0&&(b[T]=w.reverse())}const R=Zr.triangulateShape(x,b);for(let T=0,M=b.length;T<M;T++){const w=b[T];x=x.concat(w)}for(let T=0,M=x.length;T<M;T++){const w=x[T];i.push(w.x,w.y,0),o.push(0,0,1),l.push(w.x,w.y)}for(let T=0,M=R.length;T<M;T++){const w=R[T],D=w[0]+v,U=w[1]+v,F=w[2]+v;n.push(D,U,F),d+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return zw(t,e)}static fromJSON(e,t){const n=[];for(let i=0,o=e.shapes.length;i<o;i++){const l=t[e.shapes[i]];n.push(l)}return new Dv(n,e.curveSegments)}}function zw(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class kp extends on{constructor(e=1,t=32,n=16,i=0,o=Math.PI*2,l=0,h=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:o,thetaStart:l,thetaLength:h},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const d=Math.min(l+h,Math.PI);let p=0;const _=[],v=new Q,y=new Q,x=[],b=[],R=[],T=[];for(let M=0;M<=n;M++){const w=[],D=M/n;let U=0;M===0&&l===0?U=.5/t:M===n&&d===Math.PI&&(U=-.5/t);for(let F=0;F<=t;F++){const O=F/t;v.x=-e*Math.cos(i+O*o)*Math.sin(l+D*h),v.y=e*Math.cos(l+D*h),v.z=e*Math.sin(i+O*o)*Math.sin(l+D*h),b.push(v.x,v.y,v.z),y.copy(v).normalize(),R.push(y.x,y.y,y.z),T.push(O+U,1-D),w.push(p++)}_.push(w)}for(let M=0;M<n;M++)for(let w=0;w<t;w++){const D=_[M][w+1],U=_[M][w],F=_[M+1][w],O=_[M+1][w+1];(M!==0||l>0)&&x.push(D,U,O),(M!==n-1||d<Math.PI)&&x.push(U,F,O)}this.setIndex(x),this.setAttribute("position",new Ht(b,3)),this.setAttribute("normal",new Ht(R,3)),this.setAttribute("uv",new Ht(T,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kp(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Uv extends Sc{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Uv(e.radius,e.detail)}}class Nv extends on{constructor(e=1,t=.4,n=12,i=48,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:o},n=Math.floor(n),i=Math.floor(i);const l=[],h=[],d=[],p=[],_=new Q,v=new Q,y=new Q;for(let x=0;x<=n;x++)for(let b=0;b<=i;b++){const R=b/i*o,T=x/n*Math.PI*2;v.x=(e+t*Math.cos(T))*Math.cos(R),v.y=(e+t*Math.cos(T))*Math.sin(R),v.z=t*Math.sin(T),h.push(v.x,v.y,v.z),_.x=e*Math.cos(R),_.y=e*Math.sin(R),y.subVectors(v,_).normalize(),d.push(y.x,y.y,y.z),p.push(b/i),p.push(x/n)}for(let x=1;x<=n;x++)for(let b=1;b<=i;b++){const R=(i+1)*x+b-1,T=(i+1)*(x-1)+b-1,M=(i+1)*(x-1)+b,w=(i+1)*x+b;l.push(R,T,w),l.push(T,M,w)}this.setIndex(l),this.setAttribute("position",new Ht(h,3)),this.setAttribute("normal",new Ht(d,3)),this.setAttribute("uv",new Ht(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Nv(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Lv extends on{constructor(e=1,t=.4,n=64,i=8,o=2,l=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:o,q:l},n=Math.floor(n),i=Math.floor(i);const h=[],d=[],p=[],_=[],v=new Q,y=new Q,x=new Q,b=new Q,R=new Q,T=new Q,M=new Q;for(let D=0;D<=n;++D){const U=D/n*o*Math.PI*2;w(U,o,l,e,x),w(U+.01,o,l,e,b),T.subVectors(b,x),M.addVectors(b,x),R.crossVectors(T,M),M.crossVectors(R,T),R.normalize(),M.normalize();for(let F=0;F<=i;++F){const O=F/i*Math.PI*2,z=-t*Math.cos(O),k=t*Math.sin(O);v.x=x.x+(z*M.x+k*R.x),v.y=x.y+(z*M.y+k*R.y),v.z=x.z+(z*M.z+k*R.z),d.push(v.x,v.y,v.z),y.subVectors(v,x).normalize(),p.push(y.x,y.y,y.z),_.push(D/n),_.push(F/i)}}for(let D=1;D<=n;D++)for(let U=1;U<=i;U++){const F=(i+1)*(D-1)+(U-1),O=(i+1)*D+(U-1),z=(i+1)*D+U,k=(i+1)*(D-1)+U;h.push(F,O,k),h.push(O,z,k)}this.setIndex(h),this.setAttribute("position",new Ht(d,3)),this.setAttribute("normal",new Ht(p,3)),this.setAttribute("uv",new Ht(_,2));function w(D,U,F,O,z){const k=Math.cos(D),N=Math.sin(D),I=F/U*D,W=Math.cos(I);z.x=O*(2+W)*.5*k,z.y=O*(2+W)*N*.5,z.z=O*Math.sin(I)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Lv(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Ov extends on{constructor(e=new Qx(new Q(-1,-1,0),new Q(-1,1,0),new Q(1,1,0)),t=64,n=1,i=8,o=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:o};const l=e.computeFrenetFrames(t,o);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;const h=new Q,d=new Q,p=new et;let _=new Q;const v=[],y=[],x=[],b=[];R(),this.setIndex(b),this.setAttribute("position",new Ht(v,3)),this.setAttribute("normal",new Ht(y,3)),this.setAttribute("uv",new Ht(x,2));function R(){for(let D=0;D<t;D++)T(D);T(o===!1?t:0),w(),M()}function T(D){_=e.getPointAt(D/t,_);const U=l.normals[D],F=l.binormals[D];for(let O=0;O<=i;O++){const z=O/i*Math.PI*2,k=Math.sin(z),N=-Math.cos(z);d.x=N*U.x+k*F.x,d.y=N*U.y+k*F.y,d.z=N*U.z+k*F.z,d.normalize(),y.push(d.x,d.y,d.z),h.x=_.x+n*d.x,h.y=_.y+n*d.y,h.z=_.z+n*d.z,v.push(h.x,h.y,h.z)}}function M(){for(let D=1;D<=t;D++)for(let U=1;U<=i;U++){const F=(i+1)*(D-1)+(U-1),O=(i+1)*D+(U-1),z=(i+1)*D+U,k=(i+1)*(D-1)+U;b.push(F,O,k),b.push(O,z,k)}}function w(){for(let D=0;D<=t;D++)for(let U=0;U<=i;U++)p.x=D/t,p.y=U/i,x.push(p.x,p.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Ov(new bv[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class M1 extends on{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new Q,o=new Q;if(e.index!==null){const l=e.attributes.position,h=e.index;let d=e.groups;d.length===0&&(d=[{start:0,count:h.count,materialIndex:0}]);for(let p=0,_=d.length;p<_;++p){const v=d[p],y=v.start,x=v.count;for(let b=y,R=y+x;b<R;b+=3)for(let T=0;T<3;T++){const M=h.getX(b+T),w=h.getX(b+(T+1)%3);i.fromBufferAttribute(l,M),o.fromBufferAttribute(l,w),b1(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}}else{const l=e.attributes.position;for(let h=0,d=l.count/3;h<d;h++)for(let p=0;p<3;p++){const _=3*h+p,v=3*h+(p+1)%3;i.fromBufferAttribute(l,_),o.fromBufferAttribute(l,v),b1(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}this.setAttribute("position",new Ht(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function b1(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var E1=Object.freeze({__proto__:null,BoxGeometry:Du,CapsuleGeometry:gv,CircleGeometry:vv,ConeGeometry:Lp,CylinderGeometry:Np,DodecahedronGeometry:_v,EdgesGeometry:c1,ExtrudeGeometry:Rv,IcosahedronGeometry:zp,LatheGeometry:wv,OctahedronGeometry:Vp,PlaneGeometry:Mc,PolyhedronGeometry:Sc,RingGeometry:Bv,ShapeGeometry:Dv,SphereGeometry:kp,TetrahedronGeometry:Uv,TorusGeometry:Nv,TorusKnotGeometry:Lv,TubeGeometry:Ov,WireframeGeometry:M1});class T1 extends Gi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new At(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class nA extends ms{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Fu extends Gi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new At(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class zi extends Fu{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new et(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return rn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new At(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new At(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new At(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class C1 extends Gi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new At(16777215),this.specular=new At(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=$d,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.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class R1 extends Gi{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new At(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(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 w1 extends Gi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(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 B1 extends Gi{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new At(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=$d,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.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class iA extends Gi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ab,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 aA extends Gi{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}}class D1 extends Gi{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new At(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class U1 extends Pa{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 Hu(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function N1(s){function e(i,o){return s[i]-s[o]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function sA(s,e,t){const n=s.length,i=new s.constructor(n);for(let o=0,l=0;l!==n;++o){const h=t[o]*e;for(let d=0;d!==e;++d)i[l++]=s[h+d]}return i}function rA(s,e,t,n){let i=1,o=s[0];for(;o!==void 0&&o[n]===void 0;)o=s[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=s[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=s[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=s[i++];while(o!==void 0)}function Vw(s,e,t,n,i=30){const o=s.clone();o.name=e;const l=[];for(let d=0;d<o.tracks.length;++d){const p=o.tracks[d],_=p.getValueSize(),v=[],y=[];for(let x=0;x<p.times.length;++x){const b=p.times[x]*i;if(!(b<t||b>=n)){v.push(p.times[x]);for(let R=0;R<_;++R)y.push(p.values[x*_+R])}}v.length!==0&&(p.times=Hu(v,p.times.constructor),p.values=Hu(y,p.values.constructor),l.push(p))}o.tracks=l;let h=1/0;for(let d=0;d<o.tracks.length;++d)h>o.tracks[d].times[0]&&(h=o.tracks[d].times[0]);for(let d=0;d<o.tracks.length;++d)o.tracks[d].shift(-1*h);return o.resetDuration(),o}function kw(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,o=e/n;for(let l=0;l<i;++l){const h=t.tracks[l],d=h.ValueTypeName;if(d==="bool"||d==="string")continue;const p=s.tracks.find(function(M){return M.name===h.name&&M.ValueTypeName===d});if(p===void 0)continue;let _=0;const v=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(_=v/3);let y=0;const x=p.getValueSize();p.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(y=x/3);const b=h.times.length-1;let R;if(o<=h.times[0]){const M=_,w=v-_;R=h.values.slice(M,w)}else if(o>=h.times[b]){const M=b*v+_,w=M+v-_;R=h.values.slice(M,w)}else{const M=h.createInterpolant(),w=_,D=v-_;M.evaluate(o),R=M.resultBuffer.slice(w,D)}d==="quaternion"&&new ba().fromArray(R).normalize().conjugate().toArray(R);const T=p.times.length;for(let M=0;M<T;++M){const w=M*x+y;if(d==="quaternion")ba.multiplyQuaternionsFlat(p.values,w,R,0,p.values,w);else{const D=x-y*2;for(let U=0;U<D;++U)p.values[w+U]-=R[U]}}}return s.blendMode=rx,s}class Xw{static convertArray(e,t){return Hu(e,t)}static isTypedArray(e){return db(e)}static getKeyframeOrder(e){return N1(e)}static sortedArray(e,t,n){return sA(e,t,n)}static flattenJSON(e,t,n,i){rA(e,t,n,i)}static subclip(e,t,n,i,o=30){return Vw(e,t,n,i,o)}static makeClipAdditive(e,t=0,n=e,i=30){return kw(e,t,n,i)}}class Pu{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],o=t[n-1];e:{t:{let l;n:{i:if(!(e<i)){for(let h=n+2;;){if(i===void 0){if(e<o)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===h)break;if(o=i,i=t[++n],e<i)break t}l=t.length;break n}if(!(e>=o)){const h=t[1];e<h&&(n=2,o=h);for(let d=n-2;;){if(o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===d)break;if(i=o,o=t[--n-1],e>=o)break t}l=n,n=0;break n}break e}for(;n<l;){const h=n+l>>>1;e<t[h]?l=h:n=h+1}if(i=t[n],o=t[n-1],o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,o,i)}return this.interpolate_(n,o,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i;for(let l=0;l!==i;++l)t[l]=n[o+l];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class L1 extends Pu{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Su,endingEnd:Su}}intervalChanged_(e,t,n){const i=this.parameterPositions;let o=e-2,l=e+1,h=i[o],d=i[l];if(h===void 0)switch(this.getSettings_().endingStart){case Mu:o=e,h=2*t-n;break;case up:o=i.length-2,h=t+i[o]-i[o+1];break;default:o=e,h=n}if(d===void 0)switch(this.getSettings_().endingEnd){case Mu:l=e,d=2*n-t;break;case up:l=1,d=n+i[1]-i[0];break;default:l=e-1,d=t}const p=(n-t)*.5,_=this.valueSize;this._weightPrev=p/(t-h),this._weightNext=p/(d-n),this._offsetPrev=o*_,this._offsetNext=l*_}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=e*h,p=d-h,_=this._offsetPrev,v=this._offsetNext,y=this._weightPrev,x=this._weightNext,b=(n-t)/(i-t),R=b*b,T=R*b,M=-y*T+2*y*R-y*b,w=(1+y)*T+(-1.5-2*y)*R+(-.5+y)*b+1,D=(-1-x)*T+(1.5+x)*R+.5*b,U=x*T-x*R;for(let F=0;F!==h;++F)o[F]=M*l[_+F]+w*l[p+F]+D*l[d+F]+U*l[v+F];return o}}class oA extends Pu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=e*h,p=d-h,_=(n-t)/(i-t),v=1-_;for(let y=0;y!==h;++y)o[y]=l[p+y]*v+l[d+y]*_;return o}}class O1 extends Pu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class xr{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Hu(t,this.TimeBufferType),this.values=Hu(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Hu(e.times,Array),values:Hu(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new O1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new oA(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new L1(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Au:t=this.InterpolantFactoryMethodDiscrete;break;case uc:t=this.InterpolantFactoryMethodLinear;break;case A0:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Et("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Au;case this.InterpolantFactoryMethodLinear:return uc;case this.InterpolantFactoryMethodSmooth:return A0}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let o=0,l=i-1;for(;o!==i&&n[o]<e;)++o;for(;l!==-1&&n[l]>t;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const h=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*h,l*h)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Wt("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(Wt("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let h=0;h!==o;h++){const d=n[h];if(typeof d=="number"&&isNaN(d)){Wt("KeyframeTrack: Time is not a valid number.",this,h,d),e=!1;break}if(l!==null&&l>d){Wt("KeyframeTrack: Out of order keys.",this,h,d,l),e=!1;break}l=d}if(i!==void 0&&db(i))for(let h=0,d=i.length;h!==d;++h){const p=i[h];if(isNaN(p)){Wt("KeyframeTrack: Value is not a valid number.",this,h,p),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===A0,o=e.length-1;let l=1;for(let h=1;h<o;++h){let d=!1;const p=e[h],_=e[h+1];if(p!==_&&(h!==1||p!==e[0]))if(i)d=!0;else{const v=h*n,y=v-n,x=v+n;for(let b=0;b!==n;++b){const R=t[v+b];if(R!==t[y+b]||R!==t[x+b]){d=!0;break}}}if(d){if(h!==l){e[l]=e[h];const v=h*n,y=l*n;for(let x=0;x!==n;++x)t[y+x]=t[v+x]}++l}}if(o>0){e[l]=e[o];for(let h=o*n,d=l*n,p=0;p!==n;++p)t[d+p]=t[h+p];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}xr.prototype.ValueTypeName="",xr.prototype.TimeBufferType=Float32Array,xr.prototype.ValueBufferType=Float32Array,xr.prototype.DefaultInterpolation=uc;class Gu extends xr{constructor(e,t,n){super(e,t,n)}}Gu.prototype.ValueTypeName="bool",Gu.prototype.ValueBufferType=Array,Gu.prototype.DefaultInterpolation=Au,Gu.prototype.InterpolantFactoryMethodLinear=void 0,Gu.prototype.InterpolantFactoryMethodSmooth=void 0;class lA extends xr{constructor(e,t,n,i){super(e,t,n,i)}}lA.prototype.ValueTypeName="color";class Al extends xr{constructor(e,t,n,i){super(e,t,n,i)}}Al.prototype.ValueTypeName="number";class I1 extends Pu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=(n-t)/(i-t);let p=e*h;for(let _=p+h;p!==_;p+=4)ba.slerpFlat(o,0,l,p-h,l,p,d);return o}}class Sl extends xr{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new I1(this.times,this.values,this.getValueSize(),e)}}Sl.prototype.ValueTypeName="quaternion",Sl.prototype.InterpolantFactoryMethodSmooth=void 0;class zu extends xr{constructor(e,t,n){super(e,t,n)}}zu.prototype.ValueTypeName="string",zu.prototype.ValueBufferType=Array,zu.prototype.DefaultInterpolation=Au,zu.prototype.InterpolantFactoryMethodLinear=void 0,zu.prototype.InterpolantFactoryMethodSmooth=void 0;class Ml extends xr{constructor(e,t,n,i){super(e,t,n,i)}}Ml.prototype.ValueTypeName="vector";class Vu{constructor(e="",t=-1,n=[],i=S0){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Qs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,h=n.length;l!==h;++l)t.push(Jw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(xr.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let h=0;h<o;h++){let d=[],p=[];d.push((h+o-1)%o,h,(h+1)%o),p.push(0,1,0);const _=N1(d);d=sA(d,1,_),p=sA(p,1,_),!i&&d[0]===0&&(d.push(o),p.push(p[0])),l.push(new Al(".morphTargetInfluences["+t[h].name+"]",d,p).scale(1/n))}return new this(e,-1,l)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},o=/^([\w-]*?)([\d]+)$/;for(let h=0,d=e.length;h<d;h++){const p=e[h],_=p.name.match(o);if(_&&_.length>1){const v=_[1];let y=i[v];y||(i[v]=y=[]),y.push(p)}}const l=[];for(const h in i)l.push(this.CreateFromMorphTargetSequence(h,i[h],t,n));return l}static parseAnimation(e,t){if(Et("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Wt("AnimationClip: No animation in JSONLoader data."),null;const n=function(v,y,x,b,R){if(x.length!==0){const T=[],M=[];rA(x,T,M,b),T.length!==0&&R.push(new v(y,T,M))}},i=[],o=e.name||"default",l=e.fps||30,h=e.blendMode;let d=e.length||-1;const p=e.hierarchy||[];for(let v=0;v<p.length;v++){const y=p[v].keys;if(!(!y||y.length===0))if(y[0].morphTargets){const x={};let b;for(b=0;b<y.length;b++)if(y[b].morphTargets)for(let R=0;R<y[b].morphTargets.length;R++)x[y[b].morphTargets[R]]=-1;for(const R in x){const T=[],M=[];for(let w=0;w!==y[b].morphTargets.length;++w){const D=y[b];T.push(D.time),M.push(D.morphTarget===R?1:0)}i.push(new Al(".morphTargetInfluence["+R+"]",T,M))}d=x.length*l}else{const x=".bones["+t[v].name+"]";n(Ml,x+".position",y,"pos",i),n(Sl,x+".quaternion",y,"rot",i),n(Ml,x+".scale",y,"scl",i)}}return i.length===0?null:new this(o,d,i,h)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const o=this.tracks[n];t=Math.max(t,o.times[o.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Yw(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Al;case"vector":case"vector2":case"vector3":case"vector4":return Ml;case"color":return lA;case"quaternion":return Sl;case"bool":case"boolean":return Gu;case"string":return zu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function Jw(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Yw(s.type);if(s.times===void 0){const t=[],n=[];rA(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const wo={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class Iv{constructor(e,t,n){const i=this;let o=!1,l=0,h=0,d;const p=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(_){h++,o===!1&&i.onStart!==void 0&&i.onStart(_,l,h),o=!0},this.itemEnd=function(_){l++,i.onProgress!==void 0&&i.onProgress(_,l,h),l===h&&(o=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(_){i.onError!==void 0&&i.onError(_)},this.resolveURL=function(_){return d?d(_):_},this.setURLModifier=function(_){return d=_,this},this.addHandler=function(_,v){return p.push(_,v),this},this.removeHandler=function(_){const v=p.indexOf(_);return v!==-1&&p.splice(v,2),this},this.getHandler=function(_){for(let v=0,y=p.length;v<y;v+=2){const x=p[v],b=p[v+1];if(x.global&&(x.lastIndex=0),x.test(_))return b}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const F1=new Iv;class Ca{constructor(e){this.manager=e!==void 0?e:F1,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,o){n.load(e,i,t,o)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Ca.DEFAULT_MATERIAL_NAME="__DEFAULT";const bl={};class qw extends Error{constructor(e,t){super(e),this.response=t}}class ha extends Ca{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=wo.get(`file:${e}`);if(o!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(o),this.manager.itemEnd(e)},0),o;if(bl[e]!==void 0){bl[e].push({onLoad:t,onProgress:n,onError:i});return}bl[e]=[],bl[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),h=this.mimeType,d=this.responseType;fetch(l).then(p=>{if(p.status===200||p.status===0){if(p.status===0&&Et("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||p.body===void 0||p.body.getReader===void 0)return p;const _=bl[e],v=p.body.getReader(),y=p.headers.get("X-File-Size")||p.headers.get("Content-Length"),x=y?parseInt(y):0,b=x!==0;let R=0;const T=new ReadableStream({start(M){w();function w(){v.read().then(({done:D,value:U})=>{if(D)M.close();else{R+=U.byteLength;const F=new ProgressEvent("progress",{lengthComputable:b,loaded:R,total:x});for(let O=0,z=_.length;O<z;O++){const k=_[O];k.onProgress&&k.onProgress(F)}M.enqueue(U),w()}},D=>{M.error(D)})}}});return new Response(T)}else throw new qw(`fetch for "${p.url}" responded with ${p.status}: ${p.statusText}`,p)}).then(p=>{switch(d){case"arraybuffer":return p.arrayBuffer();case"blob":return p.blob();case"document":return p.text().then(_=>new DOMParser().parseFromString(_,h));case"json":return p.json();default:if(h==="")return p.text();{const v=/charset="?([^;"\s]*)"?/i.exec(h),y=v&&v[1]?v[1].toLowerCase():void 0,x=new TextDecoder(y);return p.arrayBuffer().then(b=>x.decode(b))}}}).then(p=>{wo.add(`file:${e}`,p);const _=bl[e];delete bl[e];for(let v=0,y=_.length;v<y;v++){const x=_[v];x.onLoad&&x.onLoad(p)}}).catch(p=>{const _=bl[e];if(_===void 0)throw this.manager.itemError(e),p;delete bl[e];for(let v=0,y=_.length;v<y;v++){const x=_[v];x.onError&&x.onError(p)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Kw extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new ha(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{t(o.parse(JSON.parse(h)))}catch(d){i?i(d):Wt(d),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Vu.parse(e[n]);t.push(i)}return t}}class Ww extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=[],h=new mv,d=new ha(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(o.withCredentials);let p=0;function _(v){d.load(e[v],function(y){const x=o.parse(y,!0);l[v]={width:x.width,height:x.height,format:x.format,mipmaps:x.mipmaps},p+=1,p===6&&(x.mipmapCount===1&&(h.minFilter=bn),h.image=l,h.format=x.format,h.needsUpdate=!0,t&&t(h))},n,i)}if(Array.isArray(e))for(let v=0,y=e.length;v<y;++v)_(v);else d.load(e,function(v){const y=o.parse(v,!0);if(y.isCubemap){const x=y.mipmaps.length/y.mipmapCount;for(let b=0;b<x;b++){l[b]={mipmaps:[]};for(let R=0;R<y.mipmapCount;R++)l[b].mipmaps.push(y.mipmaps[b*y.mipmapCount+R]),l[b].format=y.format,l[b].width=y.width,l[b].height=y.height}h.image=l}else h.image.width=y.width,h.image.height=y.height,h.mipmaps=y.mipmaps;y.mipmapCount===1&&(h.minFilter=bn),h.format=y.format,h.needsUpdate=!0,t&&t(h)},n,i);return h}}const wh=new WeakMap;class Xp extends Ca{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=wo.get(`image:${e}`);if(l!==void 0){if(l.complete===!0)o.manager.itemStart(e),setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0);else{let v=wh.get(l);v===void 0&&(v=[],wh.set(l,v)),v.push({onLoad:t,onError:i})}return l}const h=pp("img");function d(){_(),t&&t(this);const v=wh.get(this)||[];for(let y=0;y<v.length;y++){const x=v[y];x.onLoad&&x.onLoad(this)}wh.delete(this),o.manager.itemEnd(e)}function p(v){_(),i&&i(v),wo.remove(`image:${e}`);const y=wh.get(this)||[];for(let x=0;x<y.length;x++){const b=y[x];b.onError&&b.onError(v)}wh.delete(this),o.manager.itemError(e),o.manager.itemEnd(e)}function _(){h.removeEventListener("load",d,!1),h.removeEventListener("error",p,!1)}return h.addEventListener("load",d,!1),h.addEventListener("error",p,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(h.crossOrigin=this.crossOrigin),wo.add(`image:${e}`,h),o.manager.itemStart(e),h.src=e,h}}class H1 extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=new Sp;o.colorSpace=Pi;const l=new Xp(this.manager);l.setCrossOrigin(this.crossOrigin),l.setPath(this.path);let h=0;function d(p){l.load(e[p],function(_){o.images[p]=_,h++,h===6&&(o.needsUpdate=!0,t&&t(o))},void 0,i)}for(let p=0;p<e.length;++p)d(p);return o}}class cA extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new _r,h=new ha(this.manager);return h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setPath(this.path),h.setWithCredentials(o.withCredentials),h.load(e,function(d){let p;try{p=o.parse(d)}catch(_){if(i!==void 0)i(_);else{_(_);return}}p.image!==void 0?l.image=p.image:p.data!==void 0&&(l.image.width=p.width,l.image.height=p.height,l.image.data=p.data),l.wrapS=p.wrapS!==void 0?p.wrapS:yi,l.wrapT=p.wrapT!==void 0?p.wrapT:yi,l.magFilter=p.magFilter!==void 0?p.magFilter:bn,l.minFilter=p.minFilter!==void 0?p.minFilter:bn,l.anisotropy=p.anisotropy!==void 0?p.anisotropy:1,p.colorSpace!==void 0&&(l.colorSpace=p.colorSpace),p.flipY!==void 0&&(l.flipY=p.flipY),p.format!==void 0&&(l.format=p.format),p.type!==void 0&&(l.type=p.type),p.mipmaps!==void 0&&(l.mipmaps=p.mipmaps,l.minFilter=Is),p.mipmapCount===1&&(l.minFilter=bn),p.generateMipmaps!==void 0&&(l.generateMipmaps=p.generateMipmaps),l.needsUpdate=!0,t&&t(l,p)},n,i),l}}class uA extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=new qn,l=new Xp(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(e,function(h){o.image=h,o.needsUpdate=!0,t!==void 0&&t(o)},n,i),o}}class bc extends wn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new At(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class P1 extends bc{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(wn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new At(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const fA=new Qt,G1=new Q,z1=new Q;class hA{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new et(512,512),this.mapType=Ma,this.map=null,this.mapPass=null,this.matrix=new Qt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Th,this._frameExtents=new et(1,1),this._viewportCount=1,this._viewports=[new ci(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;G1.setFromMatrixPosition(e.matrixWorld),t.position.copy(G1),z1.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(z1),t.updateMatrixWorld(),fA.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fA,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(fA)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class jw extends hA{constructor(){super(new ia(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=nh*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,o=e.distance||t.far;(n!==t.fov||i!==t.aspect||o!==t.far)&&(t.fov=n,t.aspect=i,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Fv extends bc{constructor(e,t,n=0,i=Math.PI/3,o=0,l=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(wn.DEFAULT_UP),this.updateMatrix(),this.target=new wn,this.distance=n,this.angle=i,this.penumbra=o,this.decay=l,this.map=null,this.shadow=new jw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class Zw extends hA{constructor(){super(new ia(90,1,.5,500)),this.isPointLightShadow=!0}}class Hv extends bc{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Zw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class El extends X0{constructor(e=-1,t=1,n=1,i=-1,o=.1,l=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=o,this.far=l,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,o,l){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=o,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let o=n-e,l=n+e,h=i+t,d=i-t;if(this.view!==null&&this.view.enabled){const p=(this.right-this.left)/this.view.fullWidth/this.zoom,_=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=p*this.view.offsetX,l=o+p*this.view.width,h-=_*this.view.offsetY,d=h-_*this.view.height}this.projectionMatrix.makeOrthographic(o,l,h,d,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Qw extends hA{constructor(){super(new El(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Pv extends bc{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(wn.DEFAULT_UP),this.updateMatrix(),this.target=new wn,this.shadow=new Qw}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class V1 extends bc{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class k1 extends bc{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class dA{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Q)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.282095),t.addScaledVector(l[1],.488603*i),t.addScaledVector(l[2],.488603*o),t.addScaledVector(l[3],.488603*n),t.addScaledVector(l[4],1.092548*(n*i)),t.addScaledVector(l[5],1.092548*(i*o)),t.addScaledVector(l[6],.315392*(3*o*o-1)),t.addScaledVector(l[7],1.092548*(n*o)),t.addScaledVector(l[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.886227),t.addScaledVector(l[1],1.023328*i),t.addScaledVector(l[2],1.023328*o),t.addScaledVector(l[3],1.023328*n),t.addScaledVector(l[4],.858086*n*i),t.addScaledVector(l[5],.858086*i*o),t.addScaledVector(l[6],.743125*o*o-.247708),t.addScaledVector(l[7],.858086*n*o),t.addScaledVector(l[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,o=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*o,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*n*o,t[8]=.546274*(n*n-i*i)}}class X1 extends bc{constructor(e=new dA,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Gv extends Ca{constructor(e){super(e),this.textures={}}load(e,t,n,i){const o=this,l=new ha(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(h){try{t(o.parse(JSON.parse(h)))}catch(d){i?i(d):Wt(d),o.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(o){return t[o]===void 0&&Et("MaterialLoader: Undefined texture",o),t[o]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new At().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new At().setHex(l.value);break;case"v2":i.uniforms[o].value=new et().fromArray(l.value);break;case"v3":i.uniforms[o].value=new Q().fromArray(l.value);break;case"v4":i.uniforms[o].value=new ci().fromArray(l.value);break;case"m3":i.uniforms[o].value=new mn().fromArray(l.value);break;case"m4":i.uniforms[o].value=new Qt().fromArray(l.value);break;default:i.uniforms[o].value=l.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=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(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 et().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),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=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new et().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Gv.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:T1,SpriteMaterial:Lx,RawShaderMaterial:nA,ShaderMaterial:ms,PointsMaterial:Up,MeshPhysicalMaterial:zi,MeshStandardMaterial:Fu,MeshPhongMaterial:C1,MeshToonMaterial:R1,MeshNormalMaterial:w1,MeshLambertMaterial:B1,MeshDepthMaterial:iA,MeshDistanceMaterial:aA,MeshBasicMaterial:fa,MeshMatcapMaterial:D1,LineDashedMaterial:U1,LineBasicMaterial:Pa,Material:Gi};return new t[e]}}class nr{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Y1 extends on{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class J1 extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new ha(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(h){try{t(o.parse(JSON.parse(h)))}catch(d){i?i(d):Wt(d),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(x,b){if(t[b]!==void 0)return t[b];const T=x.interleavedBuffers[b],M=o(x,T.buffer),w=eh(T.type,M),D=new yh(w,T.stride);return D.uuid=T.uuid,t[b]=D,D}function o(x,b){if(n[b]!==void 0)return n[b];const T=x.arrayBuffers[b],M=new Uint32Array(T).buffer;return n[b]=M,M}const l=e.isInstancedBufferGeometry?new Y1:new on,h=e.data.index;if(h!==void 0){const x=eh(h.type,h.array);l.setIndex(new Ln(x,1))}const d=e.data.attributes;for(const x in d){const b=d[x];let R;if(b.isInterleavedBufferAttribute){const T=i(e.data,b.data);R=new xl(T,b.itemSize,b.offset,b.normalized)}else{const T=eh(b.type,b.array),M=b.isInstancedBufferAttribute?xc:Ln;R=new M(T,b.itemSize,b.normalized)}b.name!==void 0&&(R.name=b.name),b.usage!==void 0&&R.setUsage(b.usage),l.setAttribute(x,R)}const p=e.data.morphAttributes;if(p)for(const x in p){const b=p[x],R=[];for(let T=0,M=b.length;T<M;T++){const w=b[T];let D;if(w.isInterleavedBufferAttribute){const U=i(e.data,w.data);D=new xl(U,w.itemSize,w.offset,w.normalized)}else{const U=eh(w.type,w.array);D=new Ln(U,w.itemSize,w.normalized)}w.name!==void 0&&(D.name=w.name),R.push(D)}l.morphAttributes[x]=R}e.data.morphTargetsRelative&&(l.morphTargetsRelative=!0);const v=e.data.groups||e.data.drawcalls||e.data.offsets;if(v!==void 0)for(let x=0,b=v.length;x!==b;++x){const R=v[x];l.addGroup(R.start,R.count,R.materialIndex)}const y=e.data.boundingSphere;return y!==void 0&&(l.boundingSphere=new ua().fromJSON(y)),e.name&&(l.name=e.name),e.userData&&(l.userData=e.userData),l}}class $w extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=this.path===""?nr.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||l;const h=new ha(this.manager);h.setPath(this.path),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(d){let p=null;try{p=JSON.parse(d)}catch(v){i!==void 0&&i(v),v("ObjectLoader: Can't parse "+e+".",v.message);return}const _=p.metadata;if(_===void 0||_.type===void 0||_.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Wt("ObjectLoader: Can't load "+e);return}o.parse(p,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?nr.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const o=new ha(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials);const l=await o.loadAsync(e,t),h=JSON.parse(l),d=h.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(h)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),o=this.parseGeometries(e.geometries,i),l=this.parseImages(e.images,function(){t!==void 0&&t(p)}),h=this.parseTextures(e.textures,l),d=this.parseMaterials(e.materials,h),p=this.parseObject(e.object,o,d,h,n),_=this.parseSkeletons(e.skeletons,p);if(this.bindSkeletons(p,_),this.bindLightTargets(p),t!==void 0){let v=!1;for(const y in l)if(l[y].data instanceof HTMLImageElement){v=!0;break}v===!1&&t(p)}return p}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),o=await this.parseImagesAsync(e.images),l=this.parseTextures(e.textures,o),h=this.parseMaterials(e.materials,l),d=this.parseObject(e.object,i,h,l,t),p=this.parseSkeletons(e.skeletons,d);return this.bindSkeletons(d,p),this.bindLightTargets(d),d}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const o=new Ou().fromJSON(e[n]);t[o.uuid]=o}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(o){o.isBone&&(i[o.uuid]=o)}),e!==void 0)for(let o=0,l=e.length;o<l;o++){const h=new bh().fromJSON(e[o],i);n[h.uuid]=h}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new J1;for(let o=0,l=e.length;o<l;o++){let h;const d=e[o];switch(d.type){case"BufferGeometry":case"InstancedBufferGeometry":h=i.parse(d);break;default:d.type in E1?h=E1[d.type].fromJSON(d,t):Et(`ObjectLoader: Unsupported geometry type "${d.type}"`)}h.uuid=d.uuid,d.name!==void 0&&(h.name=d.name),d.userData!==void 0&&(h.userData=d.userData),n[d.uuid]=h}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const o=new Gv;o.setTextures(t);for(let l=0,h=e.length;l<h;l++){const d=e[l];n[d.uuid]===void 0&&(n[d.uuid]=o.parse(d)),i[d.uuid]=n[d.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],o=Vu.parse(i);t[o.uuid]=o}return t}parseImages(e,t){const n=this,i={};let o;function l(d){return n.manager.itemStart(d),o.load(d,function(){n.manager.itemEnd(d)},void 0,function(){n.manager.itemError(d),n.manager.itemEnd(d)})}function h(d){if(typeof d=="string"){const p=d,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;return l(_)}else return d.data?{data:eh(d.type,d.data),width:d.width,height:d.height}:null}if(e!==void 0&&e.length>0){const d=new Iv(t);o=new Xp(d),o.setCrossOrigin(this.crossOrigin);for(let p=0,_=e.length;p<_;p++){const v=e[p],y=v.url;if(Array.isArray(y)){const x=[];for(let b=0,R=y.length;b<R;b++){const T=y[b],M=h(T);M!==null&&(M instanceof HTMLImageElement?x.push(M):x.push(new _r(M.data,M.width,M.height)))}i[v.uuid]=new dc(x)}else{const x=h(v.url);i[v.uuid]=new dc(x)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function o(l){if(typeof l=="string"){const h=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:t.resourcePath+h;return await i.loadAsync(d)}else return l.data?{data:eh(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){i=new Xp(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,h=e.length;l<h;l++){const d=e[l],p=d.url;if(Array.isArray(p)){const _=[];for(let v=0,y=p.length;v<y;v++){const x=p[v],b=await o(x);b!==null&&(b instanceof HTMLImageElement?_.push(b):_.push(new _r(b.data,b.width,b.height)))}n[d.uuid]=new dc(_)}else{const _=await o(d.url);n[d.uuid]=new dc(_)}}}return n}parseTextures(e,t){function n(o,l){return typeof o=="number"?o:(Et("ObjectLoader.parseTexture: Constant should be in numeric form.",o),l[o])}const i={};if(e!==void 0)for(let o=0,l=e.length;o<l;o++){const h=e[o];h.image===void 0&&Et('ObjectLoader: No "image" specified for',h.uuid),t[h.image]===void 0&&Et("ObjectLoader: Undefined image",h.image);const d=t[h.image],p=d.data;let _;Array.isArray(p)?(_=new Sp,p.length===6&&(_.needsUpdate=!0)):(p&&p.data?_=new _r:_=new qn,p&&(_.needsUpdate=!0)),_.source=d,_.uuid=h.uuid,h.name!==void 0&&(_.name=h.name),h.mapping!==void 0&&(_.mapping=n(h.mapping,eB)),h.channel!==void 0&&(_.channel=h.channel),h.offset!==void 0&&_.offset.fromArray(h.offset),h.repeat!==void 0&&_.repeat.fromArray(h.repeat),h.center!==void 0&&_.center.fromArray(h.center),h.rotation!==void 0&&(_.rotation=h.rotation),h.wrap!==void 0&&(_.wrapS=n(h.wrap[0],q1),_.wrapT=n(h.wrap[1],q1)),h.format!==void 0&&(_.format=h.format),h.internalFormat!==void 0&&(_.internalFormat=h.internalFormat),h.type!==void 0&&(_.type=h.type),h.colorSpace!==void 0&&(_.colorSpace=h.colorSpace),h.minFilter!==void 0&&(_.minFilter=n(h.minFilter,K1)),h.magFilter!==void 0&&(_.magFilter=n(h.magFilter,K1)),h.anisotropy!==void 0&&(_.anisotropy=h.anisotropy),h.flipY!==void 0&&(_.flipY=h.flipY),h.generateMipmaps!==void 0&&(_.generateMipmaps=h.generateMipmaps),h.premultiplyAlpha!==void 0&&(_.premultiplyAlpha=h.premultiplyAlpha),h.unpackAlignment!==void 0&&(_.unpackAlignment=h.unpackAlignment),h.compareFunction!==void 0&&(_.compareFunction=h.compareFunction),h.userData!==void 0&&(_.userData=h.userData),i[h.uuid]=_}return i}parseObject(e,t,n,i,o){let l;function h(y){return t[y]===void 0&&Et("ObjectLoader: Undefined geometry",y),t[y]}function d(y){if(y!==void 0){if(Array.isArray(y)){const x=[];for(let b=0,R=y.length;b<R;b++){const T=y[b];n[T]===void 0&&Et("ObjectLoader: Undefined material",T),x.push(n[T])}return x}return n[y]===void 0&&Et("ObjectLoader: Undefined material",y),n[y]}}function p(y){return i[y]===void 0&&Et("ObjectLoader: Undefined texture",y),i[y]}let _,v;switch(e.type){case"Scene":l=new Mp,e.background!==void 0&&(Number.isInteger(e.background)?l.background=new At(e.background):l.background=p(e.background)),e.environment!==void 0&&(l.environment=p(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?l.fog=new K0(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(l.fog=new q0(e.fog.color,e.fog.density)),e.fog.name!==""&&(l.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(l.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(l.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&l.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(l.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&l.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":l=new ia(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(l.focus=e.focus),e.zoom!==void 0&&(l.zoom=e.zoom),e.filmGauge!==void 0&&(l.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(l.filmOffset=e.filmOffset),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"OrthographicCamera":l=new El(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(l.zoom=e.zoom),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"AmbientLight":l=new V1(e.color,e.intensity);break;case"DirectionalLight":l=new Pv(e.color,e.intensity),l.target=e.target||"";break;case"PointLight":l=new Hv(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new k1(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new Fv(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),l.target=e.target||"";break;case"HemisphereLight":l=new P1(e.color,e.groundColor,e.intensity);break;case"LightProbe":const y=new dA().fromArray(e.sh);l=new X1(y,e.intensity);break;case"SkinnedMesh":_=h(e.geometry),v=d(e.material),l=new ev(_,v),e.bindMode!==void 0&&(l.bindMode=e.bindMode),e.bindMatrix!==void 0&&l.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(l.skeleton=e.skeleton);break;case"Mesh":_=h(e.geometry),v=d(e.material),l=new pi(_,v);break;case"InstancedMesh":_=h(e.geometry),v=d(e.material);const x=e.count,b=e.instanceMatrix,R=e.instanceColor;l=new nv(_,v,x),l.instanceMatrix=new xc(new Float32Array(b.array),16),R!==void 0&&(l.instanceColor=new xc(new Float32Array(R.array),R.itemSize));break;case"BatchedMesh":_=h(e.geometry),v=d(e.material),l=new e1(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,v),l.geometry=_,l.perObjectFrustumCulled=e.perObjectFrustumCulled,l.sortObjects=e.sortObjects,l._drawRanges=e.drawRanges,l._reservedRanges=e.reservedRanges,l._geometryInfo=e.geometryInfo.map(T=>{let M=null,w=null;return T.boundingBox!==void 0&&(M=new Ea().fromJSON(T.boundingBox)),T.boundingSphere!==void 0&&(w=new ua().fromJSON(T.boundingSphere)),{...T,boundingBox:M,boundingSphere:w}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=p(e.matricesTexture.uuid),l._indirectTexture=p(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=p(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new ua().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Ea().fromJSON(e.boundingBox));break;case"LOD":l=new kb;break;case"Line":l=new Ro(h(e.geometry),d(e.material));break;case"LineLoop":l=new fv(h(e.geometry),d(e.material));break;case"LineSegments":l=new yr(h(e.geometry),d(e.material));break;case"PointCloud":case"Points":l=new pv(h(e.geometry),d(e.material));break;case"Sprite":l=new zb(d(e.material));break;case"Group":l=new vr;break;case"Bone":l=new Cp;break;default:l=new wn}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const y=e.children;for(let x=0;x<y.length;x++)l.add(this.parseObject(y[x],t,n,i,o))}if(e.animations!==void 0){const y=e.animations;for(let x=0;x<y.length;x++){const b=y[x];l.animations.push(o[b])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(l.autoUpdate=e.autoUpdate);const y=e.levels;for(let x=0;x<y.length;x++){const b=y[x],R=l.getObjectByProperty("uuid",b.object);R!==void 0&&l.addLevel(R,b.distance,b.hysteresis)}}return l}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?Et("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new wn}})}}const eB={UVMapping:rc,CubeReflectionMapping:Yr,CubeRefractionMapping:oc,EquirectangularReflectionMapping:Wf,EquirectangularRefractionMapping:ep,CubeUVReflectionMapping:jf},q1={RepeatWrapping:Jr,ClampToEdgeWrapping:yi,MirroredRepeatWrapping:_u},K1={NearestFilter:xi,NearestMipmapNearestFilter:tp,NearestMipmapLinearFilter:lc,LinearFilter:bn,LinearMipmapNearestFilter:yu,LinearMipmapLinearFilter:Is},pA=new WeakMap;class mA extends Ca{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Et("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Et("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=wo.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(p=>{if(pA.has(l)===!0)i&&i(pA.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(p),o.manager.itemEnd(e),p});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const h={};h.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",h.headers=this.requestHeader,h.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const d=fetch(e,h).then(function(p){return p.blob()}).then(function(p){return createImageBitmap(p,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(p){return wo.add(`image-bitmap:${e}`,p),t&&t(p),o.manager.itemEnd(e),p}).catch(function(p){i&&i(p),pA.set(d,p),wo.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});wo.add(`image-bitmap:${e}`,d),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let zv;class gA{static getContext(){return zv===void 0&&(zv=new(window.AudioContext||window.webkitAudioContext)),zv}static setContext(e){zv=e}}class tB extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new ha(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(d){try{const p=d.slice(0);gA.getContext().decodeAudioData(p,function(v){t(v)}).catch(h)}catch(p){h(p)}},n,i);function h(d){i?i(d):Wt(d),o.manager.itemError(e)}}}const W1=new Qt,j1=new Qt,ku=new Qt;class nB{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ia,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ia,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 t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ku.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(Tu*t.fov*.5)/t.zoom;let h,d;j1.elements[12]=-i,W1.elements[12]=i,h=-l*t.aspect+o,d=l*t.aspect+o,ku.elements[0]=2*t.near/(d-h),ku.elements[8]=(d+h)/(d-h),this.cameraL.projectionMatrix.copy(ku),h=-l*t.aspect-o,d=l*t.aspect-o,ku.elements[0]=2*t.near/(d-h),ku.elements[8]=(d+h)/(d-h),this.cameraR.projectionMatrix.copy(ku)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(j1),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(W1)}}class Z1 extends ia{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class vA{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const Xu=new Q,_A=new ba,iB=new Q,Yu=new Q,Ju=new Q;class aB extends wn{constructor(){super(),this.type="AudioListener",this.context=gA.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new vA}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 t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xu,_A,iB),Yu.set(0,0,-1).applyQuaternion(_A),Ju.set(0,1,0).applyQuaternion(_A),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Xu.x,n),t.positionY.linearRampToValueAtTime(Xu.y,n),t.positionZ.linearRampToValueAtTime(Xu.z,n),t.forwardX.linearRampToValueAtTime(Yu.x,n),t.forwardY.linearRampToValueAtTime(Yu.y,n),t.forwardZ.linearRampToValueAtTime(Yu.z,n),t.upX.linearRampToValueAtTime(Ju.x,n),t.upY.linearRampToValueAtTime(Ju.y,n),t.upZ.linearRampToValueAtTime(Ju.z,n)}else t.setPosition(Xu.x,Xu.y,Xu.z),t.setOrientation(Yu.x,Yu.y,Yu.z,Ju.x,Ju.y,Ju.z)}}class Q1 extends wn{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){Et("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){Et("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(e=0){if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(Et("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(Et("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const qu=new Q,$1=new ba,sB=new Q,Ku=new Q;class rB extends Q1{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(qu,$1,sB),Ku.set(0,0,1).applyQuaternion($1);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(qu.x,n),t.positionY.linearRampToValueAtTime(qu.y,n),t.positionZ.linearRampToValueAtTime(qu.z,n),t.orientationX.linearRampToValueAtTime(Ku.x,n),t.orientationY.linearRampToValueAtTime(Ku.y,n),t.orientationZ.linearRampToValueAtTime(Ku.z,n)}else t.setPosition(qu.x,qu.y,qu.z),t.setOrientation(Ku.x,Ku.y,Ku.z)}}class oB{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class eE{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,o,l;switch(t){case"quaternion":i=this._slerp,o=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,o=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,o=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=o,this._setIdentity=l,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,o=e*i+i;let l=this.cumulativeWeight;if(l===0){for(let h=0;h!==i;++h)n[o+h]=n[h];l=t}else{l+=t;const h=t/l;this._mixBufferRegion(n,o,0,h,i)}this.cumulativeWeight=l}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,o=this.cumulativeWeight,l=this.cumulativeWeightAdditive,h=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,o<1){const d=t*this._origIndex;this._mixBufferRegion(n,i,d,1-o,t)}l>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let d=t,p=t+t;d!==p;++d)if(n[d]!==n[d+t]){h.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];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,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,o){if(i>=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){ba.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;ba.multiplyQuaternionsFlat(e,l,e,t,e,n),ba.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let h=0;h!==o;++h){const d=t+h;e[d]=e[d]*l+e[n+h]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const h=t+l;e[h]=e[h]+e[n+l]*i}}}const yA="\\[\\]\\.:\\/",lB=new RegExp("["+yA+"]","g"),xA="[^"+yA+"]",cB="[^"+yA.replace("\\.","")+"]",uB=/((?:WC+[\/:])*)/.source.replace("WC",xA),fB=/(WCOD+)?/.source.replace("WCOD",cB),hB=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xA),dB=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xA),pB=new RegExp("^"+uB+fB+hB+dB+"$"),mB=["material","materials","bones","map"];class gB{constructor(e,t,n){const i=n||Hn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Hn{constructor(e,t,n){this.path=t,this.parsedPath=n||Hn.parseTrackName(t),this.node=Hn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Hn.Composite(e,t,n):new Hn(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(lB,"")}static parseTrackName(e){const t=pB.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);mB.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l<o.length;l++){const h=o[l];if(h.name===t||h.uuid===t)return h;const d=n(h.children);if(d)return d}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let o=t.propertyIndex;if(e||(e=Hn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Et("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let p=t.objectIndex;switch(n){case"materials":if(!e.material){Wt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Wt("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Wt("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let _=0;_<e.length;_++)if(e[_].name===p){p=_;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Wt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Wt("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Wt("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(p!==void 0){if(e[p]===void 0){Wt("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[p]}}const l=e[i];if(l===void 0){const p=t.nodeName;Wt("PropertyBinding: Trying to update property for track: "+p+"."+i+" but it wasn't found.",e);return}let h=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?h=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let d=this.BindingType.Direct;if(o!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Wt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Wt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[o]!==void 0&&(o=e.morphTargetDictionary[o])}d=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=o}else l.fromArray!==void 0&&l.toArray!==void 0?(d=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(d=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[d],this.setValue=this.SetterByBindingTypeAndVersioning[d][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Hn.Composite=gB,Hn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Hn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Hn.prototype.GetterByBindingType=[Hn.prototype._getValue_direct,Hn.prototype._getValue_array,Hn.prototype._getValue_arrayElement,Hn.prototype._getValue_toArray],Hn.prototype.SetterByBindingTypeAndVersioning=[[Hn.prototype._setValue_direct,Hn.prototype._setValue_direct_setNeedsUpdate,Hn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Hn.prototype._setValue_array,Hn.prototype._setValue_array_setNeedsUpdate,Hn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Hn.prototype._setValue_arrayElement,Hn.prototype._setValue_arrayElement_setNeedsUpdate,Hn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Hn.prototype._setValue_fromArray,Hn.prototype._setValue_fromArray_setNeedsUpdate,Hn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class vB{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Qs(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,o=this._bindings,l=o.length;let h,d=e.length,p=this.nCachedObjects_;for(let _=0,v=arguments.length;_!==v;++_){const y=arguments[_],x=y.uuid;let b=t[x];if(b===void 0){b=d++,t[x]=b,e.push(y);for(let R=0,T=l;R!==T;++R)o[R].push(new Hn(y,n[R],i[R]))}else if(b<p){h=e[b];const R=--p,T=e[R];t[T.uuid]=b,e[b]=T,t[x]=R,e[R]=y;for(let M=0,w=l;M!==w;++M){const D=o[M],U=D[R];let F=D[b];D[b]=U,F===void 0&&(F=new Hn(y,n[M],i[M])),D[R]=F}}else e[b]!==h&&Wt("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=p}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_;for(let l=0,h=arguments.length;l!==h;++l){const d=arguments[l],p=d.uuid,_=t[p];if(_!==void 0&&_>=o){const v=o++,y=e[v];t[y.uuid]=_,e[_]=y,t[p]=v,e[v]=d;for(let x=0,b=i;x!==b;++x){const R=n[x],T=R[v],M=R[_];R[_]=T,R[v]=M}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let h=0,d=arguments.length;h!==d;++h){const p=arguments[h],_=p.uuid,v=t[_];if(v!==void 0)if(delete t[_],v<o){const y=--o,x=e[y],b=--l,R=e[b];t[x.uuid]=v,e[v]=x,t[R.uuid]=y,e[y]=R,e.pop();for(let T=0,M=i;T!==M;++T){const w=n[T],D=w[y],U=w[b];w[v]=D,w[y]=U,w.pop()}}else{const y=--l,x=e[y];y>0&&(t[x.uuid]=v),e[v]=x,e.pop();for(let b=0,R=i;b!==R;++b){const T=n[b];T[v]=T[y],T.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,h=this._parsedPaths,d=this._objects,p=d.length,_=this.nCachedObjects_,v=new Array(p);i=o.length,n[e]=i,l.push(e),h.push(t),o.push(v);for(let y=_,x=d.length;y!==x;++y){const b=d[y];v[y]=new Hn(b,e,t)}return v}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,h=l.length-1,d=l[h],p=e[h];t[p]=n,l[n]=d,l.pop(),o[n]=o[h],o.pop(),i[n]=i[h],i.pop()}}}class tE{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,h=new Array(l),d={endingStart:Su,endingEnd:Su};for(let p=0;p!==l;++p){const _=o[p].createInterpolant(null);h[p]=_,_.settings=d}this._interpolantSettings=d,this._interpolants=h,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=nb,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,t){return this.loop=e,this.repetitions=t,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,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,h=i/o;e.warp(1,l,t),this.warp(h,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}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,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let h=this._timeScaleInterpolant;h===null&&(h=i._lendControlInterpolant(),this._timeScaleInterpolant=h);const d=h.parameterPositions,p=h.sampleValues;return d[0]=o,d[1]=o+n,p[0]=e/l,p[1]=t/l,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,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const d=(e-o)*n;d<0||n===0?t=0:(this._startTime=null,t=n*d)}t*=this._updateTimeScale(e);const l=this._updateTime(t),h=this._updateWeight(e);if(h>0){const d=this._interpolants,p=this._propertyBindings;switch(this.blendMode){case rx:for(let _=0,v=d.length;_!==v;++_)d[_].evaluate(l),p[_].accumulateAdditive(h);break;case S0:default:for(let _=0,v=d.length;_!==v;++_)d[_].evaluate(l),p[_].accumulate(i,h)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===ib;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===cp){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;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,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const h=Math.floor(i/t);i-=t*h,o+=Math.abs(h);const d=this.repetitions-o;if(d<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(d===1){const p=e<0;this._setEndings(p,!p,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:h})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Mu,i.endingEnd=Mu):(e?i.endingStart=this.zeroSlopeAtStart?Mu:Su:i.endingStart=up,t?i.endingEnd=this.zeroSlopeAtEnd?Mu:Su:i.endingEnd=up)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const h=l.parameterPositions,d=l.sampleValues;return h[0]=o,d[0]=t,h[1]=o+e,d[1]=n,this}}const _B=new Float32Array(1);class nE extends Eo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,h=e._interpolants,d=n.uuid,p=this._bindingsByRootAndName;let _=p[d];_===void 0&&(_={},p[d]=_);for(let v=0;v!==o;++v){const y=i[v],x=y.name;let b=_[x];if(b!==void 0)++b.referenceCount,l[v]=b;else{if(b=l[v],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,d,x));continue}const R=t&&t._propertyBindings[v].binding.parsedPath;b=new eE(Hn.create(n,x,R),y.ValueTypeName,y.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,d,x),l[v]=b}h[v].resultBuffer=b.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--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 t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,o=this._actionsByClip;let l=o[t];if(l===void 0)l={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,o[t]=l;else{const h=l.knownActions;e._byClipCacheIndex=h.length,h.push(e)}e._cacheIndex=i.length,i.push(e),l.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const o=e._clip.uuid,l=this._actionsByClip,h=l[o],d=h.knownActions,p=d[d.length-1],_=e._byClipCacheIndex;p._byClipCacheIndex=_,d[_]=p,d.pop(),e._byClipCacheIndex=null;const v=h.actionByRoot,y=(e._localRoot||this._root).uuid;delete v[y],d.length===0&&delete l[o],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.referenceCount===0&&this._removeInactiveBinding(o)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,o=this._bindings;let l=i[t];l===void 0&&(l={},i[t]=l),l[n]=e,e._cacheIndex=o.length,o.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,o=n.path,l=this._bindingsByRootAndName,h=l[i],d=t[t.length-1],p=e._cacheIndex;d._cacheIndex=p,t[p]=d,t.pop(),delete h[o],Object.keys(h).length===0&&delete l[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new oA(new Float32Array(2),new Float32Array(2),1,_B),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,o=t[i];e.__cacheIndex=i,t[i]=e,o.__cacheIndex=n,t[n]=o}clipAction(e,t,n){const i=t||this._root,o=i.uuid;let l=typeof e=="string"?Vu.findByName(i,e):e;const h=l!==null?l.uuid:e,d=this._actionsByClip[h];let p=null;if(n===void 0&&(l!==null?n=l.blendMode:n=S0),d!==void 0){const v=d.actionByRoot[o];if(v!==void 0&&v.blendMode===n)return v;p=d.knownActions[0],l===null&&(l=p._clip)}if(l===null)return null;const _=new tE(this,l,t,n);return this._bindAction(_,p),this._addInactiveAction(_,h,o),_}existingAction(e,t){const n=t||this._root,i=n.uuid,o=typeof e=="string"?Vu.findByName(n,e):e,l=o?o.uuid:e,h=this._actionsByClip[l];return h!==void 0&&h.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let p=0;p!==n;++p)t[p]._update(i,e,o,l);const h=this._bindings,d=this._nActiveBindings;for(let p=0;p!==d;++p)h[p].apply(l);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,o=i[n];if(o!==void 0){const l=o.knownActions;for(let h=0,d=l.length;h!==d;++h){const p=l[h];this._deactivateAction(p);const _=p._cacheIndex,v=t[t.length-1];p._cacheIndex=null,p._byClipCacheIndex=null,v._cacheIndex=_,t[_]=v,t.pop(),this._removeInactiveBindingsForAction(p)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const l in n){const h=n[l].actionByRoot,d=h[t];d!==void 0&&(this._deactivateAction(d),this._removeInactiveAction(d))}const i=this._bindingsByRootAndName,o=i[t];if(o!==void 0)for(const l in o){const h=o[l];h.restoreOriginalState(),this._removeInactiveBinding(h)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class yB extends mx{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new C0(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class AA{constructor(e){this.value=e}clone(){return new AA(this.value.clone===void 0?this.value:this.value.clone())}}let xB=0;class AB extends Eo{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:xB++}),this.name="",this.usage=dp,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const o=Array.isArray(t[n])?t[n]:[t[n]];for(let l=0;l<o.length;l++)this.uniforms.push(o[l].clone())}return this}clone(){return new this.constructor().copy(this)}}class SB extends yh{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class MB{constructor(e,t,n,i,o,l=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=o,this.normalized=l,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const iE=new Qt;class SA{constructor(e,t,n=0,i=1/0){this.ray=new lh(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new uh,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Wt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return iE.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(iE),this}intersectObject(e,t=!0,n=[]){return MA(e,this,n,t),n.sort(aE),n}intersectObjects(e,t=!0,n=[]){for(let i=0,o=e.length;i<o;i++)MA(e[i],this,n,t);return n.sort(aE),n}}function aE(s,e){return s.distance-e.distance}function MA(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const o=s.children;for(let l=0,h=o.length;l<h;l++)MA(o[l],e,t,!0)}}class bB{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=EB.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function EB(){this._document.hidden===!1&&this.reset()}class TB{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=rn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(rn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class CB{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class bA{constructor(e,t,n,i){bA.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const o=this.elements;return o[0]=e,o[2]=t,o[1]=n,o[3]=i,this}}const sE=new et;class RB{constructor(e=new et(1/0,1/0),t=new et(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=sE.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.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,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sE).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 rE=new Q,Vv=new Q,Bh=new Q,Dh=new Q,EA=new Q,wB=new Q,BB=new Q;class DB{constructor(e=new Q,t=new Q){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),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,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){rE.subVectors(e,this.start),Vv.subVectors(this.end,this.start);const n=Vv.dot(Vv);let o=Vv.dot(rE)/n;return t&&(o=rn(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=wB,n=BB){const i=10000000000000001e-32;let o,l;const h=this.start,d=e.start,p=this.end,_=e.end;Bh.subVectors(p,h),Dh.subVectors(_,d),EA.subVectors(h,d);const v=Bh.dot(Bh),y=Dh.dot(Dh),x=Dh.dot(EA);if(v<=i&&y<=i)return t.copy(h),n.copy(d),t.sub(n),t.dot(t);if(v<=i)o=0,l=x/y,l=rn(l,0,1);else{const b=Bh.dot(EA);if(y<=i)l=0,o=rn(-b/v,0,1);else{const R=Bh.dot(Dh),T=v*y-R*R;T!==0?o=rn((R*x-b*y)/T,0,1):o=0,l=(R*o+x)/y,l<0?(l=0,o=rn(-b/v,0,1)):l>1&&(l=1,o=rn((R-b)/v,0,1))}}return t.copy(h).add(Bh.multiplyScalar(o)),n.copy(d).add(Dh.multiplyScalar(l)),t.sub(n),t.dot(t)}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 oE=new Q;class UB extends wn{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new on,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 l=0,h=1,d=32;l<d;l++,h++){const p=l/d*Math.PI*2,_=h/d*Math.PI*2;i.push(Math.cos(p),Math.sin(p),1,Math.cos(_),Math.sin(_),1)}n.setAttribute("position",new Ht(i,3));const o=new Pa({fog:!1,toneMapped:!1});this.cone=new yr(n,o),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),oE.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(oE),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ec=new Q,kv=new Qt,TA=new Qt;class NB extends yr{constructor(e){const t=lE(e),n=new on,i=[],o=[];for(let p=0;p<t.length;p++){const _=t[p];_.parent&&_.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),o.push(0,0,0),o.push(0,0,0))}n.setAttribute("position",new Ht(i,3)),n.setAttribute("color",new Ht(o,3));const l=new Pa({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const h=new At(255),d=new At(65280);this.setColors(h,d)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");TA.copy(this.root.matrixWorld).invert();for(let o=0,l=0;o<t.length;o++){const h=t[o];h.parent&&h.parent.isBone&&(kv.multiplyMatrices(TA,h.matrixWorld),Ec.setFromMatrixPosition(kv),i.setXYZ(l,Ec.x,Ec.y,Ec.z),kv.multiplyMatrices(TA,h.parent.matrixWorld),Ec.setFromMatrixPosition(kv),i.setXYZ(l+1,Ec.x,Ec.y,Ec.z),l+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let o=0;o<i.count;o+=2)i.setXYZ(o,e.r,e.g,e.b),i.setXYZ(o+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function lE(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push(...lE(s.children[t]));return e}class LB extends pi{constructor(e,t,n){const i=new kp(t,4,2),o=new fa({wireframe:!0,fog:!1,toneMapped:!1});super(i,o),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const OB=new Q,cE=new At,uE=new At;class IB extends wn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Vp(t);i.rotateY(Math.PI*.5),this.material=new fa({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const o=i.getAttribute("position"),l=new Float32Array(o.count*3);i.setAttribute("color",new Ln(l,3)),this.add(new pi(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");cE.copy(this.light.color),uE.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const o=n<i/2?cE:uE;t.setXYZ(n,o.r,o.g,o.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(OB.setFromMatrixPosition(this.light.matrixWorld).negate())}}class FB extends yr{constructor(e=10,t=10,n=4473924,i=8947848){n=new At(n),i=new At(i);const o=t/2,l=e/t,h=e/2,d=[],p=[];for(let y=0,x=0,b=-h;y<=t;y++,b+=l){d.push(-h,0,b,h,0,b),d.push(b,0,-h,b,0,h);const R=y===o?n:i;R.toArray(p,x),x+=3,R.toArray(p,x),x+=3,R.toArray(p,x),x+=3,R.toArray(p,x),x+=3}const _=new on;_.setAttribute("position",new Ht(d,3)),_.setAttribute("color",new Ht(p,3));const v=new Pa({vertexColors:!0,toneMapped:!1});super(_,v),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class HB extends yr{constructor(e=10,t=16,n=8,i=64,o=4473924,l=8947848){o=new At(o),l=new At(l);const h=[],d=[];if(t>1)for(let v=0;v<t;v++){const y=v/t*(Math.PI*2),x=Math.sin(y)*e,b=Math.cos(y)*e;h.push(0,0,0),h.push(x,0,b);const R=v&1?o:l;d.push(R.r,R.g,R.b),d.push(R.r,R.g,R.b)}for(let v=0;v<n;v++){const y=v&1?o:l,x=e-e/n*v;for(let b=0;b<i;b++){let R=b/i*(Math.PI*2),T=Math.sin(R)*x,M=Math.cos(R)*x;h.push(T,0,M),d.push(y.r,y.g,y.b),R=(b+1)/i*(Math.PI*2),T=Math.sin(R)*x,M=Math.cos(R)*x,h.push(T,0,M),d.push(y.r,y.g,y.b)}}const p=new on;p.setAttribute("position",new Ht(h,3)),p.setAttribute("color",new Ht(d,3));const _=new Pa({vertexColors:!0,toneMapped:!1});super(p,_),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const fE=new Q,Xv=new Q,hE=new Q;class PB extends wn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new on;i.setAttribute("position",new Ht([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const o=new Pa({fog:!1,toneMapped:!1});this.lightPlane=new Ro(i,o),this.add(this.lightPlane),i=new on,i.setAttribute("position",new Ht([0,0,0,0,0,1],3)),this.targetLine=new Ro(i,o),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),fE.setFromMatrixPosition(this.light.matrixWorld),Xv.setFromMatrixPosition(this.light.target.matrixWorld),hE.subVectors(Xv,fE),this.lightPlane.lookAt(Xv),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Xv),this.targetLine.scale.z=hE.length()}}const Yv=new Q,Vi=new X0;class GB extends yr{constructor(e){const t=new on,n=new Pa({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],o=[],l={};h("n1","n2"),h("n2","n4"),h("n4","n3"),h("n3","n1"),h("f1","f2"),h("f2","f4"),h("f4","f3"),h("f3","f1"),h("n1","f1"),h("n2","f2"),h("n3","f3"),h("n4","f4"),h("p","n1"),h("p","n2"),h("p","n3"),h("p","n4"),h("u1","u2"),h("u2","u3"),h("u3","u1"),h("c","t"),h("p","c"),h("cn1","cn2"),h("cn3","cn4"),h("cf1","cf2"),h("cf3","cf4");function h(b,R){d(b),d(R)}function d(b){i.push(0,0,0),o.push(0,0,0),l[b]===void 0&&(l[b]=[]),l[b].push(i.length/3-1)}t.setAttribute("position",new Ht(i,3)),t.setAttribute("color",new Ht(o,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=l,this.update();const p=new At(16755200),_=new At(16711680),v=new At(43775),y=new At(16777215),x=new At(3355443);this.setColors(p,_,v,y,x)}setColors(e,t,n,i,o){const h=this.geometry.getAttribute("color");return h.setXYZ(0,e.r,e.g,e.b),h.setXYZ(1,e.r,e.g,e.b),h.setXYZ(2,e.r,e.g,e.b),h.setXYZ(3,e.r,e.g,e.b),h.setXYZ(4,e.r,e.g,e.b),h.setXYZ(5,e.r,e.g,e.b),h.setXYZ(6,e.r,e.g,e.b),h.setXYZ(7,e.r,e.g,e.b),h.setXYZ(8,e.r,e.g,e.b),h.setXYZ(9,e.r,e.g,e.b),h.setXYZ(10,e.r,e.g,e.b),h.setXYZ(11,e.r,e.g,e.b),h.setXYZ(12,e.r,e.g,e.b),h.setXYZ(13,e.r,e.g,e.b),h.setXYZ(14,e.r,e.g,e.b),h.setXYZ(15,e.r,e.g,e.b),h.setXYZ(16,e.r,e.g,e.b),h.setXYZ(17,e.r,e.g,e.b),h.setXYZ(18,e.r,e.g,e.b),h.setXYZ(19,e.r,e.g,e.b),h.setXYZ(20,e.r,e.g,e.b),h.setXYZ(21,e.r,e.g,e.b),h.setXYZ(22,e.r,e.g,e.b),h.setXYZ(23,e.r,e.g,e.b),h.setXYZ(24,t.r,t.g,t.b),h.setXYZ(25,t.r,t.g,t.b),h.setXYZ(26,t.r,t.g,t.b),h.setXYZ(27,t.r,t.g,t.b),h.setXYZ(28,t.r,t.g,t.b),h.setXYZ(29,t.r,t.g,t.b),h.setXYZ(30,t.r,t.g,t.b),h.setXYZ(31,t.r,t.g,t.b),h.setXYZ(32,n.r,n.g,n.b),h.setXYZ(33,n.r,n.g,n.b),h.setXYZ(34,n.r,n.g,n.b),h.setXYZ(35,n.r,n.g,n.b),h.setXYZ(36,n.r,n.g,n.b),h.setXYZ(37,n.r,n.g,n.b),h.setXYZ(38,i.r,i.g,i.b),h.setXYZ(39,i.r,i.g,i.b),h.setXYZ(40,o.r,o.g,o.b),h.setXYZ(41,o.r,o.g,o.b),h.setXYZ(42,o.r,o.g,o.b),h.setXYZ(43,o.r,o.g,o.b),h.setXYZ(44,o.r,o.g,o.b),h.setXYZ(45,o.r,o.g,o.b),h.setXYZ(46,o.r,o.g,o.b),h.setXYZ(47,o.r,o.g,o.b),h.setXYZ(48,o.r,o.g,o.b),h.setXYZ(49,o.r,o.g,o.b),h.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let o,l;if(Vi.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)o=1,l=0;else if(this.camera.coordinateSystem===Zs)o=-1,l=1;else if(this.camera.coordinateSystem===$f)o=0,l=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Zi("c",t,e,Vi,0,0,o),Zi("t",t,e,Vi,0,0,l),Zi("n1",t,e,Vi,-n,-i,o),Zi("n2",t,e,Vi,n,-i,o),Zi("n3",t,e,Vi,-n,i,o),Zi("n4",t,e,Vi,n,i,o),Zi("f1",t,e,Vi,-n,-i,l),Zi("f2",t,e,Vi,n,-i,l),Zi("f3",t,e,Vi,-n,i,l),Zi("f4",t,e,Vi,n,i,l),Zi("u1",t,e,Vi,n*.7,i*1.1,o),Zi("u2",t,e,Vi,-n*.7,i*1.1,o),Zi("u3",t,e,Vi,0,i*2,o),Zi("cf1",t,e,Vi,-n,0,l),Zi("cf2",t,e,Vi,n,0,l),Zi("cf3",t,e,Vi,0,-i,l),Zi("cf4",t,e,Vi,0,i,l),Zi("cn1",t,e,Vi,-n,0,o),Zi("cn2",t,e,Vi,n,0,o),Zi("cn3",t,e,Vi,0,-i,o),Zi("cn4",t,e,Vi,0,i,o),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Zi(s,e,t,n,i,o,l){Yv.set(i,o,l).unproject(n);const h=e[s];if(h!==void 0){const d=t.getAttribute("position");for(let p=0,_=h.length;p<_;p++)d.setXYZ(h[p],Yv.x,Yv.y,Yv.z)}}const Jv=new Ea;class zB extends yr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),o=new on;o.setIndex(new Ln(n,1)),o.setAttribute("position",new Ln(i,3)),super(o,new Pa({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Jv.setFromObject(this.object),Jv.isEmpty())return;const e=Jv.min,t=Jv.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class VB extends yr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],o=new on;o.setIndex(new Ln(n,1)),o.setAttribute("position",new Ht(i,3)),super(o,new Pa({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class kB extends Ro{constructor(e,t=1,n=16776960){const i=n,o=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],l=new on;l.setAttribute("position",new Ht(o,3)),l.computeBoundingSphere(),super(l,new Pa({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const h=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],d=new on;d.setAttribute("position",new Ht(h,3)),d.computeBoundingSphere(),this.add(new pi(d,new fa({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const dE=new Q;let qv,CA;class XB extends wn{constructor(e=new Q(0,0,1),t=new Q(0,0,0),n=1,i=16776960,o=n*.2,l=o*.2){super(),this.type="ArrowHelper",qv===void 0&&(qv=new on,qv.setAttribute("position",new Ht([0,0,0,0,1,0],3)),CA=new Lp(.5,1,5,1),CA.translate(0,-.5,0)),this.position.copy(t),this.line=new Ro(qv,new Pa({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new pi(CA,new fa({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,o,l)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{dE.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(dE,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),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 YB extends yr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new on;i.setAttribute("position",new Ht(t,3)),i.setAttribute("color",new Ht(n,3));const o=new Pa({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new At,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class JB{constructor(){this.type="ShapePath",this.color=new At,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ev,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(M){const w=[];for(let D=0,U=M.length;D<U;D++){const F=M[D],O=new Ou;O.curves=F.curves,w.push(O)}return w}function n(M,w){const D=w.length;let U=!1;for(let F=D-1,O=0;O<D;F=O++){let z=w[F],k=w[O],N=k.x-z.x,I=k.y-z.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(z=w[O],N=-N,k=w[F],I=-I),M.y<z.y||M.y>k.y)continue;if(M.y===z.y){if(M.x===z.x)return!0}else{const W=I*(M.x-z.x)-N*(M.y-z.y);if(W===0)return!0;if(W<0)continue;U=!U}}else{if(M.y!==z.y)continue;if(k.x<=M.x&&M.x<=z.x||z.x<=M.x&&M.x<=k.x)return!0}}return U}const i=Zr.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,h,d;const p=[];if(o.length===1)return h=o[0],d=new Ou,d.curves=h.curves,p.push(d),p;let _=!i(o[0].getPoints());_=e?!_:_;const v=[],y=[];let x=[],b=0,R;y[b]=void 0,x[b]=[];for(let M=0,w=o.length;M<w;M++)h=o[M],R=h.getPoints(),l=i(R),l=e?!l:l,l?(!_&&y[b]&&b++,y[b]={s:new Ou,p:R},y[b].s.curves=h.curves,_&&b++,x[b]=[]):x[b].push({h,p:R[0]});if(!y[0])return t(o);if(y.length>1){let M=!1,w=0;for(let D=0,U=y.length;D<U;D++)v[D]=[];for(let D=0,U=y.length;D<U;D++){const F=x[D];for(let O=0;O<F.length;O++){const z=F[O];let k=!0;for(let N=0;N<y.length;N++)n(z.p,y[N].p)&&(D!==N&&w++,k?(k=!1,v[N].push(z)):M=!0);k&&v[D].push(z)}}w>0&&M===!1&&(x=v)}let T;for(let M=0,w=y.length;M<w;M++){d=y[M].s,p.push(d),T=x[M];for(let D=0,U=T.length;D<U;D++)d.holes.push(T[D].h)}return p}}class qB extends Eo{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Et("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function KB(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function WB(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function jB(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function RA(s,e,t,n){const i=ZB(n);switch(t){case ax:return s*e;case ip:return s*e/i.components*i.byteLength;case ap:return s*e/i.components*i.byteLength;case xu:return s*e*2/i.components*i.byteLength;case zg:return s*e*2/i.components*i.byteLength;case sx:return s*e*3/i.components*i.byteLength;case ji:return s*e*4/i.components*i.byteLength;case Vg:return s*e*4/i.components*i.byteLength;case sp:case rp:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case op:case lp:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Xg:case Jg:return Math.max(s,16)*Math.max(e,8)/4;case kg:case Yg:return Math.max(s,8)*Math.max(e,8)/2;case qg:case Kg:case jg:case Zg:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Wg:case Qg:case $g:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case e0:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case t0:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case n0:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case i0:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case a0:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case s0:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case r0:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case o0:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case l0:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case c0:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case u0:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case f0:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case h0:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case d0:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case p0:case m0:case g0:return Math.ceil(s/4)*Math.ceil(e/4)*16;case v0:case _0:return Math.ceil(s/4)*Math.ceil(e/4)*8;case y0:case x0:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function ZB(s){switch(s){case Ma:case Fg:return{byteLength:1,components:1};case Zf:case Hg:case Hi:return{byteLength:2,components:1};case Pg:case Gg:return{byteLength:2,components:4};case js:case np:case Ai:return{byteLength:4,components:1};case nx:case ix:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}class QB{static contain(e,t){return KB(e,t)}static cover(e,t){return WB(e,t)}static fill(e){return jB(e)}static getByteLength(e,t,n,i){return RA(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zd}})),typeof window<"u"&&(window.__THREE__?Et("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zd);function pE(){let s=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){s=o}}}function $B(s){const e=new WeakMap;function t(h,d){const p=h.array,_=h.usage,v=p.byteLength,y=s.createBuffer();s.bindBuffer(d,y),s.bufferData(d,p,_),h.onUploadCallback();let x;if(p instanceof Float32Array)x=s.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)x=s.HALF_FLOAT;else if(p instanceof Uint16Array)h.isFloat16BufferAttribute?x=s.HALF_FLOAT:x=s.UNSIGNED_SHORT;else if(p instanceof Int16Array)x=s.SHORT;else if(p instanceof Uint32Array)x=s.UNSIGNED_INT;else if(p instanceof Int32Array)x=s.INT;else if(p instanceof Int8Array)x=s.BYTE;else if(p instanceof Uint8Array)x=s.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)x=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:y,type:x,bytesPerElement:p.BYTES_PER_ELEMENT,version:h.version,size:v}}function n(h,d,p){const _=d.array,v=d.updateRanges;if(s.bindBuffer(p,h),v.length===0)s.bufferSubData(p,0,_);else{v.sort((x,b)=>x.start-b.start);let y=0;for(let x=1;x<v.length;x++){const b=v[y],R=v[x];R.start<=b.start+b.count+1?b.count=Math.max(b.count,R.start+R.count-b.start):(++y,v[y]=R)}v.length=y+1;for(let x=0,b=v.length;x<b;x++){const R=v[x];s.bufferSubData(p,R.start*_.BYTES_PER_ELEMENT,_,R.start,R.count)}d.clearUpdateRanges()}d.onUploadCallback()}function i(h){return h.isInterleavedBufferAttribute&&(h=h.data),e.get(h)}function o(h){h.isInterleavedBufferAttribute&&(h=h.data);const d=e.get(h);d&&(s.deleteBuffer(d.buffer),e.delete(h))}function l(h,d){if(h.isInterleavedBufferAttribute&&(h=h.data),h.isGLBufferAttribute){const _=e.get(h);(!_||_.version<h.version)&&e.set(h,{buffer:h.buffer,type:h.type,bytesPerElement:h.elementSize,version:h.version});return}const p=e.get(h);if(p===void 0)e.set(h,t(h,d));else if(p.version<h.version){if(p.size!==h.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(p.buffer,h,d),p.version=h.version}}return{get:i,remove:o,update:l}}var e3=`#ifdef USE_ALPHAHASH
|
|
48
|
+
`},i=new Du(5,5,5),o=new ms({name:"CubemapFromEquirect",uniforms:gh(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:fs,blending:Xr});o.uniforms.tEquirect.value=t;const l=new pi(i,o),h=t.minFilter;return t.minFilter===Is&&(t.minFilter=bn),new Fb(1,10,this).update(e,l),t.minFilter=h,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}class vr extends wn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const W2={type:"move"};class J0{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vr,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 vr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Q),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,o=null,l=null;const h=this._targetRay,d=this._grip,p=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(p&&e.hand){l=!0;for(const R of e.hand.values()){const T=t.getJointPose(R,n),M=this._getHandJoint(p,R);T!==null&&(M.matrix.fromArray(T.transform.matrix),M.matrix.decompose(M.position,M.rotation,M.scale),M.matrixWorldNeedsUpdate=!0,M.jointRadius=T.radius),M.visible=T!==null}const _=p.joints["index-finger-tip"],v=p.joints["thumb-tip"],y=_.position.distanceTo(v.position),x=.02,b=.005;p.inputState.pinching&&y>x+b?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!p.inputState.pinching&&y<=x-b&&(p.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else d!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(d.matrix.fromArray(o.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,o.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(o.linearVelocity)):d.hasLinearVelocity=!1,o.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(o.angularVelocity)):d.hasAngularVelocity=!1));h!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(h.matrix.fromArray(i.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,i.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(i.linearVelocity)):h.hasLinearVelocity=!1,i.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(i.angularVelocity)):h.hasAngularVelocity=!1,this.dispatchEvent(W2)))}return h!==null&&(h.visible=i!==null),d!==null&&(d.visible=o!==null),p!==null&&(p.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new vr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class q0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new At(e),this.density=t}clone(){return new q0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class K0{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new At(e),this.near=t,this.far=n}clone(){return new K0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Mp extends wn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new er,this.environmentIntensity=1,this.environmentRotation=new er,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class yh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=dp,this.updateRanges=[],this.version=0,this.uuid=Qs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,o=this.stride;i<o;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Qs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Qs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const gs=new Q;class xl{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyMatrix4(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyNormalMatrix(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.transformDirection(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=hs(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=yn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=yn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=hs(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=hs(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=hs(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=hs(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e=e*this.data.stride+this.offset,this.normalized&&(t=yn(t,this.array),n=yn(n,this.array),i=yn(i,this.array),o=yn(o,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=o,this}clone(e){if(e===void 0){mp("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return new Ln(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new xl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){mp("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Lx extends Gi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new At(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let xh;const bp=new Q,Ah=new Q,Sh=new Q,Mh=new et,Ep=new et,Hb=new Qt,W0=new Q,Tp=new Q,j0=new Q,Pb=new et,Ox=new et,Gb=new et;class zb extends wn{constructor(e=new Lx){if(super(),this.isSprite=!0,this.type="Sprite",xh===void 0){xh=new on;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new yh(t,5);xh.setIndex([0,1,2,0,2,3]),xh.setAttribute("position",new xl(n,3,0,!1)),xh.setAttribute("uv",new xl(n,2,3,!1))}this.geometry=xh,this.material=e,this.center=new et(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Wt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ah.setFromMatrixScale(this.matrixWorld),Hb.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Sh.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ah.multiplyScalar(-Sh.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;Z0(W0.set(-.5,-.5,0),Sh,l,Ah,i,o),Z0(Tp.set(.5,-.5,0),Sh,l,Ah,i,o),Z0(j0.set(.5,.5,0),Sh,l,Ah,i,o),Pb.set(0,0),Ox.set(1,0),Gb.set(1,1);let h=e.ray.intersectTriangle(W0,Tp,j0,!1,bp);if(h===null&&(Z0(Tp.set(-.5,.5,0),Sh,l,Ah,i,o),Ox.set(0,1),h=e.ray.intersectTriangle(W0,j0,Tp,!1,bp),h===null))return;const d=e.ray.origin.distanceTo(bp);d<e.near||d>e.far||t.push({distance:d,point:bp.clone(),uv:Fs.getInterpolation(bp,W0,Tp,j0,Pb,Ox,Gb,new et),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Z0(s,e,t,n,i,o){Mh.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Ep.x=o*Mh.x-i*Mh.y,Ep.y=i*Mh.x+o*Mh.y):Ep.copy(Mh),s.copy(e),s.x+=Ep.x,s.y+=Ep.y,s.applyMatrix4(Hb)}const Q0=new Q,Vb=new Q;class kb extends wn{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const o=t[n];this.addLevel(o.object.clone(),o.distance,o.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let o;for(o=0;o<i.length&&!(t<i[o].distance);o++);return i.splice(o,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let o=t[n].distance;if(t[n].object.visible&&(o-=o*t[n].hysteresis),e<o)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Q0.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Q0);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Q0.setFromMatrixPosition(e.matrixWorld),Vb.setFromMatrixPosition(this.matrixWorld);const n=Q0.distanceTo(Vb)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i<o;i++){let l=t[i].distance;if(t[i].object.visible&&(l-=l*t[i].hysteresis),n>=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<o;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,o=n.length;i<o;i++){const l=n[i];t.object.levels.push({object:l.object.uuid,distance:l.distance,hysteresis:l.hysteresis})}return t}}const Xb=new Q,Yb=new ci,Jb=new ci,j2=new Q,qb=new Qt,$0=new Q,Ix=new ua,Kb=new Qt,Fx=new lh;class ev extends pi{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ex,this.bindMatrix=new Qt,this.bindMatrixInverse=new Qt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ea),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,$0),this.boundingBox.expandByPoint($0)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ua),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,$0),this.boundingSphere.expandByPoint($0)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ix.copy(this.boundingSphere),Ix.applyMatrix4(i),e.ray.intersectsSphere(Ix)!==!1&&(Kb.copy(i).invert(),Fx.copy(e.ray).applyMatrix4(Kb),!(this.boundingBox!==null&&Fx.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Fx)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ci,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const o=1/e.manhattanLength();o!==1/0?e.multiplyScalar(o):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===ex?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===tb?this.bindMatrixInverse.copy(this.bindMatrix).invert():Et("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Yb.fromBufferAttribute(i.attributes.skinIndex,e),Jb.fromBufferAttribute(i.attributes.skinWeight,e),Xb.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let o=0;o<4;o++){const l=Jb.getComponent(o);if(l!==0){const h=Yb.getComponent(o);qb.multiplyMatrices(n.bones[h].matrixWorld,n.boneInverses[h]),t.addScaledVector(j2.copy(Xb).applyMatrix4(qb),l)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Cp extends wn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class _r extends qn{constructor(e=null,t=1,n=1,i,o,l,h,d,p=xi,_=xi,v,y){super(null,l,h,d,p,_,i,o,v,y),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Wb=new Qt,Z2=new Qt;class bh{constructor(e=[],t=[]){this.uuid=Qs(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Et("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Qt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Qt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let o=0,l=e.length;o<l;o++){const h=e[o]?e[o].matrixWorld:Z2;Wb.multiplyMatrices(h,t[o]),Wb.toArray(n,o*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new bh(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new _r(t,e,e,ji,Ai);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const o=e.bones[n];let l=t[o];l===void 0&&(Et("Skeleton: No bone found with UUID:",o),l=new Cp),this.bones.push(l),this.boneInverses.push(new Qt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,o=t.length;i<o;i++){const l=t[i];e.bones.push(l.uuid);const h=n[i];e.boneInverses.push(h.toArray())}return e}}class xc extends Ln{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Eh=new Qt,jb=new Qt,tv=[],Zb=new Ea,Q2=new Qt,Rp=new pi,wp=new ua;class nv extends pi{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new xc(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Q2)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ea),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Eh),Zb.copy(e.boundingBox).applyMatrix4(Eh),this.boundingBox.union(Zb)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ua),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Eh),wp.copy(e.boundingSphere).applyMatrix4(Eh),this.boundingSphere.union(wp)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,o=n.length+1,l=e*o+1;for(let h=0;h<n.length;h++)n[h]=i[l+h]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Rp.geometry=this.geometry,Rp.material=this.material,Rp.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),wp.copy(this.boundingSphere),wp.applyMatrix4(n),e.ray.intersectsSphere(wp)!==!1))for(let o=0;o<i;o++){this.getMatrixAt(o,Eh),jb.multiplyMatrices(n,Eh),Rp.matrixWorld=jb,Rp.raycast(e,tv);for(let l=0,h=tv.length;l<h;l++){const d=tv[l];d.instanceId=o,d.object=this,t.push(d)}tv.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new xc(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new _r(new Float32Array(i*this.count),i,this.count,ip,Ai));const o=this.morphTexture.source.data.data;let l=0;for(let p=0;p<n.length;p++)l+=n[p];const h=this.geometry.morphTargetsRelative?1:1-l,d=i*e;o[d]=h,o.set(n,d+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Hx=new Q,$2=new Q,ew=new mn;class Ac{constructor(e=new Q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Hx.subVectors(n,t).cross($2.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Hx),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/i;return o<0||o>1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ew.getNormalMatrix(e),i=this.coplanarPoint(Hx).applyMatrix4(e),o=this.normal.applyMatrix3(n).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 Uu=new ua,tw=new et(.5,.5),iv=new Q;class Th{constructor(e=new Ac,t=new Ac,n=new Ac,i=new Ac,o=new Ac,l=new Ac){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const h=this.planes;return h[0].copy(e),h[1].copy(t),h[2].copy(n),h[3].copy(i),h[4].copy(o),h[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Zs,n=!1){const i=this.planes,o=e.elements,l=o[0],h=o[1],d=o[2],p=o[3],_=o[4],v=o[5],y=o[6],x=o[7],b=o[8],R=o[9],T=o[10],M=o[11],w=o[12],D=o[13],U=o[14],F=o[15];if(i[0].setComponents(p-l,x-_,M-b,F-w).normalize(),i[1].setComponents(p+l,x+_,M+b,F+w).normalize(),i[2].setComponents(p+h,x+v,M+R,F+D).normalize(),i[3].setComponents(p-h,x-v,M-R,F-D).normalize(),n)i[4].setComponents(d,y,T,U).normalize(),i[5].setComponents(p-d,x-y,M-T,F-U).normalize();else if(i[4].setComponents(p-d,x-y,M-T,F-U).normalize(),t===Zs)i[5].setComponents(p+d,x+y,M+T,F+U).normalize();else if(t===$f)i[5].setComponents(d,y,T,U).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Uu.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Uu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Uu)}intersectsSprite(e){Uu.center.set(0,0,0);const t=tw.distanceTo(e.center);return Uu.radius=.7071067811865476+t,Uu.applyMatrix4(e.matrixWorld),this.intersectsSphere(Uu)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(iv.x=i.normal.x>0?e.max.x:e.min.x,iv.y=i.normal.y>0?e.max.y:e.min.y,iv.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(iv)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const To=new Qt,Co=new Th;class av{constructor(){this.coordinateSystem=Zs}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(To.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Co.setFromProjectionMatrix(To,i.coordinateSystem,i.reversedDepth),Co.containsPoint(e))return!0}return!1}clone(){return new av}}function Px(s,e){return s-e}function nw(s,e){return s.z-e.z}function iw(s,e){return e.z-s.z}class aw{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const o=this.pool,l=this.list;this.index>=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const h=o[this.index];l.push(h),this.index++,h.start=e,h.count=t,h.z=n,h.index=i}reset(){this.list.length=0,this.index=0}}const Ps=new Qt,sw=new At(1,1,1),Qb=new Th,rw=new av,sv=new Ea,Nu=new ua,Bp=new Q,$b=new Q,ow=new Q,Gx=new aw,Qa=new pi,rv=[];function lw(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let o=0;o<i;o++)for(let l=0;l<n;l++)e.setComponent(o+t,l,s.getComponent(o,l))}else e.array.set(s.array,t*n);e.needsUpdate=!0}function Lu(s,e){if(s.constructor!==e.constructor){const t=Math.min(s.length,e.length);for(let n=0;n<t;n++)e[n]=s[n]}else{const t=Math.min(s.length,e.length);e.set(new s.constructor(s.buffer,0,t))}}class e1 extends pi{constructor(e,t,n=t*2,i){super(new on,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new _r(t,e,e,ji,Ai);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new _r(t,e,e,ap,js);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new _r(t,e,e,ji,Ai);n.colorSpace=Tn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const o in e.attributes){const l=e.getAttribute(o),{array:h,itemSize:d,normalized:p}=l,_=new h.constructor(n*d),v=new Ln(_,d,p);t.setAttribute(o,v)}if(e.getIndex()!==null){const o=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Ln(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ea);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const o=t[n].geometryIndex;this.getMatrixAt(n,Ps),this.getBoundingBoxAt(o,sv).applyMatrix4(Ps),e.union(sv)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ua);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const o=t[n].geometryIndex;this.getMatrixAt(n,Ps),this.getBoundingSphereAt(o,Nu).applyMatrix4(Ps),e.union(Nu)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Px),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;Ps.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(sw.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let d;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Px),d=this._availableGeometryIds.shift(),o[d]=i):(d=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(d,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,d}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),h=this._geometryInfo[e];if(i&&l.count>h.reservedIndexCount||t.attributes.position.count>h.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const d=h.vertexStart,p=h.reservedVertexCount;h.vertexCount=t.getAttribute("position").count;for(const _ in n.attributes){const v=t.getAttribute(_),y=n.getAttribute(_);lw(v,y,d);const x=v.itemSize;for(let b=v.count,R=p;b<R;b++){const T=d+b;for(let M=0;M<x;M++)y.setComponent(T,M,0)}y.needsUpdate=!0,y.addUpdateRange(d*x,p*x)}if(i){const _=h.indexStart,v=h.reservedIndexCount;h.indexCount=t.getIndex().count;for(let y=0;y<l.count;y++)o.setX(_+y,d+l.getX(y));for(let y=l.count,x=v;y<x;y++)o.setX(_+y,d);o.needsUpdate=!0,o.addUpdateRange(_,h.reservedIndexCount)}return h.start=i?h.indexStart:h.vertexStart,h.count=i?h.indexCount:h.vertexCount,h.boundingBox=null,t.boundingBox!==null&&(h.boundingBox=t.boundingBox.clone()),h.boundingSphere=null,t.boundingSphere!==null&&(h.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;i<o;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((l,h)=>h).sort((l,h)=>n[l].vertexStart-n[h].vertexStart),o=this.geometry;for(let l=0,h=n.length;l<h;l++){const d=i[l],p=n[d];if(p.active!==!1){if(o.index!==null){if(p.indexStart!==t){const{indexStart:_,vertexStart:v,reservedIndexCount:y}=p,x=o.index,b=x.array,R=e-v;for(let T=_;T<_+y;T++)b[T]=b[T]+R;x.array.copyWithin(t,_,_+y),x.addUpdateRange(t,y),x.needsUpdate=!0,p.indexStart=t}t+=p.reservedIndexCount}if(p.vertexStart!==e){const{vertexStart:_,reservedVertexCount:v}=p,y=o.attributes;for(const x in y){const b=y[x],{array:R,itemSize:T}=b;R.copyWithin(e*T,_*T,(_+v)*T),b.addUpdateRange(e*T,v*T),b.needsUpdate=!0}p.vertexStart=e}e+=p.reservedVertexCount,p.start=o.index?p.indexStart:p.vertexStart,this._nextIndexStart=o.index?p.indexStart+p.reservedIndexCount:0,this._nextVertexStart=p.vertexStart+p.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Ea,l=n.index,h=n.attributes.position;for(let d=i.start,p=i.start+i.count;d<p;d++){let _=d;l&&(_=l.getX(_)),o.expandByPoint(Bp.fromBufferAttribute(h,_))}i.boundingBox=o}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new ua;this.getBoundingBoxAt(e,sv),sv.getCenter(o.center);const l=n.index,h=n.attributes.position;let d=0;for(let p=i.start,_=i.start+i.count;p<_;p++){let v=p;l&&(v=l.getX(v)),Bp.fromBufferAttribute(h,v),d=Math.max(d,o.center.distanceToSquared(Bp))}o.radius=Math.sqrt(d),i.boundingSphere=o}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(Px);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),o=new Int32Array(e);Lu(this._multiDrawCounts,i),Lu(this._multiDrawStarts,o),this._multiDrawCounts=i,this._multiDrawStarts=o,this._maxInstanceCount=e;const l=this._indirectTexture,h=this._matricesTexture,d=this._colorsTexture;l.dispose(),this._initIndirectTexture(),Lu(l.image.data,this._indirectTexture.image.data),h.dispose(),this._initMatricesTexture(),Lu(h.image.data,this._matricesTexture.image.data),d&&(d.dispose(),this._initColorsTexture(),Lu(d.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(h=>h.active);if(Math.max(...n.map(h=>h.vertexStart+h.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(d=>d.indexStart+d.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new on,this._initializeGeometry(o));const l=this.geometry;o.index&&Lu(o.index.array,l.index.array);for(const h in o.attributes)Lu(o.attributes[h].array,l.attributes[h].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;Qa.material=this.material,Qa.geometry.index=l.index,Qa.geometry.attributes=l.attributes,Qa.geometry.boundingBox===null&&(Qa.geometry.boundingBox=new Ea),Qa.geometry.boundingSphere===null&&(Qa.geometry.boundingSphere=new ua);for(let h=0,d=n.length;h<d;h++){if(!n[h].visible||!n[h].active)continue;const p=n[h].geometryIndex,_=i[p];Qa.geometry.setDrawRange(_.start,_.count),this.getMatrixAt(h,Qa.matrixWorld).premultiply(o),this.getBoundingBoxAt(p,Qa.geometry.boundingBox),this.getBoundingSphereAt(p,Qa.geometry.boundingSphere),Qa.raycast(e,rv);for(let v=0,y=rv.length;v<y;v++){const x=rv[v];x.object=this,x.batchId=h,t.push(x)}rv.length=0}Qa.material=null,Qa.geometry.index=null,Qa.geometry.attributes={},Qa.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex(),h=l===null?1:l.array.BYTES_PER_ELEMENT,d=this._instanceInfo,p=this._multiDrawStarts,_=this._multiDrawCounts,v=this._geometryInfo,y=this.perObjectFrustumCulled,x=this._indirectTexture,b=x.image.data,R=n.isArrayCamera?rw:Qb;y&&!n.isArrayCamera&&(Ps.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Qb.setFromProjectionMatrix(Ps,n.coordinateSystem,n.reversedDepth));let T=0;if(this.sortObjects){Ps.copy(this.matrixWorld).invert(),Bp.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ps),$b.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ps);for(let D=0,U=d.length;D<U;D++)if(d[D].visible&&d[D].active){const F=d[D].geometryIndex;this.getMatrixAt(D,Ps),this.getBoundingSphereAt(F,Nu).applyMatrix4(Ps);let O=!1;if(y&&(O=!R.intersectsSphere(Nu,n)),!O){const z=v[F],k=ow.subVectors(Nu.center,Bp).dot($b);Gx.push(z.start,z.count,k,D)}}const M=Gx.list,w=this.customSort;w===null?M.sort(o.transparent?iw:nw):w.call(this,M,n);for(let D=0,U=M.length;D<U;D++){const F=M[D];p[T]=F.start*h,_[T]=F.count,b[T]=F.index,T++}Gx.reset()}else for(let M=0,w=d.length;M<w;M++)if(d[M].visible&&d[M].active){const D=d[M].geometryIndex;let U=!1;if(y&&(this.getMatrixAt(M,Ps),this.getBoundingSphereAt(D,Nu).applyMatrix4(Ps),U=!R.intersectsSphere(Nu,n)),!U){const F=v[D];p[T]=F.start*h,_[T]=F.count,b[T]=M,T++}}x.needsUpdate=!0,this._multiDrawCount=T,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,o,l){this.onBeforeRender(e,null,i,o,l)}}class Pa extends Gi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new At(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ov=new Q,lv=new Q,t1=new Qt,Dp=new lh,cv=new ua,zx=new Q,n1=new Q;class Ro extends wn{constructor(e=new on,t=new Pa){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,o=t.count;i<o;i++)ov.fromBufferAttribute(t,i-1),lv.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ov.distanceTo(lv);e.setAttribute("lineDistance",new Pt(n,1))}else Et("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,o=e.params.Line.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),cv.copy(n.boundingSphere),cv.applyMatrix4(i),cv.radius+=o,e.ray.intersectsSphere(cv)===!1)return;t1.copy(i).invert(),Dp.copy(e.ray).applyMatrix4(t1);const h=o/((this.scale.x+this.scale.y+this.scale.z)/3),d=h*h,p=this.isLineSegments?2:1,_=n.index,y=n.attributes.position;if(_!==null){const x=Math.max(0,l.start),b=Math.min(_.count,l.start+l.count);for(let R=x,T=b-1;R<T;R+=p){const M=_.getX(R),w=_.getX(R+1),D=uv(this,e,Dp,d,M,w,R);D&&t.push(D)}if(this.isLineLoop){const R=_.getX(b-1),T=_.getX(x),M=uv(this,e,Dp,d,R,T,b-1);M&&t.push(M)}}else{const x=Math.max(0,l.start),b=Math.min(y.count,l.start+l.count);for(let R=x,T=b-1;R<T;R+=p){const M=uv(this,e,Dp,d,R,R+1,R);M&&t.push(M)}if(this.isLineLoop){const R=uv(this,e,Dp,d,b-1,x,b-1);R&&t.push(R)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o<l;o++){const h=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=o}}}}}function uv(s,e,t,n,i,o,l){const h=s.geometry.attributes.position;if(ov.fromBufferAttribute(h,i),lv.fromBufferAttribute(h,o),t.distanceSqToSegment(ov,lv,zx,n1)>n)return;zx.applyMatrix4(s.matrixWorld);const p=e.ray.origin.distanceTo(zx);if(!(p<e.near||p>e.far))return{distance:p,point:n1.clone().applyMatrix4(s.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:s}}const i1=new Q,a1=new Q;class yr extends Ro{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i<o;i+=2)i1.fromBufferAttribute(t,i),a1.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+i1.distanceTo(a1);e.setAttribute("lineDistance",new Pt(n,1))}else Et("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class fv extends Ro{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Up extends Gi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new At(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const s1=new Qt,Vx=new lh,hv=new ua,dv=new Q;class pv extends wn{constructor(e=new on,t=new Up){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,o=e.params.Points.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),hv.copy(n.boundingSphere),hv.applyMatrix4(i),hv.radius+=o,e.ray.intersectsSphere(hv)===!1)return;s1.copy(i).invert(),Vx.copy(e.ray).applyMatrix4(s1);const h=o/((this.scale.x+this.scale.y+this.scale.z)/3),d=h*h,p=n.index,v=n.attributes.position;if(p!==null){const y=Math.max(0,l.start),x=Math.min(p.count,l.start+l.count);for(let b=y,R=x;b<R;b++){const T=p.getX(b);dv.fromBufferAttribute(v,T),r1(dv,T,d,i,e,t,this)}}else{const y=Math.max(0,l.start),x=Math.min(v.count,l.start+l.count);for(let b=y,R=x;b<R;b++)dv.fromBufferAttribute(v,b),r1(dv,b,d,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o<l;o++){const h=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=o}}}}}function r1(s,e,t,n,i,o,l){const h=Vx.distanceSqToPoint(s);if(h<t){const d=new Q;Vx.closestPointToPoint(s,d),d.applyMatrix4(n);const p=i.ray.origin.distanceTo(d);if(p<i.near||p>i.far)return;o.push({distance:p,distanceToRay:Math.sqrt(h),point:d,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class o1 extends qn{constructor(e,t,n,i,o=bn,l=bn,h,d,p){super(e,t,n,i,o,l,h,d,p),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const _=this;function v(){_.needsUpdate=!0,_._requestVideoFrameCallbackId=e.requestVideoFrameCallback(v)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(v))}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)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class cw extends o1{constructor(e,t,n,i,o,l,h,d){super({},e,t,n,i,o,l,h,d),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class uw extends qn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xi,this.minFilter=xi,this.generateMipmaps=!1,this.needsUpdate=!0}}class mv extends qn{constructor(e,t,n,i,o,l,h,d,p,_,v,y){super(null,l,h,d,p,_,i,o,v,y),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class fw extends mv{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=yi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class hw extends mv{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Yr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class dw extends qn{constructor(e,t,n,i,o,l,h,d,p){super(e,t,n,i,o,l,h,d,p),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ch extends qn{constructor(e,t,n=js,i,o,l,h=xi,d=xi,p,_=bo,v=1){if(_!==bo&&_!==cc)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const y={width:e,height:t,depth:v};super(y,i,o,l,h,d,_,n,p),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new dc(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class l1 extends Ch{constructor(e,t=js,n=Yr,i,o,l=xi,h=xi,d,p=bo){const _={width:e,height:e,depth:1},v=[_,_,_,_,_,_];super(e,e,t,n,i,o,l,h,d,p),this.image=v,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class kx extends qn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class gv extends on{constructor(e=1,t=1,n=4,i=8,o=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:o},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),o=Math.max(1,Math.floor(o));const l=[],h=[],d=[],p=[],_=t/2,v=Math.PI/2*e,y=t,x=2*v+y,b=n*2+o,R=i+1,T=new Q,M=new Q;for(let w=0;w<=b;w++){let D=0,U=0,F=0,O=0;if(w<=n){const N=w/n,I=N*Math.PI/2;U=-_-e*Math.cos(I),F=e*Math.sin(I),O=-e*Math.cos(I),D=N*v}else if(w<=n+o){const N=(w-n)/o;U=-_+N*t,F=e,O=0,D=v+N*y}else{const N=(w-n-o)/n,I=N*Math.PI/2;U=_+e*Math.sin(I),F=e*Math.cos(I),O=e*Math.sin(I),D=v+y+N*v}const z=Math.max(0,Math.min(1,D/x));let k=0;w===0?k=.5/i:w===b&&(k=-.5/i);for(let N=0;N<=i;N++){const I=N/i,W=I*Math.PI*2,ae=Math.sin(W),ie=Math.cos(W);M.x=-F*ie,M.y=U,M.z=F*ae,h.push(M.x,M.y,M.z),T.set(-F*ie,O,F*ae),T.normalize(),d.push(T.x,T.y,T.z),p.push(I+k,z)}if(w>0){const N=(w-1)*R;for(let I=0;I<i;I++){const W=N+I,ae=N+I+1,ie=w*R+I,se=w*R+I+1;l.push(W,ae,ie),l.push(ae,se,ie)}}}this.setIndex(l),this.setAttribute("position",new Pt(h,3)),this.setAttribute("normal",new Pt(d,3)),this.setAttribute("uv",new Pt(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gv(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class vv extends on{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const o=[],l=[],h=[],d=[],p=new Q,_=new et;l.push(0,0,0),h.push(0,0,1),d.push(.5,.5);for(let v=0,y=3;v<=t;v++,y+=3){const x=n+v/t*i;p.x=e*Math.cos(x),p.y=e*Math.sin(x),l.push(p.x,p.y,p.z),h.push(0,0,1),_.x=(l[y]/e+1)/2,_.y=(l[y+1]/e+1)/2,d.push(_.x,_.y)}for(let v=1;v<=t;v++)o.push(v,v+1,0);this.setIndex(o),this.setAttribute("position",new Pt(l,3)),this.setAttribute("normal",new Pt(h,3)),this.setAttribute("uv",new Pt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vv(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Np extends on{constructor(e=1,t=1,n=1,i=32,o=1,l=!1,h=0,d=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:o,openEnded:l,thetaStart:h,thetaLength:d};const p=this;i=Math.floor(i),o=Math.floor(o);const _=[],v=[],y=[],x=[];let b=0;const R=[],T=n/2;let M=0;w(),l===!1&&(e>0&&D(!0),t>0&&D(!1)),this.setIndex(_),this.setAttribute("position",new Pt(v,3)),this.setAttribute("normal",new Pt(y,3)),this.setAttribute("uv",new Pt(x,2));function w(){const U=new Q,F=new Q;let O=0;const z=(t-e)/n;for(let k=0;k<=o;k++){const N=[],I=k/o,W=I*(t-e)+e;for(let ae=0;ae<=i;ae++){const ie=ae/i,se=ie*d+h,_e=Math.sin(se),H=Math.cos(se);F.x=W*_e,F.y=-I*n+T,F.z=W*H,v.push(F.x,F.y,F.z),U.set(_e,z,H).normalize(),y.push(U.x,U.y,U.z),x.push(ie,1-I),N.push(b++)}R.push(N)}for(let k=0;k<i;k++)for(let N=0;N<o;N++){const I=R[N][k],W=R[N+1][k],ae=R[N+1][k+1],ie=R[N][k+1];(e>0||N!==0)&&(_.push(I,W,ie),O+=3),(t>0||N!==o-1)&&(_.push(W,ae,ie),O+=3)}p.addGroup(M,O,0),M+=O}function D(U){const F=b,O=new et,z=new Q;let k=0;const N=U===!0?e:t,I=U===!0?1:-1;for(let ae=1;ae<=i;ae++)v.push(0,T*I,0),y.push(0,I,0),x.push(.5,.5),b++;const W=b;for(let ae=0;ae<=i;ae++){const se=ae/i*d+h,_e=Math.cos(se),H=Math.sin(se);z.x=N*H,z.y=T*I,z.z=N*_e,v.push(z.x,z.y,z.z),y.push(0,I,0),O.x=_e*.5+.5,O.y=H*.5*I+.5,x.push(O.x,O.y),b++}for(let ae=0;ae<i;ae++){const ie=F+ae,se=W+ae;U===!0?_.push(se,se+1,ie):_.push(se+1,se,ie),k+=3}p.addGroup(M,k,U===!0?1:2),M+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Np(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Lp extends Np{constructor(e=1,t=1,n=32,i=1,o=!1,l=0,h=Math.PI*2){super(0,e,t,n,i,o,l,h),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:l,thetaLength:h}}static fromJSON(e){return new Lp(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Sc extends on{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const o=[],l=[];h(i),p(n),_(),this.setAttribute("position",new Pt(o,3)),this.setAttribute("normal",new Pt(o.slice(),3)),this.setAttribute("uv",new Pt(l,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function h(w){const D=new Q,U=new Q,F=new Q;for(let O=0;O<t.length;O+=3)x(t[O+0],D),x(t[O+1],U),x(t[O+2],F),d(D,U,F,w)}function d(w,D,U,F){const O=F+1,z=[];for(let k=0;k<=O;k++){z[k]=[];const N=w.clone().lerp(U,k/O),I=D.clone().lerp(U,k/O),W=O-k;for(let ae=0;ae<=W;ae++)ae===0&&k===O?z[k][ae]=N:z[k][ae]=N.clone().lerp(I,ae/W)}for(let k=0;k<O;k++)for(let N=0;N<2*(O-k)-1;N++){const I=Math.floor(N/2);N%2===0?(y(z[k][I+1]),y(z[k+1][I]),y(z[k][I])):(y(z[k][I+1]),y(z[k+1][I+1]),y(z[k+1][I]))}}function p(w){const D=new Q;for(let U=0;U<o.length;U+=3)D.x=o[U+0],D.y=o[U+1],D.z=o[U+2],D.normalize().multiplyScalar(w),o[U+0]=D.x,o[U+1]=D.y,o[U+2]=D.z}function _(){const w=new Q;for(let D=0;D<o.length;D+=3){w.x=o[D+0],w.y=o[D+1],w.z=o[D+2];const U=T(w)/2/Math.PI+.5,F=M(w)/Math.PI+.5;l.push(U,1-F)}b(),v()}function v(){for(let w=0;w<l.length;w+=6){const D=l[w+0],U=l[w+2],F=l[w+4],O=Math.max(D,U,F),z=Math.min(D,U,F);O>.9&&z<.1&&(D<.2&&(l[w+0]+=1),U<.2&&(l[w+2]+=1),F<.2&&(l[w+4]+=1))}}function y(w){o.push(w.x,w.y,w.z)}function x(w,D){const U=w*3;D.x=e[U+0],D.y=e[U+1],D.z=e[U+2]}function b(){const w=new Q,D=new Q,U=new Q,F=new Q,O=new et,z=new et,k=new et;for(let N=0,I=0;N<o.length;N+=9,I+=6){w.set(o[N+0],o[N+1],o[N+2]),D.set(o[N+3],o[N+4],o[N+5]),U.set(o[N+6],o[N+7],o[N+8]),O.set(l[I+0],l[I+1]),z.set(l[I+2],l[I+3]),k.set(l[I+4],l[I+5]),F.copy(w).add(D).add(U).divideScalar(3);const W=T(F);R(O,I+0,w,W),R(z,I+2,D,W),R(k,I+4,U,W)}}function R(w,D,U,F){F<0&&w.x===1&&(l[D]=w.x-1),U.x===0&&U.z===0&&(l[D]=F/2/Math.PI+.5)}function T(w){return Math.atan2(w.z,-w.x)}function M(w){return Math.atan2(-w.y,Math.sqrt(w.x*w.x+w.z*w.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sc(e.vertices,e.indices,e.radius,e.detail)}}class _v extends Sc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],l=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(o,l,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new _v(e.radius,e.detail)}}const yv=new Q,xv=new Q,Xx=new Q,Av=new Fs;class c1 extends on{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),o=Math.cos(Tu*t),l=e.getIndex(),h=e.getAttribute("position"),d=l?l.count:h.count,p=[0,0,0],_=["a","b","c"],v=new Array(3),y={},x=[];for(let b=0;b<d;b+=3){l?(p[0]=l.getX(b),p[1]=l.getX(b+1),p[2]=l.getX(b+2)):(p[0]=b,p[1]=b+1,p[2]=b+2);const{a:R,b:T,c:M}=Av;if(R.fromBufferAttribute(h,p[0]),T.fromBufferAttribute(h,p[1]),M.fromBufferAttribute(h,p[2]),Av.getNormal(Xx),v[0]=`${Math.round(R.x*i)},${Math.round(R.y*i)},${Math.round(R.z*i)}`,v[1]=`${Math.round(T.x*i)},${Math.round(T.y*i)},${Math.round(T.z*i)}`,v[2]=`${Math.round(M.x*i)},${Math.round(M.y*i)},${Math.round(M.z*i)}`,!(v[0]===v[1]||v[1]===v[2]||v[2]===v[0]))for(let w=0;w<3;w++){const D=(w+1)%3,U=v[w],F=v[D],O=Av[_[w]],z=Av[_[D]],k=`${U}_${F}`,N=`${F}_${U}`;N in y&&y[N]?(Xx.dot(y[N].normal)<=o&&(x.push(O.x,O.y,O.z),x.push(z.x,z.y,z.z)),y[N]=null):k in y||(y[k]={index0:p[w],index1:p[D],normal:Xx.clone()})}}for(const b in y)if(y[b]){const{index0:R,index1:T}=y[b];yv.fromBufferAttribute(h,R),xv.fromBufferAttribute(h,T),x.push(yv.x,yv.y,yv.z),x.push(xv.x,xv.y,xv.z)}this.setAttribute("position",new Pt(x,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class jr{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Et("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),o=0;t.push(0);for(let l=1;l<=e;l++)n=this.getPoint(l/e),o+=n.distanceTo(i),t.push(o),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const o=n.length;let l;t?l=t:l=e*n[o-1];let h=0,d=o-1,p;for(;h<=d;)if(i=Math.floor(h+(d-h)/2),p=n[i]-l,p<0)h=i+1;else if(p>0)d=i-1;else{d=i;break}if(i=d,n[i]===l)return i/(o-1);const _=n[i],y=n[i+1]-_,x=(l-_)/y;return(i+x)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),h=this.getPoint(o),d=t||(l.isVector2?new et:new Q);return d.copy(h).sub(l).normalize(),d}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new Q,i=[],o=[],l=[],h=new Q,d=new Qt;for(let x=0;x<=e;x++){const b=x/e;i[x]=this.getTangentAt(b,new Q)}o[0]=new Q,l[0]=new Q;let p=Number.MAX_VALUE;const _=Math.abs(i[0].x),v=Math.abs(i[0].y),y=Math.abs(i[0].z);_<=p&&(p=_,n.set(1,0,0)),v<=p&&(p=v,n.set(0,1,0)),y<=p&&n.set(0,0,1),h.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],h),l[0].crossVectors(i[0],o[0]);for(let x=1;x<=e;x++){if(o[x]=o[x-1].clone(),l[x]=l[x-1].clone(),h.crossVectors(i[x-1],i[x]),h.length()>Number.EPSILON){h.normalize();const b=Math.acos(rn(i[x-1].dot(i[x]),-1,1));o[x].applyMatrix4(d.makeRotationAxis(h,b))}l[x].crossVectors(i[x],o[x])}if(t===!0){let x=Math.acos(rn(o[0].dot(o[e]),-1,1));x/=e,i[0].dot(h.crossVectors(o[0],o[e]))>0&&(x=-x);for(let b=1;b<=e;b++)o[b].applyMatrix4(d.makeRotationAxis(i[b],x*b)),l[b].crossVectors(i[b],o[b])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Sv extends jr{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,h=!1,d=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=h,this.aRotation=d}getPoint(e,t=new et){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=i;for(;o>i;)o-=i;o<Number.EPSILON&&(l?o=0:o=i),this.aClockwise===!0&&!l&&(o===i?o=-i:o=o-i);const h=this.aStartAngle+e*o;let d=this.aX+this.xRadius*Math.cos(h),p=this.aY+this.yRadius*Math.sin(h);if(this.aRotation!==0){const _=Math.cos(this.aRotation),v=Math.sin(this.aRotation),y=d-this.aX,x=p-this.aY;d=y*_-x*v+this.aX,p=y*v+x*_+this.aY}return n.set(d,p)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class u1 extends Sv{constructor(e,t,n,i,o,l){super(e,t,n,n,i,o,l),this.isArcCurve=!0,this.type="ArcCurve"}}function Yx(){let s=0,e=0,t=0,n=0;function i(o,l,h,d){s=o,e=h,t=-3*o+3*l-2*h-d,n=2*o-2*l+h+d}return{initCatmullRom:function(o,l,h,d,p){i(l,h,p*(h-o),p*(d-l))},initNonuniformCatmullRom:function(o,l,h,d,p,_,v){let y=(l-o)/p-(h-o)/(p+_)+(h-l)/_,x=(h-l)/_-(d-l)/(_+v)+(d-h)/v;y*=_,x*=_,i(l,h,y,x)},calc:function(o){const l=o*o,h=l*o;return s+e*o+t*l+n*h}}}const Mv=new Q,Jx=new Yx,qx=new Yx,Kx=new Yx;class f1 extends jr{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Q){const n=t,i=this.points,o=i.length,l=(o-(this.closed?0:1))*e;let h=Math.floor(l),d=l-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/o)+1)*o:d===0&&h===o-1&&(h=o-2,d=1);let p,_;this.closed||h>0?p=i[(h-1)%o]:(Mv.subVectors(i[0],i[1]).add(i[0]),p=Mv);const v=i[h%o],y=i[(h+1)%o];if(this.closed||h+2<o?_=i[(h+2)%o]:(Mv.subVectors(i[o-1],i[o-2]).add(i[o-1]),_=Mv),this.curveType==="centripetal"||this.curveType==="chordal"){const x=this.curveType==="chordal"?.5:.25;let b=Math.pow(p.distanceToSquared(v),x),R=Math.pow(v.distanceToSquared(y),x),T=Math.pow(y.distanceToSquared(_),x);R<1e-4&&(R=1),b<1e-4&&(b=R),T<1e-4&&(T=R),Jx.initNonuniformCatmullRom(p.x,v.x,y.x,_.x,b,R,T),qx.initNonuniformCatmullRom(p.y,v.y,y.y,_.y,b,R,T),Kx.initNonuniformCatmullRom(p.z,v.z,y.z,_.z,b,R,T)}else this.curveType==="catmullrom"&&(Jx.initCatmullRom(p.x,v.x,y.x,_.x,this.tension),qx.initCatmullRom(p.y,v.y,y.y,_.y,this.tension),Kx.initCatmullRom(p.z,v.z,y.z,_.z,this.tension));return n.set(Jx.calc(d),qx.calc(d),Kx.calc(d)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new Q().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function h1(s,e,t,n,i){const o=(n-e)*.5,l=(i-t)*.5,h=s*s,d=s*h;return(2*t-2*n+o+l)*d+(-3*t+3*n-2*o-l)*h+o*s+t}function pw(s,e){const t=1-s;return t*t*e}function mw(s,e){return 2*(1-s)*s*e}function gw(s,e){return s*s*e}function Op(s,e,t,n){return pw(s,e)+mw(s,t)+gw(s,n)}function vw(s,e){const t=1-s;return t*t*t*e}function _w(s,e){const t=1-s;return 3*t*t*s*e}function yw(s,e){return 3*(1-s)*s*s*e}function xw(s,e){return s*s*s*e}function Ip(s,e,t,n,i){return vw(s,e)+_w(s,t)+yw(s,n)+xw(s,i)}class Wx extends jr{constructor(e=new et,t=new et,n=new et,i=new et){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new et){const n=t,i=this.v0,o=this.v1,l=this.v2,h=this.v3;return n.set(Ip(e,i.x,o.x,l.x,h.x),Ip(e,i.y,o.y,l.y,h.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class d1 extends jr{constructor(e=new Q,t=new Q,n=new Q,i=new Q){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Q){const n=t,i=this.v0,o=this.v1,l=this.v2,h=this.v3;return n.set(Ip(e,i.x,o.x,l.x,h.x),Ip(e,i.y,o.y,l.y,h.y),Ip(e,i.z,o.z,l.z,h.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class jx extends jr{constructor(e=new et,t=new et){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new et){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new et){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class p1 extends jr{constructor(e=new Q,t=new Q){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Q){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Q){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Zx extends jr{constructor(e=new et,t=new et,n=new et){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new et){const n=t,i=this.v0,o=this.v1,l=this.v2;return n.set(Op(e,i.x,o.x,l.x),Op(e,i.y,o.y,l.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Qx extends jr{constructor(e=new Q,t=new Q,n=new Q){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Q){const n=t,i=this.v0,o=this.v1,l=this.v2;return n.set(Op(e,i.x,o.x,l.x),Op(e,i.y,o.y,l.y),Op(e,i.z,o.z,l.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class $x extends jr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new et){const n=t,i=this.points,o=(i.length-1)*e,l=Math.floor(o),h=o-l,d=i[l===0?l:l-1],p=i[l],_=i[l>i.length-2?i.length-1:l+1],v=i[l>i.length-3?i.length-1:l+2];return n.set(h1(h,d.x,p.x,_.x,v.x),h1(h,d.y,p.y,_.y,v.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new et().fromArray(i))}return this}}var bv=Object.freeze({__proto__:null,ArcCurve:u1,CatmullRomCurve3:f1,CubicBezierCurve:Wx,CubicBezierCurve3:d1,EllipseCurve:Sv,LineCurve:jx,LineCurve3:p1,QuadraticBezierCurve:Zx,QuadraticBezierCurve3:Qx,SplineCurve:$x});class m1 extends jr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new bv[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let o=0;for(;o<i.length;){if(i[o]>=n){const l=i[o]-n,h=this.curves[o],d=h.getLength(),p=d===0?0:1-l/d;return h.getPointAt(p,t)}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 t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,o=this.curves;i<o.length;i++){const l=o[i],h=l.isEllipseCurve?e*2:l.isLineCurve||l.isLineCurve3?1:l.isSplineCurve?e*l.points.length:e,d=l.getPoints(h);for(let p=0;p<d.length;p++){const _=d[p];n&&n.equals(_)||(t.push(_),n=_)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new bv[i.type]().fromJSON(i))}return this}}class Ev extends m1{constructor(e){super(),this.type="Path",this.currentPoint=new et,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new jx(this.currentPoint.clone(),new et(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const o=new Zx(this.currentPoint.clone(),new et(e,t),new et(n,i));return this.curves.push(o),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,o,l){const h=new Wx(this.currentPoint.clone(),new et(e,t),new et(n,i),new et(o,l));return this.curves.push(h),this.currentPoint.set(o,l),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new $x(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,o,l){const h=this.currentPoint.x,d=this.currentPoint.y;return this.absarc(e+h,t+d,n,i,o,l),this}absarc(e,t,n,i,o,l){return this.absellipse(e,t,n,n,i,o,l),this}ellipse(e,t,n,i,o,l,h,d){const p=this.currentPoint.x,_=this.currentPoint.y;return this.absellipse(e+p,t+_,n,i,o,l,h,d),this}absellipse(e,t,n,i,o,l,h,d){const p=new Sv(e,t,n,i,o,l,h,d);if(this.curves.length>0){const v=p.getPoint(0);v.equals(this.currentPoint)||this.lineTo(v.x,v.y)}this.curves.push(p);const _=p.getPoint(1);return this.currentPoint.copy(_),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 Ou extends Ev{constructor(e){super(e),this.uuid=Qs(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Ev().fromJSON(i))}return this}}function Aw(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let o=g1(s,0,i,t,!0);const l=[];if(!o||o.next===o.prev)return l;let h,d,p;if(n&&(o=Tw(s,e,o,t)),s.length>80*t){h=s[0],d=s[1];let _=h,v=d;for(let y=t;y<i;y+=t){const x=s[y],b=s[y+1];x<h&&(h=x),b<d&&(d=b),x>_&&(_=x),b>v&&(v=b)}p=Math.max(_-h,v-d),p=p!==0?32767/p:0}return Fp(o,l,t,h,d,p,0),l}function g1(s,e,t,n,i){let o;if(i===Fw(s,e,t,n)>0)for(let l=e;l<t;l+=n)o=x1(l/n|0,s[l],s[l+1],o);else for(let l=t-n;l>=e;l-=n)o=x1(l/n|0,s[l],s[l+1],o);return o&&Rh(o,o.next)&&(Gp(o),o=o.next),o}function Iu(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(Rh(t,t.next)||Bi(t.prev,t,t.next)===0)){if(Gp(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Fp(s,e,t,n,i,o,l){if(!s)return;!l&&o&&Dw(s,n,i,o);let h=s;for(;s.prev!==s.next;){const d=s.prev,p=s.next;if(o?Mw(s,n,i,o):Sw(s)){e.push(d.i,s.i,p.i),Gp(s),s=p.next,h=p.next;continue}if(s=p,s===h){l?l===1?(s=bw(Iu(s),e),Fp(s,e,t,n,i,o,2)):l===2&&Ew(s,e,t,n,i,o):Fp(Iu(s),e,t,n,i,o,1);break}}}function Sw(s){const e=s.prev,t=s,n=s.next;if(Bi(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,h=e.y,d=t.y,p=n.y,_=Math.min(i,o,l),v=Math.min(h,d,p),y=Math.max(i,o,l),x=Math.max(h,d,p);let b=n.next;for(;b!==e;){if(b.x>=_&&b.x<=y&&b.y>=v&&b.y<=x&&Hp(i,h,o,d,l,p,b.x,b.y)&&Bi(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function Mw(s,e,t,n){const i=s.prev,o=s,l=s.next;if(Bi(i,o,l)>=0)return!1;const h=i.x,d=o.x,p=l.x,_=i.y,v=o.y,y=l.y,x=Math.min(h,d,p),b=Math.min(_,v,y),R=Math.max(h,d,p),T=Math.max(_,v,y),M=eA(x,b,e,t,n),w=eA(R,T,e,t,n);let D=s.prevZ,U=s.nextZ;for(;D&&D.z>=M&&U&&U.z<=w;){if(D.x>=x&&D.x<=R&&D.y>=b&&D.y<=T&&D!==i&&D!==l&&Hp(h,_,d,v,p,y,D.x,D.y)&&Bi(D.prev,D,D.next)>=0||(D=D.prevZ,U.x>=x&&U.x<=R&&U.y>=b&&U.y<=T&&U!==i&&U!==l&&Hp(h,_,d,v,p,y,U.x,U.y)&&Bi(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;D&&D.z>=M;){if(D.x>=x&&D.x<=R&&D.y>=b&&D.y<=T&&D!==i&&D!==l&&Hp(h,_,d,v,p,y,D.x,D.y)&&Bi(D.prev,D,D.next)>=0)return!1;D=D.prevZ}for(;U&&U.z<=w;){if(U.x>=x&&U.x<=R&&U.y>=b&&U.y<=T&&U!==i&&U!==l&&Hp(h,_,d,v,p,y,U.x,U.y)&&Bi(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function bw(s,e){let t=s;do{const n=t.prev,i=t.next.next;!Rh(n,i)&&_1(n,t,t.next,i)&&Pp(n,i)&&Pp(i,n)&&(e.push(n.i,t.i,i.i),Gp(t),Gp(t.next),t=s=i),t=t.next}while(t!==s);return Iu(t)}function Ew(s,e,t,n,i,o){let l=s;do{let h=l.next.next;for(;h!==l.prev;){if(l.i!==h.i&&Lw(l,h)){let d=y1(l,h);l=Iu(l,l.next),d=Iu(d,d.next),Fp(l,e,t,n,i,o,0),Fp(d,e,t,n,i,o,0);return}h=h.next}l=l.next}while(l!==s)}function Tw(s,e,t,n){const i=[];for(let o=0,l=e.length;o<l;o++){const h=e[o]*n,d=o<l-1?e[o+1]*n:s.length,p=g1(s,h,d,n,!1);p===p.next&&(p.steiner=!0),i.push(Nw(p))}i.sort(Cw);for(let o=0;o<i.length;o++)t=Rw(i[o],t);return t}function Cw(s,e){let t=s.x-e.x;if(t===0&&(t=s.y-e.y,t===0)){const n=(s.next.y-s.y)/(s.next.x-s.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function Rw(s,e){const t=ww(s,e);if(!t)return e;const n=y1(t,s);return Iu(n,n.next),Iu(t,t.next)}function ww(s,e){let t=e;const n=s.x,i=s.y;let o=-1/0,l;if(Rh(s,t))return t;do{if(Rh(s,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const v=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(v<=n&&v>o&&(o=v,l=t.x<t.next.x?t:t.next,v===n))return l}t=t.next}while(t!==e);if(!l)return null;const h=l,d=l.x,p=l.y;let _=1/0;t=l;do{if(n>=t.x&&t.x>=d&&n!==t.x&&v1(i<p?n:o,i,d,p,i<p?o:n,i,t.x,t.y)){const v=Math.abs(i-t.y)/(n-t.x);Pp(t,s)&&(v<_||v===_&&(t.x>l.x||t.x===l.x&&Bw(l,t)))&&(l=t,_=v)}t=t.next}while(t!==h);return l}function Bw(s,e){return Bi(s.prev,s,e.prev)<0&&Bi(e.next,s,s.next)<0}function Dw(s,e,t,n){let i=s;do i.z===0&&(i.z=eA(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,Uw(i)}function Uw(s){let e,t=1;do{let n=s,i;s=null;let o=null;for(e=0;n;){e++;let l=n,h=0;for(let p=0;p<t&&(h++,l=l.nextZ,!!l);p++);let d=t;for(;h>0||d>0&&l;)h!==0&&(d===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,h--):(i=l,l=l.nextZ,d--),o?o.nextZ=i:s=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return s}function eA(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function Nw(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function v1(s,e,t,n,i,o,l,h){return(i-l)*(e-h)>=(s-l)*(o-h)&&(s-l)*(n-h)>=(t-l)*(e-h)&&(t-l)*(o-h)>=(i-l)*(n-h)}function Hp(s,e,t,n,i,o,l,h){return!(s===l&&e===h)&&v1(s,e,t,n,i,o,l,h)}function Lw(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!Ow(s,e)&&(Pp(s,e)&&Pp(e,s)&&Iw(s,e)&&(Bi(s.prev,s,e.prev)||Bi(s,e.prev,e))||Rh(s,e)&&Bi(s.prev,s,s.next)>0&&Bi(e.prev,e,e.next)>0)}function Bi(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function Rh(s,e){return s.x===e.x&&s.y===e.y}function _1(s,e,t,n){const i=Cv(Bi(s,e,t)),o=Cv(Bi(s,e,n)),l=Cv(Bi(t,n,s)),h=Cv(Bi(t,n,e));return!!(i!==o&&l!==h||i===0&&Tv(s,t,e)||o===0&&Tv(s,n,e)||l===0&&Tv(t,s,n)||h===0&&Tv(t,e,n))}function Tv(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Cv(s){return s>0?1:s<0?-1:0}function Ow(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&_1(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Pp(s,e){return Bi(s.prev,s,s.next)<0?Bi(s,e,s.next)>=0&&Bi(s,s.prev,e)>=0:Bi(s,e,s.prev)<0||Bi(s,s.next,e)<0}function Iw(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,o=(s.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function y1(s,e){const t=tA(s.i,s.x,s.y),n=tA(e.i,e.x,e.y),i=s.next,o=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function x1(s,e,t,n){const i=tA(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Gp(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function tA(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Fw(s,e,t,n){let i=0;for(let o=e,l=t-n;o<t;o+=n)i+=(s[l]-s[o])*(s[o+1]+s[l+1]),l=o;return i}class Hw{static triangulate(e,t,n=2){return Aw(e,t,n)}}class Zr{static area(e){const t=e.length;let n=0;for(let i=t-1,o=0;o<t;i=o++)n+=e[i].x*e[o].y-e[o].x*e[i].y;return n*.5}static isClockWise(e){return Zr.area(e)<0}static triangulateShape(e,t){const n=[],i=[],o=[];A1(e),S1(n,e);let l=e.length;t.forEach(A1);for(let d=0;d<t.length;d++)i.push(l),l+=t[d].length,S1(n,t[d]);const h=Hw.triangulate(n,i);for(let d=0;d<h.length;d+=3)o.push(h.slice(d,d+3));return o}}function A1(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function S1(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class Rv extends on{constructor(e=new Ou([new et(.5,.5),new et(-.5,.5),new et(-.5,-.5),new et(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],o=[];for(let h=0,d=e.length;h<d;h++){const p=e[h];l(p)}this.setAttribute("position",new Pt(i,3)),this.setAttribute("uv",new Pt(o,2)),this.computeVertexNormals();function l(h){const d=[],p=t.curveSegments!==void 0?t.curveSegments:12,_=t.steps!==void 0?t.steps:1,v=t.depth!==void 0?t.depth:1;let y=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,b=t.bevelSize!==void 0?t.bevelSize:x-.1,R=t.bevelOffset!==void 0?t.bevelOffset:0,T=t.bevelSegments!==void 0?t.bevelSegments:3;const M=t.extrudePath,w=t.UVGenerator!==void 0?t.UVGenerator:Pw;let D,U=!1,F,O,z,k;if(M){D=M.getSpacedPoints(_),U=!0,y=!1;const Ve=M.isCatmullRomCurve3?M.closed:!1;F=M.computeFrenetFrames(_,Ve),O=new Q,z=new Q,k=new Q}y||(T=0,x=0,b=0,R=0);const N=h.extractPoints(p);let I=N.shape;const W=N.holes;if(!Zr.isClockWise(I)){I=I.reverse();for(let Ve=0,nt=W.length;Ve<nt;Ve++){const Ge=W[Ve];Zr.isClockWise(Ge)&&(W[Ve]=Ge.reverse())}}function ie(Ve){const Ge=10000000000000001e-36;let ft=Ve[0];for(let ee=1;ee<=Ve.length;ee++){const Nt=ee%Ve.length,pt=Ve[Nt],Lt=pt.x-ft.x,gt=pt.y-ft.y,Z=Lt*Lt+gt*gt,P=Math.max(Math.abs(pt.x),Math.abs(pt.y),Math.abs(ft.x),Math.abs(ft.y)),me=Ge*P*P;if(Z<=me){Ve.splice(Nt,1),ee--;continue}ft=pt}}ie(I),W.forEach(ie);const se=W.length,_e=I;for(let Ve=0;Ve<se;Ve++){const nt=W[Ve];I=I.concat(nt)}function H(Ve,nt,Ge){return nt||Wt("ExtrudeGeometry: vec does not exist"),Ve.clone().addScaledVector(nt,Ge)}const K=I.length;function $(Ve,nt,Ge){let ft,ee,Nt;const pt=Ve.x-nt.x,Lt=Ve.y-nt.y,gt=Ge.x-Ve.x,Z=Ge.y-Ve.y,P=pt*pt+Lt*Lt,me=pt*Z-Lt*gt;if(Math.abs(me)>Number.EPSILON){const Le=Math.sqrt(P),Xe=Math.sqrt(gt*gt+Z*Z),Fe=nt.x-Lt/Le,Bt=nt.y+pt/Le,_t=Ge.x-Z/Xe,Ot=Ge.y+gt/Xe,kt=((_t-Fe)*Z-(Ot-Bt)*gt)/(pt*Z-Lt*gt);ft=Fe+pt*kt-Ve.x,ee=Bt+Lt*kt-Ve.y;const Ke=ft*ft+ee*ee;if(Ke<=2)return new et(ft,ee);Nt=Math.sqrt(Ke/2)}else{let Le=!1;pt>Number.EPSILON?gt>Number.EPSILON&&(Le=!0):pt<-Number.EPSILON?gt<-Number.EPSILON&&(Le=!0):Math.sign(Lt)===Math.sign(Z)&&(Le=!0),Le?(ft=-Lt,ee=pt,Nt=Math.sqrt(P)):(ft=pt,ee=Lt,Nt=Math.sqrt(P/2))}return new et(ft/Nt,ee/Nt)}const ue=[];for(let Ve=0,nt=_e.length,Ge=nt-1,ft=Ve+1;Ve<nt;Ve++,Ge++,ft++)Ge===nt&&(Ge=0),ft===nt&&(ft=0),ue[Ve]=$(_e[Ve],_e[Ge],_e[ft]);const re=[];let X,ne=ue.concat();for(let Ve=0,nt=se;Ve<nt;Ve++){const Ge=W[Ve];X=[];for(let ft=0,ee=Ge.length,Nt=ee-1,pt=ft+1;ft<ee;ft++,Nt++,pt++)Nt===ee&&(Nt=0),pt===ee&&(pt=0),X[ft]=$(Ge[ft],Ge[Nt],Ge[pt]);re.push(X),ne=ne.concat(X)}let Ae;if(T===0)Ae=Zr.triangulateShape(_e,W);else{const Ve=[],nt=[];for(let Ge=0;Ge<T;Ge++){const ft=Ge/T,ee=x*Math.cos(ft*Math.PI/2),Nt=b*Math.sin(ft*Math.PI/2)+R;for(let pt=0,Lt=_e.length;pt<Lt;pt++){const gt=H(_e[pt],ue[pt],Nt);xt(gt.x,gt.y,-ee),ft===0&&Ve.push(gt)}for(let pt=0,Lt=se;pt<Lt;pt++){const gt=W[pt];X=re[pt];const Z=[];for(let P=0,me=gt.length;P<me;P++){const Le=H(gt[P],X[P],Nt);xt(Le.x,Le.y,-ee),ft===0&&Z.push(Le)}ft===0&&nt.push(Z)}}Ae=Zr.triangulateShape(Ve,nt)}const Re=Ae.length,rt=b+R;for(let Ve=0;Ve<K;Ve++){const nt=y?H(I[Ve],ne[Ve],rt):I[Ve];U?(z.copy(F.normals[0]).multiplyScalar(nt.x),O.copy(F.binormals[0]).multiplyScalar(nt.y),k.copy(D[0]).add(z).add(O),xt(k.x,k.y,k.z)):xt(nt.x,nt.y,0)}for(let Ve=1;Ve<=_;Ve++)for(let nt=0;nt<K;nt++){const Ge=y?H(I[nt],ne[nt],rt):I[nt];U?(z.copy(F.normals[Ve]).multiplyScalar(Ge.x),O.copy(F.binormals[Ve]).multiplyScalar(Ge.y),k.copy(D[Ve]).add(z).add(O),xt(k.x,k.y,k.z)):xt(Ge.x,Ge.y,v/_*Ve)}for(let Ve=T-1;Ve>=0;Ve--){const nt=Ve/T,Ge=x*Math.cos(nt*Math.PI/2),ft=b*Math.sin(nt*Math.PI/2)+R;for(let ee=0,Nt=_e.length;ee<Nt;ee++){const pt=H(_e[ee],ue[ee],ft);xt(pt.x,pt.y,v+Ge)}for(let ee=0,Nt=W.length;ee<Nt;ee++){const pt=W[ee];X=re[ee];for(let Lt=0,gt=pt.length;Lt<gt;Lt++){const Z=H(pt[Lt],X[Lt],ft);U?xt(Z.x,Z.y+D[_-1].y,D[_-1].x+Ge):xt(Z.x,Z.y,v+Ge)}}}ve(),Be();function ve(){const Ve=i.length/3;if(y){let nt=0,Ge=K*nt;for(let ft=0;ft<Re;ft++){const ee=Ae[ft];Mt(ee[2]+Ge,ee[1]+Ge,ee[0]+Ge)}nt=_+T*2,Ge=K*nt;for(let ft=0;ft<Re;ft++){const ee=Ae[ft];Mt(ee[0]+Ge,ee[1]+Ge,ee[2]+Ge)}}else{for(let nt=0;nt<Re;nt++){const Ge=Ae[nt];Mt(Ge[2],Ge[1],Ge[0])}for(let nt=0;nt<Re;nt++){const Ge=Ae[nt];Mt(Ge[0]+K*_,Ge[1]+K*_,Ge[2]+K*_)}}n.addGroup(Ve,i.length/3-Ve,0)}function Be(){const Ve=i.length/3;let nt=0;st(_e,nt),nt+=_e.length;for(let Ge=0,ft=W.length;Ge<ft;Ge++){const ee=W[Ge];st(ee,nt),nt+=ee.length}n.addGroup(Ve,i.length/3-Ve,1)}function st(Ve,nt){let Ge=Ve.length;for(;--Ge>=0;){const ft=Ge;let ee=Ge-1;ee<0&&(ee=Ve.length-1);for(let Nt=0,pt=_+T*2;Nt<pt;Nt++){const Lt=K*Nt,gt=K*(Nt+1),Z=nt+ft+Lt,P=nt+ee+Lt,me=nt+ee+gt,Le=nt+ft+gt;$t(Z,P,me,Le)}}}function xt(Ve,nt,Ge){d.push(Ve),d.push(nt),d.push(Ge)}function Mt(Ve,nt,Ge){un(Ve),un(nt),un(Ge);const ft=i.length/3,ee=w.generateTopUV(n,i,ft-3,ft-2,ft-1);Vt(ee[0]),Vt(ee[1]),Vt(ee[2])}function $t(Ve,nt,Ge,ft){un(Ve),un(nt),un(ft),un(nt),un(Ge),un(ft);const ee=i.length/3,Nt=w.generateSideWallUV(n,i,ee-6,ee-3,ee-2,ee-1);Vt(Nt[0]),Vt(Nt[1]),Vt(Nt[3]),Vt(Nt[1]),Vt(Nt[2]),Vt(Nt[3])}function un(Ve){i.push(d[Ve*3+0]),i.push(d[Ve*3+1]),i.push(d[Ve*3+2])}function Vt(Ve){o.push(Ve.x),o.push(Ve.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Gw(t,n,e)}static fromJSON(e,t){const n=[];for(let o=0,l=e.shapes.length;o<l;o++){const h=t[e.shapes[o]];n.push(h)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new bv[i.type]().fromJSON(i)),new Rv(n,e.options)}}const Pw={generateTopUV:function(s,e,t,n,i){const o=e[t*3],l=e[t*3+1],h=e[n*3],d=e[n*3+1],p=e[i*3],_=e[i*3+1];return[new et(o,l),new et(h,d),new et(p,_)]},generateSideWallUV:function(s,e,t,n,i,o){const l=e[t*3],h=e[t*3+1],d=e[t*3+2],p=e[n*3],_=e[n*3+1],v=e[n*3+2],y=e[i*3],x=e[i*3+1],b=e[i*3+2],R=e[o*3],T=e[o*3+1],M=e[o*3+2];return Math.abs(h-_)<Math.abs(l-p)?[new et(l,1-d),new et(p,1-v),new et(y,1-b),new et(R,1-M)]:[new et(h,1-d),new et(_,1-v),new et(x,1-b),new et(T,1-M)]}};function Gw(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const o=s[n];t.shapes.push(o.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class zp extends Sc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new zp(e.radius,e.detail)}}class wv extends on{constructor(e=[new et(0,-.5),new et(.5,0),new et(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=rn(i,0,Math.PI*2);const o=[],l=[],h=[],d=[],p=[],_=1/t,v=new Q,y=new et,x=new Q,b=new Q,R=new Q;let T=0,M=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:T=e[w+1].x-e[w].x,M=e[w+1].y-e[w].y,x.x=M*1,x.y=-T,x.z=M*0,R.copy(x),x.normalize(),d.push(x.x,x.y,x.z);break;case e.length-1:d.push(R.x,R.y,R.z);break;default:T=e[w+1].x-e[w].x,M=e[w+1].y-e[w].y,x.x=M*1,x.y=-T,x.z=M*0,b.copy(x),x.x+=R.x,x.y+=R.y,x.z+=R.z,x.normalize(),d.push(x.x,x.y,x.z),R.copy(b)}for(let w=0;w<=t;w++){const D=n+w*_*i,U=Math.sin(D),F=Math.cos(D);for(let O=0;O<=e.length-1;O++){v.x=e[O].x*U,v.y=e[O].y,v.z=e[O].x*F,l.push(v.x,v.y,v.z),y.x=w/t,y.y=O/(e.length-1),h.push(y.x,y.y);const z=d[3*O+0]*U,k=d[3*O+1],N=d[3*O+0]*F;p.push(z,k,N)}}for(let w=0;w<t;w++)for(let D=0;D<e.length-1;D++){const U=D+w*e.length,F=U,O=U+e.length,z=U+e.length+1,k=U+1;o.push(F,O,k),o.push(z,k,O)}this.setIndex(o),this.setAttribute("position",new Pt(l,3)),this.setAttribute("uv",new Pt(h,2)),this.setAttribute("normal",new Pt(p,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wv(e.points,e.segments,e.phiStart,e.phiLength)}}class Vp extends Sc{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Vp(e.radius,e.detail)}}class Mc extends on{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const o=e/2,l=t/2,h=Math.floor(n),d=Math.floor(i),p=h+1,_=d+1,v=e/h,y=t/d,x=[],b=[],R=[],T=[];for(let M=0;M<_;M++){const w=M*y-l;for(let D=0;D<p;D++){const U=D*v-o;b.push(U,-w,0),R.push(0,0,1),T.push(D/h),T.push(1-M/d)}}for(let M=0;M<d;M++)for(let w=0;w<h;w++){const D=w+p*M,U=w+p*(M+1),F=w+1+p*(M+1),O=w+1+p*M;x.push(D,U,O),x.push(U,F,O)}this.setIndex(x),this.setAttribute("position",new Pt(b,3)),this.setAttribute("normal",new Pt(R,3)),this.setAttribute("uv",new Pt(T,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mc(e.width,e.height,e.widthSegments,e.heightSegments)}}class Bv extends on{constructor(e=.5,t=1,n=32,i=1,o=0,l=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:l},n=Math.max(3,n),i=Math.max(1,i);const h=[],d=[],p=[],_=[];let v=e;const y=(t-e)/i,x=new Q,b=new et;for(let R=0;R<=i;R++){for(let T=0;T<=n;T++){const M=o+T/n*l;x.x=v*Math.cos(M),x.y=v*Math.sin(M),d.push(x.x,x.y,x.z),p.push(0,0,1),b.x=(x.x/t+1)/2,b.y=(x.y/t+1)/2,_.push(b.x,b.y)}v+=y}for(let R=0;R<i;R++){const T=R*(n+1);for(let M=0;M<n;M++){const w=M+T,D=w,U=w+n+1,F=w+n+2,O=w+1;h.push(D,U,O),h.push(U,F,O)}}this.setIndex(h),this.setAttribute("position",new Pt(d,3)),this.setAttribute("normal",new Pt(p,3)),this.setAttribute("uv",new Pt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bv(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Dv extends on{constructor(e=new Ou([new et(0,.5),new et(-.5,-.5),new et(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],o=[],l=[];let h=0,d=0;if(Array.isArray(e)===!1)p(e);else for(let _=0;_<e.length;_++)p(e[_]),this.addGroup(h,d,_),h+=d,d=0;this.setIndex(n),this.setAttribute("position",new Pt(i,3)),this.setAttribute("normal",new Pt(o,3)),this.setAttribute("uv",new Pt(l,2));function p(_){const v=i.length/3,y=_.extractPoints(t);let x=y.shape;const b=y.holes;Zr.isClockWise(x)===!1&&(x=x.reverse());for(let T=0,M=b.length;T<M;T++){const w=b[T];Zr.isClockWise(w)===!0&&(b[T]=w.reverse())}const R=Zr.triangulateShape(x,b);for(let T=0,M=b.length;T<M;T++){const w=b[T];x=x.concat(w)}for(let T=0,M=x.length;T<M;T++){const w=x[T];i.push(w.x,w.y,0),o.push(0,0,1),l.push(w.x,w.y)}for(let T=0,M=R.length;T<M;T++){const w=R[T],D=w[0]+v,U=w[1]+v,F=w[2]+v;n.push(D,U,F),d+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return zw(t,e)}static fromJSON(e,t){const n=[];for(let i=0,o=e.shapes.length;i<o;i++){const l=t[e.shapes[i]];n.push(l)}return new Dv(n,e.curveSegments)}}function zw(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class kp extends on{constructor(e=1,t=32,n=16,i=0,o=Math.PI*2,l=0,h=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:o,thetaStart:l,thetaLength:h},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const d=Math.min(l+h,Math.PI);let p=0;const _=[],v=new Q,y=new Q,x=[],b=[],R=[],T=[];for(let M=0;M<=n;M++){const w=[],D=M/n;let U=0;M===0&&l===0?U=.5/t:M===n&&d===Math.PI&&(U=-.5/t);for(let F=0;F<=t;F++){const O=F/t;v.x=-e*Math.cos(i+O*o)*Math.sin(l+D*h),v.y=e*Math.cos(l+D*h),v.z=e*Math.sin(i+O*o)*Math.sin(l+D*h),b.push(v.x,v.y,v.z),y.copy(v).normalize(),R.push(y.x,y.y,y.z),T.push(O+U,1-D),w.push(p++)}_.push(w)}for(let M=0;M<n;M++)for(let w=0;w<t;w++){const D=_[M][w+1],U=_[M][w],F=_[M+1][w],O=_[M+1][w+1];(M!==0||l>0)&&x.push(D,U,O),(M!==n-1||d<Math.PI)&&x.push(U,F,O)}this.setIndex(x),this.setAttribute("position",new Pt(b,3)),this.setAttribute("normal",new Pt(R,3)),this.setAttribute("uv",new Pt(T,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kp(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Uv extends Sc{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Uv(e.radius,e.detail)}}class Nv extends on{constructor(e=1,t=.4,n=12,i=48,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:o},n=Math.floor(n),i=Math.floor(i);const l=[],h=[],d=[],p=[],_=new Q,v=new Q,y=new Q;for(let x=0;x<=n;x++)for(let b=0;b<=i;b++){const R=b/i*o,T=x/n*Math.PI*2;v.x=(e+t*Math.cos(T))*Math.cos(R),v.y=(e+t*Math.cos(T))*Math.sin(R),v.z=t*Math.sin(T),h.push(v.x,v.y,v.z),_.x=e*Math.cos(R),_.y=e*Math.sin(R),y.subVectors(v,_).normalize(),d.push(y.x,y.y,y.z),p.push(b/i),p.push(x/n)}for(let x=1;x<=n;x++)for(let b=1;b<=i;b++){const R=(i+1)*x+b-1,T=(i+1)*(x-1)+b-1,M=(i+1)*(x-1)+b,w=(i+1)*x+b;l.push(R,T,w),l.push(T,M,w)}this.setIndex(l),this.setAttribute("position",new Pt(h,3)),this.setAttribute("normal",new Pt(d,3)),this.setAttribute("uv",new Pt(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Nv(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Lv extends on{constructor(e=1,t=.4,n=64,i=8,o=2,l=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:o,q:l},n=Math.floor(n),i=Math.floor(i);const h=[],d=[],p=[],_=[],v=new Q,y=new Q,x=new Q,b=new Q,R=new Q,T=new Q,M=new Q;for(let D=0;D<=n;++D){const U=D/n*o*Math.PI*2;w(U,o,l,e,x),w(U+.01,o,l,e,b),T.subVectors(b,x),M.addVectors(b,x),R.crossVectors(T,M),M.crossVectors(R,T),R.normalize(),M.normalize();for(let F=0;F<=i;++F){const O=F/i*Math.PI*2,z=-t*Math.cos(O),k=t*Math.sin(O);v.x=x.x+(z*M.x+k*R.x),v.y=x.y+(z*M.y+k*R.y),v.z=x.z+(z*M.z+k*R.z),d.push(v.x,v.y,v.z),y.subVectors(v,x).normalize(),p.push(y.x,y.y,y.z),_.push(D/n),_.push(F/i)}}for(let D=1;D<=n;D++)for(let U=1;U<=i;U++){const F=(i+1)*(D-1)+(U-1),O=(i+1)*D+(U-1),z=(i+1)*D+U,k=(i+1)*(D-1)+U;h.push(F,O,k),h.push(O,z,k)}this.setIndex(h),this.setAttribute("position",new Pt(d,3)),this.setAttribute("normal",new Pt(p,3)),this.setAttribute("uv",new Pt(_,2));function w(D,U,F,O,z){const k=Math.cos(D),N=Math.sin(D),I=F/U*D,W=Math.cos(I);z.x=O*(2+W)*.5*k,z.y=O*(2+W)*N*.5,z.z=O*Math.sin(I)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Lv(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Ov extends on{constructor(e=new Qx(new Q(-1,-1,0),new Q(-1,1,0),new Q(1,1,0)),t=64,n=1,i=8,o=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:o};const l=e.computeFrenetFrames(t,o);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;const h=new Q,d=new Q,p=new et;let _=new Q;const v=[],y=[],x=[],b=[];R(),this.setIndex(b),this.setAttribute("position",new Pt(v,3)),this.setAttribute("normal",new Pt(y,3)),this.setAttribute("uv",new Pt(x,2));function R(){for(let D=0;D<t;D++)T(D);T(o===!1?t:0),w(),M()}function T(D){_=e.getPointAt(D/t,_);const U=l.normals[D],F=l.binormals[D];for(let O=0;O<=i;O++){const z=O/i*Math.PI*2,k=Math.sin(z),N=-Math.cos(z);d.x=N*U.x+k*F.x,d.y=N*U.y+k*F.y,d.z=N*U.z+k*F.z,d.normalize(),y.push(d.x,d.y,d.z),h.x=_.x+n*d.x,h.y=_.y+n*d.y,h.z=_.z+n*d.z,v.push(h.x,h.y,h.z)}}function M(){for(let D=1;D<=t;D++)for(let U=1;U<=i;U++){const F=(i+1)*(D-1)+(U-1),O=(i+1)*D+(U-1),z=(i+1)*D+U,k=(i+1)*(D-1)+U;b.push(F,O,k),b.push(O,z,k)}}function w(){for(let D=0;D<=t;D++)for(let U=0;U<=i;U++)p.x=D/t,p.y=U/i,x.push(p.x,p.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Ov(new bv[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class M1 extends on{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new Q,o=new Q;if(e.index!==null){const l=e.attributes.position,h=e.index;let d=e.groups;d.length===0&&(d=[{start:0,count:h.count,materialIndex:0}]);for(let p=0,_=d.length;p<_;++p){const v=d[p],y=v.start,x=v.count;for(let b=y,R=y+x;b<R;b+=3)for(let T=0;T<3;T++){const M=h.getX(b+T),w=h.getX(b+(T+1)%3);i.fromBufferAttribute(l,M),o.fromBufferAttribute(l,w),b1(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}}else{const l=e.attributes.position;for(let h=0,d=l.count/3;h<d;h++)for(let p=0;p<3;p++){const _=3*h+p,v=3*h+(p+1)%3;i.fromBufferAttribute(l,_),o.fromBufferAttribute(l,v),b1(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}this.setAttribute("position",new Pt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function b1(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var E1=Object.freeze({__proto__:null,BoxGeometry:Du,CapsuleGeometry:gv,CircleGeometry:vv,ConeGeometry:Lp,CylinderGeometry:Np,DodecahedronGeometry:_v,EdgesGeometry:c1,ExtrudeGeometry:Rv,IcosahedronGeometry:zp,LatheGeometry:wv,OctahedronGeometry:Vp,PlaneGeometry:Mc,PolyhedronGeometry:Sc,RingGeometry:Bv,ShapeGeometry:Dv,SphereGeometry:kp,TetrahedronGeometry:Uv,TorusGeometry:Nv,TorusKnotGeometry:Lv,TubeGeometry:Ov,WireframeGeometry:M1});class T1 extends Gi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new At(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class nA extends ms{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Fu extends Gi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new At(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class zi extends Fu{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new et(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return rn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new At(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new At(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new At(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class C1 extends Gi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new At(16777215),this.specular=new At(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=$d,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.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class R1 extends Gi{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new At(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(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 w1 extends Gi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(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 B1 extends Gi{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new At(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new At(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=$d,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.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class iA extends Gi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ab,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 aA extends Gi{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}}class D1 extends Gi{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new At(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fc,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class U1 extends Pa{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 Hu(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function N1(s){function e(i,o){return s[i]-s[o]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function sA(s,e,t){const n=s.length,i=new s.constructor(n);for(let o=0,l=0;l!==n;++o){const h=t[o]*e;for(let d=0;d!==e;++d)i[l++]=s[h+d]}return i}function rA(s,e,t,n){let i=1,o=s[0];for(;o!==void 0&&o[n]===void 0;)o=s[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=s[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=s[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=s[i++];while(o!==void 0)}function Vw(s,e,t,n,i=30){const o=s.clone();o.name=e;const l=[];for(let d=0;d<o.tracks.length;++d){const p=o.tracks[d],_=p.getValueSize(),v=[],y=[];for(let x=0;x<p.times.length;++x){const b=p.times[x]*i;if(!(b<t||b>=n)){v.push(p.times[x]);for(let R=0;R<_;++R)y.push(p.values[x*_+R])}}v.length!==0&&(p.times=Hu(v,p.times.constructor),p.values=Hu(y,p.values.constructor),l.push(p))}o.tracks=l;let h=1/0;for(let d=0;d<o.tracks.length;++d)h>o.tracks[d].times[0]&&(h=o.tracks[d].times[0]);for(let d=0;d<o.tracks.length;++d)o.tracks[d].shift(-1*h);return o.resetDuration(),o}function kw(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,o=e/n;for(let l=0;l<i;++l){const h=t.tracks[l],d=h.ValueTypeName;if(d==="bool"||d==="string")continue;const p=s.tracks.find(function(M){return M.name===h.name&&M.ValueTypeName===d});if(p===void 0)continue;let _=0;const v=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(_=v/3);let y=0;const x=p.getValueSize();p.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(y=x/3);const b=h.times.length-1;let R;if(o<=h.times[0]){const M=_,w=v-_;R=h.values.slice(M,w)}else if(o>=h.times[b]){const M=b*v+_,w=M+v-_;R=h.values.slice(M,w)}else{const M=h.createInterpolant(),w=_,D=v-_;M.evaluate(o),R=M.resultBuffer.slice(w,D)}d==="quaternion"&&new ba().fromArray(R).normalize().conjugate().toArray(R);const T=p.times.length;for(let M=0;M<T;++M){const w=M*x+y;if(d==="quaternion")ba.multiplyQuaternionsFlat(p.values,w,R,0,p.values,w);else{const D=x-y*2;for(let U=0;U<D;++U)p.values[w+U]-=R[U]}}}return s.blendMode=rx,s}class Xw{static convertArray(e,t){return Hu(e,t)}static isTypedArray(e){return db(e)}static getKeyframeOrder(e){return N1(e)}static sortedArray(e,t,n){return sA(e,t,n)}static flattenJSON(e,t,n,i){rA(e,t,n,i)}static subclip(e,t,n,i,o=30){return Vw(e,t,n,i,o)}static makeClipAdditive(e,t=0,n=e,i=30){return kw(e,t,n,i)}}class Pu{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],o=t[n-1];e:{t:{let l;n:{i:if(!(e<i)){for(let h=n+2;;){if(i===void 0){if(e<o)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===h)break;if(o=i,i=t[++n],e<i)break t}l=t.length;break n}if(!(e>=o)){const h=t[1];e<h&&(n=2,o=h);for(let d=n-2;;){if(o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===d)break;if(i=o,o=t[--n-1],e>=o)break t}l=n,n=0;break n}break e}for(;n<l;){const h=n+l>>>1;e<t[h]?l=h:n=h+1}if(i=t[n],o=t[n-1],o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,o,i)}return this.interpolate_(n,o,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i;for(let l=0;l!==i;++l)t[l]=n[o+l];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class L1 extends Pu{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Su,endingEnd:Su}}intervalChanged_(e,t,n){const i=this.parameterPositions;let o=e-2,l=e+1,h=i[o],d=i[l];if(h===void 0)switch(this.getSettings_().endingStart){case Mu:o=e,h=2*t-n;break;case up:o=i.length-2,h=t+i[o]-i[o+1];break;default:o=e,h=n}if(d===void 0)switch(this.getSettings_().endingEnd){case Mu:l=e,d=2*n-t;break;case up:l=1,d=n+i[1]-i[0];break;default:l=e-1,d=t}const p=(n-t)*.5,_=this.valueSize;this._weightPrev=p/(t-h),this._weightNext=p/(d-n),this._offsetPrev=o*_,this._offsetNext=l*_}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=e*h,p=d-h,_=this._offsetPrev,v=this._offsetNext,y=this._weightPrev,x=this._weightNext,b=(n-t)/(i-t),R=b*b,T=R*b,M=-y*T+2*y*R-y*b,w=(1+y)*T+(-1.5-2*y)*R+(-.5+y)*b+1,D=(-1-x)*T+(1.5+x)*R+.5*b,U=x*T-x*R;for(let F=0;F!==h;++F)o[F]=M*l[_+F]+w*l[p+F]+D*l[d+F]+U*l[v+F];return o}}class oA extends Pu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=e*h,p=d-h,_=(n-t)/(i-t),v=1-_;for(let y=0;y!==h;++y)o[y]=l[p+y]*v+l[d+y]*_;return o}}class O1 extends Pu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class xr{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Hu(t,this.TimeBufferType),this.values=Hu(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Hu(e.times,Array),values:Hu(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new O1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new oA(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new L1(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Au:t=this.InterpolantFactoryMethodDiscrete;break;case uc:t=this.InterpolantFactoryMethodLinear;break;case A0:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Et("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Au;case this.InterpolantFactoryMethodLinear:return uc;case this.InterpolantFactoryMethodSmooth:return A0}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let o=0,l=i-1;for(;o!==i&&n[o]<e;)++o;for(;l!==-1&&n[l]>t;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const h=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*h,l*h)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Wt("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(Wt("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let h=0;h!==o;h++){const d=n[h];if(typeof d=="number"&&isNaN(d)){Wt("KeyframeTrack: Time is not a valid number.",this,h,d),e=!1;break}if(l!==null&&l>d){Wt("KeyframeTrack: Out of order keys.",this,h,d,l),e=!1;break}l=d}if(i!==void 0&&db(i))for(let h=0,d=i.length;h!==d;++h){const p=i[h];if(isNaN(p)){Wt("KeyframeTrack: Value is not a valid number.",this,h,p),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===A0,o=e.length-1;let l=1;for(let h=1;h<o;++h){let d=!1;const p=e[h],_=e[h+1];if(p!==_&&(h!==1||p!==e[0]))if(i)d=!0;else{const v=h*n,y=v-n,x=v+n;for(let b=0;b!==n;++b){const R=t[v+b];if(R!==t[y+b]||R!==t[x+b]){d=!0;break}}}if(d){if(h!==l){e[l]=e[h];const v=h*n,y=l*n;for(let x=0;x!==n;++x)t[y+x]=t[v+x]}++l}}if(o>0){e[l]=e[o];for(let h=o*n,d=l*n,p=0;p!==n;++p)t[d+p]=t[h+p];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}xr.prototype.ValueTypeName="",xr.prototype.TimeBufferType=Float32Array,xr.prototype.ValueBufferType=Float32Array,xr.prototype.DefaultInterpolation=uc;class Gu extends xr{constructor(e,t,n){super(e,t,n)}}Gu.prototype.ValueTypeName="bool",Gu.prototype.ValueBufferType=Array,Gu.prototype.DefaultInterpolation=Au,Gu.prototype.InterpolantFactoryMethodLinear=void 0,Gu.prototype.InterpolantFactoryMethodSmooth=void 0;class lA extends xr{constructor(e,t,n,i){super(e,t,n,i)}}lA.prototype.ValueTypeName="color";class Al extends xr{constructor(e,t,n,i){super(e,t,n,i)}}Al.prototype.ValueTypeName="number";class I1 extends Pu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=(n-t)/(i-t);let p=e*h;for(let _=p+h;p!==_;p+=4)ba.slerpFlat(o,0,l,p-h,l,p,d);return o}}class Sl extends xr{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new I1(this.times,this.values,this.getValueSize(),e)}}Sl.prototype.ValueTypeName="quaternion",Sl.prototype.InterpolantFactoryMethodSmooth=void 0;class zu extends xr{constructor(e,t,n){super(e,t,n)}}zu.prototype.ValueTypeName="string",zu.prototype.ValueBufferType=Array,zu.prototype.DefaultInterpolation=Au,zu.prototype.InterpolantFactoryMethodLinear=void 0,zu.prototype.InterpolantFactoryMethodSmooth=void 0;class Ml extends xr{constructor(e,t,n,i){super(e,t,n,i)}}Ml.prototype.ValueTypeName="vector";class Vu{constructor(e="",t=-1,n=[],i=S0){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Qs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,h=n.length;l!==h;++l)t.push(Jw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(xr.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let h=0;h<o;h++){let d=[],p=[];d.push((h+o-1)%o,h,(h+1)%o),p.push(0,1,0);const _=N1(d);d=sA(d,1,_),p=sA(p,1,_),!i&&d[0]===0&&(d.push(o),p.push(p[0])),l.push(new Al(".morphTargetInfluences["+t[h].name+"]",d,p).scale(1/n))}return new this(e,-1,l)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},o=/^([\w-]*?)([\d]+)$/;for(let h=0,d=e.length;h<d;h++){const p=e[h],_=p.name.match(o);if(_&&_.length>1){const v=_[1];let y=i[v];y||(i[v]=y=[]),y.push(p)}}const l=[];for(const h in i)l.push(this.CreateFromMorphTargetSequence(h,i[h],t,n));return l}static parseAnimation(e,t){if(Et("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Wt("AnimationClip: No animation in JSONLoader data."),null;const n=function(v,y,x,b,R){if(x.length!==0){const T=[],M=[];rA(x,T,M,b),T.length!==0&&R.push(new v(y,T,M))}},i=[],o=e.name||"default",l=e.fps||30,h=e.blendMode;let d=e.length||-1;const p=e.hierarchy||[];for(let v=0;v<p.length;v++){const y=p[v].keys;if(!(!y||y.length===0))if(y[0].morphTargets){const x={};let b;for(b=0;b<y.length;b++)if(y[b].morphTargets)for(let R=0;R<y[b].morphTargets.length;R++)x[y[b].morphTargets[R]]=-1;for(const R in x){const T=[],M=[];for(let w=0;w!==y[b].morphTargets.length;++w){const D=y[b];T.push(D.time),M.push(D.morphTarget===R?1:0)}i.push(new Al(".morphTargetInfluence["+R+"]",T,M))}d=x.length*l}else{const x=".bones["+t[v].name+"]";n(Ml,x+".position",y,"pos",i),n(Sl,x+".quaternion",y,"rot",i),n(Ml,x+".scale",y,"scl",i)}}return i.length===0?null:new this(o,d,i,h)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const o=this.tracks[n];t=Math.max(t,o.times[o.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Yw(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Al;case"vector":case"vector2":case"vector3":case"vector4":return Ml;case"color":return lA;case"quaternion":return Sl;case"bool":case"boolean":return Gu;case"string":return zu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function Jw(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Yw(s.type);if(s.times===void 0){const t=[],n=[];rA(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const wo={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class Iv{constructor(e,t,n){const i=this;let o=!1,l=0,h=0,d;const p=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(_){h++,o===!1&&i.onStart!==void 0&&i.onStart(_,l,h),o=!0},this.itemEnd=function(_){l++,i.onProgress!==void 0&&i.onProgress(_,l,h),l===h&&(o=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(_){i.onError!==void 0&&i.onError(_)},this.resolveURL=function(_){return d?d(_):_},this.setURLModifier=function(_){return d=_,this},this.addHandler=function(_,v){return p.push(_,v),this},this.removeHandler=function(_){const v=p.indexOf(_);return v!==-1&&p.splice(v,2),this},this.getHandler=function(_){for(let v=0,y=p.length;v<y;v+=2){const x=p[v],b=p[v+1];if(x.global&&(x.lastIndex=0),x.test(_))return b}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const F1=new Iv;class Ca{constructor(e){this.manager=e!==void 0?e:F1,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,o){n.load(e,i,t,o)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Ca.DEFAULT_MATERIAL_NAME="__DEFAULT";const bl={};class qw extends Error{constructor(e,t){super(e),this.response=t}}class ha extends Ca{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=wo.get(`file:${e}`);if(o!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(o),this.manager.itemEnd(e)},0),o;if(bl[e]!==void 0){bl[e].push({onLoad:t,onProgress:n,onError:i});return}bl[e]=[],bl[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),h=this.mimeType,d=this.responseType;fetch(l).then(p=>{if(p.status===200||p.status===0){if(p.status===0&&Et("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||p.body===void 0||p.body.getReader===void 0)return p;const _=bl[e],v=p.body.getReader(),y=p.headers.get("X-File-Size")||p.headers.get("Content-Length"),x=y?parseInt(y):0,b=x!==0;let R=0;const T=new ReadableStream({start(M){w();function w(){v.read().then(({done:D,value:U})=>{if(D)M.close();else{R+=U.byteLength;const F=new ProgressEvent("progress",{lengthComputable:b,loaded:R,total:x});for(let O=0,z=_.length;O<z;O++){const k=_[O];k.onProgress&&k.onProgress(F)}M.enqueue(U),w()}},D=>{M.error(D)})}}});return new Response(T)}else throw new qw(`fetch for "${p.url}" responded with ${p.status}: ${p.statusText}`,p)}).then(p=>{switch(d){case"arraybuffer":return p.arrayBuffer();case"blob":return p.blob();case"document":return p.text().then(_=>new DOMParser().parseFromString(_,h));case"json":return p.json();default:if(h==="")return p.text();{const v=/charset="?([^;"\s]*)"?/i.exec(h),y=v&&v[1]?v[1].toLowerCase():void 0,x=new TextDecoder(y);return p.arrayBuffer().then(b=>x.decode(b))}}}).then(p=>{wo.add(`file:${e}`,p);const _=bl[e];delete bl[e];for(let v=0,y=_.length;v<y;v++){const x=_[v];x.onLoad&&x.onLoad(p)}}).catch(p=>{const _=bl[e];if(_===void 0)throw this.manager.itemError(e),p;delete bl[e];for(let v=0,y=_.length;v<y;v++){const x=_[v];x.onError&&x.onError(p)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Kw extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new ha(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{t(o.parse(JSON.parse(h)))}catch(d){i?i(d):Wt(d),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Vu.parse(e[n]);t.push(i)}return t}}class Ww extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=[],h=new mv,d=new ha(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(o.withCredentials);let p=0;function _(v){d.load(e[v],function(y){const x=o.parse(y,!0);l[v]={width:x.width,height:x.height,format:x.format,mipmaps:x.mipmaps},p+=1,p===6&&(x.mipmapCount===1&&(h.minFilter=bn),h.image=l,h.format=x.format,h.needsUpdate=!0,t&&t(h))},n,i)}if(Array.isArray(e))for(let v=0,y=e.length;v<y;++v)_(v);else d.load(e,function(v){const y=o.parse(v,!0);if(y.isCubemap){const x=y.mipmaps.length/y.mipmapCount;for(let b=0;b<x;b++){l[b]={mipmaps:[]};for(let R=0;R<y.mipmapCount;R++)l[b].mipmaps.push(y.mipmaps[b*y.mipmapCount+R]),l[b].format=y.format,l[b].width=y.width,l[b].height=y.height}h.image=l}else h.image.width=y.width,h.image.height=y.height,h.mipmaps=y.mipmaps;y.mipmapCount===1&&(h.minFilter=bn),h.format=y.format,h.needsUpdate=!0,t&&t(h)},n,i);return h}}const wh=new WeakMap;class Xp extends Ca{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=wo.get(`image:${e}`);if(l!==void 0){if(l.complete===!0)o.manager.itemStart(e),setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0);else{let v=wh.get(l);v===void 0&&(v=[],wh.set(l,v)),v.push({onLoad:t,onError:i})}return l}const h=pp("img");function d(){_(),t&&t(this);const v=wh.get(this)||[];for(let y=0;y<v.length;y++){const x=v[y];x.onLoad&&x.onLoad(this)}wh.delete(this),o.manager.itemEnd(e)}function p(v){_(),i&&i(v),wo.remove(`image:${e}`);const y=wh.get(this)||[];for(let x=0;x<y.length;x++){const b=y[x];b.onError&&b.onError(v)}wh.delete(this),o.manager.itemError(e),o.manager.itemEnd(e)}function _(){h.removeEventListener("load",d,!1),h.removeEventListener("error",p,!1)}return h.addEventListener("load",d,!1),h.addEventListener("error",p,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(h.crossOrigin=this.crossOrigin),wo.add(`image:${e}`,h),o.manager.itemStart(e),h.src=e,h}}class H1 extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=new Sp;o.colorSpace=Pi;const l=new Xp(this.manager);l.setCrossOrigin(this.crossOrigin),l.setPath(this.path);let h=0;function d(p){l.load(e[p],function(_){o.images[p]=_,h++,h===6&&(o.needsUpdate=!0,t&&t(o))},void 0,i)}for(let p=0;p<e.length;++p)d(p);return o}}class cA extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new _r,h=new ha(this.manager);return h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setPath(this.path),h.setWithCredentials(o.withCredentials),h.load(e,function(d){let p;try{p=o.parse(d)}catch(_){if(i!==void 0)i(_);else{_(_);return}}p.image!==void 0?l.image=p.image:p.data!==void 0&&(l.image.width=p.width,l.image.height=p.height,l.image.data=p.data),l.wrapS=p.wrapS!==void 0?p.wrapS:yi,l.wrapT=p.wrapT!==void 0?p.wrapT:yi,l.magFilter=p.magFilter!==void 0?p.magFilter:bn,l.minFilter=p.minFilter!==void 0?p.minFilter:bn,l.anisotropy=p.anisotropy!==void 0?p.anisotropy:1,p.colorSpace!==void 0&&(l.colorSpace=p.colorSpace),p.flipY!==void 0&&(l.flipY=p.flipY),p.format!==void 0&&(l.format=p.format),p.type!==void 0&&(l.type=p.type),p.mipmaps!==void 0&&(l.mipmaps=p.mipmaps,l.minFilter=Is),p.mipmapCount===1&&(l.minFilter=bn),p.generateMipmaps!==void 0&&(l.generateMipmaps=p.generateMipmaps),l.needsUpdate=!0,t&&t(l,p)},n,i),l}}class uA extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=new qn,l=new Xp(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(e,function(h){o.image=h,o.needsUpdate=!0,t!==void 0&&t(o)},n,i),o}}class bc extends wn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new At(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class P1 extends bc{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(wn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new At(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const fA=new Qt,G1=new Q,z1=new Q;class hA{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new et(512,512),this.mapType=Ma,this.map=null,this.mapPass=null,this.matrix=new Qt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Th,this._frameExtents=new et(1,1),this._viewportCount=1,this._viewports=[new ci(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;G1.setFromMatrixPosition(e.matrixWorld),t.position.copy(G1),z1.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(z1),t.updateMatrixWorld(),fA.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fA,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(fA)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class jw extends hA{constructor(){super(new ia(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=nh*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,o=e.distance||t.far;(n!==t.fov||i!==t.aspect||o!==t.far)&&(t.fov=n,t.aspect=i,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Fv extends bc{constructor(e,t,n=0,i=Math.PI/3,o=0,l=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(wn.DEFAULT_UP),this.updateMatrix(),this.target=new wn,this.distance=n,this.angle=i,this.penumbra=o,this.decay=l,this.map=null,this.shadow=new jw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class Zw extends hA{constructor(){super(new ia(90,1,.5,500)),this.isPointLightShadow=!0}}class Hv extends bc{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Zw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class El extends X0{constructor(e=-1,t=1,n=1,i=-1,o=.1,l=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=o,this.far=l,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,o,l){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=o,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let o=n-e,l=n+e,h=i+t,d=i-t;if(this.view!==null&&this.view.enabled){const p=(this.right-this.left)/this.view.fullWidth/this.zoom,_=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=p*this.view.offsetX,l=o+p*this.view.width,h-=_*this.view.offsetY,d=h-_*this.view.height}this.projectionMatrix.makeOrthographic(o,l,h,d,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Qw extends hA{constructor(){super(new El(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Pv extends bc{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(wn.DEFAULT_UP),this.updateMatrix(),this.target=new wn,this.shadow=new Qw}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class V1 extends bc{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class k1 extends bc{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class dA{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Q)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.282095),t.addScaledVector(l[1],.488603*i),t.addScaledVector(l[2],.488603*o),t.addScaledVector(l[3],.488603*n),t.addScaledVector(l[4],1.092548*(n*i)),t.addScaledVector(l[5],1.092548*(i*o)),t.addScaledVector(l[6],.315392*(3*o*o-1)),t.addScaledVector(l[7],1.092548*(n*o)),t.addScaledVector(l[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.886227),t.addScaledVector(l[1],1.023328*i),t.addScaledVector(l[2],1.023328*o),t.addScaledVector(l[3],1.023328*n),t.addScaledVector(l[4],.858086*n*i),t.addScaledVector(l[5],.858086*i*o),t.addScaledVector(l[6],.743125*o*o-.247708),t.addScaledVector(l[7],.858086*n*o),t.addScaledVector(l[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,o=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*o,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*n*o,t[8]=.546274*(n*n-i*i)}}class X1 extends bc{constructor(e=new dA,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Gv extends Ca{constructor(e){super(e),this.textures={}}load(e,t,n,i){const o=this,l=new ha(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(h){try{t(o.parse(JSON.parse(h)))}catch(d){i?i(d):Wt(d),o.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(o){return t[o]===void 0&&Et("MaterialLoader: Undefined texture",o),t[o]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new At().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new At().setHex(l.value);break;case"v2":i.uniforms[o].value=new et().fromArray(l.value);break;case"v3":i.uniforms[o].value=new Q().fromArray(l.value);break;case"v4":i.uniforms[o].value=new ci().fromArray(l.value);break;case"m3":i.uniforms[o].value=new mn().fromArray(l.value);break;case"m4":i.uniforms[o].value=new Qt().fromArray(l.value);break;default:i.uniforms[o].value=l.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=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(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 et().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),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=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new et().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Gv.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:T1,SpriteMaterial:Lx,RawShaderMaterial:nA,ShaderMaterial:ms,PointsMaterial:Up,MeshPhysicalMaterial:zi,MeshStandardMaterial:Fu,MeshPhongMaterial:C1,MeshToonMaterial:R1,MeshNormalMaterial:w1,MeshLambertMaterial:B1,MeshDepthMaterial:iA,MeshDistanceMaterial:aA,MeshBasicMaterial:fa,MeshMatcapMaterial:D1,LineDashedMaterial:U1,LineBasicMaterial:Pa,Material:Gi};return new t[e]}}class nr{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Y1 extends on{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class J1 extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new ha(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(h){try{t(o.parse(JSON.parse(h)))}catch(d){i?i(d):Wt(d),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(x,b){if(t[b]!==void 0)return t[b];const T=x.interleavedBuffers[b],M=o(x,T.buffer),w=eh(T.type,M),D=new yh(w,T.stride);return D.uuid=T.uuid,t[b]=D,D}function o(x,b){if(n[b]!==void 0)return n[b];const T=x.arrayBuffers[b],M=new Uint32Array(T).buffer;return n[b]=M,M}const l=e.isInstancedBufferGeometry?new Y1:new on,h=e.data.index;if(h!==void 0){const x=eh(h.type,h.array);l.setIndex(new Ln(x,1))}const d=e.data.attributes;for(const x in d){const b=d[x];let R;if(b.isInterleavedBufferAttribute){const T=i(e.data,b.data);R=new xl(T,b.itemSize,b.offset,b.normalized)}else{const T=eh(b.type,b.array),M=b.isInstancedBufferAttribute?xc:Ln;R=new M(T,b.itemSize,b.normalized)}b.name!==void 0&&(R.name=b.name),b.usage!==void 0&&R.setUsage(b.usage),l.setAttribute(x,R)}const p=e.data.morphAttributes;if(p)for(const x in p){const b=p[x],R=[];for(let T=0,M=b.length;T<M;T++){const w=b[T];let D;if(w.isInterleavedBufferAttribute){const U=i(e.data,w.data);D=new xl(U,w.itemSize,w.offset,w.normalized)}else{const U=eh(w.type,w.array);D=new Ln(U,w.itemSize,w.normalized)}w.name!==void 0&&(D.name=w.name),R.push(D)}l.morphAttributes[x]=R}e.data.morphTargetsRelative&&(l.morphTargetsRelative=!0);const v=e.data.groups||e.data.drawcalls||e.data.offsets;if(v!==void 0)for(let x=0,b=v.length;x!==b;++x){const R=v[x];l.addGroup(R.start,R.count,R.materialIndex)}const y=e.data.boundingSphere;return y!==void 0&&(l.boundingSphere=new ua().fromJSON(y)),e.name&&(l.name=e.name),e.userData&&(l.userData=e.userData),l}}class $w extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=this.path===""?nr.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||l;const h=new ha(this.manager);h.setPath(this.path),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(d){let p=null;try{p=JSON.parse(d)}catch(v){i!==void 0&&i(v),v("ObjectLoader: Can't parse "+e+".",v.message);return}const _=p.metadata;if(_===void 0||_.type===void 0||_.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Wt("ObjectLoader: Can't load "+e);return}o.parse(p,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?nr.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const o=new ha(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials);const l=await o.loadAsync(e,t),h=JSON.parse(l),d=h.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(h)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),o=this.parseGeometries(e.geometries,i),l=this.parseImages(e.images,function(){t!==void 0&&t(p)}),h=this.parseTextures(e.textures,l),d=this.parseMaterials(e.materials,h),p=this.parseObject(e.object,o,d,h,n),_=this.parseSkeletons(e.skeletons,p);if(this.bindSkeletons(p,_),this.bindLightTargets(p),t!==void 0){let v=!1;for(const y in l)if(l[y].data instanceof HTMLImageElement){v=!0;break}v===!1&&t(p)}return p}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),o=await this.parseImagesAsync(e.images),l=this.parseTextures(e.textures,o),h=this.parseMaterials(e.materials,l),d=this.parseObject(e.object,i,h,l,t),p=this.parseSkeletons(e.skeletons,d);return this.bindSkeletons(d,p),this.bindLightTargets(d),d}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const o=new Ou().fromJSON(e[n]);t[o.uuid]=o}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(o){o.isBone&&(i[o.uuid]=o)}),e!==void 0)for(let o=0,l=e.length;o<l;o++){const h=new bh().fromJSON(e[o],i);n[h.uuid]=h}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new J1;for(let o=0,l=e.length;o<l;o++){let h;const d=e[o];switch(d.type){case"BufferGeometry":case"InstancedBufferGeometry":h=i.parse(d);break;default:d.type in E1?h=E1[d.type].fromJSON(d,t):Et(`ObjectLoader: Unsupported geometry type "${d.type}"`)}h.uuid=d.uuid,d.name!==void 0&&(h.name=d.name),d.userData!==void 0&&(h.userData=d.userData),n[d.uuid]=h}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const o=new Gv;o.setTextures(t);for(let l=0,h=e.length;l<h;l++){const d=e[l];n[d.uuid]===void 0&&(n[d.uuid]=o.parse(d)),i[d.uuid]=n[d.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],o=Vu.parse(i);t[o.uuid]=o}return t}parseImages(e,t){const n=this,i={};let o;function l(d){return n.manager.itemStart(d),o.load(d,function(){n.manager.itemEnd(d)},void 0,function(){n.manager.itemError(d),n.manager.itemEnd(d)})}function h(d){if(typeof d=="string"){const p=d,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;return l(_)}else return d.data?{data:eh(d.type,d.data),width:d.width,height:d.height}:null}if(e!==void 0&&e.length>0){const d=new Iv(t);o=new Xp(d),o.setCrossOrigin(this.crossOrigin);for(let p=0,_=e.length;p<_;p++){const v=e[p],y=v.url;if(Array.isArray(y)){const x=[];for(let b=0,R=y.length;b<R;b++){const T=y[b],M=h(T);M!==null&&(M instanceof HTMLImageElement?x.push(M):x.push(new _r(M.data,M.width,M.height)))}i[v.uuid]=new dc(x)}else{const x=h(v.url);i[v.uuid]=new dc(x)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function o(l){if(typeof l=="string"){const h=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:t.resourcePath+h;return await i.loadAsync(d)}else return l.data?{data:eh(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){i=new Xp(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,h=e.length;l<h;l++){const d=e[l],p=d.url;if(Array.isArray(p)){const _=[];for(let v=0,y=p.length;v<y;v++){const x=p[v],b=await o(x);b!==null&&(b instanceof HTMLImageElement?_.push(b):_.push(new _r(b.data,b.width,b.height)))}n[d.uuid]=new dc(_)}else{const _=await o(d.url);n[d.uuid]=new dc(_)}}}return n}parseTextures(e,t){function n(o,l){return typeof o=="number"?o:(Et("ObjectLoader.parseTexture: Constant should be in numeric form.",o),l[o])}const i={};if(e!==void 0)for(let o=0,l=e.length;o<l;o++){const h=e[o];h.image===void 0&&Et('ObjectLoader: No "image" specified for',h.uuid),t[h.image]===void 0&&Et("ObjectLoader: Undefined image",h.image);const d=t[h.image],p=d.data;let _;Array.isArray(p)?(_=new Sp,p.length===6&&(_.needsUpdate=!0)):(p&&p.data?_=new _r:_=new qn,p&&(_.needsUpdate=!0)),_.source=d,_.uuid=h.uuid,h.name!==void 0&&(_.name=h.name),h.mapping!==void 0&&(_.mapping=n(h.mapping,eB)),h.channel!==void 0&&(_.channel=h.channel),h.offset!==void 0&&_.offset.fromArray(h.offset),h.repeat!==void 0&&_.repeat.fromArray(h.repeat),h.center!==void 0&&_.center.fromArray(h.center),h.rotation!==void 0&&(_.rotation=h.rotation),h.wrap!==void 0&&(_.wrapS=n(h.wrap[0],q1),_.wrapT=n(h.wrap[1],q1)),h.format!==void 0&&(_.format=h.format),h.internalFormat!==void 0&&(_.internalFormat=h.internalFormat),h.type!==void 0&&(_.type=h.type),h.colorSpace!==void 0&&(_.colorSpace=h.colorSpace),h.minFilter!==void 0&&(_.minFilter=n(h.minFilter,K1)),h.magFilter!==void 0&&(_.magFilter=n(h.magFilter,K1)),h.anisotropy!==void 0&&(_.anisotropy=h.anisotropy),h.flipY!==void 0&&(_.flipY=h.flipY),h.generateMipmaps!==void 0&&(_.generateMipmaps=h.generateMipmaps),h.premultiplyAlpha!==void 0&&(_.premultiplyAlpha=h.premultiplyAlpha),h.unpackAlignment!==void 0&&(_.unpackAlignment=h.unpackAlignment),h.compareFunction!==void 0&&(_.compareFunction=h.compareFunction),h.userData!==void 0&&(_.userData=h.userData),i[h.uuid]=_}return i}parseObject(e,t,n,i,o){let l;function h(y){return t[y]===void 0&&Et("ObjectLoader: Undefined geometry",y),t[y]}function d(y){if(y!==void 0){if(Array.isArray(y)){const x=[];for(let b=0,R=y.length;b<R;b++){const T=y[b];n[T]===void 0&&Et("ObjectLoader: Undefined material",T),x.push(n[T])}return x}return n[y]===void 0&&Et("ObjectLoader: Undefined material",y),n[y]}}function p(y){return i[y]===void 0&&Et("ObjectLoader: Undefined texture",y),i[y]}let _,v;switch(e.type){case"Scene":l=new Mp,e.background!==void 0&&(Number.isInteger(e.background)?l.background=new At(e.background):l.background=p(e.background)),e.environment!==void 0&&(l.environment=p(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?l.fog=new K0(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(l.fog=new q0(e.fog.color,e.fog.density)),e.fog.name!==""&&(l.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(l.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(l.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&l.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(l.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&l.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":l=new ia(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(l.focus=e.focus),e.zoom!==void 0&&(l.zoom=e.zoom),e.filmGauge!==void 0&&(l.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(l.filmOffset=e.filmOffset),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"OrthographicCamera":l=new El(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(l.zoom=e.zoom),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"AmbientLight":l=new V1(e.color,e.intensity);break;case"DirectionalLight":l=new Pv(e.color,e.intensity),l.target=e.target||"";break;case"PointLight":l=new Hv(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new k1(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new Fv(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),l.target=e.target||"";break;case"HemisphereLight":l=new P1(e.color,e.groundColor,e.intensity);break;case"LightProbe":const y=new dA().fromArray(e.sh);l=new X1(y,e.intensity);break;case"SkinnedMesh":_=h(e.geometry),v=d(e.material),l=new ev(_,v),e.bindMode!==void 0&&(l.bindMode=e.bindMode),e.bindMatrix!==void 0&&l.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(l.skeleton=e.skeleton);break;case"Mesh":_=h(e.geometry),v=d(e.material),l=new pi(_,v);break;case"InstancedMesh":_=h(e.geometry),v=d(e.material);const x=e.count,b=e.instanceMatrix,R=e.instanceColor;l=new nv(_,v,x),l.instanceMatrix=new xc(new Float32Array(b.array),16),R!==void 0&&(l.instanceColor=new xc(new Float32Array(R.array),R.itemSize));break;case"BatchedMesh":_=h(e.geometry),v=d(e.material),l=new e1(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,v),l.geometry=_,l.perObjectFrustumCulled=e.perObjectFrustumCulled,l.sortObjects=e.sortObjects,l._drawRanges=e.drawRanges,l._reservedRanges=e.reservedRanges,l._geometryInfo=e.geometryInfo.map(T=>{let M=null,w=null;return T.boundingBox!==void 0&&(M=new Ea().fromJSON(T.boundingBox)),T.boundingSphere!==void 0&&(w=new ua().fromJSON(T.boundingSphere)),{...T,boundingBox:M,boundingSphere:w}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=p(e.matricesTexture.uuid),l._indirectTexture=p(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=p(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new ua().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Ea().fromJSON(e.boundingBox));break;case"LOD":l=new kb;break;case"Line":l=new Ro(h(e.geometry),d(e.material));break;case"LineLoop":l=new fv(h(e.geometry),d(e.material));break;case"LineSegments":l=new yr(h(e.geometry),d(e.material));break;case"PointCloud":case"Points":l=new pv(h(e.geometry),d(e.material));break;case"Sprite":l=new zb(d(e.material));break;case"Group":l=new vr;break;case"Bone":l=new Cp;break;default:l=new wn}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const y=e.children;for(let x=0;x<y.length;x++)l.add(this.parseObject(y[x],t,n,i,o))}if(e.animations!==void 0){const y=e.animations;for(let x=0;x<y.length;x++){const b=y[x];l.animations.push(o[b])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(l.autoUpdate=e.autoUpdate);const y=e.levels;for(let x=0;x<y.length;x++){const b=y[x],R=l.getObjectByProperty("uuid",b.object);R!==void 0&&l.addLevel(R,b.distance,b.hysteresis)}}return l}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?Et("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new wn}})}}const eB={UVMapping:rc,CubeReflectionMapping:Yr,CubeRefractionMapping:oc,EquirectangularReflectionMapping:Wf,EquirectangularRefractionMapping:ep,CubeUVReflectionMapping:jf},q1={RepeatWrapping:Jr,ClampToEdgeWrapping:yi,MirroredRepeatWrapping:_u},K1={NearestFilter:xi,NearestMipmapNearestFilter:tp,NearestMipmapLinearFilter:lc,LinearFilter:bn,LinearMipmapNearestFilter:yu,LinearMipmapLinearFilter:Is},pA=new WeakMap;class mA extends Ca{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Et("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Et("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=wo.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(p=>{if(pA.has(l)===!0)i&&i(pA.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(p),o.manager.itemEnd(e),p});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const h={};h.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",h.headers=this.requestHeader,h.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const d=fetch(e,h).then(function(p){return p.blob()}).then(function(p){return createImageBitmap(p,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(p){return wo.add(`image-bitmap:${e}`,p),t&&t(p),o.manager.itemEnd(e),p}).catch(function(p){i&&i(p),pA.set(d,p),wo.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});wo.add(`image-bitmap:${e}`,d),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let zv;class gA{static getContext(){return zv===void 0&&(zv=new(window.AudioContext||window.webkitAudioContext)),zv}static setContext(e){zv=e}}class tB extends Ca{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new ha(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(d){try{const p=d.slice(0);gA.getContext().decodeAudioData(p,function(v){t(v)}).catch(h)}catch(p){h(p)}},n,i);function h(d){i?i(d):Wt(d),o.manager.itemError(e)}}}const W1=new Qt,j1=new Qt,ku=new Qt;class nB{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ia,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ia,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 t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ku.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(Tu*t.fov*.5)/t.zoom;let h,d;j1.elements[12]=-i,W1.elements[12]=i,h=-l*t.aspect+o,d=l*t.aspect+o,ku.elements[0]=2*t.near/(d-h),ku.elements[8]=(d+h)/(d-h),this.cameraL.projectionMatrix.copy(ku),h=-l*t.aspect-o,d=l*t.aspect-o,ku.elements[0]=2*t.near/(d-h),ku.elements[8]=(d+h)/(d-h),this.cameraR.projectionMatrix.copy(ku)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(j1),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(W1)}}class Z1 extends ia{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class vA{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const Xu=new Q,_A=new ba,iB=new Q,Yu=new Q,Ju=new Q;class aB extends wn{constructor(){super(),this.type="AudioListener",this.context=gA.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new vA}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 t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xu,_A,iB),Yu.set(0,0,-1).applyQuaternion(_A),Ju.set(0,1,0).applyQuaternion(_A),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Xu.x,n),t.positionY.linearRampToValueAtTime(Xu.y,n),t.positionZ.linearRampToValueAtTime(Xu.z,n),t.forwardX.linearRampToValueAtTime(Yu.x,n),t.forwardY.linearRampToValueAtTime(Yu.y,n),t.forwardZ.linearRampToValueAtTime(Yu.z,n),t.upX.linearRampToValueAtTime(Ju.x,n),t.upY.linearRampToValueAtTime(Ju.y,n),t.upZ.linearRampToValueAtTime(Ju.z,n)}else t.setPosition(Xu.x,Xu.y,Xu.z),t.setOrientation(Yu.x,Yu.y,Yu.z,Ju.x,Ju.y,Ju.z)}}class Q1 extends wn{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){Et("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){Et("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(e=0){if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(Et("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Et("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(Et("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const qu=new Q,$1=new ba,sB=new Q,Ku=new Q;class rB extends Q1{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(qu,$1,sB),Ku.set(0,0,1).applyQuaternion($1);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(qu.x,n),t.positionY.linearRampToValueAtTime(qu.y,n),t.positionZ.linearRampToValueAtTime(qu.z,n),t.orientationX.linearRampToValueAtTime(Ku.x,n),t.orientationY.linearRampToValueAtTime(Ku.y,n),t.orientationZ.linearRampToValueAtTime(Ku.z,n)}else t.setPosition(qu.x,qu.y,qu.z),t.setOrientation(Ku.x,Ku.y,Ku.z)}}class oB{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class eE{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,o,l;switch(t){case"quaternion":i=this._slerp,o=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,o=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,o=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=o,this._setIdentity=l,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,o=e*i+i;let l=this.cumulativeWeight;if(l===0){for(let h=0;h!==i;++h)n[o+h]=n[h];l=t}else{l+=t;const h=t/l;this._mixBufferRegion(n,o,0,h,i)}this.cumulativeWeight=l}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,o=this.cumulativeWeight,l=this.cumulativeWeightAdditive,h=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,o<1){const d=t*this._origIndex;this._mixBufferRegion(n,i,d,1-o,t)}l>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let d=t,p=t+t;d!==p;++d)if(n[d]!==n[d+t]){h.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];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,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,o){if(i>=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){ba.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;ba.multiplyQuaternionsFlat(e,l,e,t,e,n),ba.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let h=0;h!==o;++h){const d=t+h;e[d]=e[d]*l+e[n+h]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const h=t+l;e[h]=e[h]+e[n+l]*i}}}const yA="\\[\\]\\.:\\/",lB=new RegExp("["+yA+"]","g"),xA="[^"+yA+"]",cB="[^"+yA.replace("\\.","")+"]",uB=/((?:WC+[\/:])*)/.source.replace("WC",xA),fB=/(WCOD+)?/.source.replace("WCOD",cB),hB=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xA),dB=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xA),pB=new RegExp("^"+uB+fB+hB+dB+"$"),mB=["material","materials","bones","map"];class gB{constructor(e,t,n){const i=n||Hn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Hn{constructor(e,t,n){this.path=t,this.parsedPath=n||Hn.parseTrackName(t),this.node=Hn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Hn.Composite(e,t,n):new Hn(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(lB,"")}static parseTrackName(e){const t=pB.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);mB.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l<o.length;l++){const h=o[l];if(h.name===t||h.uuid===t)return h;const d=n(h.children);if(d)return d}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let o=t.propertyIndex;if(e||(e=Hn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Et("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let p=t.objectIndex;switch(n){case"materials":if(!e.material){Wt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Wt("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Wt("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let _=0;_<e.length;_++)if(e[_].name===p){p=_;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Wt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Wt("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Wt("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(p!==void 0){if(e[p]===void 0){Wt("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[p]}}const l=e[i];if(l===void 0){const p=t.nodeName;Wt("PropertyBinding: Trying to update property for track: "+p+"."+i+" but it wasn't found.",e);return}let h=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?h=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let d=this.BindingType.Direct;if(o!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Wt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Wt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[o]!==void 0&&(o=e.morphTargetDictionary[o])}d=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=o}else l.fromArray!==void 0&&l.toArray!==void 0?(d=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(d=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[d],this.setValue=this.SetterByBindingTypeAndVersioning[d][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Hn.Composite=gB,Hn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Hn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Hn.prototype.GetterByBindingType=[Hn.prototype._getValue_direct,Hn.prototype._getValue_array,Hn.prototype._getValue_arrayElement,Hn.prototype._getValue_toArray],Hn.prototype.SetterByBindingTypeAndVersioning=[[Hn.prototype._setValue_direct,Hn.prototype._setValue_direct_setNeedsUpdate,Hn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Hn.prototype._setValue_array,Hn.prototype._setValue_array_setNeedsUpdate,Hn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Hn.prototype._setValue_arrayElement,Hn.prototype._setValue_arrayElement_setNeedsUpdate,Hn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Hn.prototype._setValue_fromArray,Hn.prototype._setValue_fromArray_setNeedsUpdate,Hn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class vB{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Qs(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,o=this._bindings,l=o.length;let h,d=e.length,p=this.nCachedObjects_;for(let _=0,v=arguments.length;_!==v;++_){const y=arguments[_],x=y.uuid;let b=t[x];if(b===void 0){b=d++,t[x]=b,e.push(y);for(let R=0,T=l;R!==T;++R)o[R].push(new Hn(y,n[R],i[R]))}else if(b<p){h=e[b];const R=--p,T=e[R];t[T.uuid]=b,e[b]=T,t[x]=R,e[R]=y;for(let M=0,w=l;M!==w;++M){const D=o[M],U=D[R];let F=D[b];D[b]=U,F===void 0&&(F=new Hn(y,n[M],i[M])),D[R]=F}}else e[b]!==h&&Wt("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=p}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_;for(let l=0,h=arguments.length;l!==h;++l){const d=arguments[l],p=d.uuid,_=t[p];if(_!==void 0&&_>=o){const v=o++,y=e[v];t[y.uuid]=_,e[_]=y,t[p]=v,e[v]=d;for(let x=0,b=i;x!==b;++x){const R=n[x],T=R[v],M=R[_];R[_]=T,R[v]=M}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let h=0,d=arguments.length;h!==d;++h){const p=arguments[h],_=p.uuid,v=t[_];if(v!==void 0)if(delete t[_],v<o){const y=--o,x=e[y],b=--l,R=e[b];t[x.uuid]=v,e[v]=x,t[R.uuid]=y,e[y]=R,e.pop();for(let T=0,M=i;T!==M;++T){const w=n[T],D=w[y],U=w[b];w[v]=D,w[y]=U,w.pop()}}else{const y=--l,x=e[y];y>0&&(t[x.uuid]=v),e[v]=x,e.pop();for(let b=0,R=i;b!==R;++b){const T=n[b];T[v]=T[y],T.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,h=this._parsedPaths,d=this._objects,p=d.length,_=this.nCachedObjects_,v=new Array(p);i=o.length,n[e]=i,l.push(e),h.push(t),o.push(v);for(let y=_,x=d.length;y!==x;++y){const b=d[y];v[y]=new Hn(b,e,t)}return v}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,h=l.length-1,d=l[h],p=e[h];t[p]=n,l[n]=d,l.pop(),o[n]=o[h],o.pop(),i[n]=i[h],i.pop()}}}class tE{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,h=new Array(l),d={endingStart:Su,endingEnd:Su};for(let p=0;p!==l;++p){const _=o[p].createInterpolant(null);h[p]=_,_.settings=d}this._interpolantSettings=d,this._interpolants=h,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=nb,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,t){return this.loop=e,this.repetitions=t,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,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,h=i/o;e.warp(1,l,t),this.warp(h,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}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,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let h=this._timeScaleInterpolant;h===null&&(h=i._lendControlInterpolant(),this._timeScaleInterpolant=h);const d=h.parameterPositions,p=h.sampleValues;return d[0]=o,d[1]=o+n,p[0]=e/l,p[1]=t/l,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,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const d=(e-o)*n;d<0||n===0?t=0:(this._startTime=null,t=n*d)}t*=this._updateTimeScale(e);const l=this._updateTime(t),h=this._updateWeight(e);if(h>0){const d=this._interpolants,p=this._propertyBindings;switch(this.blendMode){case rx:for(let _=0,v=d.length;_!==v;++_)d[_].evaluate(l),p[_].accumulateAdditive(h);break;case S0:default:for(let _=0,v=d.length;_!==v;++_)d[_].evaluate(l),p[_].accumulate(i,h)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===ib;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===cp){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;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,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const h=Math.floor(i/t);i-=t*h,o+=Math.abs(h);const d=this.repetitions-o;if(d<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(d===1){const p=e<0;this._setEndings(p,!p,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:h})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Mu,i.endingEnd=Mu):(e?i.endingStart=this.zeroSlopeAtStart?Mu:Su:i.endingStart=up,t?i.endingEnd=this.zeroSlopeAtEnd?Mu:Su:i.endingEnd=up)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const h=l.parameterPositions,d=l.sampleValues;return h[0]=o,d[0]=t,h[1]=o+e,d[1]=n,this}}const _B=new Float32Array(1);class nE extends Eo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,h=e._interpolants,d=n.uuid,p=this._bindingsByRootAndName;let _=p[d];_===void 0&&(_={},p[d]=_);for(let v=0;v!==o;++v){const y=i[v],x=y.name;let b=_[x];if(b!==void 0)++b.referenceCount,l[v]=b;else{if(b=l[v],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,d,x));continue}const R=t&&t._propertyBindings[v].binding.parsedPath;b=new eE(Hn.create(n,x,R),y.ValueTypeName,y.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,d,x),l[v]=b}h[v].resultBuffer=b.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--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 t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,o=this._actionsByClip;let l=o[t];if(l===void 0)l={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,o[t]=l;else{const h=l.knownActions;e._byClipCacheIndex=h.length,h.push(e)}e._cacheIndex=i.length,i.push(e),l.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const o=e._clip.uuid,l=this._actionsByClip,h=l[o],d=h.knownActions,p=d[d.length-1],_=e._byClipCacheIndex;p._byClipCacheIndex=_,d[_]=p,d.pop(),e._byClipCacheIndex=null;const v=h.actionByRoot,y=(e._localRoot||this._root).uuid;delete v[y],d.length===0&&delete l[o],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.referenceCount===0&&this._removeInactiveBinding(o)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,o=this._bindings;let l=i[t];l===void 0&&(l={},i[t]=l),l[n]=e,e._cacheIndex=o.length,o.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,o=n.path,l=this._bindingsByRootAndName,h=l[i],d=t[t.length-1],p=e._cacheIndex;d._cacheIndex=p,t[p]=d,t.pop(),delete h[o],Object.keys(h).length===0&&delete l[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new oA(new Float32Array(2),new Float32Array(2),1,_B),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,o=t[i];e.__cacheIndex=i,t[i]=e,o.__cacheIndex=n,t[n]=o}clipAction(e,t,n){const i=t||this._root,o=i.uuid;let l=typeof e=="string"?Vu.findByName(i,e):e;const h=l!==null?l.uuid:e,d=this._actionsByClip[h];let p=null;if(n===void 0&&(l!==null?n=l.blendMode:n=S0),d!==void 0){const v=d.actionByRoot[o];if(v!==void 0&&v.blendMode===n)return v;p=d.knownActions[0],l===null&&(l=p._clip)}if(l===null)return null;const _=new tE(this,l,t,n);return this._bindAction(_,p),this._addInactiveAction(_,h,o),_}existingAction(e,t){const n=t||this._root,i=n.uuid,o=typeof e=="string"?Vu.findByName(n,e):e,l=o?o.uuid:e,h=this._actionsByClip[l];return h!==void 0&&h.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let p=0;p!==n;++p)t[p]._update(i,e,o,l);const h=this._bindings,d=this._nActiveBindings;for(let p=0;p!==d;++p)h[p].apply(l);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,o=i[n];if(o!==void 0){const l=o.knownActions;for(let h=0,d=l.length;h!==d;++h){const p=l[h];this._deactivateAction(p);const _=p._cacheIndex,v=t[t.length-1];p._cacheIndex=null,p._byClipCacheIndex=null,v._cacheIndex=_,t[_]=v,t.pop(),this._removeInactiveBindingsForAction(p)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const l in n){const h=n[l].actionByRoot,d=h[t];d!==void 0&&(this._deactivateAction(d),this._removeInactiveAction(d))}const i=this._bindingsByRootAndName,o=i[t];if(o!==void 0)for(const l in o){const h=o[l];h.restoreOriginalState(),this._removeInactiveBinding(h)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class yB extends mx{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new C0(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class AA{constructor(e){this.value=e}clone(){return new AA(this.value.clone===void 0?this.value:this.value.clone())}}let xB=0;class AB extends Eo{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:xB++}),this.name="",this.usage=dp,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const o=Array.isArray(t[n])?t[n]:[t[n]];for(let l=0;l<o.length;l++)this.uniforms.push(o[l].clone())}return this}clone(){return new this.constructor().copy(this)}}class SB extends yh{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class MB{constructor(e,t,n,i,o,l=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=o,this.normalized=l,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const iE=new Qt;class SA{constructor(e,t,n=0,i=1/0){this.ray=new lh(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new uh,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Wt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return iE.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(iE),this}intersectObject(e,t=!0,n=[]){return MA(e,this,n,t),n.sort(aE),n}intersectObjects(e,t=!0,n=[]){for(let i=0,o=e.length;i<o;i++)MA(e[i],this,n,t);return n.sort(aE),n}}function aE(s,e){return s.distance-e.distance}function MA(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const o=s.children;for(let l=0,h=o.length;l<h;l++)MA(o[l],e,t,!0)}}class bB{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=EB.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function EB(){this._document.hidden===!1&&this.reset()}class TB{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=rn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(rn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class CB{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class bA{constructor(e,t,n,i){bA.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const o=this.elements;return o[0]=e,o[2]=t,o[1]=n,o[3]=i,this}}const sE=new et;class RB{constructor(e=new et(1/0,1/0),t=new et(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=sE.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.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,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sE).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 rE=new Q,Vv=new Q,Bh=new Q,Dh=new Q,EA=new Q,wB=new Q,BB=new Q;class DB{constructor(e=new Q,t=new Q){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),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,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){rE.subVectors(e,this.start),Vv.subVectors(this.end,this.start);const n=Vv.dot(Vv);let o=Vv.dot(rE)/n;return t&&(o=rn(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=wB,n=BB){const i=10000000000000001e-32;let o,l;const h=this.start,d=e.start,p=this.end,_=e.end;Bh.subVectors(p,h),Dh.subVectors(_,d),EA.subVectors(h,d);const v=Bh.dot(Bh),y=Dh.dot(Dh),x=Dh.dot(EA);if(v<=i&&y<=i)return t.copy(h),n.copy(d),t.sub(n),t.dot(t);if(v<=i)o=0,l=x/y,l=rn(l,0,1);else{const b=Bh.dot(EA);if(y<=i)l=0,o=rn(-b/v,0,1);else{const R=Bh.dot(Dh),T=v*y-R*R;T!==0?o=rn((R*x-b*y)/T,0,1):o=0,l=(R*o+x)/y,l<0?(l=0,o=rn(-b/v,0,1)):l>1&&(l=1,o=rn((R-b)/v,0,1))}}return t.copy(h).add(Bh.multiplyScalar(o)),n.copy(d).add(Dh.multiplyScalar(l)),t.sub(n),t.dot(t)}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 oE=new Q;class UB extends wn{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new on,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 l=0,h=1,d=32;l<d;l++,h++){const p=l/d*Math.PI*2,_=h/d*Math.PI*2;i.push(Math.cos(p),Math.sin(p),1,Math.cos(_),Math.sin(_),1)}n.setAttribute("position",new Pt(i,3));const o=new Pa({fog:!1,toneMapped:!1});this.cone=new yr(n,o),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),oE.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(oE),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ec=new Q,kv=new Qt,TA=new Qt;class NB extends yr{constructor(e){const t=lE(e),n=new on,i=[],o=[];for(let p=0;p<t.length;p++){const _=t[p];_.parent&&_.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),o.push(0,0,0),o.push(0,0,0))}n.setAttribute("position",new Pt(i,3)),n.setAttribute("color",new Pt(o,3));const l=new Pa({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const h=new At(255),d=new At(65280);this.setColors(h,d)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");TA.copy(this.root.matrixWorld).invert();for(let o=0,l=0;o<t.length;o++){const h=t[o];h.parent&&h.parent.isBone&&(kv.multiplyMatrices(TA,h.matrixWorld),Ec.setFromMatrixPosition(kv),i.setXYZ(l,Ec.x,Ec.y,Ec.z),kv.multiplyMatrices(TA,h.parent.matrixWorld),Ec.setFromMatrixPosition(kv),i.setXYZ(l+1,Ec.x,Ec.y,Ec.z),l+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let o=0;o<i.count;o+=2)i.setXYZ(o,e.r,e.g,e.b),i.setXYZ(o+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function lE(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push(...lE(s.children[t]));return e}class LB extends pi{constructor(e,t,n){const i=new kp(t,4,2),o=new fa({wireframe:!0,fog:!1,toneMapped:!1});super(i,o),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const OB=new Q,cE=new At,uE=new At;class IB extends wn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Vp(t);i.rotateY(Math.PI*.5),this.material=new fa({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const o=i.getAttribute("position"),l=new Float32Array(o.count*3);i.setAttribute("color",new Ln(l,3)),this.add(new pi(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");cE.copy(this.light.color),uE.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const o=n<i/2?cE:uE;t.setXYZ(n,o.r,o.g,o.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(OB.setFromMatrixPosition(this.light.matrixWorld).negate())}}class FB extends yr{constructor(e=10,t=10,n=4473924,i=8947848){n=new At(n),i=new At(i);const o=t/2,l=e/t,h=e/2,d=[],p=[];for(let y=0,x=0,b=-h;y<=t;y++,b+=l){d.push(-h,0,b,h,0,b),d.push(b,0,-h,b,0,h);const R=y===o?n:i;R.toArray(p,x),x+=3,R.toArray(p,x),x+=3,R.toArray(p,x),x+=3,R.toArray(p,x),x+=3}const _=new on;_.setAttribute("position",new Pt(d,3)),_.setAttribute("color",new Pt(p,3));const v=new Pa({vertexColors:!0,toneMapped:!1});super(_,v),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class HB extends yr{constructor(e=10,t=16,n=8,i=64,o=4473924,l=8947848){o=new At(o),l=new At(l);const h=[],d=[];if(t>1)for(let v=0;v<t;v++){const y=v/t*(Math.PI*2),x=Math.sin(y)*e,b=Math.cos(y)*e;h.push(0,0,0),h.push(x,0,b);const R=v&1?o:l;d.push(R.r,R.g,R.b),d.push(R.r,R.g,R.b)}for(let v=0;v<n;v++){const y=v&1?o:l,x=e-e/n*v;for(let b=0;b<i;b++){let R=b/i*(Math.PI*2),T=Math.sin(R)*x,M=Math.cos(R)*x;h.push(T,0,M),d.push(y.r,y.g,y.b),R=(b+1)/i*(Math.PI*2),T=Math.sin(R)*x,M=Math.cos(R)*x,h.push(T,0,M),d.push(y.r,y.g,y.b)}}const p=new on;p.setAttribute("position",new Pt(h,3)),p.setAttribute("color",new Pt(d,3));const _=new Pa({vertexColors:!0,toneMapped:!1});super(p,_),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const fE=new Q,Xv=new Q,hE=new Q;class PB extends wn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new on;i.setAttribute("position",new Pt([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const o=new Pa({fog:!1,toneMapped:!1});this.lightPlane=new Ro(i,o),this.add(this.lightPlane),i=new on,i.setAttribute("position",new Pt([0,0,0,0,0,1],3)),this.targetLine=new Ro(i,o),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),fE.setFromMatrixPosition(this.light.matrixWorld),Xv.setFromMatrixPosition(this.light.target.matrixWorld),hE.subVectors(Xv,fE),this.lightPlane.lookAt(Xv),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Xv),this.targetLine.scale.z=hE.length()}}const Yv=new Q,Vi=new X0;class GB extends yr{constructor(e){const t=new on,n=new Pa({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],o=[],l={};h("n1","n2"),h("n2","n4"),h("n4","n3"),h("n3","n1"),h("f1","f2"),h("f2","f4"),h("f4","f3"),h("f3","f1"),h("n1","f1"),h("n2","f2"),h("n3","f3"),h("n4","f4"),h("p","n1"),h("p","n2"),h("p","n3"),h("p","n4"),h("u1","u2"),h("u2","u3"),h("u3","u1"),h("c","t"),h("p","c"),h("cn1","cn2"),h("cn3","cn4"),h("cf1","cf2"),h("cf3","cf4");function h(b,R){d(b),d(R)}function d(b){i.push(0,0,0),o.push(0,0,0),l[b]===void 0&&(l[b]=[]),l[b].push(i.length/3-1)}t.setAttribute("position",new Pt(i,3)),t.setAttribute("color",new Pt(o,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=l,this.update();const p=new At(16755200),_=new At(16711680),v=new At(43775),y=new At(16777215),x=new At(3355443);this.setColors(p,_,v,y,x)}setColors(e,t,n,i,o){const h=this.geometry.getAttribute("color");return h.setXYZ(0,e.r,e.g,e.b),h.setXYZ(1,e.r,e.g,e.b),h.setXYZ(2,e.r,e.g,e.b),h.setXYZ(3,e.r,e.g,e.b),h.setXYZ(4,e.r,e.g,e.b),h.setXYZ(5,e.r,e.g,e.b),h.setXYZ(6,e.r,e.g,e.b),h.setXYZ(7,e.r,e.g,e.b),h.setXYZ(8,e.r,e.g,e.b),h.setXYZ(9,e.r,e.g,e.b),h.setXYZ(10,e.r,e.g,e.b),h.setXYZ(11,e.r,e.g,e.b),h.setXYZ(12,e.r,e.g,e.b),h.setXYZ(13,e.r,e.g,e.b),h.setXYZ(14,e.r,e.g,e.b),h.setXYZ(15,e.r,e.g,e.b),h.setXYZ(16,e.r,e.g,e.b),h.setXYZ(17,e.r,e.g,e.b),h.setXYZ(18,e.r,e.g,e.b),h.setXYZ(19,e.r,e.g,e.b),h.setXYZ(20,e.r,e.g,e.b),h.setXYZ(21,e.r,e.g,e.b),h.setXYZ(22,e.r,e.g,e.b),h.setXYZ(23,e.r,e.g,e.b),h.setXYZ(24,t.r,t.g,t.b),h.setXYZ(25,t.r,t.g,t.b),h.setXYZ(26,t.r,t.g,t.b),h.setXYZ(27,t.r,t.g,t.b),h.setXYZ(28,t.r,t.g,t.b),h.setXYZ(29,t.r,t.g,t.b),h.setXYZ(30,t.r,t.g,t.b),h.setXYZ(31,t.r,t.g,t.b),h.setXYZ(32,n.r,n.g,n.b),h.setXYZ(33,n.r,n.g,n.b),h.setXYZ(34,n.r,n.g,n.b),h.setXYZ(35,n.r,n.g,n.b),h.setXYZ(36,n.r,n.g,n.b),h.setXYZ(37,n.r,n.g,n.b),h.setXYZ(38,i.r,i.g,i.b),h.setXYZ(39,i.r,i.g,i.b),h.setXYZ(40,o.r,o.g,o.b),h.setXYZ(41,o.r,o.g,o.b),h.setXYZ(42,o.r,o.g,o.b),h.setXYZ(43,o.r,o.g,o.b),h.setXYZ(44,o.r,o.g,o.b),h.setXYZ(45,o.r,o.g,o.b),h.setXYZ(46,o.r,o.g,o.b),h.setXYZ(47,o.r,o.g,o.b),h.setXYZ(48,o.r,o.g,o.b),h.setXYZ(49,o.r,o.g,o.b),h.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let o,l;if(Vi.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)o=1,l=0;else if(this.camera.coordinateSystem===Zs)o=-1,l=1;else if(this.camera.coordinateSystem===$f)o=0,l=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Zi("c",t,e,Vi,0,0,o),Zi("t",t,e,Vi,0,0,l),Zi("n1",t,e,Vi,-n,-i,o),Zi("n2",t,e,Vi,n,-i,o),Zi("n3",t,e,Vi,-n,i,o),Zi("n4",t,e,Vi,n,i,o),Zi("f1",t,e,Vi,-n,-i,l),Zi("f2",t,e,Vi,n,-i,l),Zi("f3",t,e,Vi,-n,i,l),Zi("f4",t,e,Vi,n,i,l),Zi("u1",t,e,Vi,n*.7,i*1.1,o),Zi("u2",t,e,Vi,-n*.7,i*1.1,o),Zi("u3",t,e,Vi,0,i*2,o),Zi("cf1",t,e,Vi,-n,0,l),Zi("cf2",t,e,Vi,n,0,l),Zi("cf3",t,e,Vi,0,-i,l),Zi("cf4",t,e,Vi,0,i,l),Zi("cn1",t,e,Vi,-n,0,o),Zi("cn2",t,e,Vi,n,0,o),Zi("cn3",t,e,Vi,0,-i,o),Zi("cn4",t,e,Vi,0,i,o),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Zi(s,e,t,n,i,o,l){Yv.set(i,o,l).unproject(n);const h=e[s];if(h!==void 0){const d=t.getAttribute("position");for(let p=0,_=h.length;p<_;p++)d.setXYZ(h[p],Yv.x,Yv.y,Yv.z)}}const Jv=new Ea;class zB extends yr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),o=new on;o.setIndex(new Ln(n,1)),o.setAttribute("position",new Ln(i,3)),super(o,new Pa({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Jv.setFromObject(this.object),Jv.isEmpty())return;const e=Jv.min,t=Jv.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class VB extends yr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],o=new on;o.setIndex(new Ln(n,1)),o.setAttribute("position",new Pt(i,3)),super(o,new Pa({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class kB extends Ro{constructor(e,t=1,n=16776960){const i=n,o=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],l=new on;l.setAttribute("position",new Pt(o,3)),l.computeBoundingSphere(),super(l,new Pa({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const h=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],d=new on;d.setAttribute("position",new Pt(h,3)),d.computeBoundingSphere(),this.add(new pi(d,new fa({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const dE=new Q;let qv,CA;class XB extends wn{constructor(e=new Q(0,0,1),t=new Q(0,0,0),n=1,i=16776960,o=n*.2,l=o*.2){super(),this.type="ArrowHelper",qv===void 0&&(qv=new on,qv.setAttribute("position",new Pt([0,0,0,0,1,0],3)),CA=new Lp(.5,1,5,1),CA.translate(0,-.5,0)),this.position.copy(t),this.line=new Ro(qv,new Pa({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new pi(CA,new fa({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,o,l)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{dE.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(dE,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),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 YB extends yr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new on;i.setAttribute("position",new Pt(t,3)),i.setAttribute("color",new Pt(n,3));const o=new Pa({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new At,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class JB{constructor(){this.type="ShapePath",this.color=new At,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ev,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(M){const w=[];for(let D=0,U=M.length;D<U;D++){const F=M[D],O=new Ou;O.curves=F.curves,w.push(O)}return w}function n(M,w){const D=w.length;let U=!1;for(let F=D-1,O=0;O<D;F=O++){let z=w[F],k=w[O],N=k.x-z.x,I=k.y-z.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(z=w[O],N=-N,k=w[F],I=-I),M.y<z.y||M.y>k.y)continue;if(M.y===z.y){if(M.x===z.x)return!0}else{const W=I*(M.x-z.x)-N*(M.y-z.y);if(W===0)return!0;if(W<0)continue;U=!U}}else{if(M.y!==z.y)continue;if(k.x<=M.x&&M.x<=z.x||z.x<=M.x&&M.x<=k.x)return!0}}return U}const i=Zr.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,h,d;const p=[];if(o.length===1)return h=o[0],d=new Ou,d.curves=h.curves,p.push(d),p;let _=!i(o[0].getPoints());_=e?!_:_;const v=[],y=[];let x=[],b=0,R;y[b]=void 0,x[b]=[];for(let M=0,w=o.length;M<w;M++)h=o[M],R=h.getPoints(),l=i(R),l=e?!l:l,l?(!_&&y[b]&&b++,y[b]={s:new Ou,p:R},y[b].s.curves=h.curves,_&&b++,x[b]=[]):x[b].push({h,p:R[0]});if(!y[0])return t(o);if(y.length>1){let M=!1,w=0;for(let D=0,U=y.length;D<U;D++)v[D]=[];for(let D=0,U=y.length;D<U;D++){const F=x[D];for(let O=0;O<F.length;O++){const z=F[O];let k=!0;for(let N=0;N<y.length;N++)n(z.p,y[N].p)&&(D!==N&&w++,k?(k=!1,v[N].push(z)):M=!0);k&&v[D].push(z)}}w>0&&M===!1&&(x=v)}let T;for(let M=0,w=y.length;M<w;M++){d=y[M].s,p.push(d),T=x[M];for(let D=0,U=T.length;D<U;D++)d.holes.push(T[D].h)}return p}}class qB extends Eo{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Et("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function KB(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function WB(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function jB(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function RA(s,e,t,n){const i=ZB(n);switch(t){case ax:return s*e;case ip:return s*e/i.components*i.byteLength;case ap:return s*e/i.components*i.byteLength;case xu:return s*e*2/i.components*i.byteLength;case zg:return s*e*2/i.components*i.byteLength;case sx:return s*e*3/i.components*i.byteLength;case ji:return s*e*4/i.components*i.byteLength;case Vg:return s*e*4/i.components*i.byteLength;case sp:case rp:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case op:case lp:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Xg:case Jg:return Math.max(s,16)*Math.max(e,8)/4;case kg:case Yg:return Math.max(s,8)*Math.max(e,8)/2;case qg:case Kg:case jg:case Zg:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Wg:case Qg:case $g:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case e0:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case t0:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case n0:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case i0:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case a0:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case s0:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case r0:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case o0:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case l0:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case c0:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case u0:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case f0:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case h0:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case d0:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case p0:case m0:case g0:return Math.ceil(s/4)*Math.ceil(e/4)*16;case v0:case _0:return Math.ceil(s/4)*Math.ceil(e/4)*8;case y0:case x0:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function ZB(s){switch(s){case Ma:case Fg:return{byteLength:1,components:1};case Zf:case Hg:case Hi:return{byteLength:2,components:1};case Pg:case Gg:return{byteLength:2,components:4};case js:case np:case Ai:return{byteLength:4,components:1};case nx:case ix:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}class QB{static contain(e,t){return KB(e,t)}static cover(e,t){return WB(e,t)}static fill(e){return jB(e)}static getByteLength(e,t,n,i){return RA(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zd}})),typeof window<"u"&&(window.__THREE__?Et("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zd);function pE(){let s=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){s=o}}}function $B(s){const e=new WeakMap;function t(h,d){const p=h.array,_=h.usage,v=p.byteLength,y=s.createBuffer();s.bindBuffer(d,y),s.bufferData(d,p,_),h.onUploadCallback();let x;if(p instanceof Float32Array)x=s.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)x=s.HALF_FLOAT;else if(p instanceof Uint16Array)h.isFloat16BufferAttribute?x=s.HALF_FLOAT:x=s.UNSIGNED_SHORT;else if(p instanceof Int16Array)x=s.SHORT;else if(p instanceof Uint32Array)x=s.UNSIGNED_INT;else if(p instanceof Int32Array)x=s.INT;else if(p instanceof Int8Array)x=s.BYTE;else if(p instanceof Uint8Array)x=s.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)x=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:y,type:x,bytesPerElement:p.BYTES_PER_ELEMENT,version:h.version,size:v}}function n(h,d,p){const _=d.array,v=d.updateRanges;if(s.bindBuffer(p,h),v.length===0)s.bufferSubData(p,0,_);else{v.sort((x,b)=>x.start-b.start);let y=0;for(let x=1;x<v.length;x++){const b=v[y],R=v[x];R.start<=b.start+b.count+1?b.count=Math.max(b.count,R.start+R.count-b.start):(++y,v[y]=R)}v.length=y+1;for(let x=0,b=v.length;x<b;x++){const R=v[x];s.bufferSubData(p,R.start*_.BYTES_PER_ELEMENT,_,R.start,R.count)}d.clearUpdateRanges()}d.onUploadCallback()}function i(h){return h.isInterleavedBufferAttribute&&(h=h.data),e.get(h)}function o(h){h.isInterleavedBufferAttribute&&(h=h.data);const d=e.get(h);d&&(s.deleteBuffer(d.buffer),e.delete(h))}function l(h,d){if(h.isInterleavedBufferAttribute&&(h=h.data),h.isGLBufferAttribute){const _=e.get(h);(!_||_.version<h.version)&&e.set(h,{buffer:h.buffer,type:h.type,bytesPerElement:h.elementSize,version:h.version});return}const p=e.get(h);if(p===void 0)e.set(h,t(h,d));else if(p.version<h.version){if(p.size!==h.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(p.buffer,h,d),p.version=h.version}}return{get:i,remove:o,update:l}}var e3=`#ifdef USE_ALPHAHASH
|
|
49
49
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
50
50
|
#endif`,t3=`#ifdef USE_ALPHAHASH
|
|
51
51
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -3868,7 +3868,7 @@ void main() {
|
|
|
3868
3868
|
gl_Position = vec4( position, 1.0 );
|
|
3869
3869
|
|
|
3870
3870
|
}
|
|
3871
|
-
`}function fU(s){let e=new WeakMap,t=null;function n(h){if(h&&h.isTexture){const d=h.mapping,p=d===Wf||d===ep,_=d===Yr||d===oc;if(p||_){let v=e.get(h);const y=v!==void 0?v.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==y)return t===null&&(t=new NA(s)),v=p?t.fromEquirectangular(h,v):t.fromCubemap(h,v),v.texture.pmremVersion=h.pmremVersion,e.set(h,v),v.texture;if(v!==void 0)return v.texture;{const x=h.image;return p&&x&&x.height>0||_&&x&&i(x)?(t===null&&(t=new NA(s)),v=p?t.fromEquirectangular(h):t.fromCubemap(h),v.texture.pmremVersion=h.pmremVersion,e.set(h,v),h.addEventListener("dispose",o),v.texture):null}}}return h}function i(h){let d=0;const p=6;for(let _=0;_<p;_++)h[_]!==void 0&&d++;return d===p}function o(h){const d=h.target;d.removeEventListener("dispose",o);const p=e.get(d);p!==void 0&&(e.delete(d),p.dispose())}function l(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:l}}function hU(s){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=s.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&th("WebGLRenderer: "+n+" extension not supported."),i}}}function dU(s,e,t,n){const i={},o=new WeakMap;function l(v){const y=v.target;y.index!==null&&e.remove(y.index);for(const b in y.attributes)e.remove(y.attributes[b]);y.removeEventListener("dispose",l),delete i[y.id];const x=o.get(y);x&&(e.remove(x),o.delete(y)),n.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,t.memory.geometries--}function h(v,y){return i[y.id]===!0||(y.addEventListener("dispose",l),i[y.id]=!0,t.memory.geometries++),y}function d(v){const y=v.attributes;for(const x in y)e.update(y[x],s.ARRAY_BUFFER)}function p(v){const y=[],x=v.index,b=v.attributes.position;let R=0;if(x!==null){const w=x.array;R=x.version;for(let D=0,U=w.length;D<U;D+=3){const F=w[D+0],O=w[D+1],z=w[D+2];y.push(F,O,O,z,z,F)}}else if(b!==void 0){const w=b.array;R=b.version;for(let D=0,U=w.length/3-1;D<U;D+=3){const F=D+0,O=D+1,z=D+2;y.push(F,O,O,z,z,F)}}else return;const T=new(hb(y)?Dx:Bx)(y,1);T.version=R;const M=o.get(v);M&&e.remove(M),o.set(v,T)}function _(v){const y=o.get(v);if(y){const x=v.index;x!==null&&y.version<x.version&&p(v)}else p(v);return o.get(v)}return{get:h,update:d,getWireframeAttribute:_}}function pU(s,e,t){let n;function i(y){n=y}let o,l;function h(y){o=y.type,l=y.bytesPerElement}function d(y,x){s.drawElements(n,x,o,y*l),t.update(x,n,1)}function p(y,x,b){b!==0&&(s.drawElementsInstanced(n,x,o,y*l,b),t.update(x,n,b))}function _(y,x,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,x,0,o,y,0,b);let T=0;for(let M=0;M<b;M++)T+=x[M];t.update(T,n,1)}function v(y,x,b,R){if(b===0)return;const T=e.get("WEBGL_multi_draw");if(T===null)for(let M=0;M<y.length;M++)p(y[M]/l,x[M],R[M]);else{T.multiDrawElementsInstancedWEBGL(n,x,0,o,y,0,R,0,b);let M=0;for(let w=0;w<b;w++)M+=x[w]*R[w];t.update(M,n,1)}}this.setMode=i,this.setIndex=h,this.render=d,this.renderInstances=p,this.renderMultiDraw=_,this.renderMultiDrawInstances=v}function mU(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(o,l,h){switch(t.calls++,l){case s.TRIANGLES:t.triangles+=h*(o/3);break;case s.LINES:t.lines+=h*(o/2);break;case s.LINE_STRIP:t.lines+=h*(o-1);break;case s.LINE_LOOP:t.lines+=h*o;break;case s.POINTS:t.points+=h*o;break;default:Wt("WebGLInfo: Unknown draw mode:",l);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function gU(s,e,t){const n=new WeakMap,i=new ci;function o(l,h,d){const p=l.morphTargetInfluences,_=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,v=_!==void 0?_.length:0;let y=n.get(h);if(y===void 0||y.count!==v){let N=function(){z.dispose(),n.delete(h),h.removeEventListener("dispose",N)};y!==void 0&&y.texture.dispose();const x=h.morphAttributes.position!==void 0,b=h.morphAttributes.normal!==void 0,R=h.morphAttributes.color!==void 0,T=h.morphAttributes.position||[],M=h.morphAttributes.normal||[],w=h.morphAttributes.color||[];let D=0;x===!0&&(D=1),b===!0&&(D=2),R===!0&&(D=3);let U=h.attributes.position.count*D,F=1;U>e.maxTextureSize&&(F=Math.ceil(U/e.maxTextureSize),U=e.maxTextureSize);const O=new Float32Array(U*F*4*v),z=new T0(O,U,F,v);z.type=Ai,z.needsUpdate=!0;const k=D*4;for(let I=0;I<v;I++){const W=T[I],ae=M[I],ie=w[I],se=U*F*4*I;for(let _e=0;_e<W.count;_e++){const H=_e*k;x===!0&&(i.fromBufferAttribute(W,_e),O[se+H+0]=i.x,O[se+H+1]=i.y,O[se+H+2]=i.z,O[se+H+3]=0),b===!0&&(i.fromBufferAttribute(ae,_e),O[se+H+4]=i.x,O[se+H+5]=i.y,O[se+H+6]=i.z,O[se+H+7]=0),R===!0&&(i.fromBufferAttribute(ie,_e),O[se+H+8]=i.x,O[se+H+9]=i.y,O[se+H+10]=i.z,O[se+H+11]=ie.itemSize===4?i.w:1)}}y={count:v,texture:z,size:new et(U,F)},n.set(h,y),h.addEventListener("dispose",N)}if(l.isInstancedMesh===!0&&l.morphTexture!==null)d.getUniforms().setValue(s,"morphTexture",l.morphTexture,t);else{let x=0;for(let R=0;R<p.length;R++)x+=p[R];const b=h.morphTargetsRelative?1:1-x;d.getUniforms().setValue(s,"morphTargetBaseInfluence",b),d.getUniforms().setValue(s,"morphTargetInfluences",p)}d.getUniforms().setValue(s,"morphTargetsTexture",y.texture,t),d.getUniforms().setValue(s,"morphTargetsTextureSize",y.size)}return{update:o}}function vU(s,e,t,n){let i=new WeakMap;function o(d){const p=n.render.frame,_=d.geometry,v=e.get(d,_);if(i.get(v)!==p&&(e.update(v),i.set(v,p)),d.isInstancedMesh&&(d.hasEventListener("dispose",h)===!1&&d.addEventListener("dispose",h),i.get(d)!==p&&(t.update(d.instanceMatrix,s.ARRAY_BUFFER),d.instanceColor!==null&&t.update(d.instanceColor,s.ARRAY_BUFFER),i.set(d,p))),d.isSkinnedMesh){const y=d.skeleton;i.get(y)!==p&&(y.update(),i.set(y,p))}return v}function l(){i=new WeakMap}function h(d){const p=d.target;p.removeEventListener("dispose",h),t.remove(p.instanceMatrix),p.instanceColor!==null&&t.remove(p.instanceColor)}return{update:o,dispose:l}}const _U={[Ky]:"LINEAR_TONE_MAPPING",[Wy]:"REINHARD_TONE_MAPPING",[jy]:"CINEON_TONE_MAPPING",[Ig]:"ACES_FILMIC_TONE_MAPPING",[Qy]:"AGX_TONE_MAPPING",[$y]:"NEUTRAL_TONE_MAPPING",[Zy]:"CUSTOM_TONE_MAPPING"};function yU(s,e,t,n,i){const o=new ds(e,t,{type:s,depthBuffer:n,stencilBuffer:i}),l=new ds(e,t,{type:Hi,depthBuffer:!1,stencilBuffer:!1}),h=new on;h.setAttribute("position",new
|
|
3871
|
+
`}function fU(s){let e=new WeakMap,t=null;function n(h){if(h&&h.isTexture){const d=h.mapping,p=d===Wf||d===ep,_=d===Yr||d===oc;if(p||_){let v=e.get(h);const y=v!==void 0?v.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==y)return t===null&&(t=new NA(s)),v=p?t.fromEquirectangular(h,v):t.fromCubemap(h,v),v.texture.pmremVersion=h.pmremVersion,e.set(h,v),v.texture;if(v!==void 0)return v.texture;{const x=h.image;return p&&x&&x.height>0||_&&x&&i(x)?(t===null&&(t=new NA(s)),v=p?t.fromEquirectangular(h):t.fromCubemap(h),v.texture.pmremVersion=h.pmremVersion,e.set(h,v),h.addEventListener("dispose",o),v.texture):null}}}return h}function i(h){let d=0;const p=6;for(let _=0;_<p;_++)h[_]!==void 0&&d++;return d===p}function o(h){const d=h.target;d.removeEventListener("dispose",o);const p=e.get(d);p!==void 0&&(e.delete(d),p.dispose())}function l(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:l}}function hU(s){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=s.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&th("WebGLRenderer: "+n+" extension not supported."),i}}}function dU(s,e,t,n){const i={},o=new WeakMap;function l(v){const y=v.target;y.index!==null&&e.remove(y.index);for(const b in y.attributes)e.remove(y.attributes[b]);y.removeEventListener("dispose",l),delete i[y.id];const x=o.get(y);x&&(e.remove(x),o.delete(y)),n.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,t.memory.geometries--}function h(v,y){return i[y.id]===!0||(y.addEventListener("dispose",l),i[y.id]=!0,t.memory.geometries++),y}function d(v){const y=v.attributes;for(const x in y)e.update(y[x],s.ARRAY_BUFFER)}function p(v){const y=[],x=v.index,b=v.attributes.position;let R=0;if(x!==null){const w=x.array;R=x.version;for(let D=0,U=w.length;D<U;D+=3){const F=w[D+0],O=w[D+1],z=w[D+2];y.push(F,O,O,z,z,F)}}else if(b!==void 0){const w=b.array;R=b.version;for(let D=0,U=w.length/3-1;D<U;D+=3){const F=D+0,O=D+1,z=D+2;y.push(F,O,O,z,z,F)}}else return;const T=new(hb(y)?Dx:Bx)(y,1);T.version=R;const M=o.get(v);M&&e.remove(M),o.set(v,T)}function _(v){const y=o.get(v);if(y){const x=v.index;x!==null&&y.version<x.version&&p(v)}else p(v);return o.get(v)}return{get:h,update:d,getWireframeAttribute:_}}function pU(s,e,t){let n;function i(y){n=y}let o,l;function h(y){o=y.type,l=y.bytesPerElement}function d(y,x){s.drawElements(n,x,o,y*l),t.update(x,n,1)}function p(y,x,b){b!==0&&(s.drawElementsInstanced(n,x,o,y*l,b),t.update(x,n,b))}function _(y,x,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,x,0,o,y,0,b);let T=0;for(let M=0;M<b;M++)T+=x[M];t.update(T,n,1)}function v(y,x,b,R){if(b===0)return;const T=e.get("WEBGL_multi_draw");if(T===null)for(let M=0;M<y.length;M++)p(y[M]/l,x[M],R[M]);else{T.multiDrawElementsInstancedWEBGL(n,x,0,o,y,0,R,0,b);let M=0;for(let w=0;w<b;w++)M+=x[w]*R[w];t.update(M,n,1)}}this.setMode=i,this.setIndex=h,this.render=d,this.renderInstances=p,this.renderMultiDraw=_,this.renderMultiDrawInstances=v}function mU(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(o,l,h){switch(t.calls++,l){case s.TRIANGLES:t.triangles+=h*(o/3);break;case s.LINES:t.lines+=h*(o/2);break;case s.LINE_STRIP:t.lines+=h*(o-1);break;case s.LINE_LOOP:t.lines+=h*o;break;case s.POINTS:t.points+=h*o;break;default:Wt("WebGLInfo: Unknown draw mode:",l);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function gU(s,e,t){const n=new WeakMap,i=new ci;function o(l,h,d){const p=l.morphTargetInfluences,_=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,v=_!==void 0?_.length:0;let y=n.get(h);if(y===void 0||y.count!==v){let N=function(){z.dispose(),n.delete(h),h.removeEventListener("dispose",N)};y!==void 0&&y.texture.dispose();const x=h.morphAttributes.position!==void 0,b=h.morphAttributes.normal!==void 0,R=h.morphAttributes.color!==void 0,T=h.morphAttributes.position||[],M=h.morphAttributes.normal||[],w=h.morphAttributes.color||[];let D=0;x===!0&&(D=1),b===!0&&(D=2),R===!0&&(D=3);let U=h.attributes.position.count*D,F=1;U>e.maxTextureSize&&(F=Math.ceil(U/e.maxTextureSize),U=e.maxTextureSize);const O=new Float32Array(U*F*4*v),z=new T0(O,U,F,v);z.type=Ai,z.needsUpdate=!0;const k=D*4;for(let I=0;I<v;I++){const W=T[I],ae=M[I],ie=w[I],se=U*F*4*I;for(let _e=0;_e<W.count;_e++){const H=_e*k;x===!0&&(i.fromBufferAttribute(W,_e),O[se+H+0]=i.x,O[se+H+1]=i.y,O[se+H+2]=i.z,O[se+H+3]=0),b===!0&&(i.fromBufferAttribute(ae,_e),O[se+H+4]=i.x,O[se+H+5]=i.y,O[se+H+6]=i.z,O[se+H+7]=0),R===!0&&(i.fromBufferAttribute(ie,_e),O[se+H+8]=i.x,O[se+H+9]=i.y,O[se+H+10]=i.z,O[se+H+11]=ie.itemSize===4?i.w:1)}}y={count:v,texture:z,size:new et(U,F)},n.set(h,y),h.addEventListener("dispose",N)}if(l.isInstancedMesh===!0&&l.morphTexture!==null)d.getUniforms().setValue(s,"morphTexture",l.morphTexture,t);else{let x=0;for(let R=0;R<p.length;R++)x+=p[R];const b=h.morphTargetsRelative?1:1-x;d.getUniforms().setValue(s,"morphTargetBaseInfluence",b),d.getUniforms().setValue(s,"morphTargetInfluences",p)}d.getUniforms().setValue(s,"morphTargetsTexture",y.texture,t),d.getUniforms().setValue(s,"morphTargetsTextureSize",y.size)}return{update:o}}function vU(s,e,t,n){let i=new WeakMap;function o(d){const p=n.render.frame,_=d.geometry,v=e.get(d,_);if(i.get(v)!==p&&(e.update(v),i.set(v,p)),d.isInstancedMesh&&(d.hasEventListener("dispose",h)===!1&&d.addEventListener("dispose",h),i.get(d)!==p&&(t.update(d.instanceMatrix,s.ARRAY_BUFFER),d.instanceColor!==null&&t.update(d.instanceColor,s.ARRAY_BUFFER),i.set(d,p))),d.isSkinnedMesh){const y=d.skeleton;i.get(y)!==p&&(y.update(),i.set(y,p))}return v}function l(){i=new WeakMap}function h(d){const p=d.target;p.removeEventListener("dispose",h),t.remove(p.instanceMatrix),p.instanceColor!==null&&t.remove(p.instanceColor)}return{update:o,dispose:l}}const _U={[Ky]:"LINEAR_TONE_MAPPING",[Wy]:"REINHARD_TONE_MAPPING",[jy]:"CINEON_TONE_MAPPING",[Ig]:"ACES_FILMIC_TONE_MAPPING",[Qy]:"AGX_TONE_MAPPING",[$y]:"NEUTRAL_TONE_MAPPING",[Zy]:"CUSTOM_TONE_MAPPING"};function yU(s,e,t,n,i){const o=new ds(e,t,{type:s,depthBuffer:n,stencilBuffer:i}),l=new ds(e,t,{type:Hi,depthBuffer:!1,stencilBuffer:!1}),h=new on;h.setAttribute("position",new Pt([-1,3,0,-1,-1,0,3,-1,0],3)),h.setAttribute("uv",new Pt([0,2,0,0,2,0],2));const d=new nA({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
3872
3872
|
precision highp float;
|
|
3873
3873
|
|
|
3874
3874
|
uniform mat4 modelViewMatrix;
|
|
@@ -4016,7 +4016,7 @@ void main() {
|
|
|
4016
4016
|
|
|
4017
4017
|
}
|
|
4018
4018
|
|
|
4019
|
-
}`;class sL{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new kx(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ms({vertexShader:iL,fragmentShader:aL,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new pi(new Mc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class rL extends Eo{constructor(e,t){super();const n=this;let i=null,o=1,l=null,h="local-floor",d=1,p=null,_=null,v=null,y=null,x=null,b=null;const R=typeof XRWebGLBinding<"u",T=new sL,M={},w=t.getContextAttributes();let D=null,U=null;const F=[],O=[],z=new et;let k=null;const N=new ia;N.viewport=new ci;const I=new ia;I.viewport=new ci;const W=[N,I],ae=new Z1;let ie=null,se=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ve){let Be=F[ve];return Be===void 0&&(Be=new J0,F[ve]=Be),Be.getTargetRaySpace()},this.getControllerGrip=function(ve){let Be=F[ve];return Be===void 0&&(Be=new J0,F[ve]=Be),Be.getGripSpace()},this.getHand=function(ve){let Be=F[ve];return Be===void 0&&(Be=new J0,F[ve]=Be),Be.getHandSpace()};function _e(ve){const Be=O.indexOf(ve.inputSource);if(Be===-1)return;const st=F[Be];st!==void 0&&(st.update(ve.inputSource,ve.frame,p||l),st.dispatchEvent({type:ve.type,data:ve.inputSource}))}function H(){i.removeEventListener("select",_e),i.removeEventListener("selectstart",_e),i.removeEventListener("selectend",_e),i.removeEventListener("squeeze",_e),i.removeEventListener("squeezestart",_e),i.removeEventListener("squeezeend",_e),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",K);for(let ve=0;ve<F.length;ve++){const Be=O[ve];Be!==null&&(O[ve]=null,F[ve].disconnect(Be))}ie=null,se=null,T.reset();for(const ve in M)delete M[ve];e.setRenderTarget(D),x=null,y=null,v=null,i=null,U=null,rt.stop(),n.isPresenting=!1,e.setPixelRatio(k),e.setSize(z.width,z.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ve){o=ve,n.isPresenting===!0&&Et("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ve){h=ve,n.isPresenting===!0&&Et("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return p||l},this.setReferenceSpace=function(ve){p=ve},this.getBaseLayer=function(){return y!==null?y:x},this.getBinding=function(){return v===null&&R&&(v=new XRWebGLBinding(i,t)),v},this.getFrame=function(){return b},this.getSession=function(){return i},this.setSession=async function(ve){if(i=ve,i!==null){if(D=e.getRenderTarget(),i.addEventListener("select",_e),i.addEventListener("selectstart",_e),i.addEventListener("selectend",_e),i.addEventListener("squeeze",_e),i.addEventListener("squeezestart",_e),i.addEventListener("squeezeend",_e),i.addEventListener("end",H),i.addEventListener("inputsourceschange",K),w.xrCompatible!==!0&&await t.makeXRCompatible(),k=e.getPixelRatio(),e.getSize(z),R&&"createProjectionLayer"in XRWebGLBinding.prototype){let st=null,xt=null,Mt=null;w.depth&&(Mt=w.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,st=w.stencil?cc:bo,xt=w.stencil?Qf:js);const $t={colorFormat:t.RGBA8,depthFormat:Mt,scaleFactor:o};v=this.getBinding(),y=v.createProjectionLayer($t),i.updateRenderState({layers:[y]}),e.setPixelRatio(1),e.setSize(y.textureWidth,y.textureHeight,!1),U=new ds(y.textureWidth,y.textureHeight,{format:ji,type:Ma,depthTexture:new Ch(y.textureWidth,y.textureHeight,xt,void 0,void 0,void 0,void 0,void 0,void 0,st),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:y.ignoreDepthValues===!1,resolveStencilBuffer:y.ignoreDepthValues===!1})}else{const st={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:o};x=new XRWebGLLayer(i,t,st),i.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),U=new ds(x.framebufferWidth,x.framebufferHeight,{format:ji,type:Ma,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}U.isXRRenderTarget=!0,this.setFoveation(d),p=null,l=await i.requestReferenceSpace(h),rt.setContext(i),rt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return T.getDepthTexture()};function K(ve){for(let Be=0;Be<ve.removed.length;Be++){const st=ve.removed[Be],xt=O.indexOf(st);xt>=0&&(O[xt]=null,F[xt].disconnect(st))}for(let Be=0;Be<ve.added.length;Be++){const st=ve.added[Be];let xt=O.indexOf(st);if(xt===-1){for(let $t=0;$t<F.length;$t++)if($t>=O.length){O.push(st),xt=$t;break}else if(O[$t]===null){O[$t]=st,xt=$t;break}if(xt===-1)break}const Mt=F[xt];Mt&&Mt.connect(st)}}const $=new Q,ue=new Q;function re(ve,Be,st){$.setFromMatrixPosition(Be.matrixWorld),ue.setFromMatrixPosition(st.matrixWorld);const xt=$.distanceTo(ue),Mt=Be.projectionMatrix.elements,$t=st.projectionMatrix.elements,un=Mt[14]/(Mt[10]-1),Vt=Mt[14]/(Mt[10]+1),Ve=(Mt[9]+1)/Mt[5],nt=(Mt[9]-1)/Mt[5],Ge=(Mt[8]-1)/Mt[0],ft=($t[8]+1)/$t[0],ee=un*Ge,Nt=un*ft,pt=xt/(-Ge+ft),Lt=pt*-Ge;if(Be.matrixWorld.decompose(ve.position,ve.quaternion,ve.scale),ve.translateX(Lt),ve.translateZ(pt),ve.matrixWorld.compose(ve.position,ve.quaternion,ve.scale),ve.matrixWorldInverse.copy(ve.matrixWorld).invert(),Mt[10]===-1)ve.projectionMatrix.copy(Be.projectionMatrix),ve.projectionMatrixInverse.copy(Be.projectionMatrixInverse);else{const gt=un+pt,Z=Vt+pt,P=ee-Lt,me=Nt+(xt-Lt),Le=Ve*Vt/Z*gt,Xe=nt*Vt/Z*gt;ve.projectionMatrix.makePerspective(P,me,Le,Xe,gt,Z),ve.projectionMatrixInverse.copy(ve.projectionMatrix).invert()}}function X(ve,Be){Be===null?ve.matrixWorld.copy(ve.matrix):ve.matrixWorld.multiplyMatrices(Be.matrixWorld,ve.matrix),ve.matrixWorldInverse.copy(ve.matrixWorld).invert()}this.updateCamera=function(ve){if(i===null)return;let Be=ve.near,st=ve.far;T.texture!==null&&(T.depthNear>0&&(Be=T.depthNear),T.depthFar>0&&(st=T.depthFar)),ae.near=I.near=N.near=Be,ae.far=I.far=N.far=st,(ie!==ae.near||se!==ae.far)&&(i.updateRenderState({depthNear:ae.near,depthFar:ae.far}),ie=ae.near,se=ae.far),ae.layers.mask=ve.layers.mask|6,N.layers.mask=ae.layers.mask&3,I.layers.mask=ae.layers.mask&5;const xt=ve.parent,Mt=ae.cameras;X(ae,xt);for(let $t=0;$t<Mt.length;$t++)X(Mt[$t],xt);Mt.length===2?re(ae,N,I):ae.projectionMatrix.copy(N.projectionMatrix),ne(ve,ae,xt)};function ne(ve,Be,st){st===null?ve.matrix.copy(Be.matrixWorld):(ve.matrix.copy(st.matrixWorld),ve.matrix.invert(),ve.matrix.multiply(Be.matrixWorld)),ve.matrix.decompose(ve.position,ve.quaternion,ve.scale),ve.updateMatrixWorld(!0),ve.projectionMatrix.copy(Be.projectionMatrix),ve.projectionMatrixInverse.copy(Be.projectionMatrixInverse),ve.isPerspectiveCamera&&(ve.fov=nh*2*Math.atan(1/ve.projectionMatrix.elements[5]),ve.zoom=1)}this.getCamera=function(){return ae},this.getFoveation=function(){if(!(y===null&&x===null))return d},this.setFoveation=function(ve){d=ve,y!==null&&(y.fixedFoveation=ve),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=ve)},this.hasDepthSensing=function(){return T.texture!==null},this.getDepthSensingMesh=function(){return T.getMesh(ae)},this.getCameraTexture=function(ve){return M[ve]};let Ae=null;function Re(ve,Be){if(_=Be.getViewerPose(p||l),b=Be,_!==null){const st=_.views;x!==null&&(e.setRenderTargetFramebuffer(U,x.framebuffer),e.setRenderTarget(U));let xt=!1;st.length!==ae.cameras.length&&(ae.cameras.length=0,xt=!0);for(let Vt=0;Vt<st.length;Vt++){const Ve=st[Vt];let nt=null;if(x!==null)nt=x.getViewport(Ve);else{const ft=v.getViewSubImage(y,Ve);nt=ft.viewport,Vt===0&&(e.setRenderTargetTextures(U,ft.colorTexture,ft.depthStencilTexture),e.setRenderTarget(U))}let Ge=W[Vt];Ge===void 0&&(Ge=new ia,Ge.layers.enable(Vt),Ge.viewport=new ci,W[Vt]=Ge),Ge.matrix.fromArray(Ve.transform.matrix),Ge.matrix.decompose(Ge.position,Ge.quaternion,Ge.scale),Ge.projectionMatrix.fromArray(Ve.projectionMatrix),Ge.projectionMatrixInverse.copy(Ge.projectionMatrix).invert(),Ge.viewport.set(nt.x,nt.y,nt.width,nt.height),Vt===0&&(ae.matrix.copy(Ge.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale)),xt===!0&&ae.cameras.push(Ge)}const Mt=i.enabledFeatures;if(Mt&&Mt.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&R){v=n.getBinding();const Vt=v.getDepthInformation(st[0]);Vt&&Vt.isValid&&Vt.texture&&T.init(Vt,i.renderState)}if(Mt&&Mt.includes("camera-access")&&R){e.state.unbindTexture(),v=n.getBinding();for(let Vt=0;Vt<st.length;Vt++){const Ve=st[Vt].camera;if(Ve){let nt=M[Ve];nt||(nt=new kx,M[Ve]=nt);const Ge=v.getCameraImage(Ve);nt.sourceTexture=Ge}}}}for(let st=0;st<F.length;st++){const xt=O[st],Mt=F[st];xt!==null&&Mt!==void 0&&Mt.update(xt,Be,p||l)}Ae&&Ae(ve,Be),Be.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Be}),b=null}const rt=new pE;rt.setAnimationLoop(Re),this.setAnimationLoop=function(ve){Ae=ve},this.dispose=function(){}}}const Zu=new er,oL=new Qt;function lL(s,e){function t(T,M){T.matrixAutoUpdate===!0&&T.updateMatrix(),M.value.copy(T.matrix)}function n(T,M){M.color.getRGB(T.fogColor.value,Nb(s)),M.isFog?(T.fogNear.value=M.near,T.fogFar.value=M.far):M.isFogExp2&&(T.fogDensity.value=M.density)}function i(T,M,w,D,U){M.isMeshBasicMaterial||M.isMeshLambertMaterial?o(T,M):M.isMeshToonMaterial?(o(T,M),v(T,M)):M.isMeshPhongMaterial?(o(T,M),_(T,M)):M.isMeshStandardMaterial?(o(T,M),y(T,M),M.isMeshPhysicalMaterial&&x(T,M,U)):M.isMeshMatcapMaterial?(o(T,M),b(T,M)):M.isMeshDepthMaterial?o(T,M):M.isMeshDistanceMaterial?(o(T,M),R(T,M)):M.isMeshNormalMaterial?o(T,M):M.isLineBasicMaterial?(l(T,M),M.isLineDashedMaterial&&h(T,M)):M.isPointsMaterial?d(T,M,w,D):M.isSpriteMaterial?p(T,M):M.isShadowMaterial?(T.color.value.copy(M.color),T.opacity.value=M.opacity):M.isShaderMaterial&&(M.uniformsNeedUpdate=!1)}function o(T,M){T.opacity.value=M.opacity,M.color&&T.diffuse.value.copy(M.color),M.emissive&&T.emissive.value.copy(M.emissive).multiplyScalar(M.emissiveIntensity),M.map&&(T.map.value=M.map,t(M.map,T.mapTransform)),M.alphaMap&&(T.alphaMap.value=M.alphaMap,t(M.alphaMap,T.alphaMapTransform)),M.bumpMap&&(T.bumpMap.value=M.bumpMap,t(M.bumpMap,T.bumpMapTransform),T.bumpScale.value=M.bumpScale,M.side===fs&&(T.bumpScale.value*=-1)),M.normalMap&&(T.normalMap.value=M.normalMap,t(M.normalMap,T.normalMapTransform),T.normalScale.value.copy(M.normalScale),M.side===fs&&T.normalScale.value.negate()),M.displacementMap&&(T.displacementMap.value=M.displacementMap,t(M.displacementMap,T.displacementMapTransform),T.displacementScale.value=M.displacementScale,T.displacementBias.value=M.displacementBias),M.emissiveMap&&(T.emissiveMap.value=M.emissiveMap,t(M.emissiveMap,T.emissiveMapTransform)),M.specularMap&&(T.specularMap.value=M.specularMap,t(M.specularMap,T.specularMapTransform)),M.alphaTest>0&&(T.alphaTest.value=M.alphaTest);const w=e.get(M),D=w.envMap,U=w.envMapRotation;D&&(T.envMap.value=D,Zu.copy(U),Zu.x*=-1,Zu.y*=-1,Zu.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Zu.y*=-1,Zu.z*=-1),T.envMapRotation.value.setFromMatrix4(oL.makeRotationFromEuler(Zu)),T.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,T.reflectivity.value=M.reflectivity,T.ior.value=M.ior,T.refractionRatio.value=M.refractionRatio),M.lightMap&&(T.lightMap.value=M.lightMap,T.lightMapIntensity.value=M.lightMapIntensity,t(M.lightMap,T.lightMapTransform)),M.aoMap&&(T.aoMap.value=M.aoMap,T.aoMapIntensity.value=M.aoMapIntensity,t(M.aoMap,T.aoMapTransform))}function l(T,M){T.diffuse.value.copy(M.color),T.opacity.value=M.opacity,M.map&&(T.map.value=M.map,t(M.map,T.mapTransform))}function h(T,M){T.dashSize.value=M.dashSize,T.totalSize.value=M.dashSize+M.gapSize,T.scale.value=M.scale}function d(T,M,w,D){T.diffuse.value.copy(M.color),T.opacity.value=M.opacity,T.size.value=M.size*w,T.scale.value=D*.5,M.map&&(T.map.value=M.map,t(M.map,T.uvTransform)),M.alphaMap&&(T.alphaMap.value=M.alphaMap,t(M.alphaMap,T.alphaMapTransform)),M.alphaTest>0&&(T.alphaTest.value=M.alphaTest)}function p(T,M){T.diffuse.value.copy(M.color),T.opacity.value=M.opacity,T.rotation.value=M.rotation,M.map&&(T.map.value=M.map,t(M.map,T.mapTransform)),M.alphaMap&&(T.alphaMap.value=M.alphaMap,t(M.alphaMap,T.alphaMapTransform)),M.alphaTest>0&&(T.alphaTest.value=M.alphaTest)}function _(T,M){T.specular.value.copy(M.specular),T.shininess.value=Math.max(M.shininess,1e-4)}function v(T,M){M.gradientMap&&(T.gradientMap.value=M.gradientMap)}function y(T,M){T.metalness.value=M.metalness,M.metalnessMap&&(T.metalnessMap.value=M.metalnessMap,t(M.metalnessMap,T.metalnessMapTransform)),T.roughness.value=M.roughness,M.roughnessMap&&(T.roughnessMap.value=M.roughnessMap,t(M.roughnessMap,T.roughnessMapTransform)),M.envMap&&(T.envMapIntensity.value=M.envMapIntensity)}function x(T,M,w){T.ior.value=M.ior,M.sheen>0&&(T.sheenColor.value.copy(M.sheenColor).multiplyScalar(M.sheen),T.sheenRoughness.value=M.sheenRoughness,M.sheenColorMap&&(T.sheenColorMap.value=M.sheenColorMap,t(M.sheenColorMap,T.sheenColorMapTransform)),M.sheenRoughnessMap&&(T.sheenRoughnessMap.value=M.sheenRoughnessMap,t(M.sheenRoughnessMap,T.sheenRoughnessMapTransform))),M.clearcoat>0&&(T.clearcoat.value=M.clearcoat,T.clearcoatRoughness.value=M.clearcoatRoughness,M.clearcoatMap&&(T.clearcoatMap.value=M.clearcoatMap,t(M.clearcoatMap,T.clearcoatMapTransform)),M.clearcoatRoughnessMap&&(T.clearcoatRoughnessMap.value=M.clearcoatRoughnessMap,t(M.clearcoatRoughnessMap,T.clearcoatRoughnessMapTransform)),M.clearcoatNormalMap&&(T.clearcoatNormalMap.value=M.clearcoatNormalMap,t(M.clearcoatNormalMap,T.clearcoatNormalMapTransform),T.clearcoatNormalScale.value.copy(M.clearcoatNormalScale),M.side===fs&&T.clearcoatNormalScale.value.negate())),M.dispersion>0&&(T.dispersion.value=M.dispersion),M.iridescence>0&&(T.iridescence.value=M.iridescence,T.iridescenceIOR.value=M.iridescenceIOR,T.iridescenceThicknessMinimum.value=M.iridescenceThicknessRange[0],T.iridescenceThicknessMaximum.value=M.iridescenceThicknessRange[1],M.iridescenceMap&&(T.iridescenceMap.value=M.iridescenceMap,t(M.iridescenceMap,T.iridescenceMapTransform)),M.iridescenceThicknessMap&&(T.iridescenceThicknessMap.value=M.iridescenceThicknessMap,t(M.iridescenceThicknessMap,T.iridescenceThicknessMapTransform))),M.transmission>0&&(T.transmission.value=M.transmission,T.transmissionSamplerMap.value=w.texture,T.transmissionSamplerSize.value.set(w.width,w.height),M.transmissionMap&&(T.transmissionMap.value=M.transmissionMap,t(M.transmissionMap,T.transmissionMapTransform)),T.thickness.value=M.thickness,M.thicknessMap&&(T.thicknessMap.value=M.thicknessMap,t(M.thicknessMap,T.thicknessMapTransform)),T.attenuationDistance.value=M.attenuationDistance,T.attenuationColor.value.copy(M.attenuationColor)),M.anisotropy>0&&(T.anisotropyVector.value.set(M.anisotropy*Math.cos(M.anisotropyRotation),M.anisotropy*Math.sin(M.anisotropyRotation)),M.anisotropyMap&&(T.anisotropyMap.value=M.anisotropyMap,t(M.anisotropyMap,T.anisotropyMapTransform))),T.specularIntensity.value=M.specularIntensity,T.specularColor.value.copy(M.specularColor),M.specularColorMap&&(T.specularColorMap.value=M.specularColorMap,t(M.specularColorMap,T.specularColorMapTransform)),M.specularIntensityMap&&(T.specularIntensityMap.value=M.specularIntensityMap,t(M.specularIntensityMap,T.specularIntensityMapTransform))}function b(T,M){M.matcap&&(T.matcap.value=M.matcap)}function R(T,M){const w=e.get(M).light;T.referencePosition.value.setFromMatrixPosition(w.matrixWorld),T.nearDistance.value=w.shadow.camera.near,T.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function cL(s,e,t,n){let i={},o={},l=[];const h=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function d(w,D){const U=D.program;n.uniformBlockBinding(w,U)}function p(w,D){let U=i[w.id];U===void 0&&(b(w),U=_(w),i[w.id]=U,w.addEventListener("dispose",T));const F=D.program;n.updateUBOMapping(w,F);const O=e.render.frame;o[w.id]!==O&&(y(w),o[w.id]=O)}function _(w){const D=v();w.__bindingPointIndex=D;const U=s.createBuffer(),F=w.__size,O=w.usage;return s.bindBuffer(s.UNIFORM_BUFFER,U),s.bufferData(s.UNIFORM_BUFFER,F,O),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,D,U),U}function v(){for(let w=0;w<h;w++)if(l.indexOf(w)===-1)return l.push(w),w;return Wt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function y(w){const D=i[w.id],U=w.uniforms,F=w.__cache;s.bindBuffer(s.UNIFORM_BUFFER,D);for(let O=0,z=U.length;O<z;O++){const k=Array.isArray(U[O])?U[O]:[U[O]];for(let N=0,I=k.length;N<I;N++){const W=k[N];if(x(W,O,N,F)===!0){const ae=W.__offset,ie=Array.isArray(W.value)?W.value:[W.value];let se=0;for(let _e=0;_e<ie.length;_e++){const H=ie[_e],K=R(H);typeof H=="number"||typeof H=="boolean"?(W.__data[0]=H,s.bufferSubData(s.UNIFORM_BUFFER,ae+se,W.__data)):H.isMatrix3?(W.__data[0]=H.elements[0],W.__data[1]=H.elements[1],W.__data[2]=H.elements[2],W.__data[3]=0,W.__data[4]=H.elements[3],W.__data[5]=H.elements[4],W.__data[6]=H.elements[5],W.__data[7]=0,W.__data[8]=H.elements[6],W.__data[9]=H.elements[7],W.__data[10]=H.elements[8],W.__data[11]=0):(H.toArray(W.__data,se),se+=K.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,ae,W.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function x(w,D,U,F){const O=w.value,z=D+"_"+U;if(F[z]===void 0)return typeof O=="number"||typeof O=="boolean"?F[z]=O:F[z]=O.clone(),!0;{const k=F[z];if(typeof O=="number"||typeof O=="boolean"){if(k!==O)return F[z]=O,!0}else if(k.equals(O)===!1)return k.copy(O),!0}return!1}function b(w){const D=w.uniforms;let U=0;const F=16;for(let z=0,k=D.length;z<k;z++){const N=Array.isArray(D[z])?D[z]:[D[z]];for(let I=0,W=N.length;I<W;I++){const ae=N[I],ie=Array.isArray(ae.value)?ae.value:[ae.value];for(let se=0,_e=ie.length;se<_e;se++){const H=ie[se],K=R(H),$=U%F,ue=$%K.boundary,re=$+ue;U+=ue,re!==0&&F-re<K.storage&&(U+=F-re),ae.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),ae.__offset=U,U+=K.storage}}}const O=U%F;return O>0&&(U+=F-O),w.__size=U,w.__cache={},this}function R(w){const D={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(D.boundary=4,D.storage=4):w.isVector2?(D.boundary=8,D.storage=8):w.isVector3||w.isColor?(D.boundary=16,D.storage=12):w.isVector4?(D.boundary=16,D.storage=16):w.isMatrix3?(D.boundary=48,D.storage=48):w.isMatrix4?(D.boundary=64,D.storage=64):w.isTexture?Et("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Et("WebGLRenderer: Unsupported uniform value type.",w),D}function T(w){const D=w.target;D.removeEventListener("dispose",T);const U=l.indexOf(D.__bindingPointIndex);l.splice(U,1),s.deleteBuffer(i[D.id]),delete i[D.id],delete o[D.id]}function M(){for(const w in i)s.deleteBuffer(i[w]);l=[],i={},o={}}return{bind:d,update:p,dispose:M}}const uL=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Bo=null;function fL(){return Bo===null&&(Bo=new _r(uL,16,16,xu,Hi),Bo.name="DFG_LUT",Bo.minFilter=bn,Bo.magFilter=bn,Bo.wrapS=yi,Bo.wrapT=yi,Bo.generateMipmaps=!1,Bo.needsUpdate=!0),Bo}class HA{constructor(e={}){const{canvas:t=pb(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:h=!1,premultipliedAlpha:d=!0,preserveDrawingBuffer:p=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:v=!1,reversedDepthBuffer:y=!1,outputBufferType:x=Ma}=e;this.isWebGLRenderer=!0;let b;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");b=n.getContextAttributes().alpha}else b=l;const R=x,T=new Set([Vg,zg,ap]),M=new Set([Ma,js,Zf,Qf,Pg,Gg]),w=new Uint32Array(4),D=new Int32Array(4);let U=null,F=null;const O=[],z=[];let k=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=mr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const N=this;let I=!1;this._outputColorSpace=Pi;let W=0,ae=0,ie=null,se=-1,_e=null;const H=new ci,K=new ci;let $=null;const ue=new At(0);let re=0,X=t.width,ne=t.height,Ae=1,Re=null,rt=null;const ve=new ci(0,0,X,ne),Be=new ci(0,0,X,ne);let st=!1;const xt=new Th;let Mt=!1,$t=!1;const un=new Qt,Vt=new Q,Ve=new ci,nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ge=!1;function ft(){return ie===null?Ae:1}let ee=n;function Nt(V,te){return t.getContext(V,te)}try{const V={alpha:!0,depth:i,stencil:o,antialias:h,premultipliedAlpha:d,preserveDrawingBuffer:p,powerPreference:_,failIfMajorPerformanceCaveat:v};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Zd}`),t.addEventListener("webglcontextlost",zt,!1),t.addEventListener("webglcontextrestored",hn,!1),t.addEventListener("webglcontextcreationerror",dn,!1),ee===null){const te="webgl2";if(ee=Nt(te,V),ee===null)throw Nt(te)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(V){throw Wt("WebGLRenderer: "+V.message),V}let pt,Lt,gt,Z,P,me,Le,Xe,Fe,Bt,_t,Ot,kt,Ke,Qe,St,yt,lt,Ft,pe,De,ot,bt,it;function qe(){pt=new hU(ee),pt.init(),ot=new zE(ee,pt),Lt=new iU(ee,pt,e,ot),gt=new tL(ee,pt),Lt.reversedDepthBuffer&&y&>.buffers.depth.setReversed(!0),Z=new mU(ee),P=new GN,me=new nL(ee,pt,gt,P,Lt,ot,Z),Le=new sU(N),Xe=new fU(N),Fe=new $B(ee),bt=new tU(ee,Fe),Bt=new dU(ee,Fe,Z,bt),_t=new vU(ee,Bt,Fe,Z),Ft=new gU(ee,Lt,me),St=new aU(P),Ot=new PN(N,Le,Xe,pt,Lt,bt,St),kt=new lL(N,P),Ke=new VN,Qe=new KN(pt),lt=new eU(N,Le,Xe,gt,_t,b,d),yt=new $N(N,_t,Lt),it=new cL(ee,Z,Lt,gt),pe=new nU(ee,pt,Z),De=new pU(ee,pt,Z),Z.programs=Ot.programs,N.capabilities=Lt,N.extensions=pt,N.properties=P,N.renderLists=Ke,N.shadowMap=yt,N.state=gt,N.info=Z}qe(),R!==Ma&&(k=new yU(R,t.width,t.height,i,o));const mt=new rL(N,ee);this.xr=mt,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const V=pt.get("WEBGL_lose_context");V&&V.loseContext()},this.forceContextRestore=function(){const V=pt.get("WEBGL_lose_context");V&&V.restoreContext()},this.getPixelRatio=function(){return Ae},this.setPixelRatio=function(V){V!==void 0&&(Ae=V,this.setSize(X,ne,!1))},this.getSize=function(V){return V.set(X,ne)},this.setSize=function(V,te,fe=!0){if(mt.isPresenting){Et("WebGLRenderer: Can't change size while VR device is presenting.");return}X=V,ne=te,t.width=Math.floor(V*Ae),t.height=Math.floor(te*Ae),fe===!0&&(t.style.width=V+"px",t.style.height=te+"px"),k!==null&&k.setSize(t.width,t.height),this.setViewport(0,0,V,te)},this.getDrawingBufferSize=function(V){return V.set(X*Ae,ne*Ae).floor()},this.setDrawingBufferSize=function(V,te,fe){X=V,ne=te,Ae=fe,t.width=Math.floor(V*fe),t.height=Math.floor(te*fe),this.setViewport(0,0,V,te)},this.setEffects=function(V){if(R===Ma){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(V){for(let te=0;te<V.length;te++)if(V[te].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}k.setEffects(V||[])},this.getCurrentViewport=function(V){return V.copy(H)},this.getViewport=function(V){return V.copy(ve)},this.setViewport=function(V,te,fe,he){V.isVector4?ve.set(V.x,V.y,V.z,V.w):ve.set(V,te,fe,he),gt.viewport(H.copy(ve).multiplyScalar(Ae).round())},this.getScissor=function(V){return V.copy(Be)},this.setScissor=function(V,te,fe,he){V.isVector4?Be.set(V.x,V.y,V.z,V.w):Be.set(V,te,fe,he),gt.scissor(K.copy(Be).multiplyScalar(Ae).round())},this.getScissorTest=function(){return st},this.setScissorTest=function(V){gt.setScissorTest(st=V)},this.setOpaqueSort=function(V){Re=V},this.setTransparentSort=function(V){rt=V},this.getClearColor=function(V){return V.copy(lt.getClearColor())},this.setClearColor=function(){lt.setClearColor(...arguments)},this.getClearAlpha=function(){return lt.getClearAlpha()},this.setClearAlpha=function(){lt.setClearAlpha(...arguments)},this.clear=function(V=!0,te=!0,fe=!0){let he=0;if(V){let oe=!1;if(ie!==null){const We=ie.texture.format;oe=T.has(We)}if(oe){const We=ie.texture.type,je=M.has(We),tt=lt.getClearColor(),ht=lt.getClearAlpha(),ct=tt.r,It=tt.g,dt=tt.b;je?(w[0]=ct,w[1]=It,w[2]=dt,w[3]=ht,ee.clearBufferuiv(ee.COLOR,0,w)):(D[0]=ct,D[1]=It,D[2]=dt,D[3]=ht,ee.clearBufferiv(ee.COLOR,0,D))}else he|=ee.COLOR_BUFFER_BIT}te&&(he|=ee.DEPTH_BUFFER_BIT),fe&&(he|=ee.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ee.clear(he)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",zt,!1),t.removeEventListener("webglcontextrestored",hn,!1),t.removeEventListener("webglcontextcreationerror",dn,!1),lt.dispose(),Ke.dispose(),Qe.dispose(),P.dispose(),Le.dispose(),Xe.dispose(),_t.dispose(),bt.dispose(),it.dispose(),Ot.dispose(),mt.dispose(),mt.removeEventListener("sessionstart",Ga),mt.removeEventListener("sessionend",gi),qt.stop()};function zt(V){V.preventDefault(),mp("WebGLRenderer: Context Lost."),I=!0}function hn(){mp("WebGLRenderer: Context Restored."),I=!1;const V=Z.autoReset,te=yt.enabled,fe=yt.autoUpdate,he=yt.needsUpdate,oe=yt.type;qe(),Z.autoReset=V,yt.enabled=te,yt.autoUpdate=fe,yt.needsUpdate=he,yt.type=oe}function dn(V){Wt("WebGLRenderer: A WebGL context could not be created. Reason: ",V.statusMessage)}function Di(V){const te=V.target;te.removeEventListener("dispose",Di),Ra(te)}function Ra(V){eo(V),P.remove(V)}function eo(V){const te=P.get(V).programs;te!==void 0&&(te.forEach(function(fe){Ot.releaseProgram(fe)}),V.isShaderMaterial&&Ot.releaseShaderCache(V))}this.renderBufferDirect=function(V,te,fe,he,oe,We){te===null&&(te=nt);const je=oe.isMesh&&oe.matrixWorld.determinant()<0,tt=Ue(V,te,fe,he,oe);gt.setMaterial(he,je);let ht=fe.index,ct=1;if(he.wireframe===!0){if(ht=Bt.getWireframeAttribute(fe),ht===void 0)return;ct=2}const It=fe.drawRange,dt=fe.attributes.position;let Dt=It.start*ct,gn=(It.start+It.count)*ct;We!==null&&(Dt=Math.max(Dt,We.start*ct),gn=Math.min(gn,(We.start+We.count)*ct)),ht!==null?(Dt=Math.max(Dt,0),gn=Math.min(gn,ht.count)):dt!=null&&(Dt=Math.max(Dt,0),gn=Math.min(gn,dt.count));const Xn=gn-Dt;if(Xn<0||Xn===1/0)return;bt.setup(oe,he,tt,fe,ht);let xn,Xt=pe;if(ht!==null&&(xn=Fe.get(ht),Xt=De,Xt.setIndex(xn)),oe.isMesh)he.wireframe===!0?(gt.setLineWidth(he.wireframeLinewidth*ft()),Xt.setMode(ee.LINES)):Xt.setMode(ee.TRIANGLES);else if(oe.isLine){let Tt=he.linewidth;Tt===void 0&&(Tt=1),gt.setLineWidth(Tt*ft()),oe.isLineSegments?Xt.setMode(ee.LINES):oe.isLineLoop?Xt.setMode(ee.LINE_LOOP):Xt.setMode(ee.LINE_STRIP)}else oe.isPoints?Xt.setMode(ee.POINTS):oe.isSprite&&Xt.setMode(ee.TRIANGLES);if(oe.isBatchedMesh)if(oe._multiDrawInstances!==null)th("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Xt.renderMultiDrawInstances(oe._multiDrawStarts,oe._multiDrawCounts,oe._multiDrawCount,oe._multiDrawInstances);else if(pt.get("WEBGL_multi_draw"))Xt.renderMultiDraw(oe._multiDrawStarts,oe._multiDrawCounts,oe._multiDrawCount);else{const Tt=oe._multiDrawStarts,Kt=oe._multiDrawCounts,Ct=oe._multiDrawCount,Yn=ht?Fe.get(ht).bytesPerElement:1,aa=P.get(he).currentProgram.getUniforms();for(let kn=0;kn<Ct;kn++)aa.setValue(ee,"_gl_DrawID",kn),Xt.render(Tt[kn]/Yn,Kt[kn])}else if(oe.isInstancedMesh)Xt.renderInstances(Dt,Xn,oe.count);else if(fe.isInstancedBufferGeometry){const Tt=fe._maxInstanceCount!==void 0?fe._maxInstanceCount:1/0,Kt=Math.min(fe.instanceCount,Tt);Xt.renderInstances(Dt,Xn,Kt)}else Xt.render(Dt,Xn)};function ir(V,te,fe){V.transparent===!0&&V.side===Ws&&V.forceSinglePass===!1?(V.side=fs,V.needsUpdate=!0,de(V,te,fe),V.side=kr,V.needsUpdate=!0,de(V,te,fe),V.side=Ws):de(V,te,fe)}this.compile=function(V,te,fe=null){fe===null&&(fe=V),F=Qe.get(fe),F.init(te),z.push(F),fe.traverseVisible(function(oe){oe.isLight&&oe.layers.test(te.layers)&&(F.pushLight(oe),oe.castShadow&&F.pushShadow(oe))}),V!==fe&&V.traverseVisible(function(oe){oe.isLight&&oe.layers.test(te.layers)&&(F.pushLight(oe),oe.castShadow&&F.pushShadow(oe))}),F.setupLights();const he=new Set;return V.traverse(function(oe){if(!(oe.isMesh||oe.isPoints||oe.isLine||oe.isSprite))return;const We=oe.material;if(We)if(Array.isArray(We))for(let je=0;je<We.length;je++){const tt=We[je];ir(tt,fe,oe),he.add(tt)}else ir(We,fe,oe),he.add(We)}),F=z.pop(),he},this.compileAsync=function(V,te,fe=null){const he=this.compile(V,te,fe);return new Promise(oe=>{function We(){if(he.forEach(function(je){P.get(je).currentProgram.isReady()&&he.delete(je)}),he.size===0){oe(V);return}setTimeout(We,10)}pt.get("KHR_parallel_shader_compile")!==null?We():setTimeout(We,10)})};let ma=null;function wa(V){ma&&ma(V)}function Ga(){qt.stop()}function gi(){qt.start()}const qt=new pE;qt.setAnimationLoop(wa),typeof self<"u"&&qt.setContext(self),this.setAnimationLoop=function(V){ma=V,mt.setAnimationLoop(V),V===null?qt.stop():qt.start()},mt.addEventListener("sessionstart",Ga),mt.addEventListener("sessionend",gi),this.render=function(V,te){if(te!==void 0&&te.isCamera!==!0){Wt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;const fe=mt.enabled===!0&&mt.isPresenting===!0,he=k!==null&&(ie===null||fe)&&k.begin(N,ie);if(V.matrixWorldAutoUpdate===!0&&V.updateMatrixWorld(),te.parent===null&&te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),mt.enabled===!0&&mt.isPresenting===!0&&(k===null||k.isCompositing()===!1)&&(mt.cameraAutoUpdate===!0&&mt.updateCamera(te),te=mt.getCamera()),V.isScene===!0&&V.onBeforeRender(N,V,te,ie),F=Qe.get(V,z.length),F.init(te),z.push(F),un.multiplyMatrices(te.projectionMatrix,te.matrixWorldInverse),xt.setFromProjectionMatrix(un,Zs,te.reversedDepth),$t=this.localClippingEnabled,Mt=St.init(this.clippingPlanes,$t),U=Ke.get(V,O.length),U.init(),O.push(U),mt.enabled===!0&&mt.isPresenting===!0){const je=N.xr.getDepthSensingMesh();je!==null&&ki(je,te,-1/0,N.sortObjects)}ki(V,te,0,N.sortObjects),U.finish(),N.sortObjects===!0&&U.sort(Re,rt),Ge=mt.enabled===!1||mt.isPresenting===!1||mt.hasDepthSensing()===!1,Ge&<.addToRenderList(U,V),this.info.render.frame++,Mt===!0&&St.beginShadows();const oe=F.state.shadowsArray;if(yt.render(oe,V,te),Mt===!0&&St.endShadows(),this.info.autoReset===!0&&this.info.reset(),(he&&k.hasRenderPass())===!1){const je=U.opaque,tt=U.transmissive;if(F.setupLights(),te.isArrayCamera){const ht=te.cameras;if(tt.length>0)for(let ct=0,It=ht.length;ct<It;ct++){const dt=ht[ct];G(je,tt,V,dt)}Ge&<.render(V);for(let ct=0,It=ht.length;ct<It;ct++){const dt=ht[ct];ln(U,V,dt,dt.viewport)}}else tt.length>0&&G(je,tt,V,te),Ge&<.render(V),ln(U,V,te)}ie!==null&&ae===0&&(me.updateMultisampleRenderTarget(ie),me.updateRenderTargetMipmap(ie)),he&&k.end(N),V.isScene===!0&&V.onAfterRender(N,V,te),bt.resetDefaultState(),se=-1,_e=null,z.pop(),z.length>0?(F=z[z.length-1],Mt===!0&&St.setGlobalState(N.clippingPlanes,F.state.camera)):F=null,O.pop(),O.length>0?U=O[O.length-1]:U=null};function ki(V,te,fe,he){if(V.visible===!1)return;if(V.layers.test(te.layers)){if(V.isGroup)fe=V.renderOrder;else if(V.isLOD)V.autoUpdate===!0&&V.update(te);else if(V.isLight)F.pushLight(V),V.castShadow&&F.pushShadow(V);else if(V.isSprite){if(!V.frustumCulled||xt.intersectsSprite(V)){he&&Ve.setFromMatrixPosition(V.matrixWorld).applyMatrix4(un);const je=_t.update(V),tt=V.material;tt.visible&&U.push(V,je,tt,fe,Ve.z,null)}}else if((V.isMesh||V.isLine||V.isPoints)&&(!V.frustumCulled||xt.intersectsObject(V))){const je=_t.update(V),tt=V.material;if(he&&(V.boundingSphere!==void 0?(V.boundingSphere===null&&V.computeBoundingSphere(),Ve.copy(V.boundingSphere.center)):(je.boundingSphere===null&&je.computeBoundingSphere(),Ve.copy(je.boundingSphere.center)),Ve.applyMatrix4(V.matrixWorld).applyMatrix4(un)),Array.isArray(tt)){const ht=je.groups;for(let ct=0,It=ht.length;ct<It;ct++){const dt=ht[ct],Dt=tt[dt.materialIndex];Dt&&Dt.visible&&U.push(V,je,Dt,fe,Ve.z,dt)}}else tt.visible&&U.push(V,je,tt,fe,Ve.z,null)}}const We=V.children;for(let je=0,tt=We.length;je<tt;je++)ki(We[je],te,fe,he)}function ln(V,te,fe,he){const{opaque:oe,transmissive:We,transparent:je}=V;F.setupLightsView(fe),Mt===!0&&St.setGlobalState(N.clippingPlanes,fe),he&>.viewport(H.copy(he)),oe.length>0&&q(oe,te,fe),We.length>0&&q(We,te,fe),je.length>0&&q(je,te,fe),gt.buffers.depth.setTest(!0),gt.buffers.depth.setMask(!0),gt.buffers.color.setMask(!0),gt.setPolygonOffset(!1)}function G(V,te,fe,he){if((fe.isScene===!0?fe.overrideMaterial:null)!==null)return;if(F.state.transmissionRenderTarget[he.id]===void 0){const Dt=pt.has("EXT_color_buffer_half_float")||pt.has("EXT_color_buffer_float");F.state.transmissionRenderTarget[he.id]=new ds(1,1,{generateMipmaps:!0,type:Dt?Hi:Ma,minFilter:Is,samples:Lt.samples,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Tn.workingColorSpace})}const We=F.state.transmissionRenderTarget[he.id],je=he.viewport||H;We.setSize(je.z*N.transmissionResolutionScale,je.w*N.transmissionResolutionScale);const tt=N.getRenderTarget(),ht=N.getActiveCubeFace(),ct=N.getActiveMipmapLevel();N.setRenderTarget(We),N.getClearColor(ue),re=N.getClearAlpha(),re<1&&N.setClearColor(16777215,.5),N.clear(),Ge&<.render(fe);const It=N.toneMapping;N.toneMapping=mr;const dt=he.viewport;if(he.viewport!==void 0&&(he.viewport=void 0),F.setupLightsView(he),Mt===!0&&St.setGlobalState(N.clippingPlanes,he),q(V,fe,he),me.updateMultisampleRenderTarget(We),me.updateRenderTargetMipmap(We),pt.has("WEBGL_multisampled_render_to_texture")===!1){let Dt=!1;for(let gn=0,Xn=te.length;gn<Xn;gn++){const xn=te[gn],{object:Xt,geometry:Tt,material:Kt,group:Ct}=xn;if(Kt.side===Ws&&Xt.layers.test(he.layers)){const Yn=Kt.side;Kt.side=fs,Kt.needsUpdate=!0,j(Xt,fe,he,Tt,Kt,Ct),Kt.side=Yn,Kt.needsUpdate=!0,Dt=!0}}Dt===!0&&(me.updateMultisampleRenderTarget(We),me.updateRenderTargetMipmap(We))}N.setRenderTarget(tt,ht,ct),N.setClearColor(ue,re),dt!==void 0&&(he.viewport=dt),N.toneMapping=It}function q(V,te,fe){const he=te.isScene===!0?te.overrideMaterial:null;for(let oe=0,We=V.length;oe<We;oe++){const je=V[oe],{object:tt,geometry:ht,group:ct}=je;let It=je.material;It.allowOverride===!0&&he!==null&&(It=he),tt.layers.test(fe.layers)&&j(tt,te,fe,ht,It,ct)}}function j(V,te,fe,he,oe,We){V.onBeforeRender(N,te,fe,he,oe,We),V.modelViewMatrix.multiplyMatrices(fe.matrixWorldInverse,V.matrixWorld),V.normalMatrix.getNormalMatrix(V.modelViewMatrix),oe.onBeforeRender(N,te,fe,he,V,We),oe.transparent===!0&&oe.side===Ws&&oe.forceSinglePass===!1?(oe.side=fs,oe.needsUpdate=!0,N.renderBufferDirect(fe,te,he,oe,V,We),oe.side=kr,oe.needsUpdate=!0,N.renderBufferDirect(fe,te,he,oe,V,We),oe.side=Ws):N.renderBufferDirect(fe,te,he,oe,V,We),V.onAfterRender(N,te,fe,he,oe,We)}function de(V,te,fe){te.isScene!==!0&&(te=nt);const he=P.get(V),oe=F.state.lights,We=F.state.shadowsArray,je=oe.state.version,tt=Ot.getParameters(V,oe.state,We,te,fe),ht=Ot.getProgramCacheKey(tt);let ct=he.programs;he.environment=V.isMeshStandardMaterial?te.environment:null,he.fog=te.fog,he.envMap=(V.isMeshStandardMaterial?Xe:Le).get(V.envMap||he.environment),he.envMapRotation=he.environment!==null&&V.envMap===null?te.environmentRotation:V.envMapRotation,ct===void 0&&(V.addEventListener("dispose",Di),ct=new Map,he.programs=ct);let It=ct.get(ht);if(It!==void 0){if(he.currentProgram===It&&he.lightsStateVersion===je)return xe(V,tt),It}else tt.uniforms=Ot.getUniforms(V),V.onBeforeCompile(tt,N),It=Ot.acquireProgram(tt,ht),ct.set(ht,It),he.uniforms=tt.uniforms;const dt=he.uniforms;return(!V.isShaderMaterial&&!V.isRawShaderMaterial||V.clipping===!0)&&(dt.clippingPlanes=St.uniform),xe(V,tt),he.needsLights=ze(V),he.lightsStateVersion=je,he.needsLights&&(dt.ambientLightColor.value=oe.state.ambient,dt.lightProbe.value=oe.state.probe,dt.directionalLights.value=oe.state.directional,dt.directionalLightShadows.value=oe.state.directionalShadow,dt.spotLights.value=oe.state.spot,dt.spotLightShadows.value=oe.state.spotShadow,dt.rectAreaLights.value=oe.state.rectArea,dt.ltc_1.value=oe.state.rectAreaLTC1,dt.ltc_2.value=oe.state.rectAreaLTC2,dt.pointLights.value=oe.state.point,dt.pointLightShadows.value=oe.state.pointShadow,dt.hemisphereLights.value=oe.state.hemi,dt.directionalShadowMap.value=oe.state.directionalShadowMap,dt.directionalShadowMatrix.value=oe.state.directionalShadowMatrix,dt.spotShadowMap.value=oe.state.spotShadowMap,dt.spotLightMatrix.value=oe.state.spotLightMatrix,dt.spotLightMap.value=oe.state.spotLightMap,dt.pointShadowMap.value=oe.state.pointShadowMap,dt.pointShadowMatrix.value=oe.state.pointShadowMatrix),he.currentProgram=It,he.uniformsList=null,It}function ye(V){if(V.uniformsList===null){const te=V.currentProgram.getUniforms();V.uniformsList=Zv.seqWithValue(te.seq,V.uniforms)}return V.uniformsList}function xe(V,te){const fe=P.get(V);fe.outputColorSpace=te.outputColorSpace,fe.batching=te.batching,fe.batchingColor=te.batchingColor,fe.instancing=te.instancing,fe.instancingColor=te.instancingColor,fe.instancingMorph=te.instancingMorph,fe.skinning=te.skinning,fe.morphTargets=te.morphTargets,fe.morphNormals=te.morphNormals,fe.morphColors=te.morphColors,fe.morphTargetsCount=te.morphTargetsCount,fe.numClippingPlanes=te.numClippingPlanes,fe.numIntersection=te.numClipIntersection,fe.vertexAlphas=te.vertexAlphas,fe.vertexTangents=te.vertexTangents,fe.toneMapping=te.toneMapping}function Ue(V,te,fe,he,oe){te.isScene!==!0&&(te=nt),me.resetTextureUnits();const We=te.fog,je=he.isMeshStandardMaterial?te.environment:null,tt=ie===null?N.outputColorSpace:ie.isXRRenderTarget===!0?ie.texture.colorSpace:ta,ht=(he.isMeshStandardMaterial?Xe:Le).get(he.envMap||je),ct=he.vertexColors===!0&&!!fe.attributes.color&&fe.attributes.color.itemSize===4,It=!!fe.attributes.tangent&&(!!he.normalMap||he.anisotropy>0),dt=!!fe.morphAttributes.position,Dt=!!fe.morphAttributes.normal,gn=!!fe.morphAttributes.color;let Xn=mr;he.toneMapped&&(ie===null||ie.isXRRenderTarget===!0)&&(Xn=N.toneMapping);const xn=fe.morphAttributes.position||fe.morphAttributes.normal||fe.morphAttributes.color,Xt=xn!==void 0?xn.length:0,Tt=P.get(he),Kt=F.state.lights;if(Mt===!0&&($t===!0||V!==_e)){const Yi=V===_e&&he.id===se;St.setState(he,V,Yi)}let Ct=!1;he.version===Tt.__version?(Tt.needsLights&&Tt.lightsStateVersion!==Kt.state.version||Tt.outputColorSpace!==tt||oe.isBatchedMesh&&Tt.batching===!1||!oe.isBatchedMesh&&Tt.batching===!0||oe.isBatchedMesh&&Tt.batchingColor===!0&&oe.colorTexture===null||oe.isBatchedMesh&&Tt.batchingColor===!1&&oe.colorTexture!==null||oe.isInstancedMesh&&Tt.instancing===!1||!oe.isInstancedMesh&&Tt.instancing===!0||oe.isSkinnedMesh&&Tt.skinning===!1||!oe.isSkinnedMesh&&Tt.skinning===!0||oe.isInstancedMesh&&Tt.instancingColor===!0&&oe.instanceColor===null||oe.isInstancedMesh&&Tt.instancingColor===!1&&oe.instanceColor!==null||oe.isInstancedMesh&&Tt.instancingMorph===!0&&oe.morphTexture===null||oe.isInstancedMesh&&Tt.instancingMorph===!1&&oe.morphTexture!==null||Tt.envMap!==ht||he.fog===!0&&Tt.fog!==We||Tt.numClippingPlanes!==void 0&&(Tt.numClippingPlanes!==St.numPlanes||Tt.numIntersection!==St.numIntersection)||Tt.vertexAlphas!==ct||Tt.vertexTangents!==It||Tt.morphTargets!==dt||Tt.morphNormals!==Dt||Tt.morphColors!==gn||Tt.toneMapping!==Xn||Tt.morphTargetsCount!==Xt)&&(Ct=!0):(Ct=!0,Tt.__version=he.version);let Yn=Tt.currentProgram;Ct===!0&&(Yn=de(he,te,oe));let aa=!1,kn=!1,Ui=!1;const Kn=Yn.getUniforms(),Mi=Tt.uniforms;if(gt.useProgram(Yn.program)&&(aa=!0,kn=!0,Ui=!0),he.id!==se&&(se=he.id,kn=!0),aa||_e!==V){gt.buffers.depth.getReversed()&&V.reversedDepth!==!0&&(V._reversedDepth=!0,V.updateProjectionMatrix()),Kn.setValue(ee,"projectionMatrix",V.projectionMatrix),Kn.setValue(ee,"viewMatrix",V.matrixWorldInverse);const Ji=Kn.map.cameraPosition;Ji!==void 0&&Ji.setValue(ee,Vt.setFromMatrixPosition(V.matrixWorld)),Lt.logarithmicDepthBuffer&&Kn.setValue(ee,"logDepthBufFC",2/(Math.log(V.far+1)/Math.LN2)),(he.isMeshPhongMaterial||he.isMeshToonMaterial||he.isMeshLambertMaterial||he.isMeshBasicMaterial||he.isMeshStandardMaterial||he.isShaderMaterial)&&Kn.setValue(ee,"isOrthographic",V.isOrthographicCamera===!0),_e!==V&&(_e=V,kn=!0,Ui=!0)}if(Tt.needsLights&&(Kt.state.directionalShadowMap.length>0&&Kn.setValue(ee,"directionalShadowMap",Kt.state.directionalShadowMap,me),Kt.state.spotShadowMap.length>0&&Kn.setValue(ee,"spotShadowMap",Kt.state.spotShadowMap,me),Kt.state.pointShadowMap.length>0&&Kn.setValue(ee,"pointShadowMap",Kt.state.pointShadowMap,me)),oe.isSkinnedMesh){Kn.setOptional(ee,oe,"bindMatrix"),Kn.setOptional(ee,oe,"bindMatrixInverse");const Yi=oe.skeleton;Yi&&(Yi.boneTexture===null&&Yi.computeBoneTexture(),Kn.setValue(ee,"boneTexture",Yi.boneTexture,me))}oe.isBatchedMesh&&(Kn.setOptional(ee,oe,"batchingTexture"),Kn.setValue(ee,"batchingTexture",oe._matricesTexture,me),Kn.setOptional(ee,oe,"batchingIdTexture"),Kn.setValue(ee,"batchingIdTexture",oe._indirectTexture,me),Kn.setOptional(ee,oe,"batchingColorTexture"),oe._colorsTexture!==null&&Kn.setValue(ee,"batchingColorTexture",oe._colorsTexture,me));const Xi=fe.morphAttributes;if((Xi.position!==void 0||Xi.normal!==void 0||Xi.color!==void 0)&&Ft.update(oe,fe,Yn),(kn||Tt.receiveShadow!==oe.receiveShadow)&&(Tt.receiveShadow=oe.receiveShadow,Kn.setValue(ee,"receiveShadow",oe.receiveShadow)),he.isMeshGouraudMaterial&&he.envMap!==null&&(Mi.envMap.value=ht,Mi.flipEnvMap.value=ht.isCubeTexture&&ht.isRenderTargetTexture===!1?-1:1),he.isMeshStandardMaterial&&he.envMap===null&&te.environment!==null&&(Mi.envMapIntensity.value=te.environmentIntensity),Mi.dfgLUT!==void 0&&(Mi.dfgLUT.value=fL()),kn&&(Kn.setValue(ee,"toneMappingExposure",N.toneMappingExposure),Tt.needsLights&&Ie(Mi,Ui),We&&he.fog===!0&&kt.refreshFogUniforms(Mi,We),kt.refreshMaterialUniforms(Mi,he,Ae,ne,F.state.transmissionRenderTarget[V.id]),Zv.upload(ee,ye(Tt),Mi,me)),he.isShaderMaterial&&he.uniformsNeedUpdate===!0&&(Zv.upload(ee,ye(Tt),Mi,me),he.uniformsNeedUpdate=!1),he.isSpriteMaterial&&Kn.setValue(ee,"center",oe.center),Kn.setValue(ee,"modelViewMatrix",oe.modelViewMatrix),Kn.setValue(ee,"normalMatrix",oe.normalMatrix),Kn.setValue(ee,"modelMatrix",oe.matrixWorld),he.isShaderMaterial||he.isRawShaderMaterial){const Yi=he.uniformsGroups;for(let Ji=0,Bl=Yi.length;Ji<Bl;Ji++){const _s=Yi[Ji];it.update(_s,Yn),it.bind(_s,Yn)}}return Yn}function Ie(V,te){V.ambientLightColor.needsUpdate=te,V.lightProbe.needsUpdate=te,V.directionalLights.needsUpdate=te,V.directionalLightShadows.needsUpdate=te,V.pointLights.needsUpdate=te,V.pointLightShadows.needsUpdate=te,V.spotLights.needsUpdate=te,V.spotLightShadows.needsUpdate=te,V.rectAreaLights.needsUpdate=te,V.hemisphereLights.needsUpdate=te}function ze(V){return V.isMeshLambertMaterial||V.isMeshToonMaterial||V.isMeshPhongMaterial||V.isMeshStandardMaterial||V.isShadowMaterial||V.isShaderMaterial&&V.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return ae},this.getRenderTarget=function(){return ie},this.setRenderTargetTextures=function(V,te,fe){const he=P.get(V);he.__autoAllocateDepthBuffer=V.resolveDepthBuffer===!1,he.__autoAllocateDepthBuffer===!1&&(he.__useRenderToTexture=!1),P.get(V.texture).__webglTexture=te,P.get(V.depthTexture).__webglTexture=he.__autoAllocateDepthBuffer?void 0:fe,he.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(V,te){const fe=P.get(V);fe.__webglFramebuffer=te,fe.__useDefaultFramebuffer=te===void 0};const Pe=ee.createFramebuffer();this.setRenderTarget=function(V,te=0,fe=0){ie=V,W=te,ae=fe;let he=null,oe=!1,We=!1;if(V){const tt=P.get(V);if(tt.__useDefaultFramebuffer!==void 0){gt.bindFramebuffer(ee.FRAMEBUFFER,tt.__webglFramebuffer),H.copy(V.viewport),K.copy(V.scissor),$=V.scissorTest,gt.viewport(H),gt.scissor(K),gt.setScissorTest($),se=-1;return}else if(tt.__webglFramebuffer===void 0)me.setupRenderTarget(V);else if(tt.__hasExternalTextures)me.rebindTextures(V,P.get(V.texture).__webglTexture,P.get(V.depthTexture).__webglTexture);else if(V.depthBuffer){const It=V.depthTexture;if(tt.__boundDepthTexture!==It){if(It!==null&&P.has(It)&&(V.width!==It.image.width||V.height!==It.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");me.setupDepthRenderbuffer(V)}}const ht=V.texture;(ht.isData3DTexture||ht.isDataArrayTexture||ht.isCompressedArrayTexture)&&(We=!0);const ct=P.get(V).__webglFramebuffer;V.isWebGLCubeRenderTarget?(Array.isArray(ct[te])?he=ct[te][fe]:he=ct[te],oe=!0):V.samples>0&&me.useMultisampledRTT(V)===!1?he=P.get(V).__webglMultisampledFramebuffer:Array.isArray(ct)?he=ct[fe]:he=ct,H.copy(V.viewport),K.copy(V.scissor),$=V.scissorTest}else H.copy(ve).multiplyScalar(Ae).floor(),K.copy(Be).multiplyScalar(Ae).floor(),$=st;if(fe!==0&&(he=Pe),gt.bindFramebuffer(ee.FRAMEBUFFER,he)&>.drawBuffers(V,he),gt.viewport(H),gt.scissor(K),gt.setScissorTest($),oe){const tt=P.get(V.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+te,tt.__webglTexture,fe)}else if(We){const tt=te;for(let ht=0;ht<V.textures.length;ht++){const ct=P.get(V.textures[ht]);ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0+ht,ct.__webglTexture,fe,tt)}}else if(V!==null&&fe!==0){const tt=P.get(V.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,tt.__webglTexture,fe)}se=-1},this.readRenderTargetPixels=function(V,te,fe,he,oe,We,je,tt=0){if(!(V&&V.isWebGLRenderTarget)){Wt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ht=P.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&je!==void 0&&(ht=ht[je]),ht){gt.bindFramebuffer(ee.FRAMEBUFFER,ht);try{const ct=V.textures[tt],It=ct.format,dt=ct.type;if(!Lt.textureFormatReadable(It)){Wt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Lt.textureTypeReadable(dt)){Wt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}te>=0&&te<=V.width-he&&fe>=0&&fe<=V.height-oe&&(V.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+tt),ee.readPixels(te,fe,he,oe,ot.convert(It),ot.convert(dt),We))}finally{const ct=ie!==null?P.get(ie).__webglFramebuffer:null;gt.bindFramebuffer(ee.FRAMEBUFFER,ct)}}},this.readRenderTargetPixelsAsync=async function(V,te,fe,he,oe,We,je,tt=0){if(!(V&&V.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ht=P.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&je!==void 0&&(ht=ht[je]),ht)if(te>=0&&te<=V.width-he&&fe>=0&&fe<=V.height-oe){gt.bindFramebuffer(ee.FRAMEBUFFER,ht);const ct=V.textures[tt],It=ct.format,dt=ct.type;if(!Lt.textureFormatReadable(It))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Lt.textureTypeReadable(dt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Dt=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Dt),ee.bufferData(ee.PIXEL_PACK_BUFFER,We.byteLength,ee.STREAM_READ),V.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+tt),ee.readPixels(te,fe,he,oe,ot.convert(It),ot.convert(dt),0);const gn=ie!==null?P.get(ie).__webglFramebuffer:null;gt.bindFramebuffer(ee.FRAMEBUFFER,gn);const Xn=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await r2(ee,Xn,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Dt),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,We),ee.deleteBuffer(Dt),ee.deleteSync(Xn),We}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(V,te=null,fe=0){const he=Math.pow(2,-fe),oe=Math.floor(V.image.width*he),We=Math.floor(V.image.height*he),je=te!==null?te.x:0,tt=te!==null?te.y:0;me.setTexture2D(V,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,fe,0,0,je,tt,oe,We),gt.unbindTexture()};const at=ee.createFramebuffer(),Je=ee.createFramebuffer();this.copyTextureToTexture=function(V,te,fe=null,he=null,oe=0,We=null){We===null&&(oe!==0?(th("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),We=oe,oe=0):We=0);let je,tt,ht,ct,It,dt,Dt,gn,Xn;const xn=V.isCompressedTexture?V.mipmaps[We]:V.image;if(fe!==null)je=fe.max.x-fe.min.x,tt=fe.max.y-fe.min.y,ht=fe.isBox3?fe.max.z-fe.min.z:1,ct=fe.min.x,It=fe.min.y,dt=fe.isBox3?fe.min.z:0;else{const Xi=Math.pow(2,-oe);je=Math.floor(xn.width*Xi),tt=Math.floor(xn.height*Xi),V.isDataArrayTexture?ht=xn.depth:V.isData3DTexture?ht=Math.floor(xn.depth*Xi):ht=1,ct=0,It=0,dt=0}he!==null?(Dt=he.x,gn=he.y,Xn=he.z):(Dt=0,gn=0,Xn=0);const Xt=ot.convert(te.format),Tt=ot.convert(te.type);let Kt;te.isData3DTexture?(me.setTexture3D(te,0),Kt=ee.TEXTURE_3D):te.isDataArrayTexture||te.isCompressedArrayTexture?(me.setTexture2DArray(te,0),Kt=ee.TEXTURE_2D_ARRAY):(me.setTexture2D(te,0),Kt=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,te.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,te.unpackAlignment);const Ct=ee.getParameter(ee.UNPACK_ROW_LENGTH),Yn=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),aa=ee.getParameter(ee.UNPACK_SKIP_PIXELS),kn=ee.getParameter(ee.UNPACK_SKIP_ROWS),Ui=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,xn.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,xn.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,ct),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,It),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,dt);const Kn=V.isDataArrayTexture||V.isData3DTexture,Mi=te.isDataArrayTexture||te.isData3DTexture;if(V.isDepthTexture){const Xi=P.get(V),Yi=P.get(te),Ji=P.get(Xi.__renderTarget),Bl=P.get(Yi.__renderTarget);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,Ji.__webglFramebuffer),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,Bl.__webglFramebuffer);for(let _s=0;_s<ht;_s++)Kn&&(ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,P.get(V).__webglTexture,oe,dt+_s),ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,P.get(te).__webglTexture,We,Xn+_s)),ee.blitFramebuffer(ct,It,je,tt,Dt,gn,je,tt,ee.DEPTH_BUFFER_BIT,ee.NEAREST);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,null),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else if(oe!==0||V.isRenderTargetTexture||P.has(V)){const Xi=P.get(V),Yi=P.get(te);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,at),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,Je);for(let Ji=0;Ji<ht;Ji++)Kn?ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Xi.__webglTexture,oe,dt+Ji):ee.framebufferTexture2D(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Xi.__webglTexture,oe),Mi?ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Yi.__webglTexture,We,Xn+Ji):ee.framebufferTexture2D(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Yi.__webglTexture,We),oe!==0?ee.blitFramebuffer(ct,It,je,tt,Dt,gn,je,tt,ee.COLOR_BUFFER_BIT,ee.NEAREST):Mi?ee.copyTexSubImage3D(Kt,We,Dt,gn,Xn+Ji,ct,It,je,tt):ee.copyTexSubImage2D(Kt,We,Dt,gn,ct,It,je,tt);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,null),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else Mi?V.isDataTexture||V.isData3DTexture?ee.texSubImage3D(Kt,We,Dt,gn,Xn,je,tt,ht,Xt,Tt,xn.data):te.isCompressedArrayTexture?ee.compressedTexSubImage3D(Kt,We,Dt,gn,Xn,je,tt,ht,Xt,xn.data):ee.texSubImage3D(Kt,We,Dt,gn,Xn,je,tt,ht,Xt,Tt,xn):V.isDataTexture?ee.texSubImage2D(ee.TEXTURE_2D,We,Dt,gn,je,tt,Xt,Tt,xn.data):V.isCompressedTexture?ee.compressedTexSubImage2D(ee.TEXTURE_2D,We,Dt,gn,xn.width,xn.height,Xt,xn.data):ee.texSubImage2D(ee.TEXTURE_2D,We,Dt,gn,je,tt,Xt,Tt,xn);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Ct),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,Yn),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,aa),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,kn),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Ui),We===0&&te.generateMipmaps&&ee.generateMipmap(Kt),gt.unbindTexture()},this.initRenderTarget=function(V){P.get(V).__webglFramebuffer===void 0&&me.setupRenderTarget(V)},this.initTexture=function(V){V.isCubeTexture?me.setTextureCube(V,0):V.isData3DTexture?me.setTexture3D(V,0):V.isDataArrayTexture||V.isCompressedArrayTexture?me.setTexture2DArray(V,0):me.setTexture2D(V,0),gt.unbindTexture()},this.resetState=function(){W=0,ae=0,ie=null,gt.reset(),bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Zs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Tn._getDrawingBufferColorSpace(e),t.unpackColorSpace=Tn._getUnpackColorSpace()}}const hL=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Ig,AddEquation:sc,AddOperation:eb,AdditiveAnimationBlendMode:rx,AdditiveBlending:Yy,AgXToneMapping:Qy,AlphaFormat:ax,AlwaysCompare:fb,AlwaysDepth:Bg,AlwaysStencilFunc:lx,AmbientLight:V1,AnimationAction:tE,AnimationClip:Vu,AnimationLoader:Kw,AnimationMixer:nE,AnimationObjectGroup:vB,AnimationUtils:Xw,ArcCurve:u1,ArrayCamera:Z1,ArrowHelper:XB,AttachedBindMode:ex,Audio:Q1,AudioAnalyser:oB,AudioContext:gA,AudioListener:aB,AudioLoader:tB,AxesHelper:YB,BackSide:fs,BasicDepthPacking:ab,BasicShadowMap:LM,BatchedMesh:e1,Bone:Cp,BooleanKeyframeTrack:Gu,Box2:RB,Box3:Ea,Box3Helper:VB,BoxGeometry:Du,BoxHelper:zB,BufferAttribute:Ln,BufferGeometry:on,BufferGeometryLoader:J1,ByteType:Fg,Cache:wo,Camera:X0,CameraHelper:GB,CanvasTexture:dw,CapsuleGeometry:gv,CatmullRomCurve3:f1,CineonToneMapping:jy,CircleGeometry:vv,ClampToEdgeWrapping:yi,Clock:vA,Color:At,ColorKeyframeTrack:lA,ColorManagement:Tn,CompressedArrayTexture:fw,CompressedCubeTexture:hw,CompressedTexture:mv,CompressedTextureLoader:Ww,ConeGeometry:Lp,ConstantAlphaFactor:ZM,ConstantColorFactor:WM,Controls:qB,CubeCamera:Fb,CubeDepthTexture:l1,CubeReflectionMapping:Yr,CubeRefractionMapping:oc,CubeTexture:Sp,CubeTextureLoader:H1,CubeUVReflectionMapping:jf,CubicBezierCurve:Wx,CubicBezierCurve3:d1,CubicInterpolant:L1,CullFaceBack:Xy,CullFaceFront:NM,CullFaceFrontBack:xR,CullFaceNone:UM,Curve:jr,CurvePath:m1,CustomBlending:OM,CustomToneMapping:Zy,CylinderGeometry:Np,Cylindrical:CB,Data3DTexture:C0,DataArrayTexture:T0,DataTexture:_r,DataTextureLoader:cA,DataUtils:wu,DecrementStencilOp:LR,DecrementWrapStencilOp:IR,DefaultLoadingManager:F1,DepthFormat:bo,DepthStencilFormat:cc,DepthTexture:Ch,DetachedBindMode:tb,DirectionalLight:Pv,DirectionalLightHelper:PB,DiscreteInterpolant:O1,DodecahedronGeometry:_v,DoubleSide:Ws,DstAlphaFactor:XM,DstColorFactor:JM,DynamicCopyUsage:ZR,DynamicDrawUsage:YR,DynamicReadUsage:KR,EdgesGeometry:c1,EllipseCurve:Sv,EqualCompare:lb,EqualDepth:Ug,EqualStencilFunc:GR,EquirectangularReflectionMapping:Wf,EquirectangularRefractionMapping:ep,Euler:er,EventDispatcher:Eo,ExternalTexture:kx,ExtrudeGeometry:Rv,FileLoader:ha,Float16BufferAttribute:k2,Float32BufferAttribute:Ht,FloatType:Ai,Fog:K0,FogExp2:q0,FramebufferTexture:uw,FrontSide:kr,Frustum:Th,FrustumArray:av,GLBufferAttribute:MB,GLSL1:$R,GLSL3:cx,GreaterCompare:cb,GreaterDepth:Lg,GreaterEqualCompare:b0,GreaterEqualDepth:Ng,GreaterEqualStencilFunc:XR,GreaterStencilFunc:VR,GridHelper:FB,Group:vr,HalfFloatType:Hi,HemisphereLight:P1,HemisphereLightHelper:IB,IcosahedronGeometry:zp,ImageBitmapLoader:mA,ImageLoader:Xp,ImageUtils:xb,IncrementStencilOp:NR,IncrementWrapStencilOp:OR,InstancedBufferAttribute:xc,InstancedBufferGeometry:Y1,InstancedInterleavedBuffer:SB,InstancedMesh:nv,Int16BufferAttribute:z2,Int32BufferAttribute:V2,Int8BufferAttribute:H2,IntType:np,InterleavedBuffer:yh,InterleavedBufferAttribute:xl,Interpolant:Pu,InterpolateDiscrete:Au,InterpolateLinear:uc,InterpolateSmooth:A0,InterpolationSamplingMode:n2,InterpolationSamplingType:t2,InvertStencilOp:FR,KeepStencilOp:Eu,KeyframeTrack:xr,LOD:kb,LatheGeometry:wv,Layers:uh,LessCompare:ob,LessDepth:Dg,LessEqualCompare:M0,LessEqualDepth:vu,LessEqualStencilFunc:zR,LessStencilFunc:PR,Light:bc,LightProbe:X1,Line:Ro,Line3:DB,LineBasicMaterial:Pa,LineCurve:jx,LineCurve3:p1,LineDashedMaterial:U1,LineLoop:fv,LineSegments:yr,LinearFilter:bn,LinearInterpolant:oA,LinearMipMapLinearFilter:tx,LinearMipMapNearestFilter:MR,LinearMipmapLinearFilter:Is,LinearMipmapNearestFilter:yu,LinearSRGBColorSpace:ta,LinearToneMapping:Ky,LinearTransfer:hp,Loader:Ca,LoaderUtils:nr,LoadingManager:Iv,LoopOnce:cp,LoopPingPong:ib,LoopRepeat:nb,MOUSE:_R,Material:Gi,MaterialLoader:Gv,MathUtils:E0,Matrix2:bA,Matrix3:mn,Matrix4:Qt,MaxEquation:PM,Mesh:pi,MeshBasicMaterial:fa,MeshDepthMaterial:iA,MeshDistanceMaterial:aA,MeshLambertMaterial:B1,MeshMatcapMaterial:D1,MeshNormalMaterial:w1,MeshPhongMaterial:C1,MeshPhysicalMaterial:zi,MeshStandardMaterial:Fu,MeshToonMaterial:R1,MinEquation:HM,MirroredRepeatWrapping:_u,MixOperation:$M,MultiplyBlending:qy,MultiplyOperation:$d,NearestFilter:xi,NearestMipMapLinearFilter:SR,NearestMipMapNearestFilter:AR,NearestMipmapLinearFilter:lc,NearestMipmapNearestFilter:tp,NeutralToneMapping:$y,NeverCompare:rb,NeverDepth:wg,NeverStencilFunc:HR,NoBlending:Xr,NoColorSpace:hl,NoNormalPacking:RR,NoToneMapping:mr,NormalAnimationBlendMode:S0,NormalBlending:gu,NormalGAPacking:BR,NormalRGPacking:wR,NotEqualCompare:ub,NotEqualDepth:Og,NotEqualStencilFunc:kR,NumberKeyframeTrack:Al,Object3D:wn,ObjectLoader:$w,ObjectSpaceNormalMap:sb,OctahedronGeometry:Vp,OneFactor:zM,OneMinusConstantAlphaFactor:QM,OneMinusConstantColorFactor:jM,OneMinusDstAlphaFactor:YM,OneMinusDstColorFactor:qM,OneMinusSrcAlphaFactor:Rg,OneMinusSrcColorFactor:kM,OrthographicCamera:El,PCFShadowMap:Kf,PCFSoftShadowMap:Qd,PMREMGenerator:NA,Path:Ev,PerspectiveCamera:ia,Plane:Ac,PlaneGeometry:Mc,PlaneHelper:kB,PointLight:Hv,PointLightHelper:LB,Points:pv,PointsMaterial:Up,PolarGridHelper:HB,PolyhedronGeometry:Sc,PositionalAudio:rB,PropertyBinding:Hn,PropertyMixer:eE,QuadraticBezierCurve:Zx,QuadraticBezierCurve3:Qx,Quaternion:ba,QuaternionKeyframeTrack:Sl,QuaternionLinearInterpolant:I1,R11_EAC_Format:jg,RED_GREEN_RGTC2_Format:y0,RED_RGTC1_Format:v0,REVISION:Zd,RG11_EAC_Format:Qg,RGBADepthPacking:ER,RGBAFormat:ji,RGBAIntegerFormat:Vg,RGBA_ASTC_10x10_Format:f0,RGBA_ASTC_10x5_Format:l0,RGBA_ASTC_10x6_Format:c0,RGBA_ASTC_10x8_Format:u0,RGBA_ASTC_12x10_Format:h0,RGBA_ASTC_12x12_Format:d0,RGBA_ASTC_4x4_Format:e0,RGBA_ASTC_5x4_Format:t0,RGBA_ASTC_5x5_Format:n0,RGBA_ASTC_6x5_Format:i0,RGBA_ASTC_6x6_Format:a0,RGBA_ASTC_8x5_Format:s0,RGBA_ASTC_8x6_Format:r0,RGBA_ASTC_8x8_Format:o0,RGBA_BPTC_Format:p0,RGBA_ETC2_EAC_Format:Wg,RGBA_PVRTC_2BPPV1_Format:Jg,RGBA_PVRTC_4BPPV1_Format:Yg,RGBA_S3TC_DXT1_Format:rp,RGBA_S3TC_DXT3_Format:op,RGBA_S3TC_DXT5_Format:lp,RGBDepthPacking:TR,RGBFormat:sx,RGBIntegerFormat:bR,RGB_BPTC_SIGNED_Format:m0,RGB_BPTC_UNSIGNED_Format:g0,RGB_ETC1_Format:qg,RGB_ETC2_Format:Kg,RGB_PVRTC_2BPPV1_Format:Xg,RGB_PVRTC_4BPPV1_Format:kg,RGB_S3TC_DXT1_Format:sp,RGDepthPacking:CR,RGFormat:xu,RGIntegerFormat:zg,RawShaderMaterial:nA,Ray:lh,Raycaster:SA,RectAreaLight:k1,RedFormat:ip,RedIntegerFormat:ap,ReinhardToneMapping:Wy,RenderTarget:mx,RenderTarget3D:yB,RepeatWrapping:Jr,ReplaceStencilOp:UR,ReverseSubtractEquation:FM,RingGeometry:Bv,SIGNED_R11_EAC_Format:Zg,SIGNED_RED_GREEN_RGTC2_Format:x0,SIGNED_RED_RGTC1_Format:_0,SIGNED_RG11_EAC_Format:$g,SRGBColorSpace:Pi,SRGBTransfer:ti,Scene:Mp,ShaderChunk:An,ShaderLib:Qr,ShaderMaterial:ms,ShadowMaterial:T1,Shape:Ou,ShapeGeometry:Dv,ShapePath:JB,ShapeUtils:Zr,ShortType:Hg,Skeleton:bh,SkeletonHelper:NB,SkinnedMesh:ev,Source:dc,Sphere:ua,SphereGeometry:kp,Spherical:TB,SphericalHarmonics3:dA,SplineCurve:$x,SpotLight:Fv,SpotLightHelper:UB,Sprite:zb,SpriteMaterial:Lx,SrcAlphaFactor:Cg,SrcAlphaSaturateFactor:KM,SrcColorFactor:VM,StaticCopyUsage:jR,StaticDrawUsage:dp,StaticReadUsage:qR,StereoCamera:nB,StreamCopyUsage:QR,StreamDrawUsage:JR,StreamReadUsage:WR,StringKeyframeTrack:zu,SubtractEquation:IM,SubtractiveBlending:Jy,TOUCH:yR,TangentSpaceNormalMap:fc,TetrahedronGeometry:Uv,Texture:qn,TextureLoader:uA,TextureUtils:QB,Timer:bB,TimestampQuery:e2,TorusGeometry:Nv,TorusKnotGeometry:Lv,Triangle:Fs,TriangleFanDrawMode:bu,TriangleStripDrawMode:fp,TrianglesDrawMode:ox,TubeGeometry:Ov,UVMapping:rc,Uint16BufferAttribute:Bx,Uint32BufferAttribute:Dx,Uint8BufferAttribute:P2,Uint8ClampedBufferAttribute:G2,Uniform:AA,UniformsGroup:AB,UniformsLib:Rt,UniformsUtils:Lb,UnsignedByteType:Ma,UnsignedInt101111Type:ix,UnsignedInt248Type:Qf,UnsignedInt5999Type:nx,UnsignedIntType:js,UnsignedShort4444Type:Pg,UnsignedShort5551Type:Gg,UnsignedShortType:Zf,VSMShadowMap:mu,Vector2:et,Vector3:Q,Vector4:ci,VectorKeyframeTrack:Ml,VideoFrameTexture:cw,VideoTexture:o1,WebGL3DRenderTarget:C2,WebGLArrayRenderTarget:T2,WebGLCoordinateSystem:Zs,WebGLCubeRenderTarget:Y0,WebGLRenderTarget:ds,WebGLRenderer:HA,WebGLUtils:zE,WebGPUCoordinateSystem:$f,WebXRController:J0,WireframeGeometry:M1,WrapAroundEnding:up,ZeroCurvatureEnding:Su,ZeroFactor:GM,ZeroSlopeEnding:Mu,ZeroStencilOp:DR,createCanvasElement:pb,error:Wt,getConsoleFunction:s2,log:mp,setConsoleFunction:a2,warn:Et,warnOnce:th},Symbol.toStringTag,{value:"Module"}));var PA={exports:{}},Tl={};var VE;function dL(){return VE||(VE=1,Tl.ConcurrentRoot=1,Tl.ContinuousEventPriority=8,Tl.DefaultEventPriority=32,Tl.DiscreteEventPriority=2,Tl.IdleEventPriority=268435456,Tl.LegacyRoot=0,Tl.NoEventPriority=0),Tl}var kE;function pL(){return kE||(kE=1,PA.exports=dL()),PA.exports}var $v=pL(),GA={exports:{}},zA={},VA={exports:{}},kA={};var XE;function mL(){if(XE)return kA;XE=1;var s=qf();function e(v,y){return v===y&&(v!==0||1/v===1/y)||v!==v&&y!==y}var t=typeof Object.is=="function"?Object.is:e,n=s.useState,i=s.useEffect,o=s.useLayoutEffect,l=s.useDebugValue;function h(v,y){var x=y(),b=n({inst:{value:x,getSnapshot:y}}),R=b[0].inst,T=b[1];return o(function(){R.value=x,R.getSnapshot=y,d(R)&&T({inst:R})},[v,x,y]),i(function(){return d(R)&&T({inst:R}),v(function(){d(R)&&T({inst:R})})},[v]),l(x),x}function d(v){var y=v.getSnapshot;v=v.value;try{var x=y();return!t(v,x)}catch{return!0}}function p(v,y){return y()}var _=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:h;return kA.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:_,kA}var YE;function gL(){return YE||(YE=1,VA.exports=mL()),VA.exports}var JE;function vL(){if(JE)return zA;JE=1;var s=qf(),e=gL();function t(p,_){return p===_&&(p!==0||1/p===1/_)||p!==p&&_!==_}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=s.useRef,l=s.useEffect,h=s.useMemo,d=s.useDebugValue;return zA.useSyncExternalStoreWithSelector=function(p,_,v,y,x){var b=o(null);if(b.current===null){var R={hasValue:!1,value:null};b.current=R}else R=b.current;b=h(function(){function M(O){if(!w){if(w=!0,D=O,O=y(O),x!==void 0&&R.hasValue){var z=R.value;if(x(z,O))return U=z}return U=O}if(z=U,n(D,O))return z;var k=y(O);return x!==void 0&&x(z,k)?(D=O,z):(D=O,U=k)}var w=!1,D,U,F=v===void 0?null:v;return[function(){return M(_())},F===null?void 0:function(){return M(F())}]},[_,v,y,x]);var T=i(p,b[0],b[1]);return l(function(){R.hasValue=!0,R.value=T},[T]),d(T),T},zA}var qE;function _L(){return qE||(qE=1,GA.exports=vL()),GA.exports}var yL=_L();const xL=Iy(yL),KE=s=>{let e;const t=new Set,n=(p,_)=>{const v=typeof p=="function"?p(e):p;if(!Object.is(v,e)){const y=e;e=_??(typeof v!="object"||v===null)?v:Object.assign({},e,v),t.forEach(x=>x(e,y))}},i=()=>e,h={setState:n,getState:i,getInitialState:()=>d,subscribe:p=>(t.add(p),()=>t.delete(p))},d=e=s(n,i,h);return h},AL=(s=>s?KE(s):KE),{useSyncExternalStoreWithSelector:SL}=xL,ML=s=>s;function bL(s,e=ML,t){const n=SL(s.subscribe,s.getState,s.getInitialState,e,t);return MM.useDebugValue(n),n}const WE=(s,e)=>{const t=AL(s),n=(i,o=e)=>bL(t,i,o);return Object.assign(n,t),n},jE=((s,e)=>s?WE(s,e):WE),EL=s=>typeof s=="object"&&typeof s.then=="function",Qu=[];function ZE(s,e,t=(n,i)=>n===i){if(s===e)return!0;if(!s||!e)return!1;const n=s.length;if(e.length!==n)return!1;for(let i=0;i<n;i++)if(!t(s[i],e[i]))return!1;return!0}function QE(s,e=null,t=!1,n={}){e===null&&(e=[s]);for(const o of Qu)if(ZE(e,o.keys,o.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(o,"error"))throw o.error;if(Object.prototype.hasOwnProperty.call(o,"response"))return n.lifespan&&n.lifespan>0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=Qu.indexOf(i);o!==-1&&Qu.splice(o,1)},promise:(EL(s)?s:s(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(Qu.push(i),!t)throw i.promise}const TL=(s,e,t)=>QE(s,e,!1,t),CL=(s,e,t)=>{QE(s,e,!0,t)},RL=s=>{if(s===void 0||s.length===0)Qu.splice(0,Qu.length);else{const e=Qu.find(t=>ZE(s,t.keys,t.equal));e&&e.remove()}};var XA={exports:{}},YA={exports:{}},JA={exports:{}},qA={};var $E;function wL(){return $E||($E=1,(function(s){function e(H,K){var $=H.length;H.push(K);e:for(;0<$;){var ue=$-1>>>1,re=H[ue];if(0<i(re,K))H[ue]=K,H[$]=re,$=ue;else break e}}function t(H){return H.length===0?null:H[0]}function n(H){if(H.length===0)return null;var K=H[0],$=H.pop();if($!==K){H[0]=$;e:for(var ue=0,re=H.length,X=re>>>1;ue<X;){var ne=2*(ue+1)-1,Ae=H[ne],Re=ne+1,rt=H[Re];if(0>i(Ae,$))Re<re&&0>i(rt,Ae)?(H[ue]=rt,H[Re]=$,ue=Re):(H[ue]=Ae,H[ne]=$,ue=ne);else if(Re<re&&0>i(rt,$))H[ue]=rt,H[Re]=$,ue=Re;else break e}}return K}function i(H,K){var $=H.sortIndex-K.sortIndex;return $!==0?$:H.id-K.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;s.unstable_now=function(){return o.now()}}else{var l=Date,h=l.now();s.unstable_now=function(){return l.now()-h}}var d=[],p=[],_=1,v=null,y=3,x=!1,b=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function D(H){for(var K=t(p);K!==null;){if(K.callback===null)n(p);else if(K.startTime<=H)n(p),K.sortIndex=K.expirationTime,e(d,K);else break;K=t(p)}}function U(H){if(R=!1,D(H),!b)if(t(d)!==null)b=!0,se();else{var K=t(p);K!==null&&_e(U,K.startTime-H)}}var F=!1,O=-1,z=5,k=-1;function N(){return!(s.unstable_now()-k<z)}function I(){if(F){var H=s.unstable_now();k=H;var K=!0;try{e:{b=!1,R&&(R=!1,M(O),O=-1),x=!0;var $=y;try{t:{for(D(H),v=t(d);v!==null&&!(v.expirationTime>H&&N());){var ue=v.callback;if(typeof ue=="function"){v.callback=null,y=v.priorityLevel;var re=ue(v.expirationTime<=H);if(H=s.unstable_now(),typeof re=="function"){v.callback=re,D(H),K=!0;break t}v===t(d)&&n(d),D(H)}else n(d);v=t(d)}if(v!==null)K=!0;else{var X=t(p);X!==null&&_e(U,X.startTime-H),K=!1}}break e}finally{v=null,y=$,x=!1}K=void 0}}finally{K?W():F=!1}}}var W;if(typeof w=="function")W=function(){w(I)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ie=ae.port2;ae.port1.onmessage=I,W=function(){ie.postMessage(null)}}else W=function(){T(I,0)};function se(){F||(F=!0,W())}function _e(H,K){O=T(function(){H(s.unstable_now())},K)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(H){H.callback=null},s.unstable_continueExecution=function(){b||x||(b=!0,se())},s.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<H?Math.floor(1e3/H):5},s.unstable_getCurrentPriorityLevel=function(){return y},s.unstable_getFirstCallbackNode=function(){return t(d)},s.unstable_next=function(H){switch(y){case 1:case 2:case 3:var K=3;break;default:K=y}var $=y;y=K;try{return H()}finally{y=$}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(H,K){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var $=y;y=H;try{return K()}finally{y=$}},s.unstable_scheduleCallback=function(H,K,$){var ue=s.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ue+$:ue):$=ue,H){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=$+re,H={id:_++,callback:K,priorityLevel:H,startTime:$,expirationTime:re,sortIndex:-1},$>ue?(H.sortIndex=$,e(p,H),t(d)===null&&H===t(p)&&(R?(M(O),O=-1):R=!0,_e(U,$-ue))):(H.sortIndex=re,e(d,H),b||x||(b=!0,se())),H},s.unstable_shouldYield=N,s.unstable_wrapCallback=function(H){var K=y;return function(){var $=y;y=K;try{return H.apply(this,arguments)}finally{y=$}}}})(qA)),qA}var eT;function BL(){return eT||(eT=1,JA.exports=wL()),JA.exports}var tT;function DL(){return tT||(tT=1,(function(s){s.exports=function(e){function t(c,u,g,S){return new Rm(c,u,g,S)}function n(){}function i(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)u+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(c){return c===null||typeof c!="object"?null:(c=Om&&c[Om]||c["@@iterator"],typeof c=="function"?c:null)}function l(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===Xl?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case Jc:return"Fragment";case or:return"Portal";case Lm:return"Profiler";case Nm:return"StrictMode";case md:return"Suspense";case Zo:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case Dr:return(c.displayName||"Context")+".Provider";case jo:return(c._context.displayName||"Context")+".Consumer";case qc:var u=c.render;return c=c.displayName,c||(c=u.displayName||u.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case Mf:return u=c.displayName||null,u!==null?u:l(c.type)||"Memo";case lr:u=c._payload,c=c._init;try{return l(c(u))}catch{}}return null}function h(c){if(gd===void 0)try{throw Error()}catch(g){var u=g.stack.trim().match(/\n( *(at )?)/);gd=u&&u[1]||"",Im=-1<g.stack.indexOf(`
|
|
4019
|
+
}`;class sL{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new kx(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ms({vertexShader:iL,fragmentShader:aL,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new pi(new Mc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class rL extends Eo{constructor(e,t){super();const n=this;let i=null,o=1,l=null,h="local-floor",d=1,p=null,_=null,v=null,y=null,x=null,b=null;const R=typeof XRWebGLBinding<"u",T=new sL,M={},w=t.getContextAttributes();let D=null,U=null;const F=[],O=[],z=new et;let k=null;const N=new ia;N.viewport=new ci;const I=new ia;I.viewport=new ci;const W=[N,I],ae=new Z1;let ie=null,se=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ve){let Be=F[ve];return Be===void 0&&(Be=new J0,F[ve]=Be),Be.getTargetRaySpace()},this.getControllerGrip=function(ve){let Be=F[ve];return Be===void 0&&(Be=new J0,F[ve]=Be),Be.getGripSpace()},this.getHand=function(ve){let Be=F[ve];return Be===void 0&&(Be=new J0,F[ve]=Be),Be.getHandSpace()};function _e(ve){const Be=O.indexOf(ve.inputSource);if(Be===-1)return;const st=F[Be];st!==void 0&&(st.update(ve.inputSource,ve.frame,p||l),st.dispatchEvent({type:ve.type,data:ve.inputSource}))}function H(){i.removeEventListener("select",_e),i.removeEventListener("selectstart",_e),i.removeEventListener("selectend",_e),i.removeEventListener("squeeze",_e),i.removeEventListener("squeezestart",_e),i.removeEventListener("squeezeend",_e),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",K);for(let ve=0;ve<F.length;ve++){const Be=O[ve];Be!==null&&(O[ve]=null,F[ve].disconnect(Be))}ie=null,se=null,T.reset();for(const ve in M)delete M[ve];e.setRenderTarget(D),x=null,y=null,v=null,i=null,U=null,rt.stop(),n.isPresenting=!1,e.setPixelRatio(k),e.setSize(z.width,z.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ve){o=ve,n.isPresenting===!0&&Et("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ve){h=ve,n.isPresenting===!0&&Et("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return p||l},this.setReferenceSpace=function(ve){p=ve},this.getBaseLayer=function(){return y!==null?y:x},this.getBinding=function(){return v===null&&R&&(v=new XRWebGLBinding(i,t)),v},this.getFrame=function(){return b},this.getSession=function(){return i},this.setSession=async function(ve){if(i=ve,i!==null){if(D=e.getRenderTarget(),i.addEventListener("select",_e),i.addEventListener("selectstart",_e),i.addEventListener("selectend",_e),i.addEventListener("squeeze",_e),i.addEventListener("squeezestart",_e),i.addEventListener("squeezeend",_e),i.addEventListener("end",H),i.addEventListener("inputsourceschange",K),w.xrCompatible!==!0&&await t.makeXRCompatible(),k=e.getPixelRatio(),e.getSize(z),R&&"createProjectionLayer"in XRWebGLBinding.prototype){let st=null,xt=null,Mt=null;w.depth&&(Mt=w.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,st=w.stencil?cc:bo,xt=w.stencil?Qf:js);const $t={colorFormat:t.RGBA8,depthFormat:Mt,scaleFactor:o};v=this.getBinding(),y=v.createProjectionLayer($t),i.updateRenderState({layers:[y]}),e.setPixelRatio(1),e.setSize(y.textureWidth,y.textureHeight,!1),U=new ds(y.textureWidth,y.textureHeight,{format:ji,type:Ma,depthTexture:new Ch(y.textureWidth,y.textureHeight,xt,void 0,void 0,void 0,void 0,void 0,void 0,st),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:y.ignoreDepthValues===!1,resolveStencilBuffer:y.ignoreDepthValues===!1})}else{const st={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:o};x=new XRWebGLLayer(i,t,st),i.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),U=new ds(x.framebufferWidth,x.framebufferHeight,{format:ji,type:Ma,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}U.isXRRenderTarget=!0,this.setFoveation(d),p=null,l=await i.requestReferenceSpace(h),rt.setContext(i),rt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return T.getDepthTexture()};function K(ve){for(let Be=0;Be<ve.removed.length;Be++){const st=ve.removed[Be],xt=O.indexOf(st);xt>=0&&(O[xt]=null,F[xt].disconnect(st))}for(let Be=0;Be<ve.added.length;Be++){const st=ve.added[Be];let xt=O.indexOf(st);if(xt===-1){for(let $t=0;$t<F.length;$t++)if($t>=O.length){O.push(st),xt=$t;break}else if(O[$t]===null){O[$t]=st,xt=$t;break}if(xt===-1)break}const Mt=F[xt];Mt&&Mt.connect(st)}}const $=new Q,ue=new Q;function re(ve,Be,st){$.setFromMatrixPosition(Be.matrixWorld),ue.setFromMatrixPosition(st.matrixWorld);const xt=$.distanceTo(ue),Mt=Be.projectionMatrix.elements,$t=st.projectionMatrix.elements,un=Mt[14]/(Mt[10]-1),Vt=Mt[14]/(Mt[10]+1),Ve=(Mt[9]+1)/Mt[5],nt=(Mt[9]-1)/Mt[5],Ge=(Mt[8]-1)/Mt[0],ft=($t[8]+1)/$t[0],ee=un*Ge,Nt=un*ft,pt=xt/(-Ge+ft),Lt=pt*-Ge;if(Be.matrixWorld.decompose(ve.position,ve.quaternion,ve.scale),ve.translateX(Lt),ve.translateZ(pt),ve.matrixWorld.compose(ve.position,ve.quaternion,ve.scale),ve.matrixWorldInverse.copy(ve.matrixWorld).invert(),Mt[10]===-1)ve.projectionMatrix.copy(Be.projectionMatrix),ve.projectionMatrixInverse.copy(Be.projectionMatrixInverse);else{const gt=un+pt,Z=Vt+pt,P=ee-Lt,me=Nt+(xt-Lt),Le=Ve*Vt/Z*gt,Xe=nt*Vt/Z*gt;ve.projectionMatrix.makePerspective(P,me,Le,Xe,gt,Z),ve.projectionMatrixInverse.copy(ve.projectionMatrix).invert()}}function X(ve,Be){Be===null?ve.matrixWorld.copy(ve.matrix):ve.matrixWorld.multiplyMatrices(Be.matrixWorld,ve.matrix),ve.matrixWorldInverse.copy(ve.matrixWorld).invert()}this.updateCamera=function(ve){if(i===null)return;let Be=ve.near,st=ve.far;T.texture!==null&&(T.depthNear>0&&(Be=T.depthNear),T.depthFar>0&&(st=T.depthFar)),ae.near=I.near=N.near=Be,ae.far=I.far=N.far=st,(ie!==ae.near||se!==ae.far)&&(i.updateRenderState({depthNear:ae.near,depthFar:ae.far}),ie=ae.near,se=ae.far),ae.layers.mask=ve.layers.mask|6,N.layers.mask=ae.layers.mask&3,I.layers.mask=ae.layers.mask&5;const xt=ve.parent,Mt=ae.cameras;X(ae,xt);for(let $t=0;$t<Mt.length;$t++)X(Mt[$t],xt);Mt.length===2?re(ae,N,I):ae.projectionMatrix.copy(N.projectionMatrix),ne(ve,ae,xt)};function ne(ve,Be,st){st===null?ve.matrix.copy(Be.matrixWorld):(ve.matrix.copy(st.matrixWorld),ve.matrix.invert(),ve.matrix.multiply(Be.matrixWorld)),ve.matrix.decompose(ve.position,ve.quaternion,ve.scale),ve.updateMatrixWorld(!0),ve.projectionMatrix.copy(Be.projectionMatrix),ve.projectionMatrixInverse.copy(Be.projectionMatrixInverse),ve.isPerspectiveCamera&&(ve.fov=nh*2*Math.atan(1/ve.projectionMatrix.elements[5]),ve.zoom=1)}this.getCamera=function(){return ae},this.getFoveation=function(){if(!(y===null&&x===null))return d},this.setFoveation=function(ve){d=ve,y!==null&&(y.fixedFoveation=ve),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=ve)},this.hasDepthSensing=function(){return T.texture!==null},this.getDepthSensingMesh=function(){return T.getMesh(ae)},this.getCameraTexture=function(ve){return M[ve]};let Ae=null;function Re(ve,Be){if(_=Be.getViewerPose(p||l),b=Be,_!==null){const st=_.views;x!==null&&(e.setRenderTargetFramebuffer(U,x.framebuffer),e.setRenderTarget(U));let xt=!1;st.length!==ae.cameras.length&&(ae.cameras.length=0,xt=!0);for(let Vt=0;Vt<st.length;Vt++){const Ve=st[Vt];let nt=null;if(x!==null)nt=x.getViewport(Ve);else{const ft=v.getViewSubImage(y,Ve);nt=ft.viewport,Vt===0&&(e.setRenderTargetTextures(U,ft.colorTexture,ft.depthStencilTexture),e.setRenderTarget(U))}let Ge=W[Vt];Ge===void 0&&(Ge=new ia,Ge.layers.enable(Vt),Ge.viewport=new ci,W[Vt]=Ge),Ge.matrix.fromArray(Ve.transform.matrix),Ge.matrix.decompose(Ge.position,Ge.quaternion,Ge.scale),Ge.projectionMatrix.fromArray(Ve.projectionMatrix),Ge.projectionMatrixInverse.copy(Ge.projectionMatrix).invert(),Ge.viewport.set(nt.x,nt.y,nt.width,nt.height),Vt===0&&(ae.matrix.copy(Ge.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale)),xt===!0&&ae.cameras.push(Ge)}const Mt=i.enabledFeatures;if(Mt&&Mt.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&R){v=n.getBinding();const Vt=v.getDepthInformation(st[0]);Vt&&Vt.isValid&&Vt.texture&&T.init(Vt,i.renderState)}if(Mt&&Mt.includes("camera-access")&&R){e.state.unbindTexture(),v=n.getBinding();for(let Vt=0;Vt<st.length;Vt++){const Ve=st[Vt].camera;if(Ve){let nt=M[Ve];nt||(nt=new kx,M[Ve]=nt);const Ge=v.getCameraImage(Ve);nt.sourceTexture=Ge}}}}for(let st=0;st<F.length;st++){const xt=O[st],Mt=F[st];xt!==null&&Mt!==void 0&&Mt.update(xt,Be,p||l)}Ae&&Ae(ve,Be),Be.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Be}),b=null}const rt=new pE;rt.setAnimationLoop(Re),this.setAnimationLoop=function(ve){Ae=ve},this.dispose=function(){}}}const Zu=new er,oL=new Qt;function lL(s,e){function t(T,M){T.matrixAutoUpdate===!0&&T.updateMatrix(),M.value.copy(T.matrix)}function n(T,M){M.color.getRGB(T.fogColor.value,Nb(s)),M.isFog?(T.fogNear.value=M.near,T.fogFar.value=M.far):M.isFogExp2&&(T.fogDensity.value=M.density)}function i(T,M,w,D,U){M.isMeshBasicMaterial||M.isMeshLambertMaterial?o(T,M):M.isMeshToonMaterial?(o(T,M),v(T,M)):M.isMeshPhongMaterial?(o(T,M),_(T,M)):M.isMeshStandardMaterial?(o(T,M),y(T,M),M.isMeshPhysicalMaterial&&x(T,M,U)):M.isMeshMatcapMaterial?(o(T,M),b(T,M)):M.isMeshDepthMaterial?o(T,M):M.isMeshDistanceMaterial?(o(T,M),R(T,M)):M.isMeshNormalMaterial?o(T,M):M.isLineBasicMaterial?(l(T,M),M.isLineDashedMaterial&&h(T,M)):M.isPointsMaterial?d(T,M,w,D):M.isSpriteMaterial?p(T,M):M.isShadowMaterial?(T.color.value.copy(M.color),T.opacity.value=M.opacity):M.isShaderMaterial&&(M.uniformsNeedUpdate=!1)}function o(T,M){T.opacity.value=M.opacity,M.color&&T.diffuse.value.copy(M.color),M.emissive&&T.emissive.value.copy(M.emissive).multiplyScalar(M.emissiveIntensity),M.map&&(T.map.value=M.map,t(M.map,T.mapTransform)),M.alphaMap&&(T.alphaMap.value=M.alphaMap,t(M.alphaMap,T.alphaMapTransform)),M.bumpMap&&(T.bumpMap.value=M.bumpMap,t(M.bumpMap,T.bumpMapTransform),T.bumpScale.value=M.bumpScale,M.side===fs&&(T.bumpScale.value*=-1)),M.normalMap&&(T.normalMap.value=M.normalMap,t(M.normalMap,T.normalMapTransform),T.normalScale.value.copy(M.normalScale),M.side===fs&&T.normalScale.value.negate()),M.displacementMap&&(T.displacementMap.value=M.displacementMap,t(M.displacementMap,T.displacementMapTransform),T.displacementScale.value=M.displacementScale,T.displacementBias.value=M.displacementBias),M.emissiveMap&&(T.emissiveMap.value=M.emissiveMap,t(M.emissiveMap,T.emissiveMapTransform)),M.specularMap&&(T.specularMap.value=M.specularMap,t(M.specularMap,T.specularMapTransform)),M.alphaTest>0&&(T.alphaTest.value=M.alphaTest);const w=e.get(M),D=w.envMap,U=w.envMapRotation;D&&(T.envMap.value=D,Zu.copy(U),Zu.x*=-1,Zu.y*=-1,Zu.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Zu.y*=-1,Zu.z*=-1),T.envMapRotation.value.setFromMatrix4(oL.makeRotationFromEuler(Zu)),T.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,T.reflectivity.value=M.reflectivity,T.ior.value=M.ior,T.refractionRatio.value=M.refractionRatio),M.lightMap&&(T.lightMap.value=M.lightMap,T.lightMapIntensity.value=M.lightMapIntensity,t(M.lightMap,T.lightMapTransform)),M.aoMap&&(T.aoMap.value=M.aoMap,T.aoMapIntensity.value=M.aoMapIntensity,t(M.aoMap,T.aoMapTransform))}function l(T,M){T.diffuse.value.copy(M.color),T.opacity.value=M.opacity,M.map&&(T.map.value=M.map,t(M.map,T.mapTransform))}function h(T,M){T.dashSize.value=M.dashSize,T.totalSize.value=M.dashSize+M.gapSize,T.scale.value=M.scale}function d(T,M,w,D){T.diffuse.value.copy(M.color),T.opacity.value=M.opacity,T.size.value=M.size*w,T.scale.value=D*.5,M.map&&(T.map.value=M.map,t(M.map,T.uvTransform)),M.alphaMap&&(T.alphaMap.value=M.alphaMap,t(M.alphaMap,T.alphaMapTransform)),M.alphaTest>0&&(T.alphaTest.value=M.alphaTest)}function p(T,M){T.diffuse.value.copy(M.color),T.opacity.value=M.opacity,T.rotation.value=M.rotation,M.map&&(T.map.value=M.map,t(M.map,T.mapTransform)),M.alphaMap&&(T.alphaMap.value=M.alphaMap,t(M.alphaMap,T.alphaMapTransform)),M.alphaTest>0&&(T.alphaTest.value=M.alphaTest)}function _(T,M){T.specular.value.copy(M.specular),T.shininess.value=Math.max(M.shininess,1e-4)}function v(T,M){M.gradientMap&&(T.gradientMap.value=M.gradientMap)}function y(T,M){T.metalness.value=M.metalness,M.metalnessMap&&(T.metalnessMap.value=M.metalnessMap,t(M.metalnessMap,T.metalnessMapTransform)),T.roughness.value=M.roughness,M.roughnessMap&&(T.roughnessMap.value=M.roughnessMap,t(M.roughnessMap,T.roughnessMapTransform)),M.envMap&&(T.envMapIntensity.value=M.envMapIntensity)}function x(T,M,w){T.ior.value=M.ior,M.sheen>0&&(T.sheenColor.value.copy(M.sheenColor).multiplyScalar(M.sheen),T.sheenRoughness.value=M.sheenRoughness,M.sheenColorMap&&(T.sheenColorMap.value=M.sheenColorMap,t(M.sheenColorMap,T.sheenColorMapTransform)),M.sheenRoughnessMap&&(T.sheenRoughnessMap.value=M.sheenRoughnessMap,t(M.sheenRoughnessMap,T.sheenRoughnessMapTransform))),M.clearcoat>0&&(T.clearcoat.value=M.clearcoat,T.clearcoatRoughness.value=M.clearcoatRoughness,M.clearcoatMap&&(T.clearcoatMap.value=M.clearcoatMap,t(M.clearcoatMap,T.clearcoatMapTransform)),M.clearcoatRoughnessMap&&(T.clearcoatRoughnessMap.value=M.clearcoatRoughnessMap,t(M.clearcoatRoughnessMap,T.clearcoatRoughnessMapTransform)),M.clearcoatNormalMap&&(T.clearcoatNormalMap.value=M.clearcoatNormalMap,t(M.clearcoatNormalMap,T.clearcoatNormalMapTransform),T.clearcoatNormalScale.value.copy(M.clearcoatNormalScale),M.side===fs&&T.clearcoatNormalScale.value.negate())),M.dispersion>0&&(T.dispersion.value=M.dispersion),M.iridescence>0&&(T.iridescence.value=M.iridescence,T.iridescenceIOR.value=M.iridescenceIOR,T.iridescenceThicknessMinimum.value=M.iridescenceThicknessRange[0],T.iridescenceThicknessMaximum.value=M.iridescenceThicknessRange[1],M.iridescenceMap&&(T.iridescenceMap.value=M.iridescenceMap,t(M.iridescenceMap,T.iridescenceMapTransform)),M.iridescenceThicknessMap&&(T.iridescenceThicknessMap.value=M.iridescenceThicknessMap,t(M.iridescenceThicknessMap,T.iridescenceThicknessMapTransform))),M.transmission>0&&(T.transmission.value=M.transmission,T.transmissionSamplerMap.value=w.texture,T.transmissionSamplerSize.value.set(w.width,w.height),M.transmissionMap&&(T.transmissionMap.value=M.transmissionMap,t(M.transmissionMap,T.transmissionMapTransform)),T.thickness.value=M.thickness,M.thicknessMap&&(T.thicknessMap.value=M.thicknessMap,t(M.thicknessMap,T.thicknessMapTransform)),T.attenuationDistance.value=M.attenuationDistance,T.attenuationColor.value.copy(M.attenuationColor)),M.anisotropy>0&&(T.anisotropyVector.value.set(M.anisotropy*Math.cos(M.anisotropyRotation),M.anisotropy*Math.sin(M.anisotropyRotation)),M.anisotropyMap&&(T.anisotropyMap.value=M.anisotropyMap,t(M.anisotropyMap,T.anisotropyMapTransform))),T.specularIntensity.value=M.specularIntensity,T.specularColor.value.copy(M.specularColor),M.specularColorMap&&(T.specularColorMap.value=M.specularColorMap,t(M.specularColorMap,T.specularColorMapTransform)),M.specularIntensityMap&&(T.specularIntensityMap.value=M.specularIntensityMap,t(M.specularIntensityMap,T.specularIntensityMapTransform))}function b(T,M){M.matcap&&(T.matcap.value=M.matcap)}function R(T,M){const w=e.get(M).light;T.referencePosition.value.setFromMatrixPosition(w.matrixWorld),T.nearDistance.value=w.shadow.camera.near,T.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function cL(s,e,t,n){let i={},o={},l=[];const h=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function d(w,D){const U=D.program;n.uniformBlockBinding(w,U)}function p(w,D){let U=i[w.id];U===void 0&&(b(w),U=_(w),i[w.id]=U,w.addEventListener("dispose",T));const F=D.program;n.updateUBOMapping(w,F);const O=e.render.frame;o[w.id]!==O&&(y(w),o[w.id]=O)}function _(w){const D=v();w.__bindingPointIndex=D;const U=s.createBuffer(),F=w.__size,O=w.usage;return s.bindBuffer(s.UNIFORM_BUFFER,U),s.bufferData(s.UNIFORM_BUFFER,F,O),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,D,U),U}function v(){for(let w=0;w<h;w++)if(l.indexOf(w)===-1)return l.push(w),w;return Wt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function y(w){const D=i[w.id],U=w.uniforms,F=w.__cache;s.bindBuffer(s.UNIFORM_BUFFER,D);for(let O=0,z=U.length;O<z;O++){const k=Array.isArray(U[O])?U[O]:[U[O]];for(let N=0,I=k.length;N<I;N++){const W=k[N];if(x(W,O,N,F)===!0){const ae=W.__offset,ie=Array.isArray(W.value)?W.value:[W.value];let se=0;for(let _e=0;_e<ie.length;_e++){const H=ie[_e],K=R(H);typeof H=="number"||typeof H=="boolean"?(W.__data[0]=H,s.bufferSubData(s.UNIFORM_BUFFER,ae+se,W.__data)):H.isMatrix3?(W.__data[0]=H.elements[0],W.__data[1]=H.elements[1],W.__data[2]=H.elements[2],W.__data[3]=0,W.__data[4]=H.elements[3],W.__data[5]=H.elements[4],W.__data[6]=H.elements[5],W.__data[7]=0,W.__data[8]=H.elements[6],W.__data[9]=H.elements[7],W.__data[10]=H.elements[8],W.__data[11]=0):(H.toArray(W.__data,se),se+=K.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,ae,W.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function x(w,D,U,F){const O=w.value,z=D+"_"+U;if(F[z]===void 0)return typeof O=="number"||typeof O=="boolean"?F[z]=O:F[z]=O.clone(),!0;{const k=F[z];if(typeof O=="number"||typeof O=="boolean"){if(k!==O)return F[z]=O,!0}else if(k.equals(O)===!1)return k.copy(O),!0}return!1}function b(w){const D=w.uniforms;let U=0;const F=16;for(let z=0,k=D.length;z<k;z++){const N=Array.isArray(D[z])?D[z]:[D[z]];for(let I=0,W=N.length;I<W;I++){const ae=N[I],ie=Array.isArray(ae.value)?ae.value:[ae.value];for(let se=0,_e=ie.length;se<_e;se++){const H=ie[se],K=R(H),$=U%F,ue=$%K.boundary,re=$+ue;U+=ue,re!==0&&F-re<K.storage&&(U+=F-re),ae.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),ae.__offset=U,U+=K.storage}}}const O=U%F;return O>0&&(U+=F-O),w.__size=U,w.__cache={},this}function R(w){const D={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(D.boundary=4,D.storage=4):w.isVector2?(D.boundary=8,D.storage=8):w.isVector3||w.isColor?(D.boundary=16,D.storage=12):w.isVector4?(D.boundary=16,D.storage=16):w.isMatrix3?(D.boundary=48,D.storage=48):w.isMatrix4?(D.boundary=64,D.storage=64):w.isTexture?Et("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Et("WebGLRenderer: Unsupported uniform value type.",w),D}function T(w){const D=w.target;D.removeEventListener("dispose",T);const U=l.indexOf(D.__bindingPointIndex);l.splice(U,1),s.deleteBuffer(i[D.id]),delete i[D.id],delete o[D.id]}function M(){for(const w in i)s.deleteBuffer(i[w]);l=[],i={},o={}}return{bind:d,update:p,dispose:M}}const uL=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Bo=null;function fL(){return Bo===null&&(Bo=new _r(uL,16,16,xu,Hi),Bo.name="DFG_LUT",Bo.minFilter=bn,Bo.magFilter=bn,Bo.wrapS=yi,Bo.wrapT=yi,Bo.generateMipmaps=!1,Bo.needsUpdate=!0),Bo}class HA{constructor(e={}){const{canvas:t=pb(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:h=!1,premultipliedAlpha:d=!0,preserveDrawingBuffer:p=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:v=!1,reversedDepthBuffer:y=!1,outputBufferType:x=Ma}=e;this.isWebGLRenderer=!0;let b;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");b=n.getContextAttributes().alpha}else b=l;const R=x,T=new Set([Vg,zg,ap]),M=new Set([Ma,js,Zf,Qf,Pg,Gg]),w=new Uint32Array(4),D=new Int32Array(4);let U=null,F=null;const O=[],z=[];let k=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=mr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const N=this;let I=!1;this._outputColorSpace=Pi;let W=0,ae=0,ie=null,se=-1,_e=null;const H=new ci,K=new ci;let $=null;const ue=new At(0);let re=0,X=t.width,ne=t.height,Ae=1,Re=null,rt=null;const ve=new ci(0,0,X,ne),Be=new ci(0,0,X,ne);let st=!1;const xt=new Th;let Mt=!1,$t=!1;const un=new Qt,Vt=new Q,Ve=new ci,nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ge=!1;function ft(){return ie===null?Ae:1}let ee=n;function Nt(V,te){return t.getContext(V,te)}try{const V={alpha:!0,depth:i,stencil:o,antialias:h,premultipliedAlpha:d,preserveDrawingBuffer:p,powerPreference:_,failIfMajorPerformanceCaveat:v};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Zd}`),t.addEventListener("webglcontextlost",zt,!1),t.addEventListener("webglcontextrestored",hn,!1),t.addEventListener("webglcontextcreationerror",dn,!1),ee===null){const te="webgl2";if(ee=Nt(te,V),ee===null)throw Nt(te)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(V){throw Wt("WebGLRenderer: "+V.message),V}let pt,Lt,gt,Z,P,me,Le,Xe,Fe,Bt,_t,Ot,kt,Ke,Qe,St,yt,lt,Ft,pe,De,ot,bt,it;function qe(){pt=new hU(ee),pt.init(),ot=new zE(ee,pt),Lt=new iU(ee,pt,e,ot),gt=new tL(ee,pt),Lt.reversedDepthBuffer&&y&>.buffers.depth.setReversed(!0),Z=new mU(ee),P=new GN,me=new nL(ee,pt,gt,P,Lt,ot,Z),Le=new sU(N),Xe=new fU(N),Fe=new $B(ee),bt=new tU(ee,Fe),Bt=new dU(ee,Fe,Z,bt),_t=new vU(ee,Bt,Fe,Z),Ft=new gU(ee,Lt,me),St=new aU(P),Ot=new PN(N,Le,Xe,pt,Lt,bt,St),kt=new lL(N,P),Ke=new VN,Qe=new KN(pt),lt=new eU(N,Le,Xe,gt,_t,b,d),yt=new $N(N,_t,Lt),it=new cL(ee,Z,Lt,gt),pe=new nU(ee,pt,Z),De=new pU(ee,pt,Z),Z.programs=Ot.programs,N.capabilities=Lt,N.extensions=pt,N.properties=P,N.renderLists=Ke,N.shadowMap=yt,N.state=gt,N.info=Z}qe(),R!==Ma&&(k=new yU(R,t.width,t.height,i,o));const mt=new rL(N,ee);this.xr=mt,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const V=pt.get("WEBGL_lose_context");V&&V.loseContext()},this.forceContextRestore=function(){const V=pt.get("WEBGL_lose_context");V&&V.restoreContext()},this.getPixelRatio=function(){return Ae},this.setPixelRatio=function(V){V!==void 0&&(Ae=V,this.setSize(X,ne,!1))},this.getSize=function(V){return V.set(X,ne)},this.setSize=function(V,te,fe=!0){if(mt.isPresenting){Et("WebGLRenderer: Can't change size while VR device is presenting.");return}X=V,ne=te,t.width=Math.floor(V*Ae),t.height=Math.floor(te*Ae),fe===!0&&(t.style.width=V+"px",t.style.height=te+"px"),k!==null&&k.setSize(t.width,t.height),this.setViewport(0,0,V,te)},this.getDrawingBufferSize=function(V){return V.set(X*Ae,ne*Ae).floor()},this.setDrawingBufferSize=function(V,te,fe){X=V,ne=te,Ae=fe,t.width=Math.floor(V*fe),t.height=Math.floor(te*fe),this.setViewport(0,0,V,te)},this.setEffects=function(V){if(R===Ma){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(V){for(let te=0;te<V.length;te++)if(V[te].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}k.setEffects(V||[])},this.getCurrentViewport=function(V){return V.copy(H)},this.getViewport=function(V){return V.copy(ve)},this.setViewport=function(V,te,fe,he){V.isVector4?ve.set(V.x,V.y,V.z,V.w):ve.set(V,te,fe,he),gt.viewport(H.copy(ve).multiplyScalar(Ae).round())},this.getScissor=function(V){return V.copy(Be)},this.setScissor=function(V,te,fe,he){V.isVector4?Be.set(V.x,V.y,V.z,V.w):Be.set(V,te,fe,he),gt.scissor(K.copy(Be).multiplyScalar(Ae).round())},this.getScissorTest=function(){return st},this.setScissorTest=function(V){gt.setScissorTest(st=V)},this.setOpaqueSort=function(V){Re=V},this.setTransparentSort=function(V){rt=V},this.getClearColor=function(V){return V.copy(lt.getClearColor())},this.setClearColor=function(){lt.setClearColor(...arguments)},this.getClearAlpha=function(){return lt.getClearAlpha()},this.setClearAlpha=function(){lt.setClearAlpha(...arguments)},this.clear=function(V=!0,te=!0,fe=!0){let he=0;if(V){let oe=!1;if(ie!==null){const We=ie.texture.format;oe=T.has(We)}if(oe){const We=ie.texture.type,je=M.has(We),tt=lt.getClearColor(),ht=lt.getClearAlpha(),ct=tt.r,It=tt.g,dt=tt.b;je?(w[0]=ct,w[1]=It,w[2]=dt,w[3]=ht,ee.clearBufferuiv(ee.COLOR,0,w)):(D[0]=ct,D[1]=It,D[2]=dt,D[3]=ht,ee.clearBufferiv(ee.COLOR,0,D))}else he|=ee.COLOR_BUFFER_BIT}te&&(he|=ee.DEPTH_BUFFER_BIT),fe&&(he|=ee.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ee.clear(he)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",zt,!1),t.removeEventListener("webglcontextrestored",hn,!1),t.removeEventListener("webglcontextcreationerror",dn,!1),lt.dispose(),Ke.dispose(),Qe.dispose(),P.dispose(),Le.dispose(),Xe.dispose(),_t.dispose(),bt.dispose(),it.dispose(),Ot.dispose(),mt.dispose(),mt.removeEventListener("sessionstart",Ga),mt.removeEventListener("sessionend",gi),qt.stop()};function zt(V){V.preventDefault(),mp("WebGLRenderer: Context Lost."),I=!0}function hn(){mp("WebGLRenderer: Context Restored."),I=!1;const V=Z.autoReset,te=yt.enabled,fe=yt.autoUpdate,he=yt.needsUpdate,oe=yt.type;qe(),Z.autoReset=V,yt.enabled=te,yt.autoUpdate=fe,yt.needsUpdate=he,yt.type=oe}function dn(V){Wt("WebGLRenderer: A WebGL context could not be created. Reason: ",V.statusMessage)}function Di(V){const te=V.target;te.removeEventListener("dispose",Di),Ra(te)}function Ra(V){eo(V),P.remove(V)}function eo(V){const te=P.get(V).programs;te!==void 0&&(te.forEach(function(fe){Ot.releaseProgram(fe)}),V.isShaderMaterial&&Ot.releaseShaderCache(V))}this.renderBufferDirect=function(V,te,fe,he,oe,We){te===null&&(te=nt);const je=oe.isMesh&&oe.matrixWorld.determinant()<0,tt=Ue(V,te,fe,he,oe);gt.setMaterial(he,je);let ht=fe.index,ct=1;if(he.wireframe===!0){if(ht=Bt.getWireframeAttribute(fe),ht===void 0)return;ct=2}const It=fe.drawRange,dt=fe.attributes.position;let Dt=It.start*ct,gn=(It.start+It.count)*ct;We!==null&&(Dt=Math.max(Dt,We.start*ct),gn=Math.min(gn,(We.start+We.count)*ct)),ht!==null?(Dt=Math.max(Dt,0),gn=Math.min(gn,ht.count)):dt!=null&&(Dt=Math.max(Dt,0),gn=Math.min(gn,dt.count));const Xn=gn-Dt;if(Xn<0||Xn===1/0)return;bt.setup(oe,he,tt,fe,ht);let xn,Xt=pe;if(ht!==null&&(xn=Fe.get(ht),Xt=De,Xt.setIndex(xn)),oe.isMesh)he.wireframe===!0?(gt.setLineWidth(he.wireframeLinewidth*ft()),Xt.setMode(ee.LINES)):Xt.setMode(ee.TRIANGLES);else if(oe.isLine){let Tt=he.linewidth;Tt===void 0&&(Tt=1),gt.setLineWidth(Tt*ft()),oe.isLineSegments?Xt.setMode(ee.LINES):oe.isLineLoop?Xt.setMode(ee.LINE_LOOP):Xt.setMode(ee.LINE_STRIP)}else oe.isPoints?Xt.setMode(ee.POINTS):oe.isSprite&&Xt.setMode(ee.TRIANGLES);if(oe.isBatchedMesh)if(oe._multiDrawInstances!==null)th("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Xt.renderMultiDrawInstances(oe._multiDrawStarts,oe._multiDrawCounts,oe._multiDrawCount,oe._multiDrawInstances);else if(pt.get("WEBGL_multi_draw"))Xt.renderMultiDraw(oe._multiDrawStarts,oe._multiDrawCounts,oe._multiDrawCount);else{const Tt=oe._multiDrawStarts,Kt=oe._multiDrawCounts,Ct=oe._multiDrawCount,Yn=ht?Fe.get(ht).bytesPerElement:1,aa=P.get(he).currentProgram.getUniforms();for(let kn=0;kn<Ct;kn++)aa.setValue(ee,"_gl_DrawID",kn),Xt.render(Tt[kn]/Yn,Kt[kn])}else if(oe.isInstancedMesh)Xt.renderInstances(Dt,Xn,oe.count);else if(fe.isInstancedBufferGeometry){const Tt=fe._maxInstanceCount!==void 0?fe._maxInstanceCount:1/0,Kt=Math.min(fe.instanceCount,Tt);Xt.renderInstances(Dt,Xn,Kt)}else Xt.render(Dt,Xn)};function ir(V,te,fe){V.transparent===!0&&V.side===Ws&&V.forceSinglePass===!1?(V.side=fs,V.needsUpdate=!0,de(V,te,fe),V.side=kr,V.needsUpdate=!0,de(V,te,fe),V.side=Ws):de(V,te,fe)}this.compile=function(V,te,fe=null){fe===null&&(fe=V),F=Qe.get(fe),F.init(te),z.push(F),fe.traverseVisible(function(oe){oe.isLight&&oe.layers.test(te.layers)&&(F.pushLight(oe),oe.castShadow&&F.pushShadow(oe))}),V!==fe&&V.traverseVisible(function(oe){oe.isLight&&oe.layers.test(te.layers)&&(F.pushLight(oe),oe.castShadow&&F.pushShadow(oe))}),F.setupLights();const he=new Set;return V.traverse(function(oe){if(!(oe.isMesh||oe.isPoints||oe.isLine||oe.isSprite))return;const We=oe.material;if(We)if(Array.isArray(We))for(let je=0;je<We.length;je++){const tt=We[je];ir(tt,fe,oe),he.add(tt)}else ir(We,fe,oe),he.add(We)}),F=z.pop(),he},this.compileAsync=function(V,te,fe=null){const he=this.compile(V,te,fe);return new Promise(oe=>{function We(){if(he.forEach(function(je){P.get(je).currentProgram.isReady()&&he.delete(je)}),he.size===0){oe(V);return}setTimeout(We,10)}pt.get("KHR_parallel_shader_compile")!==null?We():setTimeout(We,10)})};let ma=null;function wa(V){ma&&ma(V)}function Ga(){qt.stop()}function gi(){qt.start()}const qt=new pE;qt.setAnimationLoop(wa),typeof self<"u"&&qt.setContext(self),this.setAnimationLoop=function(V){ma=V,mt.setAnimationLoop(V),V===null?qt.stop():qt.start()},mt.addEventListener("sessionstart",Ga),mt.addEventListener("sessionend",gi),this.render=function(V,te){if(te!==void 0&&te.isCamera!==!0){Wt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;const fe=mt.enabled===!0&&mt.isPresenting===!0,he=k!==null&&(ie===null||fe)&&k.begin(N,ie);if(V.matrixWorldAutoUpdate===!0&&V.updateMatrixWorld(),te.parent===null&&te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),mt.enabled===!0&&mt.isPresenting===!0&&(k===null||k.isCompositing()===!1)&&(mt.cameraAutoUpdate===!0&&mt.updateCamera(te),te=mt.getCamera()),V.isScene===!0&&V.onBeforeRender(N,V,te,ie),F=Qe.get(V,z.length),F.init(te),z.push(F),un.multiplyMatrices(te.projectionMatrix,te.matrixWorldInverse),xt.setFromProjectionMatrix(un,Zs,te.reversedDepth),$t=this.localClippingEnabled,Mt=St.init(this.clippingPlanes,$t),U=Ke.get(V,O.length),U.init(),O.push(U),mt.enabled===!0&&mt.isPresenting===!0){const je=N.xr.getDepthSensingMesh();je!==null&&ki(je,te,-1/0,N.sortObjects)}ki(V,te,0,N.sortObjects),U.finish(),N.sortObjects===!0&&U.sort(Re,rt),Ge=mt.enabled===!1||mt.isPresenting===!1||mt.hasDepthSensing()===!1,Ge&<.addToRenderList(U,V),this.info.render.frame++,Mt===!0&&St.beginShadows();const oe=F.state.shadowsArray;if(yt.render(oe,V,te),Mt===!0&&St.endShadows(),this.info.autoReset===!0&&this.info.reset(),(he&&k.hasRenderPass())===!1){const je=U.opaque,tt=U.transmissive;if(F.setupLights(),te.isArrayCamera){const ht=te.cameras;if(tt.length>0)for(let ct=0,It=ht.length;ct<It;ct++){const dt=ht[ct];G(je,tt,V,dt)}Ge&<.render(V);for(let ct=0,It=ht.length;ct<It;ct++){const dt=ht[ct];ln(U,V,dt,dt.viewport)}}else tt.length>0&&G(je,tt,V,te),Ge&<.render(V),ln(U,V,te)}ie!==null&&ae===0&&(me.updateMultisampleRenderTarget(ie),me.updateRenderTargetMipmap(ie)),he&&k.end(N),V.isScene===!0&&V.onAfterRender(N,V,te),bt.resetDefaultState(),se=-1,_e=null,z.pop(),z.length>0?(F=z[z.length-1],Mt===!0&&St.setGlobalState(N.clippingPlanes,F.state.camera)):F=null,O.pop(),O.length>0?U=O[O.length-1]:U=null};function ki(V,te,fe,he){if(V.visible===!1)return;if(V.layers.test(te.layers)){if(V.isGroup)fe=V.renderOrder;else if(V.isLOD)V.autoUpdate===!0&&V.update(te);else if(V.isLight)F.pushLight(V),V.castShadow&&F.pushShadow(V);else if(V.isSprite){if(!V.frustumCulled||xt.intersectsSprite(V)){he&&Ve.setFromMatrixPosition(V.matrixWorld).applyMatrix4(un);const je=_t.update(V),tt=V.material;tt.visible&&U.push(V,je,tt,fe,Ve.z,null)}}else if((V.isMesh||V.isLine||V.isPoints)&&(!V.frustumCulled||xt.intersectsObject(V))){const je=_t.update(V),tt=V.material;if(he&&(V.boundingSphere!==void 0?(V.boundingSphere===null&&V.computeBoundingSphere(),Ve.copy(V.boundingSphere.center)):(je.boundingSphere===null&&je.computeBoundingSphere(),Ve.copy(je.boundingSphere.center)),Ve.applyMatrix4(V.matrixWorld).applyMatrix4(un)),Array.isArray(tt)){const ht=je.groups;for(let ct=0,It=ht.length;ct<It;ct++){const dt=ht[ct],Dt=tt[dt.materialIndex];Dt&&Dt.visible&&U.push(V,je,Dt,fe,Ve.z,dt)}}else tt.visible&&U.push(V,je,tt,fe,Ve.z,null)}}const We=V.children;for(let je=0,tt=We.length;je<tt;je++)ki(We[je],te,fe,he)}function ln(V,te,fe,he){const{opaque:oe,transmissive:We,transparent:je}=V;F.setupLightsView(fe),Mt===!0&&St.setGlobalState(N.clippingPlanes,fe),he&>.viewport(H.copy(he)),oe.length>0&&q(oe,te,fe),We.length>0&&q(We,te,fe),je.length>0&&q(je,te,fe),gt.buffers.depth.setTest(!0),gt.buffers.depth.setMask(!0),gt.buffers.color.setMask(!0),gt.setPolygonOffset(!1)}function G(V,te,fe,he){if((fe.isScene===!0?fe.overrideMaterial:null)!==null)return;if(F.state.transmissionRenderTarget[he.id]===void 0){const Dt=pt.has("EXT_color_buffer_half_float")||pt.has("EXT_color_buffer_float");F.state.transmissionRenderTarget[he.id]=new ds(1,1,{generateMipmaps:!0,type:Dt?Hi:Ma,minFilter:Is,samples:Lt.samples,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Tn.workingColorSpace})}const We=F.state.transmissionRenderTarget[he.id],je=he.viewport||H;We.setSize(je.z*N.transmissionResolutionScale,je.w*N.transmissionResolutionScale);const tt=N.getRenderTarget(),ht=N.getActiveCubeFace(),ct=N.getActiveMipmapLevel();N.setRenderTarget(We),N.getClearColor(ue),re=N.getClearAlpha(),re<1&&N.setClearColor(16777215,.5),N.clear(),Ge&<.render(fe);const It=N.toneMapping;N.toneMapping=mr;const dt=he.viewport;if(he.viewport!==void 0&&(he.viewport=void 0),F.setupLightsView(he),Mt===!0&&St.setGlobalState(N.clippingPlanes,he),q(V,fe,he),me.updateMultisampleRenderTarget(We),me.updateRenderTargetMipmap(We),pt.has("WEBGL_multisampled_render_to_texture")===!1){let Dt=!1;for(let gn=0,Xn=te.length;gn<Xn;gn++){const xn=te[gn],{object:Xt,geometry:Tt,material:Kt,group:Ct}=xn;if(Kt.side===Ws&&Xt.layers.test(he.layers)){const Yn=Kt.side;Kt.side=fs,Kt.needsUpdate=!0,j(Xt,fe,he,Tt,Kt,Ct),Kt.side=Yn,Kt.needsUpdate=!0,Dt=!0}}Dt===!0&&(me.updateMultisampleRenderTarget(We),me.updateRenderTargetMipmap(We))}N.setRenderTarget(tt,ht,ct),N.setClearColor(ue,re),dt!==void 0&&(he.viewport=dt),N.toneMapping=It}function q(V,te,fe){const he=te.isScene===!0?te.overrideMaterial:null;for(let oe=0,We=V.length;oe<We;oe++){const je=V[oe],{object:tt,geometry:ht,group:ct}=je;let It=je.material;It.allowOverride===!0&&he!==null&&(It=he),tt.layers.test(fe.layers)&&j(tt,te,fe,ht,It,ct)}}function j(V,te,fe,he,oe,We){V.onBeforeRender(N,te,fe,he,oe,We),V.modelViewMatrix.multiplyMatrices(fe.matrixWorldInverse,V.matrixWorld),V.normalMatrix.getNormalMatrix(V.modelViewMatrix),oe.onBeforeRender(N,te,fe,he,V,We),oe.transparent===!0&&oe.side===Ws&&oe.forceSinglePass===!1?(oe.side=fs,oe.needsUpdate=!0,N.renderBufferDirect(fe,te,he,oe,V,We),oe.side=kr,oe.needsUpdate=!0,N.renderBufferDirect(fe,te,he,oe,V,We),oe.side=Ws):N.renderBufferDirect(fe,te,he,oe,V,We),V.onAfterRender(N,te,fe,he,oe,We)}function de(V,te,fe){te.isScene!==!0&&(te=nt);const he=P.get(V),oe=F.state.lights,We=F.state.shadowsArray,je=oe.state.version,tt=Ot.getParameters(V,oe.state,We,te,fe),ht=Ot.getProgramCacheKey(tt);let ct=he.programs;he.environment=V.isMeshStandardMaterial?te.environment:null,he.fog=te.fog,he.envMap=(V.isMeshStandardMaterial?Xe:Le).get(V.envMap||he.environment),he.envMapRotation=he.environment!==null&&V.envMap===null?te.environmentRotation:V.envMapRotation,ct===void 0&&(V.addEventListener("dispose",Di),ct=new Map,he.programs=ct);let It=ct.get(ht);if(It!==void 0){if(he.currentProgram===It&&he.lightsStateVersion===je)return xe(V,tt),It}else tt.uniforms=Ot.getUniforms(V),V.onBeforeCompile(tt,N),It=Ot.acquireProgram(tt,ht),ct.set(ht,It),he.uniforms=tt.uniforms;const dt=he.uniforms;return(!V.isShaderMaterial&&!V.isRawShaderMaterial||V.clipping===!0)&&(dt.clippingPlanes=St.uniform),xe(V,tt),he.needsLights=ze(V),he.lightsStateVersion=je,he.needsLights&&(dt.ambientLightColor.value=oe.state.ambient,dt.lightProbe.value=oe.state.probe,dt.directionalLights.value=oe.state.directional,dt.directionalLightShadows.value=oe.state.directionalShadow,dt.spotLights.value=oe.state.spot,dt.spotLightShadows.value=oe.state.spotShadow,dt.rectAreaLights.value=oe.state.rectArea,dt.ltc_1.value=oe.state.rectAreaLTC1,dt.ltc_2.value=oe.state.rectAreaLTC2,dt.pointLights.value=oe.state.point,dt.pointLightShadows.value=oe.state.pointShadow,dt.hemisphereLights.value=oe.state.hemi,dt.directionalShadowMap.value=oe.state.directionalShadowMap,dt.directionalShadowMatrix.value=oe.state.directionalShadowMatrix,dt.spotShadowMap.value=oe.state.spotShadowMap,dt.spotLightMatrix.value=oe.state.spotLightMatrix,dt.spotLightMap.value=oe.state.spotLightMap,dt.pointShadowMap.value=oe.state.pointShadowMap,dt.pointShadowMatrix.value=oe.state.pointShadowMatrix),he.currentProgram=It,he.uniformsList=null,It}function ye(V){if(V.uniformsList===null){const te=V.currentProgram.getUniforms();V.uniformsList=Zv.seqWithValue(te.seq,V.uniforms)}return V.uniformsList}function xe(V,te){const fe=P.get(V);fe.outputColorSpace=te.outputColorSpace,fe.batching=te.batching,fe.batchingColor=te.batchingColor,fe.instancing=te.instancing,fe.instancingColor=te.instancingColor,fe.instancingMorph=te.instancingMorph,fe.skinning=te.skinning,fe.morphTargets=te.morphTargets,fe.morphNormals=te.morphNormals,fe.morphColors=te.morphColors,fe.morphTargetsCount=te.morphTargetsCount,fe.numClippingPlanes=te.numClippingPlanes,fe.numIntersection=te.numClipIntersection,fe.vertexAlphas=te.vertexAlphas,fe.vertexTangents=te.vertexTangents,fe.toneMapping=te.toneMapping}function Ue(V,te,fe,he,oe){te.isScene!==!0&&(te=nt),me.resetTextureUnits();const We=te.fog,je=he.isMeshStandardMaterial?te.environment:null,tt=ie===null?N.outputColorSpace:ie.isXRRenderTarget===!0?ie.texture.colorSpace:ta,ht=(he.isMeshStandardMaterial?Xe:Le).get(he.envMap||je),ct=he.vertexColors===!0&&!!fe.attributes.color&&fe.attributes.color.itemSize===4,It=!!fe.attributes.tangent&&(!!he.normalMap||he.anisotropy>0),dt=!!fe.morphAttributes.position,Dt=!!fe.morphAttributes.normal,gn=!!fe.morphAttributes.color;let Xn=mr;he.toneMapped&&(ie===null||ie.isXRRenderTarget===!0)&&(Xn=N.toneMapping);const xn=fe.morphAttributes.position||fe.morphAttributes.normal||fe.morphAttributes.color,Xt=xn!==void 0?xn.length:0,Tt=P.get(he),Kt=F.state.lights;if(Mt===!0&&($t===!0||V!==_e)){const Yi=V===_e&&he.id===se;St.setState(he,V,Yi)}let Ct=!1;he.version===Tt.__version?(Tt.needsLights&&Tt.lightsStateVersion!==Kt.state.version||Tt.outputColorSpace!==tt||oe.isBatchedMesh&&Tt.batching===!1||!oe.isBatchedMesh&&Tt.batching===!0||oe.isBatchedMesh&&Tt.batchingColor===!0&&oe.colorTexture===null||oe.isBatchedMesh&&Tt.batchingColor===!1&&oe.colorTexture!==null||oe.isInstancedMesh&&Tt.instancing===!1||!oe.isInstancedMesh&&Tt.instancing===!0||oe.isSkinnedMesh&&Tt.skinning===!1||!oe.isSkinnedMesh&&Tt.skinning===!0||oe.isInstancedMesh&&Tt.instancingColor===!0&&oe.instanceColor===null||oe.isInstancedMesh&&Tt.instancingColor===!1&&oe.instanceColor!==null||oe.isInstancedMesh&&Tt.instancingMorph===!0&&oe.morphTexture===null||oe.isInstancedMesh&&Tt.instancingMorph===!1&&oe.morphTexture!==null||Tt.envMap!==ht||he.fog===!0&&Tt.fog!==We||Tt.numClippingPlanes!==void 0&&(Tt.numClippingPlanes!==St.numPlanes||Tt.numIntersection!==St.numIntersection)||Tt.vertexAlphas!==ct||Tt.vertexTangents!==It||Tt.morphTargets!==dt||Tt.morphNormals!==Dt||Tt.morphColors!==gn||Tt.toneMapping!==Xn||Tt.morphTargetsCount!==Xt)&&(Ct=!0):(Ct=!0,Tt.__version=he.version);let Yn=Tt.currentProgram;Ct===!0&&(Yn=de(he,te,oe));let aa=!1,kn=!1,Ui=!1;const Kn=Yn.getUniforms(),Mi=Tt.uniforms;if(gt.useProgram(Yn.program)&&(aa=!0,kn=!0,Ui=!0),he.id!==se&&(se=he.id,kn=!0),aa||_e!==V){gt.buffers.depth.getReversed()&&V.reversedDepth!==!0&&(V._reversedDepth=!0,V.updateProjectionMatrix()),Kn.setValue(ee,"projectionMatrix",V.projectionMatrix),Kn.setValue(ee,"viewMatrix",V.matrixWorldInverse);const Ji=Kn.map.cameraPosition;Ji!==void 0&&Ji.setValue(ee,Vt.setFromMatrixPosition(V.matrixWorld)),Lt.logarithmicDepthBuffer&&Kn.setValue(ee,"logDepthBufFC",2/(Math.log(V.far+1)/Math.LN2)),(he.isMeshPhongMaterial||he.isMeshToonMaterial||he.isMeshLambertMaterial||he.isMeshBasicMaterial||he.isMeshStandardMaterial||he.isShaderMaterial)&&Kn.setValue(ee,"isOrthographic",V.isOrthographicCamera===!0),_e!==V&&(_e=V,kn=!0,Ui=!0)}if(Tt.needsLights&&(Kt.state.directionalShadowMap.length>0&&Kn.setValue(ee,"directionalShadowMap",Kt.state.directionalShadowMap,me),Kt.state.spotShadowMap.length>0&&Kn.setValue(ee,"spotShadowMap",Kt.state.spotShadowMap,me),Kt.state.pointShadowMap.length>0&&Kn.setValue(ee,"pointShadowMap",Kt.state.pointShadowMap,me)),oe.isSkinnedMesh){Kn.setOptional(ee,oe,"bindMatrix"),Kn.setOptional(ee,oe,"bindMatrixInverse");const Yi=oe.skeleton;Yi&&(Yi.boneTexture===null&&Yi.computeBoneTexture(),Kn.setValue(ee,"boneTexture",Yi.boneTexture,me))}oe.isBatchedMesh&&(Kn.setOptional(ee,oe,"batchingTexture"),Kn.setValue(ee,"batchingTexture",oe._matricesTexture,me),Kn.setOptional(ee,oe,"batchingIdTexture"),Kn.setValue(ee,"batchingIdTexture",oe._indirectTexture,me),Kn.setOptional(ee,oe,"batchingColorTexture"),oe._colorsTexture!==null&&Kn.setValue(ee,"batchingColorTexture",oe._colorsTexture,me));const Xi=fe.morphAttributes;if((Xi.position!==void 0||Xi.normal!==void 0||Xi.color!==void 0)&&Ft.update(oe,fe,Yn),(kn||Tt.receiveShadow!==oe.receiveShadow)&&(Tt.receiveShadow=oe.receiveShadow,Kn.setValue(ee,"receiveShadow",oe.receiveShadow)),he.isMeshGouraudMaterial&&he.envMap!==null&&(Mi.envMap.value=ht,Mi.flipEnvMap.value=ht.isCubeTexture&&ht.isRenderTargetTexture===!1?-1:1),he.isMeshStandardMaterial&&he.envMap===null&&te.environment!==null&&(Mi.envMapIntensity.value=te.environmentIntensity),Mi.dfgLUT!==void 0&&(Mi.dfgLUT.value=fL()),kn&&(Kn.setValue(ee,"toneMappingExposure",N.toneMappingExposure),Tt.needsLights&&Ie(Mi,Ui),We&&he.fog===!0&&kt.refreshFogUniforms(Mi,We),kt.refreshMaterialUniforms(Mi,he,Ae,ne,F.state.transmissionRenderTarget[V.id]),Zv.upload(ee,ye(Tt),Mi,me)),he.isShaderMaterial&&he.uniformsNeedUpdate===!0&&(Zv.upload(ee,ye(Tt),Mi,me),he.uniformsNeedUpdate=!1),he.isSpriteMaterial&&Kn.setValue(ee,"center",oe.center),Kn.setValue(ee,"modelViewMatrix",oe.modelViewMatrix),Kn.setValue(ee,"normalMatrix",oe.normalMatrix),Kn.setValue(ee,"modelMatrix",oe.matrixWorld),he.isShaderMaterial||he.isRawShaderMaterial){const Yi=he.uniformsGroups;for(let Ji=0,Bl=Yi.length;Ji<Bl;Ji++){const _s=Yi[Ji];it.update(_s,Yn),it.bind(_s,Yn)}}return Yn}function Ie(V,te){V.ambientLightColor.needsUpdate=te,V.lightProbe.needsUpdate=te,V.directionalLights.needsUpdate=te,V.directionalLightShadows.needsUpdate=te,V.pointLights.needsUpdate=te,V.pointLightShadows.needsUpdate=te,V.spotLights.needsUpdate=te,V.spotLightShadows.needsUpdate=te,V.rectAreaLights.needsUpdate=te,V.hemisphereLights.needsUpdate=te}function ze(V){return V.isMeshLambertMaterial||V.isMeshToonMaterial||V.isMeshPhongMaterial||V.isMeshStandardMaterial||V.isShadowMaterial||V.isShaderMaterial&&V.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return ae},this.getRenderTarget=function(){return ie},this.setRenderTargetTextures=function(V,te,fe){const he=P.get(V);he.__autoAllocateDepthBuffer=V.resolveDepthBuffer===!1,he.__autoAllocateDepthBuffer===!1&&(he.__useRenderToTexture=!1),P.get(V.texture).__webglTexture=te,P.get(V.depthTexture).__webglTexture=he.__autoAllocateDepthBuffer?void 0:fe,he.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(V,te){const fe=P.get(V);fe.__webglFramebuffer=te,fe.__useDefaultFramebuffer=te===void 0};const Pe=ee.createFramebuffer();this.setRenderTarget=function(V,te=0,fe=0){ie=V,W=te,ae=fe;let he=null,oe=!1,We=!1;if(V){const tt=P.get(V);if(tt.__useDefaultFramebuffer!==void 0){gt.bindFramebuffer(ee.FRAMEBUFFER,tt.__webglFramebuffer),H.copy(V.viewport),K.copy(V.scissor),$=V.scissorTest,gt.viewport(H),gt.scissor(K),gt.setScissorTest($),se=-1;return}else if(tt.__webglFramebuffer===void 0)me.setupRenderTarget(V);else if(tt.__hasExternalTextures)me.rebindTextures(V,P.get(V.texture).__webglTexture,P.get(V.depthTexture).__webglTexture);else if(V.depthBuffer){const It=V.depthTexture;if(tt.__boundDepthTexture!==It){if(It!==null&&P.has(It)&&(V.width!==It.image.width||V.height!==It.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");me.setupDepthRenderbuffer(V)}}const ht=V.texture;(ht.isData3DTexture||ht.isDataArrayTexture||ht.isCompressedArrayTexture)&&(We=!0);const ct=P.get(V).__webglFramebuffer;V.isWebGLCubeRenderTarget?(Array.isArray(ct[te])?he=ct[te][fe]:he=ct[te],oe=!0):V.samples>0&&me.useMultisampledRTT(V)===!1?he=P.get(V).__webglMultisampledFramebuffer:Array.isArray(ct)?he=ct[fe]:he=ct,H.copy(V.viewport),K.copy(V.scissor),$=V.scissorTest}else H.copy(ve).multiplyScalar(Ae).floor(),K.copy(Be).multiplyScalar(Ae).floor(),$=st;if(fe!==0&&(he=Pe),gt.bindFramebuffer(ee.FRAMEBUFFER,he)&>.drawBuffers(V,he),gt.viewport(H),gt.scissor(K),gt.setScissorTest($),oe){const tt=P.get(V.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+te,tt.__webglTexture,fe)}else if(We){const tt=te;for(let ht=0;ht<V.textures.length;ht++){const ct=P.get(V.textures[ht]);ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0+ht,ct.__webglTexture,fe,tt)}}else if(V!==null&&fe!==0){const tt=P.get(V.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,tt.__webglTexture,fe)}se=-1},this.readRenderTargetPixels=function(V,te,fe,he,oe,We,je,tt=0){if(!(V&&V.isWebGLRenderTarget)){Wt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ht=P.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&je!==void 0&&(ht=ht[je]),ht){gt.bindFramebuffer(ee.FRAMEBUFFER,ht);try{const ct=V.textures[tt],It=ct.format,dt=ct.type;if(!Lt.textureFormatReadable(It)){Wt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Lt.textureTypeReadable(dt)){Wt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}te>=0&&te<=V.width-he&&fe>=0&&fe<=V.height-oe&&(V.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+tt),ee.readPixels(te,fe,he,oe,ot.convert(It),ot.convert(dt),We))}finally{const ct=ie!==null?P.get(ie).__webglFramebuffer:null;gt.bindFramebuffer(ee.FRAMEBUFFER,ct)}}},this.readRenderTargetPixelsAsync=async function(V,te,fe,he,oe,We,je,tt=0){if(!(V&&V.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ht=P.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&je!==void 0&&(ht=ht[je]),ht)if(te>=0&&te<=V.width-he&&fe>=0&&fe<=V.height-oe){gt.bindFramebuffer(ee.FRAMEBUFFER,ht);const ct=V.textures[tt],It=ct.format,dt=ct.type;if(!Lt.textureFormatReadable(It))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Lt.textureTypeReadable(dt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Dt=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Dt),ee.bufferData(ee.PIXEL_PACK_BUFFER,We.byteLength,ee.STREAM_READ),V.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+tt),ee.readPixels(te,fe,he,oe,ot.convert(It),ot.convert(dt),0);const gn=ie!==null?P.get(ie).__webglFramebuffer:null;gt.bindFramebuffer(ee.FRAMEBUFFER,gn);const Xn=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await r2(ee,Xn,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Dt),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,We),ee.deleteBuffer(Dt),ee.deleteSync(Xn),We}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(V,te=null,fe=0){const he=Math.pow(2,-fe),oe=Math.floor(V.image.width*he),We=Math.floor(V.image.height*he),je=te!==null?te.x:0,tt=te!==null?te.y:0;me.setTexture2D(V,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,fe,0,0,je,tt,oe,We),gt.unbindTexture()};const at=ee.createFramebuffer(),Je=ee.createFramebuffer();this.copyTextureToTexture=function(V,te,fe=null,he=null,oe=0,We=null){We===null&&(oe!==0?(th("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),We=oe,oe=0):We=0);let je,tt,ht,ct,It,dt,Dt,gn,Xn;const xn=V.isCompressedTexture?V.mipmaps[We]:V.image;if(fe!==null)je=fe.max.x-fe.min.x,tt=fe.max.y-fe.min.y,ht=fe.isBox3?fe.max.z-fe.min.z:1,ct=fe.min.x,It=fe.min.y,dt=fe.isBox3?fe.min.z:0;else{const Xi=Math.pow(2,-oe);je=Math.floor(xn.width*Xi),tt=Math.floor(xn.height*Xi),V.isDataArrayTexture?ht=xn.depth:V.isData3DTexture?ht=Math.floor(xn.depth*Xi):ht=1,ct=0,It=0,dt=0}he!==null?(Dt=he.x,gn=he.y,Xn=he.z):(Dt=0,gn=0,Xn=0);const Xt=ot.convert(te.format),Tt=ot.convert(te.type);let Kt;te.isData3DTexture?(me.setTexture3D(te,0),Kt=ee.TEXTURE_3D):te.isDataArrayTexture||te.isCompressedArrayTexture?(me.setTexture2DArray(te,0),Kt=ee.TEXTURE_2D_ARRAY):(me.setTexture2D(te,0),Kt=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,te.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,te.unpackAlignment);const Ct=ee.getParameter(ee.UNPACK_ROW_LENGTH),Yn=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),aa=ee.getParameter(ee.UNPACK_SKIP_PIXELS),kn=ee.getParameter(ee.UNPACK_SKIP_ROWS),Ui=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,xn.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,xn.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,ct),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,It),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,dt);const Kn=V.isDataArrayTexture||V.isData3DTexture,Mi=te.isDataArrayTexture||te.isData3DTexture;if(V.isDepthTexture){const Xi=P.get(V),Yi=P.get(te),Ji=P.get(Xi.__renderTarget),Bl=P.get(Yi.__renderTarget);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,Ji.__webglFramebuffer),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,Bl.__webglFramebuffer);for(let _s=0;_s<ht;_s++)Kn&&(ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,P.get(V).__webglTexture,oe,dt+_s),ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,P.get(te).__webglTexture,We,Xn+_s)),ee.blitFramebuffer(ct,It,je,tt,Dt,gn,je,tt,ee.DEPTH_BUFFER_BIT,ee.NEAREST);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,null),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else if(oe!==0||V.isRenderTargetTexture||P.has(V)){const Xi=P.get(V),Yi=P.get(te);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,at),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,Je);for(let Ji=0;Ji<ht;Ji++)Kn?ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Xi.__webglTexture,oe,dt+Ji):ee.framebufferTexture2D(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Xi.__webglTexture,oe),Mi?ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Yi.__webglTexture,We,Xn+Ji):ee.framebufferTexture2D(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Yi.__webglTexture,We),oe!==0?ee.blitFramebuffer(ct,It,je,tt,Dt,gn,je,tt,ee.COLOR_BUFFER_BIT,ee.NEAREST):Mi?ee.copyTexSubImage3D(Kt,We,Dt,gn,Xn+Ji,ct,It,je,tt):ee.copyTexSubImage2D(Kt,We,Dt,gn,ct,It,je,tt);gt.bindFramebuffer(ee.READ_FRAMEBUFFER,null),gt.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else Mi?V.isDataTexture||V.isData3DTexture?ee.texSubImage3D(Kt,We,Dt,gn,Xn,je,tt,ht,Xt,Tt,xn.data):te.isCompressedArrayTexture?ee.compressedTexSubImage3D(Kt,We,Dt,gn,Xn,je,tt,ht,Xt,xn.data):ee.texSubImage3D(Kt,We,Dt,gn,Xn,je,tt,ht,Xt,Tt,xn):V.isDataTexture?ee.texSubImage2D(ee.TEXTURE_2D,We,Dt,gn,je,tt,Xt,Tt,xn.data):V.isCompressedTexture?ee.compressedTexSubImage2D(ee.TEXTURE_2D,We,Dt,gn,xn.width,xn.height,Xt,xn.data):ee.texSubImage2D(ee.TEXTURE_2D,We,Dt,gn,je,tt,Xt,Tt,xn);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Ct),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,Yn),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,aa),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,kn),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Ui),We===0&&te.generateMipmaps&&ee.generateMipmap(Kt),gt.unbindTexture()},this.initRenderTarget=function(V){P.get(V).__webglFramebuffer===void 0&&me.setupRenderTarget(V)},this.initTexture=function(V){V.isCubeTexture?me.setTextureCube(V,0):V.isData3DTexture?me.setTexture3D(V,0):V.isDataArrayTexture||V.isCompressedArrayTexture?me.setTexture2DArray(V,0):me.setTexture2D(V,0),gt.unbindTexture()},this.resetState=function(){W=0,ae=0,ie=null,gt.reset(),bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Zs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Tn._getDrawingBufferColorSpace(e),t.unpackColorSpace=Tn._getUnpackColorSpace()}}const hL=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Ig,AddEquation:sc,AddOperation:eb,AdditiveAnimationBlendMode:rx,AdditiveBlending:Yy,AgXToneMapping:Qy,AlphaFormat:ax,AlwaysCompare:fb,AlwaysDepth:Bg,AlwaysStencilFunc:lx,AmbientLight:V1,AnimationAction:tE,AnimationClip:Vu,AnimationLoader:Kw,AnimationMixer:nE,AnimationObjectGroup:vB,AnimationUtils:Xw,ArcCurve:u1,ArrayCamera:Z1,ArrowHelper:XB,AttachedBindMode:ex,Audio:Q1,AudioAnalyser:oB,AudioContext:gA,AudioListener:aB,AudioLoader:tB,AxesHelper:YB,BackSide:fs,BasicDepthPacking:ab,BasicShadowMap:LM,BatchedMesh:e1,Bone:Cp,BooleanKeyframeTrack:Gu,Box2:RB,Box3:Ea,Box3Helper:VB,BoxGeometry:Du,BoxHelper:zB,BufferAttribute:Ln,BufferGeometry:on,BufferGeometryLoader:J1,ByteType:Fg,Cache:wo,Camera:X0,CameraHelper:GB,CanvasTexture:dw,CapsuleGeometry:gv,CatmullRomCurve3:f1,CineonToneMapping:jy,CircleGeometry:vv,ClampToEdgeWrapping:yi,Clock:vA,Color:At,ColorKeyframeTrack:lA,ColorManagement:Tn,CompressedArrayTexture:fw,CompressedCubeTexture:hw,CompressedTexture:mv,CompressedTextureLoader:Ww,ConeGeometry:Lp,ConstantAlphaFactor:ZM,ConstantColorFactor:WM,Controls:qB,CubeCamera:Fb,CubeDepthTexture:l1,CubeReflectionMapping:Yr,CubeRefractionMapping:oc,CubeTexture:Sp,CubeTextureLoader:H1,CubeUVReflectionMapping:jf,CubicBezierCurve:Wx,CubicBezierCurve3:d1,CubicInterpolant:L1,CullFaceBack:Xy,CullFaceFront:NM,CullFaceFrontBack:xR,CullFaceNone:UM,Curve:jr,CurvePath:m1,CustomBlending:OM,CustomToneMapping:Zy,CylinderGeometry:Np,Cylindrical:CB,Data3DTexture:C0,DataArrayTexture:T0,DataTexture:_r,DataTextureLoader:cA,DataUtils:wu,DecrementStencilOp:LR,DecrementWrapStencilOp:IR,DefaultLoadingManager:F1,DepthFormat:bo,DepthStencilFormat:cc,DepthTexture:Ch,DetachedBindMode:tb,DirectionalLight:Pv,DirectionalLightHelper:PB,DiscreteInterpolant:O1,DodecahedronGeometry:_v,DoubleSide:Ws,DstAlphaFactor:XM,DstColorFactor:JM,DynamicCopyUsage:ZR,DynamicDrawUsage:YR,DynamicReadUsage:KR,EdgesGeometry:c1,EllipseCurve:Sv,EqualCompare:lb,EqualDepth:Ug,EqualStencilFunc:GR,EquirectangularReflectionMapping:Wf,EquirectangularRefractionMapping:ep,Euler:er,EventDispatcher:Eo,ExternalTexture:kx,ExtrudeGeometry:Rv,FileLoader:ha,Float16BufferAttribute:k2,Float32BufferAttribute:Pt,FloatType:Ai,Fog:K0,FogExp2:q0,FramebufferTexture:uw,FrontSide:kr,Frustum:Th,FrustumArray:av,GLBufferAttribute:MB,GLSL1:$R,GLSL3:cx,GreaterCompare:cb,GreaterDepth:Lg,GreaterEqualCompare:b0,GreaterEqualDepth:Ng,GreaterEqualStencilFunc:XR,GreaterStencilFunc:VR,GridHelper:FB,Group:vr,HalfFloatType:Hi,HemisphereLight:P1,HemisphereLightHelper:IB,IcosahedronGeometry:zp,ImageBitmapLoader:mA,ImageLoader:Xp,ImageUtils:xb,IncrementStencilOp:NR,IncrementWrapStencilOp:OR,InstancedBufferAttribute:xc,InstancedBufferGeometry:Y1,InstancedInterleavedBuffer:SB,InstancedMesh:nv,Int16BufferAttribute:z2,Int32BufferAttribute:V2,Int8BufferAttribute:H2,IntType:np,InterleavedBuffer:yh,InterleavedBufferAttribute:xl,Interpolant:Pu,InterpolateDiscrete:Au,InterpolateLinear:uc,InterpolateSmooth:A0,InterpolationSamplingMode:n2,InterpolationSamplingType:t2,InvertStencilOp:FR,KeepStencilOp:Eu,KeyframeTrack:xr,LOD:kb,LatheGeometry:wv,Layers:uh,LessCompare:ob,LessDepth:Dg,LessEqualCompare:M0,LessEqualDepth:vu,LessEqualStencilFunc:zR,LessStencilFunc:PR,Light:bc,LightProbe:X1,Line:Ro,Line3:DB,LineBasicMaterial:Pa,LineCurve:jx,LineCurve3:p1,LineDashedMaterial:U1,LineLoop:fv,LineSegments:yr,LinearFilter:bn,LinearInterpolant:oA,LinearMipMapLinearFilter:tx,LinearMipMapNearestFilter:MR,LinearMipmapLinearFilter:Is,LinearMipmapNearestFilter:yu,LinearSRGBColorSpace:ta,LinearToneMapping:Ky,LinearTransfer:hp,Loader:Ca,LoaderUtils:nr,LoadingManager:Iv,LoopOnce:cp,LoopPingPong:ib,LoopRepeat:nb,MOUSE:_R,Material:Gi,MaterialLoader:Gv,MathUtils:E0,Matrix2:bA,Matrix3:mn,Matrix4:Qt,MaxEquation:PM,Mesh:pi,MeshBasicMaterial:fa,MeshDepthMaterial:iA,MeshDistanceMaterial:aA,MeshLambertMaterial:B1,MeshMatcapMaterial:D1,MeshNormalMaterial:w1,MeshPhongMaterial:C1,MeshPhysicalMaterial:zi,MeshStandardMaterial:Fu,MeshToonMaterial:R1,MinEquation:HM,MirroredRepeatWrapping:_u,MixOperation:$M,MultiplyBlending:qy,MultiplyOperation:$d,NearestFilter:xi,NearestMipMapLinearFilter:SR,NearestMipMapNearestFilter:AR,NearestMipmapLinearFilter:lc,NearestMipmapNearestFilter:tp,NeutralToneMapping:$y,NeverCompare:rb,NeverDepth:wg,NeverStencilFunc:HR,NoBlending:Xr,NoColorSpace:hl,NoNormalPacking:RR,NoToneMapping:mr,NormalAnimationBlendMode:S0,NormalBlending:gu,NormalGAPacking:BR,NormalRGPacking:wR,NotEqualCompare:ub,NotEqualDepth:Og,NotEqualStencilFunc:kR,NumberKeyframeTrack:Al,Object3D:wn,ObjectLoader:$w,ObjectSpaceNormalMap:sb,OctahedronGeometry:Vp,OneFactor:zM,OneMinusConstantAlphaFactor:QM,OneMinusConstantColorFactor:jM,OneMinusDstAlphaFactor:YM,OneMinusDstColorFactor:qM,OneMinusSrcAlphaFactor:Rg,OneMinusSrcColorFactor:kM,OrthographicCamera:El,PCFShadowMap:Kf,PCFSoftShadowMap:Qd,PMREMGenerator:NA,Path:Ev,PerspectiveCamera:ia,Plane:Ac,PlaneGeometry:Mc,PlaneHelper:kB,PointLight:Hv,PointLightHelper:LB,Points:pv,PointsMaterial:Up,PolarGridHelper:HB,PolyhedronGeometry:Sc,PositionalAudio:rB,PropertyBinding:Hn,PropertyMixer:eE,QuadraticBezierCurve:Zx,QuadraticBezierCurve3:Qx,Quaternion:ba,QuaternionKeyframeTrack:Sl,QuaternionLinearInterpolant:I1,R11_EAC_Format:jg,RED_GREEN_RGTC2_Format:y0,RED_RGTC1_Format:v0,REVISION:Zd,RG11_EAC_Format:Qg,RGBADepthPacking:ER,RGBAFormat:ji,RGBAIntegerFormat:Vg,RGBA_ASTC_10x10_Format:f0,RGBA_ASTC_10x5_Format:l0,RGBA_ASTC_10x6_Format:c0,RGBA_ASTC_10x8_Format:u0,RGBA_ASTC_12x10_Format:h0,RGBA_ASTC_12x12_Format:d0,RGBA_ASTC_4x4_Format:e0,RGBA_ASTC_5x4_Format:t0,RGBA_ASTC_5x5_Format:n0,RGBA_ASTC_6x5_Format:i0,RGBA_ASTC_6x6_Format:a0,RGBA_ASTC_8x5_Format:s0,RGBA_ASTC_8x6_Format:r0,RGBA_ASTC_8x8_Format:o0,RGBA_BPTC_Format:p0,RGBA_ETC2_EAC_Format:Wg,RGBA_PVRTC_2BPPV1_Format:Jg,RGBA_PVRTC_4BPPV1_Format:Yg,RGBA_S3TC_DXT1_Format:rp,RGBA_S3TC_DXT3_Format:op,RGBA_S3TC_DXT5_Format:lp,RGBDepthPacking:TR,RGBFormat:sx,RGBIntegerFormat:bR,RGB_BPTC_SIGNED_Format:m0,RGB_BPTC_UNSIGNED_Format:g0,RGB_ETC1_Format:qg,RGB_ETC2_Format:Kg,RGB_PVRTC_2BPPV1_Format:Xg,RGB_PVRTC_4BPPV1_Format:kg,RGB_S3TC_DXT1_Format:sp,RGDepthPacking:CR,RGFormat:xu,RGIntegerFormat:zg,RawShaderMaterial:nA,Ray:lh,Raycaster:SA,RectAreaLight:k1,RedFormat:ip,RedIntegerFormat:ap,ReinhardToneMapping:Wy,RenderTarget:mx,RenderTarget3D:yB,RepeatWrapping:Jr,ReplaceStencilOp:UR,ReverseSubtractEquation:FM,RingGeometry:Bv,SIGNED_R11_EAC_Format:Zg,SIGNED_RED_GREEN_RGTC2_Format:x0,SIGNED_RED_RGTC1_Format:_0,SIGNED_RG11_EAC_Format:$g,SRGBColorSpace:Pi,SRGBTransfer:ti,Scene:Mp,ShaderChunk:An,ShaderLib:Qr,ShaderMaterial:ms,ShadowMaterial:T1,Shape:Ou,ShapeGeometry:Dv,ShapePath:JB,ShapeUtils:Zr,ShortType:Hg,Skeleton:bh,SkeletonHelper:NB,SkinnedMesh:ev,Source:dc,Sphere:ua,SphereGeometry:kp,Spherical:TB,SphericalHarmonics3:dA,SplineCurve:$x,SpotLight:Fv,SpotLightHelper:UB,Sprite:zb,SpriteMaterial:Lx,SrcAlphaFactor:Cg,SrcAlphaSaturateFactor:KM,SrcColorFactor:VM,StaticCopyUsage:jR,StaticDrawUsage:dp,StaticReadUsage:qR,StereoCamera:nB,StreamCopyUsage:QR,StreamDrawUsage:JR,StreamReadUsage:WR,StringKeyframeTrack:zu,SubtractEquation:IM,SubtractiveBlending:Jy,TOUCH:yR,TangentSpaceNormalMap:fc,TetrahedronGeometry:Uv,Texture:qn,TextureLoader:uA,TextureUtils:QB,Timer:bB,TimestampQuery:e2,TorusGeometry:Nv,TorusKnotGeometry:Lv,Triangle:Fs,TriangleFanDrawMode:bu,TriangleStripDrawMode:fp,TrianglesDrawMode:ox,TubeGeometry:Ov,UVMapping:rc,Uint16BufferAttribute:Bx,Uint32BufferAttribute:Dx,Uint8BufferAttribute:P2,Uint8ClampedBufferAttribute:G2,Uniform:AA,UniformsGroup:AB,UniformsLib:Rt,UniformsUtils:Lb,UnsignedByteType:Ma,UnsignedInt101111Type:ix,UnsignedInt248Type:Qf,UnsignedInt5999Type:nx,UnsignedIntType:js,UnsignedShort4444Type:Pg,UnsignedShort5551Type:Gg,UnsignedShortType:Zf,VSMShadowMap:mu,Vector2:et,Vector3:Q,Vector4:ci,VectorKeyframeTrack:Ml,VideoFrameTexture:cw,VideoTexture:o1,WebGL3DRenderTarget:C2,WebGLArrayRenderTarget:T2,WebGLCoordinateSystem:Zs,WebGLCubeRenderTarget:Y0,WebGLRenderTarget:ds,WebGLRenderer:HA,WebGLUtils:zE,WebGPUCoordinateSystem:$f,WebXRController:J0,WireframeGeometry:M1,WrapAroundEnding:up,ZeroCurvatureEnding:Su,ZeroFactor:GM,ZeroSlopeEnding:Mu,ZeroStencilOp:DR,createCanvasElement:pb,error:Wt,getConsoleFunction:s2,log:mp,setConsoleFunction:a2,warn:Et,warnOnce:th},Symbol.toStringTag,{value:"Module"}));var PA={exports:{}},Tl={};var VE;function dL(){return VE||(VE=1,Tl.ConcurrentRoot=1,Tl.ContinuousEventPriority=8,Tl.DefaultEventPriority=32,Tl.DiscreteEventPriority=2,Tl.IdleEventPriority=268435456,Tl.LegacyRoot=0,Tl.NoEventPriority=0),Tl}var kE;function pL(){return kE||(kE=1,PA.exports=dL()),PA.exports}var $v=pL(),GA={exports:{}},zA={},VA={exports:{}},kA={};var XE;function mL(){if(XE)return kA;XE=1;var s=qf();function e(v,y){return v===y&&(v!==0||1/v===1/y)||v!==v&&y!==y}var t=typeof Object.is=="function"?Object.is:e,n=s.useState,i=s.useEffect,o=s.useLayoutEffect,l=s.useDebugValue;function h(v,y){var x=y(),b=n({inst:{value:x,getSnapshot:y}}),R=b[0].inst,T=b[1];return o(function(){R.value=x,R.getSnapshot=y,d(R)&&T({inst:R})},[v,x,y]),i(function(){return d(R)&&T({inst:R}),v(function(){d(R)&&T({inst:R})})},[v]),l(x),x}function d(v){var y=v.getSnapshot;v=v.value;try{var x=y();return!t(v,x)}catch{return!0}}function p(v,y){return y()}var _=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:h;return kA.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:_,kA}var YE;function gL(){return YE||(YE=1,VA.exports=mL()),VA.exports}var JE;function vL(){if(JE)return zA;JE=1;var s=qf(),e=gL();function t(p,_){return p===_&&(p!==0||1/p===1/_)||p!==p&&_!==_}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=s.useRef,l=s.useEffect,h=s.useMemo,d=s.useDebugValue;return zA.useSyncExternalStoreWithSelector=function(p,_,v,y,x){var b=o(null);if(b.current===null){var R={hasValue:!1,value:null};b.current=R}else R=b.current;b=h(function(){function M(O){if(!w){if(w=!0,D=O,O=y(O),x!==void 0&&R.hasValue){var z=R.value;if(x(z,O))return U=z}return U=O}if(z=U,n(D,O))return z;var k=y(O);return x!==void 0&&x(z,k)?(D=O,z):(D=O,U=k)}var w=!1,D,U,F=v===void 0?null:v;return[function(){return M(_())},F===null?void 0:function(){return M(F())}]},[_,v,y,x]);var T=i(p,b[0],b[1]);return l(function(){R.hasValue=!0,R.value=T},[T]),d(T),T},zA}var qE;function _L(){return qE||(qE=1,GA.exports=vL()),GA.exports}var yL=_L();const xL=Iy(yL),KE=s=>{let e;const t=new Set,n=(p,_)=>{const v=typeof p=="function"?p(e):p;if(!Object.is(v,e)){const y=e;e=_??(typeof v!="object"||v===null)?v:Object.assign({},e,v),t.forEach(x=>x(e,y))}},i=()=>e,h={setState:n,getState:i,getInitialState:()=>d,subscribe:p=>(t.add(p),()=>t.delete(p))},d=e=s(n,i,h);return h},AL=(s=>s?KE(s):KE),{useSyncExternalStoreWithSelector:SL}=xL,ML=s=>s;function bL(s,e=ML,t){const n=SL(s.subscribe,s.getState,s.getInitialState,e,t);return MM.useDebugValue(n),n}const WE=(s,e)=>{const t=AL(s),n=(i,o=e)=>bL(t,i,o);return Object.assign(n,t),n},jE=((s,e)=>s?WE(s,e):WE),EL=s=>typeof s=="object"&&typeof s.then=="function",Qu=[];function ZE(s,e,t=(n,i)=>n===i){if(s===e)return!0;if(!s||!e)return!1;const n=s.length;if(e.length!==n)return!1;for(let i=0;i<n;i++)if(!t(s[i],e[i]))return!1;return!0}function QE(s,e=null,t=!1,n={}){e===null&&(e=[s]);for(const o of Qu)if(ZE(e,o.keys,o.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(o,"error"))throw o.error;if(Object.prototype.hasOwnProperty.call(o,"response"))return n.lifespan&&n.lifespan>0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=Qu.indexOf(i);o!==-1&&Qu.splice(o,1)},promise:(EL(s)?s:s(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(Qu.push(i),!t)throw i.promise}const TL=(s,e,t)=>QE(s,e,!1,t),CL=(s,e,t)=>{QE(s,e,!0,t)},RL=s=>{if(s===void 0||s.length===0)Qu.splice(0,Qu.length);else{const e=Qu.find(t=>ZE(s,t.keys,t.equal));e&&e.remove()}};var XA={exports:{}},YA={exports:{}},JA={exports:{}},qA={};var $E;function wL(){return $E||($E=1,(function(s){function e(H,K){var $=H.length;H.push(K);e:for(;0<$;){var ue=$-1>>>1,re=H[ue];if(0<i(re,K))H[ue]=K,H[$]=re,$=ue;else break e}}function t(H){return H.length===0?null:H[0]}function n(H){if(H.length===0)return null;var K=H[0],$=H.pop();if($!==K){H[0]=$;e:for(var ue=0,re=H.length,X=re>>>1;ue<X;){var ne=2*(ue+1)-1,Ae=H[ne],Re=ne+1,rt=H[Re];if(0>i(Ae,$))Re<re&&0>i(rt,Ae)?(H[ue]=rt,H[Re]=$,ue=Re):(H[ue]=Ae,H[ne]=$,ue=ne);else if(Re<re&&0>i(rt,$))H[ue]=rt,H[Re]=$,ue=Re;else break e}}return K}function i(H,K){var $=H.sortIndex-K.sortIndex;return $!==0?$:H.id-K.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;s.unstable_now=function(){return o.now()}}else{var l=Date,h=l.now();s.unstable_now=function(){return l.now()-h}}var d=[],p=[],_=1,v=null,y=3,x=!1,b=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function D(H){for(var K=t(p);K!==null;){if(K.callback===null)n(p);else if(K.startTime<=H)n(p),K.sortIndex=K.expirationTime,e(d,K);else break;K=t(p)}}function U(H){if(R=!1,D(H),!b)if(t(d)!==null)b=!0,se();else{var K=t(p);K!==null&&_e(U,K.startTime-H)}}var F=!1,O=-1,z=5,k=-1;function N(){return!(s.unstable_now()-k<z)}function I(){if(F){var H=s.unstable_now();k=H;var K=!0;try{e:{b=!1,R&&(R=!1,M(O),O=-1),x=!0;var $=y;try{t:{for(D(H),v=t(d);v!==null&&!(v.expirationTime>H&&N());){var ue=v.callback;if(typeof ue=="function"){v.callback=null,y=v.priorityLevel;var re=ue(v.expirationTime<=H);if(H=s.unstable_now(),typeof re=="function"){v.callback=re,D(H),K=!0;break t}v===t(d)&&n(d),D(H)}else n(d);v=t(d)}if(v!==null)K=!0;else{var X=t(p);X!==null&&_e(U,X.startTime-H),K=!1}}break e}finally{v=null,y=$,x=!1}K=void 0}}finally{K?W():F=!1}}}var W;if(typeof w=="function")W=function(){w(I)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ie=ae.port2;ae.port1.onmessage=I,W=function(){ie.postMessage(null)}}else W=function(){T(I,0)};function se(){F||(F=!0,W())}function _e(H,K){O=T(function(){H(s.unstable_now())},K)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(H){H.callback=null},s.unstable_continueExecution=function(){b||x||(b=!0,se())},s.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<H?Math.floor(1e3/H):5},s.unstable_getCurrentPriorityLevel=function(){return y},s.unstable_getFirstCallbackNode=function(){return t(d)},s.unstable_next=function(H){switch(y){case 1:case 2:case 3:var K=3;break;default:K=y}var $=y;y=K;try{return H()}finally{y=$}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(H,K){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var $=y;y=H;try{return K()}finally{y=$}},s.unstable_scheduleCallback=function(H,K,$){var ue=s.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ue+$:ue):$=ue,H){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=$+re,H={id:_++,callback:K,priorityLevel:H,startTime:$,expirationTime:re,sortIndex:-1},$>ue?(H.sortIndex=$,e(p,H),t(d)===null&&H===t(p)&&(R?(M(O),O=-1):R=!0,_e(U,$-ue))):(H.sortIndex=re,e(d,H),b||x||(b=!0,se())),H},s.unstable_shouldYield=N,s.unstable_wrapCallback=function(H){var K=y;return function(){var $=y;y=K;try{return H.apply(this,arguments)}finally{y=$}}}})(qA)),qA}var eT;function BL(){return eT||(eT=1,JA.exports=wL()),JA.exports}var tT;function DL(){return tT||(tT=1,(function(s){s.exports=function(e){function t(c,u,g,S){return new Rm(c,u,g,S)}function n(){}function i(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)u+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(c){return c===null||typeof c!="object"?null:(c=Om&&c[Om]||c["@@iterator"],typeof c=="function"?c:null)}function l(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===Xl?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case Jc:return"Fragment";case or:return"Portal";case Lm:return"Profiler";case Nm:return"StrictMode";case md:return"Suspense";case Zo:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case Dr:return(c.displayName||"Context")+".Provider";case jo:return(c._context.displayName||"Context")+".Consumer";case qc:var u=c.render;return c=c.displayName,c||(c=u.displayName||u.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case Mf:return u=c.displayName||null,u!==null?u:l(c.type)||"Memo";case lr:u=c._payload,c=c._init;try{return l(c(u))}catch{}}return null}function h(c){if(gd===void 0)try{throw Error()}catch(g){var u=g.stack.trim().match(/\n( *(at )?)/);gd=u&&u[1]||"",Im=-1<g.stack.indexOf(`
|
|
4020
4020
|
at`)?" (<anonymous>)":-1<g.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4021
4021
|
`+gd+c+Im}function d(c,u){if(!c||Qo)return"";Qo=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var S={DetermineComponentFrameRoot:function(){try{if(u){var wt=function(){throw Error()};if(Object.defineProperty(wt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(wt,[])}catch(cn){var Ut=cn}Reflect.construct(c,[],wt)}else{try{wt.call()}catch(cn){Ut=cn}c.call(wt.prototype)}}else{try{throw Error()}catch(cn){Ut=cn}(wt=c())&&typeof wt.catch=="function"&&wt.catch(function(){})}}catch(cn){if(cn&&Ut&&typeof cn.stack=="string")return[cn.stack,Ut.stack]}return[null,null]}};S.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(S.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(S.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var B=S.DetermineComponentFrameRoot(),J=B[0],le=B[1];if(J&&le){var be=J.split(`
|
|
4022
4022
|
`),Ye=le.split(`
|
|
@@ -4027,7 +4027,7 @@ Error generating stack: `+g.message+`
|
|
|
4027
4027
|
`+(S.join(" > ")+`
|
|
4028
4028
|
|
|
4029
4029
|
No matching component was found for:
|
|
4030
|
-
`)+c.join(" > ")}return null},jt.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 27:case 5:return Kc(c.child.stateNode);default:return c.child.stateNode}},jt.injectIntoDevTools=function(){var c={bundleType:0,version:vd,rendererPackageName:Ef,currentDispatcherRef:tn,findFiberByHostInstance:Gm,reconcilerVersion:"19.0.0"};if(Tf!==null&&(c.rendererConfig=Tf),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)c=!0;else{try{$c=u.inject(c),ss=u}catch{}c=!!u.checkDCE}}return c},jt.isAlreadyRendering=function(){return!1},jt.observeVisibleRects=function(c,u,g,S){if(!Lr)throw Error(i(363));c=Va(c,u);var C=km(c,g,S).disconnect;return{disconnect:function(){C()}}},jt.shouldError=function(){return null},jt.shouldSuspend=function(){return!1},jt.startHostTransition=function(c,u,g,S){if(c.tag!==5)throw Error(i(476));var C=sm(c).queue;Yh(c,C,u,is,g===null?n:function(){var B=sm(c).next.queue;return Oo(c,B,{},ka()),g(S)})},jt.updateContainer=function(c,u,g,S){var C=u.current,B=ka();return H_(C,B,c,u,g,S),B},jt.updateContainerSync=function(c,u,g,S){return u.tag===0&&oa(),H_(u.current,2,c,u,g,S),2},jt},s.exports.default=s.exports,Object.defineProperty(s.exports,"__esModule",{value:!0})})(YA)),YA.exports}var nT;function UL(){return nT||(nT=1,XA.exports=DL()),XA.exports}var NL=UL();const LL=Iy(NL);var KA={exports:{}},WA={};var iT;function OL(){return iT||(iT=1,(function(s){function e(H,K){var $=H.length;H.push(K);e:for(;0<$;){var ue=$-1>>>1,re=H[ue];if(0<i(re,K))H[ue]=K,H[$]=re,$=ue;else break e}}function t(H){return H.length===0?null:H[0]}function n(H){if(H.length===0)return null;var K=H[0],$=H.pop();if($!==K){H[0]=$;e:for(var ue=0,re=H.length,X=re>>>1;ue<X;){var ne=2*(ue+1)-1,Ae=H[ne],Re=ne+1,rt=H[Re];if(0>i(Ae,$))Re<re&&0>i(rt,Ae)?(H[ue]=rt,H[Re]=$,ue=Re):(H[ue]=Ae,H[ne]=$,ue=ne);else if(Re<re&&0>i(rt,$))H[ue]=rt,H[Re]=$,ue=Re;else break e}}return K}function i(H,K){var $=H.sortIndex-K.sortIndex;return $!==0?$:H.id-K.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;s.unstable_now=function(){return o.now()}}else{var l=Date,h=l.now();s.unstable_now=function(){return l.now()-h}}var d=[],p=[],_=1,v=null,y=3,x=!1,b=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function D(H){for(var K=t(p);K!==null;){if(K.callback===null)n(p);else if(K.startTime<=H)n(p),K.sortIndex=K.expirationTime,e(d,K);else break;K=t(p)}}function U(H){if(R=!1,D(H),!b)if(t(d)!==null)b=!0,se();else{var K=t(p);K!==null&&_e(U,K.startTime-H)}}var F=!1,O=-1,z=5,k=-1;function N(){return!(s.unstable_now()-k<z)}function I(){if(F){var H=s.unstable_now();k=H;var K=!0;try{e:{b=!1,R&&(R=!1,M(O),O=-1),x=!0;var $=y;try{t:{for(D(H),v=t(d);v!==null&&!(v.expirationTime>H&&N());){var ue=v.callback;if(typeof ue=="function"){v.callback=null,y=v.priorityLevel;var re=ue(v.expirationTime<=H);if(H=s.unstable_now(),typeof re=="function"){v.callback=re,D(H),K=!0;break t}v===t(d)&&n(d),D(H)}else n(d);v=t(d)}if(v!==null)K=!0;else{var X=t(p);X!==null&&_e(U,X.startTime-H),K=!1}}break e}finally{v=null,y=$,x=!1}K=void 0}}finally{K?W():F=!1}}}var W;if(typeof w=="function")W=function(){w(I)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ie=ae.port2;ae.port1.onmessage=I,W=function(){ie.postMessage(null)}}else W=function(){T(I,0)};function se(){F||(F=!0,W())}function _e(H,K){O=T(function(){H(s.unstable_now())},K)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(H){H.callback=null},s.unstable_continueExecution=function(){b||x||(b=!0,se())},s.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<H?Math.floor(1e3/H):5},s.unstable_getCurrentPriorityLevel=function(){return y},s.unstable_getFirstCallbackNode=function(){return t(d)},s.unstable_next=function(H){switch(y){case 1:case 2:case 3:var K=3;break;default:K=y}var $=y;y=K;try{return H()}finally{y=$}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(H,K){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var $=y;y=H;try{return K()}finally{y=$}},s.unstable_scheduleCallback=function(H,K,$){var ue=s.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ue+$:ue):$=ue,H){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=$+re,H={id:_++,callback:K,priorityLevel:H,startTime:$,expirationTime:re,sortIndex:-1},$>ue?(H.sortIndex=$,e(p,H),t(d)===null&&H===t(p)&&(R?(M(O),O=-1):R=!0,_e(U,$-ue))):(H.sortIndex=re,e(d,H),b||x||(b=!0,se())),H},s.unstable_shouldYield=N,s.unstable_wrapCallback=function(H){var K=y;return function(){var $=y;y=K;try{return H.apply(this,arguments)}finally{y=$}}}})(WA)),WA}var aT;function IL(){return aT||(aT=1,KA.exports=OL()),KA.exports}var sT=IL();function jA(s,e,t){if(!s)return;if(t(s)===!0)return s;let n=e?s.return:s.child;for(;n;){const i=jA(n,e,t);if(i)return i;n=e?null:n.sibling}}function rT(s){try{return Object.defineProperties(s,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return s}}const ZA=rT(Ee.createContext(null));class oT extends Ee.Component{render(){return Ee.createElement(ZA.Provider,{value:this._reactInternals},this.props.children)}}function lT(){const s=Ee.useContext(ZA);if(s===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Ee.useId();return Ee.useMemo(()=>{for(const t of[s,s?.alternate]){if(!t)continue;const n=jA(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[s,e])}const FL=Symbol.for("react.context"),HL=s=>s!==null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===FL;function PL(){const s=lT(),[e]=Ee.useState(()=>new Map);e.clear();let t=s;for(;t;){const n=t.type;HL(n)&&n!==ZA&&!e.has(n)&&e.set(n,Ee.use(rT(n))),t=t.return}return e}function GL(){const s=PL();return Ee.useMemo(()=>Array.from(s.keys()).reduce((e,t)=>n=>Ee.createElement(e,null,Ee.createElement(t.Provider,{...n,value:s.get(t)})),e=>Ee.createElement(oT,{...e})),[s])}function cT(s){let e=s.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const uT=s=>s&&s.isOrthographicCamera,zL=s=>s&&s.hasOwnProperty("current"),VL=s=>s!=null&&(typeof s=="string"||typeof s=="number"||s.isColor),Kp=((s,e)=>typeof window<"u"&&(((s=window.document)==null?void 0:s.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?Ee.useLayoutEffect:Ee.useEffect;function QA(s){const e=Ee.useRef(s);return Kp(()=>{e.current=s},[s]),e}function kL(){const s=lT(),e=GL();return Ee.useMemo(()=>({children:t})=>{const i=!!jA(s,!0,o=>o.type===Ee.StrictMode)?Ee.StrictMode:Ee.Fragment;return Pt.jsx(i,{children:Pt.jsx(e,{children:t})})},[s,e])}function XL({set:s}){return Kp(()=>(s(new Promise(()=>null)),()=>s(!1)),[s]),null}const YL=(s=>(s=class extends Ee.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},s.getDerivedStateFromError=()=>({error:!0}),s))();function fT(s){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(s)?Math.min(Math.max(s[0],t),s[1]):s}function Lh(s){var e;return(e=s.__r3f)==null?void 0:e.root.getState()}const Si={obj:s=>s===Object(s)&&!Si.arr(s)&&typeof s!="function",fun:s=>typeof s=="function",str:s=>typeof s=="string",num:s=>typeof s=="number",boo:s=>typeof s=="boolean",und:s=>s===void 0,nul:s=>s===null,arr:s=>Array.isArray(s),equ(s,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof s!=typeof e||!!s!=!!e)return!1;if(Si.str(s)||Si.num(s)||Si.boo(s))return s===e;const o=Si.obj(s);if(o&&n==="reference")return s===e;const l=Si.arr(s);if(l&&t==="reference")return s===e;if((l||o)&&s===e)return!0;let h;for(h in s)if(!(h in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(h in i?e:s)if(!Si.equ(s[h],e[h],{strict:i,objects:"reference"}))return!1}else for(h in i?e:s)if(s[h]!==e[h])return!1;if(Si.und(h)){if(l&&s.length===0&&e.length===0||o&&Object.keys(s).length===0&&Object.keys(e).length===0)return!0;if(s!==e)return!1}return!0}};function JL(s){const e={nodes:{},materials:{},meshes:{}};return s&&s.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function qL(s){s.type!=="Scene"&&(s.dispose==null||s.dispose());for(const e in s){const t=s[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const hT=["children","key","ref"];function KL(s){const e={};for(const t in s)hT.includes(t)||(e[t]=s[t]);return e}function e_(s,e,t,n){const i=s;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:KL(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function Wp(s,e){if(!e.includes("-"))return{root:s,key:e,target:s[e]};if(e in s)return{root:s,key:e,target:s[e]};let t=s;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:s,key:e,target:void 0}}e=i,s=t,t=t[e]}return{root:s,key:e,target:t}}const dT=/-\d+$/;function t_(s,e){if(Si.str(e.props.attach)){if(dT.test(e.props.attach)){const i=e.props.attach.replace(dT,""),{root:o,key:l}=Wp(s.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=Wp(s.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else Si.fun(e.props.attach)&&(e.previousAttach=e.props.attach(s.object,e.object))}function n_(s,e){if(Si.str(e.props.attach)){const{root:t,key:n}=Wp(s.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(s.object,e.object);delete e.previousAttach}const $A=[...hT,"args","dispose","attach","object","onUpdate","dispose"],pT=new Map;function WL(s){let e=pT.get(s.constructor);try{e||(e=new s.constructor,pT.set(s.constructor,e))}catch{}return e}function jL(s,e){const t={};for(const n in e)if(!$A.includes(n)&&!Si.equ(e[n],s.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in s.props){if($A.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=Wp(s.object,n);if(i.constructor&&i.constructor.length===0){const l=WL(i);Si.und(l)||(t[o]=l[o])}else t[o]=0}return t}const ZL=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],QL=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Do(s,e){var t;const n=s.__r3f,i=n&&cT(n).getState(),o=n?.eventCount;for(const h in e){let d=e[h];if($A.includes(h))continue;if(n&&QL.test(h)){typeof d=="function"?n.handlers[h]=d:delete n.handlers[h],n.eventCount=Object.keys(n.handlers).length;continue}if(d===void 0)continue;let{root:p,key:_,target:v}=Wp(s,h);if(v===void 0&&(typeof p!="object"||p===null))throw Error(`R3F: Cannot set "${h}". Ensure it is an object before setting "${_}".`);if(v instanceof uh&&d instanceof uh)v.mask=d.mask;else if(v instanceof At&&VL(d))v.set(d);else if(v!==null&&typeof v=="object"&&typeof v.set=="function"&&typeof v.copy=="function"&&d!=null&&d.constructor&&v.constructor===d.constructor)v.copy(d);else if(v!==null&&typeof v=="object"&&typeof v.set=="function"&&Array.isArray(d))typeof v.fromArray=="function"?v.fromArray(d):v.set(...d);else if(v!==null&&typeof v=="object"&&typeof v.set=="function"&&typeof d=="number")typeof v.setScalar=="function"?v.setScalar(d):v.set(d);else{var l;p[_]=d,i&&!i.linear&&ZL.includes(_)&&(l=p[_])!=null&&l.isTexture&&p[_].format===ji&&p[_].type===Ma&&(p[_].colorSpace=Pi)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const h=n.object,d=i.internal.interaction.indexOf(h);d>-1&&i.internal.interaction.splice(d,1),n.eventCount&&h.raycast!==null&&i.internal.interaction.push(h)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&Oh(n),s}function Oh(s){var e;if(!s.parent)return;s.props.onUpdate==null||s.props.onUpdate(s.object);const t=(e=s.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function mT(s,e){s.manual||(uT(s)?(s.left=e.width/-2,s.right=e.width/2,s.top=e.height/2,s.bottom=e.height/-2):s.aspect=e.width/e.height,s.updateProjectionMatrix())}const vs=s=>s?.isObject3D;function i_(s){return(s.eventObject||s.object).uuid+"/"+s.index+s.instanceId}function gT(s,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(s.delete(n),i.target.releasePointerCapture(n)))}function $L(s,e){const{internal:t}=s.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{gT(t.capturedMap,e,n,i)})}function eO(s){function e(d){const{internal:p}=s.getState(),_=d.offsetX-p.initialClick[0],v=d.offsetY-p.initialClick[1];return Math.round(Math.sqrt(_*_+v*v))}function t(d){return d.filter(p=>["Move","Over","Enter","Out","Leave"].some(_=>{var v;return(v=p.__r3f)==null?void 0:v.handlers["onPointer"+_]}))}function n(d,p){const _=s.getState(),v=new Set,y=[],x=p?p(_.internal.interaction):_.internal.interaction;for(let M=0;M<x.length;M++){const w=Lh(x[M]);w&&(w.raycaster.camera=void 0)}_.previousRoot||_.events.compute==null||_.events.compute(d,_);function b(M){const w=Lh(M);if(!w||!w.events.enabled||w.raycaster.camera===null)return[];if(w.raycaster.camera===void 0){var D;w.events.compute==null||w.events.compute(d,w,(D=w.previousRoot)==null?void 0:D.getState()),w.raycaster.camera===void 0&&(w.raycaster.camera=null)}return w.raycaster.camera?w.raycaster.intersectObject(M,!0):[]}let R=x.flatMap(b).sort((M,w)=>{const D=Lh(M.object),U=Lh(w.object);return!D||!U?M.distance-w.distance:U.events.priority-D.events.priority||M.distance-w.distance}).filter(M=>{const w=i_(M);return v.has(w)?!1:(v.add(w),!0)});_.events.filter&&(R=_.events.filter(R,_));for(const M of R){let w=M.object;for(;w;){var T;(T=w.__r3f)!=null&&T.eventCount&&y.push({...M,eventObject:w}),w=w.parent}}if("pointerId"in d&&_.internal.capturedMap.has(d.pointerId))for(let M of _.internal.capturedMap.get(d.pointerId).values())v.has(i_(M.intersection))||y.push(M.intersection);return y}function i(d,p,_,v){if(d.length){const y={stopped:!1};for(const x of d){let b=Lh(x.object);if(b||x.object.traverseAncestors(R=>{const T=Lh(R);if(T)return b=T,!1}),b){const{raycaster:R,pointer:T,camera:M,internal:w}=b,D=new Q(T.x,T.y,0).unproject(M),U=N=>{var I,W;return(I=(W=w.capturedMap.get(N))==null?void 0:W.has(x.eventObject))!=null?I:!1},F=N=>{const I={intersection:x,target:p.target};w.capturedMap.has(N)?w.capturedMap.get(N).set(x.eventObject,I):w.capturedMap.set(N,new Map([[x.eventObject,I]])),p.target.setPointerCapture(N)},O=N=>{const I=w.capturedMap.get(N);I&&gT(w.capturedMap,x.eventObject,I,N)};let z={};for(let N in p){let I=p[N];typeof I!="function"&&(z[N]=I)}let k={...x,...z,pointer:T,intersections:d,stopped:y.stopped,delta:_,unprojectedPoint:D,ray:R.ray,camera:M,stopPropagation(){const N="pointerId"in p&&w.capturedMap.get(p.pointerId);if((!N||N.has(x.eventObject))&&(k.stopped=y.stopped=!0,w.hovered.size&&Array.from(w.hovered.values()).find(I=>I.eventObject===x.eventObject))){const I=d.slice(0,d.indexOf(x));o([...I,x])}},target:{hasPointerCapture:U,setPointerCapture:F,releasePointerCapture:O},currentTarget:{hasPointerCapture:U,setPointerCapture:F,releasePointerCapture:O},nativeEvent:p};if(v(k),y.stopped===!0)break}}}return d}function o(d){const{internal:p}=s.getState();for(const _ of p.hovered.values())if(!d.length||!d.find(v=>v.object===_.object&&v.index===_.index&&v.instanceId===_.instanceId)){const y=_.eventObject.__r3f;if(p.hovered.delete(i_(_)),y!=null&&y.eventCount){const x=y.handlers,b={..._,intersections:d};x.onPointerOut==null||x.onPointerOut(b),x.onPointerLeave==null||x.onPointerLeave(b)}}}function l(d,p){for(let _=0;_<p.length;_++){const v=p[_].__r3f;v==null||v.handlers.onPointerMissed==null||v.handlers.onPointerMissed(d)}}function h(d){switch(d){case"onPointerLeave":case"onPointerCancel":return()=>o([]);case"onLostPointerCapture":return p=>{const{internal:_}=s.getState();"pointerId"in p&&_.capturedMap.has(p.pointerId)&&requestAnimationFrame(()=>{_.capturedMap.has(p.pointerId)&&(_.capturedMap.delete(p.pointerId),o([]))})}}return function(_){const{onPointerMissed:v,internal:y}=s.getState();y.lastEvent.current=_;const x=d==="onPointerMove",b=d==="onClick"||d==="onContextMenu"||d==="onDoubleClick",T=n(_,x?t:void 0),M=b?e(_):0;d==="onPointerDown"&&(y.initialClick=[_.offsetX,_.offsetY],y.initialHits=T.map(D=>D.eventObject)),b&&!T.length&&M<=2&&(l(_,y.interaction),v&&v(_)),x&&o(T);function w(D){const U=D.eventObject,F=U.__r3f;if(!(F!=null&&F.eventCount))return;const O=F.handlers;if(x){if(O.onPointerOver||O.onPointerEnter||O.onPointerOut||O.onPointerLeave){const z=i_(D),k=y.hovered.get(z);k?k.stopped&&D.stopPropagation():(y.hovered.set(z,D),O.onPointerOver==null||O.onPointerOver(D),O.onPointerEnter==null||O.onPointerEnter(D))}O.onPointerMove==null||O.onPointerMove(D)}else{const z=O[d];z?(!b||y.initialHits.includes(U))&&(l(_,y.interaction.filter(k=>!y.initialHits.includes(k))),z(D)):b&&y.initialHits.includes(U)&&l(_,y.interaction.filter(k=>!y.initialHits.includes(k)))}}i(T,_,M,w)}}return{handlePointer:h}}const vT=s=>!!(s!=null&&s.render),eS=Ee.createContext(null),tO=(s,e)=>{const t=jE((h,d)=>{const p=new Q,_=new Q,v=new Q;function y(M=d().camera,w=_,D=d().size){const{width:U,height:F,top:O,left:z}=D,k=U/F;w.isVector3?v.copy(w):v.set(...w);const N=M.getWorldPosition(p).distanceTo(v);if(uT(M))return{width:U/M.zoom,height:F/M.zoom,top:O,left:z,factor:1,distance:N,aspect:k};{const I=M.fov*Math.PI/180,W=2*Math.tan(I/2)*N,ae=W*(U/F);return{width:ae,height:W,top:O,left:z,factor:U/ae,distance:N,aspect:k}}}let x;const b=M=>h(w=>({performance:{...w.performance,current:M}})),R=new et;return{set:h,get:d,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(M=1)=>s(d(),M),advance:(M,w)=>e(M,w,d()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new vA,pointer:R,mouse:R,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const M=d();x&&clearTimeout(x),M.performance.current!==M.performance.min&&b(M.performance.min),x=setTimeout(()=>b(d().performance.max),M.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:y},setEvents:M=>h(w=>({...w,events:{...w.events,...M}})),setSize:(M,w,D=0,U=0)=>{const F=d().camera,O={width:M,height:w,top:D,left:U};h(z=>({size:O,viewport:{...z.viewport,...y(F,_,O)}}))},setDpr:M=>h(w=>{const D=fT(M);return{viewport:{...w.viewport,dpr:D,initialDpr:w.viewport.initialDpr||D}}}),setFrameloop:(M="always")=>{const w=d().clock;w.stop(),w.elapsedTime=0,M!=="never"&&(w.start(),w.elapsedTime=0),h(()=>({frameloop:M}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:Ee.createRef(),active:!1,frames:0,priority:0,subscribe:(M,w,D)=>{const U=d().internal;return U.priority=U.priority+(w>0?1:0),U.subscribers.push({ref:M,priority:w,store:D}),U.subscribers=U.subscribers.sort((F,O)=>F.priority-O.priority),()=>{const F=d().internal;F!=null&&F.subscribers&&(F.priority=F.priority-(w>0?1:0),F.subscribers=F.subscribers.filter(O=>O.ref!==M))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:h,size:d,viewport:p,gl:_,set:v}=t.getState();if(d.width!==i.width||d.height!==i.height||p.dpr!==o){i=d,o=p.dpr,mT(h,d),p.dpr>0&&_.setPixelRatio(p.dpr);const y=typeof HTMLCanvasElement<"u"&&_.domElement instanceof HTMLCanvasElement;_.setSize(d.width,d.height,y)}h!==l&&(l=h,v(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(h)}})))}),t.subscribe(h=>s(h)),t};function tS(){const s=Ee.useContext(eS);if(!s)throw new Error("R3F: Hooks can only be used within the Canvas component!");return s}function Ih(s=t=>t,e){return tS()(s,e)}function _T(s,e=0){const t=tS(),n=t.getState().internal.subscribe,i=QA(s);return Kp(()=>n(i,e,t),[e,n,t]),null}const yT=new WeakMap,nO=s=>{var e;return typeof s=="function"&&(s==null||(e=s.prototype)==null?void 0:e.constructor)===s};function xT(s,e){return function(t,...n){let i;return nO(t)?(i=yT.get(t),i||(i=new t,yT.set(t,i))):i=t,s&&s(i),Promise.all(n.map(o=>new Promise((l,h)=>i.load(o,d=>{vs(d?.scene)&&Object.assign(d,JL(d.scene)),l(d)},e,d=>h(new Error(`Could not load ${o}: ${d?.message}`))))))}}function Cl(s,e,t,n){const i=Array.isArray(e)?e:[e],o=TL(xT(t,n),[s,...i],{equal:Si.equ});return Array.isArray(e)?o:o[0]}Cl.preload=function(s,e,t){const n=Array.isArray(e)?e:[e];return CL(xT(t),[s,...n])},Cl.clear=function(s,e){const t=Array.isArray(e)?e:[e];return RL([s,...t])};var iO={version:"9.4.2"};function aO(s){const e=LL(s);return e.injectIntoDevTools(),e}const AT=0,Fh={},sO=/^three(?=[A-Z])/,a_=s=>`${s[0].toUpperCase()}${s.slice(1)}`;let rO=0;const oO=s=>typeof s=="function";function ST(s){if(oO(s)){const e=`${rO++}`;return Fh[e]=s,e}else Object.assign(Fh,s)}function MT(s,e){const t=a_(s),n=Fh[t];if(s!=="primitive"&&!n)throw new Error(`R3F: ${t} 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(s==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function lO(s,e,t){var n;return s=a_(s)in Fh?s:s.replace(sO,""),MT(s,e),s==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,e_(e.object,t,s,e)}function cO(s){if(!s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?n_(s.parent,s):vs(s.object)&&(s.object.visible=!1),s.isHidden=!0,Oh(s)}}function bT(s){if(s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?t_(s.parent,s):vs(s.object)&&s.props.visible!==!1&&(s.object.visible=!0),s.isHidden=!1,Oh(s)}}function nS(s,e,t){const n=e.root.getState();if(!(!s.parent&&s.object!==n.scene)){if(!e.object){var i,o;const l=Fh[a_(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(Do(e.object,e.props),e.props.attach)t_(s,e);else if(vs(e.object)&&vs(s.object)){const l=s.object.children.indexOf(t?.object);if(t&&l!==-1){const h=s.object.children.indexOf(e.object);if(h!==-1){s.object.children.splice(h,1);const d=h<l?l-1:l;s.object.children.splice(d,0,e.object)}else e.object.parent=s.object,s.object.children.splice(l,0,e.object),e.object.dispatchEvent({type:"added"}),s.object.dispatchEvent({type:"childadded",child:e.object})}else s.object.add(e.object)}for(const l of e.children)nS(e,l);Oh(e)}}function iS(s,e){e&&(e.parent=s,s.children.push(e),nS(s,e))}function ET(s,e,t){if(!e||!t)return;e.parent=s;const n=s.children.indexOf(t);n!==-1?s.children.splice(n,0,e):s.children.push(e),nS(s,e,t)}function TT(s){if(typeof s.dispose=="function"){const e=()=>{try{s.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():sT.unstable_scheduleCallback(sT.unstable_IdlePriority,e)}}function aS(s,e,t){if(!e)return;e.parent=null;const n=s.children.indexOf(e);n!==-1&&s.children.splice(n,1),e.props.attach?n_(s,e):vs(e.object)&&vs(s.object)&&(s.object.remove(e.object),$L(cT(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];aS(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&TT(e.object),t===void 0&&Oh(e)}function uO(s,e){for(const t of[s,s.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const s_=[];function fO(){for(const[t]of s_){const n=t.parent;if(n){t.props.attach?n_(n,t):vs(t.object)&&vs(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?n_(t,i):vs(i.object)&&vs(t.object)&&t.object.remove(i.object)}t.isHidden&&bT(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&TT(t.object)}for(const[t,n,i]of s_){t.props=n;const o=t.parent;if(o){var s,e;const l=Fh[a_(t.type)];t.object=(s=t.props.object)!=null?s:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,uO(i,t.object),Do(t.object,t.props),t.props.attach?t_(o,t):vs(t.object)&&vs(o.object)&&o.object.add(t.object);for(const h of t.children)h.props.attach?t_(t,h):vs(h.object)&&vs(t.object)&&t.object.add(h.object);Oh(t)}}s_.length=0}const sS=()=>{},CT={};let r_=AT;const hO=0,dO=4,o_=aO({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:lO,removeChild:aS,appendChild:iS,appendInitialChild:iS,insertBefore:ET,appendChildToContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||iS(t,e)},removeChildFromContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||aS(t,e)},insertInContainerBefore(s,e,t){const n=s.getState().scene.__r3f;!e||!t||!n||ET(n,e,t)},getRootHostContext:()=>CT,getChildHostContext:()=>CT,commitUpdate(s,e,t,n,i){var o,l,h;MT(e,n);let d=!1;if((s.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(h=n.args)!=null&&h.some((_,v)=>{var y;return _!==((y=t.args)==null?void 0:y[v])}))&&(d=!0),d)s_.push([s,{...n},i]);else{const _=jL(s,n);Object.keys(_).length&&(Object.assign(s.props,_),Do(s.object,_))}(i.sibling===null||(i.flags&dO)===hO)&&fO()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:s=>s?.object,prepareForCommit:()=>null,preparePortalMount:s=>e_(s.getState().scene,s,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:cO,unhideInstance:bT,createTextInstance:sS,hideTextInstance:sS,unhideTextInstance:sS,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:Ee.createContext(null),setCurrentUpdatePriority(s){r_=s},getCurrentUpdatePriority(){return r_},resolveUpdatePriority(){var s;if(r_!==AT)return r_;switch(typeof window<"u"&&((s=window.event)==null?void 0:s.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return $v.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return $v.ContinuousEventPriority;default:return $v.DefaultEventPriority}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:iO.version}),$u=new Map,Hh={objects:"shallow",strict:!1};function pO(s,e){if(!e&&typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&s.parentElement){const{width:t,height:n,top:i,left:o}=s.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas)return{width:s.width,height:s.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function mO(s){const e=$u.get(s),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||tO(hS,DT),l=t||o_.createContainer(o,$v.ConcurrentRoot,null,!1,null,"",i,i,i,null);e||$u.set(s,{fiber:l,store:o});let h,d,p=!1,_=null;return{async configure(v={}){let y;_=new Promise(X=>y=X);let{gl:x,size:b,scene:R,events:T,onCreated:M,shadows:w=!1,linear:D=!1,flat:U=!1,legacy:F=!1,orthographic:O=!1,frameloop:z="always",dpr:k=[1,2],performance:N,raycaster:I,camera:W,onPointerMissed:ae}=v,ie=o.getState(),se=ie.gl;if(!ie.gl){const X={canvas:s,powerPreference:"high-performance",antialias:!0,alpha:!0},ne=typeof x=="function"?await x(X):x;vT(ne)?se=ne:se=new HA({...X,...x}),ie.set({gl:se})}let _e=ie.raycaster;_e||ie.set({raycaster:_e=new SA});const{params:H,...K}=I||{};if(Si.equ(K,_e,Hh)||Do(_e,{...K}),Si.equ(H,_e.params,Hh)||Do(_e,{params:{..._e.params,...H}}),!ie.camera||ie.camera===d&&!Si.equ(d,W,Hh)){d=W;const X=W?.isCamera,ne=X?W:O?new El(0,0,0,0,.1,1e3):new ia(75,0,.1,1e3);X||(ne.position.z=5,W&&(Do(ne,W),ne.manual||("aspect"in W||"left"in W||"right"in W||"bottom"in W||"top"in W)&&(ne.manual=!0,ne.updateProjectionMatrix())),!ie.camera&&!(W!=null&&W.rotation)&&ne.lookAt(0,0,0)),ie.set({camera:ne}),_e.camera=ne}if(!ie.scene){let X;R!=null&&R.isScene?(X=R,e_(X,o,"",{})):(X=new Mp,e_(X,o,"",{}),R&&Do(X,R)),ie.set({scene:X})}T&&!ie.events.handlers&&ie.set({events:T(o)});const $=pO(s,b);if(Si.equ($,ie.size,Hh)||ie.setSize($.width,$.height,$.top,$.left),k&&ie.viewport.dpr!==fT(k)&&ie.setDpr(k),ie.frameloop!==z&&ie.setFrameloop(z),ie.onPointerMissed||ie.set({onPointerMissed:ae}),N&&!Si.equ(N,ie.performance,Hh)&&ie.set(X=>({performance:{...X.performance,...N}})),!ie.xr){var ue;const X=(Re,rt)=>{const ve=o.getState();ve.frameloop!=="never"&&DT(Re,!0,ve,rt)},ne=()=>{const Re=o.getState();Re.gl.xr.enabled=Re.gl.xr.isPresenting,Re.gl.xr.setAnimationLoop(Re.gl.xr.isPresenting?X:null),Re.gl.xr.isPresenting||hS(Re)},Ae={connect(){const Re=o.getState().gl;Re.xr.addEventListener("sessionstart",ne),Re.xr.addEventListener("sessionend",ne)},disconnect(){const Re=o.getState().gl;Re.xr.removeEventListener("sessionstart",ne),Re.xr.removeEventListener("sessionend",ne)}};typeof((ue=se.xr)==null?void 0:ue.addEventListener)=="function"&&Ae.connect(),ie.set({xr:Ae})}if(se.shadowMap){const X=se.shadowMap.enabled,ne=se.shadowMap.type;if(se.shadowMap.enabled=!!w,Si.boo(w))se.shadowMap.type=Qd;else if(Si.str(w)){var re;const Ae={basic:LM,percentage:Kf,soft:Qd,variance:mu};se.shadowMap.type=(re=Ae[w])!=null?re:Qd}else Si.obj(w)&&Object.assign(se.shadowMap,w);(X!==se.shadowMap.enabled||ne!==se.shadowMap.type)&&(se.shadowMap.needsUpdate=!0)}return Tn.enabled=!F,p||(se.outputColorSpace=D?ta:Pi,se.toneMapping=U?mr:Ig),ie.legacy!==F&&ie.set(()=>({legacy:F})),ie.linear!==D&&ie.set(()=>({linear:D})),ie.flat!==U&&ie.set(()=>({flat:U})),x&&!Si.fun(x)&&!vT(x)&&!Si.equ(x,se,Hh)&&Do(se,x),h=M,p=!0,y(),this},render(v){return!p&&!_&&this.configure(),_.then(()=>{o_.updateContainer(Pt.jsx(gO,{store:o,children:v,onCreated:h,rootElement:s}),l,null,()=>{})}),o},unmount(){RT(s)}}}function gO({store:s,children:e,onCreated:t,rootElement:n}){return Kp(()=>{const i=s.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),s.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),Pt.jsx(eS.Provider,{value:s,children:e})}function RT(s,e){const t=$u.get(s),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),o_.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,h,d;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(h=i.gl)==null||h.forceContextLoss==null||h.forceContextLoss(),(d=i.gl)!=null&&d.xr&&i.xr.disconnect(),qL(i.scene),$u.delete(s)}catch{}},500)})}}function vO(s,e,t){return Pt.jsx(_O,{children:s,container:e,state:t})}function _O({state:s={},children:e,container:t}){const{events:n,size:i,...o}=s,l=tS(),[h]=Ee.useState(()=>new SA),[d]=Ee.useState(()=>new et),p=QA((v,y)=>{let x;if(y.camera&&i){const b=y.camera;x=v.viewport.getCurrentViewport(b,new Q,i),b!==v.camera&&mT(b,i)}return{...v,...y,scene:t,raycaster:h,pointer:d,mouse:d,previousRoot:l,events:{...v.events,...y.events,...n},size:{...v.size,...i},viewport:{...v.viewport,...x},setEvents:b=>y.set(R=>({...R,events:{...R.events,...b}}))}}),_=Ee.useMemo(()=>{const v=jE((x,b)=>({...o,set:x,get:b})),y=x=>v.setState(b=>p.current(x,b));return y(l.getState()),l.subscribe(y),v},[l,t]);return Pt.jsx(Pt.Fragment,{children:o_.createPortal(Pt.jsx(eS.Provider,{value:_,children:e}),_,null)})}const yO=new Set,xO=new Set,AO=new Set;function rS(s,e){if(s.size)for(const{callback:t}of s.values())t(e)}function jp(s,e){switch(s){case"before":return rS(yO,e);case"after":return rS(xO,e);case"tail":return rS(AO,e)}}let oS,lS;function cS(s,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof s=="number"&&(n=s-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=s),oS=e.internal.subscribers;for(let i=0;i<oS.length;i++)lS=oS[i],lS.ref.current(lS.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let l_=!1,uS=!1,fS,wT,Ph;function BT(s){wT=requestAnimationFrame(BT),l_=!0,fS=0,jp("before",s),uS=!0;for(const t of $u.values()){var e;Ph=t.store.getState(),Ph.internal.active&&(Ph.frameloop==="always"||Ph.internal.frames>0)&&!((e=Ph.gl.xr)!=null&&e.isPresenting)&&(fS+=cS(s,Ph))}if(uS=!1,jp("after",s),fS===0)return jp("tail",s),l_=!1,cancelAnimationFrame(wT)}function hS(s,e=1){var t;if(!s)return $u.forEach(n=>hS(n.store.getState(),e));(t=s.gl.xr)!=null&&t.isPresenting||!s.internal.active||s.frameloop==="never"||(e>1?s.internal.frames=Math.min(60,s.internal.frames+e):uS?s.internal.frames=2:s.internal.frames=1,l_||(l_=!0,requestAnimationFrame(BT)))}function DT(s,e=!0,t,n){if(e&&jp("before",s),t)cS(s,t,n);else for(const i of $u.values())cS(s,i.store.getState());e&&jp("after",s)}const dS={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 SO(s){const{handlePointer:e}=eO(s);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(dS).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=s.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=s.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[h,d]=dS[o];t.addEventListener(h,l,{passive:d})}},disconnect:()=>{const{set:t,events:n}=s.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=dS[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function UT(s,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>s(...n),e)}}function MO({debounce:s,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)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[o,l]=Ee.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),h=Ee.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),d=s?typeof s=="number"?s:s.scroll:null,p=s?typeof s=="number"?s:s.resize:null,_=Ee.useRef(!1);Ee.useEffect(()=>(_.current=!0,()=>{_.current=!1}));const[v,y,x]=Ee.useMemo(()=>{const M=()=>{if(!h.current.element)return;const{left:w,top:D,width:U,height:F,bottom:O,right:z,x:k,y:N}=h.current.element.getBoundingClientRect(),I={left:w,top:D,width:U,height:F,bottom:O,right:z,x:k,y:N};h.current.element instanceof HTMLElement&&n&&(I.height=h.current.element.offsetHeight,I.width=h.current.element.offsetWidth),Object.freeze(I),_.current&&!CO(h.current.lastBounds,I)&&l(h.current.lastBounds=I)};return[M,p?UT(M,p):M,d?UT(M,d):M]},[l,n,d,p]);function b(){h.current.scrollContainers&&(h.current.scrollContainers.forEach(M=>M.removeEventListener("scroll",x,!0)),h.current.scrollContainers=null),h.current.resizeObserver&&(h.current.resizeObserver.disconnect(),h.current.resizeObserver=null),h.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",h.current.orientationHandler))}function R(){h.current.element&&(h.current.resizeObserver=new i(x),h.current.resizeObserver.observe(h.current.element),e&&h.current.scrollContainers&&h.current.scrollContainers.forEach(M=>M.addEventListener("scroll",x,{capture:!0,passive:!0})),h.current.orientationHandler=()=>{x()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",h.current.orientationHandler))}const T=M=>{!M||M===h.current.element||(b(),h.current.element=M,h.current.scrollContainers=NT(M),R())};return EO(x,!!e),bO(y),Ee.useEffect(()=>{b(),R()},[e,x,y]),Ee.useEffect(()=>b,[]),[T,o,v]}function bO(s){Ee.useEffect(()=>{const e=s;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[s])}function EO(s,e){Ee.useEffect(()=>{if(e){const t=s;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[s,e])}function NT(s){const e=[];if(!s||s===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(s);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(s),[...e,...NT(s.parentElement)]}const TO=["x","y","top","bottom","left","right","width","height"],CO=(s,e)=>TO.every(t=>s[t]===e[t]);function RO({ref:s,children:e,fallback:t,resize:n,style:i,gl:o,events:l=SO,eventSource:h,eventPrefix:d,shadows:p,linear:_,flat:v,legacy:y,orthographic:x,frameloop:b,dpr:R,performance:T,raycaster:M,camera:w,scene:D,onPointerMissed:U,onCreated:F,...O}){Ee.useMemo(()=>ST(hL),[]);const z=kL(),[k,N]=MO({scroll:!0,debounce:{scroll:50,resize:0},...n}),I=Ee.useRef(null),W=Ee.useRef(null);Ee.useImperativeHandle(s,()=>I.current);const ae=QA(U),[ie,se]=Ee.useState(!1),[_e,H]=Ee.useState(!1);if(ie)throw ie;if(_e)throw _e;const K=Ee.useRef(null);Kp(()=>{const ue=I.current;if(N.width>0&&N.height>0&&ue){K.current||(K.current=mO(ue));async function re(){await K.current.configure({gl:o,scene:D,events:l,shadows:p,linear:_,flat:v,legacy:y,orthographic:x,frameloop:b,dpr:R,performance:T,raycaster:M,camera:w,size:N,onPointerMissed:(...X)=>ae.current==null?void 0:ae.current(...X),onCreated:X=>{X.events.connect==null||X.events.connect(h?zL(h)?h.current:h:W.current),d&&X.setEvents({compute:(ne,Ae)=>{const Re=ne[d+"X"],rt=ne[d+"Y"];Ae.pointer.set(Re/Ae.size.width*2-1,-(rt/Ae.size.height)*2+1),Ae.raycaster.setFromCamera(Ae.pointer,Ae.camera)}}),F?.(X)}}),K.current.render(Pt.jsx(z,{children:Pt.jsx(YL,{set:H,children:Pt.jsx(Ee.Suspense,{fallback:Pt.jsx(XL,{set:se}),children:e??null})})}))}re()}}),Ee.useEffect(()=>{const ue=I.current;if(ue)return()=>RT(ue)},[]);const $=h?"none":"auto";return Pt.jsx("div",{ref:W,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:$,...i},...O,children:Pt.jsx("div",{ref:k,style:{width:"100%",height:"100%"},children:Pt.jsx("canvas",{ref:I,style:{display:"block"},children:t})})})}function wO(s){return Pt.jsx(oT,{children:Pt.jsx(RO,{...s})})}const pS=parseInt(Zd.replace(/\D+/g,""));function LT(s,e){if(e===ox)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===bu||e===fp){let t=s.getIndex();if(t===null){const l=[],h=s.getAttribute("position");if(h!==void 0){for(let d=0;d<h.count;d++)l.push(d);s.setIndex(l),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(t)if(e===bu)for(let l=1;l<=n;l++)i.push(t.getX(0)),i.push(t.getX(l)),i.push(t.getX(l+1));else for(let l=0;l<n;l++)l%2===0?(i.push(t.getX(l)),i.push(t.getX(l+1)),i.push(t.getX(l+2))):(i.push(t.getX(l+2)),i.push(t.getX(l+1)),i.push(t.getX(l)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=s.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}var Ar=Uint8Array,Cc=Uint16Array,mS=Uint32Array,OT=new Ar([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]),IT=new Ar([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]),BO=new Ar([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),FT=function(s,e){for(var t=new Cc(31),n=0;n<31;++n)t[n]=e+=1<<s[n-1];for(var i=new mS(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)i[o]=o-t[n]<<5|n;return[t,i]},HT=FT(OT,2),PT=HT[0],DO=HT[1];PT[28]=258,DO[258]=28;for(var UO=FT(IT,0),NO=UO[0],gS=new Cc(32768),mi=0;mi<32768;++mi){var Rc=(mi&43690)>>>1|(mi&21845)<<1;Rc=(Rc&52428)>>>2|(Rc&13107)<<2,Rc=(Rc&61680)>>>4|(Rc&3855)<<4,gS[mi]=((Rc&65280)>>>8|(Rc&255)<<8)>>>1}for(var Zp=(function(s,e,t){for(var n=s.length,i=0,o=new Cc(e);i<n;++i)++o[s[i]-1];var l=new Cc(e);for(i=0;i<e;++i)l[i]=l[i-1]+o[i-1]<<1;var h;if(t){h=new Cc(1<<e);var d=15-e;for(i=0;i<n;++i)if(s[i])for(var p=i<<4|s[i],_=e-s[i],v=l[s[i]-1]++<<_,y=v|(1<<_)-1;v<=y;++v)h[gS[v]>>>d]=p}else for(h=new Cc(n),i=0;i<n;++i)s[i]&&(h[i]=gS[l[s[i]-1]++]>>>15-s[i]);return h}),Qp=new Ar(288),mi=0;mi<144;++mi)Qp[mi]=8;for(var mi=144;mi<256;++mi)Qp[mi]=9;for(var mi=256;mi<280;++mi)Qp[mi]=7;for(var mi=280;mi<288;++mi)Qp[mi]=8;for(var GT=new Ar(32),mi=0;mi<32;++mi)GT[mi]=5;var LO=Zp(Qp,9,1),OO=Zp(GT,5,1),vS=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},$r=function(s,e,t){var n=e/8|0;return(s[n]|s[n+1]<<8)>>(e&7)&t},_S=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},IO=function(s){return(s/8|0)+(s&7&&1)},FO=function(s,e,t){(t==null||t>s.length)&&(t=s.length);var n=new(s instanceof Cc?Cc:s instanceof mS?mS:Ar)(t-e);return n.set(s.subarray(e,t)),n},HO=function(s,e,t){var n=s.length;if(!n||t&&!t.l&&n<5)return e||new Ar(0);var i=!e||t,o=!t||t.i;t||(t={}),e||(e=new Ar(n*3));var l=function(ve){var Be=e.length;if(ve>Be){var st=new Ar(Math.max(Be*2,ve));st.set(e),e=st}},h=t.f||0,d=t.p||0,p=t.b||0,_=t.l,v=t.d,y=t.m,x=t.n,b=n*8;do{if(!_){t.f=h=$r(s,d,1);var R=$r(s,d+1,3);if(d+=3,R)if(R==1)_=LO,v=OO,y=9,x=5;else if(R==2){var D=$r(s,d,31)+257,U=$r(s,d+10,15)+4,F=D+$r(s,d+5,31)+1;d+=14;for(var O=new Ar(F),z=new Ar(19),k=0;k<U;++k)z[BO[k]]=$r(s,d+k*3,7);d+=U*3;for(var N=vS(z),I=(1<<N)-1,W=Zp(z,N,1),k=0;k<F;){var ae=W[$r(s,d,I)];d+=ae&15;var T=ae>>>4;if(T<16)O[k++]=T;else{var ie=0,se=0;for(T==16?(se=3+$r(s,d,3),d+=2,ie=O[k-1]):T==17?(se=3+$r(s,d,7),d+=3):T==18&&(se=11+$r(s,d,127),d+=7);se--;)O[k++]=ie}}var _e=O.subarray(0,D),H=O.subarray(D);y=vS(_e),x=vS(H),_=Zp(_e,y,1),v=Zp(H,x,1)}else throw"invalid block type";else{var T=IO(d)+4,M=s[T-4]|s[T-3]<<8,w=T+M;if(w>n){if(o)throw"unexpected EOF";break}i&&l(p+M),e.set(s.subarray(T,w),p),t.b=p+=M,t.p=d=w*8;continue}if(d>b){if(o)throw"unexpected EOF";break}}i&&l(p+131072);for(var K=(1<<y)-1,$=(1<<x)-1,ue=d;;ue=d){var ie=_[_S(s,d)&K],re=ie>>>4;if(d+=ie&15,d>b){if(o)throw"unexpected EOF";break}if(!ie)throw"invalid length/literal";if(re<256)e[p++]=re;else if(re==256){ue=d,_=null;break}else{var X=re-254;if(re>264){var k=re-257,ne=OT[k];X=$r(s,d,(1<<ne)-1)+PT[k],d+=ne}var Ae=v[_S(s,d)&$],Re=Ae>>>4;if(!Ae)throw"invalid distance";d+=Ae&15;var H=NO[Re];if(Re>3){var ne=IT[Re];H+=_S(s,d)&(1<<ne)-1,d+=ne}if(d>b){if(o)throw"unexpected EOF";break}i&&l(p+131072);for(var rt=p+X;p<rt;p+=4)e[p]=e[p-H],e[p+1]=e[p+1-H],e[p+2]=e[p+2-H],e[p+3]=e[p+3-H];p=rt}}t.l=_,t.p=ue,t.b=p,_&&(h=1,t.m=y,t.d=v,t.n=x)}while(!h);return p==e.length?e:FO(e,0,p)},PO=new Ar(0),GO=function(s){if((s[0]&15)!=8||s[0]>>>4>7||(s[0]<<8|s[1])%31)throw"invalid zlib data";if(s[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function c_(s,e){return HO((GO(s),s.subarray(2,-4)),e)}var zO=typeof TextDecoder<"u"&&new TextDecoder,VO=0;try{zO.decode(PO,{stream:!0}),VO=1}catch{}const kO=s=>s&&s.isCubeTexture;class XO extends pi{constructor(e,t){var n,i;const o=kO(e),h=((i=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?i:1024)/4,d=Math.floor(Math.log2(h)),p=Math.pow(2,d),_=3*Math.max(p,112),v=4*p,y=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/_}`,`#define CUBEUV_TEXEL_HEIGHT ${1/v}`,`#define CUBEUV_MAX_MIP ${d}.0`],x=`
|
|
4030
|
+
`)+c.join(" > ")}return null},jt.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 27:case 5:return Kc(c.child.stateNode);default:return c.child.stateNode}},jt.injectIntoDevTools=function(){var c={bundleType:0,version:vd,rendererPackageName:Ef,currentDispatcherRef:tn,findFiberByHostInstance:Gm,reconcilerVersion:"19.0.0"};if(Tf!==null&&(c.rendererConfig=Tf),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)c=!0;else{try{$c=u.inject(c),ss=u}catch{}c=!!u.checkDCE}}return c},jt.isAlreadyRendering=function(){return!1},jt.observeVisibleRects=function(c,u,g,S){if(!Lr)throw Error(i(363));c=Va(c,u);var C=km(c,g,S).disconnect;return{disconnect:function(){C()}}},jt.shouldError=function(){return null},jt.shouldSuspend=function(){return!1},jt.startHostTransition=function(c,u,g,S){if(c.tag!==5)throw Error(i(476));var C=sm(c).queue;Yh(c,C,u,is,g===null?n:function(){var B=sm(c).next.queue;return Oo(c,B,{},ka()),g(S)})},jt.updateContainer=function(c,u,g,S){var C=u.current,B=ka();return H_(C,B,c,u,g,S),B},jt.updateContainerSync=function(c,u,g,S){return u.tag===0&&oa(),H_(u.current,2,c,u,g,S),2},jt},s.exports.default=s.exports,Object.defineProperty(s.exports,"__esModule",{value:!0})})(YA)),YA.exports}var nT;function UL(){return nT||(nT=1,XA.exports=DL()),XA.exports}var NL=UL();const LL=Iy(NL);var KA={exports:{}},WA={};var iT;function OL(){return iT||(iT=1,(function(s){function e(H,K){var $=H.length;H.push(K);e:for(;0<$;){var ue=$-1>>>1,re=H[ue];if(0<i(re,K))H[ue]=K,H[$]=re,$=ue;else break e}}function t(H){return H.length===0?null:H[0]}function n(H){if(H.length===0)return null;var K=H[0],$=H.pop();if($!==K){H[0]=$;e:for(var ue=0,re=H.length,X=re>>>1;ue<X;){var ne=2*(ue+1)-1,Ae=H[ne],Re=ne+1,rt=H[Re];if(0>i(Ae,$))Re<re&&0>i(rt,Ae)?(H[ue]=rt,H[Re]=$,ue=Re):(H[ue]=Ae,H[ne]=$,ue=ne);else if(Re<re&&0>i(rt,$))H[ue]=rt,H[Re]=$,ue=Re;else break e}}return K}function i(H,K){var $=H.sortIndex-K.sortIndex;return $!==0?$:H.id-K.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;s.unstable_now=function(){return o.now()}}else{var l=Date,h=l.now();s.unstable_now=function(){return l.now()-h}}var d=[],p=[],_=1,v=null,y=3,x=!1,b=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function D(H){for(var K=t(p);K!==null;){if(K.callback===null)n(p);else if(K.startTime<=H)n(p),K.sortIndex=K.expirationTime,e(d,K);else break;K=t(p)}}function U(H){if(R=!1,D(H),!b)if(t(d)!==null)b=!0,se();else{var K=t(p);K!==null&&_e(U,K.startTime-H)}}var F=!1,O=-1,z=5,k=-1;function N(){return!(s.unstable_now()-k<z)}function I(){if(F){var H=s.unstable_now();k=H;var K=!0;try{e:{b=!1,R&&(R=!1,M(O),O=-1),x=!0;var $=y;try{t:{for(D(H),v=t(d);v!==null&&!(v.expirationTime>H&&N());){var ue=v.callback;if(typeof ue=="function"){v.callback=null,y=v.priorityLevel;var re=ue(v.expirationTime<=H);if(H=s.unstable_now(),typeof re=="function"){v.callback=re,D(H),K=!0;break t}v===t(d)&&n(d),D(H)}else n(d);v=t(d)}if(v!==null)K=!0;else{var X=t(p);X!==null&&_e(U,X.startTime-H),K=!1}}break e}finally{v=null,y=$,x=!1}K=void 0}}finally{K?W():F=!1}}}var W;if(typeof w=="function")W=function(){w(I)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ie=ae.port2;ae.port1.onmessage=I,W=function(){ie.postMessage(null)}}else W=function(){T(I,0)};function se(){F||(F=!0,W())}function _e(H,K){O=T(function(){H(s.unstable_now())},K)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(H){H.callback=null},s.unstable_continueExecution=function(){b||x||(b=!0,se())},s.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<H?Math.floor(1e3/H):5},s.unstable_getCurrentPriorityLevel=function(){return y},s.unstable_getFirstCallbackNode=function(){return t(d)},s.unstable_next=function(H){switch(y){case 1:case 2:case 3:var K=3;break;default:K=y}var $=y;y=K;try{return H()}finally{y=$}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(H,K){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var $=y;y=H;try{return K()}finally{y=$}},s.unstable_scheduleCallback=function(H,K,$){var ue=s.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ue+$:ue):$=ue,H){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=$+re,H={id:_++,callback:K,priorityLevel:H,startTime:$,expirationTime:re,sortIndex:-1},$>ue?(H.sortIndex=$,e(p,H),t(d)===null&&H===t(p)&&(R?(M(O),O=-1):R=!0,_e(U,$-ue))):(H.sortIndex=re,e(d,H),b||x||(b=!0,se())),H},s.unstable_shouldYield=N,s.unstable_wrapCallback=function(H){var K=y;return function(){var $=y;y=K;try{return H.apply(this,arguments)}finally{y=$}}}})(WA)),WA}var aT;function IL(){return aT||(aT=1,KA.exports=OL()),KA.exports}var sT=IL();function jA(s,e,t){if(!s)return;if(t(s)===!0)return s;let n=e?s.return:s.child;for(;n;){const i=jA(n,e,t);if(i)return i;n=e?null:n.sibling}}function rT(s){try{return Object.defineProperties(s,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return s}}const ZA=rT(Ee.createContext(null));class oT extends Ee.Component{render(){return Ee.createElement(ZA.Provider,{value:this._reactInternals},this.props.children)}}function lT(){const s=Ee.useContext(ZA);if(s===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Ee.useId();return Ee.useMemo(()=>{for(const t of[s,s?.alternate]){if(!t)continue;const n=jA(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[s,e])}const FL=Symbol.for("react.context"),HL=s=>s!==null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===FL;function PL(){const s=lT(),[e]=Ee.useState(()=>new Map);e.clear();let t=s;for(;t;){const n=t.type;HL(n)&&n!==ZA&&!e.has(n)&&e.set(n,Ee.use(rT(n))),t=t.return}return e}function GL(){const s=PL();return Ee.useMemo(()=>Array.from(s.keys()).reduce((e,t)=>n=>Ee.createElement(e,null,Ee.createElement(t.Provider,{...n,value:s.get(t)})),e=>Ee.createElement(oT,{...e})),[s])}function cT(s){let e=s.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const uT=s=>s&&s.isOrthographicCamera,zL=s=>s&&s.hasOwnProperty("current"),VL=s=>s!=null&&(typeof s=="string"||typeof s=="number"||s.isColor),Kp=((s,e)=>typeof window<"u"&&(((s=window.document)==null?void 0:s.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?Ee.useLayoutEffect:Ee.useEffect;function QA(s){const e=Ee.useRef(s);return Kp(()=>{e.current=s},[s]),e}function kL(){const s=lT(),e=GL();return Ee.useMemo(()=>({children:t})=>{const i=!!jA(s,!0,o=>o.type===Ee.StrictMode)?Ee.StrictMode:Ee.Fragment;return Ht.jsx(i,{children:Ht.jsx(e,{children:t})})},[s,e])}function XL({set:s}){return Kp(()=>(s(new Promise(()=>null)),()=>s(!1)),[s]),null}const YL=(s=>(s=class extends Ee.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},s.getDerivedStateFromError=()=>({error:!0}),s))();function fT(s){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(s)?Math.min(Math.max(s[0],t),s[1]):s}function Lh(s){var e;return(e=s.__r3f)==null?void 0:e.root.getState()}const Si={obj:s=>s===Object(s)&&!Si.arr(s)&&typeof s!="function",fun:s=>typeof s=="function",str:s=>typeof s=="string",num:s=>typeof s=="number",boo:s=>typeof s=="boolean",und:s=>s===void 0,nul:s=>s===null,arr:s=>Array.isArray(s),equ(s,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof s!=typeof e||!!s!=!!e)return!1;if(Si.str(s)||Si.num(s)||Si.boo(s))return s===e;const o=Si.obj(s);if(o&&n==="reference")return s===e;const l=Si.arr(s);if(l&&t==="reference")return s===e;if((l||o)&&s===e)return!0;let h;for(h in s)if(!(h in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(h in i?e:s)if(!Si.equ(s[h],e[h],{strict:i,objects:"reference"}))return!1}else for(h in i?e:s)if(s[h]!==e[h])return!1;if(Si.und(h)){if(l&&s.length===0&&e.length===0||o&&Object.keys(s).length===0&&Object.keys(e).length===0)return!0;if(s!==e)return!1}return!0}};function JL(s){const e={nodes:{},materials:{},meshes:{}};return s&&s.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function qL(s){s.type!=="Scene"&&(s.dispose==null||s.dispose());for(const e in s){const t=s[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const hT=["children","key","ref"];function KL(s){const e={};for(const t in s)hT.includes(t)||(e[t]=s[t]);return e}function e_(s,e,t,n){const i=s;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:KL(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function Wp(s,e){if(!e.includes("-"))return{root:s,key:e,target:s[e]};if(e in s)return{root:s,key:e,target:s[e]};let t=s;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:s,key:e,target:void 0}}e=i,s=t,t=t[e]}return{root:s,key:e,target:t}}const dT=/-\d+$/;function t_(s,e){if(Si.str(e.props.attach)){if(dT.test(e.props.attach)){const i=e.props.attach.replace(dT,""),{root:o,key:l}=Wp(s.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=Wp(s.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else Si.fun(e.props.attach)&&(e.previousAttach=e.props.attach(s.object,e.object))}function n_(s,e){if(Si.str(e.props.attach)){const{root:t,key:n}=Wp(s.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(s.object,e.object);delete e.previousAttach}const $A=[...hT,"args","dispose","attach","object","onUpdate","dispose"],pT=new Map;function WL(s){let e=pT.get(s.constructor);try{e||(e=new s.constructor,pT.set(s.constructor,e))}catch{}return e}function jL(s,e){const t={};for(const n in e)if(!$A.includes(n)&&!Si.equ(e[n],s.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in s.props){if($A.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=Wp(s.object,n);if(i.constructor&&i.constructor.length===0){const l=WL(i);Si.und(l)||(t[o]=l[o])}else t[o]=0}return t}const ZL=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],QL=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Do(s,e){var t;const n=s.__r3f,i=n&&cT(n).getState(),o=n?.eventCount;for(const h in e){let d=e[h];if($A.includes(h))continue;if(n&&QL.test(h)){typeof d=="function"?n.handlers[h]=d:delete n.handlers[h],n.eventCount=Object.keys(n.handlers).length;continue}if(d===void 0)continue;let{root:p,key:_,target:v}=Wp(s,h);if(v===void 0&&(typeof p!="object"||p===null))throw Error(`R3F: Cannot set "${h}". Ensure it is an object before setting "${_}".`);if(v instanceof uh&&d instanceof uh)v.mask=d.mask;else if(v instanceof At&&VL(d))v.set(d);else if(v!==null&&typeof v=="object"&&typeof v.set=="function"&&typeof v.copy=="function"&&d!=null&&d.constructor&&v.constructor===d.constructor)v.copy(d);else if(v!==null&&typeof v=="object"&&typeof v.set=="function"&&Array.isArray(d))typeof v.fromArray=="function"?v.fromArray(d):v.set(...d);else if(v!==null&&typeof v=="object"&&typeof v.set=="function"&&typeof d=="number")typeof v.setScalar=="function"?v.setScalar(d):v.set(d);else{var l;p[_]=d,i&&!i.linear&&ZL.includes(_)&&(l=p[_])!=null&&l.isTexture&&p[_].format===ji&&p[_].type===Ma&&(p[_].colorSpace=Pi)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const h=n.object,d=i.internal.interaction.indexOf(h);d>-1&&i.internal.interaction.splice(d,1),n.eventCount&&h.raycast!==null&&i.internal.interaction.push(h)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&Oh(n),s}function Oh(s){var e;if(!s.parent)return;s.props.onUpdate==null||s.props.onUpdate(s.object);const t=(e=s.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function mT(s,e){s.manual||(uT(s)?(s.left=e.width/-2,s.right=e.width/2,s.top=e.height/2,s.bottom=e.height/-2):s.aspect=e.width/e.height,s.updateProjectionMatrix())}const vs=s=>s?.isObject3D;function i_(s){return(s.eventObject||s.object).uuid+"/"+s.index+s.instanceId}function gT(s,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(s.delete(n),i.target.releasePointerCapture(n)))}function $L(s,e){const{internal:t}=s.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{gT(t.capturedMap,e,n,i)})}function eO(s){function e(d){const{internal:p}=s.getState(),_=d.offsetX-p.initialClick[0],v=d.offsetY-p.initialClick[1];return Math.round(Math.sqrt(_*_+v*v))}function t(d){return d.filter(p=>["Move","Over","Enter","Out","Leave"].some(_=>{var v;return(v=p.__r3f)==null?void 0:v.handlers["onPointer"+_]}))}function n(d,p){const _=s.getState(),v=new Set,y=[],x=p?p(_.internal.interaction):_.internal.interaction;for(let M=0;M<x.length;M++){const w=Lh(x[M]);w&&(w.raycaster.camera=void 0)}_.previousRoot||_.events.compute==null||_.events.compute(d,_);function b(M){const w=Lh(M);if(!w||!w.events.enabled||w.raycaster.camera===null)return[];if(w.raycaster.camera===void 0){var D;w.events.compute==null||w.events.compute(d,w,(D=w.previousRoot)==null?void 0:D.getState()),w.raycaster.camera===void 0&&(w.raycaster.camera=null)}return w.raycaster.camera?w.raycaster.intersectObject(M,!0):[]}let R=x.flatMap(b).sort((M,w)=>{const D=Lh(M.object),U=Lh(w.object);return!D||!U?M.distance-w.distance:U.events.priority-D.events.priority||M.distance-w.distance}).filter(M=>{const w=i_(M);return v.has(w)?!1:(v.add(w),!0)});_.events.filter&&(R=_.events.filter(R,_));for(const M of R){let w=M.object;for(;w;){var T;(T=w.__r3f)!=null&&T.eventCount&&y.push({...M,eventObject:w}),w=w.parent}}if("pointerId"in d&&_.internal.capturedMap.has(d.pointerId))for(let M of _.internal.capturedMap.get(d.pointerId).values())v.has(i_(M.intersection))||y.push(M.intersection);return y}function i(d,p,_,v){if(d.length){const y={stopped:!1};for(const x of d){let b=Lh(x.object);if(b||x.object.traverseAncestors(R=>{const T=Lh(R);if(T)return b=T,!1}),b){const{raycaster:R,pointer:T,camera:M,internal:w}=b,D=new Q(T.x,T.y,0).unproject(M),U=N=>{var I,W;return(I=(W=w.capturedMap.get(N))==null?void 0:W.has(x.eventObject))!=null?I:!1},F=N=>{const I={intersection:x,target:p.target};w.capturedMap.has(N)?w.capturedMap.get(N).set(x.eventObject,I):w.capturedMap.set(N,new Map([[x.eventObject,I]])),p.target.setPointerCapture(N)},O=N=>{const I=w.capturedMap.get(N);I&&gT(w.capturedMap,x.eventObject,I,N)};let z={};for(let N in p){let I=p[N];typeof I!="function"&&(z[N]=I)}let k={...x,...z,pointer:T,intersections:d,stopped:y.stopped,delta:_,unprojectedPoint:D,ray:R.ray,camera:M,stopPropagation(){const N="pointerId"in p&&w.capturedMap.get(p.pointerId);if((!N||N.has(x.eventObject))&&(k.stopped=y.stopped=!0,w.hovered.size&&Array.from(w.hovered.values()).find(I=>I.eventObject===x.eventObject))){const I=d.slice(0,d.indexOf(x));o([...I,x])}},target:{hasPointerCapture:U,setPointerCapture:F,releasePointerCapture:O},currentTarget:{hasPointerCapture:U,setPointerCapture:F,releasePointerCapture:O},nativeEvent:p};if(v(k),y.stopped===!0)break}}}return d}function o(d){const{internal:p}=s.getState();for(const _ of p.hovered.values())if(!d.length||!d.find(v=>v.object===_.object&&v.index===_.index&&v.instanceId===_.instanceId)){const y=_.eventObject.__r3f;if(p.hovered.delete(i_(_)),y!=null&&y.eventCount){const x=y.handlers,b={..._,intersections:d};x.onPointerOut==null||x.onPointerOut(b),x.onPointerLeave==null||x.onPointerLeave(b)}}}function l(d,p){for(let _=0;_<p.length;_++){const v=p[_].__r3f;v==null||v.handlers.onPointerMissed==null||v.handlers.onPointerMissed(d)}}function h(d){switch(d){case"onPointerLeave":case"onPointerCancel":return()=>o([]);case"onLostPointerCapture":return p=>{const{internal:_}=s.getState();"pointerId"in p&&_.capturedMap.has(p.pointerId)&&requestAnimationFrame(()=>{_.capturedMap.has(p.pointerId)&&(_.capturedMap.delete(p.pointerId),o([]))})}}return function(_){const{onPointerMissed:v,internal:y}=s.getState();y.lastEvent.current=_;const x=d==="onPointerMove",b=d==="onClick"||d==="onContextMenu"||d==="onDoubleClick",T=n(_,x?t:void 0),M=b?e(_):0;d==="onPointerDown"&&(y.initialClick=[_.offsetX,_.offsetY],y.initialHits=T.map(D=>D.eventObject)),b&&!T.length&&M<=2&&(l(_,y.interaction),v&&v(_)),x&&o(T);function w(D){const U=D.eventObject,F=U.__r3f;if(!(F!=null&&F.eventCount))return;const O=F.handlers;if(x){if(O.onPointerOver||O.onPointerEnter||O.onPointerOut||O.onPointerLeave){const z=i_(D),k=y.hovered.get(z);k?k.stopped&&D.stopPropagation():(y.hovered.set(z,D),O.onPointerOver==null||O.onPointerOver(D),O.onPointerEnter==null||O.onPointerEnter(D))}O.onPointerMove==null||O.onPointerMove(D)}else{const z=O[d];z?(!b||y.initialHits.includes(U))&&(l(_,y.interaction.filter(k=>!y.initialHits.includes(k))),z(D)):b&&y.initialHits.includes(U)&&l(_,y.interaction.filter(k=>!y.initialHits.includes(k)))}}i(T,_,M,w)}}return{handlePointer:h}}const vT=s=>!!(s!=null&&s.render),eS=Ee.createContext(null),tO=(s,e)=>{const t=jE((h,d)=>{const p=new Q,_=new Q,v=new Q;function y(M=d().camera,w=_,D=d().size){const{width:U,height:F,top:O,left:z}=D,k=U/F;w.isVector3?v.copy(w):v.set(...w);const N=M.getWorldPosition(p).distanceTo(v);if(uT(M))return{width:U/M.zoom,height:F/M.zoom,top:O,left:z,factor:1,distance:N,aspect:k};{const I=M.fov*Math.PI/180,W=2*Math.tan(I/2)*N,ae=W*(U/F);return{width:ae,height:W,top:O,left:z,factor:U/ae,distance:N,aspect:k}}}let x;const b=M=>h(w=>({performance:{...w.performance,current:M}})),R=new et;return{set:h,get:d,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(M=1)=>s(d(),M),advance:(M,w)=>e(M,w,d()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new vA,pointer:R,mouse:R,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const M=d();x&&clearTimeout(x),M.performance.current!==M.performance.min&&b(M.performance.min),x=setTimeout(()=>b(d().performance.max),M.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:y},setEvents:M=>h(w=>({...w,events:{...w.events,...M}})),setSize:(M,w,D=0,U=0)=>{const F=d().camera,O={width:M,height:w,top:D,left:U};h(z=>({size:O,viewport:{...z.viewport,...y(F,_,O)}}))},setDpr:M=>h(w=>{const D=fT(M);return{viewport:{...w.viewport,dpr:D,initialDpr:w.viewport.initialDpr||D}}}),setFrameloop:(M="always")=>{const w=d().clock;w.stop(),w.elapsedTime=0,M!=="never"&&(w.start(),w.elapsedTime=0),h(()=>({frameloop:M}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:Ee.createRef(),active:!1,frames:0,priority:0,subscribe:(M,w,D)=>{const U=d().internal;return U.priority=U.priority+(w>0?1:0),U.subscribers.push({ref:M,priority:w,store:D}),U.subscribers=U.subscribers.sort((F,O)=>F.priority-O.priority),()=>{const F=d().internal;F!=null&&F.subscribers&&(F.priority=F.priority-(w>0?1:0),F.subscribers=F.subscribers.filter(O=>O.ref!==M))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:h,size:d,viewport:p,gl:_,set:v}=t.getState();if(d.width!==i.width||d.height!==i.height||p.dpr!==o){i=d,o=p.dpr,mT(h,d),p.dpr>0&&_.setPixelRatio(p.dpr);const y=typeof HTMLCanvasElement<"u"&&_.domElement instanceof HTMLCanvasElement;_.setSize(d.width,d.height,y)}h!==l&&(l=h,v(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(h)}})))}),t.subscribe(h=>s(h)),t};function tS(){const s=Ee.useContext(eS);if(!s)throw new Error("R3F: Hooks can only be used within the Canvas component!");return s}function Ih(s=t=>t,e){return tS()(s,e)}function _T(s,e=0){const t=tS(),n=t.getState().internal.subscribe,i=QA(s);return Kp(()=>n(i,e,t),[e,n,t]),null}const yT=new WeakMap,nO=s=>{var e;return typeof s=="function"&&(s==null||(e=s.prototype)==null?void 0:e.constructor)===s};function xT(s,e){return function(t,...n){let i;return nO(t)?(i=yT.get(t),i||(i=new t,yT.set(t,i))):i=t,s&&s(i),Promise.all(n.map(o=>new Promise((l,h)=>i.load(o,d=>{vs(d?.scene)&&Object.assign(d,JL(d.scene)),l(d)},e,d=>h(new Error(`Could not load ${o}: ${d?.message}`))))))}}function Cl(s,e,t,n){const i=Array.isArray(e)?e:[e],o=TL(xT(t,n),[s,...i],{equal:Si.equ});return Array.isArray(e)?o:o[0]}Cl.preload=function(s,e,t){const n=Array.isArray(e)?e:[e];return CL(xT(t),[s,...n])},Cl.clear=function(s,e){const t=Array.isArray(e)?e:[e];return RL([s,...t])};var iO={version:"9.4.2"};function aO(s){const e=LL(s);return e.injectIntoDevTools(),e}const AT=0,Fh={},sO=/^three(?=[A-Z])/,a_=s=>`${s[0].toUpperCase()}${s.slice(1)}`;let rO=0;const oO=s=>typeof s=="function";function ST(s){if(oO(s)){const e=`${rO++}`;return Fh[e]=s,e}else Object.assign(Fh,s)}function MT(s,e){const t=a_(s),n=Fh[t];if(s!=="primitive"&&!n)throw new Error(`R3F: ${t} 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(s==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function lO(s,e,t){var n;return s=a_(s)in Fh?s:s.replace(sO,""),MT(s,e),s==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,e_(e.object,t,s,e)}function cO(s){if(!s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?n_(s.parent,s):vs(s.object)&&(s.object.visible=!1),s.isHidden=!0,Oh(s)}}function bT(s){if(s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?t_(s.parent,s):vs(s.object)&&s.props.visible!==!1&&(s.object.visible=!0),s.isHidden=!1,Oh(s)}}function nS(s,e,t){const n=e.root.getState();if(!(!s.parent&&s.object!==n.scene)){if(!e.object){var i,o;const l=Fh[a_(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(Do(e.object,e.props),e.props.attach)t_(s,e);else if(vs(e.object)&&vs(s.object)){const l=s.object.children.indexOf(t?.object);if(t&&l!==-1){const h=s.object.children.indexOf(e.object);if(h!==-1){s.object.children.splice(h,1);const d=h<l?l-1:l;s.object.children.splice(d,0,e.object)}else e.object.parent=s.object,s.object.children.splice(l,0,e.object),e.object.dispatchEvent({type:"added"}),s.object.dispatchEvent({type:"childadded",child:e.object})}else s.object.add(e.object)}for(const l of e.children)nS(e,l);Oh(e)}}function iS(s,e){e&&(e.parent=s,s.children.push(e),nS(s,e))}function ET(s,e,t){if(!e||!t)return;e.parent=s;const n=s.children.indexOf(t);n!==-1?s.children.splice(n,0,e):s.children.push(e),nS(s,e,t)}function TT(s){if(typeof s.dispose=="function"){const e=()=>{try{s.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():sT.unstable_scheduleCallback(sT.unstable_IdlePriority,e)}}function aS(s,e,t){if(!e)return;e.parent=null;const n=s.children.indexOf(e);n!==-1&&s.children.splice(n,1),e.props.attach?n_(s,e):vs(e.object)&&vs(s.object)&&(s.object.remove(e.object),$L(cT(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];aS(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&TT(e.object),t===void 0&&Oh(e)}function uO(s,e){for(const t of[s,s.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const s_=[];function fO(){for(const[t]of s_){const n=t.parent;if(n){t.props.attach?n_(n,t):vs(t.object)&&vs(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?n_(t,i):vs(i.object)&&vs(t.object)&&t.object.remove(i.object)}t.isHidden&&bT(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&TT(t.object)}for(const[t,n,i]of s_){t.props=n;const o=t.parent;if(o){var s,e;const l=Fh[a_(t.type)];t.object=(s=t.props.object)!=null?s:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,uO(i,t.object),Do(t.object,t.props),t.props.attach?t_(o,t):vs(t.object)&&vs(o.object)&&o.object.add(t.object);for(const h of t.children)h.props.attach?t_(t,h):vs(h.object)&&vs(t.object)&&t.object.add(h.object);Oh(t)}}s_.length=0}const sS=()=>{},CT={};let r_=AT;const hO=0,dO=4,o_=aO({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:lO,removeChild:aS,appendChild:iS,appendInitialChild:iS,insertBefore:ET,appendChildToContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||iS(t,e)},removeChildFromContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||aS(t,e)},insertInContainerBefore(s,e,t){const n=s.getState().scene.__r3f;!e||!t||!n||ET(n,e,t)},getRootHostContext:()=>CT,getChildHostContext:()=>CT,commitUpdate(s,e,t,n,i){var o,l,h;MT(e,n);let d=!1;if((s.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(h=n.args)!=null&&h.some((_,v)=>{var y;return _!==((y=t.args)==null?void 0:y[v])}))&&(d=!0),d)s_.push([s,{...n},i]);else{const _=jL(s,n);Object.keys(_).length&&(Object.assign(s.props,_),Do(s.object,_))}(i.sibling===null||(i.flags&dO)===hO)&&fO()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:s=>s?.object,prepareForCommit:()=>null,preparePortalMount:s=>e_(s.getState().scene,s,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:cO,unhideInstance:bT,createTextInstance:sS,hideTextInstance:sS,unhideTextInstance:sS,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:Ee.createContext(null),setCurrentUpdatePriority(s){r_=s},getCurrentUpdatePriority(){return r_},resolveUpdatePriority(){var s;if(r_!==AT)return r_;switch(typeof window<"u"&&((s=window.event)==null?void 0:s.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return $v.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return $v.ContinuousEventPriority;default:return $v.DefaultEventPriority}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:iO.version}),$u=new Map,Hh={objects:"shallow",strict:!1};function pO(s,e){if(!e&&typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&s.parentElement){const{width:t,height:n,top:i,left:o}=s.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas)return{width:s.width,height:s.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function mO(s){const e=$u.get(s),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||tO(hS,DT),l=t||o_.createContainer(o,$v.ConcurrentRoot,null,!1,null,"",i,i,i,null);e||$u.set(s,{fiber:l,store:o});let h,d,p=!1,_=null;return{async configure(v={}){let y;_=new Promise(X=>y=X);let{gl:x,size:b,scene:R,events:T,onCreated:M,shadows:w=!1,linear:D=!1,flat:U=!1,legacy:F=!1,orthographic:O=!1,frameloop:z="always",dpr:k=[1,2],performance:N,raycaster:I,camera:W,onPointerMissed:ae}=v,ie=o.getState(),se=ie.gl;if(!ie.gl){const X={canvas:s,powerPreference:"high-performance",antialias:!0,alpha:!0},ne=typeof x=="function"?await x(X):x;vT(ne)?se=ne:se=new HA({...X,...x}),ie.set({gl:se})}let _e=ie.raycaster;_e||ie.set({raycaster:_e=new SA});const{params:H,...K}=I||{};if(Si.equ(K,_e,Hh)||Do(_e,{...K}),Si.equ(H,_e.params,Hh)||Do(_e,{params:{..._e.params,...H}}),!ie.camera||ie.camera===d&&!Si.equ(d,W,Hh)){d=W;const X=W?.isCamera,ne=X?W:O?new El(0,0,0,0,.1,1e3):new ia(75,0,.1,1e3);X||(ne.position.z=5,W&&(Do(ne,W),ne.manual||("aspect"in W||"left"in W||"right"in W||"bottom"in W||"top"in W)&&(ne.manual=!0,ne.updateProjectionMatrix())),!ie.camera&&!(W!=null&&W.rotation)&&ne.lookAt(0,0,0)),ie.set({camera:ne}),_e.camera=ne}if(!ie.scene){let X;R!=null&&R.isScene?(X=R,e_(X,o,"",{})):(X=new Mp,e_(X,o,"",{}),R&&Do(X,R)),ie.set({scene:X})}T&&!ie.events.handlers&&ie.set({events:T(o)});const $=pO(s,b);if(Si.equ($,ie.size,Hh)||ie.setSize($.width,$.height,$.top,$.left),k&&ie.viewport.dpr!==fT(k)&&ie.setDpr(k),ie.frameloop!==z&&ie.setFrameloop(z),ie.onPointerMissed||ie.set({onPointerMissed:ae}),N&&!Si.equ(N,ie.performance,Hh)&&ie.set(X=>({performance:{...X.performance,...N}})),!ie.xr){var ue;const X=(Re,rt)=>{const ve=o.getState();ve.frameloop!=="never"&&DT(Re,!0,ve,rt)},ne=()=>{const Re=o.getState();Re.gl.xr.enabled=Re.gl.xr.isPresenting,Re.gl.xr.setAnimationLoop(Re.gl.xr.isPresenting?X:null),Re.gl.xr.isPresenting||hS(Re)},Ae={connect(){const Re=o.getState().gl;Re.xr.addEventListener("sessionstart",ne),Re.xr.addEventListener("sessionend",ne)},disconnect(){const Re=o.getState().gl;Re.xr.removeEventListener("sessionstart",ne),Re.xr.removeEventListener("sessionend",ne)}};typeof((ue=se.xr)==null?void 0:ue.addEventListener)=="function"&&Ae.connect(),ie.set({xr:Ae})}if(se.shadowMap){const X=se.shadowMap.enabled,ne=se.shadowMap.type;if(se.shadowMap.enabled=!!w,Si.boo(w))se.shadowMap.type=Qd;else if(Si.str(w)){var re;const Ae={basic:LM,percentage:Kf,soft:Qd,variance:mu};se.shadowMap.type=(re=Ae[w])!=null?re:Qd}else Si.obj(w)&&Object.assign(se.shadowMap,w);(X!==se.shadowMap.enabled||ne!==se.shadowMap.type)&&(se.shadowMap.needsUpdate=!0)}return Tn.enabled=!F,p||(se.outputColorSpace=D?ta:Pi,se.toneMapping=U?mr:Ig),ie.legacy!==F&&ie.set(()=>({legacy:F})),ie.linear!==D&&ie.set(()=>({linear:D})),ie.flat!==U&&ie.set(()=>({flat:U})),x&&!Si.fun(x)&&!vT(x)&&!Si.equ(x,se,Hh)&&Do(se,x),h=M,p=!0,y(),this},render(v){return!p&&!_&&this.configure(),_.then(()=>{o_.updateContainer(Ht.jsx(gO,{store:o,children:v,onCreated:h,rootElement:s}),l,null,()=>{})}),o},unmount(){RT(s)}}}function gO({store:s,children:e,onCreated:t,rootElement:n}){return Kp(()=>{const i=s.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),s.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),Ht.jsx(eS.Provider,{value:s,children:e})}function RT(s,e){const t=$u.get(s),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),o_.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,h,d;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(h=i.gl)==null||h.forceContextLoss==null||h.forceContextLoss(),(d=i.gl)!=null&&d.xr&&i.xr.disconnect(),qL(i.scene),$u.delete(s)}catch{}},500)})}}function vO(s,e,t){return Ht.jsx(_O,{children:s,container:e,state:t})}function _O({state:s={},children:e,container:t}){const{events:n,size:i,...o}=s,l=tS(),[h]=Ee.useState(()=>new SA),[d]=Ee.useState(()=>new et),p=QA((v,y)=>{let x;if(y.camera&&i){const b=y.camera;x=v.viewport.getCurrentViewport(b,new Q,i),b!==v.camera&&mT(b,i)}return{...v,...y,scene:t,raycaster:h,pointer:d,mouse:d,previousRoot:l,events:{...v.events,...y.events,...n},size:{...v.size,...i},viewport:{...v.viewport,...x},setEvents:b=>y.set(R=>({...R,events:{...R.events,...b}}))}}),_=Ee.useMemo(()=>{const v=jE((x,b)=>({...o,set:x,get:b})),y=x=>v.setState(b=>p.current(x,b));return y(l.getState()),l.subscribe(y),v},[l,t]);return Ht.jsx(Ht.Fragment,{children:o_.createPortal(Ht.jsx(eS.Provider,{value:_,children:e}),_,null)})}const yO=new Set,xO=new Set,AO=new Set;function rS(s,e){if(s.size)for(const{callback:t}of s.values())t(e)}function jp(s,e){switch(s){case"before":return rS(yO,e);case"after":return rS(xO,e);case"tail":return rS(AO,e)}}let oS,lS;function cS(s,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof s=="number"&&(n=s-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=s),oS=e.internal.subscribers;for(let i=0;i<oS.length;i++)lS=oS[i],lS.ref.current(lS.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let l_=!1,uS=!1,fS,wT,Ph;function BT(s){wT=requestAnimationFrame(BT),l_=!0,fS=0,jp("before",s),uS=!0;for(const t of $u.values()){var e;Ph=t.store.getState(),Ph.internal.active&&(Ph.frameloop==="always"||Ph.internal.frames>0)&&!((e=Ph.gl.xr)!=null&&e.isPresenting)&&(fS+=cS(s,Ph))}if(uS=!1,jp("after",s),fS===0)return jp("tail",s),l_=!1,cancelAnimationFrame(wT)}function hS(s,e=1){var t;if(!s)return $u.forEach(n=>hS(n.store.getState(),e));(t=s.gl.xr)!=null&&t.isPresenting||!s.internal.active||s.frameloop==="never"||(e>1?s.internal.frames=Math.min(60,s.internal.frames+e):uS?s.internal.frames=2:s.internal.frames=1,l_||(l_=!0,requestAnimationFrame(BT)))}function DT(s,e=!0,t,n){if(e&&jp("before",s),t)cS(s,t,n);else for(const i of $u.values())cS(s,i.store.getState());e&&jp("after",s)}const dS={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 SO(s){const{handlePointer:e}=eO(s);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(dS).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=s.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=s.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[h,d]=dS[o];t.addEventListener(h,l,{passive:d})}},disconnect:()=>{const{set:t,events:n}=s.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=dS[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function UT(s,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>s(...n),e)}}function MO({debounce:s,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)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[o,l]=Ee.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),h=Ee.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),d=s?typeof s=="number"?s:s.scroll:null,p=s?typeof s=="number"?s:s.resize:null,_=Ee.useRef(!1);Ee.useEffect(()=>(_.current=!0,()=>{_.current=!1}));const[v,y,x]=Ee.useMemo(()=>{const M=()=>{if(!h.current.element)return;const{left:w,top:D,width:U,height:F,bottom:O,right:z,x:k,y:N}=h.current.element.getBoundingClientRect(),I={left:w,top:D,width:U,height:F,bottom:O,right:z,x:k,y:N};h.current.element instanceof HTMLElement&&n&&(I.height=h.current.element.offsetHeight,I.width=h.current.element.offsetWidth),Object.freeze(I),_.current&&!CO(h.current.lastBounds,I)&&l(h.current.lastBounds=I)};return[M,p?UT(M,p):M,d?UT(M,d):M]},[l,n,d,p]);function b(){h.current.scrollContainers&&(h.current.scrollContainers.forEach(M=>M.removeEventListener("scroll",x,!0)),h.current.scrollContainers=null),h.current.resizeObserver&&(h.current.resizeObserver.disconnect(),h.current.resizeObserver=null),h.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",h.current.orientationHandler))}function R(){h.current.element&&(h.current.resizeObserver=new i(x),h.current.resizeObserver.observe(h.current.element),e&&h.current.scrollContainers&&h.current.scrollContainers.forEach(M=>M.addEventListener("scroll",x,{capture:!0,passive:!0})),h.current.orientationHandler=()=>{x()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",h.current.orientationHandler))}const T=M=>{!M||M===h.current.element||(b(),h.current.element=M,h.current.scrollContainers=NT(M),R())};return EO(x,!!e),bO(y),Ee.useEffect(()=>{b(),R()},[e,x,y]),Ee.useEffect(()=>b,[]),[T,o,v]}function bO(s){Ee.useEffect(()=>{const e=s;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[s])}function EO(s,e){Ee.useEffect(()=>{if(e){const t=s;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[s,e])}function NT(s){const e=[];if(!s||s===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(s);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(s),[...e,...NT(s.parentElement)]}const TO=["x","y","top","bottom","left","right","width","height"],CO=(s,e)=>TO.every(t=>s[t]===e[t]);function RO({ref:s,children:e,fallback:t,resize:n,style:i,gl:o,events:l=SO,eventSource:h,eventPrefix:d,shadows:p,linear:_,flat:v,legacy:y,orthographic:x,frameloop:b,dpr:R,performance:T,raycaster:M,camera:w,scene:D,onPointerMissed:U,onCreated:F,...O}){Ee.useMemo(()=>ST(hL),[]);const z=kL(),[k,N]=MO({scroll:!0,debounce:{scroll:50,resize:0},...n}),I=Ee.useRef(null),W=Ee.useRef(null);Ee.useImperativeHandle(s,()=>I.current);const ae=QA(U),[ie,se]=Ee.useState(!1),[_e,H]=Ee.useState(!1);if(ie)throw ie;if(_e)throw _e;const K=Ee.useRef(null);Kp(()=>{const ue=I.current;if(N.width>0&&N.height>0&&ue){K.current||(K.current=mO(ue));async function re(){await K.current.configure({gl:o,scene:D,events:l,shadows:p,linear:_,flat:v,legacy:y,orthographic:x,frameloop:b,dpr:R,performance:T,raycaster:M,camera:w,size:N,onPointerMissed:(...X)=>ae.current==null?void 0:ae.current(...X),onCreated:X=>{X.events.connect==null||X.events.connect(h?zL(h)?h.current:h:W.current),d&&X.setEvents({compute:(ne,Ae)=>{const Re=ne[d+"X"],rt=ne[d+"Y"];Ae.pointer.set(Re/Ae.size.width*2-1,-(rt/Ae.size.height)*2+1),Ae.raycaster.setFromCamera(Ae.pointer,Ae.camera)}}),F?.(X)}}),K.current.render(Ht.jsx(z,{children:Ht.jsx(YL,{set:H,children:Ht.jsx(Ee.Suspense,{fallback:Ht.jsx(XL,{set:se}),children:e??null})})}))}re()}}),Ee.useEffect(()=>{const ue=I.current;if(ue)return()=>RT(ue)},[]);const $=h?"none":"auto";return Ht.jsx("div",{ref:W,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:$,...i},...O,children:Ht.jsx("div",{ref:k,style:{width:"100%",height:"100%"},children:Ht.jsx("canvas",{ref:I,style:{display:"block"},children:t})})})}function wO(s){return Ht.jsx(oT,{children:Ht.jsx(RO,{...s})})}const pS=parseInt(Zd.replace(/\D+/g,""));function LT(s,e){if(e===ox)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===bu||e===fp){let t=s.getIndex();if(t===null){const l=[],h=s.getAttribute("position");if(h!==void 0){for(let d=0;d<h.count;d++)l.push(d);s.setIndex(l),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(t)if(e===bu)for(let l=1;l<=n;l++)i.push(t.getX(0)),i.push(t.getX(l)),i.push(t.getX(l+1));else for(let l=0;l<n;l++)l%2===0?(i.push(t.getX(l)),i.push(t.getX(l+1)),i.push(t.getX(l+2))):(i.push(t.getX(l+2)),i.push(t.getX(l+1)),i.push(t.getX(l)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=s.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}var Ar=Uint8Array,Cc=Uint16Array,mS=Uint32Array,OT=new Ar([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]),IT=new Ar([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]),BO=new Ar([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),FT=function(s,e){for(var t=new Cc(31),n=0;n<31;++n)t[n]=e+=1<<s[n-1];for(var i=new mS(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)i[o]=o-t[n]<<5|n;return[t,i]},HT=FT(OT,2),PT=HT[0],DO=HT[1];PT[28]=258,DO[258]=28;for(var UO=FT(IT,0),NO=UO[0],gS=new Cc(32768),mi=0;mi<32768;++mi){var Rc=(mi&43690)>>>1|(mi&21845)<<1;Rc=(Rc&52428)>>>2|(Rc&13107)<<2,Rc=(Rc&61680)>>>4|(Rc&3855)<<4,gS[mi]=((Rc&65280)>>>8|(Rc&255)<<8)>>>1}for(var Zp=(function(s,e,t){for(var n=s.length,i=0,o=new Cc(e);i<n;++i)++o[s[i]-1];var l=new Cc(e);for(i=0;i<e;++i)l[i]=l[i-1]+o[i-1]<<1;var h;if(t){h=new Cc(1<<e);var d=15-e;for(i=0;i<n;++i)if(s[i])for(var p=i<<4|s[i],_=e-s[i],v=l[s[i]-1]++<<_,y=v|(1<<_)-1;v<=y;++v)h[gS[v]>>>d]=p}else for(h=new Cc(n),i=0;i<n;++i)s[i]&&(h[i]=gS[l[s[i]-1]++]>>>15-s[i]);return h}),Qp=new Ar(288),mi=0;mi<144;++mi)Qp[mi]=8;for(var mi=144;mi<256;++mi)Qp[mi]=9;for(var mi=256;mi<280;++mi)Qp[mi]=7;for(var mi=280;mi<288;++mi)Qp[mi]=8;for(var GT=new Ar(32),mi=0;mi<32;++mi)GT[mi]=5;var LO=Zp(Qp,9,1),OO=Zp(GT,5,1),vS=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},$r=function(s,e,t){var n=e/8|0;return(s[n]|s[n+1]<<8)>>(e&7)&t},_S=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},IO=function(s){return(s/8|0)+(s&7&&1)},FO=function(s,e,t){(t==null||t>s.length)&&(t=s.length);var n=new(s instanceof Cc?Cc:s instanceof mS?mS:Ar)(t-e);return n.set(s.subarray(e,t)),n},HO=function(s,e,t){var n=s.length;if(!n||t&&!t.l&&n<5)return e||new Ar(0);var i=!e||t,o=!t||t.i;t||(t={}),e||(e=new Ar(n*3));var l=function(ve){var Be=e.length;if(ve>Be){var st=new Ar(Math.max(Be*2,ve));st.set(e),e=st}},h=t.f||0,d=t.p||0,p=t.b||0,_=t.l,v=t.d,y=t.m,x=t.n,b=n*8;do{if(!_){t.f=h=$r(s,d,1);var R=$r(s,d+1,3);if(d+=3,R)if(R==1)_=LO,v=OO,y=9,x=5;else if(R==2){var D=$r(s,d,31)+257,U=$r(s,d+10,15)+4,F=D+$r(s,d+5,31)+1;d+=14;for(var O=new Ar(F),z=new Ar(19),k=0;k<U;++k)z[BO[k]]=$r(s,d+k*3,7);d+=U*3;for(var N=vS(z),I=(1<<N)-1,W=Zp(z,N,1),k=0;k<F;){var ae=W[$r(s,d,I)];d+=ae&15;var T=ae>>>4;if(T<16)O[k++]=T;else{var ie=0,se=0;for(T==16?(se=3+$r(s,d,3),d+=2,ie=O[k-1]):T==17?(se=3+$r(s,d,7),d+=3):T==18&&(se=11+$r(s,d,127),d+=7);se--;)O[k++]=ie}}var _e=O.subarray(0,D),H=O.subarray(D);y=vS(_e),x=vS(H),_=Zp(_e,y,1),v=Zp(H,x,1)}else throw"invalid block type";else{var T=IO(d)+4,M=s[T-4]|s[T-3]<<8,w=T+M;if(w>n){if(o)throw"unexpected EOF";break}i&&l(p+M),e.set(s.subarray(T,w),p),t.b=p+=M,t.p=d=w*8;continue}if(d>b){if(o)throw"unexpected EOF";break}}i&&l(p+131072);for(var K=(1<<y)-1,$=(1<<x)-1,ue=d;;ue=d){var ie=_[_S(s,d)&K],re=ie>>>4;if(d+=ie&15,d>b){if(o)throw"unexpected EOF";break}if(!ie)throw"invalid length/literal";if(re<256)e[p++]=re;else if(re==256){ue=d,_=null;break}else{var X=re-254;if(re>264){var k=re-257,ne=OT[k];X=$r(s,d,(1<<ne)-1)+PT[k],d+=ne}var Ae=v[_S(s,d)&$],Re=Ae>>>4;if(!Ae)throw"invalid distance";d+=Ae&15;var H=NO[Re];if(Re>3){var ne=IT[Re];H+=_S(s,d)&(1<<ne)-1,d+=ne}if(d>b){if(o)throw"unexpected EOF";break}i&&l(p+131072);for(var rt=p+X;p<rt;p+=4)e[p]=e[p-H],e[p+1]=e[p+1-H],e[p+2]=e[p+2-H],e[p+3]=e[p+3-H];p=rt}}t.l=_,t.p=ue,t.b=p,_&&(h=1,t.m=y,t.d=v,t.n=x)}while(!h);return p==e.length?e:FO(e,0,p)},PO=new Ar(0),GO=function(s){if((s[0]&15)!=8||s[0]>>>4>7||(s[0]<<8|s[1])%31)throw"invalid zlib data";if(s[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function c_(s,e){return HO((GO(s),s.subarray(2,-4)),e)}var zO=typeof TextDecoder<"u"&&new TextDecoder,VO=0;try{zO.decode(PO,{stream:!0}),VO=1}catch{}const kO=s=>s&&s.isCubeTexture;class XO extends pi{constructor(e,t){var n,i;const o=kO(e),h=((i=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?i:1024)/4,d=Math.floor(Math.log2(h)),p=Math.pow(2,d),_=3*Math.max(p,112),v=4*p,y=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/_}`,`#define CUBEUV_TEXEL_HEIGHT ${1/v}`,`#define CUBEUV_MAX_MIP ${d}.0`],x=`
|
|
4031
4031
|
varying vec3 vWorldPosition;
|
|
4032
4032
|
void main()
|
|
4033
4033
|
{
|
|
@@ -4146,11 +4146,11 @@ void main() {
|
|
|
4146
4146
|
vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
|
|
4147
4147
|
gl_FragColor = vec4( clampedHdrColor , 1.0 );
|
|
4148
4148
|
}
|
|
4149
|
-
`;class FI extends ms{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:i,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:h,hdrCapacityMax:d,sdr:p,gainMap:_}){super({name:"GainMapDecoderMaterial",vertexShader:OI,fragmentShader:II,uniforms:{sdr:{value:p},gainMap:{value:_},gamma:{value:new Q(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new Q().fromArray(t)},offsetSdr:{value:new Q().fromArray(n)},gainMapMin:{value:new Q().fromArray(i)},gainMapMax:{value:new Q().fromArray(o)},weightFactor:{value:(Math.log2(l)-h)/(d-h)}},blending:Xr,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=h,this._hdrCapacityMax=d,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class eC extends LI{constructor(e,t){super({renderer:e,createMaterial:n=>new FI(n),createQuadRenderer:n=>new CS(n)},t)}async render(e,t,n,i){const{sdrImage:o,gainMapImage:l,needsFlip:h}=await this.processImages(n,i,"flipY"),{gainMap:d,sdr:p}=this.createTextures(o,l,h);this.updateQuadRenderer(e,o,d,p,t),e.render()}}class HI extends eC{load([e,t,n],i,o,l){const h=this.prepareQuadRenderer();let d,p,_;const v=async()=>{if(d&&p&&_){try{await this.render(h,_,d,p)}catch(N){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof l=="function"&&l(N),h.disposeOnDemandRenderer();return}typeof i=="function"&&i(h),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),h.disposeOnDemandRenderer()}};let y=!0,x=0,b=0,R=!0,T=0,M=0,w=!0,D=0,U=0;const F=()=>{if(typeof o=="function"){const N=x+T+D,I=b+M+U,W=y&&R&&w;o(new ProgressEvent("progress",{lengthComputable:W,loaded:I,total:N}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const O=new ha(this._internalLoadingManager);O.setResponseType("arraybuffer"),O.setRequestHeader(this.requestHeader),O.setPath(this.path),O.setWithCredentials(this.withCredentials),O.load(e,async N=>{if(typeof N=="string")throw new Error("Invalid sdr buffer");d=N,await v()},N=>{y=N.lengthComputable,b=N.loaded,x=N.total,F()},N=>{this.manager.itemError(e),typeof l=="function"&&l(N)});const z=new ha(this._internalLoadingManager);z.setResponseType("arraybuffer"),z.setRequestHeader(this.requestHeader),z.setPath(this.path),z.setWithCredentials(this.withCredentials),z.load(t,async N=>{if(typeof N=="string")throw new Error("Invalid gainmap buffer");p=N,await v()},N=>{R=N.lengthComputable,M=N.loaded,T=N.total,F()},N=>{this.manager.itemError(t),typeof l=="function"&&l(N)});const k=new ha(this._internalLoadingManager);return k.setRequestHeader(this.requestHeader),k.setPath(this.path),k.setWithCredentials(this.withCredentials),k.load(n,async N=>{if(typeof N!="string")throw new Error("Invalid metadata string");_=JSON.parse(N),await v()},N=>{w=N.lengthComputable,U=N.loaded,D=N.total,F()},N=>{this.manager.itemError(n),typeof l=="function"&&l(N)}),h}}class PI extends eC{load(e,t,n,i){const o=this.prepareQuadRenderer(),l=new ha(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,async h=>{if(typeof h=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const d=new Uint8Array(h);let p,_,v;try{const y=await NI(d);p=y.sdr,_=y.gainMap,v=y.metadata}catch(y){if(y instanceof QT||y instanceof ZT)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),v={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},p=d;else throw y}try{await this.render(o,v,p.buffer,_?.buffer)}catch(y){this.manager.itemError(e),typeof i=="function"&&i(y),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,h=>{this.manager.itemError(e),typeof i=="function"&&i(h)}),o}}const nm={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"},tC="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Vh=s=>Array.isArray(s),RS=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function p_({files:s=RS,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:i}={}){t&&(wS(t),s=nm[t],e=tC);const o=Vh(s),{extension:l,isCubemap:h}=BS(s),d=DS(l);if(!d)throw new Error("useEnvironment: Unrecognized file extension: "+s);const p=Ih(x=>x.gl);Ee.useLayoutEffect(()=>{if(l!=="webp"&&l!=="jpg"&&l!=="jpeg")return;function x(){Cl.clear(d,o?[s]:s)}p.domElement.addEventListener("webglcontextlost",x,{once:!0})},[s,p.domElement]);const _=Cl(d,o?[s]:s,x=>{(l==="webp"||l==="jpg"||l==="jpeg")&&x.setRenderer(p),x.setPath==null||x.setPath(e),i&&i(x)});let v=o?_[0]:_;if(l==="jpg"||l==="jpeg"||l==="webp"){var y;v=(y=v.renderTarget)==null?void 0:y.texture}return v.mapping=h?Yr:Wf,v.colorSpace=n??(h?"srgb":"srgb-linear"),v}const GI={files:RS,path:"",preset:void 0,extensions:void 0};p_.preload=s=>{const e={...GI,...s};let{files:t,path:n=""}=e;const{preset:i,extensions:o}=e;i&&(wS(i),t=nm[i],n=tC);const{extension:l}=BS(t);if(l==="webp"||l==="jpg"||l==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const h=DS(l);if(!h)throw new Error("useEnvironment: Unrecognized file extension: "+t);Cl.preload(h,Vh(t)?[t]:t,d=>{d.setPath==null||d.setPath(n),o&&o(d)})};const zI={files:RS,preset:void 0};p_.clear=s=>{const e={...zI,...s};let{files:t}=e;const{preset:n}=e;n&&(wS(n),t=nm[n]);const{extension:i}=BS(t),o=DS(i);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);Cl.clear(o,Vh(t)?[t]:t)};function wS(s){if(!(s in nm))throw new Error("Preset must be one of: "+Object.keys(nm).join(", "))}function BS(s){var e;const t=Vh(s)&&s.length===6,n=Vh(s)&&s.length===3&&s.some(l=>l.endsWith("json")),i=Vh(s)?s[0]:s;return{extension:t?"cube":n?"webp":i.startsWith("data:application/exr")?"exr":i.startsWith("data:application/hdr")?"hdr":i.startsWith("data:image/jpeg")?"jpg":(e=i.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function DS(s){return s==="cube"?H1:s==="hdr"?TI:s==="exr"?CI:s==="jpg"||s==="jpeg"?PI:s==="webp"?HI:null}const VI=s=>s.current&&s.current.isScene,kI=s=>VI(s)?s.current:s;function US(s,e,t,n,i={}){var o,l,h,d;i={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...i};const p=kI(e||t),_=p.background,v=p.environment,y={backgroundBlurriness:p.backgroundBlurriness,backgroundIntensity:p.backgroundIntensity,backgroundRotation:(o=(l=p.backgroundRotation)==null||l.clone==null?void 0:l.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:p.environmentIntensity,environmentRotation:(h=(d=p.environmentRotation)==null||d.clone==null?void 0:d.clone())!==null&&h!==void 0?h:[0,0,0]};return s!=="only"&&(p.environment=n),s&&(p.background=n),Do(p,i),()=>{s!=="only"&&(p.environment=v),s&&(p.background=_),Do(p,y)}}function NS({scene:s,background:e=!1,map:t,...n}){const i=Ih(o=>o.scene);return Ee.useLayoutEffect(()=>{if(t)return US(e,s,i,t,n)}),null}function nC({background:s=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:i,backgroundRotation:o,environmentIntensity:l,environmentRotation:h,...d}){const p=p_(d),_=Ih(v=>v.scene);return Ee.useLayoutEffect(()=>US(s,e,_,p,{backgroundBlurriness:t??n,backgroundIntensity:i,backgroundRotation:o,environmentIntensity:l,environmentRotation:h})),Ee.useEffect(()=>()=>{p.dispose()},[p]),null}function XI({children:s,near:e=.1,far:t=1e3,resolution:n=256,frames:i=1,map:o,background:l=!1,blur:h,backgroundBlurriness:d,backgroundIntensity:p,backgroundRotation:_,environmentIntensity:v,environmentRotation:y,scene:x,files:b,path:R,preset:T=void 0,extensions:M}){const w=Ih(k=>k.gl),D=Ih(k=>k.scene),U=Ee.useRef(null),[F]=Ee.useState(()=>new Mp),O=Ee.useMemo(()=>{const k=new Y0(n);return k.texture.type=Hi,k},[n]);Ee.useEffect(()=>()=>{O.dispose()},[O]),Ee.useLayoutEffect(()=>{if(i===1){const k=w.autoClear;w.autoClear=!0,U.current.update(w,F),w.autoClear=k}return US(l,x,D,O.texture,{backgroundBlurriness:h??d,backgroundIntensity:p,backgroundRotation:_,environmentIntensity:v,environmentRotation:y})},[s,F,O.texture,x,D,l,i,w]);let z=1;return _T(()=>{if(i===1/0||z<i){const k=w.autoClear;w.autoClear=!0,U.current.update(w,F),w.autoClear=k,z++}}),Ee.createElement(Ee.Fragment,null,vO(Ee.createElement(Ee.Fragment,null,s,Ee.createElement("cubeCamera",{ref:U,args:[e,t,O]}),b||T?Ee.createElement(nC,{background:!0,files:b,preset:T,path:R,extensions:M}):o?Ee.createElement(NS,{background:!0,map:o,extensions:M}):null),F))}function YI(s){var e,t,n,i;const o=p_(s),l=s.map||o;Ee.useMemo(()=>ST({GroundProjectedEnvImpl:XO}),[]),Ee.useEffect(()=>()=>{o.dispose()},[o]);const h=Ee.useMemo(()=>[l],[l]),d=(e=s.ground)==null?void 0:e.height,p=(t=s.ground)==null?void 0:t.radius,_=(n=(i=s.ground)==null?void 0:i.scale)!==null&&n!==void 0?n:1e3;return Ee.createElement(Ee.Fragment,null,Ee.createElement(NS,ky({},s,{map:l})),Ee.createElement("groundProjectedEnvImpl",{args:h,scale:_,height:d,radius:p}))}function JI(s){return s.ground?Ee.createElement(YI,s):s.map?Ee.createElement(NS,s):s.children?Ee.createElement(XI,s):Ee.createElement(nC,s)}function iC(s,e){if(e===ox)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===bu||e===fp){let t=s.getIndex();if(t===null){const l=[],h=s.getAttribute("position");if(h!==void 0){for(let d=0;d<h.count;d++)l.push(d);s.setIndex(l),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(e===bu)for(let l=1;l<=n;l++)i.push(t.getX(0)),i.push(t.getX(l)),i.push(t.getX(l+1));else for(let l=0;l<n;l++)l%2===0?(i.push(t.getX(l)),i.push(t.getX(l+1)),i.push(t.getX(l+2))):(i.push(t.getX(l+2)),i.push(t.getX(l+1)),i.push(t.getX(l)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=s.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}class qI extends Ca{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new QI(t)}),this.register(function(t){return new $I(t)}),this.register(function(t){return new lF(t)}),this.register(function(t){return new cF(t)}),this.register(function(t){return new uF(t)}),this.register(function(t){return new tF(t)}),this.register(function(t){return new nF(t)}),this.register(function(t){return new iF(t)}),this.register(function(t){return new aF(t)}),this.register(function(t){return new ZI(t)}),this.register(function(t){return new sF(t)}),this.register(function(t){return new eF(t)}),this.register(function(t){return new oF(t)}),this.register(function(t){return new rF(t)}),this.register(function(t){return new WI(t)}),this.register(function(t){return new fF(t)}),this.register(function(t){return new hF(t)})}load(e,t,n,i){const o=this;let l;if(this.resourcePath!=="")l=this.resourcePath;else if(this.path!==""){const p=nr.extractUrlBase(e);l=nr.resolveURL(p,this.path)}else l=nr.extractUrlBase(e);this.manager.itemStart(e);const h=function(p){i?i(p):console.error(p),o.manager.itemError(e),o.manager.itemEnd(e)},d=new ha(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(this.withCredentials),d.load(e,function(p){try{o.parse(p,l,function(_){t(_),o.manager.itemEnd(e)},h)}catch(_){h(_)}},n,h)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let o;const l={},h={},d=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(d.decode(new Uint8Array(e,0,4))===aC){try{l[Dn.KHR_BINARY_GLTF]=new dF(e)}catch(v){i&&i(v);return}o=JSON.parse(l[Dn.KHR_BINARY_GLTF].content)}else o=JSON.parse(d.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const p=new TF(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});p.fileLoader.setRequestHeader(this.requestHeader);for(let _=0;_<this.pluginCallbacks.length;_++){const v=this.pluginCallbacks[_](p);v.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),h[v.name]=v,l[v.name]=!0}if(o.extensionsUsed)for(let _=0;_<o.extensionsUsed.length;++_){const v=o.extensionsUsed[_],y=o.extensionsRequired||[];switch(v){case Dn.KHR_MATERIALS_UNLIT:l[v]=new jI;break;case Dn.KHR_DRACO_MESH_COMPRESSION:l[v]=new pF(o,this.dracoLoader);break;case Dn.KHR_TEXTURE_TRANSFORM:l[v]=new mF;break;case Dn.KHR_MESH_QUANTIZATION:l[v]=new gF;break;default:y.indexOf(v)>=0&&h[v]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+v+'".')}}p.setExtensions(l),p.setPlugins(h),p.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,o){n.parse(e,t,i,o)})}}function KI(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const Dn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class WI{constructor(e){this.parser=e,this.name=Dn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const o=t.json,d=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let p;const _=new At(16777215);d.color!==void 0&&_.setRGB(d.color[0],d.color[1],d.color[2],ta);const v=d.range!==void 0?d.range:0;switch(d.type){case"directional":p=new Pv(_),p.target.position.set(0,0,-1),p.add(p.target);break;case"point":p=new Hv(_),p.distance=v;break;case"spot":p=new Fv(_),p.distance=v,d.spot=d.spot||{},d.spot.innerConeAngle=d.spot.innerConeAngle!==void 0?d.spot.innerConeAngle:0,d.spot.outerConeAngle=d.spot.outerConeAngle!==void 0?d.spot.outerConeAngle:Math.PI/4,p.angle=d.spot.outerConeAngle,p.penumbra=1-d.spot.innerConeAngle/d.spot.outerConeAngle,p.target.position.set(0,0,-1),p.add(p.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+d.type)}return p.position.set(0,0,0),Uo(p,d),d.intensity!==void 0&&(p.intensity=d.intensity),p.name=t.createUniqueName(d.name||"light_"+e),i=Promise.resolve(p),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],h=(o.extensions&&o.extensions[this.name]||{}).light;return h===void 0?null:this._loadLight(h).then(function(d){return n._getNodeRef(t.cache,h,d)})}}class jI{constructor(){this.name=Dn.KHR_MATERIALS_UNLIT}getMaterialType(){return fa}extendParams(e,t,n){const i=[];e.color=new At(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const l=o.baseColorFactor;e.color.setRGB(l[0],l[1],l[2],ta),e.opacity=l[3]}o.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",o.baseColorTexture,Pi))}return Promise.all(i)}}class ZI{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class QI{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];if(l.clearcoatFactor!==void 0&&(t.clearcoat=l.clearcoatFactor),l.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),l.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),l.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),l.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),l.clearcoatNormalTexture.scale!==void 0)){const h=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new et(h,h)}return Promise.all(o)}}class $I{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.dispersion=o.dispersion!==void 0?o.dispersion:0,Promise.resolve()}}class eF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return l.iridescenceFactor!==void 0&&(t.iridescence=l.iridescenceFactor),l.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),l.iridescenceIor!==void 0&&(t.iridescenceIOR=l.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),l.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),l.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),l.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class tF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new At(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=i.extensions[this.name];if(l.sheenColorFactor!==void 0){const h=l.sheenColorFactor;t.sheenColor.setRGB(h[0],h[1],h[2],ta)}return l.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=l.sheenRoughnessFactor),l.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",l.sheenColorTexture,Pi)),l.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(o)}}class nF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return l.transmissionFactor!==void 0&&(t.transmission=l.transmissionFactor),l.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class iF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];t.thickness=l.thicknessFactor!==void 0?l.thicknessFactor:0,l.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const h=l.attenuationColor||[1,1,1];return t.attenuationColor=new At().setRGB(h[0],h[1],h[2],ta),Promise.all(o)}}class aF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class sF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];t.specularIntensity=l.specularFactor!==void 0?l.specularFactor:1,l.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",l.specularTexture));const h=l.specularColorFactor||[1,1,1];return t.specularColor=new At().setRGB(h[0],h[1],h[2],ta),l.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",l.specularColorTexture,Pi)),Promise.all(o)}}class rF{constructor(e){this.parser=e,this.name=Dn.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return t.bumpScale=l.bumpFactor!==void 0?l.bumpFactor:1,l.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class oF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return l.anisotropyStrength!==void 0&&(t.anisotropy=l.anisotropyStrength),l.anisotropyRotation!==void 0&&(t.anisotropyRotation=l.anisotropyRotation),l.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class lF{constructor(e){this.parser=e,this.name=Dn.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const o=i.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class cF{constructor(e){this.parser=e,this.name=Dn.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],h=i.images[l.source];let d=n.textureLoader;if(h.uri){const p=n.options.manager.getHandler(h.uri);p!==null&&(d=p)}return n.loadTextureImage(e,l.source,d)}}class uF{constructor(e){this.parser=e,this.name=Dn.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],h=i.images[l.source];let d=n.textureLoader;if(h.uri){const p=n.options.manager.getHandler(h.uri);p!==null&&(d=p)}return n.loadTextureImage(e,l.source,d)}}class fF{constructor(e){this.name=Dn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),l=this.parser.options.meshoptDecoder;if(!l||!l.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(h){const d=i.byteOffset||0,p=i.byteLength||0,_=i.count,v=i.byteStride,y=new Uint8Array(h,d,p);return l.decodeGltfBufferAsync?l.decodeGltfBufferAsync(_,v,y,i.mode,i.filter).then(function(x){return x.buffer}):l.ready.then(function(){const x=new ArrayBuffer(_*v);return l.decodeGltfBuffer(new Uint8Array(x),_,v,y,i.mode,i.filter),x})})}else return null}}class hF{constructor(e){this.name=Dn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const p of i.primitives)if(p.mode!==Mr.TRIANGLES&&p.mode!==Mr.TRIANGLE_STRIP&&p.mode!==Mr.TRIANGLE_FAN&&p.mode!==void 0)return null;const l=n.extensions[this.name].attributes,h=[],d={};for(const p in l)h.push(this.parser.getDependency("accessor",l[p]).then(_=>(d[p]=_,d[p])));return h.length<1?null:(h.push(this.parser.createNodeMesh(e)),Promise.all(h).then(p=>{const _=p.pop(),v=_.isGroup?_.children:[_],y=p[0].count,x=[];for(const b of v){const R=new Qt,T=new Q,M=new ba,w=new Q(1,1,1),D=new nv(b.geometry,b.material,y);for(let U=0;U<y;U++)d.TRANSLATION&&T.fromBufferAttribute(d.TRANSLATION,U),d.ROTATION&&M.fromBufferAttribute(d.ROTATION,U),d.SCALE&&w.fromBufferAttribute(d.SCALE,U),D.setMatrixAt(U,R.compose(T,M,w));for(const U in d)if(U==="_COLOR_0"){const F=d[U];D.instanceColor=new xc(F.array,F.itemSize,F.normalized)}else U!=="TRANSLATION"&&U!=="ROTATION"&&U!=="SCALE"&&b.geometry.setAttribute(U,d[U]);wn.prototype.copy.call(D,b),this.parser.assignFinalMaterial(D),x.push(D)}return _.isGroup?(_.clear(),_.add(...x),_):x[0]}))}}const aC="glTF",im=12,sC={JSON:1313821514,BIN:5130562};class dF{constructor(e){this.name=Dn.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,im),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==aC)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-im,o=new DataView(e,im);let l=0;for(;l<i;){const h=o.getUint32(l,!0);l+=4;const d=o.getUint32(l,!0);if(l+=4,d===sC.JSON){const p=new Uint8Array(e,im+l,h);this.content=n.decode(p)}else if(d===sC.BIN){const p=im+l;this.body=e.slice(p,p+h)}l+=h}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class pF{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Dn.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,o=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,h={},d={},p={};for(const _ in l){const v=OS[_]||_.toLowerCase();h[v]=l[_]}for(const _ in e.attributes){const v=OS[_]||_.toLowerCase();if(l[_]!==void 0){const y=n.accessors[e.attributes[_]],x=kh[y.componentType];p[v]=x.name,d[v]=y.normalized===!0}}return t.getDependency("bufferView",o).then(function(_){return new Promise(function(v,y){i.decodeDracoFile(_,function(x){for(const b in x.attributes){const R=x.attributes[b],T=d[b];T!==void 0&&(R.normalized=T)}v(x)},h,p,ta,y)})})}}class mF{constructor(){this.name=Dn.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class gF{constructor(){this.name=Dn.KHR_MESH_QUANTIZATION}}class rC extends Pu{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i*3+i;for(let l=0;l!==i;l++)t[l]=n[o+l];return t}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=h*2,p=h*3,_=i-t,v=(n-t)/_,y=v*v,x=y*v,b=e*p,R=b-p,T=-2*x+3*y,M=x-y,w=1-T,D=M-y+v;for(let U=0;U!==h;U++){const F=l[R+U+h],O=l[R+U+d]*_,z=l[b+U+h],k=l[b+U]*_;o[U]=w*F+D*O+T*z+M*k}return o}}const vF=new ba;class _F extends rC{interpolate_(e,t,n,i){const o=super.interpolate_(e,t,n,i);return vF.fromArray(o).normalize().toArray(o),o}}const Mr={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},kh={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},oC={9728:xi,9729:bn,9984:tp,9985:yu,9986:lc,9987:Is},lC={33071:yi,33648:_u,10497:Jr},LS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},OS={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Bc={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},yF={CUBICSPLINE:void 0,LINEAR:uc,STEP:Au},IS={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function xF(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new Fu({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:kr})),s.DefaultMaterial}function nf(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Uo(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function AF(s,e,t){let n=!1,i=!1,o=!1;for(let p=0,_=e.length;p<_;p++){const v=e[p];if(v.POSITION!==void 0&&(n=!0),v.NORMAL!==void 0&&(i=!0),v.COLOR_0!==void 0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(s);const l=[],h=[],d=[];for(let p=0,_=e.length;p<_;p++){const v=e[p];if(n){const y=v.POSITION!==void 0?t.getDependency("accessor",v.POSITION):s.attributes.position;l.push(y)}if(i){const y=v.NORMAL!==void 0?t.getDependency("accessor",v.NORMAL):s.attributes.normal;h.push(y)}if(o){const y=v.COLOR_0!==void 0?t.getDependency("accessor",v.COLOR_0):s.attributes.color;d.push(y)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(d)]).then(function(p){const _=p[0],v=p[1],y=p[2];return n&&(s.morphAttributes.position=_),i&&(s.morphAttributes.normal=v),o&&(s.morphAttributes.color=y),s.morphTargetsRelative=!0,s})}function SF(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function MF(s){let e;const t=s.extensions&&s.extensions[Dn.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+FS(t.attributes):e=s.indices+":"+FS(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+FS(s.targets[n]);return e}function FS(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function HS(s){switch(s){case Int8Array:return .007874015748031496;case Uint8Array:return .00392156862745098;case Int16Array:return 3051850947599719e-20;case Uint16Array:return 15259021896696422e-21;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function bF(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const EF=new Qt;class TF{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new KI,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,o=!1,l=-1;if(typeof navigator<"u"){const h=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(h)===!0;const d=h.match(/Version\/(\d+)/);i=n&&d?parseInt(d[1],10):-1,o=h.indexOf("Firefox")>-1,l=o?h.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||o&&l<98?this.textureLoader=new uA(this.options.manager):this.textureLoader=new mA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ha(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(l){return l._markDefs&&l._markDefs()}),Promise.all(this._invokeAll(function(l){return l.beforeRoot&&l.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(l){const h={scene:l[0][i.scene||0],scenes:l[0],animations:l[1],cameras:l[2],asset:i.asset,parser:n,userData:{}};return nf(o,h,i),Uo(h,i),Promise.all(n._invokeAll(function(d){return d.afterRoot&&d.afterRoot(h)})).then(function(){for(const d of h.scenes)d.updateMatrixWorld();e(h)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,o=t.length;i<o;i++){const l=t[i].joints;for(let h=0,d=l.length;h<d;h++)e[l[h]].isBone=!0}for(let i=0,o=e.length;i<o;i++){const l=e[i];l.mesh!==void 0&&(this._addNodeRef(this.meshCache,l.mesh),l.skin!==void 0&&(n[l.mesh].isSkinnedMesh=!0)),l.camera!==void 0&&this._addNodeRef(this.cameraCache,l.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),o=(l,h)=>{const d=this.associations.get(l);d!=null&&this.associations.set(h,d);for(const[p,_]of l.children.entries())o(_,h.children[p])};return o(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const o=e(t[i]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":i=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(o,l){return n.getDependency(e,l)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Dn.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(o,l){n.load(nr.resolveURL(t.uri,i.path),o,void 0,function(){l(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const l=LS[i.type],h=kh[i.componentType],d=i.normalized===!0,p=new h(i.count*l);return Promise.resolve(new Ln(p,l,d))}const o=[];return i.bufferView!==void 0?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),i.sparse!==void 0&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then(function(l){const h=l[0],d=LS[i.type],p=kh[i.componentType],_=p.BYTES_PER_ELEMENT,v=_*d,y=i.byteOffset||0,x=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,b=i.normalized===!0;let R,T;if(x&&x!==v){const M=Math.floor(y/x),w="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+M+":"+i.count;let D=t.cache.get(w);D||(R=new p(h,M*x,i.count*x/_),D=new yh(R,x/_),t.cache.add(w,D)),T=new xl(D,d,y%x/_,b)}else h===null?R=new p(i.count*d):R=new p(h,y,i.count*d),T=new Ln(R,d,b);if(i.sparse!==void 0){const M=LS.SCALAR,w=kh[i.sparse.indices.componentType],D=i.sparse.indices.byteOffset||0,U=i.sparse.values.byteOffset||0,F=new w(l[1],D,i.sparse.count*M),O=new p(l[2],U,i.sparse.count*d);h!==null&&(T=new Ln(T.array.slice(),T.itemSize,T.normalized)),T.normalized=!1;for(let z=0,k=F.length;z<k;z++){const N=F[z];if(T.setX(N,O[z*d]),d>=2&&T.setY(N,O[z*d+1]),d>=3&&T.setZ(N,O[z*d+2]),d>=4&&T.setW(N,O[z*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}T.normalized=b}return T})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,l=t.images[o];let h=this.textureLoader;if(l.uri){const d=n.manager.getHandler(l.uri);d!==null&&(h=d)}return this.loadTextureImage(e,o,h)}loadTextureImage(e,t,n){const i=this,o=this.json,l=o.textures[e],h=o.images[t],d=(h.uri||h.bufferView)+":"+l.sampler;if(this.textureCache[d])return this.textureCache[d];const p=this.loadImageSource(t,n).then(function(_){_.flipY=!1,_.name=l.name||h.name||"",_.name===""&&typeof h.uri=="string"&&h.uri.startsWith("data:image/")===!1&&(_.name=h.uri);const y=(o.samplers||{})[l.sampler]||{};return _.magFilter=oC[y.magFilter]||bn,_.minFilter=oC[y.minFilter]||Is,_.wrapS=lC[y.wrapS]||Jr,_.wrapT=lC[y.wrapT]||Jr,_.generateMipmaps=!_.isCompressedTexture&&_.minFilter!==xi&&_.minFilter!==bn,i.associations.set(_,{textures:e}),_}).catch(function(){return null});return this.textureCache[d]=p,p}loadImageSource(e,t){const n=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(v=>v.clone());const l=i.images[e],h=self.URL||self.webkitURL;let d=l.uri||"",p=!1;if(l.bufferView!==void 0)d=n.getDependency("bufferView",l.bufferView).then(function(v){p=!0;const y=new Blob([v],{type:l.mimeType});return d=h.createObjectURL(y),d});else if(l.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const _=Promise.resolve(d).then(function(v){return new Promise(function(y,x){let b=y;t.isImageBitmapLoader===!0&&(b=function(R){const T=new qn(R);T.needsUpdate=!0,y(T)}),t.load(nr.resolveURL(v,o.path),b,void 0,x)})}).then(function(v){return p===!0&&h.revokeObjectURL(d),Uo(v,l),v.userData.mimeType=l.mimeType||bF(l.uri),v}).catch(function(v){throw console.error("THREE.GLTFLoader: Couldn't load texture",d),v});return this.sourceCache[e]=_,_}assignTexture(e,t,n,i){const o=this;return this.getDependency("texture",n.index).then(function(l){if(!l)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(l=l.clone(),l.channel=n.texCoord),o.extensions[Dn.KHR_TEXTURE_TRANSFORM]){const h=n.extensions!==void 0?n.extensions[Dn.KHR_TEXTURE_TRANSFORM]:void 0;if(h){const d=o.associations.get(l);l=o.extensions[Dn.KHR_TEXTURE_TRANSFORM].extendTexture(l,h),o.associations.set(l,d)}}return i!==void 0&&(l.colorSpace=i),e[t]=l,l})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,l=t.attributes.normal===void 0;if(e.isPoints){const h="PointsMaterial:"+n.uuid;let d=this.cache.get(h);d||(d=new Up,Gi.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,d.sizeAttenuation=!1,this.cache.add(h,d)),n=d}else if(e.isLine){const h="LineBasicMaterial:"+n.uuid;let d=this.cache.get(h);d||(d=new Pa,Gi.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,this.cache.add(h,d)),n=d}if(i||o||l){let h="ClonedMaterial:"+n.uuid+":";i&&(h+="derivative-tangents:"),o&&(h+="vertex-colors:"),l&&(h+="flat-shading:");let d=this.cache.get(h);d||(d=n.clone(),o&&(d.vertexColors=!0),l&&(d.flatShading=!0),i&&(d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(h,d),this.associations.set(d,this.associations.get(n))),n=d}e.material=n}getMaterialType(){return Fu}loadMaterial(e){const t=this,n=this.json,i=this.extensions,o=n.materials[e];let l;const h={},d=o.extensions||{},p=[];if(d[Dn.KHR_MATERIALS_UNLIT]){const v=i[Dn.KHR_MATERIALS_UNLIT];l=v.getMaterialType(),p.push(v.extendParams(h,o,t))}else{const v=o.pbrMetallicRoughness||{};if(h.color=new At(1,1,1),h.opacity=1,Array.isArray(v.baseColorFactor)){const y=v.baseColorFactor;h.color.setRGB(y[0],y[1],y[2],ta),h.opacity=y[3]}v.baseColorTexture!==void 0&&p.push(t.assignTexture(h,"map",v.baseColorTexture,Pi)),h.metalness=v.metallicFactor!==void 0?v.metallicFactor:1,h.roughness=v.roughnessFactor!==void 0?v.roughnessFactor:1,v.metallicRoughnessTexture!==void 0&&(p.push(t.assignTexture(h,"metalnessMap",v.metallicRoughnessTexture)),p.push(t.assignTexture(h,"roughnessMap",v.metallicRoughnessTexture))),l=this._invokeOne(function(y){return y.getMaterialType&&y.getMaterialType(e)}),p.push(Promise.all(this._invokeAll(function(y){return y.extendMaterialParams&&y.extendMaterialParams(e,h)})))}o.doubleSided===!0&&(h.side=Ws);const _=o.alphaMode||IS.OPAQUE;if(_===IS.BLEND?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,_===IS.MASK&&(h.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&l!==fa&&(p.push(t.assignTexture(h,"normalMap",o.normalTexture)),h.normalScale=new et(1,1),o.normalTexture.scale!==void 0)){const v=o.normalTexture.scale;h.normalScale.set(v,v)}if(o.occlusionTexture!==void 0&&l!==fa&&(p.push(t.assignTexture(h,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(h.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&l!==fa){const v=o.emissiveFactor;h.emissive=new At().setRGB(v[0],v[1],v[2],ta)}return o.emissiveTexture!==void 0&&l!==fa&&p.push(t.assignTexture(h,"emissiveMap",o.emissiveTexture,Pi)),Promise.all(p).then(function(){const v=new l(h);return o.name&&(v.name=o.name),Uo(v,o),t.associations.set(v,{materials:e}),o.extensions&&nf(i,v,o),v})}createUniqueName(e){const t=Hn.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function o(h){return n[Dn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h,t).then(function(d){return cC(d,h,t)})}const l=[];for(let h=0,d=e.length;h<d;h++){const p=e[h],_=MF(p),v=i[_];if(v)l.push(v.promise);else{let y;p.extensions&&p.extensions[Dn.KHR_DRACO_MESH_COMPRESSION]?y=o(p):y=cC(new on,p,t),i[_]={primitive:p,promise:y},l.push(y)}}return Promise.all(l)}loadMesh(e){const t=this,n=this.json,i=this.extensions,o=n.meshes[e],l=o.primitives,h=[];for(let d=0,p=l.length;d<p;d++){const _=l[d].material===void 0?xF(this.cache):this.getDependency("material",l[d].material);h.push(_)}return h.push(t.loadGeometries(l)),Promise.all(h).then(function(d){const p=d.slice(0,d.length-1),_=d[d.length-1],v=[];for(let x=0,b=_.length;x<b;x++){const R=_[x],T=l[x];let M;const w=p[x];if(T.mode===Mr.TRIANGLES||T.mode===Mr.TRIANGLE_STRIP||T.mode===Mr.TRIANGLE_FAN||T.mode===void 0)M=o.isSkinnedMesh===!0?new ev(R,w):new pi(R,w),M.isSkinnedMesh===!0&&M.normalizeSkinWeights(),T.mode===Mr.TRIANGLE_STRIP?M.geometry=iC(M.geometry,fp):T.mode===Mr.TRIANGLE_FAN&&(M.geometry=iC(M.geometry,bu));else if(T.mode===Mr.LINES)M=new yr(R,w);else if(T.mode===Mr.LINE_STRIP)M=new Ro(R,w);else if(T.mode===Mr.LINE_LOOP)M=new fv(R,w);else if(T.mode===Mr.POINTS)M=new pv(R,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+T.mode);Object.keys(M.geometry.morphAttributes).length>0&&SF(M,o),M.name=t.createUniqueName(o.name||"mesh_"+e),Uo(M,o),T.extensions&&nf(i,M,T),t.assignFinalMaterial(M),v.push(M)}for(let x=0,b=v.length;x<b;x++)t.associations.set(v[x],{meshes:e,primitives:x});if(v.length===1)return o.extensions&&nf(i,v[0],o),v[0];const y=new vr;o.extensions&&nf(i,y,o),t.associations.set(y,{meshes:e});for(let x=0,b=v.length;x<b;x++)y.add(v[x]);return y})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new ia(E0.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new El(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Uo(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,o=t.joints.length;i<o;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const o=i.pop(),l=i,h=[],d=[];for(let p=0,_=l.length;p<_;p++){const v=l[p];if(v){h.push(v);const y=new Qt;o!==null&&y.fromArray(o.array,p*16),d.push(y)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[p])}return new bh(h,d)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],o=i.name?i.name:"animation_"+e,l=[],h=[],d=[],p=[],_=[];for(let v=0,y=i.channels.length;v<y;v++){const x=i.channels[v],b=i.samplers[x.sampler],R=x.target,T=R.node,M=i.parameters!==void 0?i.parameters[b.input]:b.input,w=i.parameters!==void 0?i.parameters[b.output]:b.output;R.node!==void 0&&(l.push(this.getDependency("node",T)),h.push(this.getDependency("accessor",M)),d.push(this.getDependency("accessor",w)),p.push(b),_.push(R))}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(d),Promise.all(p),Promise.all(_)]).then(function(v){const y=v[0],x=v[1],b=v[2],R=v[3],T=v[4],M=[];for(let D=0,U=y.length;D<U;D++){const F=y[D],O=x[D],z=b[D],k=R[D],N=T[D];if(F===void 0)continue;F.updateMatrix&&F.updateMatrix();const I=n._createAnimationTracks(F,O,z,k,N);if(I)for(let W=0;W<I.length;W++)M.push(I[W])}const w=new Vu(o,void 0,M);return Uo(w,i),w})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(o){const l=n._getNodeRef(n.meshCache,i.mesh,o);return i.weights!==void 0&&l.traverse(function(h){if(h.isMesh)for(let d=0,p=i.weights.length;d<p;d++)h.morphTargetInfluences[d]=i.weights[d]}),l})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],o=n._loadNodeShallow(e),l=[],h=i.children||[];for(let p=0,_=h.length;p<_;p++)l.push(n.getDependency("node",h[p]));const d=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([o,Promise.all(l),d]).then(function(p){const _=p[0],v=p[1],y=p[2];y!==null&&_.traverse(function(x){x.isSkinnedMesh&&x.bind(y,EF)});for(let x=0,b=v.length;x<b;x++)_.add(v[x]);return _})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],l=o.name?i.createUniqueName(o.name):"",h=[],d=i._invokeOne(function(p){return p.createNodeMesh&&p.createNodeMesh(e)});return d&&h.push(d),o.camera!==void 0&&h.push(i.getDependency("camera",o.camera).then(function(p){return i._getNodeRef(i.cameraCache,o.camera,p)})),i._invokeAll(function(p){return p.createNodeAttachment&&p.createNodeAttachment(e)}).forEach(function(p){h.push(p)}),this.nodeCache[e]=Promise.all(h).then(function(p){let _;if(o.isBone===!0?_=new Cp:p.length>1?_=new vr:p.length===1?_=p[0]:_=new wn,_!==p[0])for(let v=0,y=p.length;v<y;v++)_.add(p[v]);if(o.name&&(_.userData.name=o.name,_.name=l),Uo(_,o),o.extensions&&nf(n,_,o),o.matrix!==void 0){const v=new Qt;v.fromArray(o.matrix),_.applyMatrix4(v)}else o.translation!==void 0&&_.position.fromArray(o.translation),o.rotation!==void 0&&_.quaternion.fromArray(o.rotation),o.scale!==void 0&&_.scale.fromArray(o.scale);if(!i.associations.has(_))i.associations.set(_,{});else if(o.mesh!==void 0&&i.meshCache.refs[o.mesh]>1){const v=i.associations.get(_);i.associations.set(_,{...v})}return i.associations.get(_).nodes=e,_}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,o=new vr;n.name&&(o.name=i.createUniqueName(n.name)),Uo(o,n),n.extensions&&nf(t,o,n);const l=n.nodes||[],h=[];for(let d=0,p=l.length;d<p;d++)h.push(i.getDependency("node",l[d]));return Promise.all(h).then(function(d){for(let _=0,v=d.length;_<v;_++)o.add(d[_]);const p=_=>{const v=new Map;for(const[y,x]of i.associations)(y instanceof Gi||y instanceof qn)&&v.set(y,x);return _.traverse(y=>{const x=i.associations.get(y);x!=null&&v.set(y,x)}),v};return i.associations=p(o),o})}_createAnimationTracks(e,t,n,i,o){const l=[],h=e.name?e.name:e.uuid,d=[];Bc[o.path]===Bc.weights?e.traverse(function(y){y.morphTargetInfluences&&d.push(y.name?y.name:y.uuid)}):d.push(h);let p;switch(Bc[o.path]){case Bc.weights:p=Al;break;case Bc.rotation:p=Sl;break;case Bc.translation:case Bc.scale:p=Ml;break;default:n.itemSize===1?p=Al:p=Ml;break}const _=i.interpolation!==void 0?yF[i.interpolation]:uc,v=this._getArrayFromAccessor(n);for(let y=0,x=d.length;y<x;y++){const b=new p(d[y]+"."+Bc[o.path],t.array,v,_);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(b),l.push(b)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=HS(t.constructor),i=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o++)i[o]=t[o]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof Sl?_F:rC;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function CF(s,e,t){const n=e.attributes,i=new Ea;if(n.POSITION!==void 0){const h=t.json.accessors[n.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(i.set(new Q(d[0],d[1],d[2]),new Q(p[0],p[1],p[2])),h.normalized){const _=HS(kh[h.componentType]);i.min.multiplyScalar(_),i.max.multiplyScalar(_)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const h=new Q,d=new Q;for(let p=0,_=o.length;p<_;p++){const v=o[p];if(v.POSITION!==void 0){const y=t.json.accessors[v.POSITION],x=y.min,b=y.max;if(x!==void 0&&b!==void 0){if(d.setX(Math.max(Math.abs(x[0]),Math.abs(b[0]))),d.setY(Math.max(Math.abs(x[1]),Math.abs(b[1]))),d.setZ(Math.max(Math.abs(x[2]),Math.abs(b[2]))),y.normalized){const R=HS(kh[y.componentType]);d.multiplyScalar(R)}h.max(d)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(h)}s.boundingBox=i;const l=new ua;i.getCenter(l.center),l.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=l}function cC(s,e,t){const n=e.attributes,i=[];function o(l,h){return t.getDependency("accessor",l).then(function(d){s.setAttribute(h,d)})}for(const l in n){const h=OS[l]||l.toLowerCase();h in s.attributes||i.push(o(n[l],h))}if(e.indices!==void 0&&!s.index){const l=t.getDependency("accessor",e.indices).then(function(h){s.setIndex(h)});i.push(l)}return Tn.workingColorSpace!==ta&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Tn.workingColorSpace}" not supported.`),Uo(s,e),CF(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?AF(s,e.targets,t):s})}const $a=(...s)=>{},RF=(...s)=>{},uC=({analyser:s})=>{const e=Ee.useRef(null),t=Ee.useRef(null);return Ee.useEffect(()=>{const n=e.current;if(!n)return;const i=n.getContext("2d",{alpha:!0});if(!i)return;let o,l=null;s&&(s.fftSize=128,l=new Uint8Array(s.frequencyBinCount));const h=()=>{o=requestAnimationFrame(h),(n.width!==n.offsetWidth||n.height!==n.offsetHeight)&&(n.width=n.offsetWidth,n.height=n.offsetHeight);const d=n.width,p=n.height;if(d===0||p===0)return;const _=p/2;i.clearRect(0,0,d,p),i.fillStyle="#1e293b";const v=2,x=v+2,b=d*.95,R=Math.floor(b/x);(!t.current||t.current.length!==R)&&(t.current=new Float32Array(R).fill(2));const T=R*x,M=(d-T)/2;s&&l&&s.getByteFrequencyData(l);const w=l?l.length:0,U=Math.floor(w*.7)/R,F=new Float32Array(R);for(let O=0;O<R;O++){let z=0;if(l&&U>0){const I=Math.floor(O*U),W=Math.floor((O+1)*U);for(let ae=I;ae<W;ae++){const ie=l[ae]||0;ie>z&&(z=ie)}}z<10&&(z=0);const k=z/255,N=z>0?Math.max(2,Math.pow(k,1.4)*p*.25):2;F[O]=N}for(let O=0;O<R;O++){const z=R-1-O,k=Math.max(F[O],F[z]),N=t.current[O]+(k-t.current[O])*.3;t.current[O]=N;const I=M+O*x,W=_-N/2;i.beginPath(),i.roundRect?i.roundRect(I,W,v,N,4):i.fillRect(I,W,v,N),i.fill()}};return h(),()=>{cancelAnimationFrame(o)}},[s]),Pt.jsx("canvas",{ref:e,style:{width:"100%",height:"100%",display:"block"}})},fC="https://ai.streamoji.com",wF="https://pub-48df6f7d60d6440bbd01676ea5d90e55.r2.dev",hC="https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/default-models/fullbodyavatarmale.glb";async function BF(s){const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(s));return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}function DF(s){const[e,t]=Ee.useState(null);return Ee.useEffect(()=>{if(!s){t(null);return}let n=!1;return BF(s).then(i=>{if(n)return;const o=`${wF}/${i}.glb`;fetch(o,{method:"HEAD"}).then(l=>{n||t(l.ok?o:hC)}).catch(()=>{n||t(hC)})}),()=>{n=!0}},[s]),e}const UF=["https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_001.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_002.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_002.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_005.glb"],NF=[{id:"m_expr_01",name:"Friendly Wave",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_001.glb"},{id:"m_expr_02",name:"You There",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_002.glb"},{id:"m_expr_04",name:"Awkward Agreement",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_004.glb"},{id:"m_expr_05",name:"What's Going On?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_005.glb"},{id:"m_expr_06",name:"Tired Stretch",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_006.glb"},{id:"m_expr_07",name:"Conceilied Laughter",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_007.glb"},{id:"m_expr_08",name:"You Come Here",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_008.glb"},{id:"m_expr_09",name:"Come Here Kid",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_009.glb"},{id:"m_expr_10",name:"Come Here Everyone",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_010.glb"},{id:"m_expr_11",name:"No Freaking Way",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_011.glb"},{id:"m_expr_12",name:"Cheerful Approval",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_012.glb"},{id:"m_expr_13",name:"Waving Hello",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_013.glb"},{id:"m_expr_14",name:"Checking Surroundings",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_014.glb"},{id:"m_expr_15",name:"Referee Warning",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_015.glb"},{id:"m_expr_16",name:"You Thumbs Down",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_016.glb"},{id:"m_expr_17",name:"Side Thumbs Down",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_017.glb"},{id:"m_expr_18",name:"You're Finished",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_018.glb"},{id:"m_talk_01",name:"Oh God, Why Me?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_001.glb"},{id:"m_talk_02",name:"What Are You Doing?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_002.glb"},{id:"m_talk_03",name:"What Am I doing?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_003.glb"},{id:"m_talk_04",name:"No Way",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_004.glb"},{id:"m_talk_05",name:"What's Going On?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_005.glb"},{id:"m_talk_06",name:"I have no idea",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_006.glb"},{id:"m_talk_07",name:"What's going on here?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_007.glb"},{id:"m_talk_08",name:"Let's stop",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_008.glb"},{id:"m_talk_09",name:"Fed Up Moment",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_009.glb"},{id:"m_talk_10",name:"What's This? Hold On",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_010.glb"},{id:"f_talk_01",name:"Great Job Clap",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_001.glb"},{id:"f_talk_02",name:"Chill Stretch",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_002.glb"},{id:"f_talk_03",name:"This Is Me",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_003.glb"},{id:"f_talk_04",name:"Empathize",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_004.glb"},{id:"f_talk_05",name:"Loose Hands Stretch",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_005.glb"},{id:"f_talk_06",name:"Take It Easy",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_006.glb"}],LF=["https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_005.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_007.glb"],OF={zoom:.85,position:[.15,-.8,0],scale:1.5,rotation:[.15,.02,0]},IF=[-.45,1.9,.1],FF={browInnerUp:.2},PS=.18,HF=1,m_={neutral:{eyeLookDownLeft:.1,eyeLookDownRight:.1},happy:{mouthSmileLeft:.2,mouthSmileRight:.2,eyeLookDownLeft:.1,eyeLookDownRight:.1},sad:{eyeLookDownLeft:.2,eyeLookDownRight:.2,browDownRight:.1,browInnerUp:.6,browOuterUpRight:.2,eyeSquintLeft:.7,eyeSquintRight:.7,mouthFrownLeft:.8,mouthFrownRight:.8,mouthLeft:.2,mouthPucker:.5,mouthRollLower:.2,mouthRollUpper:.2,mouthShrugLower:.2,mouthShrugUpper:.2,mouthStretchLeft:.4},angry:{eyeLookDownLeft:.1,eyeLookDownRight:.1,browDownLeft:.6,browDownRight:.6,jawForward:.3,mouthFrownLeft:.7,mouthFrownRight:.7,mouthRollLower:.2,mouthShrugLower:.3},fear:{browInnerUp:.7,eyeSquintLeft:.5,eyeSquintRight:.5,eyeWideLeft:.6,eyeWideRight:.6,mouthClose:.1,mouthFunnel:.3,mouthShrugLower:.5,mouthShrugUpper:.5},disgust:{browDownLeft:.7,browDownRight:.1,browInnerUp:.3,eyeSquintLeft:1,eyeSquintRight:1,eyeWideLeft:.5,eyeWideRight:.5,mouthLeft:.4,mouthPressLeft:.3,mouthRollLower:.3,mouthShrugLower:.3,mouthShrugUpper:.8,mouthUpperUpLeft:.3,noseSneerLeft:1,noseSneerRight:.7},love:{browInnerUp:.4,browOuterUpLeft:.2,browOuterUpRight:.2,mouthSmileLeft:.2,mouthSmileRight:.2,eyeBlinkLeft:.6,eyeBlinkRight:.6,eyeWideLeft:.7,eyeWideRight:.7,mouthDimpleLeft:.1,mouthDimpleRight:.1,mouthPressLeft:.2,mouthShrugUpper:.2,mouthUpperUpLeft:.1,mouthUpperUpRight:.1}},PF=[{key:"viseme_aa",mix:{jawOpen:.6}},{key:"viseme_E",mix:{mouthPressLeft:.8,mouthPressRight:.8,mouthDimpleLeft:1,mouthDimpleRight:1,jawOpen:.3}},{key:"viseme_I",mix:{mouthPressLeft:.6,mouthPressRight:.6,mouthDimpleLeft:.6,mouthDimpleRight:.6,jawOpen:.2}},{key:"viseme_O",mix:{mouthPucker:1,jawForward:.6,jawOpen:.2}},{key:"viseme_U",mix:{mouthFunnel:1}},{key:"viseme_PP",mix:{mouthRollLower:.3,mouthRollUpper:.3,mouthUpperUpLeft:.3,mouthUpperUpRight:.3}},{key:"viseme_FF",mix:{mouthPucker:1,mouthShrugUpper:1,mouthLowerDownLeft:.2,mouthLowerDownRight:.2,mouthDimpleLeft:1,mouthDimpleRight:1,mouthRollLower:.3}},{key:"viseme_DD",mix:{mouthPressLeft:.8,mouthPressRight:.8,mouthFunnel:.5,jawOpen:.2}},{key:"viseme_SS",mix:{mouthPressLeft:.8,mouthPressRight:.8,mouthLowerDownLeft:.5,mouthLowerDownRight:.5,jawOpen:.1}},{key:"viseme_TH",mix:{mouthRollUpper:.3,jawOpen:.2,tongueOut:.4}},{key:"viseme_CH",mix:{mouthPucker:.5,jawOpen:.2}},{key:"viseme_RR",mix:{mouthPucker:.5,jawOpen:.2}},{key:"viseme_kk",mix:{mouthLowerDownLeft:.4,mouthLowerDownRight:.4,mouthDimpleLeft:.3,mouthDimpleRight:.3,mouthFunnel:.3,mouthPucker:.3,jawOpen:.15}},{key:"viseme_nn",mix:{mouthLowerDownLeft:.4,mouthLowerDownRight:.4,mouthDimpleLeft:.3,mouthDimpleRight:.3,mouthFunnel:.3,mouthPucker:.3,jawOpen:.15,tongueOut:.2}},{key:"viseme_sil",mix:{}}],GF={aei:[{v:"E",w:.8},{v:"I",w:.2}],ee:[{v:"I",w:1}],oo:[{v:"O",w:1}],u:[{v:"U",w:1}],aa:[{v:"aa",w:1}],ah:[{v:"aa",w:.7},{v:"O",w:.3}],bmp:[{v:"PP",w:1}],fv:[{v:"FF",w:1}],th:[{v:"TH",w:1}],l:[{v:"nn",w:1}],r:[{v:"RR",w:1}],qw:[{v:"U",w:.6},{v:"O",w:.4}],chjsh:[{v:"CH",w:1}],cdgknstxyz:[{v:"DD",w:.6},{v:"SS",w:.4}],sil:[{v:"sil",w:1}]};function zF(s){if(!s)return[{v:"sil",w:1}];const e=s.toLowerCase();return GF[e]??[{v:"sil",w:1}]}function VF({target:s}){const{camera:e}=Ih();return Ee.useEffect(()=>{e.lookAt(...s)},[e,s]),null}function Gs(s,e,t){if(!s||!s.morphTargetDictionary)return;const n=s,i=n.morphTargetDictionary,o=n.morphTargetInfluences;if(o)for(const l in i)l.toLowerCase()===e.toLowerCase()&&(o[i[l]]=t)}function dC(s,e=.97){if(!s)return;const t=s;if(t.morphTargetInfluences)for(let n=0;n<t.morphTargetInfluences.length;n++)t.morphTargetInfluences[n]*=e}const kF=Ee.memo(({avatarUrl:s,isPlayingRef:e,visemeQueueRef:t,audioContextRef:n,responseAudioStartTimeRef:i,adjustments:o,mood:l,expression:h,agentResponse:d,isSpeaking:p,nextStartTimeRef:_,stopPlayback:v,setIsSpeaking:y,expressionUrl:x,onExpressionFinished:b})=>{const{scene:R}=zh(s),T=zh(UF),M=Ee.useMemo(()=>T.flatMap($=>$.animations),[T]),w=zh(LF),D=Ee.useMemo(()=>w.flatMap($=>$.animations),[w]),U=Ee.useRef(null),F=Ee.useRef(null),O=Ee.useRef(null),z=Ee.useRef([]),[k]=Ee.useState(()=>new nE(R)),N=Ee.useRef({}),I=Ee.useRef(null),W=Ee.useRef(0),ae=Ee.useRef(!1),ie=Ee.useRef(0),se=Ee.useRef(null);Ee.useEffect(()=>{if(!(!M||!R)){if(M.forEach(($,ue)=>{const re=`idle_${ue}`;if(!N.current[re]){const X=k.clipAction($,R);X.name=re,X.setLoop(cp,1),X.clampWhenFinished=!0,N.current[re]=X}}),D.forEach(($,ue)=>{const re=`talk_${ue}`;if(!N.current[re]){const X=k.clipAction($,R);X.name=re,X.setLoop(cp,1),X.clampWhenFinished=!0,N.current[re]=X}}),M.length>0){const $=N.current.idle_0,ue=I.current&&k.existingAction(I.current.getClip());$&&!ue&&($.reset().fadeIn(.5).play(),I.current=$)}return()=>{k.stopAllAction(),N.current={},I.current=null}}},[M,D,R,k]);const _e=Ee.useRef("");Ee.useEffect(()=>{if(!x||!R||x===_e.current)return;_e.current=x,se.current=x,new qI().load(x,ue=>{if(ue.animations&&ue.animations.length>0){const re=ue.animations[0],X=k.clipAction(re,R);if(X.name=`EXPR_${x}`,X.setLoop(cp,1),X.clampWhenFinished=!0,N.current[`EXPR_${x}`]=X,p&&se.current===x){const ne=I.current;X.reset().fadeIn(.3).play(),ne&&ne!==X&&ne.crossFadeTo(X,.3,!0),I.current=X,se.current=null}}},void 0,ue=>{console.error(`[ANIMATION] Failed to load ${x}`,ue)})},[x,R,k,p]),Ee.useEffect(()=>{const $=ue=>{const re=ue.action,X=re.name||"";if(X.startsWith("idle_")){const Ae=(parseInt(X.split("_")[1])+1)%M.length,Re=N.current[`idle_${Ae}`];Re&&(Re.reset().fadeIn(.5).play(),re.crossFadeTo(Re,.5,!0),I.current=Re)}else if(X.startsWith("EXPR_")){if(p){const ne=N.current.talk_0;ne&&(ne.reset().fadeIn(.5).play(),re.crossFadeTo(ne,.5,!0),I.current=ne)}else{const ne=N.current.idle_0;ne&&(ne.reset().fadeIn(.5).play(),re.crossFadeTo(ne,.5,!0),I.current=ne)}b&&b()}else if(X.startsWith("talk_"))if(p){const Ae=(parseInt(X.split("_")[1])+1)%D.length,Re=N.current[`talk_${Ae}`];Re&&(Re.reset().fadeIn(.3).play(),re.crossFadeTo(Re,.3,!0),I.current=Re)}else{const ne=N.current.idle_0;ne&&(ne.reset().fadeIn(.5).play(),re.crossFadeTo(ne,.5,!0),I.current=ne)}};return k.addEventListener("finished",$),()=>k.removeEventListener("finished",$)},[k,M,D,p,b]),Ee.useEffect(()=>{if(p&&R){const $=I.current,ue=$?.name||"";if(ue.startsWith("idle_")||ue.startsWith("talk_")||ue===""){const re=se.current;if(re){const X=N.current[`EXPR_${re}`];if(X){X.reset().fadeIn(.3).play(),$&&$!==X&&$.crossFadeTo(X,.3,!0),I.current=X,se.current=null;return}}if(ue.startsWith("idle_")||ue===""){const X=N.current.talk_0;X&&(X.reset().fadeIn(.5).play(),$&&$.crossFadeTo(X,.5,!0),I.current=X)}}}else if(!p&&R){const $=I.current,ue=$?.name||"";if(ue.startsWith("talk_")||ue.startsWith("EXPR_")){const re=N.current.idle_0;re&&(re.reset().fadeIn(.5).play(),$&&$.crossFadeTo(re,.5,!0),I.current=re)}}},[p,R,x]),Ee.useEffect(()=>{if(!R)return;R.traverse(re=>{if(re.isMesh&&re.morphTargetDictionary){const X=re.name.toLowerCase();(X.includes("head")||X.includes("avatar"))&&(F.current=re,$a(`[ANIMATION] Found head mesh: ${re.name}`)),X.includes("teeth")&&(O.current=re,$a(`[ANIMATION] Found teeth mesh: ${re.name}`))}});const $=F.current?.morphTargetDictionary;$&&Object.keys($).filter(re=>re.toLowerCase().includes("brow"));const ue=[];R.traverse(re=>{if(re.isMesh){const ne=re.morphTargetDictionary;ne&&Object.keys(ne).some(Ae=>Ae.toLowerCase().includes("brow"))&&ue.push(re)}}),z.current=ue,ue.length>0&&$a("[ANIMATION] Meshes with brow morphs:",ue.length)},[R]);const H=($,ue=1)=>{const re=`viseme_${$}`.toLowerCase(),X=PF.find(ne=>ne.key.toLowerCase()===re);if(X)for(const ne in X.mix){const Ae=X.mix[ne]*ue;Gs(F.current,ne,Ae),Gs(O.current,ne,Ae)}},K=$=>{const ue=m_[$]??m_.neutral;for(const re in ue)Gs(F.current,re,ue[re]),Gs(O.current,re,ue[re])};return _T(($,ue)=>{const re=Math.pow(.88,60*ue);dC(F.current,re),dC(O.current,re),K(l);const X=$.clock.elapsedTime;let ne=0;if(Math.floor(X)%5===0&&Math.floor((X-ue)%5)!==0){let Ge=null;R.traverse(ee=>{ee.name.toLowerCase().includes("hips")&&(Ge=ee)});const ft=Ge?`Hips Y: ${Ge.position.y.toFixed(4)}`:"Hips not found";$a(`[ANIMATION] Mixer Time: ${k.time.toFixed(2)}, ${ft}`)}if(k.update(ue),X>W.current&&!ae.current&&(ae.current=!0,ie.current=X),ae.current){const ft=(X-ie.current)/.3;if(ft>=1)ae.current=!1,W.current=X+2+Math.random()*5;else{const ee=ft<.5?ft*2:(1-ft)*2;Gs(F.current,"eyeBlinkLeft",ee),Gs(F.current,"eyeBlinkRight",ee),Gs(O.current,"eyeBlinkLeft",ee),Gs(O.current,"eyeBlinkRight",ee),ne=ee*FF.browInnerUp}}const Ae=m_[l]??m_.neutral,Re=Ae.browInnerUp??0,rt=Ae.browOuterUpLeft??0,ve=Ae.browOuterUpRight??0,Be=X*HF,st=PS*Math.sin(Be),xt=PS*.7*Math.sin(Be+.7),Mt=PS*.7*Math.sin(Be+1.3),$t=Ge=>Math.max(0,Math.min(1,Ge)),un=$t(Re+st),Vt=$t(rt+xt),Ve=$t(ve+Mt),nt=$t(un+ne);if(Gs(F.current,"browInnerUp",nt),Gs(O.current,"browInnerUp",nt),Gs(F.current,"browOuterUpLeft",Vt),Gs(O.current,"browOuterUpLeft",Vt),Gs(F.current,"browOuterUpRight",Ve),Gs(O.current,"browOuterUpRight",Ve),U.current){const Ge=e.current?0:o.rotation[1];U.current.rotation.y=E0.lerp(U.current.rotation.y,Ge,.1),U.current.position.set(...o.position),U.current.scale.setScalar(o.scale),U.current.rotation.x=o.rotation[0],U.current.rotation.z=o.rotation[2]}if(e.current&&n.current){const Ge=n.current.currentTime,Nt=(Ge-i.current)*1e3- -150;for(let pt=0;pt<t.current.length;pt++){const Lt=t.current[pt];Nt>=Lt.vtime&&Nt<Lt.vtime+Lt.vduration&&H(Lt.viseme,Lt.weight??1)}Ge>_.current+.5&&(v(),y(!1))}}),Pt.jsx("group",{ref:U,children:Pt.jsx("primitive",{object:R})})});function XF(s){return s?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():""}const YF=({token:s,agentToken:e,onNavigationRequested:t}={})=>{const n=s??e??"",i=DF(n||void 0),[o,l]=Ee.useState(""),[h,d]=Ee.useState(""),[p,_]=Ee.useState("Ready"),[v,y]=Ee.useState(!1),[x,b]=Ee.useState(!1),[R,T]=Ee.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 480px)").matches:!1);Ee.useEffect(()=>{const j=window.matchMedia("(max-width: 480px)"),de=()=>T(j.matches);return j.addEventListener("change",de),()=>j.removeEventListener("change",de)},[]);const M=R?80:600,w=Ee.useRef(!1),D=Ee.useRef([]),U=Ee.useRef(0),F=Ee.useRef(!1),O=Ee.useRef([]),z=Ee.useRef(null),k=Ee.useRef([]);Ee.useRef([]);const N=Ee.useRef([]),I=Ee.useRef(0),W=Ee.useRef(0),ae=Ee.useRef(0),ie=Ee.useRef(0),se=Ee.useRef(!1),[_e,H]=Ee.useState(null),K=Ee.useRef(null),[$,ue]=Ee.useState("neutral"),[re,X]=Ee.useState(""),[ne,Ae]=Ee.useState(""),[Re,rt]=Ee.useState("Chat with us"),[ve,Be]=Ee.useState(null),[st,xt]=Ee.useState("hidden"),[Mt,$t]=Ee.useState(""),un=Ee.useRef(null),Vt=Ee.useRef(st);Vt.current=st;const[Ve,nt]=Ee.useState(null),Ge=Ee.useRef(null),ft=Ee.useRef(null),[ee,Nt]=Ee.useState("hidden"),[pt,Lt]=Ee.useState(""),gt=Ee.useRef(ee);gt.current=ee;const Z=Ee.useRef(""),P=Ee.useRef(!1),me=Ee.useRef(""),Le=Ee.useMemo(()=>p==="Thinking..."||p==="Processing Voice..."?p:ve!=null&&ve!==""&&ve!=="none"&&ve!=="<none>"?`Enter ${XF(ve)}`:null,[p,ve]),Xe=Le!=null&&Le!=="";Ee.useEffect(()=>{const j=Vt.current;if(!(j==="exiting"||j==="entering")){if(j==="hidden"){Xe&&($t(Le??""),xt("entering"));return}j==="visible"&&(!Xe||Le!==Mt)&&(un.current=Xe?Le:null,xt("exiting"))}},[Xe,Le,st,Mt]);const Fe=Ee.useCallback(()=>{const j=Vt.current;if(j==="exiting"){xt("hidden");const de=un.current;un.current=null,de!=null&&de!==""&&($t(de),xt("entering"))}else j==="entering"&&xt("visible")},[]),Bt=j=>{if(!j)return;if(j.mood!=null){const Ue=String(j.mood).toLowerCase();ue(Ue)}if(j.expression!=null){const Ue=String(j.expression).trim();X(Ue);const Ie=NF.find(ze=>ze.name.toLowerCase()===Ue.toLowerCase());$a(`[STREAM] Animation match for "${Ue}": ${Ie?Ie.name:"NONE"}`),Ae(Ie?.url??"")}if(j.navigation!=null){const Ue=String(j.navigation).trim();Ue!==""&&(t?t(Ue):window.open(Ue,"_blank"))}const de=j.ask_for||j.lead_capture?.ask_for,ye=de?String(de).trim().toLowerCase():"",xe=ye==="none"||ye==="<none>";if(de&&!xe){const Ue=ye;Be(Ue||null),rt(Ue==="email"?"Enter your email":Ue==="name"?"Enter your name":Ue==="phone"?"Enter your phone number":"Chat with us")}else(xe||j.ask_for===null||j.lead_capture&&j.lead_capture.ask_for===null||j.ask_for==="none")&&(Be(null),Re!=="Chat with us"&&rt("Chat with us"));j.collected,j.valid},_t=j=>{const de=j.trim();if(!de)return null;if(de.startsWith("{"))try{return JSON.parse(de)}catch{return null}if(de.includes(":")){const ye=de.split(":"),xe=ye[0].trim().toLowerCase(),Ue=ye.slice(1).join(":").trim();return{[xe]:Ue}}return null},Ot=Ee.useCallback(()=>{},[]),kt=j=>{if(P.current)j==="§"?P.current=!1:(me.current+=j,d(de=>de+j));else if(j==="§"){P.current=!0;return}else for(Z.current+=j;Z.current.includes(`
|
|
4149
|
+
`;class FI extends ms{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:i,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:h,hdrCapacityMax:d,sdr:p,gainMap:_}){super({name:"GainMapDecoderMaterial",vertexShader:OI,fragmentShader:II,uniforms:{sdr:{value:p},gainMap:{value:_},gamma:{value:new Q(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new Q().fromArray(t)},offsetSdr:{value:new Q().fromArray(n)},gainMapMin:{value:new Q().fromArray(i)},gainMapMax:{value:new Q().fromArray(o)},weightFactor:{value:(Math.log2(l)-h)/(d-h)}},blending:Xr,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=h,this._hdrCapacityMax=d,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class eC extends LI{constructor(e,t){super({renderer:e,createMaterial:n=>new FI(n),createQuadRenderer:n=>new CS(n)},t)}async render(e,t,n,i){const{sdrImage:o,gainMapImage:l,needsFlip:h}=await this.processImages(n,i,"flipY"),{gainMap:d,sdr:p}=this.createTextures(o,l,h);this.updateQuadRenderer(e,o,d,p,t),e.render()}}class HI extends eC{load([e,t,n],i,o,l){const h=this.prepareQuadRenderer();let d,p,_;const v=async()=>{if(d&&p&&_){try{await this.render(h,_,d,p)}catch(N){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof l=="function"&&l(N),h.disposeOnDemandRenderer();return}typeof i=="function"&&i(h),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),h.disposeOnDemandRenderer()}};let y=!0,x=0,b=0,R=!0,T=0,M=0,w=!0,D=0,U=0;const F=()=>{if(typeof o=="function"){const N=x+T+D,I=b+M+U,W=y&&R&&w;o(new ProgressEvent("progress",{lengthComputable:W,loaded:I,total:N}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const O=new ha(this._internalLoadingManager);O.setResponseType("arraybuffer"),O.setRequestHeader(this.requestHeader),O.setPath(this.path),O.setWithCredentials(this.withCredentials),O.load(e,async N=>{if(typeof N=="string")throw new Error("Invalid sdr buffer");d=N,await v()},N=>{y=N.lengthComputable,b=N.loaded,x=N.total,F()},N=>{this.manager.itemError(e),typeof l=="function"&&l(N)});const z=new ha(this._internalLoadingManager);z.setResponseType("arraybuffer"),z.setRequestHeader(this.requestHeader),z.setPath(this.path),z.setWithCredentials(this.withCredentials),z.load(t,async N=>{if(typeof N=="string")throw new Error("Invalid gainmap buffer");p=N,await v()},N=>{R=N.lengthComputable,M=N.loaded,T=N.total,F()},N=>{this.manager.itemError(t),typeof l=="function"&&l(N)});const k=new ha(this._internalLoadingManager);return k.setRequestHeader(this.requestHeader),k.setPath(this.path),k.setWithCredentials(this.withCredentials),k.load(n,async N=>{if(typeof N!="string")throw new Error("Invalid metadata string");_=JSON.parse(N),await v()},N=>{w=N.lengthComputable,U=N.loaded,D=N.total,F()},N=>{this.manager.itemError(n),typeof l=="function"&&l(N)}),h}}class PI extends eC{load(e,t,n,i){const o=this.prepareQuadRenderer(),l=new ha(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,async h=>{if(typeof h=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const d=new Uint8Array(h);let p,_,v;try{const y=await NI(d);p=y.sdr,_=y.gainMap,v=y.metadata}catch(y){if(y instanceof QT||y instanceof ZT)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),v={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},p=d;else throw y}try{await this.render(o,v,p.buffer,_?.buffer)}catch(y){this.manager.itemError(e),typeof i=="function"&&i(y),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,h=>{this.manager.itemError(e),typeof i=="function"&&i(h)}),o}}const nm={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"},tC="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Vh=s=>Array.isArray(s),RS=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function p_({files:s=RS,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:i}={}){t&&(wS(t),s=nm[t],e=tC);const o=Vh(s),{extension:l,isCubemap:h}=BS(s),d=DS(l);if(!d)throw new Error("useEnvironment: Unrecognized file extension: "+s);const p=Ih(x=>x.gl);Ee.useLayoutEffect(()=>{if(l!=="webp"&&l!=="jpg"&&l!=="jpeg")return;function x(){Cl.clear(d,o?[s]:s)}p.domElement.addEventListener("webglcontextlost",x,{once:!0})},[s,p.domElement]);const _=Cl(d,o?[s]:s,x=>{(l==="webp"||l==="jpg"||l==="jpeg")&&x.setRenderer(p),x.setPath==null||x.setPath(e),i&&i(x)});let v=o?_[0]:_;if(l==="jpg"||l==="jpeg"||l==="webp"){var y;v=(y=v.renderTarget)==null?void 0:y.texture}return v.mapping=h?Yr:Wf,v.colorSpace=n??(h?"srgb":"srgb-linear"),v}const GI={files:RS,path:"",preset:void 0,extensions:void 0};p_.preload=s=>{const e={...GI,...s};let{files:t,path:n=""}=e;const{preset:i,extensions:o}=e;i&&(wS(i),t=nm[i],n=tC);const{extension:l}=BS(t);if(l==="webp"||l==="jpg"||l==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const h=DS(l);if(!h)throw new Error("useEnvironment: Unrecognized file extension: "+t);Cl.preload(h,Vh(t)?[t]:t,d=>{d.setPath==null||d.setPath(n),o&&o(d)})};const zI={files:RS,preset:void 0};p_.clear=s=>{const e={...zI,...s};let{files:t}=e;const{preset:n}=e;n&&(wS(n),t=nm[n]);const{extension:i}=BS(t),o=DS(i);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);Cl.clear(o,Vh(t)?[t]:t)};function wS(s){if(!(s in nm))throw new Error("Preset must be one of: "+Object.keys(nm).join(", "))}function BS(s){var e;const t=Vh(s)&&s.length===6,n=Vh(s)&&s.length===3&&s.some(l=>l.endsWith("json")),i=Vh(s)?s[0]:s;return{extension:t?"cube":n?"webp":i.startsWith("data:application/exr")?"exr":i.startsWith("data:application/hdr")?"hdr":i.startsWith("data:image/jpeg")?"jpg":(e=i.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function DS(s){return s==="cube"?H1:s==="hdr"?TI:s==="exr"?CI:s==="jpg"||s==="jpeg"?PI:s==="webp"?HI:null}const VI=s=>s.current&&s.current.isScene,kI=s=>VI(s)?s.current:s;function US(s,e,t,n,i={}){var o,l,h,d;i={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...i};const p=kI(e||t),_=p.background,v=p.environment,y={backgroundBlurriness:p.backgroundBlurriness,backgroundIntensity:p.backgroundIntensity,backgroundRotation:(o=(l=p.backgroundRotation)==null||l.clone==null?void 0:l.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:p.environmentIntensity,environmentRotation:(h=(d=p.environmentRotation)==null||d.clone==null?void 0:d.clone())!==null&&h!==void 0?h:[0,0,0]};return s!=="only"&&(p.environment=n),s&&(p.background=n),Do(p,i),()=>{s!=="only"&&(p.environment=v),s&&(p.background=_),Do(p,y)}}function NS({scene:s,background:e=!1,map:t,...n}){const i=Ih(o=>o.scene);return Ee.useLayoutEffect(()=>{if(t)return US(e,s,i,t,n)}),null}function nC({background:s=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:i,backgroundRotation:o,environmentIntensity:l,environmentRotation:h,...d}){const p=p_(d),_=Ih(v=>v.scene);return Ee.useLayoutEffect(()=>US(s,e,_,p,{backgroundBlurriness:t??n,backgroundIntensity:i,backgroundRotation:o,environmentIntensity:l,environmentRotation:h})),Ee.useEffect(()=>()=>{p.dispose()},[p]),null}function XI({children:s,near:e=.1,far:t=1e3,resolution:n=256,frames:i=1,map:o,background:l=!1,blur:h,backgroundBlurriness:d,backgroundIntensity:p,backgroundRotation:_,environmentIntensity:v,environmentRotation:y,scene:x,files:b,path:R,preset:T=void 0,extensions:M}){const w=Ih(k=>k.gl),D=Ih(k=>k.scene),U=Ee.useRef(null),[F]=Ee.useState(()=>new Mp),O=Ee.useMemo(()=>{const k=new Y0(n);return k.texture.type=Hi,k},[n]);Ee.useEffect(()=>()=>{O.dispose()},[O]),Ee.useLayoutEffect(()=>{if(i===1){const k=w.autoClear;w.autoClear=!0,U.current.update(w,F),w.autoClear=k}return US(l,x,D,O.texture,{backgroundBlurriness:h??d,backgroundIntensity:p,backgroundRotation:_,environmentIntensity:v,environmentRotation:y})},[s,F,O.texture,x,D,l,i,w]);let z=1;return _T(()=>{if(i===1/0||z<i){const k=w.autoClear;w.autoClear=!0,U.current.update(w,F),w.autoClear=k,z++}}),Ee.createElement(Ee.Fragment,null,vO(Ee.createElement(Ee.Fragment,null,s,Ee.createElement("cubeCamera",{ref:U,args:[e,t,O]}),b||T?Ee.createElement(nC,{background:!0,files:b,preset:T,path:R,extensions:M}):o?Ee.createElement(NS,{background:!0,map:o,extensions:M}):null),F))}function YI(s){var e,t,n,i;const o=p_(s),l=s.map||o;Ee.useMemo(()=>ST({GroundProjectedEnvImpl:XO}),[]),Ee.useEffect(()=>()=>{o.dispose()},[o]);const h=Ee.useMemo(()=>[l],[l]),d=(e=s.ground)==null?void 0:e.height,p=(t=s.ground)==null?void 0:t.radius,_=(n=(i=s.ground)==null?void 0:i.scale)!==null&&n!==void 0?n:1e3;return Ee.createElement(Ee.Fragment,null,Ee.createElement(NS,ky({},s,{map:l})),Ee.createElement("groundProjectedEnvImpl",{args:h,scale:_,height:d,radius:p}))}function JI(s){return s.ground?Ee.createElement(YI,s):s.map?Ee.createElement(NS,s):s.children?Ee.createElement(XI,s):Ee.createElement(nC,s)}function iC(s,e){if(e===ox)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===bu||e===fp){let t=s.getIndex();if(t===null){const l=[],h=s.getAttribute("position");if(h!==void 0){for(let d=0;d<h.count;d++)l.push(d);s.setIndex(l),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(e===bu)for(let l=1;l<=n;l++)i.push(t.getX(0)),i.push(t.getX(l)),i.push(t.getX(l+1));else for(let l=0;l<n;l++)l%2===0?(i.push(t.getX(l)),i.push(t.getX(l+1)),i.push(t.getX(l+2))):(i.push(t.getX(l+2)),i.push(t.getX(l+1)),i.push(t.getX(l)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=s.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}class qI extends Ca{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new QI(t)}),this.register(function(t){return new $I(t)}),this.register(function(t){return new lF(t)}),this.register(function(t){return new cF(t)}),this.register(function(t){return new uF(t)}),this.register(function(t){return new tF(t)}),this.register(function(t){return new nF(t)}),this.register(function(t){return new iF(t)}),this.register(function(t){return new aF(t)}),this.register(function(t){return new ZI(t)}),this.register(function(t){return new sF(t)}),this.register(function(t){return new eF(t)}),this.register(function(t){return new oF(t)}),this.register(function(t){return new rF(t)}),this.register(function(t){return new WI(t)}),this.register(function(t){return new fF(t)}),this.register(function(t){return new hF(t)})}load(e,t,n,i){const o=this;let l;if(this.resourcePath!=="")l=this.resourcePath;else if(this.path!==""){const p=nr.extractUrlBase(e);l=nr.resolveURL(p,this.path)}else l=nr.extractUrlBase(e);this.manager.itemStart(e);const h=function(p){i?i(p):console.error(p),o.manager.itemError(e),o.manager.itemEnd(e)},d=new ha(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(this.withCredentials),d.load(e,function(p){try{o.parse(p,l,function(_){t(_),o.manager.itemEnd(e)},h)}catch(_){h(_)}},n,h)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let o;const l={},h={},d=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(d.decode(new Uint8Array(e,0,4))===aC){try{l[Dn.KHR_BINARY_GLTF]=new dF(e)}catch(v){i&&i(v);return}o=JSON.parse(l[Dn.KHR_BINARY_GLTF].content)}else o=JSON.parse(d.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const p=new TF(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});p.fileLoader.setRequestHeader(this.requestHeader);for(let _=0;_<this.pluginCallbacks.length;_++){const v=this.pluginCallbacks[_](p);v.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),h[v.name]=v,l[v.name]=!0}if(o.extensionsUsed)for(let _=0;_<o.extensionsUsed.length;++_){const v=o.extensionsUsed[_],y=o.extensionsRequired||[];switch(v){case Dn.KHR_MATERIALS_UNLIT:l[v]=new jI;break;case Dn.KHR_DRACO_MESH_COMPRESSION:l[v]=new pF(o,this.dracoLoader);break;case Dn.KHR_TEXTURE_TRANSFORM:l[v]=new mF;break;case Dn.KHR_MESH_QUANTIZATION:l[v]=new gF;break;default:y.indexOf(v)>=0&&h[v]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+v+'".')}}p.setExtensions(l),p.setPlugins(h),p.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,o){n.parse(e,t,i,o)})}}function KI(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const Dn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class WI{constructor(e){this.parser=e,this.name=Dn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const o=t.json,d=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let p;const _=new At(16777215);d.color!==void 0&&_.setRGB(d.color[0],d.color[1],d.color[2],ta);const v=d.range!==void 0?d.range:0;switch(d.type){case"directional":p=new Pv(_),p.target.position.set(0,0,-1),p.add(p.target);break;case"point":p=new Hv(_),p.distance=v;break;case"spot":p=new Fv(_),p.distance=v,d.spot=d.spot||{},d.spot.innerConeAngle=d.spot.innerConeAngle!==void 0?d.spot.innerConeAngle:0,d.spot.outerConeAngle=d.spot.outerConeAngle!==void 0?d.spot.outerConeAngle:Math.PI/4,p.angle=d.spot.outerConeAngle,p.penumbra=1-d.spot.innerConeAngle/d.spot.outerConeAngle,p.target.position.set(0,0,-1),p.add(p.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+d.type)}return p.position.set(0,0,0),Uo(p,d),d.intensity!==void 0&&(p.intensity=d.intensity),p.name=t.createUniqueName(d.name||"light_"+e),i=Promise.resolve(p),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],h=(o.extensions&&o.extensions[this.name]||{}).light;return h===void 0?null:this._loadLight(h).then(function(d){return n._getNodeRef(t.cache,h,d)})}}class jI{constructor(){this.name=Dn.KHR_MATERIALS_UNLIT}getMaterialType(){return fa}extendParams(e,t,n){const i=[];e.color=new At(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const l=o.baseColorFactor;e.color.setRGB(l[0],l[1],l[2],ta),e.opacity=l[3]}o.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",o.baseColorTexture,Pi))}return Promise.all(i)}}class ZI{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class QI{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];if(l.clearcoatFactor!==void 0&&(t.clearcoat=l.clearcoatFactor),l.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),l.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),l.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),l.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),l.clearcoatNormalTexture.scale!==void 0)){const h=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new et(h,h)}return Promise.all(o)}}class $I{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.dispersion=o.dispersion!==void 0?o.dispersion:0,Promise.resolve()}}class eF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return l.iridescenceFactor!==void 0&&(t.iridescence=l.iridescenceFactor),l.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),l.iridescenceIor!==void 0&&(t.iridescenceIOR=l.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),l.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),l.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),l.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class tF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new At(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=i.extensions[this.name];if(l.sheenColorFactor!==void 0){const h=l.sheenColorFactor;t.sheenColor.setRGB(h[0],h[1],h[2],ta)}return l.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=l.sheenRoughnessFactor),l.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",l.sheenColorTexture,Pi)),l.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(o)}}class nF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return l.transmissionFactor!==void 0&&(t.transmission=l.transmissionFactor),l.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class iF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];t.thickness=l.thicknessFactor!==void 0?l.thicknessFactor:0,l.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const h=l.attenuationColor||[1,1,1];return t.attenuationColor=new At().setRGB(h[0],h[1],h[2],ta),Promise.all(o)}}class aF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class sF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];t.specularIntensity=l.specularFactor!==void 0?l.specularFactor:1,l.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",l.specularTexture));const h=l.specularColorFactor||[1,1,1];return t.specularColor=new At().setRGB(h[0],h[1],h[2],ta),l.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",l.specularColorTexture,Pi)),Promise.all(o)}}class rF{constructor(e){this.parser=e,this.name=Dn.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return t.bumpScale=l.bumpFactor!==void 0?l.bumpFactor:1,l.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class oF{constructor(e){this.parser=e,this.name=Dn.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],l=i.extensions[this.name];return l.anisotropyStrength!==void 0&&(t.anisotropy=l.anisotropyStrength),l.anisotropyRotation!==void 0&&(t.anisotropyRotation=l.anisotropyRotation),l.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class lF{constructor(e){this.parser=e,this.name=Dn.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const o=i.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class cF{constructor(e){this.parser=e,this.name=Dn.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],h=i.images[l.source];let d=n.textureLoader;if(h.uri){const p=n.options.manager.getHandler(h.uri);p!==null&&(d=p)}return n.loadTextureImage(e,l.source,d)}}class uF{constructor(e){this.parser=e,this.name=Dn.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],h=i.images[l.source];let d=n.textureLoader;if(h.uri){const p=n.options.manager.getHandler(h.uri);p!==null&&(d=p)}return n.loadTextureImage(e,l.source,d)}}class fF{constructor(e){this.name=Dn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),l=this.parser.options.meshoptDecoder;if(!l||!l.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(h){const d=i.byteOffset||0,p=i.byteLength||0,_=i.count,v=i.byteStride,y=new Uint8Array(h,d,p);return l.decodeGltfBufferAsync?l.decodeGltfBufferAsync(_,v,y,i.mode,i.filter).then(function(x){return x.buffer}):l.ready.then(function(){const x=new ArrayBuffer(_*v);return l.decodeGltfBuffer(new Uint8Array(x),_,v,y,i.mode,i.filter),x})})}else return null}}class hF{constructor(e){this.name=Dn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const p of i.primitives)if(p.mode!==Mr.TRIANGLES&&p.mode!==Mr.TRIANGLE_STRIP&&p.mode!==Mr.TRIANGLE_FAN&&p.mode!==void 0)return null;const l=n.extensions[this.name].attributes,h=[],d={};for(const p in l)h.push(this.parser.getDependency("accessor",l[p]).then(_=>(d[p]=_,d[p])));return h.length<1?null:(h.push(this.parser.createNodeMesh(e)),Promise.all(h).then(p=>{const _=p.pop(),v=_.isGroup?_.children:[_],y=p[0].count,x=[];for(const b of v){const R=new Qt,T=new Q,M=new ba,w=new Q(1,1,1),D=new nv(b.geometry,b.material,y);for(let U=0;U<y;U++)d.TRANSLATION&&T.fromBufferAttribute(d.TRANSLATION,U),d.ROTATION&&M.fromBufferAttribute(d.ROTATION,U),d.SCALE&&w.fromBufferAttribute(d.SCALE,U),D.setMatrixAt(U,R.compose(T,M,w));for(const U in d)if(U==="_COLOR_0"){const F=d[U];D.instanceColor=new xc(F.array,F.itemSize,F.normalized)}else U!=="TRANSLATION"&&U!=="ROTATION"&&U!=="SCALE"&&b.geometry.setAttribute(U,d[U]);wn.prototype.copy.call(D,b),this.parser.assignFinalMaterial(D),x.push(D)}return _.isGroup?(_.clear(),_.add(...x),_):x[0]}))}}const aC="glTF",im=12,sC={JSON:1313821514,BIN:5130562};class dF{constructor(e){this.name=Dn.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,im),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==aC)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-im,o=new DataView(e,im);let l=0;for(;l<i;){const h=o.getUint32(l,!0);l+=4;const d=o.getUint32(l,!0);if(l+=4,d===sC.JSON){const p=new Uint8Array(e,im+l,h);this.content=n.decode(p)}else if(d===sC.BIN){const p=im+l;this.body=e.slice(p,p+h)}l+=h}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class pF{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Dn.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,o=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,h={},d={},p={};for(const _ in l){const v=OS[_]||_.toLowerCase();h[v]=l[_]}for(const _ in e.attributes){const v=OS[_]||_.toLowerCase();if(l[_]!==void 0){const y=n.accessors[e.attributes[_]],x=kh[y.componentType];p[v]=x.name,d[v]=y.normalized===!0}}return t.getDependency("bufferView",o).then(function(_){return new Promise(function(v,y){i.decodeDracoFile(_,function(x){for(const b in x.attributes){const R=x.attributes[b],T=d[b];T!==void 0&&(R.normalized=T)}v(x)},h,p,ta,y)})})}}class mF{constructor(){this.name=Dn.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class gF{constructor(){this.name=Dn.KHR_MESH_QUANTIZATION}}class rC extends Pu{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i*3+i;for(let l=0;l!==i;l++)t[l]=n[o+l];return t}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,h=this.valueSize,d=h*2,p=h*3,_=i-t,v=(n-t)/_,y=v*v,x=y*v,b=e*p,R=b-p,T=-2*x+3*y,M=x-y,w=1-T,D=M-y+v;for(let U=0;U!==h;U++){const F=l[R+U+h],O=l[R+U+d]*_,z=l[b+U+h],k=l[b+U]*_;o[U]=w*F+D*O+T*z+M*k}return o}}const vF=new ba;class _F extends rC{interpolate_(e,t,n,i){const o=super.interpolate_(e,t,n,i);return vF.fromArray(o).normalize().toArray(o),o}}const Mr={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},kh={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},oC={9728:xi,9729:bn,9984:tp,9985:yu,9986:lc,9987:Is},lC={33071:yi,33648:_u,10497:Jr},LS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},OS={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Bc={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},yF={CUBICSPLINE:void 0,LINEAR:uc,STEP:Au},IS={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function xF(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new Fu({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:kr})),s.DefaultMaterial}function nf(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Uo(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function AF(s,e,t){let n=!1,i=!1,o=!1;for(let p=0,_=e.length;p<_;p++){const v=e[p];if(v.POSITION!==void 0&&(n=!0),v.NORMAL!==void 0&&(i=!0),v.COLOR_0!==void 0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(s);const l=[],h=[],d=[];for(let p=0,_=e.length;p<_;p++){const v=e[p];if(n){const y=v.POSITION!==void 0?t.getDependency("accessor",v.POSITION):s.attributes.position;l.push(y)}if(i){const y=v.NORMAL!==void 0?t.getDependency("accessor",v.NORMAL):s.attributes.normal;h.push(y)}if(o){const y=v.COLOR_0!==void 0?t.getDependency("accessor",v.COLOR_0):s.attributes.color;d.push(y)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(d)]).then(function(p){const _=p[0],v=p[1],y=p[2];return n&&(s.morphAttributes.position=_),i&&(s.morphAttributes.normal=v),o&&(s.morphAttributes.color=y),s.morphTargetsRelative=!0,s})}function SF(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function MF(s){let e;const t=s.extensions&&s.extensions[Dn.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+FS(t.attributes):e=s.indices+":"+FS(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+FS(s.targets[n]);return e}function FS(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function HS(s){switch(s){case Int8Array:return .007874015748031496;case Uint8Array:return .00392156862745098;case Int16Array:return 3051850947599719e-20;case Uint16Array:return 15259021896696422e-21;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function bF(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const EF=new Qt;class TF{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new KI,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,o=!1,l=-1;if(typeof navigator<"u"){const h=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(h)===!0;const d=h.match(/Version\/(\d+)/);i=n&&d?parseInt(d[1],10):-1,o=h.indexOf("Firefox")>-1,l=o?h.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||o&&l<98?this.textureLoader=new uA(this.options.manager):this.textureLoader=new mA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ha(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(l){return l._markDefs&&l._markDefs()}),Promise.all(this._invokeAll(function(l){return l.beforeRoot&&l.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(l){const h={scene:l[0][i.scene||0],scenes:l[0],animations:l[1],cameras:l[2],asset:i.asset,parser:n,userData:{}};return nf(o,h,i),Uo(h,i),Promise.all(n._invokeAll(function(d){return d.afterRoot&&d.afterRoot(h)})).then(function(){for(const d of h.scenes)d.updateMatrixWorld();e(h)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,o=t.length;i<o;i++){const l=t[i].joints;for(let h=0,d=l.length;h<d;h++)e[l[h]].isBone=!0}for(let i=0,o=e.length;i<o;i++){const l=e[i];l.mesh!==void 0&&(this._addNodeRef(this.meshCache,l.mesh),l.skin!==void 0&&(n[l.mesh].isSkinnedMesh=!0)),l.camera!==void 0&&this._addNodeRef(this.cameraCache,l.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),o=(l,h)=>{const d=this.associations.get(l);d!=null&&this.associations.set(h,d);for(const[p,_]of l.children.entries())o(_,h.children[p])};return o(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const o=e(t[i]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":i=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(o,l){return n.getDependency(e,l)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Dn.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(o,l){n.load(nr.resolveURL(t.uri,i.path),o,void 0,function(){l(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const l=LS[i.type],h=kh[i.componentType],d=i.normalized===!0,p=new h(i.count*l);return Promise.resolve(new Ln(p,l,d))}const o=[];return i.bufferView!==void 0?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),i.sparse!==void 0&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then(function(l){const h=l[0],d=LS[i.type],p=kh[i.componentType],_=p.BYTES_PER_ELEMENT,v=_*d,y=i.byteOffset||0,x=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,b=i.normalized===!0;let R,T;if(x&&x!==v){const M=Math.floor(y/x),w="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+M+":"+i.count;let D=t.cache.get(w);D||(R=new p(h,M*x,i.count*x/_),D=new yh(R,x/_),t.cache.add(w,D)),T=new xl(D,d,y%x/_,b)}else h===null?R=new p(i.count*d):R=new p(h,y,i.count*d),T=new Ln(R,d,b);if(i.sparse!==void 0){const M=LS.SCALAR,w=kh[i.sparse.indices.componentType],D=i.sparse.indices.byteOffset||0,U=i.sparse.values.byteOffset||0,F=new w(l[1],D,i.sparse.count*M),O=new p(l[2],U,i.sparse.count*d);h!==null&&(T=new Ln(T.array.slice(),T.itemSize,T.normalized)),T.normalized=!1;for(let z=0,k=F.length;z<k;z++){const N=F[z];if(T.setX(N,O[z*d]),d>=2&&T.setY(N,O[z*d+1]),d>=3&&T.setZ(N,O[z*d+2]),d>=4&&T.setW(N,O[z*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}T.normalized=b}return T})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,l=t.images[o];let h=this.textureLoader;if(l.uri){const d=n.manager.getHandler(l.uri);d!==null&&(h=d)}return this.loadTextureImage(e,o,h)}loadTextureImage(e,t,n){const i=this,o=this.json,l=o.textures[e],h=o.images[t],d=(h.uri||h.bufferView)+":"+l.sampler;if(this.textureCache[d])return this.textureCache[d];const p=this.loadImageSource(t,n).then(function(_){_.flipY=!1,_.name=l.name||h.name||"",_.name===""&&typeof h.uri=="string"&&h.uri.startsWith("data:image/")===!1&&(_.name=h.uri);const y=(o.samplers||{})[l.sampler]||{};return _.magFilter=oC[y.magFilter]||bn,_.minFilter=oC[y.minFilter]||Is,_.wrapS=lC[y.wrapS]||Jr,_.wrapT=lC[y.wrapT]||Jr,_.generateMipmaps=!_.isCompressedTexture&&_.minFilter!==xi&&_.minFilter!==bn,i.associations.set(_,{textures:e}),_}).catch(function(){return null});return this.textureCache[d]=p,p}loadImageSource(e,t){const n=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(v=>v.clone());const l=i.images[e],h=self.URL||self.webkitURL;let d=l.uri||"",p=!1;if(l.bufferView!==void 0)d=n.getDependency("bufferView",l.bufferView).then(function(v){p=!0;const y=new Blob([v],{type:l.mimeType});return d=h.createObjectURL(y),d});else if(l.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const _=Promise.resolve(d).then(function(v){return new Promise(function(y,x){let b=y;t.isImageBitmapLoader===!0&&(b=function(R){const T=new qn(R);T.needsUpdate=!0,y(T)}),t.load(nr.resolveURL(v,o.path),b,void 0,x)})}).then(function(v){return p===!0&&h.revokeObjectURL(d),Uo(v,l),v.userData.mimeType=l.mimeType||bF(l.uri),v}).catch(function(v){throw console.error("THREE.GLTFLoader: Couldn't load texture",d),v});return this.sourceCache[e]=_,_}assignTexture(e,t,n,i){const o=this;return this.getDependency("texture",n.index).then(function(l){if(!l)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(l=l.clone(),l.channel=n.texCoord),o.extensions[Dn.KHR_TEXTURE_TRANSFORM]){const h=n.extensions!==void 0?n.extensions[Dn.KHR_TEXTURE_TRANSFORM]:void 0;if(h){const d=o.associations.get(l);l=o.extensions[Dn.KHR_TEXTURE_TRANSFORM].extendTexture(l,h),o.associations.set(l,d)}}return i!==void 0&&(l.colorSpace=i),e[t]=l,l})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,l=t.attributes.normal===void 0;if(e.isPoints){const h="PointsMaterial:"+n.uuid;let d=this.cache.get(h);d||(d=new Up,Gi.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,d.sizeAttenuation=!1,this.cache.add(h,d)),n=d}else if(e.isLine){const h="LineBasicMaterial:"+n.uuid;let d=this.cache.get(h);d||(d=new Pa,Gi.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,this.cache.add(h,d)),n=d}if(i||o||l){let h="ClonedMaterial:"+n.uuid+":";i&&(h+="derivative-tangents:"),o&&(h+="vertex-colors:"),l&&(h+="flat-shading:");let d=this.cache.get(h);d||(d=n.clone(),o&&(d.vertexColors=!0),l&&(d.flatShading=!0),i&&(d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(h,d),this.associations.set(d,this.associations.get(n))),n=d}e.material=n}getMaterialType(){return Fu}loadMaterial(e){const t=this,n=this.json,i=this.extensions,o=n.materials[e];let l;const h={},d=o.extensions||{},p=[];if(d[Dn.KHR_MATERIALS_UNLIT]){const v=i[Dn.KHR_MATERIALS_UNLIT];l=v.getMaterialType(),p.push(v.extendParams(h,o,t))}else{const v=o.pbrMetallicRoughness||{};if(h.color=new At(1,1,1),h.opacity=1,Array.isArray(v.baseColorFactor)){const y=v.baseColorFactor;h.color.setRGB(y[0],y[1],y[2],ta),h.opacity=y[3]}v.baseColorTexture!==void 0&&p.push(t.assignTexture(h,"map",v.baseColorTexture,Pi)),h.metalness=v.metallicFactor!==void 0?v.metallicFactor:1,h.roughness=v.roughnessFactor!==void 0?v.roughnessFactor:1,v.metallicRoughnessTexture!==void 0&&(p.push(t.assignTexture(h,"metalnessMap",v.metallicRoughnessTexture)),p.push(t.assignTexture(h,"roughnessMap",v.metallicRoughnessTexture))),l=this._invokeOne(function(y){return y.getMaterialType&&y.getMaterialType(e)}),p.push(Promise.all(this._invokeAll(function(y){return y.extendMaterialParams&&y.extendMaterialParams(e,h)})))}o.doubleSided===!0&&(h.side=Ws);const _=o.alphaMode||IS.OPAQUE;if(_===IS.BLEND?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,_===IS.MASK&&(h.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&l!==fa&&(p.push(t.assignTexture(h,"normalMap",o.normalTexture)),h.normalScale=new et(1,1),o.normalTexture.scale!==void 0)){const v=o.normalTexture.scale;h.normalScale.set(v,v)}if(o.occlusionTexture!==void 0&&l!==fa&&(p.push(t.assignTexture(h,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(h.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&l!==fa){const v=o.emissiveFactor;h.emissive=new At().setRGB(v[0],v[1],v[2],ta)}return o.emissiveTexture!==void 0&&l!==fa&&p.push(t.assignTexture(h,"emissiveMap",o.emissiveTexture,Pi)),Promise.all(p).then(function(){const v=new l(h);return o.name&&(v.name=o.name),Uo(v,o),t.associations.set(v,{materials:e}),o.extensions&&nf(i,v,o),v})}createUniqueName(e){const t=Hn.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function o(h){return n[Dn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h,t).then(function(d){return cC(d,h,t)})}const l=[];for(let h=0,d=e.length;h<d;h++){const p=e[h],_=MF(p),v=i[_];if(v)l.push(v.promise);else{let y;p.extensions&&p.extensions[Dn.KHR_DRACO_MESH_COMPRESSION]?y=o(p):y=cC(new on,p,t),i[_]={primitive:p,promise:y},l.push(y)}}return Promise.all(l)}loadMesh(e){const t=this,n=this.json,i=this.extensions,o=n.meshes[e],l=o.primitives,h=[];for(let d=0,p=l.length;d<p;d++){const _=l[d].material===void 0?xF(this.cache):this.getDependency("material",l[d].material);h.push(_)}return h.push(t.loadGeometries(l)),Promise.all(h).then(function(d){const p=d.slice(0,d.length-1),_=d[d.length-1],v=[];for(let x=0,b=_.length;x<b;x++){const R=_[x],T=l[x];let M;const w=p[x];if(T.mode===Mr.TRIANGLES||T.mode===Mr.TRIANGLE_STRIP||T.mode===Mr.TRIANGLE_FAN||T.mode===void 0)M=o.isSkinnedMesh===!0?new ev(R,w):new pi(R,w),M.isSkinnedMesh===!0&&M.normalizeSkinWeights(),T.mode===Mr.TRIANGLE_STRIP?M.geometry=iC(M.geometry,fp):T.mode===Mr.TRIANGLE_FAN&&(M.geometry=iC(M.geometry,bu));else if(T.mode===Mr.LINES)M=new yr(R,w);else if(T.mode===Mr.LINE_STRIP)M=new Ro(R,w);else if(T.mode===Mr.LINE_LOOP)M=new fv(R,w);else if(T.mode===Mr.POINTS)M=new pv(R,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+T.mode);Object.keys(M.geometry.morphAttributes).length>0&&SF(M,o),M.name=t.createUniqueName(o.name||"mesh_"+e),Uo(M,o),T.extensions&&nf(i,M,T),t.assignFinalMaterial(M),v.push(M)}for(let x=0,b=v.length;x<b;x++)t.associations.set(v[x],{meshes:e,primitives:x});if(v.length===1)return o.extensions&&nf(i,v[0],o),v[0];const y=new vr;o.extensions&&nf(i,y,o),t.associations.set(y,{meshes:e});for(let x=0,b=v.length;x<b;x++)y.add(v[x]);return y})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new ia(E0.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new El(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Uo(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,o=t.joints.length;i<o;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const o=i.pop(),l=i,h=[],d=[];for(let p=0,_=l.length;p<_;p++){const v=l[p];if(v){h.push(v);const y=new Qt;o!==null&&y.fromArray(o.array,p*16),d.push(y)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[p])}return new bh(h,d)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],o=i.name?i.name:"animation_"+e,l=[],h=[],d=[],p=[],_=[];for(let v=0,y=i.channels.length;v<y;v++){const x=i.channels[v],b=i.samplers[x.sampler],R=x.target,T=R.node,M=i.parameters!==void 0?i.parameters[b.input]:b.input,w=i.parameters!==void 0?i.parameters[b.output]:b.output;R.node!==void 0&&(l.push(this.getDependency("node",T)),h.push(this.getDependency("accessor",M)),d.push(this.getDependency("accessor",w)),p.push(b),_.push(R))}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(d),Promise.all(p),Promise.all(_)]).then(function(v){const y=v[0],x=v[1],b=v[2],R=v[3],T=v[4],M=[];for(let D=0,U=y.length;D<U;D++){const F=y[D],O=x[D],z=b[D],k=R[D],N=T[D];if(F===void 0)continue;F.updateMatrix&&F.updateMatrix();const I=n._createAnimationTracks(F,O,z,k,N);if(I)for(let W=0;W<I.length;W++)M.push(I[W])}const w=new Vu(o,void 0,M);return Uo(w,i),w})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(o){const l=n._getNodeRef(n.meshCache,i.mesh,o);return i.weights!==void 0&&l.traverse(function(h){if(h.isMesh)for(let d=0,p=i.weights.length;d<p;d++)h.morphTargetInfluences[d]=i.weights[d]}),l})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],o=n._loadNodeShallow(e),l=[],h=i.children||[];for(let p=0,_=h.length;p<_;p++)l.push(n.getDependency("node",h[p]));const d=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([o,Promise.all(l),d]).then(function(p){const _=p[0],v=p[1],y=p[2];y!==null&&_.traverse(function(x){x.isSkinnedMesh&&x.bind(y,EF)});for(let x=0,b=v.length;x<b;x++)_.add(v[x]);return _})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],l=o.name?i.createUniqueName(o.name):"",h=[],d=i._invokeOne(function(p){return p.createNodeMesh&&p.createNodeMesh(e)});return d&&h.push(d),o.camera!==void 0&&h.push(i.getDependency("camera",o.camera).then(function(p){return i._getNodeRef(i.cameraCache,o.camera,p)})),i._invokeAll(function(p){return p.createNodeAttachment&&p.createNodeAttachment(e)}).forEach(function(p){h.push(p)}),this.nodeCache[e]=Promise.all(h).then(function(p){let _;if(o.isBone===!0?_=new Cp:p.length>1?_=new vr:p.length===1?_=p[0]:_=new wn,_!==p[0])for(let v=0,y=p.length;v<y;v++)_.add(p[v]);if(o.name&&(_.userData.name=o.name,_.name=l),Uo(_,o),o.extensions&&nf(n,_,o),o.matrix!==void 0){const v=new Qt;v.fromArray(o.matrix),_.applyMatrix4(v)}else o.translation!==void 0&&_.position.fromArray(o.translation),o.rotation!==void 0&&_.quaternion.fromArray(o.rotation),o.scale!==void 0&&_.scale.fromArray(o.scale);if(!i.associations.has(_))i.associations.set(_,{});else if(o.mesh!==void 0&&i.meshCache.refs[o.mesh]>1){const v=i.associations.get(_);i.associations.set(_,{...v})}return i.associations.get(_).nodes=e,_}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,o=new vr;n.name&&(o.name=i.createUniqueName(n.name)),Uo(o,n),n.extensions&&nf(t,o,n);const l=n.nodes||[],h=[];for(let d=0,p=l.length;d<p;d++)h.push(i.getDependency("node",l[d]));return Promise.all(h).then(function(d){for(let _=0,v=d.length;_<v;_++)o.add(d[_]);const p=_=>{const v=new Map;for(const[y,x]of i.associations)(y instanceof Gi||y instanceof qn)&&v.set(y,x);return _.traverse(y=>{const x=i.associations.get(y);x!=null&&v.set(y,x)}),v};return i.associations=p(o),o})}_createAnimationTracks(e,t,n,i,o){const l=[],h=e.name?e.name:e.uuid,d=[];Bc[o.path]===Bc.weights?e.traverse(function(y){y.morphTargetInfluences&&d.push(y.name?y.name:y.uuid)}):d.push(h);let p;switch(Bc[o.path]){case Bc.weights:p=Al;break;case Bc.rotation:p=Sl;break;case Bc.translation:case Bc.scale:p=Ml;break;default:n.itemSize===1?p=Al:p=Ml;break}const _=i.interpolation!==void 0?yF[i.interpolation]:uc,v=this._getArrayFromAccessor(n);for(let y=0,x=d.length;y<x;y++){const b=new p(d[y]+"."+Bc[o.path],t.array,v,_);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(b),l.push(b)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=HS(t.constructor),i=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o++)i[o]=t[o]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof Sl?_F:rC;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function CF(s,e,t){const n=e.attributes,i=new Ea;if(n.POSITION!==void 0){const h=t.json.accessors[n.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(i.set(new Q(d[0],d[1],d[2]),new Q(p[0],p[1],p[2])),h.normalized){const _=HS(kh[h.componentType]);i.min.multiplyScalar(_),i.max.multiplyScalar(_)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const h=new Q,d=new Q;for(let p=0,_=o.length;p<_;p++){const v=o[p];if(v.POSITION!==void 0){const y=t.json.accessors[v.POSITION],x=y.min,b=y.max;if(x!==void 0&&b!==void 0){if(d.setX(Math.max(Math.abs(x[0]),Math.abs(b[0]))),d.setY(Math.max(Math.abs(x[1]),Math.abs(b[1]))),d.setZ(Math.max(Math.abs(x[2]),Math.abs(b[2]))),y.normalized){const R=HS(kh[y.componentType]);d.multiplyScalar(R)}h.max(d)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(h)}s.boundingBox=i;const l=new ua;i.getCenter(l.center),l.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=l}function cC(s,e,t){const n=e.attributes,i=[];function o(l,h){return t.getDependency("accessor",l).then(function(d){s.setAttribute(h,d)})}for(const l in n){const h=OS[l]||l.toLowerCase();h in s.attributes||i.push(o(n[l],h))}if(e.indices!==void 0&&!s.index){const l=t.getDependency("accessor",e.indices).then(function(h){s.setIndex(h)});i.push(l)}return Tn.workingColorSpace!==ta&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Tn.workingColorSpace}" not supported.`),Uo(s,e),CF(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?AF(s,e.targets,t):s})}const $a=(...s)=>{},RF=(...s)=>{},uC=({analyser:s})=>{const e=Ee.useRef(null),t=Ee.useRef(null);return Ee.useEffect(()=>{const n=e.current;if(!n)return;const i=n.getContext("2d",{alpha:!0});if(!i)return;let o,l=null;s&&(s.fftSize=128,l=new Uint8Array(s.frequencyBinCount));const h=()=>{o=requestAnimationFrame(h),(n.width!==n.offsetWidth||n.height!==n.offsetHeight)&&(n.width=n.offsetWidth,n.height=n.offsetHeight);const d=n.width,p=n.height;if(d===0||p===0)return;const _=p/2;i.clearRect(0,0,d,p),i.fillStyle="#1e293b";const v=2,x=v+2,b=d*.95,R=Math.floor(b/x);(!t.current||t.current.length!==R)&&(t.current=new Float32Array(R).fill(2));const T=R*x,M=(d-T)/2;s&&l&&s.getByteFrequencyData(l);const w=l?l.length:0,U=Math.floor(w*.7)/R,F=new Float32Array(R);for(let O=0;O<R;O++){let z=0;if(l&&U>0){const I=Math.floor(O*U),W=Math.floor((O+1)*U);for(let ae=I;ae<W;ae++){const ie=l[ae]||0;ie>z&&(z=ie)}}z<10&&(z=0);const k=z/255,N=z>0?Math.max(2,Math.pow(k,1.4)*p*.25):2;F[O]=N}for(let O=0;O<R;O++){const z=R-1-O,k=Math.max(F[O],F[z]),N=t.current[O]+(k-t.current[O])*.3;t.current[O]=N;const I=M+O*x,W=_-N/2;i.beginPath(),i.roundRect?i.roundRect(I,W,v,N,4):i.fillRect(I,W,v,N),i.fill()}};return h(),()=>{cancelAnimationFrame(o)}},[s]),Ht.jsx("canvas",{ref:e,style:{width:"100%",height:"100%",display:"block"}})},fC="https://ai.streamoji.com",wF="https://pub-48df6f7d60d6440bbd01676ea5d90e55.r2.dev",hC="https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/default-models/fullbodyavatarmale.glb";async function BF(s){const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(s));return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}function DF(s){const[e,t]=Ee.useState(null);return Ee.useEffect(()=>{if(!s){t(null);return}let n=!1;return BF(s).then(i=>{if(n)return;const o=`${wF}/${i}.glb`;fetch(o,{method:"HEAD"}).then(l=>{n||t(l.ok?o:hC)}).catch(()=>{n||t(hC)})}),()=>{n=!0}},[s]),e}const UF=["https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_001.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_002.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_002.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_005.glb"],NF=[{id:"m_expr_01",name:"Friendly Wave",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_001.glb"},{id:"m_expr_02",name:"You There",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_002.glb"},{id:"m_expr_04",name:"Awkward Agreement",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_004.glb"},{id:"m_expr_05",name:"What's Going On?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_005.glb"},{id:"m_expr_06",name:"Tired Stretch",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_006.glb"},{id:"m_expr_07",name:"Conceilied Laughter",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_007.glb"},{id:"m_expr_08",name:"You Come Here",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_008.glb"},{id:"m_expr_09",name:"Come Here Kid",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_009.glb"},{id:"m_expr_10",name:"Come Here Everyone",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_010.glb"},{id:"m_expr_11",name:"No Freaking Way",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_011.glb"},{id:"m_expr_12",name:"Cheerful Approval",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_012.glb"},{id:"m_expr_13",name:"Waving Hello",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_013.glb"},{id:"m_expr_14",name:"Checking Surroundings",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_014.glb"},{id:"m_expr_15",name:"Referee Warning",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_015.glb"},{id:"m_expr_16",name:"You Thumbs Down",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_016.glb"},{id:"m_expr_17",name:"Side Thumbs Down",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_017.glb"},{id:"m_expr_18",name:"You're Finished",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Standing_Expressions_018.glb"},{id:"m_talk_01",name:"Oh God, Why Me?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_001.glb"},{id:"m_talk_02",name:"What Are You Doing?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_002.glb"},{id:"m_talk_03",name:"What Am I doing?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_003.glb"},{id:"m_talk_04",name:"No Way",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_004.glb"},{id:"m_talk_05",name:"What's Going On?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_005.glb"},{id:"m_talk_06",name:"I have no idea",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_006.glb"},{id:"m_talk_07",name:"What's going on here?",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_007.glb"},{id:"m_talk_08",name:"Let's stop",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_008.glb"},{id:"m_talk_09",name:"Fed Up Moment",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_009.glb"},{id:"m_talk_10",name:"What's This? Hold On",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_010.glb"},{id:"f_talk_01",name:"Great Job Clap",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_001.glb"},{id:"f_talk_02",name:"Chill Stretch",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_002.glb"},{id:"f_talk_03",name:"This Is Me",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_003.glb"},{id:"f_talk_04",name:"Empathize",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_004.glb"},{id:"f_talk_05",name:"Loose Hands Stretch",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_005.glb"},{id:"f_talk_06",name:"Take It Easy",url:"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_006.glb"}],LF=["https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_005.glb","https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_007.glb"],OF={zoom:.85,position:[.15,-.8,0],scale:1.5,rotation:[.15,.02,0]},IF=[-.45,1.9,.1],FF={browInnerUp:.2},PS=.18,HF=1,m_={neutral:{eyeLookDownLeft:.1,eyeLookDownRight:.1},happy:{mouthSmileLeft:.2,mouthSmileRight:.2,eyeLookDownLeft:.1,eyeLookDownRight:.1},sad:{eyeLookDownLeft:.2,eyeLookDownRight:.2,browDownRight:.1,browInnerUp:.6,browOuterUpRight:.2,eyeSquintLeft:.7,eyeSquintRight:.7,mouthFrownLeft:.8,mouthFrownRight:.8,mouthLeft:.2,mouthPucker:.5,mouthRollLower:.2,mouthRollUpper:.2,mouthShrugLower:.2,mouthShrugUpper:.2,mouthStretchLeft:.4},angry:{eyeLookDownLeft:.1,eyeLookDownRight:.1,browDownLeft:.6,browDownRight:.6,jawForward:.3,mouthFrownLeft:.7,mouthFrownRight:.7,mouthRollLower:.2,mouthShrugLower:.3},fear:{browInnerUp:.7,eyeSquintLeft:.5,eyeSquintRight:.5,eyeWideLeft:.6,eyeWideRight:.6,mouthClose:.1,mouthFunnel:.3,mouthShrugLower:.5,mouthShrugUpper:.5},disgust:{browDownLeft:.7,browDownRight:.1,browInnerUp:.3,eyeSquintLeft:1,eyeSquintRight:1,eyeWideLeft:.5,eyeWideRight:.5,mouthLeft:.4,mouthPressLeft:.3,mouthRollLower:.3,mouthShrugLower:.3,mouthShrugUpper:.8,mouthUpperUpLeft:.3,noseSneerLeft:1,noseSneerRight:.7},love:{browInnerUp:.4,browOuterUpLeft:.2,browOuterUpRight:.2,mouthSmileLeft:.2,mouthSmileRight:.2,eyeBlinkLeft:.6,eyeBlinkRight:.6,eyeWideLeft:.7,eyeWideRight:.7,mouthDimpleLeft:.1,mouthDimpleRight:.1,mouthPressLeft:.2,mouthShrugUpper:.2,mouthUpperUpLeft:.1,mouthUpperUpRight:.1}},PF=[{key:"viseme_aa",mix:{jawOpen:.6}},{key:"viseme_E",mix:{mouthPressLeft:.8,mouthPressRight:.8,mouthDimpleLeft:1,mouthDimpleRight:1,jawOpen:.3}},{key:"viseme_I",mix:{mouthPressLeft:.6,mouthPressRight:.6,mouthDimpleLeft:.6,mouthDimpleRight:.6,jawOpen:.2}},{key:"viseme_O",mix:{mouthPucker:1,jawForward:.6,jawOpen:.2}},{key:"viseme_U",mix:{mouthFunnel:1}},{key:"viseme_PP",mix:{mouthRollLower:.3,mouthRollUpper:.3,mouthUpperUpLeft:.3,mouthUpperUpRight:.3}},{key:"viseme_FF",mix:{mouthPucker:1,mouthShrugUpper:1,mouthLowerDownLeft:.2,mouthLowerDownRight:.2,mouthDimpleLeft:1,mouthDimpleRight:1,mouthRollLower:.3}},{key:"viseme_DD",mix:{mouthPressLeft:.8,mouthPressRight:.8,mouthFunnel:.5,jawOpen:.2}},{key:"viseme_SS",mix:{mouthPressLeft:.8,mouthPressRight:.8,mouthLowerDownLeft:.5,mouthLowerDownRight:.5,jawOpen:.1}},{key:"viseme_TH",mix:{mouthRollUpper:.3,jawOpen:.2,tongueOut:.4}},{key:"viseme_CH",mix:{mouthPucker:.5,jawOpen:.2}},{key:"viseme_RR",mix:{mouthPucker:.5,jawOpen:.2}},{key:"viseme_kk",mix:{mouthLowerDownLeft:.4,mouthLowerDownRight:.4,mouthDimpleLeft:.3,mouthDimpleRight:.3,mouthFunnel:.3,mouthPucker:.3,jawOpen:.15}},{key:"viseme_nn",mix:{mouthLowerDownLeft:.4,mouthLowerDownRight:.4,mouthDimpleLeft:.3,mouthDimpleRight:.3,mouthFunnel:.3,mouthPucker:.3,jawOpen:.15,tongueOut:.2}},{key:"viseme_sil",mix:{}}],GF={aei:[{v:"E",w:.8},{v:"I",w:.2}],ee:[{v:"I",w:1}],oo:[{v:"O",w:1}],u:[{v:"U",w:1}],aa:[{v:"aa",w:1}],ah:[{v:"aa",w:.7},{v:"O",w:.3}],bmp:[{v:"PP",w:1}],fv:[{v:"FF",w:1}],th:[{v:"TH",w:1}],l:[{v:"nn",w:1}],r:[{v:"RR",w:1}],qw:[{v:"U",w:.6},{v:"O",w:.4}],chjsh:[{v:"CH",w:1}],cdgknstxyz:[{v:"DD",w:.6},{v:"SS",w:.4}],sil:[{v:"sil",w:1}]};function zF(s){if(!s)return[{v:"sil",w:1}];const e=s.toLowerCase();return GF[e]??[{v:"sil",w:1}]}function VF({target:s}){const{camera:e}=Ih();return Ee.useEffect(()=>{e.lookAt(...s)},[e,s]),null}function Gs(s,e,t){if(!s||!s.morphTargetDictionary)return;const n=s,i=n.morphTargetDictionary,o=n.morphTargetInfluences;if(o)for(const l in i)l.toLowerCase()===e.toLowerCase()&&(o[i[l]]=t)}function dC(s,e=.97){if(!s)return;const t=s;if(t.morphTargetInfluences)for(let n=0;n<t.morphTargetInfluences.length;n++)t.morphTargetInfluences[n]*=e}const kF=Ee.memo(({avatarUrl:s,isPlayingRef:e,visemeQueueRef:t,audioContextRef:n,responseAudioStartTimeRef:i,adjustments:o,mood:l,expression:h,agentResponse:d,isSpeaking:p,nextStartTimeRef:_,stopPlayback:v,setIsSpeaking:y,expressionUrl:x,onExpressionFinished:b})=>{const{scene:R}=zh(s),T=zh(UF),M=Ee.useMemo(()=>T.flatMap($=>$.animations),[T]),w=zh(LF),D=Ee.useMemo(()=>w.flatMap($=>$.animations),[w]),U=Ee.useRef(null),F=Ee.useRef(null),O=Ee.useRef(null),z=Ee.useRef([]),[k]=Ee.useState(()=>new nE(R)),N=Ee.useRef({}),I=Ee.useRef(null),W=Ee.useRef(0),ae=Ee.useRef(!1),ie=Ee.useRef(0),se=Ee.useRef(null);Ee.useEffect(()=>{if(!(!M||!R)){if(M.forEach(($,ue)=>{const re=`idle_${ue}`;if(!N.current[re]){const X=k.clipAction($,R);X.name=re,X.setLoop(cp,1),X.clampWhenFinished=!0,N.current[re]=X}}),D.forEach(($,ue)=>{const re=`talk_${ue}`;if(!N.current[re]){const X=k.clipAction($,R);X.name=re,X.setLoop(cp,1),X.clampWhenFinished=!0,N.current[re]=X}}),M.length>0){const $=N.current.idle_0,ue=I.current&&k.existingAction(I.current.getClip());$&&!ue&&($.reset().fadeIn(.5).play(),I.current=$)}return()=>{k.stopAllAction(),N.current={},I.current=null}}},[M,D,R,k]);const _e=Ee.useRef("");Ee.useEffect(()=>{if(!x||!R||x===_e.current)return;_e.current=x,se.current=x,new qI().load(x,ue=>{if(ue.animations&&ue.animations.length>0){const re=ue.animations[0],X=k.clipAction(re,R);if(X.name=`EXPR_${x}`,X.setLoop(cp,1),X.clampWhenFinished=!0,N.current[`EXPR_${x}`]=X,p&&se.current===x){const ne=I.current;X.reset().fadeIn(.3).play(),ne&&ne!==X&&ne.crossFadeTo(X,.3,!0),I.current=X,se.current=null}}},void 0,ue=>{console.error(`[ANIMATION] Failed to load ${x}`,ue)})},[x,R,k,p]),Ee.useEffect(()=>{const $=ue=>{const re=ue.action,X=re.name||"";if(X.startsWith("idle_")){const Ae=(parseInt(X.split("_")[1])+1)%M.length,Re=N.current[`idle_${Ae}`];Re&&(Re.reset().fadeIn(.5).play(),re.crossFadeTo(Re,.5,!0),I.current=Re)}else if(X.startsWith("EXPR_")){if(p){const ne=N.current.talk_0;ne&&(ne.reset().fadeIn(.5).play(),re.crossFadeTo(ne,.5,!0),I.current=ne)}else{const ne=N.current.idle_0;ne&&(ne.reset().fadeIn(.5).play(),re.crossFadeTo(ne,.5,!0),I.current=ne)}b&&b()}else if(X.startsWith("talk_"))if(p){const Ae=(parseInt(X.split("_")[1])+1)%D.length,Re=N.current[`talk_${Ae}`];Re&&(Re.reset().fadeIn(.3).play(),re.crossFadeTo(Re,.3,!0),I.current=Re)}else{const ne=N.current.idle_0;ne&&(ne.reset().fadeIn(.5).play(),re.crossFadeTo(ne,.5,!0),I.current=ne)}};return k.addEventListener("finished",$),()=>k.removeEventListener("finished",$)},[k,M,D,p,b]),Ee.useEffect(()=>{if(p&&R){const $=I.current,ue=$?.name||"";if(ue.startsWith("idle_")||ue.startsWith("talk_")||ue===""){const re=se.current;if(re){const X=N.current[`EXPR_${re}`];if(X){X.reset().fadeIn(.3).play(),$&&$!==X&&$.crossFadeTo(X,.3,!0),I.current=X,se.current=null;return}}if(ue.startsWith("idle_")||ue===""){const X=N.current.talk_0;X&&(X.reset().fadeIn(.5).play(),$&&$.crossFadeTo(X,.5,!0),I.current=X)}}}else if(!p&&R){const $=I.current,ue=$?.name||"";if(ue.startsWith("talk_")||ue.startsWith("EXPR_")){const re=N.current.idle_0;re&&(re.reset().fadeIn(.5).play(),$&&$.crossFadeTo(re,.5,!0),I.current=re)}}},[p,R,x]),Ee.useEffect(()=>{if(!R)return;R.traverse(re=>{if(re.isMesh&&re.morphTargetDictionary){const X=re.name.toLowerCase();(X.includes("head")||X.includes("avatar"))&&(F.current=re,$a(`[ANIMATION] Found head mesh: ${re.name}`)),X.includes("teeth")&&(O.current=re,$a(`[ANIMATION] Found teeth mesh: ${re.name}`))}});const $=F.current?.morphTargetDictionary;$&&Object.keys($).filter(re=>re.toLowerCase().includes("brow"));const ue=[];R.traverse(re=>{if(re.isMesh){const ne=re.morphTargetDictionary;ne&&Object.keys(ne).some(Ae=>Ae.toLowerCase().includes("brow"))&&ue.push(re)}}),z.current=ue,ue.length>0&&$a("[ANIMATION] Meshes with brow morphs:",ue.length)},[R]);const H=($,ue=1)=>{const re=`viseme_${$}`.toLowerCase(),X=PF.find(ne=>ne.key.toLowerCase()===re);if(X)for(const ne in X.mix){const Ae=X.mix[ne]*ue;Gs(F.current,ne,Ae),Gs(O.current,ne,Ae)}},K=$=>{const ue=m_[$]??m_.neutral;for(const re in ue)Gs(F.current,re,ue[re]),Gs(O.current,re,ue[re])};return _T(($,ue)=>{const re=Math.pow(.88,60*ue);dC(F.current,re),dC(O.current,re),K(l);const X=$.clock.elapsedTime;let ne=0;if(Math.floor(X)%5===0&&Math.floor((X-ue)%5)!==0){let Ge=null;R.traverse(ee=>{ee.name.toLowerCase().includes("hips")&&(Ge=ee)});const ft=Ge?`Hips Y: ${Ge.position.y.toFixed(4)}`:"Hips not found";$a(`[ANIMATION] Mixer Time: ${k.time.toFixed(2)}, ${ft}`)}if(k.update(ue),X>W.current&&!ae.current&&(ae.current=!0,ie.current=X),ae.current){const ft=(X-ie.current)/.3;if(ft>=1)ae.current=!1,W.current=X+2+Math.random()*5;else{const ee=ft<.5?ft*2:(1-ft)*2;Gs(F.current,"eyeBlinkLeft",ee),Gs(F.current,"eyeBlinkRight",ee),Gs(O.current,"eyeBlinkLeft",ee),Gs(O.current,"eyeBlinkRight",ee),ne=ee*FF.browInnerUp}}const Ae=m_[l]??m_.neutral,Re=Ae.browInnerUp??0,rt=Ae.browOuterUpLeft??0,ve=Ae.browOuterUpRight??0,Be=X*HF,st=PS*Math.sin(Be),xt=PS*.7*Math.sin(Be+.7),Mt=PS*.7*Math.sin(Be+1.3),$t=Ge=>Math.max(0,Math.min(1,Ge)),un=$t(Re+st),Vt=$t(rt+xt),Ve=$t(ve+Mt),nt=$t(un+ne);if(Gs(F.current,"browInnerUp",nt),Gs(O.current,"browInnerUp",nt),Gs(F.current,"browOuterUpLeft",Vt),Gs(O.current,"browOuterUpLeft",Vt),Gs(F.current,"browOuterUpRight",Ve),Gs(O.current,"browOuterUpRight",Ve),U.current){const Ge=e.current?0:o.rotation[1];U.current.rotation.y=E0.lerp(U.current.rotation.y,Ge,.1),U.current.position.set(...o.position),U.current.scale.setScalar(o.scale),U.current.rotation.x=o.rotation[0],U.current.rotation.z=o.rotation[2]}if(e.current&&n.current){const Ge=n.current.currentTime,Nt=(Ge-i.current)*1e3- -150;for(let pt=0;pt<t.current.length;pt++){const Lt=t.current[pt];Nt>=Lt.vtime&&Nt<Lt.vtime+Lt.vduration&&H(Lt.viseme,Lt.weight??1)}Ge>_.current+.5&&(v(),y(!1))}}),Ht.jsx("group",{ref:U,children:Ht.jsx("primitive",{object:R})})});function XF(s){return s?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():""}const YF=({token:s,agentToken:e,onNavigationRequested:t}={})=>{const n=s??e??"",i=DF(n||void 0),[o,l]=Ee.useState(""),[h,d]=Ee.useState(""),[p,_]=Ee.useState("Ready"),[v,y]=Ee.useState(!1),[x,b]=Ee.useState(!1),[R,T]=Ee.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 480px)").matches:!1);Ee.useEffect(()=>{const j=window.matchMedia("(max-width: 480px)"),de=()=>T(j.matches);return j.addEventListener("change",de),()=>j.removeEventListener("change",de)},[]);const M=R?80:600,w=Ee.useRef(!1),D=Ee.useRef([]),U=Ee.useRef(0),F=Ee.useRef(!1),O=Ee.useRef([]),z=Ee.useRef(null),k=Ee.useRef([]);Ee.useRef([]);const N=Ee.useRef([]),I=Ee.useRef(0),W=Ee.useRef(0),ae=Ee.useRef(0),ie=Ee.useRef(0),se=Ee.useRef(!1),[_e,H]=Ee.useState(null),K=Ee.useRef(null),[$,ue]=Ee.useState("neutral"),[re,X]=Ee.useState(""),[ne,Ae]=Ee.useState(""),[Re,rt]=Ee.useState("Chat with us"),[ve,Be]=Ee.useState(null),[st,xt]=Ee.useState("hidden"),[Mt,$t]=Ee.useState(""),un=Ee.useRef(null),Vt=Ee.useRef(st);Vt.current=st;const[Ve,nt]=Ee.useState(null),Ge=Ee.useRef(null),ft=Ee.useRef(null),[ee,Nt]=Ee.useState("hidden"),[pt,Lt]=Ee.useState(""),gt=Ee.useRef(ee);gt.current=ee;const Z=Ee.useRef(""),P=Ee.useRef(!1),me=Ee.useRef(""),Le=Ee.useMemo(()=>p==="Thinking..."||p==="Processing Voice..."?p:ve!=null&&ve!==""&&ve!=="none"&&ve!=="<none>"?`Enter ${XF(ve)}`:null,[p,ve]),Xe=Le!=null&&Le!=="";Ee.useEffect(()=>{const j=Vt.current;if(!(j==="exiting"||j==="entering")){if(j==="hidden"){Xe&&($t(Le??""),xt("entering"));return}j==="visible"&&(!Xe||Le!==Mt)&&(un.current=Xe?Le:null,xt("exiting"))}},[Xe,Le,st,Mt]);const Fe=Ee.useCallback(()=>{const j=Vt.current;if(j==="exiting"){xt("hidden");const de=un.current;un.current=null,de!=null&&de!==""&&($t(de),xt("entering"))}else j==="entering"&&xt("visible")},[]),Bt=j=>{if(!j)return;if(j.mood!=null){const Ue=String(j.mood).toLowerCase();ue(Ue)}if(j.expression!=null){const Ue=String(j.expression).trim();X(Ue);const Ie=NF.find(ze=>ze.name.toLowerCase()===Ue.toLowerCase());$a(`[STREAM] Animation match for "${Ue}": ${Ie?Ie.name:"NONE"}`),Ae(Ie?.url??"")}if(j.navigation!=null){const Ue=String(j.navigation).trim();Ue!==""&&(t?t(Ue):window.open(Ue,"_blank"))}const de=j.ask_for||j.lead_capture?.ask_for,ye=de?String(de).trim().toLowerCase():"",xe=ye==="none"||ye==="<none>";if(de&&!xe){const Ue=ye;Be(Ue||null),rt(Ue==="email"?"Enter your email":Ue==="name"?"Enter your name":Ue==="phone"?"Enter your phone number":"Chat with us")}else(xe||j.ask_for===null||j.lead_capture&&j.lead_capture.ask_for===null||j.ask_for==="none")&&(Be(null),Re!=="Chat with us"&&rt("Chat with us"));j.collected,j.valid},_t=j=>{const de=j.trim();if(!de)return null;if(de.startsWith("{"))try{return JSON.parse(de)}catch{return null}if(de.includes(":")){const ye=de.split(":"),xe=ye[0].trim().toLowerCase(),Ue=ye.slice(1).join(":").trim();return{[xe]:Ue}}return null},Ot=Ee.useCallback(()=>{},[]),kt=j=>{if(P.current)j==="§"?P.current=!1:(me.current+=j,d(de=>de+j));else if(j==="§"){P.current=!0;return}else for(Z.current+=j;Z.current.includes(`
|
|
4150
4150
|
`);){const de=Z.current.indexOf(`
|
|
4151
4151
|
`),ye=Z.current.slice(0,de).trim();Z.current=Z.current.slice(de+1);const xe=_t(ye);xe&&Bt(xe)}};Ee.useEffect(()=>{(async()=>{if(!sessionStorage.getItem("STREAMOJI_LEADS_SESSION_LEAD_ID")){const ye="secret",xe=Math.floor(Date.now()/1e3).toString();try{const Ue=new TextEncoder,Ie=await crypto.subtle.importKey("raw",Ue.encode(ye),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),ze=await crypto.subtle.sign("HMAC",Ie,Ue.encode(xe)),at=Array.from(new Uint8Array(ze)).map(Je=>Je.toString(16).padStart(2,"0")).join("");sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",at),$a("[SESSION] New HMAC UID generated and saved:",at)}catch(Ue){console.error("[SESSION] HMAC generation failed:",Ue);const Ie=Math.random().toString(36)+Date.now().toString();sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",Ie)}}sessionStorage.getItem("STREAMOJI_LEADS_SESSION_MESSAGES")||sessionStorage.setItem("STREAMOJI_LEADS_SESSION_MESSAGES",JSON.stringify([]))})()},[]);const Ke=()=>{try{return JSON.parse(sessionStorage.getItem("STREAMOJI_LEADS_SESSION_MESSAGES")||"[]")}catch{return[]}},Qe=j=>{sessionStorage.setItem("STREAMOJI_LEADS_SESSION_MESSAGES",JSON.stringify(j))},[St,yt]=Ee.useState(!1),[lt,Ft]=Ee.useState(0),pe=Ee.useRef(null),De=Ee.useRef([]),ot=Ee.useRef(0),[bt,it]=Ee.useState(null),[qe,mt]=Ee.useState(null),zt=Ee.useRef(null),hn=Ee.useRef(null),dn=Ee.useCallback((j=!1)=>{j&&(se.current=!0,y(!1),_("Ready")),O.current=[],D.current=[],F.current=!1,b(!1),I.current=0,W.current=0,ae.current=0,k.current.forEach(de=>{try{de.stop()}catch{}}),Ge.current&&(clearTimeout(Ge.current),Ge.current=null),nt(null),Ae(""),k.current=[]},[]),Di=async()=>{try{const j=await navigator.mediaDevices.getUserMedia({audio:!0}),de=window.AudioContext||window.webkitAudioContext,ye=new de,xe=ye.createMediaStreamSource(j),Ue=ye.createAnalyser();Ue.fftSize=64,xe.connect(Ue),zt.current=ye,hn.current=xe,mt(Ue);const Ie=new MediaRecorder(j);pe.current=Ie,De.current=[],Ie.ondataavailable=ze=>{ze.data.size>0&&De.current.push(ze.data)},Ie.onstop=async()=>{const ze=Date.now()-ot.current;if(mt(null),hn.current&&(hn.current.disconnect(),hn.current=null),zt.current&&zt.current.state!=="closed"&&(zt.current.close(),zt.current=null),ze<1e3){_("Recording too short. Hold or click longer."),y(!1);return}const Pe=new Blob(De.current,{type:"audio/wav"});await wa(Pe)},ot.current=Date.now(),Ie.start(100),yt(!0),_("Listening...")}catch(j){console.error("Error accessing microphone:",j),_("Mic Access Error")}},Ra=()=>{pe.current&&pe.current.state!=="inactive"&&(pe.current.stop(),pe.current.stream.getTracks().forEach(j=>j.stop()),yt(!1))},eo=()=>{pe.current&&pe.current.state!=="inactive"&&(pe.current.onstop=null,pe.current.stop(),pe.current.stream.getTracks().forEach(j=>j.stop()),mt(null),hn.current&&(hn.current.disconnect(),hn.current=null),zt.current&&zt.current.state!=="closed"&&(zt.current.close(),zt.current=null),yt(!1),De.current=[],_("Ready"))};Ee.useEffect(()=>{if(!x)return;const j=()=>{const de=ae.current;if(de<=0)return;const ye=z.current,xe=I.current;if(!ye)return;const Ue=ye.currentTime-xe,Ie=Math.min(Math.max(0,Ue),de),ze=h.trim().length;if(ze<=0)return;const Pe=Math.min(Math.round(Ie/de*ze),ze);H(Pe)};return clearInterval(K.current??void 0),K.current=setInterval(j,90),()=>clearInterval(K.current??void 0)},[x,h,ae.current]),Ee.useEffect(()=>{let j;return St?(Ft(0),j=window.setInterval(()=>{Ft(de=>de+1)},1e3)):Ft(0),()=>clearInterval(j)},[St]);const ir=j=>{const de=j.numberOfChannels,ye=j.length*de*2+44,xe=new ArrayBuffer(ye),Ue=new DataView(xe);let Ie=0;const ze=V=>{Ue.setUint16(Ie,V,!0),Ie+=2},Pe=V=>{Ue.setUint32(Ie,V,!0),Ie+=4};Pe(1179011410),Pe(ye-8),Pe(1163280727),Pe(544501094),Pe(16),ze(1),ze(de),Pe(j.sampleRate),Pe(j.sampleRate*2*de),ze(de*2),ze(16),Pe(1635017060),Pe(ye-Ie-4);const at=[];for(let V=0;V<de;V++)at.push(j.getChannelData(V));let Je=0;for(;Ie<ye;){for(let V=0;V<de;V++){let te=Math.max(-1,Math.min(1,at[V][Je]));te=te<0?te*32768:te*32767,Ue.setInt16(Ie,te,!0),Ie+=2}Je++}return new Blob([xe],{type:"audio/wav"})},ma=async(j,de,ye=!1)=>{if(!se.current){if(w.current){D.current.push({audio:j,visemes:de,isNewSegment:ye});return}w.current=!0;try{const xe=window.AudioContext||window.webkitAudioContext,Ue=z.current??new xe;Ue.state==="suspended"&&await Ue.resume(),z.current=Ue;const Ie=window.atob(j),ze=new Uint8Array(Ie.length);for(let oe=0;oe<Ie.length;oe++)ze[oe]=Ie.charCodeAt(oe);const Pe=await Ue.decodeAudioData(ze.buffer.slice(0));ae.current+=Pe.duration;const at=Ue.currentTime;let Je=W.current;const V=!F.current;Je<at&&(Je=at+.1),W.current=Je+Pe.duration;const te=Ue.createBufferSource();te.buffer=Pe;let fe=bt;if((!fe||fe.context!==Ue)&&(fe=Ue.createAnalyser(),fe.fftSize=64,fe.connect(Ue.destination),it(fe)),te.connect(fe),k.current.push(te),se.current){k.current=k.current.filter(oe=>oe!==te);return}if(V){F.current=!0,b(!0),$a(`[AUDIO] setIsSpeaking(true) - First chunk starting at ${Je.toFixed(3)}`),I.current=Je;const oe=(Je-at)*1e3;U.current=performance.now()+oe,$a(`[AUDIO] Response started. Initial startTime: ${Je.toFixed(3)}, CT: ${at.toFixed(3)}`)}te.start(Je);const he=(Je-I.current)*1e3;ye&&(ie.current=he,$a(`[AUDIO] New segment detected at +${he.toFixed(0)}ms. Resetting segment offset.`)),de.forEach((oe,We)=>{const je=oe.symbol??"";if(je){const tt=zF(je),ht=Math.round(oe.start*1e3),ct=Math.round((oe.duration??0)*1e3),It=ie.current+ht;We<3&&$a(`[AUDIO] Viseme "${je}": segment_relative=${ht}ms, segment_offset=${ie.current.toFixed(0)}ms => vtime=${It}ms`),tt.forEach(dt=>{O.current.push({viseme:dt.v,weight:dt.w,vtime:It,vduration:ct})})}}),_("Speaking...")}finally{if(w.current=!1,D.current.length>0){const xe=D.current.shift();xe&&ma(xe.audio,xe.visemes,xe.isNewSegment)}}}},wa=async j=>{try{y(!0),me.current="",d(""),_("Processing Voice...");const de=await j.arrayBuffer(),xe=await new(window.AudioContext||window.webkitAudioContext)().decodeAudioData(de),Ue=ir(xe),Ie=new FileReader;Ie.readAsDataURL(Ue),Ie.onloadend=async()=>{const ze=Ie.result.split(",")[1];dn(),l(""),Z.current="",P.current=!1;const Pe=`${fC}/stt?token=${encodeURIComponent(n)}`,at=await fetch(Pe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({audio_base64:ze,audio_format:"wav"})});if(!at.ok){const We=await at.text();let je="STT Failed";try{je=JSON.parse(We).error||je}catch{We&&(je=We.slice(0,200))}throw new Error(je)}const Je=at.body;if($a("this is body"+Je),!Je){_("STT Failed"),y(!1);return}const V=Je.getReader();se.current=!1;const te=new TextDecoder;let fe="",he=!1;const oe=async(We,je)=>{switch(We){case"transcript":je.transcript!=null&&l(String(je.transcript));break;case"text":{const tt=je.delta??je.text??"";tt&&kt(tt);break}case"audio":{const tt=je.chunk,ht=je.visemes??[],ct=!!je.is_new_segment;tt&&await ma(tt,ht,ct);break}case"done":{he=!0,_("Ready"),y(!1);break}case"error":{he=!0,_("STT Failed"),y(!1);break}default:break}};for(;;){const{done:We,value:je}=await V.read();je&&(fe+=te.decode(je,{stream:!0}));const tt=fe.split(`
|
|
4152
4152
|
|
|
4153
4153
|
`);fe=tt.pop()??"";for(const ht of tt){const ct=gi(ht);ct&&await oe(ct.event,ct.data)}if(We){if(fe.trim()){const ht=gi(fe.trim());ht&&await oe(ht.event,ht.data)}he||(_("Ready"),y(!1));break}}}}catch(de){console.error("Audio Submission Error:",de),_("STT Failed"),y(!1)}},Ga=async j=>{j&&j.preventDefault(),me.current="",d(""),!(!o||v)&&await ki(o)},gi=j=>{const de=j.split(/\r?\n/);let ye="",xe="";for(const Ie of de)Ie.startsWith("event:")?ye=Ie.slice(6).trim():Ie.startsWith("data:")&&(xe=Ie.slice(5).trim());if(!ye)return null;let Ue={};if(xe)try{Ue=JSON.parse(xe)}catch{Ue={raw:xe}}return{event:ye,data:Ue}},qt=(j,de)=>{switch(j){case"connected":Z.current="",P.current=!1;break;case"text":{const ye=de.delta??"";ye&&kt(ye);break}case"audio":{const ye=de.chunk,xe=de.visemes??[];ye&&ma(ye,xe);break}case"done":{const ye=Ke(),xe=me.current.trim(),Ue=[...ye,{role:"user",content:o||"..."},{role:"assistant",content:xe}];Qe(Ue),N.current=[...O.current],_("Ready"),y(!1),l("");break}case"error":{const ye=de.message??"Unknown error";me.current=ye,d(ye),_("Agent Failed"),y(!1);break}}},ki=async j=>{y(!0),_("Thinking..."),me.current="",Z.current="",P.current=!1,dn(),ae.current=0,H(0);const de=`${fC}/agent/chat?token=${encodeURIComponent(n)}`;try{const ye=Ke();let xe=sessionStorage.getItem("STREAMOJI_LEADS_SESSION_LEAD_ID");xe||(RF("[CHAT] Session UID missing at send time! Generating emergency backup."),xe="emergency-"+Math.random().toString(36).substring(7),sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",xe));const Ue={history:ye,question:j,lead_id:xe};$a("[CHAT] Sending payload:",Ue);const Ie=await fetch(de,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ue),cache:"default"});if(!Ie.ok)throw new Error("Agent request failed");const ze=Ie.body;if(!ze){_("Agent Failed"),y(!1);return}const Pe=ze.getReader();se.current=!1;const at=new TextDecoder;let Je="";for(;;){const{done:V,value:te}=await Pe.read();$a(`[SSE] Chunk received. done=${V}, length=${te?.length||0}`),te&&(Je+=at.decode(te,{stream:!0}));const fe=Je.split(`
|
|
4154
4154
|
|
|
4155
|
-
`);Je=fe.pop()??"";for(const he of fe){$a(`[SSE] Processing block: ${he.slice(0,50)}...`);const oe=gi(he);oe&&($a(`[SSE] Event: ${oe.event}`),qt(oe.event,oe.data))}if(V){if($a("[SSE] Stream finished"),Je.trim()){const he=gi(Je.trim());he&&qt(he.event,he.data)}_("Ready"),y(!1),l("");break}}}catch(ye){console.error("Chat Error:",ye),_("Agent Failed"),y(!1)}},ln=h.trim(),G=ln&&x?ln.slice(0,_e!=null&&_e>0?_e:0):"";Ee.useEffect(()=>{const j=gt.current;j!=="exiting"&&(G?(Lt(G),j==="hidden"&&Nt("entering")):(j==="visible"||j==="entering")&&Nt("exiting"))},[G,ee]);const q=Ee.useCallback(()=>{const j=gt.current;j==="entering"?Nt("visible"):j==="exiting"&&Nt("hidden")},[]);return Ee.useLayoutEffect(()=>{const j=ft.current;j&&(j.scrollTop=j.scrollHeight)},[pt]),
|
|
4155
|
+
`);Je=fe.pop()??"";for(const he of fe){$a(`[SSE] Processing block: ${he.slice(0,50)}...`);const oe=gi(he);oe&&($a(`[SSE] Event: ${oe.event}`),qt(oe.event,oe.data))}if(V){if($a("[SSE] Stream finished"),Je.trim()){const he=gi(Je.trim());he&&qt(he.event,he.data)}_("Ready"),y(!1),l("");break}}}catch(ye){console.error("Chat Error:",ye),_("Agent Failed"),y(!1)}},ln=h.trim(),G=ln&&x?ln.slice(0,_e!=null&&_e>0?_e:0):"";Ee.useEffect(()=>{const j=gt.current;j!=="exiting"&&(G?(Lt(G),j==="hidden"&&Nt("entering")):(j==="visible"||j==="entering")&&Nt("exiting"))},[G,ee]);const q=Ee.useCallback(()=>{const j=gt.current;j==="entering"?Nt("visible"):j==="exiting"&&Nt("hidden")},[]);return Ee.useLayoutEffect(()=>{const j=ft.current;j&&(j.scrollTop=j.scrollHeight)},[pt]),Ht.jsxs("div",{className:"avatar-widget-container",children:[Ht.jsxs("div",{className:"avatar-input-area",children:[st!=="hidden"?Ht.jsx("div",{className:`avatar-thinking-tab${st==="exiting"?" avatar-thinking-tab--exiting":st==="entering"?" avatar-thinking-tab--entering":""}`,onAnimationEnd:Fe,children:Mt}):null,Ht.jsx("div",{className:"avatar-input-container",children:Ht.jsx("div",{style:{display:"flex",alignItems:"center",width:"100%",height:"100%"},children:St?Ht.jsxs("div",{className:"avatar-input-recording",children:[Ht.jsx("button",{type:"button",className:"avatar-recording-cancel",onClick:eo,title:"Cancel",children:Ht.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[Ht.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ht.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),Ht.jsxs("div",{style:{flex:1,height:"100%",position:"relative",display:"flex",alignItems:"center",minWidth:0},children:[Ht.jsx("div",{style:{flex:1,height:"100%"},children:Ht.jsx(uC,{analyser:qe})}),Ht.jsxs("span",{style:{fontSize:"0.75rem",color:"#64748b",fontWeight:500,marginLeft:"4px",minWidth:"32px",textAlign:"right",fontVariantNumeric:"tabular-nums"},children:[Math.floor(lt/60),":",String(lt%60).padStart(2,"0")]})]}),Ht.jsx("button",{type:"button",className:"avatar-recording-confirm",onClick:Ra,title:"Send",children:Ht.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:Ht.jsx("polyline",{points:"20 6 9 17 4 12"})})})]}):x?Ht.jsxs("div",{className:"avatar-input-speaking",children:[Ht.jsx("div",{style:{flex:1,height:"100%",display:"flex",alignItems:"center",paddingRight:"8px"},children:Ht.jsx(uC,{analyser:bt})}),Ht.jsx("button",{type:"button",className:"avatar-speaking-stop",onClick:()=>dn(!0),title:"Stop",children:Ht.jsx("span",{className:"avatar-speaking-stop__icon","aria-hidden":!0})})]}):v?Ht.jsx("div",{style:{flex:1,height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:Ht.jsx("div",{className:"avatar-input-loader"})}):Ht.jsxs("form",{onSubmit:Ga,style:{flex:1,display:"flex",height:"100%",alignItems:"center"},children:[Ht.jsx("input",{id:"avatar-text-input",type:"text",value:o,onChange:j=>l(j.target.value),placeholder:"Ask me anything",disabled:v,autoComplete:"off",style:{width:"100%",height:"100%"}}),o.trim()===""?Ht.jsx("button",{type:"button",className:"mic-button",onClick:Di,disabled:v,style:{backgroundColor:"#1e4a5e"},children:Ht.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Ht.jsx("path",{d:"M12 14C13.66 14 15 12.66 15 11V5C15 3.34 13.66 2 12 2C10.34 2 9 3.34 9 5V11C9 12.66 10.34 14 12 14Z",fill:"white"}),Ht.jsx("path",{d:"M17 11C17 13.76 14.76 16 12 16C9.24 16 7 13.76 7 11H5C5 14.53 7.61 17.43 11 17.93V21H13V17.93C16.39 17.43 19 14.53 19 11H17Z",fill:"white"})]})}):Ht.jsx("button",{type:"submit",className:"mic-button",disabled:v,style:{backgroundColor:"#1e4a5e"},title:"Send",children:Ht.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:Ht.jsx("path",{d:"M19 12H5M19 12L14 17M19 12L14 7",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})})})]}),Ht.jsx("div",{className:"avatar-wrapper",children:Ht.jsxs("div",{className:"avatar-scene-wrapper",children:[ee!=="hidden"&&Ht.jsx("div",{className:`avatar-bubble${ee==="entering"?" avatar-bubble--entering":ee==="exiting"?" avatar-bubble--exiting":""}`,onAnimationEnd:q,children:Ht.jsx("div",{ref:ft,className:"avatar-bubble__content",children:pt})}),Ht.jsx("div",{className:"avatar-canvas-layer",style:{width:M,height:M},children:Ht.jsxs(wO,{shadows:!0,camera:{position:[.2,1.4,3],fov:42},gl:{alpha:!0},dpr:1.8,style:{pointerEvents:"none",width:"100%",height:"100%"},children:[Ht.jsx(VF,{target:IF}),Ht.jsx("ambientLight",{intensity:.7}),Ht.jsx("directionalLight",{position:[0,2,2],intensity:1}),Ht.jsx(JI,{preset:"city"}),Ht.jsx(Ee.Suspense,{fallback:null,children:i!==null&&Ht.jsx(kF,{avatarUrl:i,isPlayingRef:F,visemeQueueRef:O,audioContextRef:z,responseAudioStartTimeRef:I,adjustments:OF,mood:$,expression:re,agentResponse:h,isSpeaking:x,nextStartTimeRef:W,stopPlayback:dn,setIsSpeaking:b,expressionUrl:ne,onExpressionFinished:Ot})})]})})]})})]})},JF=({token:s,onNavigationRequested:e})=>Ht.jsx(YF,{token:s,onNavigationRequested:e}),pC="streamoji-leads-avatar-widget-root";function mC(s){const{token:e}=s;let t=document.getElementById(pC);if(!t){t=document.createElement("div"),t.id=pC,t.style.cssText="position:fixed;bottom:0;right:0;z-index:9999;pointer-events:none;";const i=document.createElement("div");i.style.cssText="pointer-events:auto;",t.appendChild(i),document.body.appendChild(t),t=i}mR.createRoot(t).render(MM.createElement(JF,{token:e||""}))}return window.StreamojiLeadsAvatarWidget={init:mC},Oy.init=mC,Object.defineProperty(Oy,Symbol.toStringTag,{value:"Module"}),Oy})({});
|
|
4156
4156
|
//# sourceMappingURL=avatar-widget.umd.js.map
|