1
0
Fork 0
forked from Simnation/Main
Main/resources/[tools]/tgiann-attachproptoplayereditor/web/dist/assets/index.4b31427f.js
2025-07-14 15:59:33 +02:00

3497 lines
924 KiB
JavaScript

(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerpolicy&&(s.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?s.credentials="include":r.crossorigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();var Qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var d0={},MM={exports:{}},Fi={},Te={exports:{}},Mt={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Wc=Symbol.for("react.element"),sC=Symbol.for("react.portal"),oC=Symbol.for("react.fragment"),aC=Symbol.for("react.strict_mode"),lC=Symbol.for("react.profiler"),uC=Symbol.for("react.provider"),cC=Symbol.for("react.context"),fC=Symbol.for("react.forward_ref"),hC=Symbol.for("react.suspense"),dC=Symbol.for("react.memo"),pC=Symbol.for("react.lazy"),S1=Symbol.iterator;function mC(n){return n===null||typeof n!="object"?null:(n=S1&&n[S1]||n["@@iterator"],typeof n=="function"?n:null)}var EM={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},TM=Object.assign,AM={};function Gl(n,e,t){this.props=n,this.context=e,this.refs=AM,this.updater=t||EM}Gl.prototype.isReactComponent={};Gl.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Gl.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function CM(){}CM.prototype=Gl.prototype;function Qv(n,e,t){this.props=n,this.context=e,this.refs=AM,this.updater=t||EM}var Jv=Qv.prototype=new CM;Jv.constructor=Qv;TM(Jv,Gl.prototype);Jv.isPureReactComponent=!0;var w1=Array.isArray,bM=Object.prototype.hasOwnProperty,Kv={current:null},PM={key:!0,ref:!0,__self:!0,__source:!0};function LM(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)bM.call(e,i)&&!PM.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var c=Array(a),f=0;f<a;f++)c[f]=arguments[f+2];r.children=c}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:Wc,type:n,key:s,ref:o,props:r,_owner:Kv.current}}function gC(n,e){return{$$typeof:Wc,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function $v(n){return typeof n=="object"&&n!==null&&n.$$typeof===Wc}function vC(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var M1=/\/+/g;function eg(n,e){return typeof n=="object"&&n!==null&&n.key!=null?vC(""+n.key):e.toString(36)}function gd(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case Wc:case sC:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+eg(o,0):i,w1(r)?(t="",n!=null&&(t=n.replace(M1,"$&/")+"/"),gd(r,e,t,"",function(f){return f})):r!=null&&($v(r)&&(r=gC(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(M1,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",w1(n))for(var a=0;a<n.length;a++){s=n[a];var c=i+eg(s,a);o+=gd(s,e,t,c,r)}else if(c=mC(n),typeof c=="function")for(n=c.call(n),a=0;!(s=n.next()).done;)s=s.value,c=i+eg(s,a++),o+=gd(s,e,t,c,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function ch(n,e,t){if(n==null)return n;var i=[],r=0;return gd(n,i,"","",function(s){return e.call(t,s,r++)}),i}function yC(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var ui={current:null},vd={transition:null},_C={ReactCurrentDispatcher:ui,ReactCurrentBatchConfig:vd,ReactCurrentOwner:Kv};Mt.Children={map:ch,forEach:function(n,e,t){ch(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return ch(n,function(){e++}),e},toArray:function(n){return ch(n,function(e){return e})||[]},only:function(n){if(!$v(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Mt.Component=Gl;Mt.Fragment=oC;Mt.Profiler=lC;Mt.PureComponent=Qv;Mt.StrictMode=aC;Mt.Suspense=hC;Mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_C;Mt.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=TM({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Kv.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(c in e)bM.call(e,c)&&!PM.hasOwnProperty(c)&&(i[c]=e[c]===void 0&&a!==void 0?a[c]:e[c])}var c=arguments.length-2;if(c===1)i.children=t;else if(1<c){a=Array(c);for(var f=0;f<c;f++)a[f]=arguments[f+2];i.children=a}return{$$typeof:Wc,type:n.type,key:r,ref:s,props:i,_owner:o}};Mt.createContext=function(n){return n={$$typeof:cC,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:uC,_context:n},n.Consumer=n};Mt.createElement=LM;Mt.createFactory=function(n){var e=LM.bind(null,n);return e.type=n,e};Mt.createRef=function(){return{current:null}};Mt.forwardRef=function(n){return{$$typeof:fC,render:n}};Mt.isValidElement=$v;Mt.lazy=function(n){return{$$typeof:pC,_payload:{_status:-1,_result:n},_init:yC}};Mt.memo=function(n,e){return{$$typeof:dC,type:n,compare:e===void 0?null:e}};Mt.startTransition=function(n){var e=vd.transition;vd.transition={};try{n()}finally{vd.transition=e}};Mt.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Mt.useCallback=function(n,e){return ui.current.useCallback(n,e)};Mt.useContext=function(n){return ui.current.useContext(n)};Mt.useDebugValue=function(){};Mt.useDeferredValue=function(n){return ui.current.useDeferredValue(n)};Mt.useEffect=function(n,e){return ui.current.useEffect(n,e)};Mt.useId=function(){return ui.current.useId()};Mt.useImperativeHandle=function(n,e,t){return ui.current.useImperativeHandle(n,e,t)};Mt.useInsertionEffect=function(n,e){return ui.current.useInsertionEffect(n,e)};Mt.useLayoutEffect=function(n,e){return ui.current.useLayoutEffect(n,e)};Mt.useMemo=function(n,e){return ui.current.useMemo(n,e)};Mt.useReducer=function(n,e,t){return ui.current.useReducer(n,e,t)};Mt.useRef=function(n){return ui.current.useRef(n)};Mt.useState=function(n){return ui.current.useState(n)};Mt.useSyncExternalStore=function(n,e,t){return ui.current.useSyncExternalStore(n,e,t)};Mt.useTransition=function(){return ui.current.useTransition()};Mt.version="18.2.0";(function(n){n.exports=Mt})(Te);var RM={exports:{}},IM={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(n){function e(D,V){var B=D.length;D.push(V);e:for(;0<B;){var J=B-1>>>1,Y=D[J];if(0<r(Y,V))D[J]=V,D[B]=Y,B=J;else break e}}function t(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var V=D[0],B=D.pop();if(B!==V){D[0]=B;e:for(var J=0,Y=D.length,K=Y>>>1;J<K;){var z=2*(J+1)-1,ye=D[z],pe=z+1,Q=D[pe];if(0>r(ye,B))pe<Y&&0>r(Q,ye)?(D[J]=Q,D[pe]=B,J=pe):(D[J]=ye,D[z]=B,J=z);else if(pe<Y&&0>r(Q,B))D[J]=Q,D[pe]=B,J=pe;else break e}}return V}function r(D,V){var B=D.sortIndex-V.sortIndex;return B!==0?B:D.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var c=[],f=[],h=1,d=null,m=3,v=!1,_=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(D){for(var V=t(f);V!==null;){if(V.callback===null)i(f);else if(V.startTime<=D)i(f),V.sortIndex=V.expirationTime,e(c,V);else break;V=t(f)}}function T(D){if(E=!1,w(D),!_)if(t(c)!==null)_=!0,oe(C);else{var V=t(f);V!==null&&ue(T,V.startTime-D)}}function C(D,V){_=!1,E&&(E=!1,g(I),I=-1),v=!0;var B=m;try{for(w(V),d=t(c);d!==null&&(!(d.expirationTime>V)||D&&!H());){var J=d.callback;if(typeof J=="function"){d.callback=null,m=d.priorityLevel;var Y=J(d.expirationTime<=V);V=n.unstable_now(),typeof Y=="function"?d.callback=Y:d===t(c)&&i(c),w(V)}else i(c);d=t(c)}if(d!==null)var K=!0;else{var z=t(f);z!==null&&ue(T,z.startTime-V),K=!1}return K}finally{d=null,m=B,v=!1}}var P=!1,R=null,I=-1,b=5,L=-1;function H(){return!(n.unstable_now()-L<b)}function q(){if(R!==null){var D=n.unstable_now();L=D;var V=!0;try{V=R(!0,D)}finally{V?G():(P=!1,R=null)}}else P=!1}var G;if(typeof x=="function")G=function(){x(q)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,ee=W.port2;W.port1.onmessage=q,G=function(){ee.postMessage(null)}}else G=function(){S(q,0)};function oe(D){R=D,P||(P=!0,G())}function ue(D,V){I=S(function(){D(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){_||v||(_=!0,oe(C))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_getFirstCallbackNode=function(){return t(c)},n.unstable_next=function(D){switch(m){case 1:case 2:case 3:var V=3;break;default:V=m}var B=m;m=V;try{return D()}finally{m=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,V){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var B=m;m=D;try{return V()}finally{m=B}},n.unstable_scheduleCallback=function(D,V,B){var J=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?J+B:J):B=J,D){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=B+Y,D={id:h++,callback:V,priorityLevel:D,startTime:B,expirationTime:Y,sortIndex:-1},B>J?(D.sortIndex=B,e(f,D),t(c)===null&&D===t(f)&&(E?(g(I),I=-1):E=!0,ue(T,B-J))):(D.sortIndex=Y,e(c,D),_||v||(_=!0,oe(C))),D},n.unstable_shouldYield=H,n.unstable_wrapCallback=function(D){var V=m;return function(){var B=m;m=V;try{return D.apply(this,arguments)}finally{m=B}}}})(IM);(function(n){n.exports=IM})(RM);/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var DM=Te.exports,Oi=RM.exports;function we(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var NM=new Set,lc={};function ga(n,e){Rl(n,e),Rl(n+"Capture",e)}function Rl(n,e){for(lc[n]=e,n=0;n<e.length;n++)NM.add(e[n])}var _s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p0=Object.prototype.hasOwnProperty,xC=/^[: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]*$/,E1={},T1={};function SC(n){return p0.call(T1,n)?!0:p0.call(E1,n)?!1:xC.test(n)?T1[n]=!0:(E1[n]=!0,!1)}function wC(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function MC(n,e,t,i){if(e===null||typeof e>"u"||wC(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ci(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Fn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Fn[n]=new ci(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Fn[e]=new ci(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Fn[n]=new ci(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Fn[n]=new ci(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Fn[n]=new ci(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Fn[n]=new ci(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Fn[n]=new ci(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Fn[n]=new ci(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Fn[n]=new ci(n,5,!1,n.toLowerCase(),null,!1,!1)});var ey=/[\-:]([a-z])/g;function ty(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(ey,ty);Fn[e]=new ci(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(ey,ty);Fn[e]=new ci(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(ey,ty);Fn[e]=new ci(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Fn[n]=new ci(n,1,!1,n.toLowerCase(),null,!1,!1)});Fn.xlinkHref=new ci("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Fn[n]=new ci(n,1,!1,n.toLowerCase(),null,!0,!0)});function ny(n,e,t,i){var r=Fn.hasOwnProperty(e)?Fn[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(MC(e,t,r,i)&&(t=null),i||r===null?SC(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var Cs=DM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,fh=Symbol.for("react.element"),al=Symbol.for("react.portal"),ll=Symbol.for("react.fragment"),iy=Symbol.for("react.strict_mode"),m0=Symbol.for("react.profiler"),kM=Symbol.for("react.provider"),zM=Symbol.for("react.context"),ry=Symbol.for("react.forward_ref"),g0=Symbol.for("react.suspense"),v0=Symbol.for("react.suspense_list"),sy=Symbol.for("react.memo"),Xs=Symbol.for("react.lazy"),UM=Symbol.for("react.offscreen"),A1=Symbol.iterator;function xu(n){return n===null||typeof n!="object"?null:(n=A1&&n[A1]||n["@@iterator"],typeof n=="function"?n:null)}var rn=Object.assign,tg;function Hu(n){if(tg===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);tg=e&&e[1]||""}return`
`+tg+n}var ng=!1;function ig(n,e){if(!n||ng)return"";ng=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(f){var i=f}Reflect.construct(n,[],e)}else{try{e.call()}catch(f){i=f}n.call(e.prototype)}else{try{throw Error()}catch(f){i=f}n()}}catch(f){if(f&&i&&typeof f.stack=="string"){for(var r=f.stack.split(`
`),s=i.stack.split(`
`),o=r.length-1,a=s.length-1;1<=o&&0<=a&&r[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==s[a]){var c=`
`+r[o].replace(" at new "," at ");return n.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",n.displayName)),c}while(1<=o&&0<=a);break}}}finally{ng=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Hu(n):""}function EC(n){switch(n.tag){case 5:return Hu(n.type);case 16:return Hu("Lazy");case 13:return Hu("Suspense");case 19:return Hu("SuspenseList");case 0:case 2:case 15:return n=ig(n.type,!1),n;case 11:return n=ig(n.type.render,!1),n;case 1:return n=ig(n.type,!0),n;default:return""}}function y0(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case ll:return"Fragment";case al:return"Portal";case m0:return"Profiler";case iy:return"StrictMode";case g0:return"Suspense";case v0:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case zM:return(n.displayName||"Context")+".Consumer";case kM:return(n._context.displayName||"Context")+".Provider";case ry:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case sy:return e=n.displayName||null,e!==null?e:y0(n.type)||"Memo";case Xs:e=n._payload,n=n._init;try{return y0(n(e))}catch{}}return null}function TC(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return y0(e);case 8:return e===iy?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function uo(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function OM(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function AC(n){var e=OM(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function hh(n){n._valueTracker||(n._valueTracker=AC(n))}function FM(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=OM(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function zd(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function _0(n,e){var t=e.checked;return rn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t!=null?t:n._wrapperState.initialChecked})}function C1(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=uo(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function BM(n,e){e=e.checked,e!=null&&ny(n,"checked",e,!1)}function x0(n,e){BM(n,e);var t=uo(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?S0(n,e.type,t):e.hasOwnProperty("defaultValue")&&S0(n,e.type,uo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function b1(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function S0(n,e,t){(e!=="number"||zd(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Gu=Array.isArray;function Ml(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+uo(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function w0(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(we(91));return rn({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function P1(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(we(92));if(Gu(t)){if(1<t.length)throw Error(we(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:uo(t)}}function VM(n,e){var t=uo(e.value),i=uo(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function L1(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function HM(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function M0(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?HM(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var dh,GM=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(dh=dh||document.createElement("div"),dh.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=dh.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function uc(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var qu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},CC=["Webkit","ms","Moz","O"];Object.keys(qu).forEach(function(n){CC.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),qu[e]=qu[n]})});function WM(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||qu.hasOwnProperty(n)&&qu[n]?(""+e).trim():e+"px"}function XM(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=WM(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var bC=rn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function E0(n,e){if(e){if(bC[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(we(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(we(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(we(61))}if(e.style!=null&&typeof e.style!="object")throw Error(we(62))}}function T0(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var A0=null;function oy(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var C0=null,El=null,Tl=null;function R1(n){if(n=Yc(n)){if(typeof C0!="function")throw Error(we(280));var e=n.stateNode;e&&(e=gp(e),C0(n.stateNode,n.type,e))}}function jM(n){El?Tl?Tl.push(n):Tl=[n]:El=n}function YM(){if(El){var n=El,e=Tl;if(Tl=El=null,R1(n),e)for(n=0;n<e.length;n++)R1(e[n])}}function qM(n,e){return n(e)}function ZM(){}var rg=!1;function QM(n,e,t){if(rg)return n(e,t);rg=!0;try{return qM(n,e,t)}finally{rg=!1,(El!==null||Tl!==null)&&(ZM(),YM())}}function cc(n,e){var t=n.stateNode;if(t===null)return null;var i=gp(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(we(231,e,typeof t));return t}var b0=!1;if(_s)try{var Su={};Object.defineProperty(Su,"passive",{get:function(){b0=!0}}),window.addEventListener("test",Su,Su),window.removeEventListener("test",Su,Su)}catch{b0=!1}function PC(n,e,t,i,r,s,o,a,c){var f=Array.prototype.slice.call(arguments,3);try{e.apply(t,f)}catch(h){this.onError(h)}}var Zu=!1,Ud=null,Od=!1,P0=null,LC={onError:function(n){Zu=!0,Ud=n}};function RC(n,e,t,i,r,s,o,a,c){Zu=!1,Ud=null,PC.apply(LC,arguments)}function IC(n,e,t,i,r,s,o,a,c){if(RC.apply(this,arguments),Zu){if(Zu){var f=Ud;Zu=!1,Ud=null}else throw Error(we(198));Od||(Od=!0,P0=f)}}function va(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,(e.flags&4098)!==0&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function JM(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function I1(n){if(va(n)!==n)throw Error(we(188))}function DC(n){var e=n.alternate;if(!e){if(e=va(n),e===null)throw Error(we(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return I1(r),n;if(s===i)return I1(r),e;s=s.sibling}throw Error(we(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(we(189))}}if(t.alternate!==i)throw Error(we(190))}if(t.tag!==3)throw Error(we(188));return t.stateNode.current===t?n:e}function KM(n){return n=DC(n),n!==null?$M(n):null}function $M(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=$M(n);if(e!==null)return e;n=n.sibling}return null}var eE=Oi.unstable_scheduleCallback,D1=Oi.unstable_cancelCallback,NC=Oi.unstable_shouldYield,kC=Oi.unstable_requestPaint,dn=Oi.unstable_now,zC=Oi.unstable_getCurrentPriorityLevel,ay=Oi.unstable_ImmediatePriority,tE=Oi.unstable_UserBlockingPriority,Fd=Oi.unstable_NormalPriority,UC=Oi.unstable_LowPriority,nE=Oi.unstable_IdlePriority,hp=null,Gr=null;function OC(n){if(Gr&&typeof Gr.onCommitFiberRoot=="function")try{Gr.onCommitFiberRoot(hp,n,void 0,(n.current.flags&128)===128)}catch{}}var Er=Math.clz32?Math.clz32:VC,FC=Math.log,BC=Math.LN2;function VC(n){return n>>>=0,n===0?32:31-(FC(n)/BC|0)|0}var ph=64,mh=4194304;function Wu(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Bd(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=Wu(a):(s&=o,s!==0&&(i=Wu(s)))}else o=t&~r,o!==0?i=Wu(o):s!==0&&(i=Wu(s));if(i===0)return 0;if(e!==0&&e!==i&&(e&r)===0&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if((i&4)!==0&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-Er(e),r=1<<t,i|=n[t],e&=~r;return i}function HC(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function GC(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-Er(s),a=1<<o,c=r[o];c===-1?((a&t)===0||(a&i)!==0)&&(r[o]=HC(a,e)):c<=e&&(n.expiredLanes|=a),s&=~a}}function L0(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function iE(){var n=ph;return ph<<=1,(ph&4194240)===0&&(ph=64),n}function sg(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function Xc(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Er(e),n[e]=t}function WC(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-Er(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function ly(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-Er(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var kt=0;function rE(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var sE,uy,oE,aE,lE,R0=!1,gh=[],eo=null,to=null,no=null,fc=new Map,hc=new Map,qs=[],XC="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 submit".split(" ");function N1(n,e){switch(n){case"focusin":case"focusout":eo=null;break;case"dragenter":case"dragleave":to=null;break;case"mouseover":case"mouseout":no=null;break;case"pointerover":case"pointerout":fc.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":hc.delete(e.pointerId)}}function wu(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Yc(e),e!==null&&uy(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function jC(n,e,t,i,r){switch(e){case"focusin":return eo=wu(eo,n,e,t,i,r),!0;case"dragenter":return to=wu(to,n,e,t,i,r),!0;case"mouseover":return no=wu(no,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return fc.set(s,wu(fc.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,hc.set(s,wu(hc.get(s)||null,n,e,t,i,r)),!0}return!1}function uE(n){var e=Go(n.target);if(e!==null){var t=va(e);if(t!==null){if(e=t.tag,e===13){if(e=JM(t),e!==null){n.blockedOn=e,lE(n.priority,function(){oE(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function yd(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=I0(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);A0=i,t.target.dispatchEvent(i),A0=null}else return e=Yc(t),e!==null&&uy(e),n.blockedOn=t,!1;e.shift()}return!0}function k1(n,e,t){yd(n)&&t.delete(e)}function YC(){R0=!1,eo!==null&&yd(eo)&&(eo=null),to!==null&&yd(to)&&(to=null),no!==null&&yd(no)&&(no=null),fc.forEach(k1),hc.forEach(k1)}function Mu(n,e){n.blockedOn===e&&(n.blockedOn=null,R0||(R0=!0,Oi.unstable_scheduleCallback(Oi.unstable_NormalPriority,YC)))}function dc(n){function e(r){return Mu(r,n)}if(0<gh.length){Mu(gh[0],n);for(var t=1;t<gh.length;t++){var i=gh[t];i.blockedOn===n&&(i.blockedOn=null)}}for(eo!==null&&Mu(eo,n),to!==null&&Mu(to,n),no!==null&&Mu(no,n),fc.forEach(e),hc.forEach(e),t=0;t<qs.length;t++)i=qs[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<qs.length&&(t=qs[0],t.blockedOn===null);)uE(t),t.blockedOn===null&&qs.shift()}var Al=Cs.ReactCurrentBatchConfig,Vd=!0;function qC(n,e,t,i){var r=kt,s=Al.transition;Al.transition=null;try{kt=1,cy(n,e,t,i)}finally{kt=r,Al.transition=s}}function ZC(n,e,t,i){var r=kt,s=Al.transition;Al.transition=null;try{kt=4,cy(n,e,t,i)}finally{kt=r,Al.transition=s}}function cy(n,e,t,i){if(Vd){var r=I0(n,e,t,i);if(r===null)mg(n,e,i,Hd,t),N1(n,i);else if(jC(r,n,e,t,i))i.stopPropagation();else if(N1(n,i),e&4&&-1<XC.indexOf(n)){for(;r!==null;){var s=Yc(r);if(s!==null&&sE(s),s=I0(n,e,t,i),s===null&&mg(n,e,i,Hd,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else mg(n,e,i,null,t)}}var Hd=null;function I0(n,e,t,i){if(Hd=null,n=oy(i),n=Go(n),n!==null)if(e=va(n),e===null)n=null;else if(t=e.tag,t===13){if(n=JM(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return Hd=n,null}function cE(n){switch(n){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(zC()){case ay:return 1;case tE:return 4;case Fd:case UC:return 16;case nE:return 536870912;default:return 16}default:return 16}}var Js=null,fy=null,_d=null;function fE(){if(_d)return _d;var n,e=fy,t=e.length,i,r="value"in Js?Js.value:Js.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return _d=r.slice(n,1<i?1-i:void 0)}function xd(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function vh(){return!0}function z1(){return!1}function Bi(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?vh:z1,this.isPropagationStopped=z1,this}return rn(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=vh)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=vh)},persist:function(){},isPersistent:vh}),e}var Wl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hy=Bi(Wl),jc=rn({},Wl,{view:0,detail:0}),QC=Bi(jc),og,ag,Eu,dp=rn({},jc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dy,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Eu&&(Eu&&n.type==="mousemove"?(og=n.screenX-Eu.screenX,ag=n.screenY-Eu.screenY):ag=og=0,Eu=n),og)},movementY:function(n){return"movementY"in n?n.movementY:ag}}),U1=Bi(dp),JC=rn({},dp,{dataTransfer:0}),KC=Bi(JC),$C=rn({},jc,{relatedTarget:0}),lg=Bi($C),eb=rn({},Wl,{animationName:0,elapsedTime:0,pseudoElement:0}),tb=Bi(eb),nb=rn({},Wl,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),ib=Bi(nb),rb=rn({},Wl,{data:0}),O1=Bi(rb),sb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ob={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"},ab={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lb(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=ab[n])?!!e[n]:!1}function dy(){return lb}var ub=rn({},jc,{key:function(n){if(n.key){var e=sb[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=xd(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?ob[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dy,charCode:function(n){return n.type==="keypress"?xd(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?xd(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),cb=Bi(ub),fb=rn({},dp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),F1=Bi(fb),hb=rn({},jc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dy}),db=Bi(hb),pb=rn({},Wl,{propertyName:0,elapsedTime:0,pseudoElement:0}),mb=Bi(pb),gb=rn({},dp,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),vb=Bi(gb),yb=[9,13,27,32],py=_s&&"CompositionEvent"in window,Qu=null;_s&&"documentMode"in document&&(Qu=document.documentMode);var _b=_s&&"TextEvent"in window&&!Qu,hE=_s&&(!py||Qu&&8<Qu&&11>=Qu),B1=String.fromCharCode(32),V1=!1;function dE(n,e){switch(n){case"keyup":return yb.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pE(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ul=!1;function xb(n,e){switch(n){case"compositionend":return pE(e);case"keypress":return e.which!==32?null:(V1=!0,B1);case"textInput":return n=e.data,n===B1&&V1?null:n;default:return null}}function Sb(n,e){if(ul)return n==="compositionend"||!py&&dE(n,e)?(n=fE(),_d=fy=Js=null,ul=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return hE&&e.locale!=="ko"?null:e.data;default:return null}}var wb={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 H1(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!wb[n.type]:e==="textarea"}function mE(n,e,t,i){jM(i),e=Gd(e,"onChange"),0<e.length&&(t=new hy("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var Ju=null,pc=null;function Mb(n){AE(n,0)}function pp(n){var e=hl(n);if(FM(e))return n}function Eb(n,e){if(n==="change")return e}var gE=!1;if(_s){var ug;if(_s){var cg="oninput"in document;if(!cg){var G1=document.createElement("div");G1.setAttribute("oninput","return;"),cg=typeof G1.oninput=="function"}ug=cg}else ug=!1;gE=ug&&(!document.documentMode||9<document.documentMode)}function W1(){Ju&&(Ju.detachEvent("onpropertychange",vE),pc=Ju=null)}function vE(n){if(n.propertyName==="value"&&pp(pc)){var e=[];mE(e,pc,n,oy(n)),QM(Mb,e)}}function Tb(n,e,t){n==="focusin"?(W1(),Ju=e,pc=t,Ju.attachEvent("onpropertychange",vE)):n==="focusout"&&W1()}function Ab(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return pp(pc)}function Cb(n,e){if(n==="click")return pp(e)}function bb(n,e){if(n==="input"||n==="change")return pp(e)}function Pb(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Cr=typeof Object.is=="function"?Object.is:Pb;function mc(n,e){if(Cr(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!p0.call(e,r)||!Cr(n[r],e[r]))return!1}return!0}function X1(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function j1(n,e){var t=X1(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=X1(t)}}function yE(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?yE(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function _E(){for(var n=window,e=zd();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=zd(n.document)}return e}function my(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function Lb(n){var e=_E(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&yE(t.ownerDocument.documentElement,t)){if(i!==null&&my(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=j1(t,s);var o=j1(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var Rb=_s&&"documentMode"in document&&11>=document.documentMode,cl=null,D0=null,Ku=null,N0=!1;function Y1(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;N0||cl==null||cl!==zd(i)||(i=cl,"selectionStart"in i&&my(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ku&&mc(Ku,i)||(Ku=i,i=Gd(D0,"onSelect"),0<i.length&&(e=new hy("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=cl)))}function yh(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var fl={animationend:yh("Animation","AnimationEnd"),animationiteration:yh("Animation","AnimationIteration"),animationstart:yh("Animation","AnimationStart"),transitionend:yh("Transition","TransitionEnd")},fg={},xE={};_s&&(xE=document.createElement("div").style,"AnimationEvent"in window||(delete fl.animationend.animation,delete fl.animationiteration.animation,delete fl.animationstart.animation),"TransitionEvent"in window||delete fl.transitionend.transition);function mp(n){if(fg[n])return fg[n];if(!fl[n])return n;var e=fl[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in xE)return fg[n]=e[t];return n}var SE=mp("animationend"),wE=mp("animationiteration"),ME=mp("animationstart"),EE=mp("transitionend"),TE=new Map,q1="abort auxClick 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(" ");function mo(n,e){TE.set(n,e),ga(e,[n])}for(var hg=0;hg<q1.length;hg++){var dg=q1[hg],Ib=dg.toLowerCase(),Db=dg[0].toUpperCase()+dg.slice(1);mo(Ib,"on"+Db)}mo(SE,"onAnimationEnd");mo(wE,"onAnimationIteration");mo(ME,"onAnimationStart");mo("dblclick","onDoubleClick");mo("focusin","onFocus");mo("focusout","onBlur");mo(EE,"onTransitionEnd");Rl("onMouseEnter",["mouseout","mouseover"]);Rl("onMouseLeave",["mouseout","mouseover"]);Rl("onPointerEnter",["pointerout","pointerover"]);Rl("onPointerLeave",["pointerout","pointerover"]);ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ga("onBeforeInput",["compositionend","keypress","textInput","paste"]);ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xu="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(" "),Nb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xu));function Z1(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,IC(i,e,void 0,n),n.currentTarget=null}function AE(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],c=a.instance,f=a.currentTarget;if(a=a.listener,c!==s&&r.isPropagationStopped())break e;Z1(r,a,f),s=c}else for(o=0;o<i.length;o++){if(a=i[o],c=a.instance,f=a.currentTarget,a=a.listener,c!==s&&r.isPropagationStopped())break e;Z1(r,a,f),s=c}}}if(Od)throw n=P0,Od=!1,P0=null,n}function Xt(n,e){var t=e[F0];t===void 0&&(t=e[F0]=new Set);var i=n+"__bubble";t.has(i)||(CE(e,n,2,!1),t.add(i))}function pg(n,e,t){var i=0;e&&(i|=4),CE(t,n,i,e)}var _h="_reactListening"+Math.random().toString(36).slice(2);function gc(n){if(!n[_h]){n[_h]=!0,NM.forEach(function(t){t!=="selectionchange"&&(Nb.has(t)||pg(t,!1,n),pg(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[_h]||(e[_h]=!0,pg("selectionchange",!1,e))}}function CE(n,e,t,i){switch(cE(e)){case 1:var r=qC;break;case 4:r=ZC;break;default:r=cy}t=r.bind(null,e,t,n),r=void 0,!b0||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function mg(n,e,t,i,r){var s=i;if((e&1)===0&&(e&2)===0&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===r||c.nodeType===8&&c.parentNode===r))return;o=o.return}for(;a!==null;){if(o=Go(a),o===null)return;if(c=o.tag,c===5||c===6){i=s=o;continue e}a=a.parentNode}}i=i.return}QM(function(){var f=s,h=oy(t),d=[];e:{var m=TE.get(n);if(m!==void 0){var v=hy,_=n;switch(n){case"keypress":if(xd(t)===0)break e;case"keydown":case"keyup":v=cb;break;case"focusin":_="focus",v=lg;break;case"focusout":_="blur",v=lg;break;case"beforeblur":case"afterblur":v=lg;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=U1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=KC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=db;break;case SE:case wE:case ME:v=tb;break;case EE:v=mb;break;case"scroll":v=QC;break;case"wheel":v=vb;break;case"copy":case"cut":case"paste":v=ib;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=F1}var E=(e&4)!==0,S=!E&&n==="scroll",g=E?m!==null?m+"Capture":null:m;E=[];for(var x=f,w;x!==null;){w=x;var T=w.stateNode;if(w.tag===5&&T!==null&&(w=T,g!==null&&(T=cc(x,g),T!=null&&E.push(vc(x,T,w)))),S)break;x=x.return}0<E.length&&(m=new v(m,_,null,t,h),d.push({event:m,listeners:E}))}}if((e&7)===0){e:{if(m=n==="mouseover"||n==="pointerover",v=n==="mouseout"||n==="pointerout",m&&t!==A0&&(_=t.relatedTarget||t.fromElement)&&(Go(_)||_[xs]))break e;if((v||m)&&(m=h.window===h?h:(m=h.ownerDocument)?m.defaultView||m.parentWindow:window,v?(_=t.relatedTarget||t.toElement,v=f,_=_?Go(_):null,_!==null&&(S=va(_),_!==S||_.tag!==5&&_.tag!==6)&&(_=null)):(v=null,_=f),v!==_)){if(E=U1,T="onMouseLeave",g="onMouseEnter",x="mouse",(n==="pointerout"||n==="pointerover")&&(E=F1,T="onPointerLeave",g="onPointerEnter",x="pointer"),S=v==null?m:hl(v),w=_==null?m:hl(_),m=new E(T,x+"leave",v,t,h),m.target=S,m.relatedTarget=w,T=null,Go(h)===f&&(E=new E(g,x+"enter",_,t,h),E.target=w,E.relatedTarget=S,T=E),S=T,v&&_)t:{for(E=v,g=_,x=0,w=E;w;w=ka(w))x++;for(w=0,T=g;T;T=ka(T))w++;for(;0<x-w;)E=ka(E),x--;for(;0<w-x;)g=ka(g),w--;for(;x--;){if(E===g||g!==null&&E===g.alternate)break t;E=ka(E),g=ka(g)}E=null}else E=null;v!==null&&Q1(d,m,v,E,!1),_!==null&&S!==null&&Q1(d,S,_,E,!0)}}e:{if(m=f?hl(f):window,v=m.nodeName&&m.nodeName.toLowerCase(),v==="select"||v==="input"&&m.type==="file")var C=Eb;else if(H1(m))if(gE)C=bb;else{C=Ab;var P=Tb}else(v=m.nodeName)&&v.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(C=Cb);if(C&&(C=C(n,f))){mE(d,C,t,h);break e}P&&P(n,m,f),n==="focusout"&&(P=m._wrapperState)&&P.controlled&&m.type==="number"&&S0(m,"number",m.value)}switch(P=f?hl(f):window,n){case"focusin":(H1(P)||P.contentEditable==="true")&&(cl=P,D0=f,Ku=null);break;case"focusout":Ku=D0=cl=null;break;case"mousedown":N0=!0;break;case"contextmenu":case"mouseup":case"dragend":N0=!1,Y1(d,t,h);break;case"selectionchange":if(Rb)break;case"keydown":case"keyup":Y1(d,t,h)}var R;if(py)e:{switch(n){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else ul?dE(n,t)&&(I="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(I="onCompositionStart");I&&(hE&&t.locale!=="ko"&&(ul||I!=="onCompositionStart"?I==="onCompositionEnd"&&ul&&(R=fE()):(Js=h,fy="value"in Js?Js.value:Js.textContent,ul=!0)),P=Gd(f,I),0<P.length&&(I=new O1(I,n,null,t,h),d.push({event:I,listeners:P}),R?I.data=R:(R=pE(t),R!==null&&(I.data=R)))),(R=_b?xb(n,t):Sb(n,t))&&(f=Gd(f,"onBeforeInput"),0<f.length&&(h=new O1("onBeforeInput","beforeinput",null,t,h),d.push({event:h,listeners:f}),h.data=R))}AE(d,e)})}function vc(n,e,t){return{instance:n,listener:e,currentTarget:t}}function Gd(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=cc(n,t),s!=null&&i.unshift(vc(n,s,r)),s=cc(n,e),s!=null&&i.push(vc(n,s,r))),n=n.return}return i}function ka(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Q1(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,c=a.alternate,f=a.stateNode;if(c!==null&&c===i)break;a.tag===5&&f!==null&&(a=f,r?(c=cc(t,s),c!=null&&o.unshift(vc(t,c,a))):r||(c=cc(t,s),c!=null&&o.push(vc(t,c,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var kb=/\r\n?/g,zb=/\u0000|\uFFFD/g;function J1(n){return(typeof n=="string"?n:""+n).replace(kb,`
`).replace(zb,"")}function xh(n,e,t){if(e=J1(e),J1(n)!==e&&t)throw Error(we(425))}function Wd(){}var k0=null,z0=null;function U0(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var O0=typeof setTimeout=="function"?setTimeout:void 0,Ub=typeof clearTimeout=="function"?clearTimeout:void 0,K1=typeof Promise=="function"?Promise:void 0,Ob=typeof queueMicrotask=="function"?queueMicrotask:typeof K1<"u"?function(n){return K1.resolve(null).then(n).catch(Fb)}:O0;function Fb(n){setTimeout(function(){throw n})}function gg(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),dc(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);dc(e)}function io(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function $1(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var Xl=Math.random().toString(36).slice(2),Vr="__reactFiber$"+Xl,yc="__reactProps$"+Xl,xs="__reactContainer$"+Xl,F0="__reactEvents$"+Xl,Bb="__reactListeners$"+Xl,Vb="__reactHandles$"+Xl;function Go(n){var e=n[Vr];if(e)return e;for(var t=n.parentNode;t;){if(e=t[xs]||t[Vr]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=$1(n);n!==null;){if(t=n[Vr])return t;n=$1(n)}return e}n=t,t=n.parentNode}return null}function Yc(n){return n=n[Vr]||n[xs],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function hl(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(we(33))}function gp(n){return n[yc]||null}var B0=[],dl=-1;function go(n){return{current:n}}function jt(n){0>dl||(n.current=B0[dl],B0[dl]=null,dl--)}function Wt(n,e){dl++,B0[dl]=n.current,n.current=e}var co={},Kn=go(co),Si=go(!1),sa=co;function Il(n,e){var t=n.type.contextTypes;if(!t)return co;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function wi(n){return n=n.childContextTypes,n!=null}function Xd(){jt(Si),jt(Kn)}function eS(n,e,t){if(Kn.current!==co)throw Error(we(168));Wt(Kn,e),Wt(Si,t)}function bE(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(we(108,TC(n)||"Unknown",r));return rn({},t,i)}function jd(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||co,sa=Kn.current,Wt(Kn,n),Wt(Si,Si.current),!0}function tS(n,e,t){var i=n.stateNode;if(!i)throw Error(we(169));t?(n=bE(n,e,sa),i.__reactInternalMemoizedMergedChildContext=n,jt(Si),jt(Kn),Wt(Kn,n)):jt(Si),Wt(Si,t)}var hs=null,vp=!1,vg=!1;function PE(n){hs===null?hs=[n]:hs.push(n)}function Hb(n){vp=!0,PE(n)}function vo(){if(!vg&&hs!==null){vg=!0;var n=0,e=kt;try{var t=hs;for(kt=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}hs=null,vp=!1}catch(r){throw hs!==null&&(hs=hs.slice(n+1)),eE(ay,vo),r}finally{kt=e,vg=!1}}return null}var pl=[],ml=0,Yd=null,qd=0,er=[],tr=0,oa=null,ps=1,ms="";function Oo(n,e){pl[ml++]=qd,pl[ml++]=Yd,Yd=n,qd=e}function LE(n,e,t){er[tr++]=ps,er[tr++]=ms,er[tr++]=oa,oa=n;var i=ps;n=ms;var r=32-Er(i)-1;i&=~(1<<r),t+=1;var s=32-Er(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,ps=1<<32-Er(e)+r|t<<r|i,ms=s+n}else ps=1<<s|t<<r|i,ms=n}function gy(n){n.return!==null&&(Oo(n,1),LE(n,1,0))}function vy(n){for(;n===Yd;)Yd=pl[--ml],pl[ml]=null,qd=pl[--ml],pl[ml]=null;for(;n===oa;)oa=er[--tr],er[tr]=null,ms=er[--tr],er[tr]=null,ps=er[--tr],er[tr]=null}var zi=null,Ni=null,Qt=!1,wr=null;function RE(n,e){var t=ir(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function nS(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,zi=n,Ni=io(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,zi=n,Ni=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=oa!==null?{id:ps,overflow:ms}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=ir(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,zi=n,Ni=null,!0):!1;default:return!1}}function V0(n){return(n.mode&1)!==0&&(n.flags&128)===0}function H0(n){if(Qt){var e=Ni;if(e){var t=e;if(!nS(n,e)){if(V0(n))throw Error(we(418));e=io(t.nextSibling);var i=zi;e&&nS(n,e)?RE(i,t):(n.flags=n.flags&-4097|2,Qt=!1,zi=n)}}else{if(V0(n))throw Error(we(418));n.flags=n.flags&-4097|2,Qt=!1,zi=n}}}function iS(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;zi=n}function Sh(n){if(n!==zi)return!1;if(!Qt)return iS(n),Qt=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!U0(n.type,n.memoizedProps)),e&&(e=Ni)){if(V0(n))throw IE(),Error(we(418));for(;e;)RE(n,e),e=io(e.nextSibling)}if(iS(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(we(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Ni=io(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Ni=null}}else Ni=zi?io(n.stateNode.nextSibling):null;return!0}function IE(){for(var n=Ni;n;)n=io(n.nextSibling)}function Dl(){Ni=zi=null,Qt=!1}function yy(n){wr===null?wr=[n]:wr.push(n)}var Gb=Cs.ReactCurrentBatchConfig;function _r(n,e){if(n&&n.defaultProps){e=rn({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}var Zd=go(null),Qd=null,gl=null,_y=null;function xy(){_y=gl=Qd=null}function Sy(n){var e=Zd.current;jt(Zd),n._currentValue=e}function G0(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Cl(n,e){Qd=n,_y=gl=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&e)!==0&&(xi=!0),n.firstContext=null)}function sr(n){var e=n._currentValue;if(_y!==n)if(n={context:n,memoizedValue:e,next:null},gl===null){if(Qd===null)throw Error(we(308));gl=n,Qd.dependencies={lanes:0,firstContext:n}}else gl=gl.next=n;return e}var Wo=null;function wy(n){Wo===null?Wo=[n]:Wo.push(n)}function DE(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,wy(e)):(t.next=r.next,r.next=t),e.interleaved=t,Ss(n,i)}function Ss(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var js=!1;function My(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function NE(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function vs(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function ro(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,(At&2)!==0){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,Ss(n,t)}return r=i.interleaved,r===null?(e.next=e,wy(i)):(e.next=r.next,r.next=e),i.interleaved=e,Ss(n,t)}function Sd(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,ly(n,t)}}function rS(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function Jd(n,e,t,i){var r=n.updateQueue;js=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var c=a,f=c.next;c.next=null,o===null?s=f:o.next=f,o=c;var h=n.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=f:a.next=f,h.lastBaseUpdate=c))}if(s!==null){var d=r.baseState;o=0,h=f=c=null,a=s;do{var m=a.lane,v=a.eventTime;if((i&m)===m){h!==null&&(h=h.next={eventTime:v,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var _=n,E=a;switch(m=e,v=t,E.tag){case 1:if(_=E.payload,typeof _=="function"){d=_.call(v,d,m);break e}d=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=E.payload,m=typeof _=="function"?_.call(v,d,m):_,m==null)break e;d=rn({},d,m);break e;case 2:js=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,m=r.effects,m===null?r.effects=[a]:m.push(a))}else v={eventTime:v,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(f=h=v,c=d):h=h.next=v,o|=m;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;m=a,a=m.next,m.next=null,r.lastBaseUpdate=m,r.shared.pending=null}}while(1);if(h===null&&(c=d),r.baseState=c,r.firstBaseUpdate=f,r.lastBaseUpdate=h,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);la|=o,n.lanes=o,n.memoizedState=d}}function sS(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(we(191,r));r.call(i)}}}var kE=new DM.Component().refs;function W0(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:rn({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var yp={isMounted:function(n){return(n=n._reactInternals)?va(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=ai(),r=oo(n),s=vs(i,r);s.payload=e,t!=null&&(s.callback=t),e=ro(n,s,r),e!==null&&(Tr(e,n,r,i),Sd(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=ai(),r=oo(n),s=vs(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=ro(n,s,r),e!==null&&(Tr(e,n,r,i),Sd(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=ai(),i=oo(n),r=vs(t,i);r.tag=2,e!=null&&(r.callback=e),e=ro(n,r,i),e!==null&&(Tr(e,n,i,t),Sd(e,n,i))}};function oS(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!mc(t,i)||!mc(r,s):!0}function zE(n,e,t){var i=!1,r=co,s=e.contextType;return typeof s=="object"&&s!==null?s=sr(s):(r=wi(e)?sa:Kn.current,i=e.contextTypes,s=(i=i!=null)?Il(n,r):co),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=yp,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function aS(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&yp.enqueueReplaceState(e,e.state,null)}function X0(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs=kE,My(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=sr(s):(s=wi(e)?sa:Kn.current,r.context=Il(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(W0(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&yp.enqueueReplaceState(r,r.state,null),Jd(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Tu(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(we(309));var i=t.stateNode}if(!i)throw Error(we(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;a===kE&&(a=r.refs={}),o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(we(284));if(!t._owner)throw Error(we(290,n))}return n}function wh(n,e){throw n=Object.prototype.toString.call(e),Error(we(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function lS(n){var e=n._init;return e(n._payload)}function UE(n){function e(g,x){if(n){var w=g.deletions;w===null?(g.deletions=[x],g.flags|=16):w.push(x)}}function t(g,x){if(!n)return null;for(;x!==null;)e(g,x),x=x.sibling;return null}function i(g,x){for(g=new Map;x!==null;)x.key!==null?g.set(x.key,x):g.set(x.index,x),x=x.sibling;return g}function r(g,x){return g=ao(g,x),g.index=0,g.sibling=null,g}function s(g,x,w){return g.index=w,n?(w=g.alternate,w!==null?(w=w.index,w<x?(g.flags|=2,x):w):(g.flags|=2,x)):(g.flags|=1048576,x)}function o(g){return n&&g.alternate===null&&(g.flags|=2),g}function a(g,x,w,T){return x===null||x.tag!==6?(x=Eg(w,g.mode,T),x.return=g,x):(x=r(x,w),x.return=g,x)}function c(g,x,w,T){var C=w.type;return C===ll?h(g,x,w.props.children,T,w.key):x!==null&&(x.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Xs&&lS(C)===x.type)?(T=r(x,w.props),T.ref=Tu(g,x,w),T.return=g,T):(T=Cd(w.type,w.key,w.props,null,g.mode,T),T.ref=Tu(g,x,w),T.return=g,T)}function f(g,x,w,T){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=Tg(w,g.mode,T),x.return=g,x):(x=r(x,w.children||[]),x.return=g,x)}function h(g,x,w,T,C){return x===null||x.tag!==7?(x=$o(w,g.mode,T,C),x.return=g,x):(x=r(x,w),x.return=g,x)}function d(g,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=Eg(""+x,g.mode,w),x.return=g,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case fh:return w=Cd(x.type,x.key,x.props,null,g.mode,w),w.ref=Tu(g,null,x),w.return=g,w;case al:return x=Tg(x,g.mode,w),x.return=g,x;case Xs:var T=x._init;return d(g,T(x._payload),w)}if(Gu(x)||xu(x))return x=$o(x,g.mode,w,null),x.return=g,x;wh(g,x)}return null}function m(g,x,w,T){var C=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:a(g,x,""+w,T);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case fh:return w.key===C?c(g,x,w,T):null;case al:return w.key===C?f(g,x,w,T):null;case Xs:return C=w._init,m(g,x,C(w._payload),T)}if(Gu(w)||xu(w))return C!==null?null:h(g,x,w,T,null);wh(g,w)}return null}function v(g,x,w,T,C){if(typeof T=="string"&&T!==""||typeof T=="number")return g=g.get(w)||null,a(x,g,""+T,C);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case fh:return g=g.get(T.key===null?w:T.key)||null,c(x,g,T,C);case al:return g=g.get(T.key===null?w:T.key)||null,f(x,g,T,C);case Xs:var P=T._init;return v(g,x,w,P(T._payload),C)}if(Gu(T)||xu(T))return g=g.get(w)||null,h(x,g,T,C,null);wh(x,T)}return null}function _(g,x,w,T){for(var C=null,P=null,R=x,I=x=0,b=null;R!==null&&I<w.length;I++){R.index>I?(b=R,R=null):b=R.sibling;var L=m(g,R,w[I],T);if(L===null){R===null&&(R=b);break}n&&R&&L.alternate===null&&e(g,R),x=s(L,x,I),P===null?C=L:P.sibling=L,P=L,R=b}if(I===w.length)return t(g,R),Qt&&Oo(g,I),C;if(R===null){for(;I<w.length;I++)R=d(g,w[I],T),R!==null&&(x=s(R,x,I),P===null?C=R:P.sibling=R,P=R);return Qt&&Oo(g,I),C}for(R=i(g,R);I<w.length;I++)b=v(R,g,I,w[I],T),b!==null&&(n&&b.alternate!==null&&R.delete(b.key===null?I:b.key),x=s(b,x,I),P===null?C=b:P.sibling=b,P=b);return n&&R.forEach(function(H){return e(g,H)}),Qt&&Oo(g,I),C}function E(g,x,w,T){var C=xu(w);if(typeof C!="function")throw Error(we(150));if(w=C.call(w),w==null)throw Error(we(151));for(var P=C=null,R=x,I=x=0,b=null,L=w.next();R!==null&&!L.done;I++,L=w.next()){R.index>I?(b=R,R=null):b=R.sibling;var H=m(g,R,L.value,T);if(H===null){R===null&&(R=b);break}n&&R&&H.alternate===null&&e(g,R),x=s(H,x,I),P===null?C=H:P.sibling=H,P=H,R=b}if(L.done)return t(g,R),Qt&&Oo(g,I),C;if(R===null){for(;!L.done;I++,L=w.next())L=d(g,L.value,T),L!==null&&(x=s(L,x,I),P===null?C=L:P.sibling=L,P=L);return Qt&&Oo(g,I),C}for(R=i(g,R);!L.done;I++,L=w.next())L=v(R,g,I,L.value,T),L!==null&&(n&&L.alternate!==null&&R.delete(L.key===null?I:L.key),x=s(L,x,I),P===null?C=L:P.sibling=L,P=L);return n&&R.forEach(function(q){return e(g,q)}),Qt&&Oo(g,I),C}function S(g,x,w,T){if(typeof w=="object"&&w!==null&&w.type===ll&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case fh:e:{for(var C=w.key,P=x;P!==null;){if(P.key===C){if(C=w.type,C===ll){if(P.tag===7){t(g,P.sibling),x=r(P,w.props.children),x.return=g,g=x;break e}}else if(P.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Xs&&lS(C)===P.type){t(g,P.sibling),x=r(P,w.props),x.ref=Tu(g,P,w),x.return=g,g=x;break e}t(g,P);break}else e(g,P);P=P.sibling}w.type===ll?(x=$o(w.props.children,g.mode,T,w.key),x.return=g,g=x):(T=Cd(w.type,w.key,w.props,null,g.mode,T),T.ref=Tu(g,x,w),T.return=g,g=T)}return o(g);case al:e:{for(P=w.key;x!==null;){if(x.key===P)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){t(g,x.sibling),x=r(x,w.children||[]),x.return=g,g=x;break e}else{t(g,x);break}else e(g,x);x=x.sibling}x=Tg(w,g.mode,T),x.return=g,g=x}return o(g);case Xs:return P=w._init,S(g,x,P(w._payload),T)}if(Gu(w))return _(g,x,w,T);if(xu(w))return E(g,x,w,T);wh(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(t(g,x.sibling),x=r(x,w),x.return=g,g=x):(t(g,x),x=Eg(w,g.mode,T),x.return=g,g=x),o(g)):t(g,x)}return S}var Nl=UE(!0),OE=UE(!1),qc={},Wr=go(qc),_c=go(qc),xc=go(qc);function Xo(n){if(n===qc)throw Error(we(174));return n}function Ey(n,e){switch(Wt(xc,e),Wt(_c,n),Wt(Wr,qc),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:M0(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=M0(e,n)}jt(Wr),Wt(Wr,e)}function kl(){jt(Wr),jt(_c),jt(xc)}function FE(n){Xo(xc.current);var e=Xo(Wr.current),t=M0(e,n.type);e!==t&&(Wt(_c,n),Wt(Wr,t))}function Ty(n){_c.current===n&&(jt(Wr),jt(_c))}var $t=go(0);function Kd(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var yg=[];function Ay(){for(var n=0;n<yg.length;n++)yg[n]._workInProgressVersionPrimary=null;yg.length=0}var wd=Cs.ReactCurrentDispatcher,_g=Cs.ReactCurrentBatchConfig,aa=0,nn=null,Sn=null,Rn=null,$d=!1,$u=!1,Sc=0,Wb=0;function jn(){throw Error(we(321))}function Cy(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!Cr(n[t],e[t]))return!1;return!0}function by(n,e,t,i,r,s){if(aa=s,nn=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,wd.current=n===null||n.memoizedState===null?qb:Zb,n=t(i,r),$u){s=0;do{if($u=!1,Sc=0,25<=s)throw Error(we(301));s+=1,Rn=Sn=null,e.updateQueue=null,wd.current=Qb,n=t(i,r)}while($u)}if(wd.current=ep,e=Sn!==null&&Sn.next!==null,aa=0,Rn=Sn=nn=null,$d=!1,e)throw Error(we(300));return n}function Py(){var n=Sc!==0;return Sc=0,n}function Fr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?nn.memoizedState=Rn=n:Rn=Rn.next=n,Rn}function or(){if(Sn===null){var n=nn.alternate;n=n!==null?n.memoizedState:null}else n=Sn.next;var e=Rn===null?nn.memoizedState:Rn.next;if(e!==null)Rn=e,Sn=n;else{if(n===null)throw Error(we(310));Sn=n,n={memoizedState:Sn.memoizedState,baseState:Sn.baseState,baseQueue:Sn.baseQueue,queue:Sn.queue,next:null},Rn===null?nn.memoizedState=Rn=n:Rn=Rn.next=n}return Rn}function wc(n,e){return typeof e=="function"?e(n):e}function xg(n){var e=or(),t=e.queue;if(t===null)throw Error(we(311));t.lastRenderedReducer=n;var i=Sn,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,c=null,f=s;do{var h=f.lane;if((aa&h)===h)c!==null&&(c=c.next={lane:0,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null}),i=f.hasEagerState?f.eagerState:n(i,f.action);else{var d={lane:h,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null};c===null?(a=c=d,o=i):c=c.next=d,nn.lanes|=h,la|=h}f=f.next}while(f!==null&&f!==s);c===null?o=i:c.next=a,Cr(i,e.memoizedState)||(xi=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=c,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,nn.lanes|=s,la|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function Sg(n){var e=or(),t=e.queue;if(t===null)throw Error(we(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);Cr(s,e.memoizedState)||(xi=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function BE(){}function VE(n,e){var t=nn,i=or(),r=e(),s=!Cr(i.memoizedState,r);if(s&&(i.memoizedState=r,xi=!0),i=i.queue,Ly(WE.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||Rn!==null&&Rn.memoizedState.tag&1){if(t.flags|=2048,Mc(9,GE.bind(null,t,i,r,e),void 0,null),Dn===null)throw Error(we(349));(aa&30)!==0||HE(t,e,r)}return r}function HE(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=nn.updateQueue,e===null?(e={lastEffect:null,stores:null},nn.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function GE(n,e,t,i){e.value=t,e.getSnapshot=i,XE(e)&&jE(n)}function WE(n,e,t){return t(function(){XE(e)&&jE(n)})}function XE(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Cr(n,t)}catch{return!0}}function jE(n){var e=Ss(n,1);e!==null&&Tr(e,n,1,-1)}function uS(n){var e=Fr();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:wc,lastRenderedState:n},e.queue=n,n=n.dispatch=Yb.bind(null,nn,n),[e.memoizedState,n]}function Mc(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=nn.updateQueue,e===null?(e={lastEffect:null,stores:null},nn.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function YE(){return or().memoizedState}function Md(n,e,t,i){var r=Fr();nn.flags|=n,r.memoizedState=Mc(1|e,t,void 0,i===void 0?null:i)}function _p(n,e,t,i){var r=or();i=i===void 0?null:i;var s=void 0;if(Sn!==null){var o=Sn.memoizedState;if(s=o.destroy,i!==null&&Cy(i,o.deps)){r.memoizedState=Mc(e,t,s,i);return}}nn.flags|=n,r.memoizedState=Mc(1|e,t,s,i)}function cS(n,e){return Md(8390656,8,n,e)}function Ly(n,e){return _p(2048,8,n,e)}function qE(n,e){return _p(4,2,n,e)}function ZE(n,e){return _p(4,4,n,e)}function QE(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function JE(n,e,t){return t=t!=null?t.concat([n]):null,_p(4,4,QE.bind(null,e,n),t)}function Ry(){}function KE(n,e){var t=or();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Cy(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function $E(n,e){var t=or();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Cy(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function eT(n,e,t){return(aa&21)===0?(n.baseState&&(n.baseState=!1,xi=!0),n.memoizedState=t):(Cr(t,e)||(t=iE(),nn.lanes|=t,la|=t,n.baseState=!0),e)}function Xb(n,e){var t=kt;kt=t!==0&&4>t?t:4,n(!0);var i=_g.transition;_g.transition={};try{n(!1),e()}finally{kt=t,_g.transition=i}}function tT(){return or().memoizedState}function jb(n,e,t){var i=oo(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},nT(n))iT(e,t);else if(t=DE(n,e,t,i),t!==null){var r=ai();Tr(t,n,i,r),rT(t,e,i)}}function Yb(n,e,t){var i=oo(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(nT(n))iT(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,Cr(a,o)){var c=e.interleaved;c===null?(r.next=r,wy(e)):(r.next=c.next,c.next=r),e.interleaved=r;return}}catch{}finally{}t=DE(n,e,r,i),t!==null&&(r=ai(),Tr(t,n,i,r),rT(t,e,i))}}function nT(n){var e=n.alternate;return n===nn||e!==null&&e===nn}function iT(n,e){$u=$d=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function rT(n,e,t){if((t&4194240)!==0){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,ly(n,t)}}var ep={readContext:sr,useCallback:jn,useContext:jn,useEffect:jn,useImperativeHandle:jn,useInsertionEffect:jn,useLayoutEffect:jn,useMemo:jn,useReducer:jn,useRef:jn,useState:jn,useDebugValue:jn,useDeferredValue:jn,useTransition:jn,useMutableSource:jn,useSyncExternalStore:jn,useId:jn,unstable_isNewReconciler:!1},qb={readContext:sr,useCallback:function(n,e){return Fr().memoizedState=[n,e===void 0?null:e],n},useContext:sr,useEffect:cS,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Md(4194308,4,QE.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Md(4194308,4,n,e)},useInsertionEffect:function(n,e){return Md(4,2,n,e)},useMemo:function(n,e){var t=Fr();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=Fr();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=jb.bind(null,nn,n),[i.memoizedState,n]},useRef:function(n){var e=Fr();return n={current:n},e.memoizedState=n},useState:uS,useDebugValue:Ry,useDeferredValue:function(n){return Fr().memoizedState=n},useTransition:function(){var n=uS(!1),e=n[0];return n=Xb.bind(null,n[1]),Fr().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=nn,r=Fr();if(Qt){if(t===void 0)throw Error(we(407));t=t()}else{if(t=e(),Dn===null)throw Error(we(349));(aa&30)!==0||HE(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,cS(WE.bind(null,i,s,n),[n]),i.flags|=2048,Mc(9,GE.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=Fr(),e=Dn.identifierPrefix;if(Qt){var t=ms,i=ps;t=(i&~(1<<32-Er(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Sc++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=Wb++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},Zb={readContext:sr,useCallback:KE,useContext:sr,useEffect:Ly,useImperativeHandle:JE,useInsertionEffect:qE,useLayoutEffect:ZE,useMemo:$E,useReducer:xg,useRef:YE,useState:function(){return xg(wc)},useDebugValue:Ry,useDeferredValue:function(n){var e=or();return eT(e,Sn.memoizedState,n)},useTransition:function(){var n=xg(wc)[0],e=or().memoizedState;return[n,e]},useMutableSource:BE,useSyncExternalStore:VE,useId:tT,unstable_isNewReconciler:!1},Qb={readContext:sr,useCallback:KE,useContext:sr,useEffect:Ly,useImperativeHandle:JE,useInsertionEffect:qE,useLayoutEffect:ZE,useMemo:$E,useReducer:Sg,useRef:YE,useState:function(){return Sg(wc)},useDebugValue:Ry,useDeferredValue:function(n){var e=or();return Sn===null?e.memoizedState=n:eT(e,Sn.memoizedState,n)},useTransition:function(){var n=Sg(wc)[0],e=or().memoizedState;return[n,e]},useMutableSource:BE,useSyncExternalStore:VE,useId:tT,unstable_isNewReconciler:!1};function zl(n,e){try{var t="",i=e;do t+=EC(i),i=i.return;while(i);var r=t}catch(s){r=`
Error generating stack: `+s.message+`
`+s.stack}return{value:n,source:e,stack:r,digest:null}}function wg(n,e,t){return{value:n,source:null,stack:t!=null?t:null,digest:e!=null?e:null}}function j0(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var Jb=typeof WeakMap=="function"?WeakMap:Map;function sT(n,e,t){t=vs(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){np||(np=!0,nv=i),j0(n,e)},t}function oT(n,e,t){t=vs(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){j0(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){j0(n,e),typeof i!="function"&&(so===null?so=new Set([this]):so.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function fS(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new Jb;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=fP.bind(null,n,e,t),e.then(n,n))}function hS(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function dS(n,e,t,i,r){return(n.mode&1)===0?(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=vs(-1,1),e.tag=2,ro(t,e,1))),t.lanes|=1),n):(n.flags|=65536,n.lanes=r,n)}var Kb=Cs.ReactCurrentOwner,xi=!1;function si(n,e,t,i){e.child=n===null?OE(e,null,t,i):Nl(e,n.child,t,i)}function pS(n,e,t,i,r){t=t.render;var s=e.ref;return Cl(e,r),i=by(n,e,t,i,s,r),t=Py(),n!==null&&!xi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,ws(n,e,r)):(Qt&&t&&gy(e),e.flags|=1,si(n,e,i,r),e.child)}function mS(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Fy(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,aT(n,e,s,i,r)):(n=Cd(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,(n.lanes&r)===0){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:mc,t(o,i)&&n.ref===e.ref)return ws(n,e,r)}return e.flags|=1,n=ao(s,i),n.ref=e.ref,n.return=e,e.child=n}function aT(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(mc(s,i)&&n.ref===e.ref)if(xi=!1,e.pendingProps=i=s,(n.lanes&r)!==0)(n.flags&131072)!==0&&(xi=!0);else return e.lanes=n.lanes,ws(n,e,r)}return Y0(n,e,t,i,r)}function lT(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if((e.mode&1)===0)e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Wt(yl,Ri),Ri|=t;else{if((t&1073741824)===0)return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,Wt(yl,Ri),Ri|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,Wt(yl,Ri),Ri|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,Wt(yl,Ri),Ri|=i;return si(n,e,r,t),e.child}function uT(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function Y0(n,e,t,i,r){var s=wi(t)?sa:Kn.current;return s=Il(e,s),Cl(e,r),t=by(n,e,t,i,s,r),i=Py(),n!==null&&!xi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,ws(n,e,r)):(Qt&&i&&gy(e),e.flags|=1,si(n,e,t,r),e.child)}function gS(n,e,t,i,r){if(wi(t)){var s=!0;jd(e)}else s=!1;if(Cl(e,r),e.stateNode===null)Ed(n,e),zE(e,t,i),X0(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var c=o.context,f=t.contextType;typeof f=="object"&&f!==null?f=sr(f):(f=wi(t)?sa:Kn.current,f=Il(e,f));var h=t.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||c!==f)&&aS(e,o,i,f),js=!1;var m=e.memoizedState;o.state=m,Jd(e,i,o,r),c=e.memoizedState,a!==i||m!==c||Si.current||js?(typeof h=="function"&&(W0(e,t,h,i),c=e.memoizedState),(a=js||oS(e,t,a,i,m,c,f))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=c),o.props=i,o.state=c,o.context=f,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,NE(n,e),a=e.memoizedProps,f=e.type===e.elementType?a:_r(e.type,a),o.props=f,d=e.pendingProps,m=o.context,c=t.contextType,typeof c=="object"&&c!==null?c=sr(c):(c=wi(t)?sa:Kn.current,c=Il(e,c));var v=t.getDerivedStateFromProps;(h=typeof v=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||m!==c)&&aS(e,o,i,c),js=!1,m=e.memoizedState,o.state=m,Jd(e,i,o,r);var _=e.memoizedState;a!==d||m!==_||Si.current||js?(typeof v=="function"&&(W0(e,t,v,i),_=e.memoizedState),(f=js||oS(e,t,f,i,m,_,c)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,_,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,_,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&m===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&m===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=_),o.props=i,o.state=_,o.context=c,i=f):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&m===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&m===n.memoizedState||(e.flags|=1024),i=!1)}return q0(n,e,t,i,s,r)}function q0(n,e,t,i,r,s){uT(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&tS(e,t,!1),ws(n,e,s);i=e.stateNode,Kb.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Nl(e,n.child,null,s),e.child=Nl(e,null,a,s)):si(n,e,a,s),e.memoizedState=i.state,r&&tS(e,t,!0),e.child}function cT(n){var e=n.stateNode;e.pendingContext?eS(n,e.pendingContext,e.pendingContext!==e.context):e.context&&eS(n,e.context,!1),Ey(n,e.containerInfo)}function vS(n,e,t,i,r){return Dl(),yy(r),e.flags|=256,si(n,e,t,i),e.child}var Z0={dehydrated:null,treeContext:null,retryLane:0};function Q0(n){return{baseLanes:n,cachePool:null,transitions:null}}function fT(n,e,t){var i=e.pendingProps,r=$t.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),Wt($t,r&1),n===null)return H0(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((e.mode&1)===0?e.lanes=1:n.data==="$!"?e.lanes=8:e.lanes=1073741824,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},(i&1)===0&&s!==null?(s.childLanes=0,s.pendingProps=o):s=wp(o,i,0,null),n=$o(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=Q0(t),e.memoizedState=Z0,n):Iy(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return $b(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var c={mode:"hidden",children:i.children};return(o&1)===0&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=c,e.deletions=null):(i=ao(r,c),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=ao(a,s):(s=$o(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?Q0(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=Z0,i}return s=n.child,n=s.sibling,i=ao(s,{mode:"visible",children:i.children}),(e.mode&1)===0&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function Iy(n,e){return e=wp({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function Mh(n,e,t,i){return i!==null&&yy(i),Nl(e,n.child,null,t),n=Iy(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function $b(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=wg(Error(we(422))),Mh(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=wp({mode:"visible",children:i.children},r,0,null),s=$o(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,(e.mode&1)!==0&&Nl(e,n.child,null,o),e.child.memoizedState=Q0(o),e.memoizedState=Z0,s);if((e.mode&1)===0)return Mh(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(we(419)),i=wg(s,i,void 0),Mh(n,e,o,i)}if(a=(o&n.childLanes)!==0,xi||a){if(i=Dn,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=(r&(i.suspendedLanes|o))!==0?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,Ss(n,r),Tr(i,n,r,-1))}return Oy(),i=wg(Error(we(421))),Mh(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=hP.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,Ni=io(r.nextSibling),zi=e,Qt=!0,wr=null,n!==null&&(er[tr++]=ps,er[tr++]=ms,er[tr++]=oa,ps=n.id,ms=n.overflow,oa=e),e=Iy(e,i.children),e.flags|=4096,e)}function yS(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),G0(n.return,e,t)}function Mg(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function hT(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(si(n,e,i.children,t),i=$t.current,(i&2)!==0)i=i&1|2,e.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&yS(n,t,e);else if(n.tag===19)yS(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(Wt($t,i),(e.mode&1)===0)e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&Kd(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),Mg(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&Kd(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}Mg(e,!0,t,null,s);break;case"together":Mg(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ed(n,e){(e.mode&1)===0&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function ws(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),la|=e.lanes,(t&e.childLanes)===0)return null;if(n!==null&&e.child!==n.child)throw Error(we(153));if(e.child!==null){for(n=e.child,t=ao(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=ao(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function eP(n,e,t){switch(e.tag){case 3:cT(e),Dl();break;case 5:FE(e);break;case 1:wi(e.type)&&jd(e);break;case 4:Ey(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;Wt(Zd,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(Wt($t,$t.current&1),e.flags|=128,null):(t&e.child.childLanes)!==0?fT(n,e,t):(Wt($t,$t.current&1),n=ws(n,e,t),n!==null?n.sibling:null);Wt($t,$t.current&1);break;case 19:if(i=(t&e.childLanes)!==0,(n.flags&128)!==0){if(i)return hT(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Wt($t,$t.current),i)break;return null;case 22:case 23:return e.lanes=0,lT(n,e,t)}return ws(n,e,t)}var dT,J0,pT,mT;dT=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};J0=function(){};pT=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,Xo(Wr.current);var s=null;switch(t){case"input":r=_0(n,r),i=_0(n,i),s=[];break;case"select":r=rn({},r,{value:void 0}),i=rn({},i,{value:void 0}),s=[];break;case"textarea":r=w0(n,r),i=w0(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=Wd)}E0(t,i);var o;t=null;for(f in r)if(!i.hasOwnProperty(f)&&r.hasOwnProperty(f)&&r[f]!=null)if(f==="style"){var a=r[f];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else f!=="dangerouslySetInnerHTML"&&f!=="children"&&f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(lc.hasOwnProperty(f)?s||(s=[]):(s=s||[]).push(f,null));for(f in i){var c=i[f];if(a=r!=null?r[f]:void 0,i.hasOwnProperty(f)&&c!==a&&(c!=null||a!=null))if(f==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in c)c.hasOwnProperty(o)&&a[o]!==c[o]&&(t||(t={}),t[o]=c[o])}else t||(s||(s=[]),s.push(f,t)),t=c;else f==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(s=s||[]).push(f,c)):f==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(f,""+c):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&(lc.hasOwnProperty(f)?(c!=null&&f==="onScroll"&&Xt("scroll",n),s||a===c||(s=[])):(s=s||[]).push(f,c))}t&&(s=s||[]).push("style",t);var f=s;(e.updateQueue=f)&&(e.flags|=4)}};mT=function(n,e,t,i){t!==i&&(e.flags|=4)};function Au(n,e){if(!Qt)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Yn(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function tP(n,e,t){var i=e.pendingProps;switch(vy(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yn(e),null;case 1:return wi(e.type)&&Xd(),Yn(e),null;case 3:return i=e.stateNode,kl(),jt(Si),jt(Kn),Ay(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Sh(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,wr!==null&&(sv(wr),wr=null))),J0(n,e),Yn(e),null;case 5:Ty(e);var r=Xo(xc.current);if(t=e.type,n!==null&&e.stateNode!=null)pT(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(we(166));return Yn(e),null}if(n=Xo(Wr.current),Sh(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[Vr]=e,i[yc]=s,n=(e.mode&1)!==0,t){case"dialog":Xt("cancel",i),Xt("close",i);break;case"iframe":case"object":case"embed":Xt("load",i);break;case"video":case"audio":for(r=0;r<Xu.length;r++)Xt(Xu[r],i);break;case"source":Xt("error",i);break;case"img":case"image":case"link":Xt("error",i),Xt("load",i);break;case"details":Xt("toggle",i);break;case"input":C1(i,s),Xt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},Xt("invalid",i);break;case"textarea":P1(i,s),Xt("invalid",i)}E0(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&xh(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&xh(i.textContent,a,n),r=["children",""+a]):lc.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Xt("scroll",i)}switch(t){case"input":hh(i),b1(i,s,!0);break;case"textarea":hh(i),L1(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=Wd)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=HM(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Vr]=e,n[yc]=i,dT(n,e,!1,!1),e.stateNode=n;e:{switch(o=T0(t,i),t){case"dialog":Xt("cancel",n),Xt("close",n),r=i;break;case"iframe":case"object":case"embed":Xt("load",n),r=i;break;case"video":case"audio":for(r=0;r<Xu.length;r++)Xt(Xu[r],n);r=i;break;case"source":Xt("error",n),r=i;break;case"img":case"image":case"link":Xt("error",n),Xt("load",n),r=i;break;case"details":Xt("toggle",n),r=i;break;case"input":C1(n,i),r=_0(n,i),Xt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=rn({},i,{value:void 0}),Xt("invalid",n);break;case"textarea":P1(n,i),r=w0(n,i),Xt("invalid",n);break;default:r=i}E0(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var c=a[s];s==="style"?XM(n,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&GM(n,c)):s==="children"?typeof c=="string"?(t!=="textarea"||c!=="")&&uc(n,c):typeof c=="number"&&uc(n,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(lc.hasOwnProperty(s)?c!=null&&s==="onScroll"&&Xt("scroll",n):c!=null&&ny(n,s,c,o))}switch(t){case"input":hh(n),b1(n,i,!1);break;case"textarea":hh(n),L1(n);break;case"option":i.value!=null&&n.setAttribute("value",""+uo(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?Ml(n,!!i.multiple,s,!1):i.defaultValue!=null&&Ml(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=Wd)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Yn(e),null;case 6:if(n&&e.stateNode!=null)mT(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(we(166));if(t=Xo(xc.current),Xo(Wr.current),Sh(e)){if(i=e.stateNode,t=e.memoizedProps,i[Vr]=e,(s=i.nodeValue!==t)&&(n=zi,n!==null))switch(n.tag){case 3:xh(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&xh(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[Vr]=e,e.stateNode=i}return Yn(e),null;case 13:if(jt($t),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Qt&&Ni!==null&&(e.mode&1)!==0&&(e.flags&128)===0)IE(),Dl(),e.flags|=98560,s=!1;else if(s=Sh(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(we(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(we(317));s[Vr]=e}else Dl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Yn(e),s=!1}else wr!==null&&(sv(wr),wr=null),s=!0;if(!s)return e.flags&65536?e:null}return(e.flags&128)!==0?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,(e.mode&1)!==0&&(n===null||($t.current&1)!==0?wn===0&&(wn=3):Oy())),e.updateQueue!==null&&(e.flags|=4),Yn(e),null);case 4:return kl(),J0(n,e),n===null&&gc(e.stateNode.containerInfo),Yn(e),null;case 10:return Sy(e.type._context),Yn(e),null;case 17:return wi(e.type)&&Xd(),Yn(e),null;case 19:if(jt($t),s=e.memoizedState,s===null)return Yn(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)Au(s,!1);else{if(wn!==0||n!==null&&(n.flags&128)!==0)for(n=e.child;n!==null;){if(o=Kd(n),o!==null){for(e.flags|=128,Au(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return Wt($t,$t.current&1|2),e.child}n=n.sibling}s.tail!==null&&dn()>Ul&&(e.flags|=128,i=!0,Au(s,!1),e.lanes=4194304)}else{if(!i)if(n=Kd(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Au(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Qt)return Yn(e),null}else 2*dn()-s.renderingStartTime>Ul&&t!==1073741824&&(e.flags|=128,i=!0,Au(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=dn(),e.sibling=null,t=$t.current,Wt($t,i?t&1|2:t&1),e):(Yn(e),null);case 22:case 23:return Uy(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&(e.mode&1)!==0?(Ri&1073741824)!==0&&(Yn(e),e.subtreeFlags&6&&(e.flags|=8192)):Yn(e),null;case 24:return null;case 25:return null}throw Error(we(156,e.tag))}function nP(n,e){switch(vy(e),e.tag){case 1:return wi(e.type)&&Xd(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return kl(),jt(Si),jt(Kn),Ay(),n=e.flags,(n&65536)!==0&&(n&128)===0?(e.flags=n&-65537|128,e):null;case 5:return Ty(e),null;case 13:if(jt($t),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(we(340));Dl()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return jt($t),null;case 4:return kl(),null;case 10:return Sy(e.type._context),null;case 22:case 23:return Uy(),null;case 24:return null;default:return null}}var Eh=!1,Qn=!1,iP=typeof WeakSet=="function"?WeakSet:Set,ze=null;function vl(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){an(n,e,i)}else t.current=null}function K0(n,e,t){try{t()}catch(i){an(n,e,i)}}var _S=!1;function rP(n,e){if(k0=Vd,n=_E(),my(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,c=-1,f=0,h=0,d=n,m=null;t:for(;;){for(var v;d!==t||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(c=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(v=d.firstChild)!==null;)m=d,d=v;for(;;){if(d===n)break t;if(m===t&&++f===r&&(a=o),m===s&&++h===i&&(c=o),(v=d.nextSibling)!==null)break;d=m,m=d.parentNode}d=v}t=a===-1||c===-1?null:{start:a,end:c}}else t=null}t=t||{start:0,end:0}}else t=null;for(z0={focusedElem:n,selectionRange:t},Vd=!1,ze=e;ze!==null;)if(e=ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ze=n;else for(;ze!==null;){e=ze;try{var _=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var E=_.memoizedProps,S=_.memoizedState,g=e.stateNode,x=g.getSnapshotBeforeUpdate(e.elementType===e.type?E:_r(e.type,E),S);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(we(163))}}catch(T){an(e,e.return,T)}if(n=e.sibling,n!==null){n.return=e.return,ze=n;break}ze=e.return}return _=_S,_S=!1,_}function ec(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&K0(e,t,s)}r=r.next}while(r!==i)}}function xp(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function $0(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function gT(n){var e=n.alternate;e!==null&&(n.alternate=null,gT(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Vr],delete e[yc],delete e[F0],delete e[Bb],delete e[Vb])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function vT(n){return n.tag===5||n.tag===3||n.tag===4}function xS(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||vT(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function ev(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Wd));else if(i!==4&&(n=n.child,n!==null))for(ev(n,e,t),n=n.sibling;n!==null;)ev(n,e,t),n=n.sibling}function tv(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(tv(n,e,t),n=n.sibling;n!==null;)tv(n,e,t),n=n.sibling}var Un=null,xr=!1;function Fs(n,e,t){for(t=t.child;t!==null;)yT(n,e,t),t=t.sibling}function yT(n,e,t){if(Gr&&typeof Gr.onCommitFiberUnmount=="function")try{Gr.onCommitFiberUnmount(hp,t)}catch{}switch(t.tag){case 5:Qn||vl(t,e);case 6:var i=Un,r=xr;Un=null,Fs(n,e,t),Un=i,xr=r,Un!==null&&(xr?(n=Un,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Un.removeChild(t.stateNode));break;case 18:Un!==null&&(xr?(n=Un,t=t.stateNode,n.nodeType===8?gg(n.parentNode,t):n.nodeType===1&&gg(n,t),dc(n)):gg(Un,t.stateNode));break;case 4:i=Un,r=xr,Un=t.stateNode.containerInfo,xr=!0,Fs(n,e,t),Un=i,xr=r;break;case 0:case 11:case 14:case 15:if(!Qn&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&((s&2)!==0||(s&4)!==0)&&K0(t,e,o),r=r.next}while(r!==i)}Fs(n,e,t);break;case 1:if(!Qn&&(vl(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){an(t,e,a)}Fs(n,e,t);break;case 21:Fs(n,e,t);break;case 22:t.mode&1?(Qn=(i=Qn)||t.memoizedState!==null,Fs(n,e,t),Qn=i):Fs(n,e,t);break;default:Fs(n,e,t)}}function SS(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new iP),e.forEach(function(i){var r=dP.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function mr(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Un=a.stateNode,xr=!1;break e;case 3:Un=a.stateNode.containerInfo,xr=!0;break e;case 4:Un=a.stateNode.containerInfo,xr=!0;break e}a=a.return}if(Un===null)throw Error(we(160));yT(s,o,r),Un=null,xr=!1;var c=r.alternate;c!==null&&(c.return=null),r.return=null}catch(f){an(r,e,f)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)_T(e,n),e=e.sibling}function _T(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(mr(e,n),Ur(n),i&4){try{ec(3,n,n.return),xp(3,n)}catch(E){an(n,n.return,E)}try{ec(5,n,n.return)}catch(E){an(n,n.return,E)}}break;case 1:mr(e,n),Ur(n),i&512&&t!==null&&vl(t,t.return);break;case 5:if(mr(e,n),Ur(n),i&512&&t!==null&&vl(t,t.return),n.flags&32){var r=n.stateNode;try{uc(r,"")}catch(E){an(n,n.return,E)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,c=n.updateQueue;if(n.updateQueue=null,c!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&BM(r,s),T0(a,o);var f=T0(a,s);for(o=0;o<c.length;o+=2){var h=c[o],d=c[o+1];h==="style"?XM(r,d):h==="dangerouslySetInnerHTML"?GM(r,d):h==="children"?uc(r,d):ny(r,h,d,f)}switch(a){case"input":x0(r,s);break;case"textarea":VM(r,s);break;case"select":var m=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var v=s.value;v!=null?Ml(r,!!s.multiple,v,!1):m!==!!s.multiple&&(s.defaultValue!=null?Ml(r,!!s.multiple,s.defaultValue,!0):Ml(r,!!s.multiple,s.multiple?[]:"",!1))}r[yc]=s}catch(E){an(n,n.return,E)}}break;case 6:if(mr(e,n),Ur(n),i&4){if(n.stateNode===null)throw Error(we(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(E){an(n,n.return,E)}}break;case 3:if(mr(e,n),Ur(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{dc(e.containerInfo)}catch(E){an(n,n.return,E)}break;case 4:mr(e,n),Ur(n);break;case 13:mr(e,n),Ur(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(ky=dn())),i&4&&SS(n);break;case 22:if(h=t!==null&&t.memoizedState!==null,n.mode&1?(Qn=(f=Qn)||h,mr(e,n),Qn=f):mr(e,n),Ur(n),i&8192){if(f=n.memoizedState!==null,(n.stateNode.isHidden=f)&&!h&&(n.mode&1)!==0)for(ze=n,h=n.child;h!==null;){for(d=ze=h;ze!==null;){switch(m=ze,v=m.child,m.tag){case 0:case 11:case 14:case 15:ec(4,m,m.return);break;case 1:vl(m,m.return);var _=m.stateNode;if(typeof _.componentWillUnmount=="function"){i=m,t=m.return;try{e=i,_.props=e.memoizedProps,_.state=e.memoizedState,_.componentWillUnmount()}catch(E){an(i,t,E)}}break;case 5:vl(m,m.return);break;case 22:if(m.memoizedState!==null){MS(d);continue}}v!==null?(v.return=m,ze=v):MS(d)}h=h.sibling}e:for(h=null,d=n;;){if(d.tag===5){if(h===null){h=d;try{r=d.stateNode,f?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,c=d.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=WM("display",o))}catch(E){an(n,n.return,E)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=f?"":d.memoizedProps}catch(E){an(n,n.return,E)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===n)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===n)break e;for(;d.sibling===null;){if(d.return===null||d.return===n)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:mr(e,n),Ur(n),i&4&&SS(n);break;case 21:break;default:mr(e,n),Ur(n)}}function Ur(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(vT(t)){var i=t;break e}t=t.return}throw Error(we(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(uc(r,""),i.flags&=-33);var s=xS(n);tv(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=xS(n);ev(n,a,o);break;default:throw Error(we(161))}}catch(c){an(n,n.return,c)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function sP(n,e,t){ze=n,xT(n)}function xT(n,e,t){for(var i=(n.mode&1)!==0;ze!==null;){var r=ze,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||Eh;if(!o){var a=r.alternate,c=a!==null&&a.memoizedState!==null||Qn;a=Eh;var f=Qn;if(Eh=o,(Qn=c)&&!f)for(ze=r;ze!==null;)o=ze,c=o.child,o.tag===22&&o.memoizedState!==null?ES(r):c!==null?(c.return=o,ze=c):ES(r);for(;s!==null;)ze=s,xT(s),s=s.sibling;ze=r,Eh=a,Qn=f}wS(n)}else(r.subtreeFlags&8772)!==0&&s!==null?(s.return=r,ze=s):wS(n)}}function wS(n){for(;ze!==null;){var e=ze;if((e.flags&8772)!==0){var t=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:Qn||xp(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!Qn)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:_r(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&sS(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}sS(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&t.focus();break;case"img":c.src&&(t.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var f=e.alternate;if(f!==null){var h=f.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&dc(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(we(163))}Qn||e.flags&512&&$0(e)}catch(m){an(e,e.return,m)}}if(e===n){ze=null;break}if(t=e.sibling,t!==null){t.return=e.return,ze=t;break}ze=e.return}}function MS(n){for(;ze!==null;){var e=ze;if(e===n){ze=null;break}var t=e.sibling;if(t!==null){t.return=e.return,ze=t;break}ze=e.return}}function ES(n){for(;ze!==null;){var e=ze;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{xp(4,e)}catch(c){an(e,t,c)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(c){an(e,r,c)}}var s=e.return;try{$0(e)}catch(c){an(e,s,c)}break;case 5:var o=e.return;try{$0(e)}catch(c){an(e,o,c)}}}catch(c){an(e,e.return,c)}if(e===n){ze=null;break}var a=e.sibling;if(a!==null){a.return=e.return,ze=a;break}ze=e.return}}var oP=Math.ceil,tp=Cs.ReactCurrentDispatcher,Dy=Cs.ReactCurrentOwner,rr=Cs.ReactCurrentBatchConfig,At=0,Dn=null,_n=null,On=0,Ri=0,yl=go(0),wn=0,Ec=null,la=0,Sp=0,Ny=0,tc=null,vi=null,ky=0,Ul=1/0,fs=null,np=!1,nv=null,so=null,Th=!1,Ks=null,ip=0,nc=0,iv=null,Td=-1,Ad=0;function ai(){return(At&6)!==0?dn():Td!==-1?Td:Td=dn()}function oo(n){return(n.mode&1)===0?1:(At&2)!==0&&On!==0?On&-On:Gb.transition!==null?(Ad===0&&(Ad=iE()),Ad):(n=kt,n!==0||(n=window.event,n=n===void 0?16:cE(n.type)),n)}function Tr(n,e,t,i){if(50<nc)throw nc=0,iv=null,Error(we(185));Xc(n,t,i),((At&2)===0||n!==Dn)&&(n===Dn&&((At&2)===0&&(Sp|=t),wn===4&&Zs(n,On)),Mi(n,i),t===1&&At===0&&(e.mode&1)===0&&(Ul=dn()+500,vp&&vo()))}function Mi(n,e){var t=n.callbackNode;GC(n,e);var i=Bd(n,n===Dn?On:0);if(i===0)t!==null&&D1(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&D1(t),e===1)n.tag===0?Hb(TS.bind(null,n)):PE(TS.bind(null,n)),Ob(function(){(At&6)===0&&vo()}),t=null;else{switch(rE(i)){case 1:t=ay;break;case 4:t=tE;break;case 16:t=Fd;break;case 536870912:t=nE;break;default:t=Fd}t=bT(t,ST.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function ST(n,e){if(Td=-1,Ad=0,(At&6)!==0)throw Error(we(327));var t=n.callbackNode;if(bl()&&n.callbackNode!==t)return null;var i=Bd(n,n===Dn?On:0);if(i===0)return null;if((i&30)!==0||(i&n.expiredLanes)!==0||e)e=rp(n,i);else{e=i;var r=At;At|=2;var s=MT();(Dn!==n||On!==e)&&(fs=null,Ul=dn()+500,Ko(n,e));do try{uP();break}catch(a){wT(n,a)}while(1);xy(),tp.current=s,At=r,_n!==null?e=0:(Dn=null,On=0,e=wn)}if(e!==0){if(e===2&&(r=L0(n),r!==0&&(i=r,e=rv(n,r))),e===1)throw t=Ec,Ko(n,0),Zs(n,i),Mi(n,dn()),t;if(e===6)Zs(n,i);else{if(r=n.current.alternate,(i&30)===0&&!aP(r)&&(e=rp(n,i),e===2&&(s=L0(n),s!==0&&(i=s,e=rv(n,s))),e===1))throw t=Ec,Ko(n,0),Zs(n,i),Mi(n,dn()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(we(345));case 2:Fo(n,vi,fs);break;case 3:if(Zs(n,i),(i&130023424)===i&&(e=ky+500-dn(),10<e)){if(Bd(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){ai(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=O0(Fo.bind(null,n,vi,fs),e);break}Fo(n,vi,fs);break;case 4:if(Zs(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-Er(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=dn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*oP(i/1960))-i,10<i){n.timeoutHandle=O0(Fo.bind(null,n,vi,fs),i);break}Fo(n,vi,fs);break;case 5:Fo(n,vi,fs);break;default:throw Error(we(329))}}}return Mi(n,dn()),n.callbackNode===t?ST.bind(null,n):null}function rv(n,e){var t=tc;return n.current.memoizedState.isDehydrated&&(Ko(n,e).flags|=256),n=rp(n,e),n!==2&&(e=vi,vi=t,e!==null&&sv(e)),n}function sv(n){vi===null?vi=n:vi.push.apply(vi,n)}function aP(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!Cr(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Zs(n,e){for(e&=~Ny,e&=~Sp,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-Er(e),i=1<<t;n[t]=-1,e&=~i}}function TS(n){if((At&6)!==0)throw Error(we(327));bl();var e=Bd(n,0);if((e&1)===0)return Mi(n,dn()),null;var t=rp(n,e);if(n.tag!==0&&t===2){var i=L0(n);i!==0&&(e=i,t=rv(n,i))}if(t===1)throw t=Ec,Ko(n,0),Zs(n,e),Mi(n,dn()),t;if(t===6)throw Error(we(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,Fo(n,vi,fs),Mi(n,dn()),null}function zy(n,e){var t=At;At|=1;try{return n(e)}finally{At=t,At===0&&(Ul=dn()+500,vp&&vo())}}function ua(n){Ks!==null&&Ks.tag===0&&(At&6)===0&&bl();var e=At;At|=1;var t=rr.transition,i=kt;try{if(rr.transition=null,kt=1,n)return n()}finally{kt=i,rr.transition=t,At=e,(At&6)===0&&vo()}}function Uy(){Ri=yl.current,jt(yl)}function Ko(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,Ub(t)),_n!==null)for(t=_n.return;t!==null;){var i=t;switch(vy(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&Xd();break;case 3:kl(),jt(Si),jt(Kn),Ay();break;case 5:Ty(i);break;case 4:kl();break;case 13:jt($t);break;case 19:jt($t);break;case 10:Sy(i.type._context);break;case 22:case 23:Uy()}t=t.return}if(Dn=n,_n=n=ao(n.current,null),On=Ri=e,wn=0,Ec=null,Ny=Sp=la=0,vi=tc=null,Wo!==null){for(e=0;e<Wo.length;e++)if(t=Wo[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}Wo=null}return n}function wT(n,e){do{var t=_n;try{if(xy(),wd.current=ep,$d){for(var i=nn.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}$d=!1}if(aa=0,Rn=Sn=nn=null,$u=!1,Sc=0,Dy.current=null,t===null||t.return===null){wn=1,Ec=e,_n=null;break}e:{var s=n,o=t.return,a=t,c=e;if(e=On,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=c,h=a,d=h.tag;if((h.mode&1)===0&&(d===0||d===11||d===15)){var m=h.alternate;m?(h.updateQueue=m.updateQueue,h.memoizedState=m.memoizedState,h.lanes=m.lanes):(h.updateQueue=null,h.memoizedState=null)}var v=hS(o);if(v!==null){v.flags&=-257,dS(v,o,a,s,e),v.mode&1&&fS(s,f,e),e=v,c=f;var _=e.updateQueue;if(_===null){var E=new Set;E.add(c),e.updateQueue=E}else _.add(c);break e}else{if((e&1)===0){fS(s,f,e),Oy();break e}c=Error(we(426))}}else if(Qt&&a.mode&1){var S=hS(o);if(S!==null){(S.flags&65536)===0&&(S.flags|=256),dS(S,o,a,s,e),yy(zl(c,a));break e}}s=c=zl(c,a),wn!==4&&(wn=2),tc===null?tc=[s]:tc.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var g=sT(s,c,e);rS(s,g);break e;case 1:a=c;var x=s.type,w=s.stateNode;if((s.flags&128)===0&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(so===null||!so.has(w)))){s.flags|=65536,e&=-e,s.lanes|=e;var T=oT(s,a,e);rS(s,T);break e}}s=s.return}while(s!==null)}TT(t)}catch(C){e=C,_n===t&&t!==null&&(_n=t=t.return);continue}break}while(1)}function MT(){var n=tp.current;return tp.current=ep,n===null?ep:n}function Oy(){(wn===0||wn===3||wn===2)&&(wn=4),Dn===null||(la&268435455)===0&&(Sp&268435455)===0||Zs(Dn,On)}function rp(n,e){var t=At;At|=2;var i=MT();(Dn!==n||On!==e)&&(fs=null,Ko(n,e));do try{lP();break}catch(r){wT(n,r)}while(1);if(xy(),At=t,tp.current=i,_n!==null)throw Error(we(261));return Dn=null,On=0,wn}function lP(){for(;_n!==null;)ET(_n)}function uP(){for(;_n!==null&&!NC();)ET(_n)}function ET(n){var e=CT(n.alternate,n,Ri);n.memoizedProps=n.pendingProps,e===null?TT(n):_n=e,Dy.current=null}function TT(n){var e=n;do{var t=e.alternate;if(n=e.return,(e.flags&32768)===0){if(t=tP(t,e,Ri),t!==null){_n=t;return}}else{if(t=nP(t,e),t!==null){t.flags&=32767,_n=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{wn=6,_n=null;return}}if(e=e.sibling,e!==null){_n=e;return}_n=e=n}while(e!==null);wn===0&&(wn=5)}function Fo(n,e,t){var i=kt,r=rr.transition;try{rr.transition=null,kt=1,cP(n,e,t,i)}finally{rr.transition=r,kt=i}return null}function cP(n,e,t,i){do bl();while(Ks!==null);if((At&6)!==0)throw Error(we(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(we(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(WC(n,s),n===Dn&&(_n=Dn=null,On=0),(t.subtreeFlags&2064)===0&&(t.flags&2064)===0||Th||(Th=!0,bT(Fd,function(){return bl(),null})),s=(t.flags&15990)!==0,(t.subtreeFlags&15990)!==0||s){s=rr.transition,rr.transition=null;var o=kt;kt=1;var a=At;At|=4,Dy.current=null,rP(n,t),_T(t,n),Lb(z0),Vd=!!k0,z0=k0=null,n.current=t,sP(t),kC(),At=a,kt=o,rr.transition=s}else n.current=t;if(Th&&(Th=!1,Ks=n,ip=r),s=n.pendingLanes,s===0&&(so=null),OC(t.stateNode),Mi(n,dn()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(np)throw np=!1,n=nv,nv=null,n;return(ip&1)!==0&&n.tag!==0&&bl(),s=n.pendingLanes,(s&1)!==0?n===iv?nc++:(nc=0,iv=n):nc=0,vo(),null}function bl(){if(Ks!==null){var n=rE(ip),e=rr.transition,t=kt;try{if(rr.transition=null,kt=16>n?16:n,Ks===null)var i=!1;else{if(n=Ks,Ks=null,ip=0,(At&6)!==0)throw Error(we(331));var r=At;for(At|=4,ze=n.current;ze!==null;){var s=ze,o=s.child;if((ze.flags&16)!==0){var a=s.deletions;if(a!==null){for(var c=0;c<a.length;c++){var f=a[c];for(ze=f;ze!==null;){var h=ze;switch(h.tag){case 0:case 11:case 15:ec(8,h,s)}var d=h.child;if(d!==null)d.return=h,ze=d;else for(;ze!==null;){h=ze;var m=h.sibling,v=h.return;if(gT(h),h===f){ze=null;break}if(m!==null){m.return=v,ze=m;break}ze=v}}}var _=s.alternate;if(_!==null){var E=_.child;if(E!==null){_.child=null;do{var S=E.sibling;E.sibling=null,E=S}while(E!==null)}}ze=s}}if((s.subtreeFlags&2064)!==0&&o!==null)o.return=s,ze=o;else e:for(;ze!==null;){if(s=ze,(s.flags&2048)!==0)switch(s.tag){case 0:case 11:case 15:ec(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,ze=g;break e}ze=s.return}}var x=n.current;for(ze=x;ze!==null;){o=ze;var w=o.child;if((o.subtreeFlags&2064)!==0&&w!==null)w.return=o,ze=w;else e:for(o=x;ze!==null;){if(a=ze,(a.flags&2048)!==0)try{switch(a.tag){case 0:case 11:case 15:xp(9,a)}}catch(C){an(a,a.return,C)}if(a===o){ze=null;break e}var T=a.sibling;if(T!==null){T.return=a.return,ze=T;break e}ze=a.return}}if(At=r,vo(),Gr&&typeof Gr.onPostCommitFiberRoot=="function")try{Gr.onPostCommitFiberRoot(hp,n)}catch{}i=!0}return i}finally{kt=t,rr.transition=e}}return!1}function AS(n,e,t){e=zl(t,e),e=sT(n,e,1),n=ro(n,e,1),e=ai(),n!==null&&(Xc(n,1,e),Mi(n,e))}function an(n,e,t){if(n.tag===3)AS(n,n,t);else for(;e!==null;){if(e.tag===3){AS(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(so===null||!so.has(i))){n=zl(t,n),n=oT(e,n,1),e=ro(e,n,1),n=ai(),e!==null&&(Xc(e,1,n),Mi(e,n));break}}e=e.return}}function fP(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=ai(),n.pingedLanes|=n.suspendedLanes&t,Dn===n&&(On&t)===t&&(wn===4||wn===3&&(On&130023424)===On&&500>dn()-ky?Ko(n,0):Ny|=t),Mi(n,e)}function AT(n,e){e===0&&((n.mode&1)===0?e=1:(e=mh,mh<<=1,(mh&130023424)===0&&(mh=4194304)));var t=ai();n=Ss(n,e),n!==null&&(Xc(n,e,t),Mi(n,t))}function hP(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),AT(n,t)}function dP(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(we(314))}i!==null&&i.delete(e),AT(n,t)}var CT;CT=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Si.current)xi=!0;else{if((n.lanes&t)===0&&(e.flags&128)===0)return xi=!1,eP(n,e,t);xi=(n.flags&131072)!==0}else xi=!1,Qt&&(e.flags&1048576)!==0&&LE(e,qd,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Ed(n,e),n=e.pendingProps;var r=Il(e,Kn.current);Cl(e,t),r=by(null,e,i,n,r,t);var s=Py();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,wi(i)?(s=!0,jd(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,My(e),r.updater=yp,e.stateNode=r,r._reactInternals=e,X0(e,i,n,t),e=q0(null,e,i,!0,s,t)):(e.tag=0,Qt&&s&&gy(e),si(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Ed(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=mP(i),n=_r(i,n),r){case 0:e=Y0(null,e,i,n,t);break e;case 1:e=gS(null,e,i,n,t);break e;case 11:e=pS(null,e,i,n,t);break e;case 14:e=mS(null,e,i,_r(i.type,n),t);break e}throw Error(we(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_r(i,r),Y0(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_r(i,r),gS(n,e,i,r,t);case 3:e:{if(cT(e),n===null)throw Error(we(387));i=e.pendingProps,s=e.memoizedState,r=s.element,NE(n,e),Jd(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=zl(Error(we(423)),e),e=vS(n,e,i,t,r);break e}else if(i!==r){r=zl(Error(we(424)),e),e=vS(n,e,i,t,r);break e}else for(Ni=io(e.stateNode.containerInfo.firstChild),zi=e,Qt=!0,wr=null,t=OE(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Dl(),i===r){e=ws(n,e,t);break e}si(n,e,i,t)}e=e.child}return e;case 5:return FE(e),n===null&&H0(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,U0(i,r)?o=null:s!==null&&U0(i,s)&&(e.flags|=32),uT(n,e),si(n,e,o,t),e.child;case 6:return n===null&&H0(e),null;case 13:return fT(n,e,t);case 4:return Ey(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Nl(e,null,i,t):si(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_r(i,r),pS(n,e,i,r,t);case 7:return si(n,e,e.pendingProps,t),e.child;case 8:return si(n,e,e.pendingProps.children,t),e.child;case 12:return si(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,Wt(Zd,i._currentValue),i._currentValue=o,s!==null)if(Cr(s.value,o)){if(s.children===r.children&&!Si.current){e=ws(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var c=a.firstContext;c!==null;){if(c.context===i){if(s.tag===1){c=vs(-1,t&-t),c.tag=2;var f=s.updateQueue;if(f!==null){f=f.shared;var h=f.pending;h===null?c.next=c:(c.next=h.next,h.next=c),f.pending=c}}s.lanes|=t,c=s.alternate,c!==null&&(c.lanes|=t),G0(s.return,t,e),a.lanes|=t;break}c=c.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(we(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),G0(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}si(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Cl(e,t),r=sr(r),i=i(r),e.flags|=1,si(n,e,i,t),e.child;case 14:return i=e.type,r=_r(i,e.pendingProps),r=_r(i.type,r),mS(n,e,i,r,t);case 15:return aT(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_r(i,r),Ed(n,e),e.tag=1,wi(i)?(n=!0,jd(e)):n=!1,Cl(e,t),zE(e,i,r),X0(e,i,r,t),q0(null,e,i,!0,n,t);case 19:return hT(n,e,t);case 22:return lT(n,e,t)}throw Error(we(156,e.tag))};function bT(n,e){return eE(n,e)}function pP(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ir(n,e,t,i){return new pP(n,e,t,i)}function Fy(n){return n=n.prototype,!(!n||!n.isReactComponent)}function mP(n){if(typeof n=="function")return Fy(n)?1:0;if(n!=null){if(n=n.$$typeof,n===ry)return 11;if(n===sy)return 14}return 2}function ao(n,e){var t=n.alternate;return t===null?(t=ir(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Cd(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Fy(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case ll:return $o(t.children,r,s,e);case iy:o=8,r|=8;break;case m0:return n=ir(12,t,e,r|2),n.elementType=m0,n.lanes=s,n;case g0:return n=ir(13,t,e,r),n.elementType=g0,n.lanes=s,n;case v0:return n=ir(19,t,e,r),n.elementType=v0,n.lanes=s,n;case UM:return wp(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case kM:o=10;break e;case zM:o=9;break e;case ry:o=11;break e;case sy:o=14;break e;case Xs:o=16,i=null;break e}throw Error(we(130,n==null?n:typeof n,""))}return e=ir(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function $o(n,e,t,i){return n=ir(7,n,i,e),n.lanes=t,n}function wp(n,e,t,i){return n=ir(22,n,i,e),n.elementType=UM,n.lanes=t,n.stateNode={isHidden:!1},n}function Eg(n,e,t){return n=ir(6,n,null,e),n.lanes=t,n}function Tg(n,e,t){return e=ir(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function gP(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sg(0),this.expirationTimes=sg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sg(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function By(n,e,t,i,r,s,o,a,c){return n=new gP(n,e,t,a,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=ir(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},My(s),n}function vP(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:al,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function PT(n){if(!n)return co;n=n._reactInternals;e:{if(va(n)!==n||n.tag!==1)throw Error(we(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(wi(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(we(171))}if(n.tag===1){var t=n.type;if(wi(t))return bE(n,t,e)}return e}function LT(n,e,t,i,r,s,o,a,c){return n=By(t,i,!0,n,r,s,o,a,c),n.context=PT(null),t=n.current,i=ai(),r=oo(t),s=vs(i,r),s.callback=e!=null?e:null,ro(t,s,r),n.current.lanes=r,Xc(n,r,i),Mi(n,i),n}function Mp(n,e,t,i){var r=e.current,s=ai(),o=oo(r);return t=PT(t),e.context===null?e.context=t:e.pendingContext=t,e=vs(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=ro(r,e,o),n!==null&&(Tr(n,r,o,s),Sd(n,r,o)),o}function sp(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function CS(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function Vy(n,e){CS(n,e),(n=n.alternate)&&CS(n,e)}function yP(){return null}var RT=typeof reportError=="function"?reportError:function(n){console.error(n)};function Hy(n){this._internalRoot=n}Ep.prototype.render=Hy.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(we(409));Mp(n,e,null,null)};Ep.prototype.unmount=Hy.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;ua(function(){Mp(null,n,null,null)}),e[xs]=null}};function Ep(n){this._internalRoot=n}Ep.prototype.unstable_scheduleHydration=function(n){if(n){var e=aE();n={blockedOn:null,target:n,priority:e};for(var t=0;t<qs.length&&e!==0&&e<qs[t].priority;t++);qs.splice(t,0,n),t===0&&uE(n)}};function Gy(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Tp(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function bS(){}function _P(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var f=sp(o);s.call(f)}}var o=LT(e,i,n,0,null,!1,!1,"",bS);return n._reactRootContainer=o,n[xs]=o.current,gc(n.nodeType===8?n.parentNode:n),ua(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var f=sp(c);a.call(f)}}var c=By(n,0,!1,null,null,!1,!1,"",bS);return n._reactRootContainer=c,n[xs]=c.current,gc(n.nodeType===8?n.parentNode:n),ua(function(){Mp(e,c,t,i)}),c}function Ap(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var c=sp(o);a.call(c)}}Mp(e,o,n,r)}else o=_P(t,e,n,r,i);return sp(o)}sE=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=Wu(e.pendingLanes);t!==0&&(ly(e,t|1),Mi(e,dn()),(At&6)===0&&(Ul=dn()+500,vo()))}break;case 13:ua(function(){var i=Ss(n,1);if(i!==null){var r=ai();Tr(i,n,1,r)}}),Vy(n,1)}};uy=function(n){if(n.tag===13){var e=Ss(n,134217728);if(e!==null){var t=ai();Tr(e,n,134217728,t)}Vy(n,134217728)}};oE=function(n){if(n.tag===13){var e=oo(n),t=Ss(n,e);if(t!==null){var i=ai();Tr(t,n,e,i)}Vy(n,e)}};aE=function(){return kt};lE=function(n,e){var t=kt;try{return kt=n,e()}finally{kt=t}};C0=function(n,e,t){switch(e){case"input":if(x0(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=gp(i);if(!r)throw Error(we(90));FM(i),x0(i,r)}}}break;case"textarea":VM(n,t);break;case"select":e=t.value,e!=null&&Ml(n,!!t.multiple,e,!1)}};qM=zy;ZM=ua;var xP={usingClientEntryPoint:!1,Events:[Yc,hl,gp,jM,YM,zy]},Cu={findFiberByHostInstance:Go,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},SP={bundleType:Cu.bundleType,version:Cu.version,rendererPackageName:Cu.rendererPackageName,rendererConfig:Cu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Cs.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=KM(n),n===null?null:n.stateNode},findFiberByHostInstance:Cu.findFiberByHostInstance||yP,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ah=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ah.isDisabled&&Ah.supportsFiber)try{hp=Ah.inject(SP),Gr=Ah}catch{}}Fi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xP;Fi.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gy(e))throw Error(we(200));return vP(n,e,null,t)};Fi.createRoot=function(n,e){if(!Gy(n))throw Error(we(299));var t=!1,i="",r=RT;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=By(n,1,!1,null,null,t,!1,i,r),n[xs]=e.current,gc(n.nodeType===8?n.parentNode:n),new Hy(e)};Fi.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(we(188)):(n=Object.keys(n).join(","),Error(we(268,n)));return n=KM(e),n=n===null?null:n.stateNode,n};Fi.flushSync=function(n){return ua(n)};Fi.hydrate=function(n,e,t){if(!Tp(e))throw Error(we(200));return Ap(null,n,e,!0,t)};Fi.hydrateRoot=function(n,e,t){if(!Gy(n))throw Error(we(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=RT;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=LT(e,null,n,1,t!=null?t:null,r,!1,s,o),n[xs]=e.current,gc(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new Ep(e)};Fi.render=function(n,e,t){if(!Tp(e))throw Error(we(200));return Ap(null,n,e,!1,t)};Fi.unmountComponentAtNode=function(n){if(!Tp(n))throw Error(we(40));return n._reactRootContainer?(ua(function(){Ap(null,null,n,!1,function(){n._reactRootContainer=null,n[xs]=null})}),!0):!1};Fi.unstable_batchedUpdates=zy;Fi.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!Tp(t))throw Error(we(200));if(n==null||n._reactInternals===void 0)throw Error(we(38));return Ap(n,e,t,!1,i)};Fi.version="18.2.0-next-9e3b772b8-20220608";(function(n){function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}e(),n.exports=Fi})(MM);var PS=MM.exports;d0.createRoot=PS.createRoot,d0.hydrateRoot=PS.hydrateRoot;/**
* @license
* Copyright 2010-2023 Three.js Authors
* SPDX-License-Identifier: MIT
*/const Cp="151",wP={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},MP={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},IT=0,ov=1,DT=2,EP=3,NT=0,bp=1,ic=2,jo=3,Ms=0,li=1,nr=2,TP=2,ys=0,ea=1,av=2,lv=3,uv=4,kT=5,Vo=100,zT=101,UT=102,cv=103,fv=104,OT=200,FT=201,BT=202,VT=203,Wy=204,Xy=205,HT=206,GT=207,WT=208,XT=209,jT=210,YT=0,qT=1,ZT=2,op=3,QT=4,JT=5,KT=6,$T=7,Zc=0,e2=1,t2=2,Ar=0,n2=1,i2=2,r2=3,jy=4,s2=5,Pp=300,fo=301,ho=302,Tc=303,Ac=304,jl=306,Cc=1e3,Jn=1001,bc=1002,hn=1003,ap=1004,AP=1004,rc=1005,CP=1005,en=1006,Yy=1007,bP=1007,po=1008,PP=1008,Es=1009,o2=1010,a2=1011,qy=1012,l2=1013,$s=1014,Hr=1015,ca=1016,u2=1017,c2=1018,ta=1020,f2=1021,_i=1023,h2=1024,d2=1025,lo=1026,fa=1027,p2=1028,m2=1029,g2=1030,v2=1031,y2=1033,bd=33776,Pd=33777,Ld=33778,Rd=33779,hv=35840,dv=35841,pv=35842,mv=35843,_2=36196,gv=37492,vv=37496,yv=37808,_v=37809,xv=37810,Sv=37811,wv=37812,Mv=37813,Ev=37814,Tv=37815,Av=37816,Cv=37817,bv=37818,Pv=37819,Lv=37820,Rv=37821,Id=36492,x2=36283,Iv=36284,Dv=36285,Nv=36286,S2=2200,w2=2201,M2=2202,Pc=2300,Lc=2301,Dd=2302,Yo=2400,qo=2401,Rc=2402,Lp=2500,Zy=2501,LP=0,RP=1,IP=2,Ts=3e3,Ot=3001,E2=3200,T2=3201,yo=0,A2=1,DP="",Sr="srgb",Ol="srgb-linear",Qy="display-p3",NP=0,Nd=7680,kP=7681,zP=7682,UP=7683,OP=34055,FP=34056,BP=5386,VP=512,HP=513,GP=514,WP=515,XP=516,jP=517,YP=518,C2=519,Ic=35044,qP=35048,ZP=35040,QP=35045,JP=35049,KP=35041,$P=35046,eL=35050,tL=35042,nL="100",kv="300 es",lp=1035;class bs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const qn=["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 LS=1234567;const na=Math.PI/180,Fl=180/Math.PI;function Ui(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(qn[n&255]+qn[n>>8&255]+qn[n>>16&255]+qn[n>>24&255]+"-"+qn[e&255]+qn[e>>8&255]+"-"+qn[e>>16&15|64]+qn[e>>24&255]+"-"+qn[t&63|128]+qn[t>>8&255]+"-"+qn[t>>16&255]+qn[t>>24&255]+qn[i&255]+qn[i>>8&255]+qn[i>>16&255]+qn[i>>24&255]).toLowerCase()}function ln(n,e,t){return Math.max(e,Math.min(t,n))}function Jy(n,e){return(n%e+e)%e}function iL(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function rL(n,e,t){return n!==e?(t-n)/(e-n):0}function sc(n,e,t){return(1-t)*n+t*e}function sL(n,e,t,i){return sc(n,e,1-Math.exp(-t*i))}function oL(n,e=1){return e-Math.abs(Jy(n,e*2)-e)}function aL(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function lL(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function uL(n,e){return n+Math.floor(Math.random()*(e-n+1))}function cL(n,e){return n+Math.random()*(e-n)}function fL(n){return n*(.5-Math.random())}function hL(n){n!==void 0&&(LS=n);let e=LS+=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 dL(n){return n*na}function pL(n){return n*Fl}function zv(n){return(n&n-1)===0&&n!==0}function b2(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function P2(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function mL(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),c=o(t/2),f=s((e+i)/2),h=o((e+i)/2),d=s((e-i)/2),m=o((e-i)/2),v=s((i-e)/2),_=o((i-e)/2);switch(r){case"XYX":n.set(a*h,c*d,c*m,a*f);break;case"YZY":n.set(c*m,a*h,c*d,a*f);break;case"ZXZ":n.set(c*d,c*m,a*h,a*f);break;case"XZX":n.set(a*h,c*_,c*v,a*f);break;case"YXY":n.set(c*v,a*h,c*_,a*f);break;case"ZYZ":n.set(c*_,c*v,a*h,a*f);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ki(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function dt(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Br={DEG2RAD:na,RAD2DEG:Fl,generateUUID:Ui,clamp:ln,euclideanModulo:Jy,mapLinear:iL,inverseLerp:rL,lerp:sc,damp:sL,pingpong:oL,smoothstep:aL,smootherstep:lL,randInt:uL,randFloat:cL,randFloatSpread:fL,seededRandom:hL,degToRad:dL,radToDeg:pL,isPowerOfTwo:zv,ceilPowerOfTwo:b2,floorPowerOfTwo:P2,setQuaternionFromProperEuler:mL,normalize:dt,denormalize:ki};class ge{constructor(e=0,t=0){ge.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,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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 i=this.dot(e)/t;return Math.acos(ln(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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 i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class xt{constructor(){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,s,o,a,c,f){const h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=s,h[5]=c,h[6]=i,h[7]=o,h[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],c=i[6],f=i[1],h=i[4],d=i[7],m=i[2],v=i[5],_=i[8],E=r[0],S=r[3],g=r[6],x=r[1],w=r[4],T=r[7],C=r[2],P=r[5],R=r[8];return s[0]=o*E+a*x+c*C,s[3]=o*S+a*w+c*P,s[6]=o*g+a*T+c*R,s[1]=f*E+h*x+d*C,s[4]=f*S+h*w+d*P,s[7]=f*g+h*T+d*R,s[2]=m*E+v*x+_*C,s[5]=m*S+v*w+_*P,s[8]=m*g+v*T+_*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8];return t*o*h-t*a*f-i*s*h+i*a*c+r*s*f-r*o*c}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],d=h*o-a*f,m=a*c-h*s,v=f*s-o*c,_=t*d+i*m+r*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=d*E,e[1]=(r*f-h*i)*E,e[2]=(a*i-r*o)*E,e[3]=m*E,e[4]=(h*t-r*c)*E,e[5]=(r*s-a*t)*E,e[6]=v*E,e[7]=(i*c-f*t)*E,e[8]=(o*t-i*s)*E,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,i,r,s,o,a){const c=Math.cos(s),f=Math.sin(s);return this.set(i*c,i*f,-i*(c*o+f*a)+o+e,-r*f,r*c,-r*(-f*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Ag.makeScale(e,t)),this}rotate(e){return this.premultiply(Ag.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ag.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Ag=new xt;function L2(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const gL={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function _l(n,e){return new gL[n](e)}function Dc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Pl(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Cg(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const vL=new xt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),yL=new xt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function _L(n){return n.convertSRGBToLinear().applyMatrix3(yL)}function xL(n){return n.applyMatrix3(vL).convertLinearToSRGB()}const SL={[Ol]:n=>n,[Sr]:n=>n.convertSRGBToLinear(),[Qy]:_L},wL={[Ol]:n=>n,[Sr]:n=>n.convertLinearToSRGB(),[Qy]:xL},mi={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return Ol},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=SL[e],r=wL[t];if(i===void 0||r===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let za;class Ky{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{za===void 0&&(za=Dc("canvas")),za.width=e.width,za.height=e.height;const i=za.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=za}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Dc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Pl(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Pl(t[i]/255)*255):t[i]=Pl(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class Zo{constructor(e=null){this.isSource=!0,this.uuid=Ui(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(bg(r[o].image)):s.push(bg(r[o]))}else s=bg(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function bg(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ky.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let ML=0;class un extends bs{constructor(e=un.DEFAULT_IMAGE,t=un.DEFAULT_MAPPING,i=Jn,r=Jn,s=en,o=po,a=_i,c=Es,f=un.DEFAULT_ANISOTROPY,h=Ts){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ML++}),this.uuid=Ui(),this.name="",this.source=new Zo(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=f,this.format=a,this.internalFormat=null,this.type=c,this.offset=new ge(0,0),this.repeat=new ge(1,1),this.center=new ge(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.5,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,encoding:this.encoding,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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Pp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Cc:e.x=e.x-Math.floor(e.x);break;case Jn:e.x=e.x<0?0:1;break;case bc: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 Cc:e.y=e.y-Math.floor(e.y);break;case Jn:e.y=e.y<0?0:1;break;case bc: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)}}un.DEFAULT_IMAGE=null;un.DEFAULT_MAPPING=Pp;un.DEFAULT_ANISOTROPY=1;class Nt{constructor(e=0,t=0,i=0,r=1){Nt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const c=e.elements,f=c[0],h=c[4],d=c[8],m=c[1],v=c[5],_=c[9],E=c[2],S=c[6],g=c[10];if(Math.abs(h-m)<.01&&Math.abs(d-E)<.01&&Math.abs(_-S)<.01){if(Math.abs(h+m)<.1&&Math.abs(d+E)<.1&&Math.abs(_+S)<.1&&Math.abs(f+v+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(f+1)/2,T=(v+1)/2,C=(g+1)/2,P=(h+m)/4,R=(d+E)/4,I=(_+S)/4;return w>T&&w>C?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=P/i,s=R/i):T>C?T<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),i=P/r,s=I/r):C<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(C),i=R/s,r=I/s),this.set(i,r,s,t),this}let x=Math.sqrt((S-_)*(S-_)+(d-E)*(d-E)+(m-h)*(m-h));return Math.abs(x)<.001&&(x=1),this.x=(S-_)/x,this.y=(d-E)/x,this.z=(m-h)/x,this.w=Math.acos((f+v+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,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 ar extends bs{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Nt(0,0,e,t),this.scissorTest=!1,this.viewport=new Nt(0,0,e,t);const r={width:e,height:t,depth:1};this.texture=new un(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:en,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,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.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Zo(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Rp extends un{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=hn,this.minFilter=hn,this.wrapR=Jn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class EL extends ar{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Rp(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class $y extends un{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=hn,this.minFilter=hn,this.wrapR=Jn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class TL extends ar{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new $y(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class AL extends ar{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o<i;o++)this.texture[o]=s.clone(),this.texture[o].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class It{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let c=i[r+0],f=i[r+1],h=i[r+2],d=i[r+3];const m=s[o+0],v=s[o+1],_=s[o+2],E=s[o+3];if(a===0){e[t+0]=c,e[t+1]=f,e[t+2]=h,e[t+3]=d;return}if(a===1){e[t+0]=m,e[t+1]=v,e[t+2]=_,e[t+3]=E;return}if(d!==E||c!==m||f!==v||h!==_){let S=1-a;const g=c*m+f*v+h*_+d*E,x=g>=0?1:-1,w=1-g*g;if(w>Number.EPSILON){const C=Math.sqrt(w),P=Math.atan2(C,g*x);S=Math.sin(S*P)/C,a=Math.sin(a*P)/C}const T=a*x;if(c=c*S+m*T,f=f*S+v*T,h=h*S+_*T,d=d*S+E*T,S===1-a){const C=1/Math.sqrt(c*c+f*f+h*h+d*d);c*=C,f*=C,h*=C,d*=C}}e[t]=c,e[t+1]=f,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],c=i[r+1],f=i[r+2],h=i[r+3],d=s[o],m=s[o+1],v=s[o+2],_=s[o+3];return e[t]=a*_+h*d+c*v-f*m,e[t+1]=c*_+h*m+f*d-a*v,e[t+2]=f*_+h*v+a*m-c*d,e[t+3]=h*_-a*d-c*m-f*v,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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,f=a(i/2),h=a(r/2),d=a(s/2),m=c(i/2),v=c(r/2),_=c(s/2);switch(o){case"XYZ":this._x=m*h*d+f*v*_,this._y=f*v*d-m*h*_,this._z=f*h*_+m*v*d,this._w=f*h*d-m*v*_;break;case"YXZ":this._x=m*h*d+f*v*_,this._y=f*v*d-m*h*_,this._z=f*h*_-m*v*d,this._w=f*h*d+m*v*_;break;case"ZXY":this._x=m*h*d-f*v*_,this._y=f*v*d+m*h*_,this._z=f*h*_+m*v*d,this._w=f*h*d-m*v*_;break;case"ZYX":this._x=m*h*d-f*v*_,this._y=f*v*d+m*h*_,this._z=f*h*_-m*v*d,this._w=f*h*d+m*v*_;break;case"YZX":this._x=m*h*d+f*v*_,this._y=f*v*d+m*h*_,this._z=f*h*_-m*v*d,this._w=f*h*d-m*v*_;break;case"XZY":this._x=m*h*d-f*v*_,this._y=f*v*d-m*h*_,this._z=f*h*_+m*v*d,this._w=f*h*d+m*v*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],c=t[9],f=t[2],h=t[6],d=t[10],m=i+a+d;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(h-c)*v,this._y=(s-f)*v,this._z=(o-r)*v}else if(i>a&&i>d){const v=2*Math.sqrt(1+i-a-d);this._w=(h-c)/v,this._x=.25*v,this._y=(r+o)/v,this._z=(s+f)/v}else if(a>d){const v=2*Math.sqrt(1+a-i-d);this._w=(s-f)/v,this._x=(r+o)/v,this._y=.25*v,this._z=(c+h)/v}else{const v=2*Math.sqrt(1+d-i-a);this._w=(o-r)/v,this._x=(s+f)/v,this._y=(c+h)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ln(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,c=t._y,f=t._z,h=t._w;return this._x=i*h+o*a+r*f-s*c,this._y=r*h+o*c+s*a-i*f,this._z=s*h+o*f+i*c-r*a,this._w=o*h-i*a-r*c-s*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const c=1-a*a;if(c<=Number.EPSILON){const v=1-t;return this._w=v*o+t*this._w,this._x=v*i+t*this._x,this._y=v*r+t*this._y,this._z=v*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const f=Math.sqrt(c),h=Math.atan2(f,a),d=Math.sin((1-t)*h)/f,m=Math.sin(t*h)/f;return this._w=o*d+this._w*m,this._x=i*d+this._x*m,this._y=r*d+this._y*m,this._z=s*d+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}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}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 N{constructor(e=0,t=0,i=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(RS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(RS.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,c=e.w,f=c*t+o*r-a*i,h=c*i+a*t-s*r,d=c*r+s*i-o*t,m=-s*t-o*i-a*r;return this.x=f*c+m*-s+h*-a-d*-o,this.y=h*c+m*-o+d*-s-f*-a,this.z=d*c+m*-a+f*-o-h*-s,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,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,c=t.z;return this.x=r*c-s*a,this.y=s*o-i*c,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Pg.copy(this).projectOnVector(e),this.sub(Pg)}reflect(e){return this.sub(Pg.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 i=this.dot(e)/t;return Math.acos(ln(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Pg=new N,RS=new It;class Yr{constructor(e=new N(1/0,1/0,1/0),t=new N(-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,i=e.length;t<i;t+=3)this.expandByPoint(ss.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(ss.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=ss.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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){if(e.updateWorldMatrix(!1,!1),e.boundingBox!==void 0)e.boundingBox===null&&e.computeBoundingBox(),Ua.copy(e.boundingBox),Ua.applyMatrix4(e.matrixWorld),this.union(Ua);else{const r=e.geometry;if(r!==void 0)if(t&&r.attributes!==void 0&&r.attributes.position!==void 0){const s=r.attributes.position;for(let o=0,a=s.count;o<a;o++)ss.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(ss)}else r.boundingBox===null&&r.computeBoundingBox(),Ua.copy(r.boundingBox),Ua.applyMatrix4(e.matrixWorld),this.union(Ua)}const i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ss),ss.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(bu),Ch.subVectors(this.max,bu),Oa.subVectors(e.a,bu),Fa.subVectors(e.b,bu),Ba.subVectors(e.c,bu),Bs.subVectors(Fa,Oa),Vs.subVectors(Ba,Fa),Lo.subVectors(Oa,Ba);let t=[0,-Bs.z,Bs.y,0,-Vs.z,Vs.y,0,-Lo.z,Lo.y,Bs.z,0,-Bs.x,Vs.z,0,-Vs.x,Lo.z,0,-Lo.x,-Bs.y,Bs.x,0,-Vs.y,Vs.x,0,-Lo.y,Lo.x,0];return!Lg(t,Oa,Fa,Ba,Ch)||(t=[1,0,0,0,1,0,0,0,1],!Lg(t,Oa,Fa,Ba,Ch))?!1:(bh.crossVectors(Bs,Vs),t=[bh.x,bh.y,bh.z],Lg(t,Oa,Fa,Ba,Ch))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ss).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ss).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:(rs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rs),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 rs=[new N,new N,new N,new N,new N,new N,new N,new N],ss=new N,Ua=new Yr,Oa=new N,Fa=new N,Ba=new N,Bs=new N,Vs=new N,Lo=new N,bu=new N,Ch=new N,bh=new N,Ro=new N;function Lg(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Ro.fromArray(n,s);const a=r.x*Math.abs(Ro.x)+r.y*Math.abs(Ro.y)+r.z*Math.abs(Ro.z),c=e.dot(Ro),f=t.dot(Ro),h=i.dot(Ro);if(Math.max(-Math.max(c,f,h),Math.min(c,f,h))>a)return!1}return!0}const CL=new Yr,Pu=new N,Rg=new N;class qr{constructor(e=new N,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):CL.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>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;Pu.subVectors(e,this.center);const t=Pu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Pu,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Rg.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pu.copy(e.center).add(Rg)),this.expandByPoint(Pu.copy(e.center).sub(Rg))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const os=new N,Ig=new N,Ph=new N,Hs=new N,Dg=new N,Lh=new N,Ng=new N;class Qc{constructor(e=new N,t=new N(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,os)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=os.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(os.copy(this.origin).addScaledVector(this.direction,t),os.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Ig.copy(e).add(t).multiplyScalar(.5),Ph.copy(t).sub(e).normalize(),Hs.copy(this.origin).sub(Ig);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Ph),a=Hs.dot(this.direction),c=-Hs.dot(Ph),f=Hs.lengthSq(),h=Math.abs(1-o*o);let d,m,v,_;if(h>0)if(d=o*c-a,m=o*a-c,_=s*h,d>=0)if(m>=-_)if(m<=_){const E=1/h;d*=E,m*=E,v=d*(d+o*m+2*a)+m*(o*d+m+2*c)+f}else m=s,d=Math.max(0,-(o*m+a)),v=-d*d+m*(m+2*c)+f;else m=-s,d=Math.max(0,-(o*m+a)),v=-d*d+m*(m+2*c)+f;else m<=-_?(d=Math.max(0,-(-o*s+a)),m=d>0?-s:Math.min(Math.max(-s,-c),s),v=-d*d+m*(m+2*c)+f):m<=_?(d=0,m=Math.min(Math.max(-s,-c),s),v=m*(m+2*c)+f):(d=Math.max(0,-(o*s+a)),m=d>0?s:Math.min(Math.max(-s,-c),s),v=-d*d+m*(m+2*c)+f);else m=o>0?-s:s,d=Math.max(0,-(o*m+a)),v=-d*d+m*(m+2*c)+f;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Ig).addScaledVector(Ph,m),v}intersectSphere(e,t){os.subVectors(e.center,this.origin);const i=os.dot(this.direction),r=os.dot(os)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,c=i+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,c;const f=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,m=this.origin;return f>=0?(i=(e.min.x-m.x)*f,r=(e.max.x-m.x)*f):(i=(e.max.x-m.x)*f,r=(e.min.x-m.x)*f),h>=0?(s=(e.min.y-m.y)*h,o=(e.max.y-m.y)*h):(s=(e.max.y-m.y)*h,o=(e.min.y-m.y)*h),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),d>=0?(a=(e.min.z-m.z)*d,c=(e.max.z-m.z)*d):(a=(e.max.z-m.z)*d,c=(e.min.z-m.z)*d),i>c||a>r)||((a>i||i!==i)&&(i=a),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,os)!==null}intersectTriangle(e,t,i,r,s){Dg.subVectors(t,e),Lh.subVectors(i,e),Ng.crossVectors(Dg,Lh);let o=this.direction.dot(Ng),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Hs.subVectors(this.origin,e);const c=a*this.direction.dot(Lh.crossVectors(Hs,Lh));if(c<0)return null;const f=a*this.direction.dot(Dg.cross(Hs));if(f<0||c+f>o)return null;const h=-a*Hs.dot(Ng);return h<0?null:this.at(h/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class st{constructor(){st.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,r,s,o,a,c,f,h,d,m,v,_,E,S){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=c,g[2]=f,g[6]=h,g[10]=d,g[14]=m,g[3]=v,g[7]=_,g[11]=E,g[15]=S,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 st().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Va.setFromMatrixColumn(e,0).length(),s=1/Va.setFromMatrixColumn(e,1).length(),o=1/Va.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(r),f=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const m=o*h,v=o*d,_=a*h,E=a*d;t[0]=c*h,t[4]=-c*d,t[8]=f,t[1]=v+_*f,t[5]=m-E*f,t[9]=-a*c,t[2]=E-m*f,t[6]=_+v*f,t[10]=o*c}else if(e.order==="YXZ"){const m=c*h,v=c*d,_=f*h,E=f*d;t[0]=m+E*a,t[4]=_*a-v,t[8]=o*f,t[1]=o*d,t[5]=o*h,t[9]=-a,t[2]=v*a-_,t[6]=E+m*a,t[10]=o*c}else if(e.order==="ZXY"){const m=c*h,v=c*d,_=f*h,E=f*d;t[0]=m-E*a,t[4]=-o*d,t[8]=_+v*a,t[1]=v+_*a,t[5]=o*h,t[9]=E-m*a,t[2]=-o*f,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const m=o*h,v=o*d,_=a*h,E=a*d;t[0]=c*h,t[4]=_*f-v,t[8]=m*f+E,t[1]=c*d,t[5]=E*f+m,t[9]=v*f-_,t[2]=-f,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const m=o*c,v=o*f,_=a*c,E=a*f;t[0]=c*h,t[4]=E-m*d,t[8]=_*d+v,t[1]=d,t[5]=o*h,t[9]=-a*h,t[2]=-f*h,t[6]=v*d+_,t[10]=m-E*d}else if(e.order==="XZY"){const m=o*c,v=o*f,_=a*c,E=a*f;t[0]=c*h,t[4]=-d,t[8]=f*h,t[1]=m*d+E,t[5]=o*h,t[9]=v*d-_,t[2]=_*d-v,t[6]=a*h,t[10]=E*d+m}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(bL,e,PL)}lookAt(e,t,i){const r=this.elements;return Pi.subVectors(e,t),Pi.lengthSq()===0&&(Pi.z=1),Pi.normalize(),Gs.crossVectors(i,Pi),Gs.lengthSq()===0&&(Math.abs(i.z)===1?Pi.x+=1e-4:Pi.z+=1e-4,Pi.normalize(),Gs.crossVectors(i,Pi)),Gs.normalize(),Rh.crossVectors(Pi,Gs),r[0]=Gs.x,r[4]=Rh.x,r[8]=Pi.x,r[1]=Gs.y,r[5]=Rh.y,r[9]=Pi.y,r[2]=Gs.z,r[6]=Rh.z,r[10]=Pi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],c=i[8],f=i[12],h=i[1],d=i[5],m=i[9],v=i[13],_=i[2],E=i[6],S=i[10],g=i[14],x=i[3],w=i[7],T=i[11],C=i[15],P=r[0],R=r[4],I=r[8],b=r[12],L=r[1],H=r[5],q=r[9],G=r[13],W=r[2],ee=r[6],oe=r[10],ue=r[14],D=r[3],V=r[7],B=r[11],J=r[15];return s[0]=o*P+a*L+c*W+f*D,s[4]=o*R+a*H+c*ee+f*V,s[8]=o*I+a*q+c*oe+f*B,s[12]=o*b+a*G+c*ue+f*J,s[1]=h*P+d*L+m*W+v*D,s[5]=h*R+d*H+m*ee+v*V,s[9]=h*I+d*q+m*oe+v*B,s[13]=h*b+d*G+m*ue+v*J,s[2]=_*P+E*L+S*W+g*D,s[6]=_*R+E*H+S*ee+g*V,s[10]=_*I+E*q+S*oe+g*B,s[14]=_*b+E*G+S*ue+g*J,s[3]=x*P+w*L+T*W+C*D,s[7]=x*R+w*H+T*ee+C*V,s[11]=x*I+w*q+T*oe+C*B,s[15]=x*b+w*G+T*ue+C*J,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],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],c=e[9],f=e[13],h=e[2],d=e[6],m=e[10],v=e[14],_=e[3],E=e[7],S=e[11],g=e[15];return _*(+s*c*d-r*f*d-s*a*m+i*f*m+r*a*v-i*c*v)+E*(+t*c*v-t*f*m+s*o*m-r*o*v+r*f*h-s*c*h)+S*(+t*f*d-t*a*v-s*o*d+i*o*v+s*a*h-i*f*h)+g*(-r*a*h-t*c*d+t*a*m+r*o*d-i*o*m+i*c*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],d=e[9],m=e[10],v=e[11],_=e[12],E=e[13],S=e[14],g=e[15],x=d*S*f-E*m*f+E*c*v-a*S*v-d*c*g+a*m*g,w=_*m*f-h*S*f-_*c*v+o*S*v+h*c*g-o*m*g,T=h*E*f-_*d*f+_*a*v-o*E*v-h*a*g+o*d*g,C=_*d*c-h*E*c-_*a*m+o*E*m+h*a*S-o*d*S,P=t*x+i*w+r*T+s*C;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/P;return e[0]=x*R,e[1]=(E*m*s-d*S*s-E*r*v+i*S*v+d*r*g-i*m*g)*R,e[2]=(a*S*s-E*c*s+E*r*f-i*S*f-a*r*g+i*c*g)*R,e[3]=(d*c*s-a*m*s-d*r*f+i*m*f+a*r*v-i*c*v)*R,e[4]=w*R,e[5]=(h*S*s-_*m*s+_*r*v-t*S*v-h*r*g+t*m*g)*R,e[6]=(_*c*s-o*S*s-_*r*f+t*S*f+o*r*g-t*c*g)*R,e[7]=(o*m*s-h*c*s+h*r*f-t*m*f-o*r*v+t*c*v)*R,e[8]=T*R,e[9]=(_*d*s-h*E*s-_*i*v+t*E*v+h*i*g-t*d*g)*R,e[10]=(o*E*s-_*a*s+_*i*f-t*E*f-o*i*g+t*a*g)*R,e[11]=(h*a*s-o*d*s-h*i*f+t*d*f+o*i*v-t*a*v)*R,e[12]=C*R,e[13]=(h*E*r-_*d*r+_*i*m-t*E*m-h*i*S+t*d*S)*R,e[14]=(_*a*r-o*E*r-_*i*c+t*E*c+o*i*S-t*a*S)*R,e[15]=(o*d*r-h*a*r+h*i*c-t*d*c-o*i*m+t*a*m)*R,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,c=e.z,f=s*o,h=s*a;return this.set(f*o+i,f*a-r*c,f*c+r*a,0,f*a+r*c,h*a+i,h*c-r*o,0,f*c-r*a,h*c+r*o,s*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,c=t._w,f=s+s,h=o+o,d=a+a,m=s*f,v=s*h,_=s*d,E=o*h,S=o*d,g=a*d,x=c*f,w=c*h,T=c*d,C=i.x,P=i.y,R=i.z;return r[0]=(1-(E+g))*C,r[1]=(v+T)*C,r[2]=(_-w)*C,r[3]=0,r[4]=(v-T)*P,r[5]=(1-(m+g))*P,r[6]=(S+x)*P,r[7]=0,r[8]=(_+w)*R,r[9]=(S-x)*R,r[10]=(1-(m+E))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Va.set(r[0],r[1],r[2]).length();const o=Va.set(r[4],r[5],r[6]).length(),a=Va.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],gr.copy(this);const f=1/s,h=1/o,d=1/a;return gr.elements[0]*=f,gr.elements[1]*=f,gr.elements[2]*=f,gr.elements[4]*=h,gr.elements[5]*=h,gr.elements[6]*=h,gr.elements[8]*=d,gr.elements[9]*=d,gr.elements[10]*=d,t.setFromRotationMatrix(gr),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o){const a=this.elements,c=2*s/(t-e),f=2*s/(i-r),h=(t+e)/(t-e),d=(i+r)/(i-r),m=-(o+s)/(o-s),v=-2*o*s/(o-s);return a[0]=c,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=f,a[9]=d,a[13]=0,a[2]=0,a[6]=0,a[10]=m,a[14]=v,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,r,s,o){const a=this.elements,c=1/(t-e),f=1/(i-r),h=1/(o-s),d=(t+e)*c,m=(i+r)*f,v=(o+s)*h;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-d,a[1]=0,a[5]=2*f,a[9]=0,a[13]=-m,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-v,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Va=new N,gr=new st,bL=new N(0,0,0),PL=new N(1,1,1),Gs=new N,Rh=new N,Pi=new N,IS=new st,DS=new It;class Yl{constructor(e=0,t=0,i=0,r=Yl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],c=r[1],f=r[5],h=r[9],d=r[2],m=r[6],v=r[10];switch(t){case"XYZ":this._y=Math.asin(ln(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,v),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,f),this._z=0);break;case"YXZ":this._x=Math.asin(-ln(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,v),this._z=Math.atan2(c,f)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ln(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-d,v),this._z=Math.atan2(-o,f)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-ln(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(m,v),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,f));break;case"YZX":this._z=Math.asin(ln(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,f),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,v));break;case"XZY":this._z=Math.asin(-ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,f),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,v),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return IS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(IS,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return DS.setFromEuler(this),this.setFromQuaternion(DS,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}}Yl.DEFAULT_ORDER="XYZ";class ia{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 LL=0;const NS=new N,Ha=new It,as=new st,Ih=new N,Lu=new N,RL=new N,IL=new It,kS=new N(1,0,0),zS=new N(0,1,0),US=new N(0,0,1),DL={type:"added"},OS={type:"removed"};class St extends bs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:LL++}),this.uuid=Ui(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=St.DEFAULT_UP.clone();const e=new N,t=new Yl,i=new It,r=new N(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new st},normalMatrix:{value:new xt}}),this.matrix=new st,this.matrixWorld=new st,this.matrixAutoUpdate=St.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new ia,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 Ha.setFromAxisAngle(e,t),this.quaternion.multiply(Ha),this}rotateOnWorldAxis(e,t){return Ha.setFromAxisAngle(e,t),this.quaternion.premultiply(Ha),this}rotateX(e){return this.rotateOnAxis(kS,e)}rotateY(e){return this.rotateOnAxis(zS,e)}rotateZ(e){return this.rotateOnAxis(US,e)}translateOnAxis(e,t){return NS.copy(e).applyQuaternion(this.quaternion),this.position.add(NS.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(kS,e)}translateY(e){return this.translateOnAxis(zS,e)}translateZ(e){return this.translateOnAxis(US,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(as.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Ih.copy(e):Ih.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Lu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?as.lookAt(Lu,Ih,this.up):as.lookAt(Ih,Lu,this.up),this.quaternion.setFromRotationMatrix(as),r&&(as.extractRotation(r.matrixWorld),Ha.setFromRotationMatrix(as),this.quaternion.premultiply(Ha.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(DL)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(OS)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(OS)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),as.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),as.multiply(e.parent.matrixWorld)),e.applyMatrix4(as),this.add(e),e.updateWorldMatrix(!1,!0),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 i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let r=0,s=this.children.length;r<s;r++){const o=this.children[r].getObjectsByProperty(e,t);o.length>0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lu,e,RL),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lu,IL,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 i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++){const s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++){const a=r[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let f=0,h=c.length;f<h;f++){const d=c[f];s(e.shapes,d)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,f=this.material.length;c<f;c++)a.push(s(e.materials,this.material[c]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];r.animations.push(s(e.animations,c))}}if(t){const a=o(e.geometries),c=o(e.materials),f=o(e.textures),h=o(e.images),d=o(e.shapes),m=o(e.skeletons),v=o(e.animations),_=o(e.nodes);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),f.length>0&&(i.textures=f),h.length>0&&(i.images=h),d.length>0&&(i.shapes=d),m.length>0&&(i.skeletons=m),v.length>0&&(i.animations=v),_.length>0&&(i.nodes=_)}return i.object=r,i;function o(a){const c=[];for(const f in a){const h=a[f];delete h.metadata,c.push(h)}return c}}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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}St.DEFAULT_UP=new N(0,1,0);St.DEFAULT_MATRIX_AUTO_UPDATE=!0;St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const vr=new N,ls=new N,kg=new N,us=new N,Ga=new N,Wa=new N,FS=new N,zg=new N,Ug=new N,Og=new N;let Dh=!1;class yi{constructor(e=new N,t=new N,i=new N){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),vr.subVectors(e,t),r.cross(vr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){vr.subVectors(r,t),ls.subVectors(i,t),kg.subVectors(e,t);const o=vr.dot(vr),a=vr.dot(ls),c=vr.dot(kg),f=ls.dot(ls),h=ls.dot(kg),d=o*f-a*a;if(d===0)return s.set(-2,-1,-1);const m=1/d,v=(f*c-a*h)*m,_=(o*h-a*c)*m;return s.set(1-v-_,_,v)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,us),us.x>=0&&us.y>=0&&us.x+us.y<=1}static getUV(e,t,i,r,s,o,a,c){return Dh===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Dh=!0),this.getInterpolation(e,t,i,r,s,o,a,c)}static getInterpolation(e,t,i,r,s,o,a,c){return this.getBarycoord(e,t,i,r,us),c.setScalar(0),c.addScaledVector(s,us.x),c.addScaledVector(o,us.y),c.addScaledVector(a,us.z),c}static isFrontFacing(e,t,i,r){return vr.subVectors(i,t),ls.subVectors(e,t),vr.cross(ls).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return vr.subVectors(this.c,this.b),ls.subVectors(this.a,this.b),vr.cross(ls).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return yi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return yi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return Dh===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Dh=!0),yi.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return yi.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return yi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return yi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Ga.subVectors(r,i),Wa.subVectors(s,i),zg.subVectors(e,i);const c=Ga.dot(zg),f=Wa.dot(zg);if(c<=0&&f<=0)return t.copy(i);Ug.subVectors(e,r);const h=Ga.dot(Ug),d=Wa.dot(Ug);if(h>=0&&d<=h)return t.copy(r);const m=c*d-h*f;if(m<=0&&c>=0&&h<=0)return o=c/(c-h),t.copy(i).addScaledVector(Ga,o);Og.subVectors(e,s);const v=Ga.dot(Og),_=Wa.dot(Og);if(_>=0&&v<=_)return t.copy(s);const E=v*f-c*_;if(E<=0&&f>=0&&_<=0)return a=f/(f-_),t.copy(i).addScaledVector(Wa,a);const S=h*_-v*d;if(S<=0&&d-h>=0&&v-_>=0)return FS.subVectors(s,r),a=(d-h)/(d-h+(v-_)),t.copy(r).addScaledVector(FS,a);const g=1/(S+E+m);return o=E*g,a=m*g,t.copy(i).addScaledVector(Ga,o).addScaledVector(Wa,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let NL=0;class Bn extends bs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:NL++}),this.uuid=Ui(),this.name="",this.type="Material",this.blending=ea,this.side=Ms,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Wy,this.blendDst=Xy,this.blendEquation=Vo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=op,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=C2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Nd,this.stencilZFail=Nd,this.stencilZPass=Nd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==ea&&(i.blending=this.blending),this.side!==Ms&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const c=s[a];delete c.metadata,o.push(c)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}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.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 i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,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.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const R2={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},yr={h:0,s:0,l:0},Nh={h:0,s:0,l:0};function Fg(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Re{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Sr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,mi.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=mi.workingColorSpace){return this.r=e,this.g=t,this.b=i,mi.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=mi.workingColorSpace){if(e=Jy(e,1),t=ln(t,0,1),i=ln(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=Fg(o,s,e+1/3),this.g=Fg(o,s,e),this.b=Fg(o,s,e-1/3)}return mi.toWorkingColorSpace(this,r),this}setStyle(e,t=Sr){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,mi.toWorkingColorSpace(this,t),i(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,mi.toWorkingColorSpace(this,t),i(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const c=parseFloat(s[1])/360,f=parseFloat(s[2])/100,h=parseFloat(s[3])/100;return i(s[4]),this.setHSL(c,f,h,t)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Sr){const i=R2[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Pl(e.r),this.g=Pl(e.g),this.b=Pl(e.b),this}copyLinearToSRGB(e){return this.r=Cg(e.r),this.g=Cg(e.g),this.b=Cg(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Sr){return mi.fromWorkingColorSpace(Zn.copy(this),e),ln(Zn.r*255,0,255)<<16^ln(Zn.g*255,0,255)<<8^ln(Zn.b*255,0,255)<<0}getHexString(e=Sr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=mi.workingColorSpace){mi.fromWorkingColorSpace(Zn.copy(this),t);const i=Zn.r,r=Zn.g,s=Zn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let c,f;const h=(a+o)/2;if(a===o)c=0,f=0;else{const d=o-a;switch(f=h<=.5?d/(o+a):d/(2-o-a),o){case i:c=(r-s)/d+(r<s?6:0);break;case r:c=(s-i)/d+2;break;case s:c=(i-r)/d+4;break}c/=6}return e.h=c,e.s=f,e.l=h,e}getRGB(e,t=mi.workingColorSpace){return mi.fromWorkingColorSpace(Zn.copy(this),t),e.r=Zn.r,e.g=Zn.g,e.b=Zn.b,e}getStyle(e=Sr){mi.fromWorkingColorSpace(Zn.copy(this),e);const t=Zn.r,i=Zn.g,r=Zn.b;return e!==Sr?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${t*255|0},${i*255|0},${r*255|0})`}offsetHSL(e,t,i){return this.getHSL(yr),yr.h+=e,yr.s+=t,yr.l+=i,this.setHSL(yr.h,yr.s,yr.l),this}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(yr),e.getHSL(Nh);const i=sc(yr.h,Nh.h,t),r=sc(yr.s,Nh.s,t),s=sc(yr.l,Nh.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Zn=new Re;Re.NAMES=R2;class Zr extends Bn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Re(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ds=kL();function kL(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let c=0;c<256;++c){const f=c-127;f<-27?(i[c]=0,i[c|256]=32768,r[c]=24,r[c|256]=24):f<-14?(i[c]=1024>>-f-14,i[c|256]=1024>>-f-14|32768,r[c]=-f-1,r[c|256]=-f-1):f<=15?(i[c]=f+15<<10,i[c|256]=f+15<<10|32768,r[c]=13,r[c|256]=13):f<128?(i[c]=31744,i[c|256]=64512,r[c]=24,r[c|256]=24):(i[c]=31744,i[c|256]=64512,r[c]=13,r[c|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let f=c<<13,h=0;for(;(f&8388608)===0;)f<<=1,h-=8388608;f&=-8388609,h+=947912704,s[c]=f|h}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function gi(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=ln(n,-65504,65504),ds.floatView[0]=n;const e=ds.uint32View[0],t=e>>23&511;return ds.baseTable[t]+((e&8388607)>>ds.shiftTable[t])}function ju(n){const e=n>>10;return ds.uint32View[0]=ds.mantissaTable[ds.offsetTable[e]+(n&1023)]+ds.exponentTable[e],ds.floatView[0]}const zL={toHalfFloat:gi,fromHalfFloat:ju},yn=new N,kh=new ge;class Bt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ic,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)kh.fromBufferAttribute(this,t),kh.applyMatrix3(e),this.setXY(t,kh.x,kh.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)yn.fromBufferAttribute(this,t),yn.applyMatrix3(e),this.setXYZ(t,yn.x,yn.y,yn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)yn.fromBufferAttribute(this,t),yn.applyMatrix4(e),this.setXYZ(t,yn.x,yn.y,yn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)yn.fromBufferAttribute(this,t),yn.applyNormalMatrix(e),this.setXYZ(t,yn.x,yn.y,yn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)yn.fromBufferAttribute(this,t),yn.transformDirection(e),this.setXYZ(t,yn.x,yn.y,yn.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ki(t,this.array)),t}setX(e,t){return this.normalized&&(t=dt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ki(t,this.array)),t}setY(e,t){return this.normalized&&(t=dt(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=ki(t,this.array)),t}setZ(e,t){return this.normalized&&(t=dt(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=ki(t,this.array)),t}setW(e,t){return this.normalized&&(t=dt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array),r=dt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array),r=dt(r,this.array),s=dt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ic&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class UL extends Bt{constructor(e,t,i){super(new Int8Array(e),t,i)}}class OL extends Bt{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class FL extends Bt{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class BL extends Bt{constructor(e,t,i){super(new Int16Array(e),t,i)}}class e_ extends Bt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class VL extends Bt{constructor(e,t,i){super(new Int32Array(e),t,i)}}class t_ extends Bt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class HL extends Bt{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=ju(this.array[e*this.itemSize]);return this.normalized&&(t=ki(t,this.array)),t}setX(e,t){return this.normalized&&(t=dt(t,this.array)),this.array[e*this.itemSize]=gi(t),this}getY(e){let t=ju(this.array[e*this.itemSize+1]);return this.normalized&&(t=ki(t,this.array)),t}setY(e,t){return this.normalized&&(t=dt(t,this.array)),this.array[e*this.itemSize+1]=gi(t),this}getZ(e){let t=ju(this.array[e*this.itemSize+2]);return this.normalized&&(t=ki(t,this.array)),t}setZ(e,t){return this.normalized&&(t=dt(t,this.array)),this.array[e*this.itemSize+2]=gi(t),this}getW(e){let t=ju(this.array[e*this.itemSize+3]);return this.normalized&&(t=ki(t,this.array)),t}setW(e,t){return this.normalized&&(t=dt(t,this.array)),this.array[e*this.itemSize+3]=gi(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array)),this.array[e+0]=gi(t),this.array[e+1]=gi(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array),r=dt(r,this.array)),this.array[e+0]=gi(t),this.array[e+1]=gi(i),this.array[e+2]=gi(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array),r=dt(r,this.array),s=dt(s,this.array)),this.array[e+0]=gi(t),this.array[e+1]=gi(i),this.array[e+2]=gi(r),this.array[e+3]=gi(s),this}}class Be extends Bt{constructor(e,t,i){super(new Float32Array(e),t,i)}}class GL extends Bt{constructor(e,t,i){super(new Float64Array(e),t,i)}}let WL=0;const Ji=new st,Bg=new St,Xa=new N,Li=new Yr,Ru=new Yr,Pn=new N;class lt extends bs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:WL++}),this.uuid=Ui(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(L2(e)?t_:e_)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}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 i=this.attributes.normal;if(i!==void 0){const s=new xt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ji.makeRotationFromQuaternion(e),this.applyMatrix4(Ji),this}rotateX(e){return Ji.makeRotationX(e),this.applyMatrix4(Ji),this}rotateY(e){return Ji.makeRotationY(e),this.applyMatrix4(Ji),this}rotateZ(e){return Ji.makeRotationZ(e),this.applyMatrix4(Ji),this}translate(e,t,i){return Ji.makeTranslation(e,t,i),this.applyMatrix4(Ji),this}scale(e,t,i){return Ji.makeScale(e,t,i),this.applyMatrix4(Ji),this}lookAt(e){return Bg.lookAt(e),Bg.updateMatrix(),this.applyMatrix4(Bg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xa).negate(),this.translate(Xa.x,Xa.y,Xa.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Be(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Yr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Li.setFromBufferAttribute(s),this.morphTargetsRelative?(Pn.addVectors(this.boundingBox.min,Li.min),this.boundingBox.expandByPoint(Pn),Pn.addVectors(this.boundingBox.max,Li.max),this.boundingBox.expandByPoint(Pn)):(this.boundingBox.expandByPoint(Li.min),this.boundingBox.expandByPoint(Li.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new N,1/0);return}if(e){const i=this.boundingSphere.center;if(Li.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];Ru.setFromBufferAttribute(a),this.morphTargetsRelative?(Pn.addVectors(Li.min,Ru.min),Li.expandByPoint(Pn),Pn.addVectors(Li.max,Ru.max),Li.expandByPoint(Pn)):(Li.expandByPoint(Ru.min),Li.expandByPoint(Ru.max))}Li.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Pn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Pn));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],c=this.morphTargetsRelative;for(let f=0,h=a.count;f<h;f++)Pn.fromBufferAttribute(a,f),c&&(Xa.fromBufferAttribute(e,f),Pn.add(Xa)),r=Math.max(r,i.distanceToSquared(Pn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=t.position.array,s=t.normal.array,o=t.uv.array,a=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Bt(new Float32Array(4*a),4));const c=this.getAttribute("tangent").array,f=[],h=[];for(let L=0;L<a;L++)f[L]=new N,h[L]=new N;const d=new N,m=new N,v=new N,_=new ge,E=new ge,S=new ge,g=new N,x=new N;function w(L,H,q){d.fromArray(r,L*3),m.fromArray(r,H*3),v.fromArray(r,q*3),_.fromArray(o,L*2),E.fromArray(o,H*2),S.fromArray(o,q*2),m.sub(d),v.sub(d),E.sub(_),S.sub(_);const G=1/(E.x*S.y-S.x*E.y);!isFinite(G)||(g.copy(m).multiplyScalar(S.y).addScaledVector(v,-E.y).multiplyScalar(G),x.copy(v).multiplyScalar(E.x).addScaledVector(m,-S.x).multiplyScalar(G),f[L].add(g),f[H].add(g),f[q].add(g),h[L].add(x),h[H].add(x),h[q].add(x))}let T=this.groups;T.length===0&&(T=[{start:0,count:i.length}]);for(let L=0,H=T.length;L<H;++L){const q=T[L],G=q.start,W=q.count;for(let ee=G,oe=G+W;ee<oe;ee+=3)w(i[ee+0],i[ee+1],i[ee+2])}const C=new N,P=new N,R=new N,I=new N;function b(L){R.fromArray(s,L*3),I.copy(R);const H=f[L];C.copy(H),C.sub(R.multiplyScalar(R.dot(H))).normalize(),P.crossVectors(I,H);const G=P.dot(h[L])<0?-1:1;c[L*4]=C.x,c[L*4+1]=C.y,c[L*4+2]=C.z,c[L*4+3]=G}for(let L=0,H=T.length;L<H;++L){const q=T[L],G=q.start,W=q.count;for(let ee=G,oe=G+W;ee<oe;ee+=3)b(i[ee+0]),b(i[ee+1]),b(i[ee+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Bt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let m=0,v=i.count;m<v;m++)i.setXYZ(m,0,0,0);const r=new N,s=new N,o=new N,a=new N,c=new N,f=new N,h=new N,d=new N;if(e)for(let m=0,v=e.count;m<v;m+=3){const _=e.getX(m+0),E=e.getX(m+1),S=e.getX(m+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,E),o.fromBufferAttribute(t,S),h.subVectors(o,s),d.subVectors(r,s),h.cross(d),a.fromBufferAttribute(i,_),c.fromBufferAttribute(i,E),f.fromBufferAttribute(i,S),a.add(h),c.add(h),f.add(h),i.setXYZ(_,a.x,a.y,a.z),i.setXYZ(E,c.x,c.y,c.z),i.setXYZ(S,f.x,f.y,f.z)}else for(let m=0,v=t.count;m<v;m+=3)r.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),o.fromBufferAttribute(t,m+2),h.subVectors(o,s),d.subVectors(r,s),h.cross(d),i.setXYZ(m+0,h.x,h.y,h.z),i.setXYZ(m+1,h.x,h.y,h.z),i.setXYZ(m+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Pn.fromBufferAttribute(e,t),Pn.normalize(),e.setXYZ(t,Pn.x,Pn.y,Pn.z)}toNonIndexed(){function e(a,c){const f=a.array,h=a.itemSize,d=a.normalized,m=new f.constructor(c.length*h);let v=0,_=0;for(let E=0,S=c.length;E<S;E++){a.isInterleavedBufferAttribute?v=c[E]*a.data.stride+a.offset:v=c[E]*h;for(let g=0;g<h;g++)m[_++]=f[v++]}return new Bt(m,h,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new lt,i=this.index.array,r=this.attributes;for(const a in r){const c=r[a],f=e(c,i);t.setAttribute(a,f)}const s=this.morphAttributes;for(const a in s){const c=[],f=s[a];for(let h=0,d=f.length;h<d;h++){const m=f[h],v=e(m,i);c.push(v)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const f=o[a];t.addGroup(f.start,f.count,f.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,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 c=this.parameters;for(const f in c)c[f]!==void 0&&(e[f]=c[f]);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 i=this.attributes;for(const c in i){const f=i[c];e.data.attributes[c]=f.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const f=this.morphAttributes[c],h=[];for(let d=0,m=f.length;d<m;d++){const v=f[d];h.push(v.toJSON(e.data))}h.length>0&&(r[c]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const f in r){const h=r[f];this.setAttribute(f,h.clone(t))}const s=e.morphAttributes;for(const f in s){const h=[],d=s[f];for(let m=0,v=d.length;m<v;m++)h.push(d[m].clone(t));this.morphAttributes[f]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let f=0,h=o.length;f<h;f++){const d=o[f];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const BS=new st,Or=new Qc,zh=new qr,VS=new N,ja=new N,Ya=new N,qa=new N,Vg=new N,Uh=new N,Oh=new ge,Fh=new ge,Bh=new ge,HS=new N,GS=new N,WS=new N,Vh=new N,Hh=new N;class Ne extends St{constructor(e=new lt,t=new Zr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){Uh.set(0,0,0);for(let c=0,f=s.length;c<f;c++){const h=a[c],d=s[c];h!==0&&(Vg.fromBufferAttribute(d,e),o?Uh.addScaledVector(Vg,h):Uh.addScaledVector(Vg.sub(t),h))}t.add(Uh)}return this.isSkinnedMesh&&this.applyBoneTransform(e,t),t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;if(r===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),zh.copy(i.boundingSphere),zh.applyMatrix4(s),Or.copy(e.ray).recast(e.near),zh.containsPoint(Or.origin)===!1&&(Or.intersectSphere(zh,VS)===null||Or.origin.distanceToSquared(VS)>(e.far-e.near)**2))||(BS.copy(s).invert(),Or.copy(e.ray).applyMatrix4(BS),i.boundingBox!==null&&Or.intersectsBox(i.boundingBox)===!1))return;let o;const a=i.index,c=i.attributes.position,f=i.attributes.uv,h=i.attributes.uv2,d=i.attributes.normal,m=i.groups,v=i.drawRange;if(a!==null)if(Array.isArray(r))for(let _=0,E=m.length;_<E;_++){const S=m[_],g=r[S.materialIndex],x=Math.max(S.start,v.start),w=Math.min(a.count,Math.min(S.start+S.count,v.start+v.count));for(let T=x,C=w;T<C;T+=3){const P=a.getX(T),R=a.getX(T+1),I=a.getX(T+2);o=Gh(this,g,e,Or,f,h,d,P,R,I),o&&(o.faceIndex=Math.floor(T/3),o.face.materialIndex=S.materialIndex,t.push(o))}}else{const _=Math.max(0,v.start),E=Math.min(a.count,v.start+v.count);for(let S=_,g=E;S<g;S+=3){const x=a.getX(S),w=a.getX(S+1),T=a.getX(S+2);o=Gh(this,r,e,Or,f,h,d,x,w,T),o&&(o.faceIndex=Math.floor(S/3),t.push(o))}}else if(c!==void 0)if(Array.isArray(r))for(let _=0,E=m.length;_<E;_++){const S=m[_],g=r[S.materialIndex],x=Math.max(S.start,v.start),w=Math.min(c.count,Math.min(S.start+S.count,v.start+v.count));for(let T=x,C=w;T<C;T+=3){const P=T,R=T+1,I=T+2;o=Gh(this,g,e,Or,f,h,d,P,R,I),o&&(o.faceIndex=Math.floor(T/3),o.face.materialIndex=S.materialIndex,t.push(o))}}else{const _=Math.max(0,v.start),E=Math.min(c.count,v.start+v.count);for(let S=_,g=E;S<g;S+=3){const x=S,w=S+1,T=S+2;o=Gh(this,r,e,Or,f,h,d,x,w,T),o&&(o.faceIndex=Math.floor(S/3),t.push(o))}}}}function XL(n,e,t,i,r,s,o,a){let c;if(e.side===li?c=i.intersectTriangle(o,s,r,!0,a):c=i.intersectTriangle(r,s,o,e.side===Ms,a),c===null)return null;Hh.copy(a),Hh.applyMatrix4(n.matrixWorld);const f=t.ray.origin.distanceTo(Hh);return f<t.near||f>t.far?null:{distance:f,point:Hh.clone(),object:n}}function Gh(n,e,t,i,r,s,o,a,c,f){n.getVertexPosition(a,ja),n.getVertexPosition(c,Ya),n.getVertexPosition(f,qa);const h=XL(n,e,t,i,ja,Ya,qa,Vh);if(h){r&&(Oh.fromBufferAttribute(r,a),Fh.fromBufferAttribute(r,c),Bh.fromBufferAttribute(r,f),h.uv=yi.getInterpolation(Vh,ja,Ya,qa,Oh,Fh,Bh,new ge)),s&&(Oh.fromBufferAttribute(s,a),Fh.fromBufferAttribute(s,c),Bh.fromBufferAttribute(s,f),h.uv2=yi.getInterpolation(Vh,ja,Ya,qa,Oh,Fh,Bh,new ge)),o&&(HS.fromBufferAttribute(o,a),GS.fromBufferAttribute(o,c),WS.fromBufferAttribute(o,f),h.normal=yi.getInterpolation(Vh,ja,Ya,qa,HS,GS,WS,new N),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const d={a,b:c,c:f,normal:new N,materialIndex:0};yi.getNormal(ja,Ya,qa,d.normal),h.face=d}return h}class oi extends lt{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const c=[],f=[],h=[],d=[];let m=0,v=0;_("z","y","x",-1,-1,i,t,e,o,s,0),_("z","y","x",1,-1,i,t,-e,o,s,1),_("x","z","y",1,1,e,i,t,r,o,2),_("x","z","y",1,-1,e,i,-t,r,o,3),_("x","y","z",1,-1,e,t,i,r,s,4),_("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(c),this.setAttribute("position",new Be(f,3)),this.setAttribute("normal",new Be(h,3)),this.setAttribute("uv",new Be(d,2));function _(E,S,g,x,w,T,C,P,R,I,b){const L=T/R,H=C/I,q=T/2,G=C/2,W=P/2,ee=R+1,oe=I+1;let ue=0,D=0;const V=new N;for(let B=0;B<oe;B++){const J=B*H-G;for(let Y=0;Y<ee;Y++){const K=Y*L-q;V[E]=K*x,V[S]=J*w,V[g]=W,f.push(V.x,V.y,V.z),V[E]=0,V[S]=0,V[g]=P>0?1:-1,h.push(V.x,V.y,V.z),d.push(Y/R),d.push(1-B/I),ue+=1}}for(let B=0;B<I;B++)for(let J=0;J<R;J++){const Y=m+J+ee*B,K=m+J+ee*(B+1),z=m+(J+1)+ee*(B+1),ye=m+(J+1)+ee*B;c.push(Y,K,ye),c.push(K,z,ye),D+=6}a.addGroup(v,D,b),v+=D,m+=ue}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Bl(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function ri(n){const e={};for(let t=0;t<n.length;t++){const i=Bl(n[t]);for(const r in i)e[r]=i[r]}return e}function jL(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function I2(n){return n.getRenderTarget()===null&&n.outputEncoding===Ot?Sr:Ol}const D2={clone:Bl,merge:ri};var YL=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,qL=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class jr extends Bn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=YL,this.fragmentShader=qL,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Bl(e.uniforms),this.uniformsGroups=jL(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Jc extends St{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new st,this.projectionMatrix=new st,this.projectionMatrixInverse=new st}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class In extends Jc{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Fl*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(na*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Fl*2*Math.atan(Math.tan(na*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(na*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,f=o.fullHeight;s+=o.offsetX*r/c,t-=o.offsetY*i/f,r*=o.width/c,i*=o.height/f}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Za=-90,Qa=1;class N2 extends St{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;const r=new In(Za,Qa,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);const s=new In(Za,Qa,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new In(Za,Qa,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new In(Za,Qa,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const c=new In(Za,Qa,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,1),this.add(c);const f=new In(Za,Qa,e,t);f.layers=this.layers,f.up.set(0,1,0),f.lookAt(0,0,-1),this.add(f)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[r,s,o,a,c,f]=this.children,h=e.getRenderTarget(),d=e.toneMapping,m=e.xr.enabled;e.toneMapping=Ar,e.xr.enabled=!1;const v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,c),i.texture.generateMipmaps=v,e.setRenderTarget(i,5),e.render(t,f),e.setRenderTarget(h),e.toneMapping=d,e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class Kc extends un{constructor(e,t,i,r,s,o,a,c,f,h){e=e!==void 0?e:[],t=t!==void 0?t:fo,super(e,t,i,r,s,o,a,c,f,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class k2 extends ar{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new Kc(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:en}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},r=new oi(5,5,5),s=new jr({name:"CubemapFromEquirect",uniforms:Bl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:li,blending:ys});s.uniforms.tEquirect.value=t;const o=new Ne(r,s),a=t.minFilter;return t.minFilter===po&&(t.minFilter=en),new N2(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const Hg=new N,ZL=new N,QL=new xt;class Ys{constructor(e=new N(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Hg.subVectors(i,t).cross(ZL.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(Hg),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||QL.getNormalMatrix(e),r=this.coplanarPoint(Hg).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Io=new qr,Wh=new N;class Ip{constructor(e=new Ys,t=new Ys,i=new Ys,r=new Ys,s=new Ys,o=new Ys){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,r=i[0],s=i[1],o=i[2],a=i[3],c=i[4],f=i[5],h=i[6],d=i[7],m=i[8],v=i[9],_=i[10],E=i[11],S=i[12],g=i[13],x=i[14],w=i[15];return t[0].setComponents(a-r,d-c,E-m,w-S).normalize(),t[1].setComponents(a+r,d+c,E+m,w+S).normalize(),t[2].setComponents(a+s,d+f,E+v,w+g).normalize(),t[3].setComponents(a-s,d-f,E-v,w-g).normalize(),t[4].setComponents(a-o,d-h,E-_,w-x).normalize(),t[5].setComponents(a+o,d+h,E+_,w+x).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Io.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Io.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Io)}intersectsSprite(e){return Io.center.set(0,0,0),Io.radius=.7071067811865476,Io.applyMatrix4(e.matrixWorld),this.intersectsSphere(Io)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Wh.x=r.normal.x>0?e.max.x:e.min.x,Wh.y=r.normal.y>0?e.max.y:e.min.y,Wh.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Wh)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function z2(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function JL(n,e){const t=e.isWebGL2,i=new WeakMap;function r(f,h){const d=f.array,m=f.usage,v=n.createBuffer();n.bindBuffer(h,v),n.bufferData(h,d,m),f.onUploadCallback();let _;if(d instanceof Float32Array)_=5126;else if(d instanceof Uint16Array)if(f.isFloat16BufferAttribute)if(t)_=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=5123;else if(d instanceof Int16Array)_=5122;else if(d instanceof Uint32Array)_=5125;else if(d instanceof Int32Array)_=5124;else if(d instanceof Int8Array)_=5120;else if(d instanceof Uint8Array)_=5121;else if(d instanceof Uint8ClampedArray)_=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:v,type:_,bytesPerElement:d.BYTES_PER_ELEMENT,version:f.version}}function s(f,h,d){const m=h.array,v=h.updateRange;n.bindBuffer(d,f),v.count===-1?n.bufferSubData(d,0,m):(t?n.bufferSubData(d,v.offset*m.BYTES_PER_ELEMENT,m,v.offset,v.count):n.bufferSubData(d,v.offset*m.BYTES_PER_ELEMENT,m.subarray(v.offset,v.offset+v.count)),v.count=-1),h.onUploadCallback()}function o(f){return f.isInterleavedBufferAttribute&&(f=f.data),i.get(f)}function a(f){f.isInterleavedBufferAttribute&&(f=f.data);const h=i.get(f);h&&(n.deleteBuffer(h.buffer),i.delete(f))}function c(f,h){if(f.isGLBufferAttribute){const m=i.get(f);(!m||m.version<f.version)&&i.set(f,{buffer:f.buffer,type:f.type,bytesPerElement:f.elementSize,version:f.version});return}f.isInterleavedBufferAttribute&&(f=f.data);const d=i.get(f);d===void 0?i.set(f,r(f,h)):d.version<f.version&&(s(d.buffer,f,h),d.version=f.version)}return{get:o,remove:a,update:c}}class Di extends lt{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),c=Math.floor(r),f=a+1,h=c+1,d=e/a,m=t/c,v=[],_=[],E=[],S=[];for(let g=0;g<h;g++){const x=g*m-o;for(let w=0;w<f;w++){const T=w*d-s;_.push(T,-x,0),E.push(0,0,1),S.push(w/a),S.push(1-g/c)}}for(let g=0;g<c;g++)for(let x=0;x<a;x++){const w=x+f*g,T=x+f*(g+1),C=x+1+f*(g+1),P=x+1+f*g;v.push(w,T,P),v.push(T,C,P)}this.setIndex(v),this.setAttribute("position",new Be(_,3)),this.setAttribute("normal",new Be(E,3)),this.setAttribute("uv",new Be(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Di(e.width,e.height,e.widthSegments,e.heightSegments)}}var KL=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,$L=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,eR=`#ifdef USE_ALPHATEST
if ( diffuseColor.a < alphaTest ) discard;
#endif`,tR=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,nR=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,iR=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,rR="vec3 transformed = vec3( position );",sR=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,oR=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
} // validated`,aR=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float R21 = R12;
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
#endif`,lR=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = dFdx( surf_pos.xyz );
vec3 vSigmaY = dFdy( surf_pos.xyz );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,uR=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
#endif`,cR=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,fR=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,hR=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,dR=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,pR=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,mR=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
varying vec3 vColor;
#endif`,gR=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif`,vR=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
struct GeometricContext {
vec3 position;
vec3 normal;
vec3 viewDir;
#ifdef USE_CLEARCOAT
vec3 clearcoatNormal;
#endif
};
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
float luminance( const in vec3 rgb ) {
const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,yR=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_v0 0.339
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_v1 0.276
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_v4 0.046
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_v5 0.016
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_v6 0.0038
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
#endif`,_R=`vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
mat3 m = mat3( instanceMatrix );
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
transformedNormal = m * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,xR=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,SR=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,wR=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,MR=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,ER="gl_FragColor = linearToOutputTexel( gl_FragColor );",TR=`vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 LinearTosRGB( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,AR=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,CR=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,bR=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,PR=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,LR=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,RR=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,IR=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,DR=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,NR=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,kR=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
}`,zR=`#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
reflectedLight.indirectDiffuse += lightMapIrradiance;
#endif`,UR=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,OR=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,FR=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,BR=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( LEGACY_LIGHTS )
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
}
return 1.0;
#else
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
#endif
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometry.position;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometry.position;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
#endif`,VR=`#if defined( USE_ENVMAP )
vec3 getIBLIrradiance( const in vec3 normal ) {
#if defined( ENVMAP_TYPE_CUBE_UV )
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#if defined( ENVMAP_TYPE_CUBE_UV )
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#endif`,HR=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,GR=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,WR=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,XR=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,jR=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif`,YR=`struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
float specularF90;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
};
vec3 clearcoatSpecular = vec3( 0.0 );
vec3 sheenSpecular = vec3( 0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColor;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
vec2 fab = DFGApprox( normal, viewDir, roughness );
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
vec2 fab = DFGApprox( normal, viewDir, roughness );
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometry.normal;
vec3 viewDir = geometry.viewDir;
vec3 position = geometry.position;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
#endif
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
#else
computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
#endif
vec3 totalScattering = singleScattering + multiScattering;
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
reflectedLight.indirectSpecular += radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,qR=`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef USE_CLEARCOAT
geometry.clearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometry.viewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometry, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,ZR=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometry.normal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
#endif
#endif`,QR=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,JR=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,KR=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,$R=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
#endif`,eI=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#else
if ( isPerspectiveMatrix( projectionMatrix ) ) {
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
gl_Position.z *= gl_Position.w;
}
#endif
#endif`,tI=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
#endif
diffuseColor *= sampledDiffuseColor;
#endif`,nI=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,iI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,rI=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,sI=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,oI=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,aI=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
#endif`,lI=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#else
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif
#endif`,uI=`#ifdef USE_MORPHTARGETS
uniform float morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#else
#ifndef USE_MORPHNORMALS
uniform float morphTargetInfluences[ 8 ];
#else
uniform float morphTargetInfluences[ 4 ];
#endif
#endif
#endif`,cI=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#else
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
#ifndef USE_MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
#endif
#endif
#endif`,fI=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#ifdef USE_NORMALMAP_TANGENTSPACE
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
vec3 geometryNormal = normal;`,hI=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,dI=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,pI=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,mI=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,gI=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
#endif`,vI=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = geometryNormal;
#endif`,yI=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,_I=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
#endif`,xI=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,SI=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha + 0.1;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,wI=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
vec4 r = vec4( fract( v * PackFactors ), v );
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors );
}
vec2 packDepthToRG( in highp float v ) {
return packDepthToRGBA( v ).yx;
}
float unpackRGToDepth( const in highp vec2 v ) {
return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
}
vec4 pack2HalfToRGBA( vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
}`,MI=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,EI=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,TI=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,AI=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,CI=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,bI=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,PI=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return shadow;
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
vec3 lightToPosition = shadowCoord.xyz;
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
return (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
#endif`,LI=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,RI=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif`,II=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,DI=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,NI=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
uniform int boneTextureSize;
mat4 getBoneMatrix( const in float i ) {
float j = i * 4.0;
float x = mod( j, float( boneTextureSize ) );
float y = floor( j / float( boneTextureSize ) );
float dx = 1.0 / float( boneTextureSize );
float dy = 1.0 / float( boneTextureSize );
y = dy * ( y + 0.5 );
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
mat4 bone = mat4( v1, v2, v3, v4 );
return bone;
}
#endif`,kI=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,zI=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,UI=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,OI=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,FI=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,BI=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return toneMappingExposure * color;
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,VI=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmission = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
#endif`,HI=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, vec2 fullSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 lodFudge = pow( 1.95, lod ) / fullSize;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec2 fullSize = vec2( textureSize( sampler, 0 ) );
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return radiance;
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
}
#endif`,GI=`#ifdef USE_UV
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,WI=`#ifdef USE_UV
varying vec2 vUv;
#endif
#ifdef USE_UV2
attribute vec2 uv2;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,XI=`#ifdef USE_UV
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,jI=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;const YI=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,qI=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
#ifdef DECODE_VIDEO_TEXTURE
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,ZI=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,QI=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,JI=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,KI=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,$I=`#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,eD=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <logdepthbuf_fragment>
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#endif
}`,tD=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,nD=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
}`,iD=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,rD=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,sD=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,oD=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,aD=`#include <common>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,lD=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,uD=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,cD=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,fD=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,hD=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,dD=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,pD=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,mD=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,gD=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,vD=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
}`,yD=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
#endif
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,_D=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,xD=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,SD=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,wD=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,MD=`#include <common>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,ED=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}`,TD=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,AD=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}`,ht={alphamap_fragment:KL,alphamap_pars_fragment:$L,alphatest_fragment:eR,alphatest_pars_fragment:tR,aomap_fragment:nR,aomap_pars_fragment:iR,begin_vertex:rR,beginnormal_vertex:sR,bsdfs:oR,iridescence_fragment:aR,bumpmap_pars_fragment:lR,clipping_planes_fragment:uR,clipping_planes_pars_fragment:cR,clipping_planes_pars_vertex:fR,clipping_planes_vertex:hR,color_fragment:dR,color_pars_fragment:pR,color_pars_vertex:mR,color_vertex:gR,common:vR,cube_uv_reflection_fragment:yR,defaultnormal_vertex:_R,displacementmap_pars_vertex:xR,displacementmap_vertex:SR,emissivemap_fragment:wR,emissivemap_pars_fragment:MR,encodings_fragment:ER,encodings_pars_fragment:TR,envmap_fragment:AR,envmap_common_pars_fragment:CR,envmap_pars_fragment:bR,envmap_pars_vertex:PR,envmap_physical_pars_fragment:VR,envmap_vertex:LR,fog_vertex:RR,fog_pars_vertex:IR,fog_fragment:DR,fog_pars_fragment:NR,gradientmap_pars_fragment:kR,lightmap_fragment:zR,lightmap_pars_fragment:UR,lights_lambert_fragment:OR,lights_lambert_pars_fragment:FR,lights_pars_begin:BR,lights_toon_fragment:HR,lights_toon_pars_fragment:GR,lights_phong_fragment:WR,lights_phong_pars_fragment:XR,lights_physical_fragment:jR,lights_physical_pars_fragment:YR,lights_fragment_begin:qR,lights_fragment_maps:ZR,lights_fragment_end:QR,logdepthbuf_fragment:JR,logdepthbuf_pars_fragment:KR,logdepthbuf_pars_vertex:$R,logdepthbuf_vertex:eI,map_fragment:tI,map_pars_fragment:nI,map_particle_fragment:iI,map_particle_pars_fragment:rI,metalnessmap_fragment:sI,metalnessmap_pars_fragment:oI,morphcolor_vertex:aI,morphnormal_vertex:lI,morphtarget_pars_vertex:uI,morphtarget_vertex:cI,normal_fragment_begin:fI,normal_fragment_maps:hI,normal_pars_fragment:dI,normal_pars_vertex:pI,normal_vertex:mI,normalmap_pars_fragment:gI,clearcoat_normal_fragment_begin:vI,clearcoat_normal_fragment_maps:yI,clearcoat_pars_fragment:_I,iridescence_pars_fragment:xI,output_fragment:SI,packing:wI,premultiplied_alpha_fragment:MI,project_vertex:EI,dithering_fragment:TI,dithering_pars_fragment:AI,roughnessmap_fragment:CI,roughnessmap_pars_fragment:bI,shadowmap_pars_fragment:PI,shadowmap_pars_vertex:LI,shadowmap_vertex:RI,shadowmask_pars_fragment:II,skinbase_vertex:DI,skinning_pars_vertex:NI,skinning_vertex:kI,skinnormal_vertex:zI,specularmap_fragment:UI,specularmap_pars_fragment:OI,tonemapping_fragment:FI,tonemapping_pars_fragment:BI,transmission_fragment:VI,transmission_pars_fragment:HI,uv_pars_fragment:GI,uv_pars_vertex:WI,uv_vertex:XI,worldpos_vertex:jI,background_vert:YI,background_frag:qI,backgroundCube_vert:ZI,backgroundCube_frag:QI,cube_vert:JI,cube_frag:KI,depth_vert:$I,depth_frag:eD,distanceRGBA_vert:tD,distanceRGBA_frag:nD,equirect_vert:iD,equirect_frag:rD,linedashed_vert:sD,linedashed_frag:oD,meshbasic_vert:aD,meshbasic_frag:lD,meshlambert_vert:uD,meshlambert_frag:cD,meshmatcap_vert:fD,meshmatcap_frag:hD,meshnormal_vert:dD,meshnormal_frag:pD,meshphong_vert:mD,meshphong_frag:gD,meshphysical_vert:vD,meshphysical_frag:yD,meshtoon_vert:_D,meshtoon_frag:xD,points_vert:SD,points_frag:wD,shadow_vert:MD,shadow_frag:ED,sprite_vert:TD,sprite_frag:AD},Ae={common:{diffuse:{value:new Re(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Re(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Re(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Re(16777215)},opacity:{value:1},center:{value:new ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaTest:{value:0}}},Mr={basic:{uniforms:ri([Ae.common,Ae.specularmap,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.fog]),vertexShader:ht.meshbasic_vert,fragmentShader:ht.meshbasic_frag},lambert:{uniforms:ri([Ae.common,Ae.specularmap,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.fog,Ae.lights,{emissive:{value:new Re(0)}}]),vertexShader:ht.meshlambert_vert,fragmentShader:ht.meshlambert_frag},phong:{uniforms:ri([Ae.common,Ae.specularmap,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.fog,Ae.lights,{emissive:{value:new Re(0)},specular:{value:new Re(1118481)},shininess:{value:30}}]),vertexShader:ht.meshphong_vert,fragmentShader:ht.meshphong_frag},standard:{uniforms:ri([Ae.common,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.roughnessmap,Ae.metalnessmap,Ae.fog,Ae.lights,{emissive:{value:new Re(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ht.meshphysical_vert,fragmentShader:ht.meshphysical_frag},toon:{uniforms:ri([Ae.common,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.gradientmap,Ae.fog,Ae.lights,{emissive:{value:new Re(0)}}]),vertexShader:ht.meshtoon_vert,fragmentShader:ht.meshtoon_frag},matcap:{uniforms:ri([Ae.common,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.fog,{matcap:{value:null}}]),vertexShader:ht.meshmatcap_vert,fragmentShader:ht.meshmatcap_frag},points:{uniforms:ri([Ae.points,Ae.fog]),vertexShader:ht.points_vert,fragmentShader:ht.points_frag},dashed:{uniforms:ri([Ae.common,Ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ht.linedashed_vert,fragmentShader:ht.linedashed_frag},depth:{uniforms:ri([Ae.common,Ae.displacementmap]),vertexShader:ht.depth_vert,fragmentShader:ht.depth_frag},normal:{uniforms:ri([Ae.common,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,{opacity:{value:1}}]),vertexShader:ht.meshnormal_vert,fragmentShader:ht.meshnormal_frag},sprite:{uniforms:ri([Ae.sprite,Ae.fog]),vertexShader:ht.sprite_vert,fragmentShader:ht.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ht.background_vert,fragmentShader:ht.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ht.backgroundCube_vert,fragmentShader:ht.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ht.cube_vert,fragmentShader:ht.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ht.equirect_vert,fragmentShader:ht.equirect_frag},distanceRGBA:{uniforms:ri([Ae.common,Ae.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ht.distanceRGBA_vert,fragmentShader:ht.distanceRGBA_frag},shadow:{uniforms:ri([Ae.lights,Ae.fog,{color:{value:new Re(0)},opacity:{value:1}}]),vertexShader:ht.shadow_vert,fragmentShader:ht.shadow_frag}};Mr.physical={uniforms:ri([Mr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Re(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Re(0)},specularColor:{value:new Re(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt}}]),vertexShader:ht.meshphysical_vert,fragmentShader:ht.meshphysical_frag};const Xh={r:0,b:0,g:0};function CD(n,e,t,i,r,s,o){const a=new Re(0);let c=s===!0?0:1,f,h,d=null,m=0,v=null;function _(S,g){let x=!1,w=g.isScene===!0?g.background:null;w&&w.isTexture&&(w=(g.backgroundBlurriness>0?t:e).get(w));const T=n.xr,C=T.getSession&&T.getSession();C&&C.environmentBlendMode==="additive"&&(w=null),w===null?E(a,c):w&&w.isColor&&(E(w,1),x=!0),(n.autoClear||x)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===jl)?(h===void 0&&(h=new Ne(new oi(1,1,1),new jr({name:"BackgroundCubeMaterial",uniforms:Bl(Mr.backgroundCube.uniforms),vertexShader:Mr.backgroundCube.vertexShader,fragmentShader:Mr.backgroundCube.fragmentShader,side:li,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,R,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),h.material.uniforms.envMap.value=w,h.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,h.material.toneMapped=w.encoding!==Ot,(d!==w||m!==w.version||v!==n.toneMapping)&&(h.material.needsUpdate=!0,d=w,m=w.version,v=n.toneMapping),h.layers.enableAll(),S.unshift(h,h.geometry,h.material,0,0,null)):w&&w.isTexture&&(f===void 0&&(f=new Ne(new Di(2,2),new jr({name:"BackgroundMaterial",uniforms:Bl(Mr.background.uniforms),vertexShader:Mr.background.vertexShader,fragmentShader:Mr.background.fragmentShader,side:Ms,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(f)),f.material.uniforms.t2D.value=w,f.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,f.material.toneMapped=w.encoding!==Ot,w.matrixAutoUpdate===!0&&w.updateMatrix(),f.material.uniforms.uvTransform.value.copy(w.matrix),(d!==w||m!==w.version||v!==n.toneMapping)&&(f.material.needsUpdate=!0,d=w,m=w.version,v=n.toneMapping),f.layers.enableAll(),S.unshift(f,f.geometry,f.material,0,0,null))}function E(S,g){S.getRGB(Xh,I2(n)),i.buffers.color.setClear(Xh.r,Xh.g,Xh.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(S,g=1){a.set(S),c=g,E(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(S){c=S,E(a,c)},render:_}}function bD(n,e,t,i){const r=n.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},c=S(null);let f=c,h=!1;function d(W,ee,oe,ue,D){let V=!1;if(o){const B=E(ue,oe,ee);f!==B&&(f=B,v(f.object)),V=g(W,ue,oe,D),V&&x(W,ue,oe,D)}else{const B=ee.wireframe===!0;(f.geometry!==ue.id||f.program!==oe.id||f.wireframe!==B)&&(f.geometry=ue.id,f.program=oe.id,f.wireframe=B,V=!0)}D!==null&&t.update(D,34963),(V||h)&&(h=!1,I(W,ee,oe,ue),D!==null&&n.bindBuffer(34963,t.get(D).buffer))}function m(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function v(W){return i.isWebGL2?n.bindVertexArray(W):s.bindVertexArrayOES(W)}function _(W){return i.isWebGL2?n.deleteVertexArray(W):s.deleteVertexArrayOES(W)}function E(W,ee,oe){const ue=oe.wireframe===!0;let D=a[W.id];D===void 0&&(D={},a[W.id]=D);let V=D[ee.id];V===void 0&&(V={},D[ee.id]=V);let B=V[ue];return B===void 0&&(B=S(m()),V[ue]=B),B}function S(W){const ee=[],oe=[],ue=[];for(let D=0;D<r;D++)ee[D]=0,oe[D]=0,ue[D]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:ee,enabledAttributes:oe,attributeDivisors:ue,object:W,attributes:{},index:null}}function g(W,ee,oe,ue){const D=f.attributes,V=ee.attributes;let B=0;const J=oe.getAttributes();for(const Y in J)if(J[Y].location>=0){const z=D[Y];let ye=V[Y];if(ye===void 0&&(Y==="instanceMatrix"&&W.instanceMatrix&&(ye=W.instanceMatrix),Y==="instanceColor"&&W.instanceColor&&(ye=W.instanceColor)),z===void 0||z.attribute!==ye||ye&&z.data!==ye.data)return!0;B++}return f.attributesNum!==B||f.index!==ue}function x(W,ee,oe,ue){const D={},V=ee.attributes;let B=0;const J=oe.getAttributes();for(const Y in J)if(J[Y].location>=0){let z=V[Y];z===void 0&&(Y==="instanceMatrix"&&W.instanceMatrix&&(z=W.instanceMatrix),Y==="instanceColor"&&W.instanceColor&&(z=W.instanceColor));const ye={};ye.attribute=z,z&&z.data&&(ye.data=z.data),D[Y]=ye,B++}f.attributes=D,f.attributesNum=B,f.index=ue}function w(){const W=f.newAttributes;for(let ee=0,oe=W.length;ee<oe;ee++)W[ee]=0}function T(W){C(W,0)}function C(W,ee){const oe=f.newAttributes,ue=f.enabledAttributes,D=f.attributeDivisors;oe[W]=1,ue[W]===0&&(n.enableVertexAttribArray(W),ue[W]=1),D[W]!==ee&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](W,ee),D[W]=ee)}function P(){const W=f.newAttributes,ee=f.enabledAttributes;for(let oe=0,ue=ee.length;oe<ue;oe++)ee[oe]!==W[oe]&&(n.disableVertexAttribArray(oe),ee[oe]=0)}function R(W,ee,oe,ue,D,V){i.isWebGL2===!0&&(oe===5124||oe===5125)?n.vertexAttribIPointer(W,ee,oe,D,V):n.vertexAttribPointer(W,ee,oe,ue,D,V)}function I(W,ee,oe,ue){if(i.isWebGL2===!1&&(W.isInstancedMesh||ue.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;w();const D=ue.attributes,V=oe.getAttributes(),B=ee.defaultAttributeValues;for(const J in V){const Y=V[J];if(Y.location>=0){let K=D[J];if(K===void 0&&(J==="instanceMatrix"&&W.instanceMatrix&&(K=W.instanceMatrix),J==="instanceColor"&&W.instanceColor&&(K=W.instanceColor)),K!==void 0){const z=K.normalized,ye=K.itemSize,pe=t.get(K);if(pe===void 0)continue;const Q=pe.buffer,Qe=pe.type,je=pe.bytesPerElement;if(K.isInterleavedBufferAttribute){const Me=K.data,De=Me.stride,me=K.offset;if(Me.isInstancedInterleavedBuffer){for(let se=0;se<Y.locationSize;se++)C(Y.location+se,Me.meshPerAttribute);W.isInstancedMesh!==!0&&ue._maxInstanceCount===void 0&&(ue._maxInstanceCount=Me.meshPerAttribute*Me.count)}else for(let se=0;se<Y.locationSize;se++)T(Y.location+se);n.bindBuffer(34962,Q);for(let se=0;se<Y.locationSize;se++)R(Y.location+se,ye/Y.locationSize,Qe,z,De*je,(me+ye/Y.locationSize*se)*je)}else{if(K.isInstancedBufferAttribute){for(let Me=0;Me<Y.locationSize;Me++)C(Y.location+Me,K.meshPerAttribute);W.isInstancedMesh!==!0&&ue._maxInstanceCount===void 0&&(ue._maxInstanceCount=K.meshPerAttribute*K.count)}else for(let Me=0;Me<Y.locationSize;Me++)T(Y.location+Me);n.bindBuffer(34962,Q);for(let Me=0;Me<Y.locationSize;Me++)R(Y.location+Me,ye/Y.locationSize,Qe,z,ye*je,ye/Y.locationSize*Me*je)}}else if(B!==void 0){const z=B[J];if(z!==void 0)switch(z.length){case 2:n.vertexAttrib2fv(Y.location,z);break;case 3:n.vertexAttrib3fv(Y.location,z);break;case 4:n.vertexAttrib4fv(Y.location,z);break;default:n.vertexAttrib1fv(Y.location,z)}}}}P()}function b(){q();for(const W in a){const ee=a[W];for(const oe in ee){const ue=ee[oe];for(const D in ue)_(ue[D].object),delete ue[D];delete ee[oe]}delete a[W]}}function L(W){if(a[W.id]===void 0)return;const ee=a[W.id];for(const oe in ee){const ue=ee[oe];for(const D in ue)_(ue[D].object),delete ue[D];delete ee[oe]}delete a[W.id]}function H(W){for(const ee in a){const oe=a[ee];if(oe[W.id]===void 0)continue;const ue=oe[W.id];for(const D in ue)_(ue[D].object),delete ue[D];delete oe[W.id]}}function q(){G(),h=!0,f!==c&&(f=c,v(f.object))}function G(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:d,reset:q,resetDefaultState:G,dispose:b,releaseStatesOfGeometry:L,releaseStatesOfProgram:H,initAttributes:w,enableAttribute:T,disableUnusedAttributes:P}}function PD(n,e,t,i){const r=i.isWebGL2;let s;function o(f){s=f}function a(f,h){n.drawArrays(s,f,h),t.update(h,s,1)}function c(f,h,d){if(d===0)return;let m,v;if(r)m=n,v="drawArraysInstanced";else if(m=e.get("ANGLE_instanced_arrays"),v="drawArraysInstancedANGLE",m===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[v](s,f,h,d),t.update(h,s,d)}this.setMode=o,this.render=a,this.renderInstances=c}function LD(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(R){if(R==="highp"){if(n.getShaderPrecisionFormat(35633,36338).precision>0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";R="mediump"}return R==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const c=s(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const f=o||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,d=n.getParameter(34930),m=n.getParameter(35660),v=n.getParameter(3379),_=n.getParameter(34076),E=n.getParameter(34921),S=n.getParameter(36347),g=n.getParameter(36348),x=n.getParameter(36349),w=m>0,T=o||e.has("OES_texture_float"),C=w&&T,P=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:f,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:m,maxTextureSize:v,maxCubemapSize:_,maxAttributes:E,maxVertexUniforms:S,maxVaryings:g,maxFragmentUniforms:x,vertexTextures:w,floatFragmentTextures:T,floatVertexTextures:C,maxSamples:P}}function RD(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Ys,a=new xt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(d,m){const v=d.length!==0||m||i!==0||r;return r=m,i=d.length,v},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,m){t=h(d,m,0)},this.setState=function(d,m,v){const _=d.clippingPlanes,E=d.clipIntersection,S=d.clipShadows,g=n.get(d);if(!r||_===null||_.length===0||s&&!S)s?h(null):f();else{const x=s?0:i,w=x*4;let T=g.clippingState||null;c.value=T,T=h(_,m,w,v);for(let C=0;C!==w;++C)T[C]=t[C];g.clippingState=T,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=x}};function f(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(d,m,v,_){const E=d!==null?d.length:0;let S=null;if(E!==0){if(S=c.value,_!==!0||S===null){const g=v+E*4,x=m.matrixWorldInverse;a.getNormalMatrix(x),(S===null||S.length<g)&&(S=new Float32Array(g));for(let w=0,T=v;w!==E;++w,T+=4)o.copy(d[w]).applyMatrix4(x,a),o.normal.toArray(S,T),S[T+3]=o.constant}c.value=S,c.needsUpdate=!0}return e.numPlanes=E,e.numIntersection=0,S}}function ID(n){let e=new WeakMap;function t(o,a){return a===Tc?o.mapping=fo:a===Ac&&(o.mapping=ho),o}function i(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===Tc||a===Ac)if(e.has(o)){const c=e.get(o).texture;return t(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const f=new k2(c.height/2);return f.fromEquirectangularTexture(n,o),e.set(o,f),o.addEventListener("dispose",r),t(f.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class $c extends Jc{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,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,i,r,s,o){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=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,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),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,c=r-t;if(this.view!==null&&this.view.enabled){const f=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=f*this.view.offsetX,o=s+f*this.view.width,a-=h*this.view.offsetY,c=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const xl=4,XS=[.125,.215,.35,.446,.526,.582],Ho=20,Gg=new $c,jS=new Re;let Wg=null;const Bo=(1+Math.sqrt(5))/2,Ja=1/Bo,YS=[new N(1,1,1),new N(-1,1,1),new N(1,1,-1),new N(-1,1,-1),new N(0,Bo,Ja),new N(0,Bo,-Ja),new N(Ja,0,Bo),new N(-Ja,0,Bo),new N(Bo,Ja,0),new N(-Bo,Ja,0)];class Uv{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){Wg=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=QS(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ZS(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Wg),e.scissorTest=!1,jh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===fo||e.mapping===ho?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Wg=this._renderer.getRenderTarget();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:en,minFilter:en,generateMipmaps:!1,type:ca,format:_i,encoding:Ts,depthBuffer:!1},r=qS(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=qS(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=DD(s)),this._blurMaterial=ND(s,e,t)}return r}_compileMaterial(e){const t=new Ne(this._lodPlanes[0],e);this._renderer.compile(t,Gg)}_sceneToCubeUV(e,t,i,r){const a=new In(90,1,t,i),c=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,m=h.toneMapping;h.getClearColor(jS),h.toneMapping=Ar,h.autoClear=!1;const v=new Zr({name:"PMREM.Background",side:li,depthWrite:!1,depthTest:!1}),_=new Ne(new oi,v);let E=!1;const S=e.background;S?S.isColor&&(v.color.copy(S),e.background=null,E=!0):(v.color.copy(jS),E=!0);for(let g=0;g<6;g++){const x=g%3;x===0?(a.up.set(0,c[g],0),a.lookAt(f[g],0,0)):x===1?(a.up.set(0,0,c[g]),a.lookAt(0,f[g],0)):(a.up.set(0,c[g],0),a.lookAt(0,0,f[g]));const w=this._cubeSize;jh(r,x*w,g>2?w:0,w,w),h.setRenderTarget(r),E&&h.render(_,a),h.render(e,a)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=m,h.autoClear=d,e.background=S}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===fo||e.mapping===ho;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=QS()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ZS());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Ne(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const c=this._cubeSize;jh(t,0,0,3*c,2*c),i.setRenderTarget(t),i.render(o,Gg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=YS[(r-1)%YS.length];this._blur(e,r-1,r,s,o)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const c=this._renderer,f=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,d=new Ne(this._lodPlanes[r],f),m=f.uniforms,v=this._sizeLods[i]-1,_=isFinite(s)?Math.PI/(2*v):2*Math.PI/(2*Ho-1),E=s/_,S=isFinite(s)?1+Math.floor(h*E):Ho;S>Ho&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Ho}`);const g=[];let x=0;for(let R=0;R<Ho;++R){const I=R/E,b=Math.exp(-I*I/2);g.push(b),R===0?x+=b:R<S&&(x+=2*b)}for(let R=0;R<g.length;R++)g[R]=g[R]/x;m.envMap.value=e.texture,m.samples.value=S,m.weights.value=g,m.latitudinal.value=o==="latitudinal",a&&(m.poleAxis.value=a);const{_lodMax:w}=this;m.dTheta.value=_,m.mipInt.value=w-i;const T=this._sizeLods[r],C=3*T*(r>w-xl?r-w+xl:0),P=4*(this._cubeSize-T);jh(t,C,P,3*T,2*T),c.setRenderTarget(t),c.render(d,Gg)}}function DD(n){const e=[],t=[],i=[];let r=n;const s=n-xl+1+XS.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let c=1/a;o>n-xl?c=XS[o-n+xl-1]:o===0&&(c=0),i.push(c);const f=1/(a-2),h=-f,d=1+f,m=[h,h,d,h,d,d,h,h,d,d,h,d],v=6,_=6,E=3,S=2,g=1,x=new Float32Array(E*_*v),w=new Float32Array(S*_*v),T=new Float32Array(g*_*v);for(let P=0;P<v;P++){const R=P%3*2/3-1,I=P>2?0:-1,b=[R,I,0,R+2/3,I,0,R+2/3,I+1,0,R,I,0,R+2/3,I+1,0,R,I+1,0];x.set(b,E*_*P),w.set(m,S*_*P);const L=[P,P,P,P,P,P];T.set(L,g*_*P)}const C=new lt;C.setAttribute("position",new Bt(x,E)),C.setAttribute("uv",new Bt(w,S)),C.setAttribute("faceIndex",new Bt(T,g)),e.push(C),r>xl&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function qS(n,e,t){const i=new ar(n,e,t);return i.texture.mapping=jl,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function jh(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function ND(n,e,t){const i=new Float32Array(Ho),r=new N(0,1,0);return new jr({name:"SphericalGaussianBlur",defines:{n:Ho,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:n_(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
`,blending:ys,depthTest:!1,depthWrite:!1})}function ZS(){return new jr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:n_(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
`,blending:ys,depthTest:!1,depthWrite:!1})}function QS(){return new jr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:n_(),fragmentShader:`
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
`,blending:ys,depthTest:!1,depthWrite:!1})}function n_(){return`
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function kD(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const c=a.mapping,f=c===Tc||c===Ac,h=c===fo||c===ho;if(f||h)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=e.get(a);return t===null&&(t=new Uv(n)),d=f?t.fromEquirectangular(a,d):t.fromCubemap(a,d),e.set(a,d),d.texture}else{if(e.has(a))return e.get(a).texture;{const d=a.image;if(f&&d&&d.height>0||h&&d&&r(d)){t===null&&(t=new Uv(n));const m=f?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,m),a.addEventListener("dispose",s),m.texture}else return null}}}return a}function r(a){let c=0;const f=6;for(let h=0;h<f;h++)a[h]!==void 0&&c++;return c===f}function s(a){const c=a.target;c.removeEventListener("dispose",s);const f=e.get(c);f!==void 0&&(e.delete(c),f.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function zD(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function UD(n,e,t,i){const r={},s=new WeakMap;function o(d){const m=d.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",o),delete r[m.id];const v=s.get(m);v&&(e.remove(v),s.delete(m)),i.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function a(d,m){return r[m.id]===!0||(m.addEventListener("dispose",o),r[m.id]=!0,t.memory.geometries++),m}function c(d){const m=d.attributes;for(const _ in m)e.update(m[_],34962);const v=d.morphAttributes;for(const _ in v){const E=v[_];for(let S=0,g=E.length;S<g;S++)e.update(E[S],34962)}}function f(d){const m=[],v=d.index,_=d.attributes.position;let E=0;if(v!==null){const x=v.array;E=v.version;for(let w=0,T=x.length;w<T;w+=3){const C=x[w+0],P=x[w+1],R=x[w+2];m.push(C,P,P,R,R,C)}}else{const x=_.array;E=_.version;for(let w=0,T=x.length/3-1;w<T;w+=3){const C=w+0,P=w+1,R=w+2;m.push(C,P,P,R,R,C)}}const S=new(L2(m)?t_:e_)(m,1);S.version=E;const g=s.get(d);g&&e.remove(g),s.set(d,S)}function h(d){const m=s.get(d);if(m){const v=d.index;v!==null&&m.version<v.version&&f(d)}else f(d);return s.get(d)}return{get:a,update:c,getWireframeAttribute:h}}function OD(n,e,t,i){const r=i.isWebGL2;let s;function o(m){s=m}let a,c;function f(m){a=m.type,c=m.bytesPerElement}function h(m,v){n.drawElements(s,v,a,m*c),t.update(v,s,1)}function d(m,v,_){if(_===0)return;let E,S;if(r)E=n,S="drawElementsInstanced";else if(E=e.get("ANGLE_instanced_arrays"),S="drawElementsInstancedANGLE",E===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}E[S](s,v,a,m*c,_),t.update(v,s,_)}this.setMode=o,this.setIndex=f,this.render=h,this.renderInstances=d}function FD(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case 4:t.triangles+=a*(s/3);break;case 1:t.lines+=a*(s/2);break;case 3:t.lines+=a*(s-1);break;case 2:t.lines+=a*s;break;case 0:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function BD(n,e){return n[0]-e[0]}function VD(n,e){return Math.abs(e[1])-Math.abs(n[1])}function HD(n,e,t){const i={},r=new Float32Array(8),s=new WeakMap,o=new Nt,a=[];for(let f=0;f<8;f++)a[f]=[f,0];function c(f,h,d){const m=f.morphTargetInfluences;if(e.isWebGL2===!0){const _=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,E=_!==void 0?_.length:0;let S=s.get(h);if(S===void 0||S.count!==E){let ee=function(){G.dispose(),s.delete(h),h.removeEventListener("dispose",ee)};var v=ee;S!==void 0&&S.texture.dispose();const w=h.morphAttributes.position!==void 0,T=h.morphAttributes.normal!==void 0,C=h.morphAttributes.color!==void 0,P=h.morphAttributes.position||[],R=h.morphAttributes.normal||[],I=h.morphAttributes.color||[];let b=0;w===!0&&(b=1),T===!0&&(b=2),C===!0&&(b=3);let L=h.attributes.position.count*b,H=1;L>e.maxTextureSize&&(H=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const q=new Float32Array(L*H*4*E),G=new Rp(q,L,H,E);G.type=Hr,G.needsUpdate=!0;const W=b*4;for(let oe=0;oe<E;oe++){const ue=P[oe],D=R[oe],V=I[oe],B=L*H*4*oe;for(let J=0;J<ue.count;J++){const Y=J*W;w===!0&&(o.fromBufferAttribute(ue,J),q[B+Y+0]=o.x,q[B+Y+1]=o.y,q[B+Y+2]=o.z,q[B+Y+3]=0),T===!0&&(o.fromBufferAttribute(D,J),q[B+Y+4]=o.x,q[B+Y+5]=o.y,q[B+Y+6]=o.z,q[B+Y+7]=0),C===!0&&(o.fromBufferAttribute(V,J),q[B+Y+8]=o.x,q[B+Y+9]=o.y,q[B+Y+10]=o.z,q[B+Y+11]=V.itemSize===4?o.w:1)}}S={count:E,texture:G,size:new ge(L,H)},s.set(h,S),h.addEventListener("dispose",ee)}let g=0;for(let w=0;w<m.length;w++)g+=m[w];const x=h.morphTargetsRelative?1:1-g;d.getUniforms().setValue(n,"morphTargetBaseInfluence",x),d.getUniforms().setValue(n,"morphTargetInfluences",m),d.getUniforms().setValue(n,"morphTargetsTexture",S.texture,t),d.getUniforms().setValue(n,"morphTargetsTextureSize",S.size)}else{const _=m===void 0?0:m.length;let E=i[h.id];if(E===void 0||E.length!==_){E=[];for(let T=0;T<_;T++)E[T]=[T,0];i[h.id]=E}for(let T=0;T<_;T++){const C=E[T];C[0]=T,C[1]=m[T]}E.sort(VD);for(let T=0;T<8;T++)T<_&&E[T][1]?(a[T][0]=E[T][0],a[T][1]=E[T][1]):(a[T][0]=Number.MAX_SAFE_INTEGER,a[T][1]=0);a.sort(BD);const S=h.morphAttributes.position,g=h.morphAttributes.normal;let x=0;for(let T=0;T<8;T++){const C=a[T],P=C[0],R=C[1];P!==Number.MAX_SAFE_INTEGER&&R?(S&&h.getAttribute("morphTarget"+T)!==S[P]&&h.setAttribute("morphTarget"+T,S[P]),g&&h.getAttribute("morphNormal"+T)!==g[P]&&h.setAttribute("morphNormal"+T,g[P]),r[T]=R,x+=R):(S&&h.hasAttribute("morphTarget"+T)===!0&&h.deleteAttribute("morphTarget"+T),g&&h.hasAttribute("morphNormal"+T)===!0&&h.deleteAttribute("morphNormal"+T),r[T]=0)}const w=h.morphTargetsRelative?1:1-x;d.getUniforms().setValue(n,"morphTargetBaseInfluence",w),d.getUniforms().setValue(n,"morphTargetInfluences",r)}}return{update:c}}function GD(n,e,t,i){let r=new WeakMap;function s(c){const f=i.render.frame,h=c.geometry,d=e.get(c,h);return r.get(d)!==f&&(e.update(d),r.set(d,f)),c.isInstancedMesh&&(c.hasEventListener("dispose",a)===!1&&c.addEventListener("dispose",a),t.update(c.instanceMatrix,34962),c.instanceColor!==null&&t.update(c.instanceColor,34962)),d}function o(){r=new WeakMap}function a(c){const f=c.target;f.removeEventListener("dispose",a),t.remove(f.instanceMatrix),f.instanceColor!==null&&t.remove(f.instanceColor)}return{update:s,dispose:o}}const U2=new un,O2=new Rp,F2=new $y,B2=new Kc,JS=[],KS=[],$S=new Float32Array(16),ew=new Float32Array(9),tw=new Float32Array(4);function ql(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=JS[r];if(s===void 0&&(s=new Float32Array(r),JS[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Mn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function En(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Dp(n,e){let t=KS[e];t===void 0&&(t=new Int32Array(e),KS[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function WD(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function XD(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Mn(t,e))return;n.uniform2fv(this.addr,e),En(t,e)}}function jD(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Mn(t,e))return;n.uniform3fv(this.addr,e),En(t,e)}}function YD(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Mn(t,e))return;n.uniform4fv(this.addr,e),En(t,e)}}function qD(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Mn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),En(t,e)}else{if(Mn(t,i))return;tw.set(i),n.uniformMatrix2fv(this.addr,!1,tw),En(t,i)}}function ZD(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Mn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),En(t,e)}else{if(Mn(t,i))return;ew.set(i),n.uniformMatrix3fv(this.addr,!1,ew),En(t,i)}}function QD(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Mn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),En(t,e)}else{if(Mn(t,i))return;$S.set(i),n.uniformMatrix4fv(this.addr,!1,$S),En(t,i)}}function JD(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function KD(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Mn(t,e))return;n.uniform2iv(this.addr,e),En(t,e)}}function $D(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Mn(t,e))return;n.uniform3iv(this.addr,e),En(t,e)}}function eN(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Mn(t,e))return;n.uniform4iv(this.addr,e),En(t,e)}}function tN(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function nN(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Mn(t,e))return;n.uniform2uiv(this.addr,e),En(t,e)}}function iN(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Mn(t,e))return;n.uniform3uiv(this.addr,e),En(t,e)}}function rN(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Mn(t,e))return;n.uniform4uiv(this.addr,e),En(t,e)}}function sN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2D(e||U2,r)}function oN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||F2,r)}function aN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||B2,r)}function lN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||O2,r)}function uN(n){switch(n){case 5126:return WD;case 35664:return XD;case 35665:return jD;case 35666:return YD;case 35674:return qD;case 35675:return ZD;case 35676:return QD;case 5124:case 35670:return JD;case 35667:case 35671:return KD;case 35668:case 35672:return $D;case 35669:case 35673:return eN;case 5125:return tN;case 36294:return nN;case 36295:return iN;case 36296:return rN;case 35678:case 36198:case 36298:case 36306:case 35682:return sN;case 35679:case 36299:case 36307:return oN;case 35680:case 36300:case 36308:case 36293:return aN;case 36289:case 36303:case 36311:case 36292:return lN}}function cN(n,e){n.uniform1fv(this.addr,e)}function fN(n,e){const t=ql(e,this.size,2);n.uniform2fv(this.addr,t)}function hN(n,e){const t=ql(e,this.size,3);n.uniform3fv(this.addr,t)}function dN(n,e){const t=ql(e,this.size,4);n.uniform4fv(this.addr,t)}function pN(n,e){const t=ql(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function mN(n,e){const t=ql(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function gN(n,e){const t=ql(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function vN(n,e){n.uniform1iv(this.addr,e)}function yN(n,e){n.uniform2iv(this.addr,e)}function _N(n,e){n.uniform3iv(this.addr,e)}function xN(n,e){n.uniform4iv(this.addr,e)}function SN(n,e){n.uniform1uiv(this.addr,e)}function wN(n,e){n.uniform2uiv(this.addr,e)}function MN(n,e){n.uniform3uiv(this.addr,e)}function EN(n,e){n.uniform4uiv(this.addr,e)}function TN(n,e,t){const i=this.cache,r=e.length,s=Dp(t,r);Mn(i,s)||(n.uniform1iv(this.addr,s),En(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||U2,s[o])}function AN(n,e,t){const i=this.cache,r=e.length,s=Dp(t,r);Mn(i,s)||(n.uniform1iv(this.addr,s),En(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||F2,s[o])}function CN(n,e,t){const i=this.cache,r=e.length,s=Dp(t,r);Mn(i,s)||(n.uniform1iv(this.addr,s),En(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||B2,s[o])}function bN(n,e,t){const i=this.cache,r=e.length,s=Dp(t,r);Mn(i,s)||(n.uniform1iv(this.addr,s),En(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||O2,s[o])}function PN(n){switch(n){case 5126:return cN;case 35664:return fN;case 35665:return hN;case 35666:return dN;case 35674:return pN;case 35675:return mN;case 35676:return gN;case 5124:case 35670:return vN;case 35667:case 35671:return yN;case 35668:case 35672:return _N;case 35669:case 35673:return xN;case 5125:return SN;case 36294:return wN;case 36295:return MN;case 36296:return EN;case 35678:case 36198:case 36298:case 36306:case 35682:return TN;case 35679:case 36299:case 36307:return AN;case 35680:case 36300:case 36308:case 36293:return CN;case 36289:case 36303:case 36311:case 36292:return bN}}class LN{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=uN(t.type)}}class RN{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=PN(t.type)}}class IN{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const Xg=/(\w+)(\])?(\[|\.)?/g;function nw(n,e){n.seq.push(e),n.map[e.id]=e}function DN(n,e,t){const i=n.name,r=i.length;for(Xg.lastIndex=0;;){const s=Xg.exec(i),o=Xg.lastIndex;let a=s[1];const c=s[2]==="]",f=s[3];if(c&&(a=a|0),f===void 0||f==="["&&o+2===r){nw(t,f===void 0?new LN(a,n,e):new RN(a,n,e));break}else{let d=t.map[a];d===void 0&&(d=new IN(a),nw(t,d)),t=d}}}class kd{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,35718);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);DN(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],c=i[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function iw(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}let NN=0;function kN(n,e){const t=n.split(`
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
`)}function zN(n){switch(n){case Ts:return["Linear","( value )"];case Ot:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function rw(n,e,t){const i=n.getShaderParameter(e,35713),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
`+r+`
`+kN(n.getShaderSource(e),o)}else return r}function UN(n,e){const t=zN(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function ON(n,e){let t;switch(e){case n2:t="Linear";break;case i2:t="Reinhard";break;case r2:t="OptimizedCineon";break;case jy:t="ACESFilmic";break;case s2:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function FN(n){return[n.extensionDerivatives||!!n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Yu).join(`
`)}function BN(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function VN(n,e){const t={},i=n.getProgramParameter(e,35721);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===35674&&(a=2),s.type===35675&&(a=3),s.type===35676&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function Yu(n){return n!==""}function sw(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ow(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const HN=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ov(n){return n.replace(HN,GN)}function GN(n,e){const t=ht[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Ov(t)}const WN=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function aw(n){return n.replace(WN,XN)}function XN(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function lw(n){let e="precision "+n.precision+` float;
precision `+n.precision+" int;";return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function jN(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===bp?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===ic?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===jo&&(e="SHADOWMAP_TYPE_VSM"),e}function YN(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case fo:case ho:e="ENVMAP_TYPE_CUBE";break;case jl:e="ENVMAP_TYPE_CUBE_UV";break}return e}function qN(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case ho:e="ENVMAP_MODE_REFRACTION";break}return e}function ZN(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Zc:e="ENVMAP_BLENDING_MULTIPLY";break;case e2:e="ENVMAP_BLENDING_MIX";break;case t2:e="ENVMAP_BLENDING_ADD";break}return e}function QN(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function JN(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const c=jN(t),f=YN(t),h=qN(t),d=ZN(t),m=QN(t),v=t.isWebGL2?"":FN(t),_=BN(s),E=r.createProgram();let S,g,x=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(S=[_].filter(Yu).join(`
`),S.length>0&&(S+=`
`),g=[v,_].filter(Yu).join(`
`),g.length>0&&(g+=`
`)):(S=[lw(t),"#define SHADER_NAME "+t.shaderName,_,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(Yu).join(`
`),g=[v,lw(t),"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ar?"#define TONE_MAPPING":"",t.toneMapping!==Ar?ht.tonemapping_pars_fragment:"",t.toneMapping!==Ar?ON("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ht.encodings_pars_fragment,UN("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(Yu).join(`
`)),o=Ov(o),o=sw(o,t),o=ow(o,t),a=Ov(a),a=sw(a,t),a=ow(a,t),o=aw(o),a=aw(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(x=`#version 300 es
`,S=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+S,g=["#define varying in",t.glslVersion===kv?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===kv?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+g);const w=x+S+o,T=x+g+a,C=iw(r,35633,w),P=iw(r,35632,T);if(r.attachShader(E,C),r.attachShader(E,P),t.index0AttributeName!==void 0?r.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(E,0,"position"),r.linkProgram(E),n.debug.checkShaderErrors){const b=r.getProgramInfoLog(E).trim(),L=r.getShaderInfoLog(C).trim(),H=r.getShaderInfoLog(P).trim();let q=!0,G=!0;if(r.getProgramParameter(E,35714)===!1)if(q=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,E,C,P);else{const W=rw(r,C,"vertex"),ee=rw(r,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(E,35715)+`
Program Info Log: `+b+`
`+W+`
`+ee)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(L===""||H==="")&&(G=!1);G&&(this.diagnostics={runnable:q,programLog:b,vertexShader:{log:L,prefix:S},fragmentShader:{log:H,prefix:g}})}r.deleteShader(C),r.deleteShader(P);let R;this.getUniforms=function(){return R===void 0&&(R=new kd(r,E)),R};let I;return this.getAttributes=function(){return I===void 0&&(I=VN(r,E)),I},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(E),this.program=void 0},this.name=t.shaderName,this.id=NN++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=P,this}let KN=0;class $N{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new ek(e),t.set(e,i)),i}}class ek{constructor(e){this.id=KN++,this.code=e,this.usedTimes=0}}function tk(n,e,t,i,r,s,o){const a=new ia,c=new $N,f=[],h=r.isWebGL2,d=r.logarithmicDepthBuffer,m=r.vertexTextures;let v=r.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function E(b){return b===1?"uv2":"uv"}function S(b,L,H,q,G){const W=q.fog,ee=G.geometry,oe=b.isMeshStandardMaterial?q.environment:null,ue=(b.isMeshStandardMaterial?t:e).get(b.envMap||oe),D=!!ue&&ue.mapping===jl?ue.image.height:null,V=_[b.type];b.precision!==null&&(v=r.getMaxPrecision(b.precision),v!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",v,"instead."));const B=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,J=B!==void 0?B.length:0;let Y=0;ee.morphAttributes.position!==void 0&&(Y=1),ee.morphAttributes.normal!==void 0&&(Y=2),ee.morphAttributes.color!==void 0&&(Y=3);let K,z,ye,pe;if(V){const Ie=Mr[V];K=Ie.vertexShader,z=Ie.fragmentShader}else K=b.vertexShader,z=b.fragmentShader,c.update(b),ye=c.getVertexShaderID(b),pe=c.getFragmentShaderID(b);const Q=n.getRenderTarget(),Qe=G.isInstancedMesh===!0,je=!!b.map,Me=!!b.matcap,De=!!ue,me=!!b.aoMap,se=!!b.lightMap,ve=!!b.bumpMap,Ue=!!b.normalMap,Ce=!!b.displacementMap,Ke=!!b.emissiveMap,$e=!!b.metalnessMap,Ye=!!b.roughnessMap,rt=b.clearcoat>0,Et=b.iridescence>0,F=b.sheen>0,k=b.transmission>0,ie=rt&&!!b.clearcoatMap,_e=rt&&!!b.clearcoatNormalMap,Se=rt&&!!b.clearcoatRoughnessMap,be=Et&&!!b.iridescenceMap,tt=Et&&!!b.iridescenceThicknessMap,ke=F&&!!b.sheenColorMap,he=F&&!!b.sheenRoughnessMap,Ve=!!b.specularMap,qe=!!b.specularColorMap,et=!!b.specularIntensityMap,Oe=k&&!!b.transmissionMap,Ge=k&&!!b.thicknessMap,wt=!!b.gradientMap,Lt=!!b.alphaMap,Jt=b.alphaTest>0,X=!!b.extensions,fe=!!ee.attributes.uv2;return{isWebGL2:h,shaderID:V,shaderName:b.type,vertexShader:K,fragmentShader:z,defines:b.defines,customVertexShaderID:ye,customFragmentShaderID:pe,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:v,instancing:Qe,instancingColor:Qe&&G.instanceColor!==null,supportsVertexTextures:m,outputEncoding:Q===null?n.outputEncoding:Q.isXRRenderTarget===!0?Q.texture.encoding:Ts,map:je,matcap:Me,envMap:De,envMapMode:De&&ue.mapping,envMapCubeUVHeight:D,aoMap:me,lightMap:se,bumpMap:ve,normalMap:Ue,displacementMap:m&&Ce,emissiveMap:Ke,normalMapObjectSpace:Ue&&b.normalMapType===A2,normalMapTangentSpace:Ue&&b.normalMapType===yo,decodeVideoTexture:je&&b.map.isVideoTexture===!0&&b.map.encoding===Ot,metalnessMap:$e,roughnessMap:Ye,clearcoat:rt,clearcoatMap:ie,clearcoatNormalMap:_e,clearcoatRoughnessMap:Se,iridescence:Et,iridescenceMap:be,iridescenceThicknessMap:tt,sheen:F,sheenColorMap:ke,sheenRoughnessMap:he,specularMap:Ve,specularColorMap:qe,specularIntensityMap:et,transmission:k,transmissionMap:Oe,thicknessMap:Ge,gradientMap:wt,opaque:b.transparent===!1&&b.blending===ea,alphaMap:Lt,alphaTest:Jt,combine:b.combine,mapUv:je&&E(b.map.channel),aoMapUv:me&&E(b.aoMap.channel),lightMapUv:se&&E(b.lightMap.channel),bumpMapUv:ve&&E(b.bumpMap.channel),normalMapUv:Ue&&E(b.normalMap.channel),displacementMapUv:Ce&&E(b.displacementMap.channel),emissiveMapUv:Ke&&E(b.emissiveMap.channel),metalnessMapUv:$e&&E(b.metalnessMap.channel),roughnessMapUv:Ye&&E(b.roughnessMap.channel),clearcoatMapUv:ie&&E(b.clearcoatMap.channel),clearcoatNormalMapUv:_e&&E(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Se&&E(b.clearcoatRoughnessMap.channel),iridescenceMapUv:be&&E(b.iridescenceMap.channel),iridescenceThicknessMapUv:tt&&E(b.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&E(b.sheenColorMap.channel),sheenRoughnessMapUv:he&&E(b.sheenRoughnessMap.channel),specularMapUv:Ve&&E(b.specularMap.channel),specularColorMapUv:qe&&E(b.specularColorMap.channel),specularIntensityMapUv:et&&E(b.specularIntensityMap.channel),transmissionMapUv:Oe&&E(b.transmissionMap.channel),thicknessMapUv:Ge&&E(b.thicknessMap.channel),alphaMapUv:Lt&&E(b.alphaMap.channel),vertexTangents:Ue&&!!ee.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,vertexUvs2:fe,pointsUvs:G.isPoints===!0&&!!ee.attributes.uv&&(je||Lt),fog:!!W,useFog:b.fog===!0,fogExp2:W&&W.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:G.isSkinnedMesh===!0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:Y,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&H.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:Ar,useLegacyLights:n.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===nr,flipSided:b.side===li,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:X&&b.extensions.derivatives===!0,extensionFragDepth:X&&b.extensions.fragDepth===!0,extensionDrawBuffers:X&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:X&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function g(b){const L=[];if(b.shaderID?L.push(b.shaderID):(L.push(b.customVertexShaderID),L.push(b.customFragmentShaderID)),b.defines!==void 0)for(const H in b.defines)L.push(H),L.push(b.defines[H]);return b.isRawShaderMaterial===!1&&(x(L,b),w(L,b),L.push(n.outputEncoding)),L.push(b.customProgramCacheKey),L.join()}function x(b,L){b.push(L.precision),b.push(L.outputEncoding),b.push(L.envMapMode),b.push(L.envMapCubeUVHeight),b.push(L.mapUv),b.push(L.alphaMapUv),b.push(L.lightMapUv),b.push(L.aoMapUv),b.push(L.bumpMapUv),b.push(L.normalMapUv),b.push(L.displacementMapUv),b.push(L.emissiveMapUv),b.push(L.metalnessMapUv),b.push(L.roughnessMapUv),b.push(L.clearcoatMapUv),b.push(L.clearcoatNormalMapUv),b.push(L.clearcoatRoughnessMapUv),b.push(L.iridescenceMapUv),b.push(L.iridescenceThicknessMapUv),b.push(L.sheenColorMapUv),b.push(L.sheenRoughnessMapUv),b.push(L.specularMapUv),b.push(L.specularColorMapUv),b.push(L.specularIntensityMapUv),b.push(L.transmissionMapUv),b.push(L.thicknessMapUv),b.push(L.combine),b.push(L.fogExp2),b.push(L.sizeAttenuation),b.push(L.morphTargetsCount),b.push(L.morphAttributeCount),b.push(L.numDirLights),b.push(L.numPointLights),b.push(L.numSpotLights),b.push(L.numSpotLightMaps),b.push(L.numHemiLights),b.push(L.numRectAreaLights),b.push(L.numDirLightShadows),b.push(L.numPointLightShadows),b.push(L.numSpotLightShadows),b.push(L.numSpotLightShadowsWithMaps),b.push(L.shadowMapType),b.push(L.toneMapping),b.push(L.numClippingPlanes),b.push(L.numClipIntersection),b.push(L.depthPacking)}function w(b,L){a.disableAll(),L.isWebGL2&&a.enable(0),L.supportsVertexTextures&&a.enable(1),L.instancing&&a.enable(2),L.instancingColor&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUvs2&&a.enable(13),L.vertexTangents&&a.enable(14),b.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.skinning&&a.enable(4),L.morphTargets&&a.enable(5),L.morphNormals&&a.enable(6),L.morphColors&&a.enable(7),L.premultipliedAlpha&&a.enable(8),L.shadowMapEnabled&&a.enable(9),L.useLegacyLights&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.decodeVideoTexture&&a.enable(17),L.opaque&&a.enable(18),L.pointsUvs&&a.enable(19),b.push(a.mask)}function T(b){const L=_[b.type];let H;if(L){const q=Mr[L];H=D2.clone(q.uniforms)}else H=b.uniforms;return H}function C(b,L){let H;for(let q=0,G=f.length;q<G;q++){const W=f[q];if(W.cacheKey===L){H=W,++H.usedTimes;break}}return H===void 0&&(H=new JN(n,L,b,s),f.push(H)),H}function P(b){if(--b.usedTimes===0){const L=f.indexOf(b);f[L]=f[f.length-1],f.pop(),b.destroy()}}function R(b){c.remove(b)}function I(){c.dispose()}return{getParameters:S,getProgramCacheKey:g,getUniforms:T,acquireProgram:C,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:I}}function nk(){let n=new WeakMap;function e(s){let o=n.get(s);return o===void 0&&(o={},n.set(s,o)),o}function t(s){n.delete(s)}function i(s,o,a){n.get(s)[o]=a}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function ik(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function uw(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function cw(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(d,m,v,_,E,S){let g=n[e];return g===void 0?(g={id:d.id,object:d,geometry:m,material:v,groupOrder:_,renderOrder:d.renderOrder,z:E,group:S},n[e]=g):(g.id=d.id,g.object=d,g.geometry=m,g.material=v,g.groupOrder=_,g.renderOrder=d.renderOrder,g.z=E,g.group=S),e++,g}function a(d,m,v,_,E,S){const g=o(d,m,v,_,E,S);v.transmission>0?i.push(g):v.transparent===!0?r.push(g):t.push(g)}function c(d,m,v,_,E,S){const g=o(d,m,v,_,E,S);v.transmission>0?i.unshift(g):v.transparent===!0?r.unshift(g):t.unshift(g)}function f(d,m){t.length>1&&t.sort(d||ik),i.length>1&&i.sort(m||uw),r.length>1&&r.sort(m||uw)}function h(){for(let d=e,m=n.length;d<m;d++){const v=n[d];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:c,finish:h,sort:f}}function rk(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new cw,n.set(i,[o])):r>=s.length?(o=new cw,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function sk(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new Re};break;case"SpotLight":t={position:new N,direction:new N,color:new Re,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new Re,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new Re,groundColor:new Re};break;case"RectAreaLight":t={color:new Re,position:new N,halfWidth:new N,halfHeight:new N};break}return n[e.id]=t,t}}}function ok(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let ak=0;function lk(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function uk(n,e){const t=new sk,i=ok(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let h=0;h<9;h++)r.probe.push(new N);const s=new N,o=new st,a=new st;function c(h,d){let m=0,v=0,_=0;for(let H=0;H<9;H++)r.probe[H].set(0,0,0);let E=0,S=0,g=0,x=0,w=0,T=0,C=0,P=0,R=0,I=0;h.sort(lk);const b=d===!0?Math.PI:1;for(let H=0,q=h.length;H<q;H++){const G=h[H],W=G.color,ee=G.intensity,oe=G.distance,ue=G.shadow&&G.shadow.map?G.shadow.map.texture:null;if(G.isAmbientLight)m+=W.r*ee*b,v+=W.g*ee*b,_+=W.b*ee*b;else if(G.isLightProbe)for(let D=0;D<9;D++)r.probe[D].addScaledVector(G.sh.coefficients[D],ee);else if(G.isDirectionalLight){const D=t.get(G);if(D.color.copy(G.color).multiplyScalar(G.intensity*b),G.castShadow){const V=G.shadow,B=i.get(G);B.shadowBias=V.bias,B.shadowNormalBias=V.normalBias,B.shadowRadius=V.radius,B.shadowMapSize=V.mapSize,r.directionalShadow[E]=B,r.directionalShadowMap[E]=ue,r.directionalShadowMatrix[E]=G.shadow.matrix,T++}r.directional[E]=D,E++}else if(G.isSpotLight){const D=t.get(G);D.position.setFromMatrixPosition(G.matrixWorld),D.color.copy(W).multiplyScalar(ee*b),D.distance=oe,D.coneCos=Math.cos(G.angle),D.penumbraCos=Math.cos(G.angle*(1-G.penumbra)),D.decay=G.decay,r.spot[g]=D;const V=G.shadow;if(G.map&&(r.spotLightMap[R]=G.map,R++,V.updateMatrices(G),G.castShadow&&I++),r.spotLightMatrix[g]=V.matrix,G.castShadow){const B=i.get(G);B.shadowBias=V.bias,B.shadowNormalBias=V.normalBias,B.shadowRadius=V.radius,B.shadowMapSize=V.mapSize,r.spotShadow[g]=B,r.spotShadowMap[g]=ue,P++}g++}else if(G.isRectAreaLight){const D=t.get(G);D.color.copy(W).multiplyScalar(ee),D.halfWidth.set(G.width*.5,0,0),D.halfHeight.set(0,G.height*.5,0),r.rectArea[x]=D,x++}else if(G.isPointLight){const D=t.get(G);if(D.color.copy(G.color).multiplyScalar(G.intensity*b),D.distance=G.distance,D.decay=G.decay,G.castShadow){const V=G.shadow,B=i.get(G);B.shadowBias=V.bias,B.shadowNormalBias=V.normalBias,B.shadowRadius=V.radius,B.shadowMapSize=V.mapSize,B.shadowCameraNear=V.camera.near,B.shadowCameraFar=V.camera.far,r.pointShadow[S]=B,r.pointShadowMap[S]=ue,r.pointShadowMatrix[S]=G.shadow.matrix,C++}r.point[S]=D,S++}else if(G.isHemisphereLight){const D=t.get(G);D.skyColor.copy(G.color).multiplyScalar(ee*b),D.groundColor.copy(G.groundColor).multiplyScalar(ee*b),r.hemi[w]=D,w++}}x>0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Ae.LTC_FLOAT_1,r.rectAreaLTC2=Ae.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Ae.LTC_HALF_1,r.rectAreaLTC2=Ae.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=m,r.ambient[1]=v,r.ambient[2]=_;const L=r.hash;(L.directionalLength!==E||L.pointLength!==S||L.spotLength!==g||L.rectAreaLength!==x||L.hemiLength!==w||L.numDirectionalShadows!==T||L.numPointShadows!==C||L.numSpotShadows!==P||L.numSpotMaps!==R)&&(r.directional.length=E,r.spot.length=g,r.rectArea.length=x,r.point.length=S,r.hemi.length=w,r.directionalShadow.length=T,r.directionalShadowMap.length=T,r.pointShadow.length=C,r.pointShadowMap.length=C,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=T,r.pointShadowMatrix.length=C,r.spotLightMatrix.length=P+R-I,r.spotLightMap.length=R,r.numSpotLightShadowsWithMaps=I,L.directionalLength=E,L.pointLength=S,L.spotLength=g,L.rectAreaLength=x,L.hemiLength=w,L.numDirectionalShadows=T,L.numPointShadows=C,L.numSpotShadows=P,L.numSpotMaps=R,r.version=ak++)}function f(h,d){let m=0,v=0,_=0,E=0,S=0;const g=d.matrixWorldInverse;for(let x=0,w=h.length;x<w;x++){const T=h[x];if(T.isDirectionalLight){const C=r.directional[m];C.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(g),m++}else if(T.isSpotLight){const C=r.spot[_];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(g),C.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(g),_++}else if(T.isRectAreaLight){const C=r.rectArea[E];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(g),a.identity(),o.copy(T.matrixWorld),o.premultiply(g),a.extractRotation(o),C.halfWidth.set(T.width*.5,0,0),C.halfHeight.set(0,T.height*.5,0),C.halfWidth.applyMatrix4(a),C.halfHeight.applyMatrix4(a),E++}else if(T.isPointLight){const C=r.point[v];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(g),v++}else if(T.isHemisphereLight){const C=r.hemi[S];C.direction.setFromMatrixPosition(T.matrixWorld),C.direction.transformDirection(g),S++}}}return{setup:c,setupView:f,state:r}}function fw(n,e){const t=new uk(n,e),i=[],r=[];function s(){i.length=0,r.length=0}function o(d){i.push(d)}function a(d){r.push(d)}function c(d){t.setup(i,d)}function f(d){t.setupView(i,d)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:c,setupLightsView:f,pushLight:o,pushShadow:a}}function ck(n,e){let t=new WeakMap;function i(s,o=0){const a=t.get(s);let c;return a===void 0?(c=new fw(n,e),t.set(s,[c])):o>=a.length?(c=new fw(n,e),a.push(c)):c=a[o],c}function r(){t=new WeakMap}return{get:i,dispose:r}}class i_ extends Bn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=E2,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 r_ extends Bn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const fk=`void main() {
gl_Position = vec4( position, 1.0 );
}`,hk=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function dk(n,e,t){let i=new Ip;const r=new ge,s=new ge,o=new Nt,a=new i_({depthPacking:T2}),c=new r_,f={},h=t.maxTextureSize,d={[Ms]:li,[li]:Ms,[nr]:nr},m=new jr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ge},radius:{value:4}},vertexShader:fk,fragmentShader:hk}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new lt;_.setAttribute("position",new Bt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Ne(_,m),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=bp,this.render=function(T,C,P){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||T.length===0)return;const R=n.getRenderTarget(),I=n.getActiveCubeFace(),b=n.getActiveMipmapLevel(),L=n.state;L.setBlending(ys),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);for(let H=0,q=T.length;H<q;H++){const G=T[H],W=G.shadow;if(W===void 0){console.warn("THREE.WebGLShadowMap:",G,"has no shadow.");continue}if(W.autoUpdate===!1&&W.needsUpdate===!1)continue;r.copy(W.mapSize);const ee=W.getFrameExtents();if(r.multiply(ee),s.copy(W.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/ee.x),r.x=s.x*ee.x,W.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/ee.y),r.y=s.y*ee.y,W.mapSize.y=s.y)),W.map===null){const ue=this.type!==jo?{minFilter:hn,magFilter:hn}:{};W.map=new ar(r.x,r.y,ue),W.map.texture.name=G.name+".shadowMap",W.camera.updateProjectionMatrix()}n.setRenderTarget(W.map),n.clear();const oe=W.getViewportCount();for(let ue=0;ue<oe;ue++){const D=W.getViewport(ue);o.set(s.x*D.x,s.y*D.y,s.x*D.z,s.y*D.w),L.viewport(o),W.updateMatrices(G,ue),i=W.getFrustum(),w(C,P,W.camera,G,this.type)}W.isPointLightShadow!==!0&&this.type===jo&&g(W,P),W.needsUpdate=!1}S.needsUpdate=!1,n.setRenderTarget(R,I,b)};function g(T,C){const P=e.update(E);m.defines.VSM_SAMPLES!==T.blurSamples&&(m.defines.VSM_SAMPLES=T.blurSamples,v.defines.VSM_SAMPLES=T.blurSamples,m.needsUpdate=!0,v.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new ar(r.x,r.y)),m.uniforms.shadow_pass.value=T.map.texture,m.uniforms.resolution.value=T.mapSize,m.uniforms.radius.value=T.radius,n.setRenderTarget(T.mapPass),n.clear(),n.renderBufferDirect(C,null,P,m,E,null),v.uniforms.shadow_pass.value=T.mapPass.texture,v.uniforms.resolution.value=T.mapSize,v.uniforms.radius.value=T.radius,n.setRenderTarget(T.map),n.clear(),n.renderBufferDirect(C,null,P,v,E,null)}function x(T,C,P,R){let I=null;const b=P.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(b!==void 0)I=b;else if(I=P.isPointLight===!0?c:a,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0){const L=I.uuid,H=C.uuid;let q=f[L];q===void 0&&(q={},f[L]=q);let G=q[H];G===void 0&&(G=I.clone(),q[H]=G),I=G}if(I.visible=C.visible,I.wireframe=C.wireframe,R===jo?I.side=C.shadowSide!==null?C.shadowSide:C.side:I.side=C.shadowSide!==null?C.shadowSide:d[C.side],I.alphaMap=C.alphaMap,I.alphaTest=C.alphaTest,I.map=C.map,I.clipShadows=C.clipShadows,I.clippingPlanes=C.clippingPlanes,I.clipIntersection=C.clipIntersection,I.displacementMap=C.displacementMap,I.displacementScale=C.displacementScale,I.displacementBias=C.displacementBias,I.wireframeLinewidth=C.wireframeLinewidth,I.linewidth=C.linewidth,P.isPointLight===!0&&I.isMeshDistanceMaterial===!0){const L=n.properties.get(I);L.light=P}return I}function w(T,C,P,R,I){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&I===jo)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const H=e.update(T),q=T.material;if(Array.isArray(q)){const G=H.groups;for(let W=0,ee=G.length;W<ee;W++){const oe=G[W],ue=q[oe.materialIndex];if(ue&&ue.visible){const D=x(T,ue,R,I);n.renderBufferDirect(P,null,H,D,T,oe)}}}else if(q.visible){const G=x(T,q,R,I);n.renderBufferDirect(P,null,H,G,T,null)}}const L=T.children;for(let H=0,q=L.length;H<q;H++)w(L[H],C,P,R,I)}}function pk(n,e,t){const i=t.isWebGL2;function r(){let X=!1;const fe=new Nt;let xe=null;const Ie=new Nt(0,0,0,0);return{setMask:function(We){xe!==We&&!X&&(n.colorMask(We,We,We,We),xe=We)},setLocked:function(We){X=We},setClear:function(We,zt,Vt,Tn,lr){lr===!0&&(We*=Tn,zt*=Tn,Vt*=Tn),fe.set(We,zt,Vt,Tn),Ie.equals(fe)===!1&&(n.clearColor(We,zt,Vt,Tn),Ie.copy(fe))},reset:function(){X=!1,xe=null,Ie.set(-1,0,0,0)}}}function s(){let X=!1,fe=null,xe=null,Ie=null;return{setTest:function(We){We?Q(2929):Qe(2929)},setMask:function(We){fe!==We&&!X&&(n.depthMask(We),fe=We)},setFunc:function(We){if(xe!==We){switch(We){case YT:n.depthFunc(512);break;case qT:n.depthFunc(519);break;case ZT:n.depthFunc(513);break;case op:n.depthFunc(515);break;case QT:n.depthFunc(514);break;case JT:n.depthFunc(518);break;case KT:n.depthFunc(516);break;case $T:n.depthFunc(517);break;default:n.depthFunc(515)}xe=We}},setLocked:function(We){X=We},setClear:function(We){Ie!==We&&(n.clearDepth(We),Ie=We)},reset:function(){X=!1,fe=null,xe=null,Ie=null}}}function o(){let X=!1,fe=null,xe=null,Ie=null,We=null,zt=null,Vt=null,Tn=null,lr=null;return{setTest:function(Yt){X||(Yt?Q(2960):Qe(2960))},setMask:function(Yt){fe!==Yt&&!X&&(n.stencilMask(Yt),fe=Yt)},setFunc:function(Yt,ei,Hi){(xe!==Yt||Ie!==ei||We!==Hi)&&(n.stencilFunc(Yt,ei,Hi),xe=Yt,Ie=ei,We=Hi)},setOp:function(Yt,ei,Hi){(zt!==Yt||Vt!==ei||Tn!==Hi)&&(n.stencilOp(Yt,ei,Hi),zt=Yt,Vt=ei,Tn=Hi)},setLocked:function(Yt){X=Yt},setClear:function(Yt){lr!==Yt&&(n.clearStencil(Yt),lr=Yt)},reset:function(){X=!1,fe=null,xe=null,Ie=null,We=null,zt=null,Vt=null,Tn=null,lr=null}}}const a=new r,c=new s,f=new o,h=new WeakMap,d=new WeakMap;let m={},v={},_=new WeakMap,E=[],S=null,g=!1,x=null,w=null,T=null,C=null,P=null,R=null,I=null,b=!1,L=null,H=null,q=null,G=null,W=null;const ee=n.getParameter(35661);let oe=!1,ue=0;const D=n.getParameter(7938);D.indexOf("WebGL")!==-1?(ue=parseFloat(/^WebGL (\d)/.exec(D)[1]),oe=ue>=1):D.indexOf("OpenGL ES")!==-1&&(ue=parseFloat(/^OpenGL ES (\d)/.exec(D)[1]),oe=ue>=2);let V=null,B={};const J=n.getParameter(3088),Y=n.getParameter(2978),K=new Nt().fromArray(J),z=new Nt().fromArray(Y);function ye(X,fe,xe){const Ie=new Uint8Array(4),We=n.createTexture();n.bindTexture(X,We),n.texParameteri(X,10241,9728),n.texParameteri(X,10240,9728);for(let zt=0;zt<xe;zt++)n.texImage2D(fe+zt,0,6408,1,1,0,6408,5121,Ie);return We}const pe={};pe[3553]=ye(3553,3553,1),pe[34067]=ye(34067,34069,6),a.setClear(0,0,0,1),c.setClear(1),f.setClear(0),Q(2929),c.setFunc(op),Ce(!1),Ke(ov),Q(2884),ve(ys);function Q(X){m[X]!==!0&&(n.enable(X),m[X]=!0)}function Qe(X){m[X]!==!1&&(n.disable(X),m[X]=!1)}function je(X,fe){return v[X]!==fe?(n.bindFramebuffer(X,fe),v[X]=fe,i&&(X===36009&&(v[36160]=fe),X===36160&&(v[36009]=fe)),!0):!1}function Me(X,fe){let xe=E,Ie=!1;if(X)if(xe=_.get(fe),xe===void 0&&(xe=[],_.set(fe,xe)),X.isWebGLMultipleRenderTargets){const We=X.texture;if(xe.length!==We.length||xe[0]!==36064){for(let zt=0,Vt=We.length;zt<Vt;zt++)xe[zt]=36064+zt;xe.length=We.length,Ie=!0}}else xe[0]!==36064&&(xe[0]=36064,Ie=!0);else xe[0]!==1029&&(xe[0]=1029,Ie=!0);Ie&&(t.isWebGL2?n.drawBuffers(xe):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(xe))}function De(X){return S!==X?(n.useProgram(X),S=X,!0):!1}const me={[Vo]:32774,[zT]:32778,[UT]:32779};if(i)me[cv]=32775,me[fv]=32776;else{const X=e.get("EXT_blend_minmax");X!==null&&(me[cv]=X.MIN_EXT,me[fv]=X.MAX_EXT)}const se={[OT]:0,[FT]:1,[BT]:768,[Wy]:770,[jT]:776,[WT]:774,[HT]:772,[VT]:769,[Xy]:771,[XT]:775,[GT]:773};function ve(X,fe,xe,Ie,We,zt,Vt,Tn){if(X===ys){g===!0&&(Qe(3042),g=!1);return}if(g===!1&&(Q(3042),g=!0),X!==kT){if(X!==x||Tn!==b){if((w!==Vo||P!==Vo)&&(n.blendEquation(32774),w=Vo,P=Vo),Tn)switch(X){case ea:n.blendFuncSeparate(1,771,1,771);break;case av:n.blendFunc(1,1);break;case lv:n.blendFuncSeparate(0,769,0,1);break;case uv:n.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}else switch(X){case ea:n.blendFuncSeparate(770,771,1,771);break;case av:n.blendFunc(770,1);break;case lv:n.blendFuncSeparate(0,769,0,1);break;case uv:n.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}T=null,C=null,R=null,I=null,x=X,b=Tn}return}We=We||fe,zt=zt||xe,Vt=Vt||Ie,(fe!==w||We!==P)&&(n.blendEquationSeparate(me[fe],me[We]),w=fe,P=We),(xe!==T||Ie!==C||zt!==R||Vt!==I)&&(n.blendFuncSeparate(se[xe],se[Ie],se[zt],se[Vt]),T=xe,C=Ie,R=zt,I=Vt),x=X,b=!1}function Ue(X,fe){X.side===nr?Qe(2884):Q(2884);let xe=X.side===li;fe&&(xe=!xe),Ce(xe),X.blending===ea&&X.transparent===!1?ve(ys):ve(X.blending,X.blendEquation,X.blendSrc,X.blendDst,X.blendEquationAlpha,X.blendSrcAlpha,X.blendDstAlpha,X.premultipliedAlpha),c.setFunc(X.depthFunc),c.setTest(X.depthTest),c.setMask(X.depthWrite),a.setMask(X.colorWrite);const Ie=X.stencilWrite;f.setTest(Ie),Ie&&(f.setMask(X.stencilWriteMask),f.setFunc(X.stencilFunc,X.stencilRef,X.stencilFuncMask),f.setOp(X.stencilFail,X.stencilZFail,X.stencilZPass)),Ye(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),X.alphaToCoverage===!0?Q(32926):Qe(32926)}function Ce(X){L!==X&&(X?n.frontFace(2304):n.frontFace(2305),L=X)}function Ke(X){X!==IT?(Q(2884),X!==H&&(X===ov?n.cullFace(1029):X===DT?n.cullFace(1028):n.cullFace(1032))):Qe(2884),H=X}function $e(X){X!==q&&(oe&&n.lineWidth(X),q=X)}function Ye(X,fe,xe){X?(Q(32823),(G!==fe||W!==xe)&&(n.polygonOffset(fe,xe),G=fe,W=xe)):Qe(32823)}function rt(X){X?Q(3089):Qe(3089)}function Et(X){X===void 0&&(X=33984+ee-1),V!==X&&(n.activeTexture(X),V=X)}function F(X,fe,xe){xe===void 0&&(V===null?xe=33984+ee-1:xe=V);let Ie=B[xe];Ie===void 0&&(Ie={type:void 0,texture:void 0},B[xe]=Ie),(Ie.type!==X||Ie.texture!==fe)&&(V!==xe&&(n.activeTexture(xe),V=xe),n.bindTexture(X,fe||pe[X]),Ie.type=X,Ie.texture=fe)}function k(){const X=B[V];X!==void 0&&X.type!==void 0&&(n.bindTexture(X.type,null),X.type=void 0,X.texture=void 0)}function ie(){try{n.compressedTexImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function _e(){try{n.compressedTexImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Se(){try{n.texSubImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function be(){try{n.texSubImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function tt(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function ke(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function he(){try{n.texStorage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ve(){try{n.texStorage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function qe(){try{n.texImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function et(){try{n.texImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Oe(X){K.equals(X)===!1&&(n.scissor(X.x,X.y,X.z,X.w),K.copy(X))}function Ge(X){z.equals(X)===!1&&(n.viewport(X.x,X.y,X.z,X.w),z.copy(X))}function wt(X,fe){let xe=d.get(fe);xe===void 0&&(xe=new WeakMap,d.set(fe,xe));let Ie=xe.get(X);Ie===void 0&&(Ie=n.getUniformBlockIndex(fe,X.name),xe.set(X,Ie))}function Lt(X,fe){const Ie=d.get(fe).get(X);h.get(fe)!==Ie&&(n.uniformBlockBinding(fe,Ie,X.__bindingPointIndex),h.set(fe,Ie))}function Jt(){n.disable(3042),n.disable(2884),n.disable(2929),n.disable(32823),n.disable(3089),n.disable(2960),n.disable(32926),n.blendEquation(32774),n.blendFunc(1,0),n.blendFuncSeparate(1,0,1,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(513),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(519,0,4294967295),n.stencilOp(7680,7680,7680),n.clearStencil(0),n.cullFace(1029),n.frontFace(2305),n.polygonOffset(0,0),n.activeTexture(33984),n.bindFramebuffer(36160,null),i===!0&&(n.bindFramebuffer(36009,null),n.bindFramebuffer(36008,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),m={},V=null,B={},v={},_=new WeakMap,E=[],S=null,g=!1,x=null,w=null,T=null,C=null,P=null,R=null,I=null,b=!1,L=null,H=null,q=null,G=null,W=null,K.set(0,0,n.canvas.width,n.canvas.height),z.set(0,0,n.canvas.width,n.canvas.height),a.reset(),c.reset(),f.reset()}return{buffers:{color:a,depth:c,stencil:f},enable:Q,disable:Qe,bindFramebuffer:je,drawBuffers:Me,useProgram:De,setBlending:ve,setMaterial:Ue,setFlipSided:Ce,setCullFace:Ke,setLineWidth:$e,setPolygonOffset:Ye,setScissorTest:rt,activeTexture:Et,bindTexture:F,unbindTexture:k,compressedTexImage2D:ie,compressedTexImage3D:_e,texImage2D:qe,texImage3D:et,updateUBOMapping:wt,uniformBlockBinding:Lt,texStorage2D:he,texStorage3D:Ve,texSubImage2D:Se,texSubImage3D:be,compressedTexSubImage2D:tt,compressedTexSubImage3D:ke,scissor:Oe,viewport:Ge,reset:Jt}}function mk(n,e,t,i,r,s,o){const a=r.isWebGL2,c=r.maxTextures,f=r.maxCubemapSize,h=r.maxTextureSize,d=r.maxSamples,m=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,v=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let E;const S=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(F,k){return g?new OffscreenCanvas(F,k):Dc("canvas")}function w(F,k,ie,_e){let Se=1;if((F.width>_e||F.height>_e)&&(Se=_e/Math.max(F.width,F.height)),Se<1||k===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap){const be=k?P2:Math.floor,tt=be(Se*F.width),ke=be(Se*F.height);E===void 0&&(E=x(tt,ke));const he=ie?x(tt,ke):E;return he.width=tt,he.height=ke,he.getContext("2d").drawImage(F,0,0,tt,ke),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+F.width+"x"+F.height+") to ("+tt+"x"+ke+")."),he}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+F.width+"x"+F.height+")."),F;return F}function T(F){return zv(F.width)&&zv(F.height)}function C(F){return a?!1:F.wrapS!==Jn||F.wrapT!==Jn||F.minFilter!==hn&&F.minFilter!==en}function P(F,k){return F.generateMipmaps&&k&&F.minFilter!==hn&&F.minFilter!==en}function R(F){n.generateMipmap(F)}function I(F,k,ie,_e,Se=!1){if(a===!1)return k;if(F!==null){if(n[F]!==void 0)return n[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let be=k;return k===6403&&(ie===5126&&(be=33326),ie===5131&&(be=33325),ie===5121&&(be=33321)),k===33319&&(ie===5126&&(be=33328),ie===5131&&(be=33327),ie===5121&&(be=33323)),k===6408&&(ie===5126&&(be=34836),ie===5131&&(be=34842),ie===5121&&(be=_e===Ot&&Se===!1?35907:32856),ie===32819&&(be=32854),ie===32820&&(be=32855)),(be===33325||be===33326||be===33327||be===33328||be===34842||be===34836)&&e.get("EXT_color_buffer_float"),be}function b(F,k,ie){return P(F,ie)===!0||F.isFramebufferTexture&&F.minFilter!==hn&&F.minFilter!==en?Math.log2(Math.max(k.width,k.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?k.mipmaps.length:1}function L(F){return F===hn||F===ap||F===rc?9728:9729}function H(F){const k=F.target;k.removeEventListener("dispose",H),G(k),k.isVideoTexture&&_.delete(k)}function q(F){const k=F.target;k.removeEventListener("dispose",q),ee(k)}function G(F){const k=i.get(F);if(k.__webglInit===void 0)return;const ie=F.source,_e=S.get(ie);if(_e){const Se=_e[k.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&W(F),Object.keys(_e).length===0&&S.delete(ie)}i.remove(F)}function W(F){const k=i.get(F);n.deleteTexture(k.__webglTexture);const ie=F.source,_e=S.get(ie);delete _e[k.__cacheKey],o.memory.textures--}function ee(F){const k=F.texture,ie=i.get(F),_e=i.get(k);if(_e.__webglTexture!==void 0&&(n.deleteTexture(_e.__webglTexture),o.memory.textures--),F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)n.deleteFramebuffer(ie.__webglFramebuffer[Se]),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer[Se]);else{if(n.deleteFramebuffer(ie.__webglFramebuffer),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer),ie.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ie.__webglMultisampledFramebuffer),ie.__webglColorRenderbuffer)for(let Se=0;Se<ie.__webglColorRenderbuffer.length;Se++)ie.__webglColorRenderbuffer[Se]&&n.deleteRenderbuffer(ie.__webglColorRenderbuffer[Se]);ie.__webglDepthRenderbuffer&&n.deleteRenderbuffer(ie.__webglDepthRenderbuffer)}if(F.isWebGLMultipleRenderTargets)for(let Se=0,be=k.length;Se<be;Se++){const tt=i.get(k[Se]);tt.__webglTexture&&(n.deleteTexture(tt.__webglTexture),o.memory.textures--),i.remove(k[Se])}i.remove(k),i.remove(F)}let oe=0;function ue(){oe=0}function D(){const F=oe;return F>=c&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+c),oe+=1,F}function V(F){const k=[];return k.push(F.wrapS),k.push(F.wrapT),k.push(F.wrapR||0),k.push(F.magFilter),k.push(F.minFilter),k.push(F.anisotropy),k.push(F.internalFormat),k.push(F.format),k.push(F.type),k.push(F.generateMipmaps),k.push(F.premultiplyAlpha),k.push(F.flipY),k.push(F.unpackAlignment),k.push(F.encoding),k.join()}function B(F,k){const ie=i.get(F);if(F.isVideoTexture&&rt(F),F.isRenderTargetTexture===!1&&F.version>0&&ie.__version!==F.version){const _e=F.image;if(_e===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(_e.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Qe(ie,F,k);return}}t.bindTexture(3553,ie.__webglTexture,33984+k)}function J(F,k){const ie=i.get(F);if(F.version>0&&ie.__version!==F.version){Qe(ie,F,k);return}t.bindTexture(35866,ie.__webglTexture,33984+k)}function Y(F,k){const ie=i.get(F);if(F.version>0&&ie.__version!==F.version){Qe(ie,F,k);return}t.bindTexture(32879,ie.__webglTexture,33984+k)}function K(F,k){const ie=i.get(F);if(F.version>0&&ie.__version!==F.version){je(ie,F,k);return}t.bindTexture(34067,ie.__webglTexture,33984+k)}const z={[Cc]:10497,[Jn]:33071,[bc]:33648},ye={[hn]:9728,[ap]:9984,[rc]:9986,[en]:9729,[Yy]:9985,[po]:9987};function pe(F,k,ie){if(ie?(n.texParameteri(F,10242,z[k.wrapS]),n.texParameteri(F,10243,z[k.wrapT]),(F===32879||F===35866)&&n.texParameteri(F,32882,z[k.wrapR]),n.texParameteri(F,10240,ye[k.magFilter]),n.texParameteri(F,10241,ye[k.minFilter])):(n.texParameteri(F,10242,33071),n.texParameteri(F,10243,33071),(F===32879||F===35866)&&n.texParameteri(F,32882,33071),(k.wrapS!==Jn||k.wrapT!==Jn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(F,10240,L(k.magFilter)),n.texParameteri(F,10241,L(k.minFilter)),k.minFilter!==hn&&k.minFilter!==en&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const _e=e.get("EXT_texture_filter_anisotropic");if(k.magFilter===hn||k.minFilter!==rc&&k.minFilter!==po||k.type===Hr&&e.has("OES_texture_float_linear")===!1||a===!1&&k.type===ca&&e.has("OES_texture_half_float_linear")===!1)return;(k.anisotropy>1||i.get(k).__currentAnisotropy)&&(n.texParameterf(F,_e.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(k.anisotropy,r.getMaxAnisotropy())),i.get(k).__currentAnisotropy=k.anisotropy)}}function Q(F,k){let ie=!1;F.__webglInit===void 0&&(F.__webglInit=!0,k.addEventListener("dispose",H));const _e=k.source;let Se=S.get(_e);Se===void 0&&(Se={},S.set(_e,Se));const be=V(k);if(be!==F.__cacheKey){Se[be]===void 0&&(Se[be]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ie=!0),Se[be].usedTimes++;const tt=Se[F.__cacheKey];tt!==void 0&&(Se[F.__cacheKey].usedTimes--,tt.usedTimes===0&&W(k)),F.__cacheKey=be,F.__webglTexture=Se[be].texture}return ie}function Qe(F,k,ie){let _e=3553;(k.isDataArrayTexture||k.isCompressedArrayTexture)&&(_e=35866),k.isData3DTexture&&(_e=32879);const Se=Q(F,k),be=k.source;t.bindTexture(_e,F.__webglTexture,33984+ie);const tt=i.get(be);if(be.version!==tt.__version||Se===!0){t.activeTexture(33984+ie),n.pixelStorei(37440,k.flipY),n.pixelStorei(37441,k.premultiplyAlpha),n.pixelStorei(3317,k.unpackAlignment),n.pixelStorei(37443,0);const ke=C(k)&&T(k.image)===!1;let he=w(k.image,ke,!1,h);he=Et(k,he);const Ve=T(he)||a,qe=s.convert(k.format,k.encoding);let et=s.convert(k.type),Oe=I(k.internalFormat,qe,et,k.encoding,k.isVideoTexture);pe(_e,k,Ve);let Ge;const wt=k.mipmaps,Lt=a&&k.isVideoTexture!==!0,Jt=tt.__version===void 0||Se===!0,X=b(k,he,Ve);if(k.isDepthTexture)Oe=6402,a?k.type===Hr?Oe=36012:k.type===$s?Oe=33190:k.type===ta?Oe=35056:Oe=33189:k.type===Hr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),k.format===lo&&Oe===6402&&k.type!==qy&&k.type!==$s&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),k.type=$s,et=s.convert(k.type)),k.format===fa&&Oe===6402&&(Oe=34041,k.type!==ta&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),k.type=ta,et=s.convert(k.type))),Jt&&(Lt?t.texStorage2D(3553,1,Oe,he.width,he.height):t.texImage2D(3553,0,Oe,he.width,he.height,0,qe,et,null));else if(k.isDataTexture)if(wt.length>0&&Ve){Lt&&Jt&&t.texStorage2D(3553,X,Oe,wt[0].width,wt[0].height);for(let fe=0,xe=wt.length;fe<xe;fe++)Ge=wt[fe],Lt?t.texSubImage2D(3553,fe,0,0,Ge.width,Ge.height,qe,et,Ge.data):t.texImage2D(3553,fe,Oe,Ge.width,Ge.height,0,qe,et,Ge.data);k.generateMipmaps=!1}else Lt?(Jt&&t.texStorage2D(3553,X,Oe,he.width,he.height),t.texSubImage2D(3553,0,0,0,he.width,he.height,qe,et,he.data)):t.texImage2D(3553,0,Oe,he.width,he.height,0,qe,et,he.data);else if(k.isCompressedTexture)if(k.isCompressedArrayTexture){Lt&&Jt&&t.texStorage3D(35866,X,Oe,wt[0].width,wt[0].height,he.depth);for(let fe=0,xe=wt.length;fe<xe;fe++)Ge=wt[fe],k.format!==_i?qe!==null?Lt?t.compressedTexSubImage3D(35866,fe,0,0,0,Ge.width,Ge.height,he.depth,qe,Ge.data,0,0):t.compressedTexImage3D(35866,fe,Oe,Ge.width,Ge.height,he.depth,0,Ge.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Lt?t.texSubImage3D(35866,fe,0,0,0,Ge.width,Ge.height,he.depth,qe,et,Ge.data):t.texImage3D(35866,fe,Oe,Ge.width,Ge.height,he.depth,0,qe,et,Ge.data)}else{Lt&&Jt&&t.texStorage2D(3553,X,Oe,wt[0].width,wt[0].height);for(let fe=0,xe=wt.length;fe<xe;fe++)Ge=wt[fe],k.format!==_i?qe!==null?Lt?t.compressedTexSubImage2D(3553,fe,0,0,Ge.width,Ge.height,qe,Ge.data):t.compressedTexImage2D(3553,fe,Oe,Ge.width,Ge.height,0,Ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Lt?t.texSubImage2D(3553,fe,0,0,Ge.width,Ge.height,qe,et,Ge.data):t.texImage2D(3553,fe,Oe,Ge.width,Ge.height,0,qe,et,Ge.data)}else if(k.isDataArrayTexture)Lt?(Jt&&t.texStorage3D(35866,X,Oe,he.width,he.height,he.depth),t.texSubImage3D(35866,0,0,0,0,he.width,he.height,he.depth,qe,et,he.data)):t.texImage3D(35866,0,Oe,he.width,he.height,he.depth,0,qe,et,he.data);else if(k.isData3DTexture)Lt?(Jt&&t.texStorage3D(32879,X,Oe,he.width,he.height,he.depth),t.texSubImage3D(32879,0,0,0,0,he.width,he.height,he.depth,qe,et,he.data)):t.texImage3D(32879,0,Oe,he.width,he.height,he.depth,0,qe,et,he.data);else if(k.isFramebufferTexture){if(Jt)if(Lt)t.texStorage2D(3553,X,Oe,he.width,he.height);else{let fe=he.width,xe=he.height;for(let Ie=0;Ie<X;Ie++)t.texImage2D(3553,Ie,Oe,fe,xe,0,qe,et,null),fe>>=1,xe>>=1}}else if(wt.length>0&&Ve){Lt&&Jt&&t.texStorage2D(3553,X,Oe,wt[0].width,wt[0].height);for(let fe=0,xe=wt.length;fe<xe;fe++)Ge=wt[fe],Lt?t.texSubImage2D(3553,fe,0,0,qe,et,Ge):t.texImage2D(3553,fe,Oe,qe,et,Ge);k.generateMipmaps=!1}else Lt?(Jt&&t.texStorage2D(3553,X,Oe,he.width,he.height),t.texSubImage2D(3553,0,0,0,qe,et,he)):t.texImage2D(3553,0,Oe,qe,et,he);P(k,Ve)&&R(_e),tt.__version=be.version,k.onUpdate&&k.onUpdate(k)}F.__version=k.version}function je(F,k,ie){if(k.image.length!==6)return;const _e=Q(F,k),Se=k.source;t.bindTexture(34067,F.__webglTexture,33984+ie);const be=i.get(Se);if(Se.version!==be.__version||_e===!0){t.activeTexture(33984+ie),n.pixelStorei(37440,k.flipY),n.pixelStorei(37441,k.premultiplyAlpha),n.pixelStorei(3317,k.unpackAlignment),n.pixelStorei(37443,0);const tt=k.isCompressedTexture||k.image[0].isCompressedTexture,ke=k.image[0]&&k.image[0].isDataTexture,he=[];for(let fe=0;fe<6;fe++)!tt&&!ke?he[fe]=w(k.image[fe],!1,!0,f):he[fe]=ke?k.image[fe].image:k.image[fe],he[fe]=Et(k,he[fe]);const Ve=he[0],qe=T(Ve)||a,et=s.convert(k.format,k.encoding),Oe=s.convert(k.type),Ge=I(k.internalFormat,et,Oe,k.encoding),wt=a&&k.isVideoTexture!==!0,Lt=be.__version===void 0||_e===!0;let Jt=b(k,Ve,qe);pe(34067,k,qe);let X;if(tt){wt&&Lt&&t.texStorage2D(34067,Jt,Ge,Ve.width,Ve.height);for(let fe=0;fe<6;fe++){X=he[fe].mipmaps;for(let xe=0;xe<X.length;xe++){const Ie=X[xe];k.format!==_i?et!==null?wt?t.compressedTexSubImage2D(34069+fe,xe,0,0,Ie.width,Ie.height,et,Ie.data):t.compressedTexImage2D(34069+fe,xe,Ge,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):wt?t.texSubImage2D(34069+fe,xe,0,0,Ie.width,Ie.height,et,Oe,Ie.data):t.texImage2D(34069+fe,xe,Ge,Ie.width,Ie.height,0,et,Oe,Ie.data)}}}else{X=k.mipmaps,wt&&Lt&&(X.length>0&&Jt++,t.texStorage2D(34067,Jt,Ge,he[0].width,he[0].height));for(let fe=0;fe<6;fe++)if(ke){wt?t.texSubImage2D(34069+fe,0,0,0,he[fe].width,he[fe].height,et,Oe,he[fe].data):t.texImage2D(34069+fe,0,Ge,he[fe].width,he[fe].height,0,et,Oe,he[fe].data);for(let xe=0;xe<X.length;xe++){const We=X[xe].image[fe].image;wt?t.texSubImage2D(34069+fe,xe+1,0,0,We.width,We.height,et,Oe,We.data):t.texImage2D(34069+fe,xe+1,Ge,We.width,We.height,0,et,Oe,We.data)}}else{wt?t.texSubImage2D(34069+fe,0,0,0,et,Oe,he[fe]):t.texImage2D(34069+fe,0,Ge,et,Oe,he[fe]);for(let xe=0;xe<X.length;xe++){const Ie=X[xe];wt?t.texSubImage2D(34069+fe,xe+1,0,0,et,Oe,Ie.image[fe]):t.texImage2D(34069+fe,xe+1,Ge,et,Oe,Ie.image[fe])}}}P(k,qe)&&R(34067),be.__version=Se.version,k.onUpdate&&k.onUpdate(k)}F.__version=k.version}function Me(F,k,ie,_e,Se){const be=s.convert(ie.format,ie.encoding),tt=s.convert(ie.type),ke=I(ie.internalFormat,be,tt,ie.encoding);i.get(k).__hasExternalTextures||(Se===32879||Se===35866?t.texImage3D(Se,0,ke,k.width,k.height,k.depth,0,be,tt,null):t.texImage2D(Se,0,ke,k.width,k.height,0,be,tt,null)),t.bindFramebuffer(36160,F),Ye(k)?m.framebufferTexture2DMultisampleEXT(36160,_e,Se,i.get(ie).__webglTexture,0,$e(k)):(Se===3553||Se>=34069&&Se<=34074)&&n.framebufferTexture2D(36160,_e,Se,i.get(ie).__webglTexture,0),t.bindFramebuffer(36160,null)}function De(F,k,ie){if(n.bindRenderbuffer(36161,F),k.depthBuffer&&!k.stencilBuffer){let _e=33189;if(ie||Ye(k)){const Se=k.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Hr?_e=36012:Se.type===$s&&(_e=33190));const be=$e(k);Ye(k)?m.renderbufferStorageMultisampleEXT(36161,be,_e,k.width,k.height):n.renderbufferStorageMultisample(36161,be,_e,k.width,k.height)}else n.renderbufferStorage(36161,_e,k.width,k.height);n.framebufferRenderbuffer(36160,36096,36161,F)}else if(k.depthBuffer&&k.stencilBuffer){const _e=$e(k);ie&&Ye(k)===!1?n.renderbufferStorageMultisample(36161,_e,35056,k.width,k.height):Ye(k)?m.renderbufferStorageMultisampleEXT(36161,_e,35056,k.width,k.height):n.renderbufferStorage(36161,34041,k.width,k.height),n.framebufferRenderbuffer(36160,33306,36161,F)}else{const _e=k.isWebGLMultipleRenderTargets===!0?k.texture:[k.texture];for(let Se=0;Se<_e.length;Se++){const be=_e[Se],tt=s.convert(be.format,be.encoding),ke=s.convert(be.type),he=I(be.internalFormat,tt,ke,be.encoding),Ve=$e(k);ie&&Ye(k)===!1?n.renderbufferStorageMultisample(36161,Ve,he,k.width,k.height):Ye(k)?m.renderbufferStorageMultisampleEXT(36161,Ve,he,k.width,k.height):n.renderbufferStorage(36161,he,k.width,k.height)}}n.bindRenderbuffer(36161,null)}function me(F,k){if(k&&k.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,F),!(k.depthTexture&&k.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(k.depthTexture).__webglTexture||k.depthTexture.image.width!==k.width||k.depthTexture.image.height!==k.height)&&(k.depthTexture.image.width=k.width,k.depthTexture.image.height=k.height,k.depthTexture.needsUpdate=!0),B(k.depthTexture,0);const _e=i.get(k.depthTexture).__webglTexture,Se=$e(k);if(k.depthTexture.format===lo)Ye(k)?m.framebufferTexture2DMultisampleEXT(36160,36096,3553,_e,0,Se):n.framebufferTexture2D(36160,36096,3553,_e,0);else if(k.depthTexture.format===fa)Ye(k)?m.framebufferTexture2DMultisampleEXT(36160,33306,3553,_e,0,Se):n.framebufferTexture2D(36160,33306,3553,_e,0);else throw new Error("Unknown depthTexture format")}function se(F){const k=i.get(F),ie=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!k.__autoAllocateDepthBuffer){if(ie)throw new Error("target.depthTexture not supported in Cube render targets");me(k.__webglFramebuffer,F)}else if(ie){k.__webglDepthbuffer=[];for(let _e=0;_e<6;_e++)t.bindFramebuffer(36160,k.__webglFramebuffer[_e]),k.__webglDepthbuffer[_e]=n.createRenderbuffer(),De(k.__webglDepthbuffer[_e],F,!1)}else t.bindFramebuffer(36160,k.__webglFramebuffer),k.__webglDepthbuffer=n.createRenderbuffer(),De(k.__webglDepthbuffer,F,!1);t.bindFramebuffer(36160,null)}function ve(F,k,ie){const _e=i.get(F);k!==void 0&&Me(_e.__webglFramebuffer,F,F.texture,36064,3553),ie!==void 0&&se(F)}function Ue(F){const k=F.texture,ie=i.get(F),_e=i.get(k);F.addEventListener("dispose",q),F.isWebGLMultipleRenderTargets!==!0&&(_e.__webglTexture===void 0&&(_e.__webglTexture=n.createTexture()),_e.__version=k.version,o.memory.textures++);const Se=F.isWebGLCubeRenderTarget===!0,be=F.isWebGLMultipleRenderTargets===!0,tt=T(F)||a;if(Se){ie.__webglFramebuffer=[];for(let ke=0;ke<6;ke++)ie.__webglFramebuffer[ke]=n.createFramebuffer()}else{if(ie.__webglFramebuffer=n.createFramebuffer(),be)if(r.drawBuffers){const ke=F.texture;for(let he=0,Ve=ke.length;he<Ve;he++){const qe=i.get(ke[he]);qe.__webglTexture===void 0&&(qe.__webglTexture=n.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&F.samples>0&&Ye(F)===!1){const ke=be?k:[k];ie.__webglMultisampledFramebuffer=n.createFramebuffer(),ie.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,ie.__webglMultisampledFramebuffer);for(let he=0;he<ke.length;he++){const Ve=ke[he];ie.__webglColorRenderbuffer[he]=n.createRenderbuffer(),n.bindRenderbuffer(36161,ie.__webglColorRenderbuffer[he]);const qe=s.convert(Ve.format,Ve.encoding),et=s.convert(Ve.type),Oe=I(Ve.internalFormat,qe,et,Ve.encoding,F.isXRRenderTarget===!0),Ge=$e(F);n.renderbufferStorageMultisample(36161,Ge,Oe,F.width,F.height),n.framebufferRenderbuffer(36160,36064+he,36161,ie.__webglColorRenderbuffer[he])}n.bindRenderbuffer(36161,null),F.depthBuffer&&(ie.__webglDepthRenderbuffer=n.createRenderbuffer(),De(ie.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(36160,null)}}if(Se){t.bindTexture(34067,_e.__webglTexture),pe(34067,k,tt);for(let ke=0;ke<6;ke++)Me(ie.__webglFramebuffer[ke],F,k,36064,34069+ke);P(k,tt)&&R(34067),t.unbindTexture()}else if(be){const ke=F.texture;for(let he=0,Ve=ke.length;he<Ve;he++){const qe=ke[he],et=i.get(qe);t.bindTexture(3553,et.__webglTexture),pe(3553,qe,tt),Me(ie.__webglFramebuffer,F,qe,36064+he,3553),P(qe,tt)&&R(3553)}t.unbindTexture()}else{let ke=3553;(F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(a?ke=F.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(ke,_e.__webglTexture),pe(ke,k,tt),Me(ie.__webglFramebuffer,F,k,36064,ke),P(k,tt)&&R(ke),t.unbindTexture()}F.depthBuffer&&se(F)}function Ce(F){const k=T(F)||a,ie=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let _e=0,Se=ie.length;_e<Se;_e++){const be=ie[_e];if(P(be,k)){const tt=F.isWebGLCubeRenderTarget?34067:3553,ke=i.get(be).__webglTexture;t.bindTexture(tt,ke),R(tt),t.unbindTexture()}}}function Ke(F){if(a&&F.samples>0&&Ye(F)===!1){const k=F.isWebGLMultipleRenderTargets?F.texture:[F.texture],ie=F.width,_e=F.height;let Se=16384;const be=[],tt=F.stencilBuffer?33306:36096,ke=i.get(F),he=F.isWebGLMultipleRenderTargets===!0;if(he)for(let Ve=0;Ve<k.length;Ve++)t.bindFramebuffer(36160,ke.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(36160,36064+Ve,36161,null),t.bindFramebuffer(36160,ke.__webglFramebuffer),n.framebufferTexture2D(36009,36064+Ve,3553,null,0);t.bindFramebuffer(36008,ke.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,ke.__webglFramebuffer);for(let Ve=0;Ve<k.length;Ve++){be.push(36064+Ve),F.depthBuffer&&be.push(tt);const qe=ke.__ignoreDepthValues!==void 0?ke.__ignoreDepthValues:!1;if(qe===!1&&(F.depthBuffer&&(Se|=256),F.stencilBuffer&&(Se|=1024)),he&&n.framebufferRenderbuffer(36008,36064,36161,ke.__webglColorRenderbuffer[Ve]),qe===!0&&(n.invalidateFramebuffer(36008,[tt]),n.invalidateFramebuffer(36009,[tt])),he){const et=i.get(k[Ve]).__webglTexture;n.framebufferTexture2D(36009,36064,3553,et,0)}n.blitFramebuffer(0,0,ie,_e,0,0,ie,_e,Se,9728),v&&n.invalidateFramebuffer(36008,be)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),he)for(let Ve=0;Ve<k.length;Ve++){t.bindFramebuffer(36160,ke.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(36160,36064+Ve,36161,ke.__webglColorRenderbuffer[Ve]);const qe=i.get(k[Ve]).__webglTexture;t.bindFramebuffer(36160,ke.__webglFramebuffer),n.framebufferTexture2D(36009,36064+Ve,3553,qe,0)}t.bindFramebuffer(36009,ke.__webglMultisampledFramebuffer)}}function $e(F){return Math.min(d,F.samples)}function Ye(F){const k=i.get(F);return a&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&k.__useRenderToTexture!==!1}function rt(F){const k=o.render.frame;_.get(F)!==k&&(_.set(F,k),F.update())}function Et(F,k){const ie=F.encoding,_e=F.format,Se=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===lp||ie!==Ts&&(ie===Ot?a===!1?e.has("EXT_sRGB")===!0&&_e===_i?(F.format=lp,F.minFilter=en,F.generateMipmaps=!1):k=Ky.sRGBToLinear(k):(_e!==_i||Se!==Es)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ie)),k}this.allocateTextureUnit=D,this.resetTextureUnits=ue,this.setTexture2D=B,this.setTexture2DArray=J,this.setTexture3D=Y,this.setTextureCube=K,this.rebindTextures=ve,this.setupRenderTarget=Ue,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=Ke,this.setupDepthRenderbuffer=se,this.setupFrameBufferTexture=Me,this.useMultisampledRTT=Ye}function V2(n,e,t){const i=t.isWebGL2;function r(s,o=null){let a;if(s===Es)return 5121;if(s===u2)return 32819;if(s===c2)return 32820;if(s===o2)return 5120;if(s===a2)return 5122;if(s===qy)return 5123;if(s===l2)return 5124;if(s===$s)return 5125;if(s===Hr)return 5126;if(s===ca)return i?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===f2)return 6406;if(s===_i)return 6408;if(s===h2)return 6409;if(s===d2)return 6410;if(s===lo)return 6402;if(s===fa)return 34041;if(s===lp)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===p2)return 6403;if(s===m2)return 36244;if(s===g2)return 33319;if(s===v2)return 33320;if(s===y2)return 36249;if(s===bd||s===Pd||s===Ld||s===Rd)if(o===Ot)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===bd)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Pd)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Ld)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Rd)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===bd)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Pd)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Ld)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Rd)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===hv||s===dv||s===pv||s===mv)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===hv)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===dv)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===pv)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===mv)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===_2)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===gv||s===vv)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===gv)return o===Ot?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===vv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===yv||s===_v||s===xv||s===Sv||s===wv||s===Mv||s===Ev||s===Tv||s===Av||s===Cv||s===bv||s===Pv||s===Lv||s===Rv)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===yv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===_v)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===xv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Sv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===wv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Mv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Ev)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Tv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Av)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Cv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===bv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Pv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Lv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Rv)return o===Ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Id)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Id)return o===Ot?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===x2||s===Iv||s===Dv||s===Nv)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Id)return a.COMPRESSED_RED_RGTC1_EXT;if(s===Iv)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Dv)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Nv)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===ta?i?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class H2 extends In{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Sl extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}const gk={type:"move"};class jg{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Sl,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 Sl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Sl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),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 i of e.hand.values())this._getHandJoint(t,i)}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,i){let r=null,s=null,o=null;const a=this._targetRay,c=this._grip,f=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(f&&e.hand){o=!0;for(const E of e.hand.values()){const S=t.getJointPose(E,i),g=this._getHandJoint(f,E);S!==null&&(g.matrix.fromArray(S.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=S.radius),g.visible=S!==null}const h=f.joints["index-finger-tip"],d=f.joints["thumb-tip"],m=h.position.distanceTo(d.position),v=.02,_=.005;f.inputState.pinching&&m>v+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(gk)))}return a!==null&&(a.visible=r!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Sl;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class s_ extends un{constructor(e,t,i,r,s,o,a,c,f,h){if(h=h!==void 0?h:lo,h!==lo&&h!==fa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===lo&&(i=$s),i===void 0&&h===fa&&(i=ta),super(null,r,s,o,a,c,h,i,f),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:hn,this.minFilter=c!==void 0?c:hn,this.flipY=!1,this.generateMipmaps=!1}}class vk extends bs{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",c=1,f=null,h=null,d=null,m=null,v=null,_=null;const E=t.getContextAttributes();let S=null,g=null;const x=[],w=[],T=new Set,C=new Map,P=new In;P.layers.enable(1),P.viewport=new Nt;const R=new In;R.layers.enable(2),R.viewport=new Nt;const I=[P,R],b=new H2;b.layers.enable(1),b.layers.enable(2);let L=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let z=x[K];return z===void 0&&(z=new jg,x[K]=z),z.getTargetRaySpace()},this.getControllerGrip=function(K){let z=x[K];return z===void 0&&(z=new jg,x[K]=z),z.getGripSpace()},this.getHand=function(K){let z=x[K];return z===void 0&&(z=new jg,x[K]=z),z.getHandSpace()};function q(K){const z=w.indexOf(K.inputSource);if(z===-1)return;const ye=x[z];ye!==void 0&&ye.dispatchEvent({type:K.type,data:K.inputSource})}function G(){r.removeEventListener("select",q),r.removeEventListener("selectstart",q),r.removeEventListener("selectend",q),r.removeEventListener("squeeze",q),r.removeEventListener("squeezestart",q),r.removeEventListener("squeezeend",q),r.removeEventListener("end",G),r.removeEventListener("inputsourceschange",W);for(let K=0;K<x.length;K++){const z=w[K];z!==null&&(w[K]=null,x[K].disconnect(z))}L=null,H=null,e.setRenderTarget(S),v=null,m=null,d=null,r=null,g=null,Y.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){s=K,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){a=K,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f||o},this.setReferenceSpace=function(K){f=K},this.getBaseLayer=function(){return m!==null?m:v},this.getBinding=function(){return d},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(K){if(r=K,r!==null){if(S=e.getRenderTarget(),r.addEventListener("select",q),r.addEventListener("selectstart",q),r.addEventListener("selectend",q),r.addEventListener("squeeze",q),r.addEventListener("squeezestart",q),r.addEventListener("squeezeend",q),r.addEventListener("end",G),r.addEventListener("inputsourceschange",W),E.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const z={antialias:r.renderState.layers===void 0?E.antialias:!0,alpha:E.alpha,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(r,t,z),r.updateRenderState({baseLayer:v}),g=new ar(v.framebufferWidth,v.framebufferHeight,{format:_i,type:Es,encoding:e.outputEncoding,stencilBuffer:E.stencil})}else{let z=null,ye=null,pe=null;E.depth&&(pe=E.stencil?35056:33190,z=E.stencil?fa:lo,ye=E.stencil?ta:$s);const Q={colorFormat:32856,depthFormat:pe,scaleFactor:s};d=new XRWebGLBinding(r,t),m=d.createProjectionLayer(Q),r.updateRenderState({layers:[m]}),g=new ar(m.textureWidth,m.textureHeight,{format:_i,type:Es,depthTexture:new s_(m.textureWidth,m.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,z),stencilBuffer:E.stencil,encoding:e.outputEncoding,samples:E.antialias?4:0});const Qe=e.properties.get(g);Qe.__ignoreDepthValues=m.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(c),f=null,o=await r.requestReferenceSpace(a),Y.setContext(r),Y.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function W(K){for(let z=0;z<K.removed.length;z++){const ye=K.removed[z],pe=w.indexOf(ye);pe>=0&&(w[pe]=null,x[pe].disconnect(ye))}for(let z=0;z<K.added.length;z++){const ye=K.added[z];let pe=w.indexOf(ye);if(pe===-1){for(let Qe=0;Qe<x.length;Qe++)if(Qe>=w.length){w.push(ye),pe=Qe;break}else if(w[Qe]===null){w[Qe]=ye,pe=Qe;break}if(pe===-1)break}const Q=x[pe];Q&&Q.connect(ye)}}const ee=new N,oe=new N;function ue(K,z,ye){ee.setFromMatrixPosition(z.matrixWorld),oe.setFromMatrixPosition(ye.matrixWorld);const pe=ee.distanceTo(oe),Q=z.projectionMatrix.elements,Qe=ye.projectionMatrix.elements,je=Q[14]/(Q[10]-1),Me=Q[14]/(Q[10]+1),De=(Q[9]+1)/Q[5],me=(Q[9]-1)/Q[5],se=(Q[8]-1)/Q[0],ve=(Qe[8]+1)/Qe[0],Ue=je*se,Ce=je*ve,Ke=pe/(-se+ve),$e=Ke*-se;z.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX($e),K.translateZ(Ke),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();const Ye=je+Ke,rt=Me+Ke,Et=Ue-$e,F=Ce+(pe-$e),k=De*Me/rt*Ye,ie=me*Me/rt*Ye;K.projectionMatrix.makePerspective(Et,F,k,ie,Ye,rt),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function D(K,z){z===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(z.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(r===null)return;b.near=R.near=P.near=K.near,b.far=R.far=P.far=K.far,(L!==b.near||H!==b.far)&&(r.updateRenderState({depthNear:b.near,depthFar:b.far}),L=b.near,H=b.far);const z=K.parent,ye=b.cameras;D(b,z);for(let pe=0;pe<ye.length;pe++)D(ye[pe],z);ye.length===2?ue(b,P,R):b.projectionMatrix.copy(P.projectionMatrix),V(K,b,z)};function V(K,z,ye){ye===null?K.matrix.copy(z.matrixWorld):(K.matrix.copy(ye.matrixWorld),K.matrix.invert(),K.matrix.multiply(z.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0);const pe=K.children;for(let Q=0,Qe=pe.length;Q<Qe;Q++)pe[Q].updateMatrixWorld(!0);K.projectionMatrix.copy(z.projectionMatrix),K.projectionMatrixInverse.copy(z.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=Fl*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return b},this.getFoveation=function(){if(!(m===null&&v===null))return c},this.setFoveation=function(K){c=K,m!==null&&(m.fixedFoveation=K),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=K)},this.getPlanes=function(){return T};let B=null;function J(K,z){if(h=z.getViewerPose(f||o),_=z,h!==null){const ye=h.views;v!==null&&(e.setRenderTargetFramebuffer(g,v.framebuffer),e.setRenderTarget(g));let pe=!1;ye.length!==b.cameras.length&&(b.cameras.length=0,pe=!0);for(let Q=0;Q<ye.length;Q++){const Qe=ye[Q];let je=null;if(v!==null)je=v.getViewport(Qe);else{const De=d.getViewSubImage(m,Qe);je=De.viewport,Q===0&&(e.setRenderTargetTextures(g,De.colorTexture,m.ignoreDepthValues?void 0:De.depthStencilTexture),e.setRenderTarget(g))}let Me=I[Q];Me===void 0&&(Me=new In,Me.layers.enable(Q),Me.viewport=new Nt,I[Q]=Me),Me.matrix.fromArray(Qe.transform.matrix),Me.matrix.decompose(Me.position,Me.quaternion,Me.scale),Me.projectionMatrix.fromArray(Qe.projectionMatrix),Me.projectionMatrixInverse.copy(Me.projectionMatrix).invert(),Me.viewport.set(je.x,je.y,je.width,je.height),Q===0&&(b.matrix.copy(Me.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale)),pe===!0&&b.cameras.push(Me)}}for(let ye=0;ye<x.length;ye++){const pe=w[ye],Q=x[ye];pe!==null&&Q!==void 0&&Q.update(pe,z,f||o)}if(B&&B(K,z),z.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:z.detectedPlanes});let ye=null;for(const pe of T)z.detectedPlanes.has(pe)||(ye===null&&(ye=[]),ye.push(pe));if(ye!==null)for(const pe of ye)T.delete(pe),C.delete(pe),i.dispatchEvent({type:"planeremoved",data:pe});for(const pe of z.detectedPlanes)if(!T.has(pe))T.add(pe),C.set(pe,z.lastChangedTime),i.dispatchEvent({type:"planeadded",data:pe});else{const Q=C.get(pe);pe.lastChangedTime>Q&&(C.set(pe,pe.lastChangedTime),i.dispatchEvent({type:"planechanged",data:pe}))}}_=null}const Y=new z2;Y.setAnimationLoop(J),this.setAnimationLoop=function(K){B=K},this.dispose=function(){}}}function yk(n,e){function t(S,g){S.matrixAutoUpdate===!0&&S.updateMatrix(),g.value.copy(S.matrix)}function i(S,g){g.color.getRGB(S.fogColor.value,I2(n)),g.isFog?(S.fogNear.value=g.near,S.fogFar.value=g.far):g.isFogExp2&&(S.fogDensity.value=g.density)}function r(S,g,x,w,T){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(S,g):g.isMeshToonMaterial?(s(S,g),d(S,g)):g.isMeshPhongMaterial?(s(S,g),h(S,g)):g.isMeshStandardMaterial?(s(S,g),m(S,g),g.isMeshPhysicalMaterial&&v(S,g,T)):g.isMeshMatcapMaterial?(s(S,g),_(S,g)):g.isMeshDepthMaterial?s(S,g):g.isMeshDistanceMaterial?(s(S,g),E(S,g)):g.isMeshNormalMaterial?s(S,g):g.isLineBasicMaterial?(o(S,g),g.isLineDashedMaterial&&a(S,g)):g.isPointsMaterial?c(S,g,x,w):g.isSpriteMaterial?f(S,g):g.isShadowMaterial?(S.color.value.copy(g.color),S.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(S,g){S.opacity.value=g.opacity,g.color&&S.diffuse.value.copy(g.color),g.emissive&&S.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(S.map.value=g.map,t(g.map,S.mapTransform)),g.alphaMap&&(S.alphaMap.value=g.alphaMap,t(g.alphaMap,S.alphaMapTransform)),g.bumpMap&&(S.bumpMap.value=g.bumpMap,t(g.bumpMap,S.bumpMapTransform),S.bumpScale.value=g.bumpScale,g.side===li&&(S.bumpScale.value*=-1)),g.normalMap&&(S.normalMap.value=g.normalMap,t(g.normalMap,S.normalMapTransform),S.normalScale.value.copy(g.normalScale),g.side===li&&S.normalScale.value.negate()),g.displacementMap&&(S.displacementMap.value=g.displacementMap,t(g.displacementMap,S.displacementMapTransform),S.displacementScale.value=g.displacementScale,S.displacementBias.value=g.displacementBias),g.emissiveMap&&(S.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,S.emissiveMapTransform)),g.specularMap&&(S.specularMap.value=g.specularMap,t(g.specularMap,S.specularMapTransform)),g.alphaTest>0&&(S.alphaTest.value=g.alphaTest);const x=e.get(g).envMap;if(x&&(S.envMap.value=x,S.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=g.reflectivity,S.ior.value=g.ior,S.refractionRatio.value=g.refractionRatio),g.lightMap){S.lightMap.value=g.lightMap;const w=n.useLegacyLights===!0?Math.PI:1;S.lightMapIntensity.value=g.lightMapIntensity*w,t(g.lightMap,S.lightMapTransform)}g.aoMap&&(S.aoMap.value=g.aoMap,S.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,S.aoMapTransform))}function o(S,g){S.diffuse.value.copy(g.color),S.opacity.value=g.opacity,g.map&&(S.map.value=g.map,t(g.map,S.mapTransform))}function a(S,g){S.dashSize.value=g.dashSize,S.totalSize.value=g.dashSize+g.gapSize,S.scale.value=g.scale}function c(S,g,x,w){S.diffuse.value.copy(g.color),S.opacity.value=g.opacity,S.size.value=g.size*x,S.scale.value=w*.5,g.map&&(S.map.value=g.map,t(g.map,S.uvTransform)),g.alphaMap&&(S.alphaMap.value=g.alphaMap),g.alphaTest>0&&(S.alphaTest.value=g.alphaTest)}function f(S,g){S.diffuse.value.copy(g.color),S.opacity.value=g.opacity,S.rotation.value=g.rotation,g.map&&(S.map.value=g.map,t(g.map,S.mapTransform)),g.alphaMap&&(S.alphaMap.value=g.alphaMap),g.alphaTest>0&&(S.alphaTest.value=g.alphaTest)}function h(S,g){S.specular.value.copy(g.specular),S.shininess.value=Math.max(g.shininess,1e-4)}function d(S,g){g.gradientMap&&(S.gradientMap.value=g.gradientMap)}function m(S,g){S.metalness.value=g.metalness,g.metalnessMap&&(S.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,S.metalnessMapTransform)),S.roughness.value=g.roughness,g.roughnessMap&&(S.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,S.roughnessMapTransform)),e.get(g).envMap&&(S.envMapIntensity.value=g.envMapIntensity)}function v(S,g,x){S.ior.value=g.ior,g.sheen>0&&(S.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),S.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(S.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,S.sheenColorMapTransform)),g.sheenRoughnessMap&&(S.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,S.sheenRoughnessMapTransform))),g.clearcoat>0&&(S.clearcoat.value=g.clearcoat,S.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(S.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,S.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(S.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===li&&S.clearcoatNormalScale.value.negate())),g.iridescence>0&&(S.iridescence.value=g.iridescence,S.iridescenceIOR.value=g.iridescenceIOR,S.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(S.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,S.iridescenceMapTransform)),g.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),g.transmission>0&&(S.transmission.value=g.transmission,S.transmissionSamplerMap.value=x.texture,S.transmissionSamplerSize.value.set(x.width,x.height),g.transmissionMap&&(S.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,S.transmissionMapTransform)),S.thickness.value=g.thickness,g.thicknessMap&&(S.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=g.attenuationDistance,S.attenuationColor.value.copy(g.attenuationColor)),S.specularIntensity.value=g.specularIntensity,S.specularColor.value.copy(g.specularColor),g.specularColorMap&&(S.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,S.specularColorMapTransform)),g.specularIntensityMap&&(S.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,S.specularIntensityMapTransform))}function _(S,g){g.matcap&&(S.matcap.value=g.matcap)}function E(S,g){const x=e.get(g).light;S.referencePosition.value.setFromMatrixPosition(x.matrixWorld),S.nearDistance.value=x.shadow.camera.near,S.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function _k(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function c(x,w){const T=w.program;i.uniformBlockBinding(x,T)}function f(x,w){let T=r[x.id];T===void 0&&(_(x),T=h(x),r[x.id]=T,x.addEventListener("dispose",S));const C=w.program;i.updateUBOMapping(x,C);const P=e.render.frame;s[x.id]!==P&&(m(x),s[x.id]=P)}function h(x){const w=d();x.__bindingPointIndex=w;const T=n.createBuffer(),C=x.__size,P=x.usage;return n.bindBuffer(35345,T),n.bufferData(35345,C,P),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,T),T}function d(){for(let x=0;x<a;x++)if(o.indexOf(x)===-1)return o.push(x),x;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(x){const w=r[x.id],T=x.uniforms,C=x.__cache;n.bindBuffer(35345,w);for(let P=0,R=T.length;P<R;P++){const I=T[P];if(v(I,P,C)===!0){const b=I.__offset,L=Array.isArray(I.value)?I.value:[I.value];let H=0;for(let q=0;q<L.length;q++){const G=L[q],W=E(G);typeof G=="number"?(I.__data[0]=G,n.bufferSubData(35345,b+H,I.__data)):G.isMatrix3?(I.__data[0]=G.elements[0],I.__data[1]=G.elements[1],I.__data[2]=G.elements[2],I.__data[3]=G.elements[0],I.__data[4]=G.elements[3],I.__data[5]=G.elements[4],I.__data[6]=G.elements[5],I.__data[7]=G.elements[0],I.__data[8]=G.elements[6],I.__data[9]=G.elements[7],I.__data[10]=G.elements[8],I.__data[11]=G.elements[0]):(G.toArray(I.__data,H),H+=W.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(35345,b,I.__data)}}n.bindBuffer(35345,null)}function v(x,w,T){const C=x.value;if(T[w]===void 0){if(typeof C=="number")T[w]=C;else{const P=Array.isArray(C)?C:[C],R=[];for(let I=0;I<P.length;I++)R.push(P[I].clone());T[w]=R}return!0}else if(typeof C=="number"){if(T[w]!==C)return T[w]=C,!0}else{const P=Array.isArray(T[w])?T[w]:[T[w]],R=Array.isArray(C)?C:[C];for(let I=0;I<P.length;I++){const b=P[I];if(b.equals(R[I])===!1)return b.copy(R[I]),!0}}return!1}function _(x){const w=x.uniforms;let T=0;const C=16;let P=0;for(let R=0,I=w.length;R<I;R++){const b=w[R],L={boundary:0,storage:0},H=Array.isArray(b.value)?b.value:[b.value];for(let q=0,G=H.length;q<G;q++){const W=H[q],ee=E(W);L.boundary+=ee.boundary,L.storage+=ee.storage}if(b.__data=new Float32Array(L.storage/Float32Array.BYTES_PER_ELEMENT),b.__offset=T,R>0){P=T%C;const q=C-P;P!==0&&q-L.boundary<0&&(T+=C-P,b.__offset=T)}T+=L.storage}return P=T%C,P>0&&(T+=C-P),x.__size=T,x.__cache={},this}function E(x){const w={boundary:0,storage:0};return typeof x=="number"?(w.boundary=4,w.storage=4):x.isVector2?(w.boundary=8,w.storage=8):x.isVector3||x.isColor?(w.boundary=16,w.storage=12):x.isVector4?(w.boundary=16,w.storage=16):x.isMatrix3?(w.boundary=48,w.storage=48):x.isMatrix4?(w.boundary=64,w.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),w}function S(x){const w=x.target;w.removeEventListener("dispose",S);const T=o.indexOf(w.__bindingPointIndex);o.splice(T,1),n.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function g(){for(const x in r)n.deleteBuffer(r[x]);o=[],r={},s={}}return{bind:c,update:f,dispose:g}}function xk(){const n=Dc("canvas");return n.style.display="block",n}class o_{constructor(e={}){const{canvas:t=xk(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:f=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let m;i!==null?m=i.getContextAttributes().alpha:m=o;let v=null,_=null;const E=[],S=[];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.outputEncoding=Ts,this.useLegacyLights=!0,this.toneMapping=Ar,this.toneMappingExposure=1;const g=this;let x=!1,w=0,T=0,C=null,P=-1,R=null;const I=new Nt,b=new Nt;let L=null,H=t.width,q=t.height,G=1,W=null,ee=null;const oe=new Nt(0,0,H,q),ue=new Nt(0,0,H,q);let D=!1;const V=new Ip;let B=!1,J=!1,Y=null;const K=new st,z=new N,ye={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function pe(){return C===null?G:1}let Q=i;function Qe(U,ne){for(let ce=0;ce<U.length;ce++){const $=U[ce],de=t.getContext($,ne);if(de!==null)return de}return null}try{const U={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:f,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Cp}`),t.addEventListener("webglcontextlost",Ge,!1),t.addEventListener("webglcontextrestored",wt,!1),t.addEventListener("webglcontextcreationerror",Lt,!1),Q===null){const ne=["webgl2","webgl","experimental-webgl"];if(g.isWebGL1Renderer===!0&&ne.shift(),Q=Qe(ne,U),Q===null)throw Qe(ne)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Q.getShaderPrecisionFormat===void 0&&(Q.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(U){throw console.error("THREE.WebGLRenderer: "+U.message),U}let je,Me,De,me,se,ve,Ue,Ce,Ke,$e,Ye,rt,Et,F,k,ie,_e,Se,be,tt,ke,he,Ve,qe;function et(){je=new zD(Q),Me=new LD(Q,je,e),je.init(Me),he=new V2(Q,je,Me),De=new pk(Q,je,Me),me=new FD,se=new nk,ve=new mk(Q,je,De,se,Me,he,me),Ue=new ID(g),Ce=new kD(g),Ke=new JL(Q,Me),Ve=new bD(Q,je,Ke,Me),$e=new UD(Q,Ke,me,Ve),Ye=new GD(Q,$e,Ke,me),be=new HD(Q,Me,ve),ie=new RD(se),rt=new tk(g,Ue,Ce,je,Me,Ve,ie),Et=new yk(g,se),F=new rk,k=new ck(je,Me),Se=new CD(g,Ue,Ce,De,Ye,m,c),_e=new dk(g,Ye,Me),qe=new _k(Q,me,Me,De),tt=new PD(Q,je,me,Me),ke=new OD(Q,je,me,Me),me.programs=rt.programs,g.capabilities=Me,g.extensions=je,g.properties=se,g.renderLists=F,g.shadowMap=_e,g.state=De,g.info=me}et();const Oe=new vk(g,Q);this.xr=Oe,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const U=je.get("WEBGL_lose_context");U&&U.loseContext()},this.forceContextRestore=function(){const U=je.get("WEBGL_lose_context");U&&U.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(U){U!==void 0&&(G=U,this.setSize(H,q,!1))},this.getSize=function(U){return U.set(H,q)},this.setSize=function(U,ne,ce=!0){if(Oe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=U,q=ne,t.width=Math.floor(U*G),t.height=Math.floor(ne*G),ce===!0&&(t.style.width=U+"px",t.style.height=ne+"px"),this.setViewport(0,0,U,ne)},this.getDrawingBufferSize=function(U){return U.set(H*G,q*G).floor()},this.setDrawingBufferSize=function(U,ne,ce){H=U,q=ne,G=ce,t.width=Math.floor(U*ce),t.height=Math.floor(ne*ce),this.setViewport(0,0,U,ne)},this.getCurrentViewport=function(U){return U.copy(I)},this.getViewport=function(U){return U.copy(oe)},this.setViewport=function(U,ne,ce,$){U.isVector4?oe.set(U.x,U.y,U.z,U.w):oe.set(U,ne,ce,$),De.viewport(I.copy(oe).multiplyScalar(G).floor())},this.getScissor=function(U){return U.copy(ue)},this.setScissor=function(U,ne,ce,$){U.isVector4?ue.set(U.x,U.y,U.z,U.w):ue.set(U,ne,ce,$),De.scissor(b.copy(ue).multiplyScalar(G).floor())},this.getScissorTest=function(){return D},this.setScissorTest=function(U){De.setScissorTest(D=U)},this.setOpaqueSort=function(U){W=U},this.setTransparentSort=function(U){ee=U},this.getClearColor=function(U){return U.copy(Se.getClearColor())},this.setClearColor=function(){Se.setClearColor.apply(Se,arguments)},this.getClearAlpha=function(){return Se.getClearAlpha()},this.setClearAlpha=function(){Se.setClearAlpha.apply(Se,arguments)},this.clear=function(U=!0,ne=!0,ce=!0){let $=0;U&&($|=16384),ne&&($|=256),ce&&($|=1024),Q.clear($)},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",Ge,!1),t.removeEventListener("webglcontextrestored",wt,!1),t.removeEventListener("webglcontextcreationerror",Lt,!1),F.dispose(),k.dispose(),se.dispose(),Ue.dispose(),Ce.dispose(),Ye.dispose(),Ve.dispose(),qe.dispose(),rt.dispose(),Oe.dispose(),Oe.removeEventListener("sessionstart",We),Oe.removeEventListener("sessionend",zt),Y&&(Y.dispose(),Y=null),Vt.stop()};function Ge(U){U.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function wt(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const U=me.autoReset,ne=_e.enabled,ce=_e.autoUpdate,$=_e.needsUpdate,de=_e.type;et(),me.autoReset=U,_e.enabled=ne,_e.autoUpdate=ce,_e.needsUpdate=$,_e.type=de}function Lt(U){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",U.statusMessage)}function Jt(U){const ne=U.target;ne.removeEventListener("dispose",Jt),X(ne)}function X(U){fe(U),se.remove(U)}function fe(U){const ne=se.get(U).programs;ne!==void 0&&(ne.forEach(function(ce){rt.releaseProgram(ce)}),U.isShaderMaterial&&rt.releaseShaderCache(U))}this.renderBufferDirect=function(U,ne,ce,$,de,Ze){ne===null&&(ne=ye);const nt=de.isMesh&&de.matrixWorld.determinant()<0,it=mf(U,ne,ce,$,de);De.setMaterial($,nt);let ut=ce.index,pt=1;$.wireframe===!0&&(ut=$e.getWireframeAttribute(ce),pt=2);const mt=ce.drawRange,yt=ce.attributes.position;let Rt=mt.start*pt,Nn=(mt.start+mt.count)*pt;Ze!==null&&(Rt=Math.max(Rt,Ze.start*pt),Nn=Math.min(Nn,(Ze.start+Ze.count)*pt)),ut!==null?(Rt=Math.max(Rt,0),Nn=Math.min(Nn,ut.count)):yt!=null&&(Rt=Math.max(Rt,0),Nn=Math.min(Nn,yt.count));const Ei=Nn-Rt;if(Ei<0||Ei===1/0)return;Ve.setup(de,$,it,ce,ut);let ur,Ht=tt;if(ut!==null&&(ur=Ke.get(ut),Ht=ke,Ht.setIndex(ur)),de.isMesh)$.wireframe===!0?(De.setLineWidth($.wireframeLinewidth*pe()),Ht.setMode(1)):Ht.setMode(4);else if(de.isLine){let _t=$.linewidth;_t===void 0&&(_t=1),De.setLineWidth(_t*pe()),de.isLineSegments?Ht.setMode(1):de.isLineLoop?Ht.setMode(2):Ht.setMode(3)}else de.isPoints?Ht.setMode(0):de.isSprite&&Ht.setMode(4);if(de.isInstancedMesh)Ht.renderInstances(Rt,Ei,de.count);else if(ce.isInstancedBufferGeometry){const _t=ce._maxInstanceCount!==void 0?ce._maxInstanceCount:1/0,xo=Math.min(ce.instanceCount,_t);Ht.renderInstances(Rt,Ei,xo)}else Ht.render(Rt,Ei)},this.compile=function(U,ne){function ce($,de,Ze){$.transparent===!0&&$.side===nr&&$.forceSinglePass===!1?($.side=li,$.needsUpdate=!0,wa($,de,Ze),$.side=Ms,$.needsUpdate=!0,wa($,de,Ze),$.side=nr):wa($,de,Ze)}_=k.get(U),_.init(),S.push(_),U.traverseVisible(function($){$.isLight&&$.layers.test(ne.layers)&&(_.pushLight($),$.castShadow&&_.pushShadow($))}),_.setupLights(g.useLegacyLights),U.traverse(function($){const de=$.material;if(de)if(Array.isArray(de))for(let Ze=0;Ze<de.length;Ze++){const nt=de[Ze];ce(nt,U,$)}else ce(de,U,$)}),S.pop(),_=null};let xe=null;function Ie(U){xe&&xe(U)}function We(){Vt.stop()}function zt(){Vt.start()}const Vt=new z2;Vt.setAnimationLoop(Ie),typeof self<"u"&&Vt.setContext(self),this.setAnimationLoop=function(U){xe=U,Oe.setAnimationLoop(U),U===null?Vt.stop():Vt.start()},Oe.addEventListener("sessionstart",We),Oe.addEventListener("sessionend",zt),this.render=function(U,ne){if(ne!==void 0&&ne.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),ne.parent===null&&ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),Oe.enabled===!0&&Oe.isPresenting===!0&&(Oe.cameraAutoUpdate===!0&&Oe.updateCamera(ne),ne=Oe.getCamera()),U.isScene===!0&&U.onBeforeRender(g,U,ne,C),_=k.get(U,S.length),_.init(),S.push(_),K.multiplyMatrices(ne.projectionMatrix,ne.matrixWorldInverse),V.setFromProjectionMatrix(K),J=this.localClippingEnabled,B=ie.init(this.clippingPlanes,J),v=F.get(U,E.length),v.init(),E.push(v),Tn(U,ne,0,g.sortObjects),v.finish(),g.sortObjects===!0&&v.sort(W,ee),B===!0&&ie.beginShadows();const ce=_.state.shadowsArray;if(_e.render(ce,U,ne),B===!0&&ie.endShadows(),this.info.autoReset===!0&&this.info.reset(),Se.render(v,U),_.setupLights(g.useLegacyLights),ne.isArrayCamera){const $=ne.cameras;for(let de=0,Ze=$.length;de<Ze;de++){const nt=$[de];lr(v,U,nt,nt.viewport)}}else lr(v,U,ne);C!==null&&(ve.updateMultisampleRenderTarget(C),ve.updateRenderTargetMipmap(C)),U.isScene===!0&&U.onAfterRender(g,U,ne),Ve.resetDefaultState(),P=-1,R=null,S.pop(),S.length>0?_=S[S.length-1]:_=null,E.pop(),E.length>0?v=E[E.length-1]:v=null};function Tn(U,ne,ce,$){if(U.visible===!1)return;if(U.layers.test(ne.layers)){if(U.isGroup)ce=U.renderOrder;else if(U.isLOD)U.autoUpdate===!0&&U.update(ne);else if(U.isLight)_.pushLight(U),U.castShadow&&_.pushShadow(U);else if(U.isSprite){if(!U.frustumCulled||V.intersectsSprite(U)){$&&z.setFromMatrixPosition(U.matrixWorld).applyMatrix4(K);const nt=Ye.update(U),it=U.material;it.visible&&v.push(U,nt,it,ce,z.z,null)}}else if((U.isMesh||U.isLine||U.isPoints)&&(U.isSkinnedMesh&&U.skeleton.frame!==me.render.frame&&(U.skeleton.update(),U.skeleton.frame=me.render.frame),!U.frustumCulled||V.intersectsObject(U))){$&&z.setFromMatrixPosition(U.matrixWorld).applyMatrix4(K);const nt=Ye.update(U),it=U.material;if(Array.isArray(it)){const ut=nt.groups;for(let pt=0,mt=ut.length;pt<mt;pt++){const yt=ut[pt],Rt=it[yt.materialIndex];Rt&&Rt.visible&&v.push(U,nt,Rt,ce,z.z,yt)}}else it.visible&&v.push(U,nt,it,ce,z.z,null)}}const Ze=U.children;for(let nt=0,it=Ze.length;nt<it;nt++)Tn(Ze[nt],ne,ce,$)}function lr(U,ne,ce,$){const de=U.opaque,Ze=U.transmissive,nt=U.transparent;_.setupLightsView(ce),B===!0&&ie.setGlobalState(g.clippingPlanes,ce),Ze.length>0&&Yt(de,Ze,ne,ce),$&&De.viewport(I.copy($)),de.length>0&&ei(de,ne,ce),Ze.length>0&&ei(Ze,ne,ce),nt.length>0&&ei(nt,ne,ce),De.buffers.depth.setTest(!0),De.buffers.depth.setMask(!0),De.buffers.color.setMask(!0),De.setPolygonOffset(!1)}function Yt(U,ne,ce,$){if(Y===null){const it=Me.isWebGL2;Y=new ar(1024,1024,{generateMipmaps:!0,type:je.has("EXT_color_buffer_half_float")?ca:Es,minFilter:po,samples:it&&a===!0?4:0})}const de=g.getRenderTarget();g.setRenderTarget(Y),g.clear();const Ze=g.toneMapping;g.toneMapping=Ar,ei(U,ce,$),ve.updateMultisampleRenderTarget(Y),ve.updateRenderTargetMipmap(Y);let nt=!1;for(let it=0,ut=ne.length;it<ut;it++){const pt=ne[it],mt=pt.object,yt=pt.geometry,Rt=pt.material,Nn=pt.group;if(Rt.side===nr&&mt.layers.test($.layers)){const Ei=Rt.side;Rt.side=li,Rt.needsUpdate=!0,Hi(mt,ce,$,yt,Rt,Nn),Rt.side=Ei,Rt.needsUpdate=!0,nt=!0}}nt===!0&&(ve.updateMultisampleRenderTarget(Y),ve.updateRenderTargetMipmap(Y)),g.setRenderTarget(de),g.toneMapping=Ze}function ei(U,ne,ce){const $=ne.isScene===!0?ne.overrideMaterial:null;for(let de=0,Ze=U.length;de<Ze;de++){const nt=U[de],it=nt.object,ut=nt.geometry,pt=$===null?nt.material:$,mt=nt.group;it.layers.test(ce.layers)&&Hi(it,ne,ce,ut,pt,mt)}}function Hi(U,ne,ce,$,de,Ze){U.onBeforeRender(g,ne,ce,$,de,Ze),U.modelViewMatrix.multiplyMatrices(ce.matrixWorldInverse,U.matrixWorld),U.normalMatrix.getNormalMatrix(U.modelViewMatrix),de.onBeforeRender(g,ne,ce,$,U,Ze),de.transparent===!0&&de.side===nr&&de.forceSinglePass===!1?(de.side=li,de.needsUpdate=!0,g.renderBufferDirect(ce,ne,$,de,U,Ze),de.side=Ms,de.needsUpdate=!0,g.renderBufferDirect(ce,ne,$,de,U,Ze),de.side=nr):g.renderBufferDirect(ce,ne,$,de,U,Ze),U.onAfterRender(g,ne,ce,$,de,Ze)}function wa(U,ne,ce){ne.isScene!==!0&&(ne=ye);const $=se.get(U),de=_.state.lights,Ze=_.state.shadowsArray,nt=de.state.version,it=rt.getParameters(U,de.state,Ze,ne,ce),ut=rt.getProgramCacheKey(it);let pt=$.programs;$.environment=U.isMeshStandardMaterial?ne.environment:null,$.fog=ne.fog,$.envMap=(U.isMeshStandardMaterial?Ce:Ue).get(U.envMap||$.environment),pt===void 0&&(U.addEventListener("dispose",Jt),pt=new Map,$.programs=pt);let mt=pt.get(ut);if(mt!==void 0){if($.currentProgram===mt&&$.lightsStateVersion===nt)return pf(U,it),mt}else it.uniforms=rt.getUniforms(U),U.onBuild(ce,it,g),U.onBeforeCompile(it,g),mt=rt.acquireProgram(it,ut),pt.set(ut,mt),$.uniforms=it.uniforms;const yt=$.uniforms;(!U.isShaderMaterial&&!U.isRawShaderMaterial||U.clipping===!0)&&(yt.clippingPlanes=ie.uniform),pf(U,it),$.needsLights=Zp(U),$.lightsStateVersion=nt,$.needsLights&&(yt.ambientLightColor.value=de.state.ambient,yt.lightProbe.value=de.state.probe,yt.directionalLights.value=de.state.directional,yt.directionalLightShadows.value=de.state.directionalShadow,yt.spotLights.value=de.state.spot,yt.spotLightShadows.value=de.state.spotShadow,yt.rectAreaLights.value=de.state.rectArea,yt.ltc_1.value=de.state.rectAreaLTC1,yt.ltc_2.value=de.state.rectAreaLTC2,yt.pointLights.value=de.state.point,yt.pointLightShadows.value=de.state.pointShadow,yt.hemisphereLights.value=de.state.hemi,yt.directionalShadowMap.value=de.state.directionalShadowMap,yt.directionalShadowMatrix.value=de.state.directionalShadowMatrix,yt.spotShadowMap.value=de.state.spotShadowMap,yt.spotLightMatrix.value=de.state.spotLightMatrix,yt.spotLightMap.value=de.state.spotLightMap,yt.pointShadowMap.value=de.state.pointShadowMap,yt.pointShadowMatrix.value=de.state.pointShadowMatrix);const Rt=mt.getUniforms(),Nn=kd.seqWithValue(Rt.seq,yt);return $.currentProgram=mt,$.uniformsList=Nn,mt}function pf(U,ne){const ce=se.get(U);ce.outputEncoding=ne.outputEncoding,ce.instancing=ne.instancing,ce.skinning=ne.skinning,ce.morphTargets=ne.morphTargets,ce.morphNormals=ne.morphNormals,ce.morphColors=ne.morphColors,ce.morphTargetsCount=ne.morphTargetsCount,ce.numClippingPlanes=ne.numClippingPlanes,ce.numIntersection=ne.numClipIntersection,ce.vertexAlphas=ne.vertexAlphas,ce.vertexTangents=ne.vertexTangents,ce.toneMapping=ne.toneMapping}function mf(U,ne,ce,$,de){ne.isScene!==!0&&(ne=ye),ve.resetTextureUnits();const Ze=ne.fog,nt=$.isMeshStandardMaterial?ne.environment:null,it=C===null?g.outputEncoding:C.isXRRenderTarget===!0?C.texture.encoding:Ts,ut=($.isMeshStandardMaterial?Ce:Ue).get($.envMap||nt),pt=$.vertexColors===!0&&!!ce.attributes.color&&ce.attributes.color.itemSize===4,mt=!!$.normalMap&&!!ce.attributes.tangent,yt=!!ce.morphAttributes.position,Rt=!!ce.morphAttributes.normal,Nn=!!ce.morphAttributes.color,Ei=$.toneMapped?g.toneMapping:Ar,ur=ce.morphAttributes.position||ce.morphAttributes.normal||ce.morphAttributes.color,Ht=ur!==void 0?ur.length:0,_t=se.get($),xo=_.state.lights;if(B===!0&&(J===!0||U!==R)){const Ut=U===R&&$.id===P;ie.setState($,U,Ut)}let pn=!1;$.version===_t.__version?(_t.needsLights&&_t.lightsStateVersion!==xo.state.version||_t.outputEncoding!==it||de.isInstancedMesh&&_t.instancing===!1||!de.isInstancedMesh&&_t.instancing===!0||de.isSkinnedMesh&&_t.skinning===!1||!de.isSkinnedMesh&&_t.skinning===!0||_t.envMap!==ut||$.fog===!0&&_t.fog!==Ze||_t.numClippingPlanes!==void 0&&(_t.numClippingPlanes!==ie.numPlanes||_t.numIntersection!==ie.numIntersection)||_t.vertexAlphas!==pt||_t.vertexTangents!==mt||_t.morphTargets!==yt||_t.morphNormals!==Rt||_t.morphColors!==Nn||_t.toneMapping!==Ei||Me.isWebGL2===!0&&_t.morphTargetsCount!==Ht)&&(pn=!0):(pn=!0,_t.__version=$.version);let cr=_t.currentProgram;pn===!0&&(cr=wa($,ne,de));let Jr=!1,fi=!1,Dt=!1;const ct=cr.getUniforms(),Vn=_t.uniforms;if(De.useProgram(cr.program)&&(Jr=!0,fi=!0,Dt=!0),$.id!==P&&(P=$.id,fi=!0),Jr||R!==U){if(ct.setValue(Q,"projectionMatrix",U.projectionMatrix),Me.logarithmicDepthBuffer&&ct.setValue(Q,"logDepthBufFC",2/(Math.log(U.far+1)/Math.LN2)),R!==U&&(R=U,fi=!0,Dt=!0),$.isShaderMaterial||$.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshStandardMaterial||$.envMap){const Ut=ct.map.cameraPosition;Ut!==void 0&&Ut.setValue(Q,z.setFromMatrixPosition(U.matrixWorld))}($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial)&&ct.setValue(Q,"isOrthographic",U.isOrthographicCamera===!0),($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial||$.isShadowMaterial||de.isSkinnedMesh)&&ct.setValue(Q,"viewMatrix",U.matrixWorldInverse)}if(de.isSkinnedMesh){ct.setOptional(Q,de,"bindMatrix"),ct.setOptional(Q,de,"bindMatrixInverse");const Ut=de.skeleton;Ut&&(Me.floatVertexTextures?(Ut.boneTexture===null&&Ut.computeBoneTexture(),ct.setValue(Q,"boneTexture",Ut.boneTexture,ve),ct.setValue(Q,"boneTextureSize",Ut.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const mn=ce.morphAttributes;if((mn.position!==void 0||mn.normal!==void 0||mn.color!==void 0&&Me.isWebGL2===!0)&&be.update(de,ce,cr),(fi||_t.receiveShadow!==de.receiveShadow)&&(_t.receiveShadow=de.receiveShadow,ct.setValue(Q,"receiveShadow",de.receiveShadow)),$.isMeshGouraudMaterial&&$.envMap!==null&&(Vn.envMap.value=ut,Vn.flipEnvMap.value=ut.isCubeTexture&&ut.isRenderTargetTexture===!1?-1:1),fi&&(ct.setValue(Q,"toneMappingExposure",g.toneMappingExposure),_t.needsLights&&eu(Vn,Dt),Ze&&$.fog===!0&&Et.refreshFogUniforms(Vn,Ze),Et.refreshMaterialUniforms(Vn,$,G,q,Y),kd.upload(Q,_t.uniformsList,Vn,ve)),$.isShaderMaterial&&$.uniformsNeedUpdate===!0&&(kd.upload(Q,_t.uniformsList,Vn,ve),$.uniformsNeedUpdate=!1),$.isSpriteMaterial&&ct.setValue(Q,"center",de.center),ct.setValue(Q,"modelViewMatrix",de.modelViewMatrix),ct.setValue(Q,"normalMatrix",de.normalMatrix),ct.setValue(Q,"modelMatrix",de.matrixWorld),$.isShaderMaterial||$.isRawShaderMaterial){const Ut=$.uniformsGroups;for(let fr=0,Ls=Ut.length;fr<Ls;fr++)if(Me.isWebGL2){const kn=Ut[fr];qe.update(kn,cr),qe.bind(kn,cr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return cr}function eu(U,ne){U.ambientLightColor.needsUpdate=ne,U.lightProbe.needsUpdate=ne,U.directionalLights.needsUpdate=ne,U.directionalLightShadows.needsUpdate=ne,U.pointLights.needsUpdate=ne,U.pointLightShadows.needsUpdate=ne,U.spotLights.needsUpdate=ne,U.spotLightShadows.needsUpdate=ne,U.rectAreaLights.needsUpdate=ne,U.hemisphereLights.needsUpdate=ne}function Zp(U){return U.isMeshLambertMaterial||U.isMeshToonMaterial||U.isMeshPhongMaterial||U.isMeshStandardMaterial||U.isShadowMaterial||U.isShaderMaterial&&U.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(U,ne,ce){se.get(U.texture).__webglTexture=ne,se.get(U.depthTexture).__webglTexture=ce;const $=se.get(U);$.__hasExternalTextures=!0,$.__hasExternalTextures&&($.__autoAllocateDepthBuffer=ce===void 0,$.__autoAllocateDepthBuffer||je.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),$.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(U,ne){const ce=se.get(U);ce.__webglFramebuffer=ne,ce.__useDefaultFramebuffer=ne===void 0},this.setRenderTarget=function(U,ne=0,ce=0){C=U,w=ne,T=ce;let $=!0,de=null,Ze=!1,nt=!1;if(U){const ut=se.get(U);ut.__useDefaultFramebuffer!==void 0?(De.bindFramebuffer(36160,null),$=!1):ut.__webglFramebuffer===void 0?ve.setupRenderTarget(U):ut.__hasExternalTextures&&ve.rebindTextures(U,se.get(U.texture).__webglTexture,se.get(U.depthTexture).__webglTexture);const pt=U.texture;(pt.isData3DTexture||pt.isDataArrayTexture||pt.isCompressedArrayTexture)&&(nt=!0);const mt=se.get(U).__webglFramebuffer;U.isWebGLCubeRenderTarget?(de=mt[ne],Ze=!0):Me.isWebGL2&&U.samples>0&&ve.useMultisampledRTT(U)===!1?de=se.get(U).__webglMultisampledFramebuffer:de=mt,I.copy(U.viewport),b.copy(U.scissor),L=U.scissorTest}else I.copy(oe).multiplyScalar(G).floor(),b.copy(ue).multiplyScalar(G).floor(),L=D;if(De.bindFramebuffer(36160,de)&&Me.drawBuffers&&$&&De.drawBuffers(U,de),De.viewport(I),De.scissor(b),De.setScissorTest(L),Ze){const ut=se.get(U.texture);Q.framebufferTexture2D(36160,36064,34069+ne,ut.__webglTexture,ce)}else if(nt){const ut=se.get(U.texture),pt=ne||0;Q.framebufferTextureLayer(36160,36064,ut.__webglTexture,ce||0,pt)}P=-1},this.readRenderTargetPixels=function(U,ne,ce,$,de,Ze,nt){if(!(U&&U.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=se.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&nt!==void 0&&(it=it[nt]),it){De.bindFramebuffer(36160,it);try{const ut=U.texture,pt=ut.format,mt=ut.type;if(pt!==_i&&he.convert(pt)!==Q.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const yt=mt===ca&&(je.has("EXT_color_buffer_half_float")||Me.isWebGL2&&je.has("EXT_color_buffer_float"));if(mt!==Es&&he.convert(mt)!==Q.getParameter(35738)&&!(mt===Hr&&(Me.isWebGL2||je.has("OES_texture_float")||je.has("WEBGL_color_buffer_float")))&&!yt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ne>=0&&ne<=U.width-$&&ce>=0&&ce<=U.height-de&&Q.readPixels(ne,ce,$,de,he.convert(pt),he.convert(mt),Ze)}finally{const ut=C!==null?se.get(C).__webglFramebuffer:null;De.bindFramebuffer(36160,ut)}}},this.copyFramebufferToTexture=function(U,ne,ce=0){const $=Math.pow(2,-ce),de=Math.floor(ne.image.width*$),Ze=Math.floor(ne.image.height*$);ve.setTexture2D(ne,0),Q.copyTexSubImage2D(3553,ce,0,0,U.x,U.y,de,Ze),De.unbindTexture()},this.copyTextureToTexture=function(U,ne,ce,$=0){const de=ne.image.width,Ze=ne.image.height,nt=he.convert(ce.format),it=he.convert(ce.type);ve.setTexture2D(ce,0),Q.pixelStorei(37440,ce.flipY),Q.pixelStorei(37441,ce.premultiplyAlpha),Q.pixelStorei(3317,ce.unpackAlignment),ne.isDataTexture?Q.texSubImage2D(3553,$,U.x,U.y,de,Ze,nt,it,ne.image.data):ne.isCompressedTexture?Q.compressedTexSubImage2D(3553,$,U.x,U.y,ne.mipmaps[0].width,ne.mipmaps[0].height,nt,ne.mipmaps[0].data):Q.texSubImage2D(3553,$,U.x,U.y,nt,it,ne.image),$===0&&ce.generateMipmaps&&Q.generateMipmap(3553),De.unbindTexture()},this.copyTextureToTexture3D=function(U,ne,ce,$,de=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ze=U.max.x-U.min.x+1,nt=U.max.y-U.min.y+1,it=U.max.z-U.min.z+1,ut=he.convert($.format),pt=he.convert($.type);let mt;if($.isData3DTexture)ve.setTexture3D($,0),mt=32879;else if($.isDataArrayTexture)ve.setTexture2DArray($,0),mt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(37440,$.flipY),Q.pixelStorei(37441,$.premultiplyAlpha),Q.pixelStorei(3317,$.unpackAlignment);const yt=Q.getParameter(3314),Rt=Q.getParameter(32878),Nn=Q.getParameter(3316),Ei=Q.getParameter(3315),ur=Q.getParameter(32877),Ht=ce.isCompressedTexture?ce.mipmaps[0]:ce.image;Q.pixelStorei(3314,Ht.width),Q.pixelStorei(32878,Ht.height),Q.pixelStorei(3316,U.min.x),Q.pixelStorei(3315,U.min.y),Q.pixelStorei(32877,U.min.z),ce.isDataTexture||ce.isData3DTexture?Q.texSubImage3D(mt,de,ne.x,ne.y,ne.z,Ze,nt,it,ut,pt,Ht.data):ce.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Q.compressedTexSubImage3D(mt,de,ne.x,ne.y,ne.z,Ze,nt,it,ut,Ht.data)):Q.texSubImage3D(mt,de,ne.x,ne.y,ne.z,Ze,nt,it,ut,pt,Ht),Q.pixelStorei(3314,yt),Q.pixelStorei(32878,Rt),Q.pixelStorei(3316,Nn),Q.pixelStorei(3315,Ei),Q.pixelStorei(32877,ur),de===0&&$.generateMipmaps&&Q.generateMipmap(mt),De.unbindTexture()},this.initTexture=function(U){U.isCubeTexture?ve.setTextureCube(U,0):U.isData3DTexture?ve.setTexture3D(U,0):U.isDataArrayTexture||U.isCompressedArrayTexture?ve.setTexture2DArray(U,0):ve.setTexture2D(U,0),De.unbindTexture()},this.resetState=function(){w=0,T=0,C=null,De.reset(),Ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}class G2 extends o_{}G2.prototype.isWebGL1Renderer=!0;class Np{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Re(e),this.density=t}clone(){return new Np(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class kp{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Re(e),this.near=t,this.far=i}clone(){return new kp(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class up extends St{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.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,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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class zp{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ic,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Ui()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];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=Ui()),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]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=Ui()),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 ii=new N;class ha{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}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,i=this.data.count;t<i;t++)ii.fromBufferAttribute(this,t),ii.applyMatrix4(e),this.setXYZ(t,ii.x,ii.y,ii.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ii.fromBufferAttribute(this,t),ii.applyNormalMatrix(e),this.setXYZ(t,ii.x,ii.y,ii.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ii.fromBufferAttribute(this,t),ii.transformDirection(e),this.setXYZ(t,ii.x,ii.y,ii.z);return this}setX(e,t){return this.normalized&&(t=dt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=dt(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=ki(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ki(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ki(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ki(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array),r=dt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=dt(t,this.array),i=dt(i,this.array),r=dt(r,this.array),s=dt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Bt(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 ha(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}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 a_ extends Bn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Re(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 Ka;const Iu=new N,$a=new N,el=new N,tl=new ge,Du=new ge,W2=new st,Yh=new N,Nu=new N,qh=new N,hw=new ge,Yg=new ge,dw=new ge;class X2 extends St{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",Ka===void 0){Ka=new lt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new zp(t,5);Ka.setIndex([0,1,2,0,2,3]),Ka.setAttribute("position",new ha(i,3,0,!1)),Ka.setAttribute("uv",new ha(i,2,3,!1))}this.geometry=Ka,this.material=e!==void 0?e:new a_,this.center=new ge(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),$a.setFromMatrixScale(this.matrixWorld),W2.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),el.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&$a.multiplyScalar(-el.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Zh(Yh.set(-.5,-.5,0),el,o,$a,r,s),Zh(Nu.set(.5,-.5,0),el,o,$a,r,s),Zh(qh.set(.5,.5,0),el,o,$a,r,s),hw.set(0,0),Yg.set(1,0),dw.set(1,1);let a=e.ray.intersectTriangle(Yh,Nu,qh,!1,Iu);if(a===null&&(Zh(Nu.set(-.5,.5,0),el,o,$a,r,s),Yg.set(0,1),a=e.ray.intersectTriangle(Yh,qh,Nu,!1,Iu),a===null))return;const c=e.ray.origin.distanceTo(Iu);c<e.near||c>e.far||t.push({distance:c,point:Iu.clone(),uv:yi.getInterpolation(Iu,Yh,Nu,qh,hw,Yg,dw,new ge),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 Zh(n,e,t,i,r,s){tl.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Du.x=s*tl.x-r*tl.y,Du.y=r*tl.x+s*tl.y):Du.copy(tl),n.copy(e),n.x+=Du.x,n.y+=Du.y,n.applyMatrix4(W2)}const Qh=new N,pw=new N;class j2 extends St{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Qh.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Qh);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Qh.setFromMatrixPosition(e.matrixWorld),pw.setFromMatrixPosition(this.matrixWorld);const i=Qh.distanceTo(pw)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const mw=new N,gw=new Nt,vw=new Nt,Sk=new N,yw=new st,nl=new N;class Y2 extends Ne{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new st,this.bindMatrixInverse=new st,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Yr),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)nl.fromBufferAttribute(t,i),this.applyBoneTransform(i,nl),this.boundingBox.expandByPoint(nl)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new qr),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)nl.fromBufferAttribute(t,i),this.applyBoneTransform(i,nl),this.boundingSphere.expandByPoint(nl)}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,this}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 Nt,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;gw.fromBufferAttribute(r.attributes.skinIndex,e),vw.fromBufferAttribute(r.attributes.skinWeight,e),mw.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=vw.getComponent(s);if(o!==0){const a=gw.getComponent(s);yw.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(Sk.copy(mw).applyMatrix4(yw),o)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class l_ extends St{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ll extends un{constructor(e=null,t=1,i=1,r,s,o,a,c,f=hn,h=hn,d,m){super(null,o,a,c,f,h,r,s,d,m),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _w=new st,wk=new st;class Up{constructor(e=[],t=[]){this.uuid=Ui(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,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){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new st)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new st;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:wk;_w.multiplyMatrices(a,t[s]),_w.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Up(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=b2(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new Ll(t,e,e,_i,Hr);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new l_),this.bones.push(o),this.boneInverses.push(new st().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Vl extends Bt{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 il=new st,xw=new st,Jh=[],Sw=new Yr,Mk=new st,ku=new Ne,zu=new qr;class q2 extends Ne{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Vl(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,Mk)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Yr),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,il),Sw.copy(e.boundingBox).applyMatrix4(il),this.boundingBox.union(Sw)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new qr),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,il),zu.copy(e.boundingSphere).applyMatrix4(il),this.boundingSphere.union(zu)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const i=this.matrixWorld,r=this.count;if(ku.geometry=this.geometry,ku.material=this.material,ku.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),zu.copy(this.boundingSphere),zu.applyMatrix4(i),e.ray.intersectsSphere(zu)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,il),xw.multiplyMatrices(i,il),ku.matrixWorld=xw,ku.raycast(e,Jh);for(let o=0,a=Jh.length;o<a;o++){const c=Jh[o];c.instanceId=s,c.object=this,t.push(c)}Jh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Vl(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class $n extends Bn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Re(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 ww=new N,Mw=new N,Ew=new st,qg=new Qc,Kh=new qr;class vt extends St{constructor(e=new lt,t=new $n){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)ww.fromBufferAttribute(t,r-1),Mw.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=ww.distanceTo(Mw);e.setAttribute("lineDistance",new Be(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Kh.copy(i.boundingSphere),Kh.applyMatrix4(r),Kh.radius+=s,e.ray.intersectsSphere(Kh)===!1)return;Ew.copy(r).invert(),qg.copy(e.ray).applyMatrix4(Ew);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,f=new N,h=new N,d=new N,m=new N,v=this.isLineSegments?2:1,_=i.index,S=i.attributes.position;if(_!==null){const g=Math.max(0,o.start),x=Math.min(_.count,o.start+o.count);for(let w=g,T=x-1;w<T;w+=v){const C=_.getX(w),P=_.getX(w+1);if(f.fromBufferAttribute(S,C),h.fromBufferAttribute(S,P),qg.distanceSqToSegment(f,h,m,d)>c)continue;m.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(m);I<e.near||I>e.far||t.push({distance:I,point:d.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),x=Math.min(S.count,o.start+o.count);for(let w=g,T=x-1;w<T;w+=v){if(f.fromBufferAttribute(S,w),h.fromBufferAttribute(S,w+1),qg.distanceSqToSegment(f,h,m,d)>c)continue;m.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(m);P<e.near||P>e.far||t.push({distance:P,point:d.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const Tw=new N,Aw=new N;class Qr extends vt{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,i=[];for(let r=0,s=t.count;r<s;r+=2)Tw.fromBufferAttribute(t,r),Aw.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+Tw.distanceTo(Aw);e.setAttribute("lineDistance",new Be(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Z2 extends vt{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class u_ extends Bn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Re(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 Cw=new st,Fv=new Qc,$h=new qr,ed=new N;class Q2 extends St{constructor(e=new lt,t=new u_){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),$h.copy(i.boundingSphere),$h.applyMatrix4(r),$h.radius+=s,e.ray.intersectsSphere($h)===!1)return;Cw.copy(r).invert(),Fv.copy(e.ray).applyMatrix4(Cw);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,f=i.index,d=i.attributes.position;if(f!==null){const m=Math.max(0,o.start),v=Math.min(f.count,o.start+o.count);for(let _=m,E=v;_<E;_++){const S=f.getX(_);ed.fromBufferAttribute(d,S),bw(ed,S,c,r,e,t,this)}}else{const m=Math.max(0,o.start),v=Math.min(d.count,o.start+o.count);for(let _=m,E=v;_<E;_++)ed.fromBufferAttribute(d,_),bw(ed,_,c,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function bw(n,e,t,i,r,s,o){const a=Fv.distanceSqToPoint(n);if(a<t){const c=new N;Fv.closestPointToPoint(n,c),c.applyMatrix4(i);const f=r.ray.origin.distanceTo(c);if(f<r.near||f>r.far)return;s.push({distance:f,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}class Ek extends un{constructor(e,t,i,r,s,o,a,c,f){super(e,t,i,r,s,o,a,c,f),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:en,this.magFilter=s!==void 0?s:en,this.generateMipmaps=!1;const h=this;function d(){h.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class Tk extends un{constructor(e,t,i){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=i,this.magFilter=hn,this.minFilter=hn,this.generateMipmaps=!1,this.needsUpdate=!0}}class c_ extends un{constructor(e,t,i,r,s,o,a,c,f,h,d,m){super(null,o,a,c,f,h,r,s,d,m),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Ak extends c_{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Jn}}class Ck extends un{constructor(e,t,i,r,s,o,a,c,f){super(e,t,i,r,s,o,a,c,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class br{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,c=s-1,f;for(;a<=c;)if(r=Math.floor(a+(c-a)/2),f=i[r]-o,f<0)a=r+1;else if(f>0)c=r-1;else{c=r;break}if(r=c,i[r]===o)return r/(s-1);const h=i[r],m=i[r+1]-h,v=(o-h)/m;return(r+v)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),c=t||(o.isVector2?new ge:new N);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new N,r=[],s=[],o=[],a=new N,c=new st;for(let v=0;v<=e;v++){const _=v/e;r[v]=this.getTangentAt(_,new N)}s[0]=new N,o[0]=new N;let f=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),m=Math.abs(r[0].z);h<=f&&(f=h,i.set(1,0,0)),d<=f&&(f=d,i.set(0,1,0)),m<=f&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let v=1;v<=e;v++){if(s[v]=s[v-1].clone(),o[v]=o[v-1].clone(),a.crossVectors(r[v-1],r[v]),a.length()>Number.EPSILON){a.normalize();const _=Math.acos(ln(r[v-1].dot(r[v]),-1,1));s[v].applyMatrix4(c.makeRotationAxis(a,_))}o[v].crossVectors(r[v],s[v])}if(t===!0){let v=Math.acos(ln(s[0].dot(s[e]),-1,1));v/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(v=-v);for(let _=1;_<=e;_++)s[_].applyMatrix4(c.makeRotationAxis(r[_],v*_)),o[_].crossVectors(r[_],s[_])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Op extends br{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t){const i=t||new ge,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let c=this.aX+this.xRadius*Math.cos(a),f=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),m=c-this.aX,v=f-this.aY;c=m*h-v*d+this.aX,f=m*d+v*h+this.aY}return i.set(c,f)}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 J2 extends Op{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function f_(){let n=0,e=0,t=0,i=0;function r(s,o,a,c){n=s,e=a,t=-3*s+3*o-2*a-c,i=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,f){r(o,a,f*(a-s),f*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,f,h,d){let m=(o-s)/f-(a-s)/(f+h)+(a-o)/h,v=(a-o)/h-(c-o)/(h+d)+(c-a)/d;m*=h,v*=h,r(o,a,m,v)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const td=new N,Zg=new f_,Qg=new f_,Jg=new f_;class K2 extends br{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new N){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let f,h;this.closed||a>0?f=r[(a-1)%s]:(td.subVectors(r[0],r[1]).add(r[0]),f=td);const d=r[a%s],m=r[(a+1)%s];if(this.closed||a+2<s?h=r[(a+2)%s]:(td.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=td),this.curveType==="centripetal"||this.curveType==="chordal"){const v=this.curveType==="chordal"?.5:.25;let _=Math.pow(f.distanceToSquared(d),v),E=Math.pow(d.distanceToSquared(m),v),S=Math.pow(m.distanceToSquared(h),v);E<1e-4&&(E=1),_<1e-4&&(_=E),S<1e-4&&(S=E),Zg.initNonuniformCatmullRom(f.x,d.x,m.x,h.x,_,E,S),Qg.initNonuniformCatmullRom(f.y,d.y,m.y,h.y,_,E,S),Jg.initNonuniformCatmullRom(f.z,d.z,m.z,h.z,_,E,S)}else this.curveType==="catmullrom"&&(Zg.initCatmullRom(f.x,d.x,m.x,h.x,this.tension),Qg.initCatmullRom(f.y,d.y,m.y,h.y,this.tension),Jg.initCatmullRom(f.z,d.z,m.z,h.z,this.tension));return i.set(Zg.calc(c),Qg.calc(c),Jg.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new N().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Pw(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,c=n*a;return(2*t-2*i+s+o)*c+(-3*t+3*i-2*s-o)*a+s*n+t}function bk(n,e){const t=1-n;return t*t*e}function Pk(n,e){return 2*(1-n)*n*e}function Lk(n,e){return n*n*e}function oc(n,e,t,i){return bk(n,e)+Pk(n,t)+Lk(n,i)}function Rk(n,e){const t=1-n;return t*t*t*e}function Ik(n,e){const t=1-n;return 3*t*t*n*e}function Dk(n,e){return 3*(1-n)*n*n*e}function Nk(n,e){return n*n*n*e}function ac(n,e,t,i,r){return Rk(n,e)+Ik(n,t)+Dk(n,i)+Nk(n,r)}class h_ extends br{constructor(e=new ge,t=new ge,i=new ge,r=new ge){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new ge){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(ac(e,r.x,s.x,o.x,a.x),ac(e,r.y,s.y,o.y,a.y)),i}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 $2 extends br{constructor(e=new N,t=new N,i=new N,r=new N){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new N){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(ac(e,r.x,s.x,o.x,a.x),ac(e,r.y,s.y,o.y,a.y),ac(e,r.z,s.z,o.z,a.z)),i}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 Fp extends br{constructor(e=new ge,t=new ge){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ge){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ge){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 e3 extends br{constructor(e=new N,t=new N){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new N){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new N){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 d_ extends br{constructor(e=new ge,t=new ge,i=new ge){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new ge){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(oc(e,r.x,s.x,o.x),oc(e,r.y,s.y,o.y)),i}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 p_ extends br{constructor(e=new N,t=new N,i=new N){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new N){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(oc(e,r.x,s.x,o.x),oc(e,r.y,s.y,o.y),oc(e,r.z,s.z,o.z)),i}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 m_ extends br{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ge){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,c=r[o===0?o:o-1],f=r[o],h=r[o>r.length-2?r.length-1:o+1],d=r[o>r.length-3?r.length-1:o+2];return i.set(Pw(a,c.x,f.x,h.x,d.x),Pw(a,c.y,f.y,h.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new ge().fromArray(r))}return this}}var g_=Object.freeze({__proto__:null,ArcCurve:J2,CatmullRomCurve3:K2,CubicBezierCurve:h_,CubicBezierCurve3:$2,EllipseCurve:Op,LineCurve:Fp,LineCurve3:e3,QuadraticBezierCurve:d_,QuadraticBezierCurve3:p_,SplineCurve:m_});class t3 extends br{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);e.equals(t)||this.curves.push(new Fp(t,e))}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],c=a.getLength(),f=c===0?0:1-o/c;return a.getPointAt(f,t)}s++}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 i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let f=0;f<c.length;f++){const h=c[f];i&&i.equals(h)||(t.push(h),i=h)}}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,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new g_[r.type]().fromJSON(r))}return this}}class Nc extends t3{constructor(e){super(),this.type="Path",this.currentPoint=new ge,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;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 i=new Fp(this.currentPoint.clone(),new ge(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new d_(this.currentPoint.clone(),new ge(e,t),new ge(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new h_(this.currentPoint.clone(),new ge(e,t),new ge(i,r),new ge(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new m_(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,c){const f=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+f,t+h,i,r,s,o,a,c),this}absellipse(e,t,i,r,s,o,a,c){const f=new Op(e,t,i,r,s,o,a,c);if(this.curves.length>0){const d=f.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(f);const h=f.getPoint(1);return this.currentPoint.copy(h),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 Zl extends lt{constructor(e=[new ge(0,-.5),new ge(.5,0),new ge(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=ln(r,0,Math.PI*2);const s=[],o=[],a=[],c=[],f=[],h=1/t,d=new N,m=new ge,v=new N,_=new N,E=new N;let S=0,g=0;for(let x=0;x<=e.length-1;x++)switch(x){case 0:S=e[x+1].x-e[x].x,g=e[x+1].y-e[x].y,v.x=g*1,v.y=-S,v.z=g*0,E.copy(v),v.normalize(),c.push(v.x,v.y,v.z);break;case e.length-1:c.push(E.x,E.y,E.z);break;default:S=e[x+1].x-e[x].x,g=e[x+1].y-e[x].y,v.x=g*1,v.y=-S,v.z=g*0,_.copy(v),v.x+=E.x,v.y+=E.y,v.z+=E.z,v.normalize(),c.push(v.x,v.y,v.z),E.copy(_)}for(let x=0;x<=t;x++){const w=i+x*h*r,T=Math.sin(w),C=Math.cos(w);for(let P=0;P<=e.length-1;P++){d.x=e[P].x*T,d.y=e[P].y,d.z=e[P].x*C,o.push(d.x,d.y,d.z),m.x=x/t,m.y=P/(e.length-1),a.push(m.x,m.y);const R=c[3*P+0]*T,I=c[3*P+1],b=c[3*P+0]*C;f.push(R,I,b)}}for(let x=0;x<t;x++)for(let w=0;w<e.length-1;w++){const T=w+x*e.length,C=T,P=T+e.length,R=T+e.length+1,I=T+1;s.push(C,P,I),s.push(R,I,P)}this.setIndex(s),this.setAttribute("position",new Be(o,3)),this.setAttribute("uv",new Be(a,2)),this.setAttribute("normal",new Be(f,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zl(e.points,e.segments,e.phiStart,e.phiLength)}}class ef extends Zl{constructor(e=1,t=1,i=4,r=8){const s=new Nc;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new ef(e.radius,e.length,e.capSegments,e.radialSegments)}}class tf extends lt{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],c=[],f=new N,h=new ge;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let d=0,m=3;d<=t;d++,m+=3){const v=i+d/t*r;f.x=e*Math.cos(v),f.y=e*Math.sin(v),o.push(f.x,f.y,f.z),a.push(0,0,1),h.x=(o[m]/e+1)/2,h.y=(o[m+1]/e+1)/2,c.push(h.x,h.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new Be(o,3)),this.setAttribute("normal",new Be(a,3)),this.setAttribute("uv",new Be(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tf(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ln extends lt{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:c};const f=this;r=Math.floor(r),s=Math.floor(s);const h=[],d=[],m=[],v=[];let _=0;const E=[],S=i/2;let g=0;x(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(h),this.setAttribute("position",new Be(d,3)),this.setAttribute("normal",new Be(m,3)),this.setAttribute("uv",new Be(v,2));function x(){const T=new N,C=new N;let P=0;const R=(t-e)/i;for(let I=0;I<=s;I++){const b=[],L=I/s,H=L*(t-e)+e;for(let q=0;q<=r;q++){const G=q/r,W=G*c+a,ee=Math.sin(W),oe=Math.cos(W);C.x=H*ee,C.y=-L*i+S,C.z=H*oe,d.push(C.x,C.y,C.z),T.set(ee,R,oe).normalize(),m.push(T.x,T.y,T.z),v.push(G,1-L),b.push(_++)}E.push(b)}for(let I=0;I<r;I++)for(let b=0;b<s;b++){const L=E[b][I],H=E[b+1][I],q=E[b+1][I+1],G=E[b][I+1];h.push(L,H,G),h.push(H,q,G),P+=6}f.addGroup(g,P,0),g+=P}function w(T){const C=_,P=new ge,R=new N;let I=0;const b=T===!0?e:t,L=T===!0?1:-1;for(let q=1;q<=r;q++)d.push(0,S*L,0),m.push(0,L,0),v.push(.5,.5),_++;const H=_;for(let q=0;q<=r;q++){const W=q/r*c+a,ee=Math.cos(W),oe=Math.sin(W);R.x=b*oe,R.y=S*L,R.z=b*ee,d.push(R.x,R.y,R.z),m.push(0,L,0),P.x=ee*.5+.5,P.y=oe*.5*L+.5,v.push(P.x,P.y),_++}for(let q=0;q<r;q++){const G=C+q,W=H+q;T===!0?h.push(W,W+1,G):h.push(W+1,W,G),I+=3}f.addGroup(g,I,T===!0?1:2),g+=I}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ln(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class nf extends Ln{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new nf(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ps extends lt{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),f(i),h(),this.setAttribute("position",new Be(s,3)),this.setAttribute("normal",new Be(s.slice(),3)),this.setAttribute("uv",new Be(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(x){const w=new N,T=new N,C=new N;for(let P=0;P<t.length;P+=3)v(t[P+0],w),v(t[P+1],T),v(t[P+2],C),c(w,T,C,x)}function c(x,w,T,C){const P=C+1,R=[];for(let I=0;I<=P;I++){R[I]=[];const b=x.clone().lerp(T,I/P),L=w.clone().lerp(T,I/P),H=P-I;for(let q=0;q<=H;q++)q===0&&I===P?R[I][q]=b:R[I][q]=b.clone().lerp(L,q/H)}for(let I=0;I<P;I++)for(let b=0;b<2*(P-I)-1;b++){const L=Math.floor(b/2);b%2===0?(m(R[I][L+1]),m(R[I+1][L]),m(R[I][L])):(m(R[I][L+1]),m(R[I+1][L+1]),m(R[I+1][L]))}}function f(x){const w=new N;for(let T=0;T<s.length;T+=3)w.x=s[T+0],w.y=s[T+1],w.z=s[T+2],w.normalize().multiplyScalar(x),s[T+0]=w.x,s[T+1]=w.y,s[T+2]=w.z}function h(){const x=new N;for(let w=0;w<s.length;w+=3){x.x=s[w+0],x.y=s[w+1],x.z=s[w+2];const T=S(x)/2/Math.PI+.5,C=g(x)/Math.PI+.5;o.push(T,1-C)}_(),d()}function d(){for(let x=0;x<o.length;x+=6){const w=o[x+0],T=o[x+2],C=o[x+4],P=Math.max(w,T,C),R=Math.min(w,T,C);P>.9&&R<.1&&(w<.2&&(o[x+0]+=1),T<.2&&(o[x+2]+=1),C<.2&&(o[x+4]+=1))}}function m(x){s.push(x.x,x.y,x.z)}function v(x,w){const T=x*3;w.x=e[T+0],w.y=e[T+1],w.z=e[T+2]}function _(){const x=new N,w=new N,T=new N,C=new N,P=new ge,R=new ge,I=new ge;for(let b=0,L=0;b<s.length;b+=9,L+=6){x.set(s[b+0],s[b+1],s[b+2]),w.set(s[b+3],s[b+4],s[b+5]),T.set(s[b+6],s[b+7],s[b+8]),P.set(o[L+0],o[L+1]),R.set(o[L+2],o[L+3]),I.set(o[L+4],o[L+5]),C.copy(x).add(w).add(T).divideScalar(3);const H=S(C);E(P,L+0,x,H),E(R,L+2,w,H),E(I,L+4,T,H)}}function E(x,w,T,C){C<0&&x.x===1&&(o[w]=x.x-1),T.x===0&&T.z===0&&(o[w]=C/2/Math.PI+.5)}function S(x){return Math.atan2(x.z,-x.x)}function g(x){return Math.atan2(-x.y,Math.sqrt(x.x*x.x+x.z*x.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ps(e.vertices,e.indices,e.radius,e.details)}}class rf extends Ps{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[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(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rf(e.radius,e.detail)}}const nd=new N,id=new N,Kg=new N,rd=new yi;class n3 extends lt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(na*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,f=[0,0,0],h=["a","b","c"],d=new Array(3),m={},v=[];for(let _=0;_<c;_+=3){o?(f[0]=o.getX(_),f[1]=o.getX(_+1),f[2]=o.getX(_+2)):(f[0]=_,f[1]=_+1,f[2]=_+2);const{a:E,b:S,c:g}=rd;if(E.fromBufferAttribute(a,f[0]),S.fromBufferAttribute(a,f[1]),g.fromBufferAttribute(a,f[2]),rd.getNormal(Kg),d[0]=`${Math.round(E.x*r)},${Math.round(E.y*r)},${Math.round(E.z*r)}`,d[1]=`${Math.round(S.x*r)},${Math.round(S.y*r)},${Math.round(S.z*r)}`,d[2]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let x=0;x<3;x++){const w=(x+1)%3,T=d[x],C=d[w],P=rd[h[x]],R=rd[h[w]],I=`${T}_${C}`,b=`${C}_${T}`;b in m&&m[b]?(Kg.dot(m[b].normal)<=s&&(v.push(P.x,P.y,P.z),v.push(R.x,R.y,R.z)),m[b]=null):I in m||(m[I]={index0:f[x],index1:f[w],normal:Kg.clone()})}}for(const _ in m)if(m[_]){const{index0:E,index1:S}=m[_];nd.fromBufferAttribute(a,E),id.fromBufferAttribute(a,S),v.push(nd.x,nd.y,nd.z),v.push(id.x,id.y,id.z)}this.setAttribute("position",new Be(v,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class ra extends Nc{constructor(e){super(e),this.uuid=Ui(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new Nc().fromJSON(r))}return this}}const kk={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=i3(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,c,f,h,d,m,v;if(i&&(s=Bk(n,e,s,t)),n.length>80*t){a=f=n[0],c=h=n[1];for(let _=t;_<r;_+=t)d=n[_],m=n[_+1],d<a&&(a=d),m<c&&(c=m),d>f&&(f=d),m>h&&(h=m);v=Math.max(f-a,h-c),v=v!==0?32767/v:0}return kc(s,o,t,a,c,v,0),o}};function i3(n,e,t,i,r){let s,o;if(r===Jk(n,e,t,i)>0)for(s=e;s<t;s+=i)o=Lw(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=Lw(s,n[s],n[s+1],o);return o&&Bp(o,o.next)&&(Uc(o),o=o.next),o}function da(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Bp(t,t.next)||tn(t.prev,t,t.next)===0)){if(Uc(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function kc(n,e,t,i,r,s,o){if(!n)return;!o&&s&&Xk(n,i,r,s);let a=n,c,f;for(;n.prev!==n.next;){if(c=n.prev,f=n.next,s?Uk(n,i,r,s):zk(n)){e.push(c.i/t|0),e.push(n.i/t|0),e.push(f.i/t|0),Uc(n),n=f.next,a=f.next;continue}if(n=f,n===a){o?o===1?(n=Ok(da(n),e,t),kc(n,e,t,i,r,s,2)):o===2&&Fk(n,e,t,i,r,s):kc(da(n),e,t,i,r,s,1);break}}}function zk(n){const e=n.prev,t=n,i=n.next;if(tn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,c=t.y,f=i.y,h=r<s?r<o?r:o:s<o?s:o,d=a<c?a<f?a:f:c<f?c:f,m=r>s?r>o?r:o:s>o?s:o,v=a>c?a>f?a:f:c>f?c:f;let _=i.next;for(;_!==e;){if(_.x>=h&&_.x<=m&&_.y>=d&&_.y<=v&&wl(r,a,s,c,o,f,_.x,_.y)&&tn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function Uk(n,e,t,i){const r=n.prev,s=n,o=n.next;if(tn(r,s,o)>=0)return!1;const a=r.x,c=s.x,f=o.x,h=r.y,d=s.y,m=o.y,v=a<c?a<f?a:f:c<f?c:f,_=h<d?h<m?h:m:d<m?d:m,E=a>c?a>f?a:f:c>f?c:f,S=h>d?h>m?h:m:d>m?d:m,g=Bv(v,_,e,t,i),x=Bv(E,S,e,t,i);let w=n.prevZ,T=n.nextZ;for(;w&&w.z>=g&&T&&T.z<=x;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=S&&w!==r&&w!==o&&wl(a,h,c,d,f,m,w.x,w.y)&&tn(w.prev,w,w.next)>=0||(w=w.prevZ,T.x>=v&&T.x<=E&&T.y>=_&&T.y<=S&&T!==r&&T!==o&&wl(a,h,c,d,f,m,T.x,T.y)&&tn(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;w&&w.z>=g;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=S&&w!==r&&w!==o&&wl(a,h,c,d,f,m,w.x,w.y)&&tn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;T&&T.z<=x;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=S&&T!==r&&T!==o&&wl(a,h,c,d,f,m,T.x,T.y)&&tn(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function Ok(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Bp(r,s)&&r3(r,i,i.next,s)&&zc(r,s)&&zc(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Uc(i),Uc(i.next),i=n=s),i=i.next}while(i!==n);return da(i)}function Fk(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&qk(o,a)){let c=s3(o,a);o=da(o,o.next),c=da(c,c.next),kc(o,e,t,i,r,s,0),kc(c,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function Bk(n,e,t,i){const r=[];let s,o,a,c,f;for(s=0,o=e.length;s<o;s++)a=e[s]*i,c=s<o-1?e[s+1]*i:n.length,f=i3(n,a,c,i,!1),f===f.next&&(f.steiner=!0),r.push(Yk(f));for(r.sort(Vk),s=0;s<r.length;s++)t=Hk(r[s],t);return t}function Vk(n,e){return n.x-e.x}function Hk(n,e){const t=Gk(n,e);if(!t)return e;const i=s3(t,n);return da(i,i.next),da(t,t.next)}function Gk(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const m=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(m<=s&&m>i&&(i=m,r=t.x<t.next.x?t:t.next,m===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,c=r.x,f=r.y;let h=1/0,d;t=r;do s>=t.x&&t.x>=c&&s!==t.x&&wl(o<f?s:i,o,c,f,o<f?i:s,o,t.x,t.y)&&(d=Math.abs(o-t.y)/(s-t.x),zc(t,n)&&(d<h||d===h&&(t.x>r.x||t.x===r.x&&Wk(r,t)))&&(r=t,h=d)),t=t.next;while(t!==a);return r}function Wk(n,e){return tn(n.prev,n,e.prev)<0&&tn(e.next,n,n.next)<0}function Xk(n,e,t,i){let r=n;do r.z===0&&(r.z=Bv(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,jk(r)}function jk(n){let e,t,i,r,s,o,a,c,f=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<f&&(a++,i=i.nextZ,!!i);e++);for(c=f;a>0||c>0&&i;)a!==0&&(c===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,f*=2}while(o>1);return n}function Bv(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function Yk(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function wl(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function qk(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!Zk(n,e)&&(zc(n,e)&&zc(e,n)&&Qk(n,e)&&(tn(n.prev,n,e.prev)||tn(n,e.prev,e))||Bp(n,e)&&tn(n.prev,n,n.next)>0&&tn(e.prev,e,e.next)>0)}function tn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Bp(n,e){return n.x===e.x&&n.y===e.y}function r3(n,e,t,i){const r=od(tn(n,e,t)),s=od(tn(n,e,i)),o=od(tn(t,i,n)),a=od(tn(t,i,e));return!!(r!==s&&o!==a||r===0&&sd(n,t,e)||s===0&&sd(n,i,e)||o===0&&sd(t,n,i)||a===0&&sd(t,e,i))}function sd(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function od(n){return n>0?1:n<0?-1:0}function Zk(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&r3(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function zc(n,e){return tn(n.prev,n,n.next)<0?tn(n,e,n.next)>=0&&tn(n,n.prev,e)>=0:tn(n,e,n.prev)<0||tn(n,n.next,e)<0}function Qk(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function s3(n,e){const t=new Vv(n.i,n.x,n.y),i=new Vv(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function Lw(n,e,t,i){const r=new Vv(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Uc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Vv(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Jk(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class Xr{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return Xr.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];Rw(e),Iw(i,e);let o=e.length;t.forEach(Rw);for(let c=0;c<t.length;c++)r.push(o),o+=t[c].length,Iw(i,t[c]);const a=kk.triangulate(i,r);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}}function Rw(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function Iw(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class sf extends lt{constructor(e=new ra([new ge(.5,.5),new ge(-.5,.5),new ge(-.5,-.5),new ge(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,c=e.length;a<c;a++){const f=e[a];o(f)}this.setAttribute("position",new Be(r,3)),this.setAttribute("uv",new Be(s,2)),this.computeVertexNormals();function o(a){const c=[],f=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,v=t.bevelThickness!==void 0?t.bevelThickness:.2,_=t.bevelSize!==void 0?t.bevelSize:v-.1,E=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,x=t.UVGenerator!==void 0?t.UVGenerator:Kk;let w,T=!1,C,P,R,I;g&&(w=g.getSpacedPoints(h),T=!0,m=!1,C=g.computeFrenetFrames(h,!1),P=new N,R=new N,I=new N),m||(S=0,v=0,_=0,E=0);const b=a.extractPoints(f);let L=b.shape;const H=b.holes;if(!Xr.isClockWise(L)){L=L.reverse();for(let me=0,se=H.length;me<se;me++){const ve=H[me];Xr.isClockWise(ve)&&(H[me]=ve.reverse())}}const G=Xr.triangulateShape(L,H),W=L;for(let me=0,se=H.length;me<se;me++){const ve=H[me];L=L.concat(ve)}function ee(me,se,ve){return se||console.error("THREE.ExtrudeGeometry: vec does not exist"),me.clone().addScaledVector(se,ve)}const oe=L.length,ue=G.length;function D(me,se,ve){let Ue,Ce,Ke;const $e=me.x-se.x,Ye=me.y-se.y,rt=ve.x-me.x,Et=ve.y-me.y,F=$e*$e+Ye*Ye,k=$e*Et-Ye*rt;if(Math.abs(k)>Number.EPSILON){const ie=Math.sqrt(F),_e=Math.sqrt(rt*rt+Et*Et),Se=se.x-Ye/ie,be=se.y+$e/ie,tt=ve.x-Et/_e,ke=ve.y+rt/_e,he=((tt-Se)*Et-(ke-be)*rt)/($e*Et-Ye*rt);Ue=Se+$e*he-me.x,Ce=be+Ye*he-me.y;const Ve=Ue*Ue+Ce*Ce;if(Ve<=2)return new ge(Ue,Ce);Ke=Math.sqrt(Ve/2)}else{let ie=!1;$e>Number.EPSILON?rt>Number.EPSILON&&(ie=!0):$e<-Number.EPSILON?rt<-Number.EPSILON&&(ie=!0):Math.sign(Ye)===Math.sign(Et)&&(ie=!0),ie?(Ue=-Ye,Ce=$e,Ke=Math.sqrt(F)):(Ue=$e,Ce=Ye,Ke=Math.sqrt(F/2))}return new ge(Ue/Ke,Ce/Ke)}const V=[];for(let me=0,se=W.length,ve=se-1,Ue=me+1;me<se;me++,ve++,Ue++)ve===se&&(ve=0),Ue===se&&(Ue=0),V[me]=D(W[me],W[ve],W[Ue]);const B=[];let J,Y=V.concat();for(let me=0,se=H.length;me<se;me++){const ve=H[me];J=[];for(let Ue=0,Ce=ve.length,Ke=Ce-1,$e=Ue+1;Ue<Ce;Ue++,Ke++,$e++)Ke===Ce&&(Ke=0),$e===Ce&&($e=0),J[Ue]=D(ve[Ue],ve[Ke],ve[$e]);B.push(J),Y=Y.concat(J)}for(let me=0;me<S;me++){const se=me/S,ve=v*Math.cos(se*Math.PI/2),Ue=_*Math.sin(se*Math.PI/2)+E;for(let Ce=0,Ke=W.length;Ce<Ke;Ce++){const $e=ee(W[Ce],V[Ce],Ue);Q($e.x,$e.y,-ve)}for(let Ce=0,Ke=H.length;Ce<Ke;Ce++){const $e=H[Ce];J=B[Ce];for(let Ye=0,rt=$e.length;Ye<rt;Ye++){const Et=ee($e[Ye],J[Ye],Ue);Q(Et.x,Et.y,-ve)}}}const K=_+E;for(let me=0;me<oe;me++){const se=m?ee(L[me],Y[me],K):L[me];T?(R.copy(C.normals[0]).multiplyScalar(se.x),P.copy(C.binormals[0]).multiplyScalar(se.y),I.copy(w[0]).add(R).add(P),Q(I.x,I.y,I.z)):Q(se.x,se.y,0)}for(let me=1;me<=h;me++)for(let se=0;se<oe;se++){const ve=m?ee(L[se],Y[se],K):L[se];T?(R.copy(C.normals[me]).multiplyScalar(ve.x),P.copy(C.binormals[me]).multiplyScalar(ve.y),I.copy(w[me]).add(R).add(P),Q(I.x,I.y,I.z)):Q(ve.x,ve.y,d/h*me)}for(let me=S-1;me>=0;me--){const se=me/S,ve=v*Math.cos(se*Math.PI/2),Ue=_*Math.sin(se*Math.PI/2)+E;for(let Ce=0,Ke=W.length;Ce<Ke;Ce++){const $e=ee(W[Ce],V[Ce],Ue);Q($e.x,$e.y,d+ve)}for(let Ce=0,Ke=H.length;Ce<Ke;Ce++){const $e=H[Ce];J=B[Ce];for(let Ye=0,rt=$e.length;Ye<rt;Ye++){const Et=ee($e[Ye],J[Ye],Ue);T?Q(Et.x,Et.y+w[h-1].y,w[h-1].x+ve):Q(Et.x,Et.y,d+ve)}}}z(),ye();function z(){const me=r.length/3;if(m){let se=0,ve=oe*se;for(let Ue=0;Ue<ue;Ue++){const Ce=G[Ue];Qe(Ce[2]+ve,Ce[1]+ve,Ce[0]+ve)}se=h+S*2,ve=oe*se;for(let Ue=0;Ue<ue;Ue++){const Ce=G[Ue];Qe(Ce[0]+ve,Ce[1]+ve,Ce[2]+ve)}}else{for(let se=0;se<ue;se++){const ve=G[se];Qe(ve[2],ve[1],ve[0])}for(let se=0;se<ue;se++){const ve=G[se];Qe(ve[0]+oe*h,ve[1]+oe*h,ve[2]+oe*h)}}i.addGroup(me,r.length/3-me,0)}function ye(){const me=r.length/3;let se=0;pe(W,se),se+=W.length;for(let ve=0,Ue=H.length;ve<Ue;ve++){const Ce=H[ve];pe(Ce,se),se+=Ce.length}i.addGroup(me,r.length/3-me,1)}function pe(me,se){let ve=me.length;for(;--ve>=0;){const Ue=ve;let Ce=ve-1;Ce<0&&(Ce=me.length-1);for(let Ke=0,$e=h+S*2;Ke<$e;Ke++){const Ye=oe*Ke,rt=oe*(Ke+1),Et=se+Ue+Ye,F=se+Ce+Ye,k=se+Ce+rt,ie=se+Ue+rt;je(Et,F,k,ie)}}}function Q(me,se,ve){c.push(me),c.push(se),c.push(ve)}function Qe(me,se,ve){Me(me),Me(se),Me(ve);const Ue=r.length/3,Ce=x.generateTopUV(i,r,Ue-3,Ue-2,Ue-1);De(Ce[0]),De(Ce[1]),De(Ce[2])}function je(me,se,ve,Ue){Me(me),Me(se),Me(Ue),Me(se),Me(ve),Me(Ue);const Ce=r.length/3,Ke=x.generateSideWallUV(i,r,Ce-6,Ce-3,Ce-2,Ce-1);De(Ke[0]),De(Ke[1]),De(Ke[3]),De(Ke[1]),De(Ke[2]),De(Ke[3])}function Me(me){r.push(c[me*3+0]),r.push(c[me*3+1]),r.push(c[me*3+2])}function De(me){s.push(me.x),s.push(me.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return $k(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new g_[r.type]().fromJSON(r)),new sf(i,e.options)}}const Kk={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],c=e[i*3+1],f=e[r*3],h=e[r*3+1];return[new ge(s,o),new ge(a,c),new ge(f,h)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],f=e[i*3],h=e[i*3+1],d=e[i*3+2],m=e[r*3],v=e[r*3+1],_=e[r*3+2],E=e[s*3],S=e[s*3+1],g=e[s*3+2];return Math.abs(a-h)<Math.abs(o-f)?[new ge(o,1-c),new ge(f,1-d),new ge(m,1-_),new ge(E,1-g)]:[new ge(a,1-c),new ge(h,1-d),new ge(v,1-_),new ge(S,1-g)]}};function $k(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class of extends Ps{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[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(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new of(e.radius,e.detail)}}class Ii extends Ps{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[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(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ii(e.radius,e.detail)}}class af extends lt{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],c=[],f=[],h=[];let d=e;const m=(t-e)/r,v=new N,_=new ge;for(let E=0;E<=r;E++){for(let S=0;S<=i;S++){const g=s+S/i*o;v.x=d*Math.cos(g),v.y=d*Math.sin(g),c.push(v.x,v.y,v.z),f.push(0,0,1),_.x=(v.x/t+1)/2,_.y=(v.y/t+1)/2,h.push(_.x,_.y)}d+=m}for(let E=0;E<r;E++){const S=E*(i+1);for(let g=0;g<i;g++){const x=g+S,w=x,T=x+i+1,C=x+i+2,P=x+1;a.push(w,T,P),a.push(T,C,P)}}this.setIndex(a),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(f,3)),this.setAttribute("uv",new Be(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new af(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class lf extends lt{constructor(e=new ra([new ge(0,.5),new ge(-.5,-.5),new ge(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)f(e);else for(let h=0;h<e.length;h++)f(e[h]),this.addGroup(a,c,h),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new Be(r,3)),this.setAttribute("normal",new Be(s,3)),this.setAttribute("uv",new Be(o,2));function f(h){const d=r.length/3,m=h.extractPoints(t);let v=m.shape;const _=m.holes;Xr.isClockWise(v)===!1&&(v=v.reverse());for(let S=0,g=_.length;S<g;S++){const x=_[S];Xr.isClockWise(x)===!0&&(_[S]=x.reverse())}const E=Xr.triangulateShape(v,_);for(let S=0,g=_.length;S<g;S++){const x=_[S];v=v.concat(x)}for(let S=0,g=v.length;S<g;S++){const x=v[S];r.push(x.x,x.y,0),s.push(0,0,1),o.push(x.x,x.y)}for(let S=0,g=E.length;S<g;S++){const x=E[S],w=x[0]+d,T=x[1]+d,C=x[2]+d;i.push(w,T,C),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return ez(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new lf(i,e.curveSegments)}}function ez(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class ya extends lt{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const c=Math.min(o+a,Math.PI);let f=0;const h=[],d=new N,m=new N,v=[],_=[],E=[],S=[];for(let g=0;g<=i;g++){const x=[],w=g/i;let T=0;g===0&&o===0?T=.5/t:g===i&&c===Math.PI&&(T=-.5/t);for(let C=0;C<=t;C++){const P=C/t;d.x=-e*Math.cos(r+P*s)*Math.sin(o+w*a),d.y=e*Math.cos(o+w*a),d.z=e*Math.sin(r+P*s)*Math.sin(o+w*a),_.push(d.x,d.y,d.z),m.copy(d).normalize(),E.push(m.x,m.y,m.z),S.push(P+T,1-w),x.push(f++)}h.push(x)}for(let g=0;g<i;g++)for(let x=0;x<t;x++){const w=h[g][x+1],T=h[g][x],C=h[g+1][x],P=h[g+1][x+1];(g!==0||o>0)&&v.push(w,T,P),(g!==i-1||c<Math.PI)&&v.push(T,C,P)}this.setIndex(v),this.setAttribute("position",new Be(_,3)),this.setAttribute("normal",new Be(E,3)),this.setAttribute("uv",new Be(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ya(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class uf extends Ps{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new uf(e.radius,e.detail)}}class gs extends lt{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],c=[],f=[],h=new N,d=new N,m=new N;for(let v=0;v<=i;v++)for(let _=0;_<=r;_++){const E=_/r*s,S=v/i*Math.PI*2;d.x=(e+t*Math.cos(S))*Math.cos(E),d.y=(e+t*Math.cos(S))*Math.sin(E),d.z=t*Math.sin(S),a.push(d.x,d.y,d.z),h.x=e*Math.cos(E),h.y=e*Math.sin(E),m.subVectors(d,h).normalize(),c.push(m.x,m.y,m.z),f.push(_/r),f.push(v/i)}for(let v=1;v<=i;v++)for(let _=1;_<=r;_++){const E=(r+1)*v+_-1,S=(r+1)*(v-1)+_-1,g=(r+1)*(v-1)+_,x=(r+1)*v+_;o.push(E,S,x),o.push(S,g,x)}this.setIndex(o),this.setAttribute("position",new Be(a,3)),this.setAttribute("normal",new Be(c,3)),this.setAttribute("uv",new Be(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gs(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class cf extends lt{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],c=[],f=[],h=[],d=new N,m=new N,v=new N,_=new N,E=new N,S=new N,g=new N;for(let w=0;w<=i;++w){const T=w/i*s*Math.PI*2;x(T,s,o,e,v),x(T+.01,s,o,e,_),S.subVectors(_,v),g.addVectors(_,v),E.crossVectors(S,g),g.crossVectors(E,S),E.normalize(),g.normalize();for(let C=0;C<=r;++C){const P=C/r*Math.PI*2,R=-t*Math.cos(P),I=t*Math.sin(P);d.x=v.x+(R*g.x+I*E.x),d.y=v.y+(R*g.y+I*E.y),d.z=v.z+(R*g.z+I*E.z),c.push(d.x,d.y,d.z),m.subVectors(d,v).normalize(),f.push(m.x,m.y,m.z),h.push(w/i),h.push(C/r)}}for(let w=1;w<=i;w++)for(let T=1;T<=r;T++){const C=(r+1)*(w-1)+(T-1),P=(r+1)*w+(T-1),R=(r+1)*w+T,I=(r+1)*(w-1)+T;a.push(C,P,I),a.push(P,R,I)}this.setIndex(a),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(f,3)),this.setAttribute("uv",new Be(h,2));function x(w,T,C,P,R){const I=Math.cos(w),b=Math.sin(w),L=C/T*w,H=Math.cos(L);R.x=P*(2+H)*.5*I,R.y=P*(2+H)*b*.5,R.z=P*Math.sin(L)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cf(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ff extends lt{constructor(e=new p_(new N(-1,-1,0),new N(-1,1,0),new N(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new N,c=new N,f=new ge;let h=new N;const d=[],m=[],v=[],_=[];E(),this.setIndex(_),this.setAttribute("position",new Be(d,3)),this.setAttribute("normal",new Be(m,3)),this.setAttribute("uv",new Be(v,2));function E(){for(let w=0;w<t;w++)S(w);S(s===!1?t:0),x(),g()}function S(w){h=e.getPointAt(w/t,h);const T=o.normals[w],C=o.binormals[w];for(let P=0;P<=r;P++){const R=P/r*Math.PI*2,I=Math.sin(R),b=-Math.cos(R);c.x=b*T.x+I*C.x,c.y=b*T.y+I*C.y,c.z=b*T.z+I*C.z,c.normalize(),m.push(c.x,c.y,c.z),a.x=h.x+i*c.x,a.y=h.y+i*c.y,a.z=h.z+i*c.z,d.push(a.x,a.y,a.z)}}function g(){for(let w=1;w<=t;w++)for(let T=1;T<=r;T++){const C=(r+1)*(w-1)+(T-1),P=(r+1)*w+(T-1),R=(r+1)*w+T,I=(r+1)*(w-1)+T;_.push(C,P,I),_.push(P,R,I)}}function x(){for(let w=0;w<=t;w++)for(let T=0;T<=r;T++)f.x=w/t,f.y=T/r,v.push(f.x,f.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 ff(new g_[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class o3 extends lt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new N,s=new N;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let f=0,h=c.length;f<h;++f){const d=c[f],m=d.start,v=d.count;for(let _=m,E=m+v;_<E;_+=3)for(let S=0;S<3;S++){const g=a.getX(_+S),x=a.getX(_+(S+1)%3);r.fromBufferAttribute(o,g),s.fromBufferAttribute(o,x),Dw(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let f=0;f<3;f++){const h=3*a+f,d=3*a+(f+1)%3;r.fromBufferAttribute(o,h),s.fromBufferAttribute(o,d),Dw(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Be(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Dw(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var Nw=Object.freeze({__proto__:null,BoxGeometry:oi,CapsuleGeometry:ef,CircleGeometry:tf,ConeGeometry:nf,CylinderGeometry:Ln,DodecahedronGeometry:rf,EdgesGeometry:n3,ExtrudeGeometry:sf,IcosahedronGeometry:of,LatheGeometry:Zl,OctahedronGeometry:Ii,PlaneGeometry:Di,PolyhedronGeometry:Ps,RingGeometry:af,ShapeGeometry:lf,SphereGeometry:ya,TetrahedronGeometry:uf,TorusGeometry:gs,TorusKnotGeometry:cf,TubeGeometry:ff,WireframeGeometry:o3});class a3 extends Bn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Re(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 l3 extends jr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class v_ extends Bn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Re(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 Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yo,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,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.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 u3 extends v_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ge(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ln(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 Re(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 Re(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Re(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=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 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.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class c3 extends Bn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Re(16777215),this.specular=new Re(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yo,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class f3 extends Bn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Re(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yo,this.normalScale=new ge(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 h3 extends Bn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yo,this.normalScale=new ge(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 d3 extends Bn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Re(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yo,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class p3 extends Bn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Re(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yo,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class m3 extends $n{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 Ki(n,e,t){return y_(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function Qo(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function y_(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function g3(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function Hv(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let c=0;c!==e;++c)r[o++]=n[a+c]}return r}function __(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function tz(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let c=0;c<s.tracks.length;++c){const f=s.tracks[c],h=f.getValueSize(),d=[],m=[];for(let v=0;v<f.times.length;++v){const _=f.times[v]*r;if(!(_<t||_>=i)){d.push(f.times[v]);for(let E=0;E<h;++E)m.push(f.values[v*h+E])}}d.length!==0&&(f.times=Qo(d,f.times.constructor),f.values=Qo(m,f.values.constructor),o.push(f))}s.tracks=o;let a=1/0;for(let c=0;c<s.tracks.length;++c)a>s.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*a);return s.resetDuration(),s}function nz(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const f=n.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===c});if(f===void 0)continue;let h=0;const d=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=d/3);let m=0;const v=f.getValueSize();f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=v/3);const _=a.times.length-1;let E;if(s<=a.times[0]){const g=h,x=d-h;E=Ki(a.values,g,x)}else if(s>=a.times[_]){const g=_*d+h,x=g+d-h;E=Ki(a.values,g,x)}else{const g=a.createInterpolant(),x=h,w=d-h;g.evaluate(s),E=Ki(g.resultBuffer,x,w)}c==="quaternion"&&new It().fromArray(E).normalize().conjugate().toArray(E);const S=f.times.length;for(let g=0;g<S;++g){const x=g*v+m;if(c==="quaternion")It.multiplyQuaternionsFlat(f.values,x,E,0,f.values,x);else{const w=v-m*2;for(let T=0;T<w;++T)f.values[x+T]-=E[T]}}}return n.blendMode=Zy,n}const iz={arraySlice:Ki,convertArray:Qo,isTypedArray:y_,getKeyframeOrder:g3,sortedArray:Hv,flattenJSON:__,subclip:tz,makeClipAdditive:nz};class hf{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let c=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===c)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class v3 extends hf{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Yo,endingEnd:Yo}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],c=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case qo:s=e,a=2*t-i;break;case Rc:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(c===void 0)switch(this.getSettings_().endingEnd){case qo:o=e,c=2*i-t;break;case Rc:o=1,c=i+r[1]-r[0];break;default:o=e-1,c=t}const f=(i-t)*.5,h=this.valueSize;this._weightPrev=f/(t-a),this._weightNext=f/(c-i),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,f=c-a,h=this._offsetPrev,d=this._offsetNext,m=this._weightPrev,v=this._weightNext,_=(i-t)/(r-t),E=_*_,S=E*_,g=-m*S+2*m*E-m*_,x=(1+m)*S+(-1.5-2*m)*E+(-.5+m)*_+1,w=(-1-v)*S+(1.5+v)*E+.5*_,T=v*S-v*E;for(let C=0;C!==a;++C)s[C]=g*o[h+C]+x*o[f+C]+w*o[c+C]+T*o[d+C];return s}}class x_ extends hf{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,f=c-a,h=(i-t)/(r-t),d=1-h;for(let m=0;m!==a;++m)s[m]=o[f+m]*d+o[c+m]*h;return s}}class y3 extends hf{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Pr{constructor(e,t,i,r){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=Qo(t,this.TimeBufferType),this.values=Qo(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:Qo(e.times,Array),values:Qo(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new y3(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new x_(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new v3(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Pc:t=this.InterpolantFactoryMethodDiscrete;break;case Lc:t=this.InterpolantFactoryMethodLinear;break;case Dd:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Pc;case this.InterpolantFactoryMethodLinear:return Lc;case this.InterpolantFactoryMethodSmooth:return Dd}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=Ki(i,s,o),this.values=Ki(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const c=i[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(r!==void 0&&y_(r))for(let a=0,c=r.length;a!==c;++a){const f=r[a];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,f),e=!1;break}}return e}optimize(){const e=Ki(this.times),t=Ki(this.values),i=this.getValueSize(),r=this.getInterpolation()===Dd,s=e.length-1;let o=1;for(let a=1;a<s;++a){let c=!1;const f=e[a],h=e[a+1];if(f!==h&&(a!==1||f!==e[0]))if(r)c=!0;else{const d=a*i,m=d-i,v=d+i;for(let _=0;_!==i;++_){const E=t[d+_];if(E!==t[m+_]||E!==t[v+_]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const d=a*i,m=o*i;for(let v=0;v!==i;++v)t[m+v]=t[d+v]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,c=o*i,f=0;f!==i;++f)t[c+f]=t[a+f];++o}return o!==e.length?(this.times=Ki(e,0,o),this.values=Ki(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=Ki(this.times,0),t=Ki(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Pr.prototype.TimeBufferType=Float32Array;Pr.prototype.ValueBufferType=Float32Array;Pr.prototype.DefaultInterpolation=Lc;class _a extends Pr{}_a.prototype.ValueTypeName="bool";_a.prototype.ValueBufferType=Array;_a.prototype.DefaultInterpolation=Pc;_a.prototype.InterpolantFactoryMethodLinear=void 0;_a.prototype.InterpolantFactoryMethodSmooth=void 0;class S_ extends Pr{}S_.prototype.ValueTypeName="color";class Oc extends Pr{}Oc.prototype.ValueTypeName="number";class _3 extends hf{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(i-t)/(r-t);let f=e*a;for(let h=f+a;f!==h;f+=4)It.slerpFlat(s,0,o,f-a,o,f,c);return s}}class Ql extends Pr{InterpolantFactoryMethodLinear(e){return new _3(this.times,this.values,this.getValueSize(),e)}}Ql.prototype.ValueTypeName="quaternion";Ql.prototype.DefaultInterpolation=Lc;Ql.prototype.InterpolantFactoryMethodSmooth=void 0;class xa extends Pr{}xa.prototype.ValueTypeName="string";xa.prototype.ValueBufferType=Array;xa.prototype.DefaultInterpolation=Pc;xa.prototype.InterpolantFactoryMethodLinear=void 0;xa.prototype.InterpolantFactoryMethodSmooth=void 0;class Fc extends Pr{}Fc.prototype.ValueTypeName="vector";class Bc{constructor(e,t=-1,i,r=Lp){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Ui(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(sz(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(Pr.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let c=[],f=[];c.push((a+s-1)%s,a,(a+1)%s),f.push(0,1,0);const h=g3(c);c=Hv(c,1,h),f=Hv(f,1,h),!r&&c[0]===0&&(c.push(s),f.push(f[0])),o.push(new Oc(".morphTargetInfluences["+t[a].name+"]",c,f).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const f=e[a],h=f.name.match(s);if(h&&h.length>1){const d=h[1];let m=r[d];m||(r[d]=m=[]),m.push(f)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(d,m,v,_,E){if(v.length!==0){const S=[],g=[];__(v,S,g,_),S.length!==0&&E.push(new d(m,S,g))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const f=e.hierarchy||[];for(let d=0;d<f.length;d++){const m=f[d].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const v={};let _;for(_=0;_<m.length;_++)if(m[_].morphTargets)for(let E=0;E<m[_].morphTargets.length;E++)v[m[_].morphTargets[E]]=-1;for(const E in v){const S=[],g=[];for(let x=0;x!==m[_].morphTargets.length;++x){const w=m[_];S.push(w.time),g.push(w.morphTarget===E?1:0)}r.push(new Oc(".morphTargetInfluence["+E+"]",S,g))}c=v.length*o}else{const v=".bones["+t[d].name+"]";i(Fc,v+".position",m,"pos",r),i(Ql,v+".quaternion",m,"rot",r),i(Fc,v+".scale",m,"scl",r)}}return r.length===0?null:new this(s,c,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.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 t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function rz(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Oc;case"vector":case"vector2":case"vector3":case"vector4":return Fc;case"color":return S_;case"quaternion":return Ql;case"bool":case"boolean":return _a;case"string":return xa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function sz(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=rz(n.type);if(n.times===void 0){const t=[],i=[];__(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const pa={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class w_{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,c;const f=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(h){a++,s===!1&&r.onStart!==void 0&&r.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,r.onProgress!==void 0&&r.onProgress(h,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,d){return f.push(h,d),this},this.removeHandler=function(h){const d=f.indexOf(h);return d!==-1&&f.splice(d,2),this},this.getHandler=function(h){for(let d=0,m=f.length;d<m;d+=2){const v=f[d],_=f[d+1];if(v.global&&(v.lastIndex=0),v.test(h))return _}return null}}}const x3=new w_;class Vi{constructor(e){this.manager=e!==void 0?e:x3,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}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}}const cs={};class oz extends Error{constructor(e,t){super(e),this.response=t}}class As extends Vi{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=pa.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(cs[e]!==void 0){cs[e].push({onLoad:t,onProgress:i,onError:r});return}cs[e]=[],cs[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const h=cs[e],d=f.body.getReader(),m=f.headers.get("Content-Length")||f.headers.get("X-File-Size"),v=m?parseInt(m):0,_=v!==0;let E=0;const S=new ReadableStream({start(g){x();function x(){d.read().then(({done:w,value:T})=>{if(w)g.close();else{E+=T.byteLength;const C=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let P=0,R=h.length;P<R;P++){const I=h[P];I.onProgress&&I.onProgress(C)}g.enqueue(T),x()}})}}});return new Response(S)}else throw new oz(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(c){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return f.json();default:if(a===void 0)return f.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),m=d&&d[1]?d[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{pa.add(e,f);const h=cs[e];delete cs[e];for(let d=0,m=h.length;d<m;d++){const v=h[d];v.onLoad&&v.onLoad(f)}}).catch(f=>{const h=cs[e];if(h===void 0)throw this.manager.itemError(e),f;delete cs[e];for(let d=0,m=h.length;d<m;d++){const v=h[d];v.onError&&v.onError(f)}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}}class az extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new As(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=Bc.parse(e[i]);t.push(r)}return t}}class lz extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new c_,c=new As(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(s.withCredentials);let f=0;function h(d){c.load(e[d],function(m){const v=s.parse(m,!0);o[d]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},f+=1,f===6&&(v.mipmapCount===1&&(a.minFilter=en),a.image=o,a.format=v.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let d=0,m=e.length;d<m;++d)h(d);else c.load(e,function(d){const m=s.parse(d,!0);if(m.isCubemap){const v=m.mipmaps.length/m.mipmapCount;for(let _=0;_<v;_++){o[_]={mipmaps:[]};for(let E=0;E<m.mipmapCount;E++)o[_].mipmaps.push(m.mipmaps[_*m.mipmapCount+E]),o[_].format=m.format,o[_].width=m.width,o[_].height=m.height}a.image=o}else a.image.width=m.width,a.image.height=m.height,a.mipmaps=m.mipmaps;m.mipmapCount===1&&(a.minFilter=en),a.format=m.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class Vc extends Vi{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=pa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Dc("img");function c(){h(),pa.add(e,this),t&&t(this),s.manager.itemEnd(e)}function f(d){h(),r&&r(d),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",c,!1),a.removeEventListener("error",f,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",f,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class uz extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=new Kc,o=new Vc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(f){o.load(e[f],function(h){s.images[f]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let f=0;f<e.length;++f)c(f);return s}}class cz extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Ll,a=new As(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(c){const f=s.parse(c);!f||(f.image!==void 0?o.image=f.image:f.data!==void 0&&(o.image.width=f.width,o.image.height=f.height,o.image.data=f.data),o.wrapS=f.wrapS!==void 0?f.wrapS:Jn,o.wrapT=f.wrapT!==void 0?f.wrapT:Jn,o.magFilter=f.magFilter!==void 0?f.magFilter:en,o.minFilter=f.minFilter!==void 0?f.minFilter:en,o.anisotropy=f.anisotropy!==void 0?f.anisotropy:1,f.encoding!==void 0&&(o.encoding=f.encoding),f.flipY!==void 0&&(o.flipY=f.flipY),f.format!==void 0&&(o.format=f.format),f.type!==void 0&&(o.type=f.type),f.mipmaps!==void 0&&(o.mipmaps=f.mipmaps,o.minFilter=po),f.mipmapCount===1&&(o.minFilter=en),f.generateMipmaps!==void 0&&(o.generateMipmaps=f.generateMipmaps),o.needsUpdate=!0,t&&t(o,f))},i,r),o}}class fz extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=new un,o=new Vc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class _o extends St{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Re(e),this.intensity=t}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,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class S3 extends _o{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(St.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Re(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const $g=new st,kw=new N,zw=new N;class M_{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ge(512,512),this.map=null,this.mapPass=null,this.matrix=new st,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ip,this._frameExtents=new ge(1,1),this._viewportCount=1,this._viewports=[new Nt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;kw.setFromMatrixPosition(e.matrixWorld),t.position.copy(kw),zw.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(zw),t.updateMatrixWorld(),$g.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($g),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply($g)}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.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return 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 hz extends M_{constructor(){super(new In(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Fl*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class w3 extends _o{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(St.DEFAULT_UP),this.updateMatrix(),this.target=new St,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new hz}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const Uw=new st,Uu=new N,e0=new N;class dz extends M_{constructor(){super(new In(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ge(4,2),this._viewportCount=6,this._viewports=[new Nt(2,1,1,1),new Nt(0,1,1,1),new Nt(3,1,1,1),new Nt(1,1,1,1),new Nt(3,0,1,1),new Nt(1,0,1,1)],this._cubeDirections=[new N(1,0,0),new N(-1,0,0),new N(0,0,1),new N(0,0,-1),new N(0,1,0),new N(0,-1,0)],this._cubeUps=[new N(0,1,0),new N(0,1,0),new N(0,1,0),new N(0,1,0),new N(0,0,1),new N(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Uu.setFromMatrixPosition(e.matrixWorld),i.position.copy(Uu),e0.copy(i.position),e0.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(e0),i.updateMatrixWorld(),r.makeTranslation(-Uu.x,-Uu.y,-Uu.z),Uw.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Uw)}}class M3 extends _o{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new dz}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class pz extends M_{constructor(){super(new $c(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class E3 extends _o{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(St.DEFAULT_UP),this.updateMatrix(),this.target=new St,this.shadow=new pz}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class T3 extends _o{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class A3 extends _o{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}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 C3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new N)}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 i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],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 i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class Vp extends _o{constructor(e=new C3,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Hp extends Vi{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new As(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=Hp.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new Re().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new Re().setHex(o.value);break;case"v2":r.uniforms[s].value=new ge().fromArray(o.value);break;case"v3":r.uniforms[s].value=new N().fromArray(o.value);break;case"v4":r.uniforms[s].value=new Nt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new xt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new st().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new ge().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new ge().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:a3,SpriteMaterial:a_,RawShaderMaterial:l3,ShaderMaterial:jr,PointsMaterial:u_,MeshPhysicalMaterial:u3,MeshStandardMaterial:v_,MeshPhongMaterial:c3,MeshToonMaterial:f3,MeshNormalMaterial:h3,MeshLambertMaterial:d3,MeshDepthMaterial:i_,MeshDistanceMaterial:r_,MeshBasicMaterial:Zr,MeshMatcapMaterial:p3,LineDashedMaterial:m3,LineBasicMaterial:$n,Material:Bn};return new t[e]}}class Gv{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}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 b3 extends lt{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 P3 extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new As(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(v,_){if(t[_]!==void 0)return t[_];const S=v.interleavedBuffers[_],g=s(v,S.buffer),x=_l(S.type,g),w=new zp(x,S.stride);return w.uuid=S.uuid,t[_]=w,w}function s(v,_){if(i[_]!==void 0)return i[_];const S=v.arrayBuffers[_],g=new Uint32Array(S).buffer;return i[_]=g,g}const o=e.isInstancedBufferGeometry?new b3:new lt,a=e.data.index;if(a!==void 0){const v=_l(a.type,a.array);o.setIndex(new Bt(v,1))}const c=e.data.attributes;for(const v in c){const _=c[v];let E;if(_.isInterleavedBufferAttribute){const S=r(e.data,_.data);E=new ha(S,_.itemSize,_.offset,_.normalized)}else{const S=_l(_.type,_.array),g=_.isInstancedBufferAttribute?Vl:Bt;E=new g(S,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),_.updateRange!==void 0&&(E.updateRange.offset=_.updateRange.offset,E.updateRange.count=_.updateRange.count),o.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let S=0,g=_.length;S<g;S++){const x=_[S];let w;if(x.isInterleavedBufferAttribute){const T=r(e.data,x.data);w=new ha(T,x.itemSize,x.offset,x.normalized)}else{const T=_l(x.type,x.array);w=new Bt(T,x.itemSize,x.normalized)}x.name!==void 0&&(w.name=x.name),E.push(w)}o.morphAttributes[v]=E}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let v=0,_=d.length;v!==_;++v){const E=d[v];o.addGroup(E.start,E.count,E.materialIndex)}const m=e.data.boundingSphere;if(m!==void 0){const v=new N;m.center!==void 0&&v.fromArray(m.center),o.boundingSphere=new qr(v,m.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class mz extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Gv.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new As(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let f=null;try{f=JSON.parse(c)}catch(d){r!==void 0&&r(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const h=f.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(f,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Gv.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new As(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(f)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),f=this.parseObject(e.object,s,c,a,i),h=this.parseSkeletons(e.skeletons,f);if(this.bindSkeletons(f,h),t!==void 0){let d=!1;for(const m in o)if(o[m].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(f)}return f}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,r,a,o,t),f=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,f),c}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new ra().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Up().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new P3;for(let s=0,o=e.length;s<o;s++){let a;const c=e[s];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(c);break;default:c.type in Nw?a=Nw[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),i[c.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new Hp;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];i[c.uuid]===void 0&&(i[c.uuid]=s.parse(c)),r[c.uuid]=i[c.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=Bc.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(c){return i.manager.itemStart(c),s.load(c,function(){i.manager.itemEnd(c)},void 0,function(){i.manager.itemError(c),i.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const f=c,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:i.resourcePath+f;return o(h)}else return c.data?{data:_l(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new w_(t);s=new Vc(c),s.setCrossOrigin(this.crossOrigin);for(let f=0,h=e.length;f<h;f++){const d=e[f],m=d.url;if(Array.isArray(m)){const v=[];for(let _=0,E=m.length;_<E;_++){const S=m[_],g=a(S);g!==null&&(g instanceof HTMLImageElement?v.push(g):v.push(new Ll(g.data,g.width,g.height)))}r[d.uuid]=new Zo(v)}else{const v=a(d.url);r[d.uuid]=new Zo(v)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(c)}else return o.data?{data:_l(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Vc(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],f=c.url;if(Array.isArray(f)){const h=[];for(let d=0,m=f.length;d<m;d++){const v=f[d],_=await s(v);_!==null&&(_ instanceof HTMLImageElement?h.push(_):h.push(new Ll(_.data,_.width,_.height)))}i[c.uuid]=new Zo(h)}else{const h=await s(c.url);i[c.uuid]=new Zo(h)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const c=t[a.image],f=c.data;let h;Array.isArray(f)?(h=new Kc,f.length===6&&(h.needsUpdate=!0)):(f&&f.data?h=new Ll:h=new un,f&&(h.needsUpdate=!0)),h.source=c,h.uuid=a.uuid,a.name!==void 0&&(h.name=a.name),a.mapping!==void 0&&(h.mapping=i(a.mapping,gz)),a.channel!==void 0&&(h.channel=a.channel),a.offset!==void 0&&h.offset.fromArray(a.offset),a.repeat!==void 0&&h.repeat.fromArray(a.repeat),a.center!==void 0&&h.center.fromArray(a.center),a.rotation!==void 0&&(h.rotation=a.rotation),a.wrap!==void 0&&(h.wrapS=i(a.wrap[0],Ow),h.wrapT=i(a.wrap[1],Ow)),a.format!==void 0&&(h.format=a.format),a.internalFormat!==void 0&&(h.internalFormat=a.internalFormat),a.type!==void 0&&(h.type=a.type),a.encoding!==void 0&&(h.encoding=a.encoding),a.minFilter!==void 0&&(h.minFilter=i(a.minFilter,Fw)),a.magFilter!==void 0&&(h.magFilter=i(a.magFilter,Fw)),a.anisotropy!==void 0&&(h.anisotropy=a.anisotropy),a.flipY!==void 0&&(h.flipY=a.flipY),a.generateMipmaps!==void 0&&(h.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(h.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(h.userData=a.userData),r[a.uuid]=h}return r}parseObject(e,t,i,r,s){let o;function a(m){return t[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),t[m]}function c(m){if(m!==void 0){if(Array.isArray(m)){const v=[];for(let _=0,E=m.length;_<E;_++){const S=m[_];i[S]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",S),v.push(i[S])}return v}return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),i[m]}}function f(m){return r[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),r[m]}let h,d;switch(e.type){case"Scene":o=new up,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Re(e.background):o.background=f(e.background)),e.environment!==void 0&&(o.environment=f(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new kp(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Np(e.fog.color,e.fog.density))),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":o=new In(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new $c(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new T3(e.color,e.intensity);break;case"DirectionalLight":o=new E3(e.color,e.intensity);break;case"PointLight":o=new M3(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new A3(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new w3(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new S3(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Vp().fromJSON(e);break;case"SkinnedMesh":h=a(e.geometry),d=c(e.material),o=new Y2(h,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":h=a(e.geometry),d=c(e.material),o=new Ne(h,d);break;case"InstancedMesh":h=a(e.geometry),d=c(e.material);const m=e.count,v=e.instanceMatrix,_=e.instanceColor;o=new q2(h,d,m),o.instanceMatrix=new Vl(new Float32Array(v.array),16),_!==void 0&&(o.instanceColor=new Vl(new Float32Array(_.array),_.itemSize));break;case"LOD":o=new j2;break;case"Line":o=new vt(a(e.geometry),c(e.material));break;case"LineLoop":o=new Z2(a(e.geometry),c(e.material));break;case"LineSegments":o=new Qr(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new Q2(a(e.geometry),c(e.material));break;case"Sprite":o=new X2(c(e.material));break;case"Group":o=new Sl;break;case"Bone":o=new l_;break;default:o=new St}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v<m.length;v++)o.add(this.parseObject(m[v],t,i,r,s))}if(e.animations!==void 0){const m=e.animations;for(let v=0;v<m.length;v++){const _=m[v];o.animations.push(s[_])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const m=e.levels;for(let v=0;v<m.length;v++){const _=m[v],E=o.getObjectByProperty("uuid",_.object);E!==void 0&&o.addLevel(E,_.distance,_.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}}const gz={UVMapping:Pp,CubeReflectionMapping:fo,CubeRefractionMapping:ho,EquirectangularReflectionMapping:Tc,EquirectangularRefractionMapping:Ac,CubeUVReflectionMapping:jl},Ow={RepeatWrapping:Cc,ClampToEdgeWrapping:Jn,MirroredRepeatWrapping:bc},Fw={NearestFilter:hn,NearestMipmapNearestFilter:ap,NearestMipmapLinearFilter:rc,LinearFilter:en,LinearMipmapNearestFilter:Yy,LinearMipmapLinearFilter:po};class vz extends Vi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=pa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){pa.add(e,c),t&&t(c),s.manager.itemEnd(e)}).catch(function(c){r&&r(c),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let ad;class E_{static getContext(){return ad===void 0&&(ad=new(window.AudioContext||window.webkitAudioContext)),ad}static setContext(e){ad=e}}class yz extends Vi{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new As(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const c=a.slice(0);E_.getContext().decodeAudioData(c,function(h){t(h)})}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}}class _z extends Vp{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new Re().set(e),s=new Re().set(t),o=new N(r.r,r.g,r.b),a=new N(s.r,s.g,s.b),c=Math.sqrt(Math.PI),f=c*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(f)}}class xz extends Vp{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new Re().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const Bw=new st,Vw=new st,Do=new st;class Sz{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new In,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new In,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,Do.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(na*t.fov*.5)/t.zoom;let a,c;Vw.elements[12]=-r,Bw.elements[12]=r,a=-o*t.aspect+s,c=o*t.aspect+s,Do.elements[0]=2*t.near/(c-a),Do.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(Do),a=-o*t.aspect-s,c=o*t.aspect-s,Do.elements[0]=2*t.near/(c-a),Do.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(Do)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Vw),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Bw)}}class T_{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Hw(),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=Hw();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Hw(){return(typeof performance>"u"?Date:performance).now()}const No=new N,Gw=new It,wz=new N,ko=new N;class Mz extends St{constructor(){super(),this.type="AudioListener",this.context=E_.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new T_}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,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(No,Gw,wz),ko.set(0,0,-1).applyQuaternion(Gw),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(No.x,r),t.positionY.linearRampToValueAtTime(No.y,r),t.positionZ.linearRampToValueAtTime(No.z,r),t.forwardX.linearRampToValueAtTime(ko.x,r),t.forwardY.linearRampToValueAtTime(ko.y,r),t.forwardZ.linearRampToValueAtTime(ko.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(No.x,No.y,No.z),t.setOrientation(ko.x,ko.y,ko.z,i.x,i.y,i.z)}}class L3 extends St{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const 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){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,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.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){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!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){console.warn("THREE.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}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.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}}const zo=new N,Ww=new It,Ez=new N,Uo=new N;class Tz extends L3{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}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,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(zo,Ww,Ez),Uo.set(0,0,1).applyQuaternion(Ww);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(zo.x,i),t.positionY.linearRampToValueAtTime(zo.y,i),t.positionZ.linearRampToValueAtTime(zo.z,i),t.orientationX.linearRampToValueAtTime(Uo.x,i),t.orientationY.linearRampToValueAtTime(Uo.y,i),t.orientationZ.linearRampToValueAtTime(Uo.z,i)}else t.setPosition(zo.x,zo.y,zo.z),t.setOrientation(Uo.x,Uo.y,Uo.z)}}class Az{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 i=0;i<t.length;i++)e+=t[i];return e/t.length}}class R3{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(i,r,c,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let c=t,f=t+t;c!==f;++c)if(i[c]!==i[c+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];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 i=e;i<t;i++)this.buffer[i]=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 i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){It.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;It.multiplyQuaternionsFlat(e,o,e,t,e,i),It.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const A_="\\[\\]\\.:\\/",Cz=new RegExp("["+A_+"]","g"),C_="[^"+A_+"]",bz="[^"+A_.replace("\\.","")+"]",Pz=/((?:WC+[\/:])*)/.source.replace("WC",C_),Lz=/(WCOD+)?/.source.replace("WCOD",bz),Rz=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",C_),Iz=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",C_),Dz=new RegExp("^"+Pz+Lz+Rz+Iz+"$"),Nz=["material","materials","bones","map"];class kz{constructor(e,t,i){const r=i||Tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Tt{constructor(e,t,i){this.path=t,this.parsedPath=i||Tt.parseTrackName(t),this.node=Tt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Tt.Composite(e,t,i):new Tt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Cz,"")}static parseTrackName(e){const t=Dz.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);Nz.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const c=i(a.children);if(c)return c}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_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 i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=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,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Tt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let f=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===f){f=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.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[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(f!==void 0){if(e[f]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[f]}}const o=e[r];if(o===void 0){const f=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+f+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Tt.Composite=kz;Tt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Tt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Tt.prototype.GetterByBindingType=[Tt.prototype._getValue_direct,Tt.prototype._getValue_array,Tt.prototype._getValue_arrayElement,Tt.prototype._getValue_toArray];Tt.prototype.SetterByBindingTypeAndVersioning=[[Tt.prototype._setValue_direct,Tt.prototype._setValue_direct_setNeedsUpdate,Tt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Tt.prototype._setValue_array,Tt.prototype._setValue_array_setNeedsUpdate,Tt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Tt.prototype._setValue_arrayElement,Tt.prototype._setValue_arrayElement_setNeedsUpdate,Tt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Tt.prototype._setValue_fromArray,Tt.prototype._setValue_fromArray_setNeedsUpdate,Tt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class zz{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ui(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;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,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,c=e.length,f=this.nCachedObjects_;for(let h=0,d=arguments.length;h!==d;++h){const m=arguments[h],v=m.uuid;let _=t[v];if(_===void 0){_=c++,t[v]=_,e.push(m);for(let E=0,S=o;E!==S;++E)s[E].push(new Tt(m,i[E],r[E]))}else if(_<f){a=e[_];const E=--f,S=e[E];t[S.uuid]=_,e[_]=S,t[v]=E,e[E]=m;for(let g=0,x=o;g!==x;++g){const w=s[g],T=w[E];let C=w[_];w[_]=T,C===void 0&&(C=new Tt(m,i[g],r[g])),w[E]=C}}else e[_]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=f}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],f=c.uuid,h=t[f];if(h!==void 0&&h>=s){const d=s++,m=e[d];t[m.uuid]=h,e[h]=m,t[f]=d,e[d]=c;for(let v=0,_=r;v!==_;++v){const E=i[v],S=E[d],g=E[h];E[h]=S,E[d]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const f=arguments[a],h=f.uuid,d=t[h];if(d!==void 0)if(delete t[h],d<s){const m=--s,v=e[m],_=--o,E=e[_];t[v.uuid]=d,e[d]=v,t[E.uuid]=m,e[m]=E,e.pop();for(let S=0,g=r;S!==g;++S){const x=i[S],w=x[m],T=x[_];x[d]=w,x[m]=T,x.pop()}}else{const m=--o,v=e[m];m>0&&(t[v.uuid]=d),e[d]=v,e.pop();for(let _=0,E=r;_!==E;++_){const S=i[_];S[d]=S[m],S.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,c=this._objects,f=c.length,h=this.nCachedObjects_,d=new Array(f);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(d);for(let m=h,v=c.length;m!==v;++m){const _=c[m];d[m]=new Tt(_,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],f=e[a];t[f]=i,o[i]=c,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class I3{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),c={endingStart:Yo,endingEnd:Yo};for(let f=0;f!==o;++f){const h=s[f].createInterpolant(null);a[f]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=w2,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,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}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,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,f=a.sampleValues;return c[0]=s,c[1]=s+i,f[0]=e/o,f[1]=t/o,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,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*i;c<0||i===0?t=0:(this._startTime=null,t=i*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Zy:for(let h=0,d=c.length;h!==d;++h)c[h].evaluate(o),f[h].accumulateAdditive(a);break;case Lp:default:for(let h=0,d=c.length;h!==d;++h)c[h].evaluate(o),f[h].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===M2;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===S2){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const f=e<0;this._setEndings(f,!f,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=qo,r.endingEnd=qo):(e?r.endingStart=this.zeroSlopeAtStart?qo:Yo:r.endingStart=Rc,t?r.endingEnd=this.zeroSlopeAtEnd?qo:Yo:r.endingEnd=Rc)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=s,c[0]=t,a[1]=s+e,c[1]=i,this}}const Uz=new Float32Array(1);class Oz extends bs{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,c=i.uuid,f=this._bindingsByRootAndName;let h=f[c];h===void 0&&(h={},f[c]=h);for(let d=0;d!==s;++d){const m=r[d],v=m.name;let _=h[v];if(_!==void 0)++_.referenceCount,o[d]=_;else{if(_=o[d],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,c,v));continue}const E=t&&t._propertyBindings[d].binding.parsedPath;_=new R3(Tt.create(i,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,c,v),o[d]=_}a[d].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}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,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],c=a.knownActions,f=c[c.length-1],h=e._byClipCacheIndex;f._byClipCacheIndex=h,c[h]=f,c.pop(),e._byClipCacheIndex=null;const d=a.actionByRoot,m=(e._localRoot||this._root).uuid;delete d[m],c.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],c=t[t.length-1],f=e._cacheIndex;c._cacheIndex=f,t[f]=c,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new x_(new Float32Array(2),new Float32Array(2),1,Uz),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?Bc.findByName(r,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let f=null;if(i===void 0&&(o!==null?i=o.blendMode:i=Lp),c!==void 0){const d=c.actionByRoot[s];if(d!==void 0&&d.blendMode===i)return d;f=c.knownActions[0],o===null&&(o=f._clip)}if(o===null)return null;const h=new I3(this,o,t,i);return this._bindAction(h,f),this._addInactiveAction(h,a,s),h}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?Bc.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let f=0;f!==i;++f)t[f]._update(r,e,s,o);const a=this._bindings,c=this._nActiveBindings;for(let f=0;f!==c;++f)a[f].apply(o);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,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,c=o.length;a!==c;++a){const f=o[a];this._deactivateAction(f);const h=f._cacheIndex,d=t[t.length-1];f._cacheIndex=null,f._byClipCacheIndex=null,d._cacheIndex=h,t[h]=d,t.pop(),this._removeInactiveBindingsForAction(f)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class b_{constructor(e){this.value=e}clone(){return new b_(this.value.clone===void 0?this.value:this.value.clone())}}let Fz=0;class Bz extends bs{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Fz++}),this.name="",this.usage=Ic,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(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++)this.uniforms.push(t[i].clone());return this}clone(){return new this.constructor().copy(this)}}class Vz extends zp{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}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 Hz{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,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}}class P_{constructor(e,t,i=0,r=1/0){this.ray=new Qc(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new ia,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):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return Wv(e,this,i,t),i.sort(Xw),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Wv(e[r],this,i,t);return i.sort(Xw),i}}function Xw(n,e){return n.distance-e.distance}function Wv(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const r=n.children;for(let s=0,o=r.length;s<o;s++)Wv(r[s],e,t,!0)}}class Gz{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(ln(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Wz{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,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,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const jw=new ge;class Xz{constructor(e=new ge(1/0,1/0),t=new ge(-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,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=jw.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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,jw).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 Yw=new N,ld=new N;class jz{constructor(e=new N,t=new N){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){Yw.subVectors(e,this.start),ld.subVectors(this.end,this.start);const i=ld.dot(ld);let s=ld.dot(Yw)/i;return t&&(s=ln(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const qw=new N;class Yz extends St{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new lt,r=[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 o=0,a=1,c=32;o<c;o++,a++){const f=o/c*Math.PI*2,h=a/c*Math.PI*2;r.push(Math.cos(f),Math.sin(f),1,Math.cos(h),Math.sin(h),1)}i.setAttribute("position",new Be(r,3));const s=new $n({fog:!1,toneMapped:!1});this.cone=new Qr(i,s),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);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),qw.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(qw),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ws=new N,ud=new st,t0=new st;class qz extends Qr{constructor(e){const t=D3(e),i=new lt,r=[],s=[],o=new Re(0,0,1),a=new Re(0,1,0);for(let f=0;f<t.length;f++){const h=t[f];h.parent&&h.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Be(r,3)),i.setAttribute("color",new Be(s,3));const c=new $n({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");t0.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(ud.multiplyMatrices(t0,a.matrixWorld),Ws.setFromMatrixPosition(ud),r.setXYZ(o,Ws.x,Ws.y,Ws.z),ud.multiplyMatrices(t0,a.parent.matrixWorld),Ws.setFromMatrixPosition(ud),r.setXYZ(o+1,Ws.x,Ws.y,Ws.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function D3(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,D3(n.children[t]));return e}class Zz extends Ne{constructor(e,t,i){const r=new ya(t,4,2),s=new Zr({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,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 Qz=new N,Zw=new Re,Qw=new Re;class Jz extends St{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new Ii(t);r.rotateY(Math.PI*.5),this.material=new Zr({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new Bt(o,3)),this.add(new Ne(r,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");Zw.copy(this.light.color),Qw.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?Zw:Qw;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Qz.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Kz extends Qr{constructor(e=10,t=10,i=4473924,r=8947848){i=new Re(i),r=new Re(r);const s=t/2,o=e/t,a=e/2,c=[],f=[];for(let m=0,v=0,_=-a;m<=t;m++,_+=o){c.push(-a,0,_,a,0,_),c.push(_,0,-a,_,0,a);const E=m===s?i:r;E.toArray(f,v),v+=3,E.toArray(f,v),v+=3,E.toArray(f,v),v+=3,E.toArray(f,v),v+=3}const h=new lt;h.setAttribute("position",new Be(c,3)),h.setAttribute("color",new Be(f,3));const d=new $n({vertexColors:!0,toneMapped:!1});super(h,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class $z extends Qr{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new Re(s),o=new Re(o);const a=[],c=[];if(t>1)for(let d=0;d<t;d++){const m=d/t*(Math.PI*2),v=Math.sin(m)*e,_=Math.cos(m)*e;a.push(0,0,0),a.push(v,0,_);const E=d&1?s:o;c.push(E.r,E.g,E.b),c.push(E.r,E.g,E.b)}for(let d=0;d<i;d++){const m=d&1?s:o,v=e-e/i*d;for(let _=0;_<r;_++){let E=_/r*(Math.PI*2),S=Math.sin(E)*v,g=Math.cos(E)*v;a.push(S,0,g),c.push(m.r,m.g,m.b),E=(_+1)/r*(Math.PI*2),S=Math.sin(E)*v,g=Math.cos(E)*v,a.push(S,0,g),c.push(m.r,m.g,m.b)}}const f=new lt;f.setAttribute("position",new Be(a,3)),f.setAttribute("color",new Be(c,3));const h=new $n({vertexColors:!0,toneMapped:!1});super(f,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Jw=new N,cd=new N,Kw=new N;class eU extends St{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new lt;r.setAttribute("position",new Be([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new $n({fog:!1,toneMapped:!1});this.lightPlane=new vt(r,s),this.add(this.lightPlane),r=new lt,r.setAttribute("position",new Be([0,0,0,0,0,1],3)),this.targetLine=new vt(r,s),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),Jw.setFromMatrixPosition(this.light.matrixWorld),cd.setFromMatrixPosition(this.light.target.matrixWorld),Kw.subVectors(cd,Jw),this.lightPlane.lookAt(cd),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(cd),this.targetLine.scale.z=Kw.length()}}const fd=new N,on=new Jc;class tU extends Qr{constructor(e){const t=new lt,i=new $n({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(_,E){c(_),c(E)}function c(_){r.push(0,0,0),s.push(0,0,0),o[_]===void 0&&(o[_]=[]),o[_].push(r.length/3-1)}t.setAttribute("position",new Be(r,3)),t.setAttribute("color",new Be(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const f=new Re(16755200),h=new Re(16711680),d=new Re(43775),m=new Re(16777215),v=new Re(3355443);this.setColors(f,h,d,m,v)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;on.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),fn("c",t,e,on,0,0,-1),fn("t",t,e,on,0,0,1),fn("n1",t,e,on,-i,-r,-1),fn("n2",t,e,on,i,-r,-1),fn("n3",t,e,on,-i,r,-1),fn("n4",t,e,on,i,r,-1),fn("f1",t,e,on,-i,-r,1),fn("f2",t,e,on,i,-r,1),fn("f3",t,e,on,-i,r,1),fn("f4",t,e,on,i,r,1),fn("u1",t,e,on,i*.7,r*1.1,-1),fn("u2",t,e,on,-i*.7,r*1.1,-1),fn("u3",t,e,on,0,r*2,-1),fn("cf1",t,e,on,-i,0,1),fn("cf2",t,e,on,i,0,1),fn("cf3",t,e,on,0,-r,1),fn("cf4",t,e,on,0,r,1),fn("cn1",t,e,on,-i,0,-1),fn("cn2",t,e,on,i,0,-1),fn("cn3",t,e,on,0,-r,-1),fn("cn4",t,e,on,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function fn(n,e,t,i,r,s,o){fd.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const c=t.getAttribute("position");for(let f=0,h=a.length;f<h;f++)c.setXYZ(a[f],fd.x,fd.y,fd.z)}}const hd=new Yr;class nU extends Qr{constructor(e,t=16776960){const i=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]),r=new Float32Array(8*3),s=new lt;s.setIndex(new Bt(i,1)),s.setAttribute("position",new Bt(r,3)),super(s,new $n({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&hd.setFromObject(this.object),hd.isEmpty())return;const t=hd.min,i=hd.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.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 iU extends Qr{constructor(e,t=16776960){const i=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]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new lt;s.setIndex(new Bt(i,1)),s.setAttribute("position",new Be(r,3)),super(s,new $n({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 rU extends vt{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new lt;o.setAttribute("position",new Be(s,3)),o.computeBoundingSphere(),super(o,new $n({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new lt;c.setAttribute("position",new Be(a,3)),c.computeBoundingSphere(),this.add(new Ne(c,new Zr({color:r,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 $w=new N;let dd,n0;class sU extends St{constructor(e=new N(0,0,1),t=new N(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",dd===void 0&&(dd=new lt,dd.setAttribute("position",new Be([0,0,0,0,1,0],3)),n0=new Ln(0,.5,1,5,1),n0.translate(0,-.5,0)),this.position.copy(t),this.line=new vt(dd,new $n({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ne(n0,new Zr({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}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{$w.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle($w,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),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 oU extends Qr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new lt;r.setAttribute("position",new Be(t,3)),r.setAttribute("color",new Be(i,3));const s=new $n({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Re,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class aU{constructor(){this.type="ShapePath",this.color=new Re,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Nc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const x=[];for(let w=0,T=g.length;w<T;w++){const C=g[w],P=new ra;P.curves=C.curves,x.push(P)}return x}function i(g,x){const w=x.length;let T=!1;for(let C=w-1,P=0;P<w;C=P++){let R=x[C],I=x[P],b=I.x-R.x,L=I.y-R.y;if(Math.abs(L)>Number.EPSILON){if(L<0&&(R=x[P],b=-b,I=x[C],L=-L),g.y<R.y||g.y>I.y)continue;if(g.y===R.y){if(g.x===R.x)return!0}else{const H=L*(g.x-R.x)-b*(g.y-R.y);if(H===0)return!0;if(H<0)continue;T=!T}}else{if(g.y!==R.y)continue;if(I.x<=g.x&&g.x<=R.x||R.x<=g.x&&g.x<=I.x)return!0}}return T}const r=Xr.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,c;const f=[];if(s.length===1)return a=s[0],c=new ra,c.curves=a.curves,f.push(c),f;let h=!r(s[0].getPoints());h=e?!h:h;const d=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let g=0,x=s.length;g<x;g++)a=s[g],E=a.getPoints(),o=r(E),o=e?!o:o,o?(!h&&m[_]&&_++,m[_]={s:new ra,p:E},m[_].s.curves=a.curves,h&&_++,v[_]=[]):v[_].push({h:a,p:E[0]});if(!m[0])return t(s);if(m.length>1){let g=!1,x=0;for(let w=0,T=m.length;w<T;w++)d[w]=[];for(let w=0,T=m.length;w<T;w++){const C=v[w];for(let P=0;P<C.length;P++){const R=C[P];let I=!0;for(let b=0;b<m.length;b++)i(R.p,m[b].p)&&(w!==b&&x++,I?(I=!1,d[b].push(R)):g=!0);I&&d[w].push(R)}}x>0&&g===!1&&(v=d)}let S;for(let g=0,x=m.length;g<x;g++){c=m[g].s,f.push(c),S=v[g];for(let w=0,T=S.length;w<T;w++)c.holes.push(S[w].h)}return f}}class lU extends oi{constructor(e,t,i,r,s,o){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,i,r,s,o)}}class uU extends ef{constructor(e,t,i,r){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,i,r)}}class cU extends tf{constructor(e,t,i,r){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,i,r)}}class fU extends nf{constructor(e,t,i,r,s,o,a){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,i,r,s,o,a)}}class hU extends Ln{constructor(e,t,i,r,s,o,a,c){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,i,r,s,o,a,c)}}class dU extends rf{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}class pU extends sf{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class mU extends of{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class gU extends Zl{constructor(e,t,i,r){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,i,r)}}class vU extends Ii{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class yU extends Di{constructor(e,t,i,r){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,i,r)}}class _U extends Ps{constructor(e,t,i,r){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,i,r)}}class xU extends af{constructor(e,t,i,r,s,o){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,i,r,s,o)}}class SU extends lf{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class wU extends ya{constructor(e,t,i,r,s,o,a){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,i,r,s,o,a)}}class MU extends uf{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class EU extends gs{constructor(e,t,i,r,s){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,i,r,s)}}class TU extends cf{constructor(e,t,i,r,s,o){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,i,r,s,o)}}class AU extends ff{constructor(e,t,i,r,s){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,i,r,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Cp}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Cp);const CU=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:jy,AddEquation:Vo,AddOperation:t2,AdditiveAnimationBlendMode:Zy,AdditiveBlending:av,AlphaFormat:f2,AlwaysDepth:qT,AlwaysStencilFunc:C2,AmbientLight:T3,AmbientLightProbe:xz,AnimationAction:I3,AnimationClip:Bc,AnimationLoader:az,AnimationMixer:Oz,AnimationObjectGroup:zz,AnimationUtils:iz,ArcCurve:J2,ArrayCamera:H2,ArrowHelper:sU,Audio:L3,AudioAnalyser:Az,AudioContext:E_,AudioListener:Mz,AudioLoader:yz,AxesHelper:oU,BackSide:li,BasicDepthPacking:E2,BasicShadowMap:NT,Bone:l_,BooleanKeyframeTrack:_a,Box2:Xz,Box3:Yr,Box3Helper:iU,BoxBufferGeometry:lU,BoxGeometry:oi,BoxHelper:nU,BufferAttribute:Bt,BufferGeometry:lt,BufferGeometryLoader:P3,ByteType:o2,Cache:pa,Camera:Jc,CameraHelper:tU,CanvasTexture:Ck,CapsuleBufferGeometry:uU,CapsuleGeometry:ef,CatmullRomCurve3:K2,CineonToneMapping:r2,CircleBufferGeometry:cU,CircleGeometry:tf,ClampToEdgeWrapping:Jn,Clock:T_,Color:Re,ColorKeyframeTrack:S_,ColorManagement:mi,CompressedArrayTexture:Ak,CompressedTexture:c_,CompressedTextureLoader:lz,ConeBufferGeometry:fU,ConeGeometry:nf,CubeCamera:N2,CubeReflectionMapping:fo,CubeRefractionMapping:ho,CubeTexture:Kc,CubeTextureLoader:uz,CubeUVReflectionMapping:jl,CubicBezierCurve:h_,CubicBezierCurve3:$2,CubicInterpolant:v3,CullFaceBack:ov,CullFaceFront:DT,CullFaceFrontBack:EP,CullFaceNone:IT,Curve:br,CurvePath:t3,CustomBlending:kT,CustomToneMapping:s2,CylinderBufferGeometry:hU,CylinderGeometry:Ln,Cylindrical:Wz,Data3DTexture:$y,DataArrayTexture:Rp,DataTexture:Ll,DataTextureLoader:cz,DataUtils:zL,DecrementStencilOp:UP,DecrementWrapStencilOp:FP,DefaultLoadingManager:x3,DepthFormat:lo,DepthStencilFormat:fa,DepthTexture:s_,DirectionalLight:E3,DirectionalLightHelper:eU,DiscreteInterpolant:y3,DisplayP3ColorSpace:Qy,DodecahedronBufferGeometry:dU,DodecahedronGeometry:rf,DoubleSide:nr,DstAlphaFactor:HT,DstColorFactor:WT,DynamicCopyUsage:eL,DynamicDrawUsage:qP,DynamicReadUsage:JP,EdgesGeometry:n3,EllipseCurve:Op,EqualDepth:QT,EqualStencilFunc:GP,EquirectangularReflectionMapping:Tc,EquirectangularRefractionMapping:Ac,Euler:Yl,EventDispatcher:bs,ExtrudeBufferGeometry:pU,ExtrudeGeometry:sf,FileLoader:As,Float16BufferAttribute:HL,Float32BufferAttribute:Be,Float64BufferAttribute:GL,FloatType:Hr,Fog:kp,FogExp2:Np,FramebufferTexture:Tk,FrontSide:Ms,Frustum:Ip,GLBufferAttribute:Hz,GLSL1:nL,GLSL3:kv,GreaterDepth:KT,GreaterEqualDepth:JT,GreaterEqualStencilFunc:YP,GreaterStencilFunc:XP,GridHelper:Kz,Group:Sl,HalfFloatType:ca,HemisphereLight:S3,HemisphereLightHelper:Jz,HemisphereLightProbe:_z,IcosahedronBufferGeometry:mU,IcosahedronGeometry:of,ImageBitmapLoader:vz,ImageLoader:Vc,ImageUtils:Ky,IncrementStencilOp:zP,IncrementWrapStencilOp:OP,InstancedBufferAttribute:Vl,InstancedBufferGeometry:b3,InstancedInterleavedBuffer:Vz,InstancedMesh:q2,Int16BufferAttribute:BL,Int32BufferAttribute:VL,Int8BufferAttribute:UL,IntType:l2,InterleavedBuffer:zp,InterleavedBufferAttribute:ha,Interpolant:hf,InterpolateDiscrete:Pc,InterpolateLinear:Lc,InterpolateSmooth:Dd,InvertStencilOp:BP,KeepStencilOp:Nd,KeyframeTrack:Pr,LOD:j2,LatheBufferGeometry:gU,LatheGeometry:Zl,Layers:ia,LessDepth:ZT,LessEqualDepth:op,LessEqualStencilFunc:WP,LessStencilFunc:HP,Light:_o,LightProbe:Vp,Line:vt,Line3:jz,LineBasicMaterial:$n,LineCurve:Fp,LineCurve3:e3,LineDashedMaterial:m3,LineLoop:Z2,LineSegments:Qr,LinearEncoding:Ts,LinearFilter:en,LinearInterpolant:x_,LinearMipMapLinearFilter:PP,LinearMipMapNearestFilter:bP,LinearMipmapLinearFilter:po,LinearMipmapNearestFilter:Yy,LinearSRGBColorSpace:Ol,LinearToneMapping:n2,Loader:Vi,LoaderUtils:Gv,LoadingManager:w_,LoopOnce:S2,LoopPingPong:M2,LoopRepeat:w2,LuminanceAlphaFormat:d2,LuminanceFormat:h2,MOUSE:wP,Material:Bn,MaterialLoader:Hp,MathUtils:Br,Matrix3:xt,Matrix4:st,MaxEquation:fv,Mesh:Ne,MeshBasicMaterial:Zr,MeshDepthMaterial:i_,MeshDistanceMaterial:r_,MeshLambertMaterial:d3,MeshMatcapMaterial:p3,MeshNormalMaterial:h3,MeshPhongMaterial:c3,MeshPhysicalMaterial:u3,MeshStandardMaterial:v_,MeshToonMaterial:f3,MinEquation:cv,MirroredRepeatWrapping:bc,MixOperation:e2,MultiplyBlending:uv,MultiplyOperation:Zc,NearestFilter:hn,NearestMipMapLinearFilter:CP,NearestMipMapNearestFilter:AP,NearestMipmapLinearFilter:rc,NearestMipmapNearestFilter:ap,NeverDepth:YT,NeverStencilFunc:VP,NoBlending:ys,NoColorSpace:DP,NoToneMapping:Ar,NormalAnimationBlendMode:Lp,NormalBlending:ea,NotEqualDepth:$T,NotEqualStencilFunc:jP,NumberKeyframeTrack:Oc,Object3D:St,ObjectLoader:mz,ObjectSpaceNormalMap:A2,OctahedronBufferGeometry:vU,OctahedronGeometry:Ii,OneFactor:FT,OneMinusDstAlphaFactor:GT,OneMinusDstColorFactor:XT,OneMinusSrcAlphaFactor:Xy,OneMinusSrcColorFactor:VT,OrthographicCamera:$c,PCFShadowMap:bp,PCFSoftShadowMap:ic,PMREMGenerator:Uv,Path:Nc,PerspectiveCamera:In,Plane:Ys,PlaneBufferGeometry:yU,PlaneGeometry:Di,PlaneHelper:rU,PointLight:M3,PointLightHelper:Zz,Points:Q2,PointsMaterial:u_,PolarGridHelper:$z,PolyhedronBufferGeometry:_U,PolyhedronGeometry:Ps,PositionalAudio:Tz,PropertyBinding:Tt,PropertyMixer:R3,QuadraticBezierCurve:d_,QuadraticBezierCurve3:p_,Quaternion:It,QuaternionKeyframeTrack:Ql,QuaternionLinearInterpolant:_3,RED_GREEN_RGTC2_Format:Dv,RED_RGTC1_Format:x2,REVISION:Cp,RGBADepthPacking:T2,RGBAFormat:_i,RGBAIntegerFormat:y2,RGBA_ASTC_10x10_Format:Pv,RGBA_ASTC_10x5_Format:Av,RGBA_ASTC_10x6_Format:Cv,RGBA_ASTC_10x8_Format:bv,RGBA_ASTC_12x10_Format:Lv,RGBA_ASTC_12x12_Format:Rv,RGBA_ASTC_4x4_Format:yv,RGBA_ASTC_5x4_Format:_v,RGBA_ASTC_5x5_Format:xv,RGBA_ASTC_6x5_Format:Sv,RGBA_ASTC_6x6_Format:wv,RGBA_ASTC_8x5_Format:Mv,RGBA_ASTC_8x6_Format:Ev,RGBA_ASTC_8x8_Format:Tv,RGBA_BPTC_Format:Id,RGBA_ETC2_EAC_Format:vv,RGBA_PVRTC_2BPPV1_Format:mv,RGBA_PVRTC_4BPPV1_Format:pv,RGBA_S3TC_DXT1_Format:Pd,RGBA_S3TC_DXT3_Format:Ld,RGBA_S3TC_DXT5_Format:Rd,RGB_ETC1_Format:_2,RGB_ETC2_Format:gv,RGB_PVRTC_2BPPV1_Format:dv,RGB_PVRTC_4BPPV1_Format:hv,RGB_S3TC_DXT1_Format:bd,RGFormat:g2,RGIntegerFormat:v2,RawShaderMaterial:l3,Ray:Qc,Raycaster:P_,RectAreaLight:A3,RedFormat:p2,RedIntegerFormat:m2,ReinhardToneMapping:i2,RepeatWrapping:Cc,ReplaceStencilOp:kP,ReverseSubtractEquation:UT,RingBufferGeometry:xU,RingGeometry:af,SIGNED_RED_GREEN_RGTC2_Format:Nv,SIGNED_RED_RGTC1_Format:Iv,SRGBColorSpace:Sr,Scene:up,ShaderChunk:ht,ShaderLib:Mr,ShaderMaterial:jr,ShadowMaterial:a3,Shape:ra,ShapeBufferGeometry:SU,ShapeGeometry:lf,ShapePath:aU,ShapeUtils:Xr,ShortType:a2,Skeleton:Up,SkeletonHelper:qz,SkinnedMesh:Y2,Source:Zo,Sphere:qr,SphereBufferGeometry:wU,SphereGeometry:ya,Spherical:Gz,SphericalHarmonics3:C3,SplineCurve:m_,SpotLight:w3,SpotLightHelper:Yz,Sprite:X2,SpriteMaterial:a_,SrcAlphaFactor:Wy,SrcAlphaSaturateFactor:jT,SrcColorFactor:BT,StaticCopyUsage:$P,StaticDrawUsage:Ic,StaticReadUsage:QP,StereoCamera:Sz,StreamCopyUsage:tL,StreamDrawUsage:ZP,StreamReadUsage:KP,StringKeyframeTrack:xa,SubtractEquation:zT,SubtractiveBlending:lv,TOUCH:MP,TangentSpaceNormalMap:yo,TetrahedronBufferGeometry:MU,TetrahedronGeometry:uf,Texture:un,TextureLoader:fz,TorusBufferGeometry:EU,TorusGeometry:gs,TorusKnotBufferGeometry:TU,TorusKnotGeometry:cf,Triangle:yi,TriangleFanDrawMode:IP,TriangleStripDrawMode:RP,TrianglesDrawMode:LP,TubeBufferGeometry:AU,TubeGeometry:ff,TwoPassDoubleSide:TP,UVMapping:Pp,Uint16BufferAttribute:e_,Uint32BufferAttribute:t_,Uint8BufferAttribute:OL,Uint8ClampedBufferAttribute:FL,Uniform:b_,UniformsGroup:Bz,UniformsLib:Ae,UniformsUtils:D2,UnsignedByteType:Es,UnsignedInt248Type:ta,UnsignedIntType:$s,UnsignedShort4444Type:u2,UnsignedShort5551Type:c2,UnsignedShortType:qy,VSMShadowMap:jo,Vector2:ge,Vector3:N,Vector4:Nt,VectorKeyframeTrack:Fc,VideoTexture:Ek,WebGL1Renderer:G2,WebGL3DRenderTarget:TL,WebGLArrayRenderTarget:EL,WebGLCubeRenderTarget:k2,WebGLMultipleRenderTargets:AL,WebGLRenderTarget:ar,WebGLRenderer:o_,WebGLUtils:V2,WireframeGeometry:o3,WrapAroundEnding:Rc,ZeroCurvatureEnding:Yo,ZeroFactor:OT,ZeroSlopeEnding:qo,ZeroStencilOp:NP,_SRGBAFormat:lp,sRGBEncoding:Ot},Symbol.toStringTag,{value:"Module"}));var Jo={exports:{}},Sa={};/**
* @license React
* react-reconciler-constants.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/Sa.ConcurrentRoot=1;Sa.ContinuousEventPriority=4;Sa.DefaultEventPriority=16;Sa.DiscreteEventPriority=1;Sa.IdleEventPriority=536870912;Sa.LegacyRoot=0;(function(n){n.exports=Sa})(Jo);function bU(n){let e;const t=new Set,i=(f,h)=>{const d=typeof f=="function"?f(e):f;if(d!==e){const m=e;e=h?d:Object.assign({},e,d),t.forEach(v=>v(e,m))}},r=()=>e,s=(f,h=r,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=h(e);function v(){const _=h(e);if(!d(m,_)){const E=m;f(m=_,E)}}return t.add(v),()=>t.delete(v)},c={setState:i,getState:r,subscribe:(f,h,d)=>h||d?s(f,h,d):(t.add(f),()=>t.delete(f)),destroy:()=>t.clear()};return e=n(i,r,c),c}const PU=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),eM=PU?Te.exports.useEffect:Te.exports.useLayoutEffect;function LU(n){const e=typeof n=="function"?bU(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=Te.exports.useReducer(S=>S+1,0),o=e.getState(),a=Te.exports.useRef(o),c=Te.exports.useRef(i),f=Te.exports.useRef(r),h=Te.exports.useRef(!1),d=Te.exports.useRef();d.current===void 0&&(d.current=i(o));let m,v=!1;(a.current!==o||c.current!==i||f.current!==r||h.current)&&(m=i(o),v=!r(d.current,m)),eM(()=>{v&&(d.current=m),a.current=o,c.current=i,f.current=r,h.current=!1});const _=Te.exports.useRef(o);eM(()=>{const S=()=>{try{const x=e.getState(),w=c.current(x);f.current(d.current,w)||(a.current=x,d.current=w,s())}catch{h.current=!0,s()}},g=e.subscribe(S);return e.getState()!==_.current&&S(),g},[]);const E=v?m:d.current;return Te.exports.useDebugValue(E),E};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}var N3={exports:{}},i0={exports:{}},r0={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var tM;function RU(){return tM||(tM=1,function(n){function e(D,V){var B=D.length;D.push(V);e:for(;0<B;){var J=B-1>>>1,Y=D[J];if(0<r(Y,V))D[J]=V,D[B]=Y,B=J;else break e}}function t(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var V=D[0],B=D.pop();if(B!==V){D[0]=B;e:for(var J=0,Y=D.length,K=Y>>>1;J<K;){var z=2*(J+1)-1,ye=D[z],pe=z+1,Q=D[pe];if(0>r(ye,B))pe<Y&&0>r(Q,ye)?(D[J]=Q,D[pe]=B,J=pe):(D[J]=ye,D[z]=B,J=z);else if(pe<Y&&0>r(Q,B))D[J]=Q,D[pe]=B,J=pe;else break e}}return V}function r(D,V){var B=D.sortIndex-V.sortIndex;return B!==0?B:D.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var c=[],f=[],h=1,d=null,m=3,v=!1,_=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(D){for(var V=t(f);V!==null;){if(V.callback===null)i(f);else if(V.startTime<=D)i(f),V.sortIndex=V.expirationTime,e(c,V);else break;V=t(f)}}function T(D){if(E=!1,w(D),!_)if(t(c)!==null)_=!0,oe(C);else{var V=t(f);V!==null&&ue(T,V.startTime-D)}}function C(D,V){_=!1,E&&(E=!1,g(I),I=-1),v=!0;var B=m;try{for(w(V),d=t(c);d!==null&&(!(d.expirationTime>V)||D&&!H());){var J=d.callback;if(typeof J=="function"){d.callback=null,m=d.priorityLevel;var Y=J(d.expirationTime<=V);V=n.unstable_now(),typeof Y=="function"?d.callback=Y:d===t(c)&&i(c),w(V)}else i(c);d=t(c)}if(d!==null)var K=!0;else{var z=t(f);z!==null&&ue(T,z.startTime-V),K=!1}return K}finally{d=null,m=B,v=!1}}var P=!1,R=null,I=-1,b=5,L=-1;function H(){return!(n.unstable_now()-L<b)}function q(){if(R!==null){var D=n.unstable_now();L=D;var V=!0;try{V=R(!0,D)}finally{V?G():(P=!1,R=null)}}else P=!1}var G;if(typeof x=="function")G=function(){x(q)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,ee=W.port2;W.port1.onmessage=q,G=function(){ee.postMessage(null)}}else G=function(){S(q,0)};function oe(D){R=D,P||(P=!0,G())}function ue(D,V){I=S(function(){D(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){_||v||(_=!0,oe(C))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_getFirstCallbackNode=function(){return t(c)},n.unstable_next=function(D){switch(m){case 1:case 2:case 3:var V=3;break;default:V=m}var B=m;m=V;try{return D()}finally{m=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,V){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var B=m;m=D;try{return V()}finally{m=B}},n.unstable_scheduleCallback=function(D,V,B){var J=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?J+B:J):B=J,D){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=B+Y,D={id:h++,callback:V,priorityLevel:D,startTime:B,expirationTime:Y,sortIndex:-1},B>J?(D.sortIndex=B,e(f,D),t(c)===null&&D===t(f)&&(E?(g(I),I=-1):E=!0,ue(T,B-J))):(D.sortIndex=Y,e(c,D),_||v||(_=!0,oe(C))),D},n.unstable_shouldYield=H,n.unstable_wrapCallback=function(D){var V=m;return function(){var B=m;m=V;try{return D.apply(this,arguments)}finally{m=B}}}}(r0)),r0}var nM;function IU(){return nM||(nM=1,function(n){n.exports=RU()}(i0)),i0.exports}/**
* @license React
* react-reconciler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var DU=function(e){var t={},i=Te.exports,r=IU(),s=Object.assign;function o(l){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p<arguments.length;p++)u+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,c=Symbol.for("react.element"),f=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),_=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),C=Symbol.iterator;function P(l){return l===null||typeof l!="object"?null:(l=C&&l[C]||l["@@iterator"],typeof l=="function"?l:null)}function R(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case h:return"Fragment";case f:return"Portal";case m:return"Profiler";case d:return"StrictMode";case S:return"Suspense";case g:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case _:return(l.displayName||"Context")+".Consumer";case v:return(l._context.displayName||"Context")+".Provider";case E:var u=l.render;return l=l.displayName,l||(l=u.displayName||u.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case x:return u=l.displayName||null,u!==null?u:R(l.type)||"Memo";case w:u=l._payload,l=l._init;try{return R(l(u))}catch{}}return null}function I(l){var u=l.type;switch(l.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=u.render,l=l.displayName||l.name||"",u.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return R(u);case 8:return u===d?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function b(l){var u=l,p=l;if(l.alternate)for(;u.return;)u=u.return;else{l=u;do u=l,(u.flags&4098)!==0&&(p=u.return),l=u.return;while(l)}return u.tag===3?p:null}function L(l){if(b(l)!==l)throw Error(o(188))}function H(l){var u=l.alternate;if(!u){if(u=b(l),u===null)throw Error(o(188));return u!==l?null:l}for(var p=l,y=u;;){var M=p.return;if(M===null)break;var A=M.alternate;if(A===null){if(y=M.return,y!==null){p=y;continue}break}if(M.child===A.child){for(A=M.child;A;){if(A===p)return L(M),l;if(A===y)return L(M),u;A=A.sibling}throw Error(o(188))}if(p.return!==y.return)p=M,y=A;else{for(var O=!1,j=M.child;j;){if(j===p){O=!0,p=M,y=A;break}if(j===y){O=!0,y=M,p=A;break}j=j.sibling}if(!O){for(j=A.child;j;){if(j===p){O=!0,p=A,y=M;break}if(j===y){O=!0,y=A,p=M;break}j=j.sibling}if(!O)throw Error(o(189))}}if(p.alternate!==y)throw Error(o(190))}if(p.tag!==3)throw Error(o(188));return p.stateNode.current===p?l:u}function q(l){return l=H(l),l!==null?G(l):null}function G(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var u=G(l);if(u!==null)return u;l=l.sibling}return null}function W(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){if(l.tag!==4){var u=W(l);if(u!==null)return u}l=l.sibling}return null}var ee=Array.isArray,oe=e.getPublicInstance,ue=e.getRootHostContext,D=e.getChildHostContext,V=e.prepareForCommit,B=e.resetAfterCommit,J=e.createInstance,Y=e.appendInitialChild,K=e.finalizeInitialChildren,z=e.prepareUpdate,ye=e.shouldSetTextContent,pe=e.createTextInstance,Q=e.scheduleTimeout,Qe=e.cancelTimeout,je=e.noTimeout,Me=e.isPrimaryRenderer,De=e.supportsMutation,me=e.supportsPersistence,se=e.supportsHydration,ve=e.getInstanceFromNode,Ue=e.preparePortalMount,Ce=e.getCurrentEventPriority,Ke=e.detachDeletedInstance,$e=e.supportsMicrotasks,Ye=e.scheduleMicrotask,rt=e.supportsTestSelectors,Et=e.findFiberRoot,F=e.getBoundingRect,k=e.getTextContent,ie=e.isHiddenSubtree,_e=e.matchAccessibilityRole,Se=e.setFocusIfFocusable,be=e.setupIntersectionObserver,tt=e.appendChild,ke=e.appendChildToContainer,he=e.commitTextUpdate,Ve=e.commitMount,qe=e.commitUpdate,et=e.insertBefore,Oe=e.insertInContainerBefore,Ge=e.removeChild,wt=e.removeChildFromContainer,Lt=e.resetTextContent,Jt=e.hideInstance,X=e.hideTextInstance,fe=e.unhideInstance,xe=e.unhideTextInstance,Ie=e.clearContainer,We=e.cloneInstance,zt=e.createContainerChildSet,Vt=e.appendChildToContainerChildSet,Tn=e.finalizeContainerChildren,lr=e.replaceContainerChildren,Yt=e.cloneHiddenInstance,ei=e.cloneHiddenTextInstance,Hi=e.canHydrateInstance,wa=e.canHydrateTextInstance,pf=e.canHydrateSuspenseInstance,mf=e.isSuspenseInstancePending,eu=e.isSuspenseInstanceFallback,Zp=e.registerSuspenseInstanceRetry,U=e.getNextHydratableSibling,ne=e.getFirstHydratableChild,ce=e.getFirstHydratableChildWithinContainer,$=e.getFirstHydratableChildWithinSuspenseInstance,de=e.hydrateInstance,Ze=e.hydrateTextInstance,nt=e.hydrateSuspenseInstance,it=e.getNextHydratableInstanceAfterSuspenseInstance,ut=e.commitHydratedContainer,pt=e.commitHydratedSuspenseInstance,mt=e.clearSuspenseBoundary,yt=e.clearSuspenseBoundaryFromContainer,Rt=e.shouldDeleteUnhydratedTailInstances,Nn=e.didNotMatchHydratedContainerTextInstance,Ei=e.didNotMatchHydratedTextInstance,ur;function Ht(l){if(ur===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);ur=u&&u[1]||""}return`
`+ur+l}var _t=!1;function xo(l,u){if(!l||_t)return"";_t=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(Ee){var y=Ee}Reflect.construct(l,[],u)}else{try{u.call()}catch(Ee){y=Ee}l.call(u.prototype)}else{try{throw Error()}catch(Ee){y=Ee}l()}}catch(Ee){if(Ee&&y&&typeof Ee.stack=="string"){for(var M=Ee.stack.split(`
`),A=y.stack.split(`
`),O=M.length-1,j=A.length-1;1<=O&&0<=j&&M[O]!==A[j];)j--;for(;1<=O&&0<=j;O--,j--)if(M[O]!==A[j]){if(O!==1||j!==1)do if(O--,j--,0>j||M[O]!==A[j]){var ae=`
`+M[O].replace(" at new "," at ");return l.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",l.displayName)),ae}while(1<=O&&0<=j);break}}}finally{_t=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?Ht(l):""}var pn=Object.prototype.hasOwnProperty,cr=[],Jr=-1;function fi(l){return{current:l}}function Dt(l){0>Jr||(l.current=cr[Jr],cr[Jr]=null,Jr--)}function ct(l,u){Jr++,cr[Jr]=l.current,l.current=u}var Vn={},mn=fi(Vn),Ut=fi(!1),fr=Vn;function Ls(l,u){var p=l.type.contextTypes;if(!p)return Vn;var y=l.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===u)return y.__reactInternalMemoizedMaskedChildContext;var M={},A;for(A in p)M[A]=u[A];return y&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=u,l.__reactInternalMemoizedMaskedChildContext=M),M}function kn(l){return l=l.childContextTypes,l!=null}function gf(){Dt(Ut),Dt(mn)}function V_(l,u,p){if(mn.current!==Vn)throw Error(o(168));ct(mn,u),ct(Ut,p)}function H_(l,u,p){var y=l.stateNode;if(u=u.childContextTypes,typeof y.getChildContext!="function")return p;y=y.getChildContext();for(var M in y)if(!(M in u))throw Error(o(108,I(l)||"Unknown",M));return s({},p,y)}function vf(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Vn,fr=mn.current,ct(mn,l),ct(Ut,Ut.current),!0}function G_(l,u,p){var y=l.stateNode;if(!y)throw Error(o(169));p?(l=H_(l,u,fr),y.__reactInternalMemoizedMergedChildContext=l,Dt(Ut),Dt(mn),ct(mn,l)):Dt(Ut),ct(Ut,p)}var hr=Math.clz32?Math.clz32:mA,dA=Math.log,pA=Math.LN2;function mA(l){return l>>>=0,l===0?32:31-(dA(l)/pA|0)|0}var yf=64,_f=4194304;function tu(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function xf(l,u){var p=l.pendingLanes;if(p===0)return 0;var y=0,M=l.suspendedLanes,A=l.pingedLanes,O=p&268435455;if(O!==0){var j=O&~M;j!==0?y=tu(j):(A&=O,A!==0&&(y=tu(A)))}else O=p&~M,O!==0?y=tu(O):A!==0&&(y=tu(A));if(y===0)return 0;if(u!==0&&u!==y&&(u&M)===0&&(M=y&-y,A=u&-u,M>=A||M===16&&(A&4194240)!==0))return u;if((y&4)!==0&&(y|=p&16),u=l.entangledLanes,u!==0)for(l=l.entanglements,u&=y;0<u;)p=31-hr(u),M=1<<p,y|=l[p],u&=~M;return y}function gA(l,u){switch(l){case 1:case 2:case 4:return u+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vA(l,u){for(var p=l.suspendedLanes,y=l.pingedLanes,M=l.expirationTimes,A=l.pendingLanes;0<A;){var O=31-hr(A),j=1<<O,ae=M[O];ae===-1?((j&p)===0||(j&y)!==0)&&(M[O]=gA(j,u)):ae<=u&&(l.expiredLanes|=j),A&=~j}}function Qp(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Jp(l){for(var u=[],p=0;31>p;p++)u.push(l);return u}function nu(l,u,p){l.pendingLanes|=u,u!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,u=31-hr(u),l[u]=p}function yA(l,u){var p=l.pendingLanes&~u;l.pendingLanes=u,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=u,l.mutableReadLanes&=u,l.entangledLanes&=u,u=l.entanglements;var y=l.eventTimes;for(l=l.expirationTimes;0<p;){var M=31-hr(p),A=1<<M;u[M]=0,y[M]=-1,l[M]=-1,p&=~A}}function Kp(l,u){var p=l.entangledLanes|=u;for(l=l.entanglements;p;){var y=31-hr(p),M=1<<y;M&u|l[y]&u&&(l[y]|=u),p&=~M}}var Ct=0;function W_(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var $p=r.unstable_scheduleCallback,X_=r.unstable_cancelCallback,_A=r.unstable_shouldYield,xA=r.unstable_requestPaint,An=r.unstable_now,em=r.unstable_ImmediatePriority,SA=r.unstable_UserBlockingPriority,tm=r.unstable_NormalPriority,wA=r.unstable_IdlePriority,Sf=null,Lr=null;function MA(l){if(Lr&&typeof Lr.onCommitFiberRoot=="function")try{Lr.onCommitFiberRoot(Sf,l,void 0,(l.current.flags&128)===128)}catch{}}function EA(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var Rr=typeof Object.is=="function"?Object.is:EA,Kr=null,wf=!1,nm=!1;function j_(l){Kr===null?Kr=[l]:Kr.push(l)}function TA(l){wf=!0,j_(l)}function Ir(){if(!nm&&Kr!==null){nm=!0;var l=0,u=Ct;try{var p=Kr;for(Ct=1;l<p.length;l++){var y=p[l];do y=y(!0);while(y!==null)}Kr=null,wf=!1}catch(M){throw Kr!==null&&(Kr=Kr.slice(l+1)),$p(em,Ir),M}finally{Ct=u,nm=!1}}return null}var AA=a.ReactCurrentBatchConfig;function Mf(l,u){if(Rr(l,u))return!0;if(typeof l!="object"||l===null||typeof u!="object"||u===null)return!1;var p=Object.keys(l),y=Object.keys(u);if(p.length!==y.length)return!1;for(y=0;y<p.length;y++){var M=p[y];if(!pn.call(u,M)||!Rr(l[M],u[M]))return!1}return!0}function CA(l){switch(l.tag){case 5:return Ht(l.type);case 16:return Ht("Lazy");case 13:return Ht("Suspense");case 19:return Ht("SuspenseList");case 0:case 2:case 15:return l=xo(l.type,!1),l;case 11:return l=xo(l.type.render,!1),l;case 1:return l=xo(l.type,!0),l;default:return""}}function dr(l,u){if(l&&l.defaultProps){u=s({},u),l=l.defaultProps;for(var p in l)u[p]===void 0&&(u[p]=l[p]);return u}return u}var Ef=fi(null),Tf=null,Ma=null,im=null;function rm(){im=Ma=Tf=null}function Y_(l,u,p){Me?(ct(Ef,u._currentValue),u._currentValue=p):(ct(Ef,u._currentValue2),u._currentValue2=p)}function sm(l){var u=Ef.current;Dt(Ef),Me?l._currentValue=u:l._currentValue2=u}function om(l,u,p){for(;l!==null;){var y=l.alternate;if((l.childLanes&u)!==u?(l.childLanes|=u,y!==null&&(y.childLanes|=u)):y!==null&&(y.childLanes&u)!==u&&(y.childLanes|=u),l===p)break;l=l.return}}function Ea(l,u){Tf=l,im=Ma=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&u)!==0&&(Ci=!0),l.firstContext=null)}function Gi(l){var u=Me?l._currentValue:l._currentValue2;if(im!==l)if(l={context:l,memoizedValue:u,next:null},Ma===null){if(Tf===null)throw Error(o(308));Ma=l,Tf.dependencies={lanes:0,firstContext:l}}else Ma=Ma.next=l;return u}var Dr=null,Rs=!1;function am(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function q_(l,u){l=l.updateQueue,u.updateQueue===l&&(u.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function $r(l,u){return{eventTime:l,lane:u,tag:0,payload:null,callback:null,next:null}}function Is(l,u){var p=l.updateQueue;p!==null&&(p=p.shared,gn!==null&&(l.mode&1)!==0&&(gt&2)===0?(l=p.interleaved,l===null?(u.next=u,Dr===null?Dr=[p]:Dr.push(p)):(u.next=l.next,l.next=u),p.interleaved=u):(l=p.pending,l===null?u.next=u:(u.next=l.next,l.next=u),p.pending=u))}function Af(l,u,p){if(u=u.updateQueue,u!==null&&(u=u.shared,(p&4194240)!==0)){var y=u.lanes;y&=l.pendingLanes,p|=y,u.lanes=p,Kp(l,p)}}function Z_(l,u){var p=l.updateQueue,y=l.alternate;if(y!==null&&(y=y.updateQueue,p===y)){var M=null,A=null;if(p=p.firstBaseUpdate,p!==null){do{var O={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};A===null?M=A=O:A=A.next=O,p=p.next}while(p!==null);A===null?M=A=u:A=A.next=u}else M=A=u;p={baseState:y.baseState,firstBaseUpdate:M,lastBaseUpdate:A,shared:y.shared,effects:y.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=u}function Cf(l,u,p,y){var M=l.updateQueue;Rs=!1;var A=M.firstBaseUpdate,O=M.lastBaseUpdate,j=M.shared.pending;if(j!==null){M.shared.pending=null;var ae=j,Ee=ae.next;ae.next=null,O===null?A=Ee:O.next=Ee,O=ae;var Fe=l.alternate;Fe!==null&&(Fe=Fe.updateQueue,j=Fe.lastBaseUpdate,j!==O&&(j===null?Fe.firstBaseUpdate=Ee:j.next=Ee,Fe.lastBaseUpdate=ae))}if(A!==null){var ot=M.baseState;O=0,Fe=Ee=ae=null,j=A;do{var Je=j.lane,Ft=j.eventTime;if((y&Je)===Je){Fe!==null&&(Fe=Fe.next={eventTime:Ft,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var Xe=l,Xn=j;switch(Je=u,Ft=p,Xn.tag){case 1:if(Xe=Xn.payload,typeof Xe=="function"){ot=Xe.call(Ft,ot,Je);break e}ot=Xe;break e;case 3:Xe.flags=Xe.flags&-65537|128;case 0:if(Xe=Xn.payload,Je=typeof Xe=="function"?Xe.call(Ft,ot,Je):Xe,Je==null)break e;ot=s({},ot,Je);break e;case 2:Rs=!0}}j.callback!==null&&j.lane!==0&&(l.flags|=64,Je=M.effects,Je===null?M.effects=[j]:Je.push(j))}else Ft={eventTime:Ft,lane:Je,tag:j.tag,payload:j.payload,callback:j.callback,next:null},Fe===null?(Ee=Fe=Ft,ae=ot):Fe=Fe.next=Ft,O|=Je;if(j=j.next,j===null){if(j=M.shared.pending,j===null)break;Je=j,j=Je.next,Je.next=null,M.lastBaseUpdate=Je,M.shared.pending=null}}while(1);if(Fe===null&&(ae=ot),M.baseState=ae,M.firstBaseUpdate=Ee,M.lastBaseUpdate=Fe,u=M.shared.interleaved,u!==null){M=u;do O|=M.lane,M=M.next;while(M!==u)}else A===null&&(M.shared.lanes=0);Da|=O,l.lanes=O,l.memoizedState=ot}}function Q_(l,u,p){if(l=u.effects,u.effects=null,l!==null)for(u=0;u<l.length;u++){var y=l[u],M=y.callback;if(M!==null){if(y.callback=null,y=p,typeof M!="function")throw Error(o(191,M));M.call(y)}}}var J_=new i.Component().refs;function lm(l,u,p,y){u=l.memoizedState,p=p(y,u),p=p==null?u:s({},u,p),l.memoizedState=p,l.lanes===0&&(l.updateQueue.baseState=p)}var bf={isMounted:function(l){return(l=l._reactInternals)?b(l)===l:!1},enqueueSetState:function(l,u,p){l=l._reactInternals;var y=ni(),M=ks(l),A=$r(y,M);A.payload=u,p!=null&&(A.callback=p),Is(l,A),u=qi(l,M,y),u!==null&&Af(u,l,M)},enqueueReplaceState:function(l,u,p){l=l._reactInternals;var y=ni(),M=ks(l),A=$r(y,M);A.tag=1,A.payload=u,p!=null&&(A.callback=p),Is(l,A),u=qi(l,M,y),u!==null&&Af(u,l,M)},enqueueForceUpdate:function(l,u){l=l._reactInternals;var p=ni(),y=ks(l),M=$r(p,y);M.tag=2,u!=null&&(M.callback=u),Is(l,M),u=qi(l,y,p),u!==null&&Af(u,l,y)}};function K_(l,u,p,y,M,A,O){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(y,A,O):u.prototype&&u.prototype.isPureReactComponent?!Mf(p,y)||!Mf(M,A):!0}function $_(l,u,p){var y=!1,M=Vn,A=u.contextType;return typeof A=="object"&&A!==null?A=Gi(A):(M=kn(u)?fr:mn.current,y=u.contextTypes,A=(y=y!=null)?Ls(l,M):Vn),u=new u(p,A),l.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=bf,l.stateNode=u,u._reactInternals=l,y&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=M,l.__reactInternalMemoizedMaskedChildContext=A),u}function ex(l,u,p,y){l=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(p,y),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(p,y),u.state!==l&&bf.enqueueReplaceState(u,u.state,null)}function um(l,u,p,y){var M=l.stateNode;M.props=p,M.state=l.memoizedState,M.refs=J_,am(l);var A=u.contextType;typeof A=="object"&&A!==null?M.context=Gi(A):(A=kn(u)?fr:mn.current,M.context=Ls(l,A)),M.state=l.memoizedState,A=u.getDerivedStateFromProps,typeof A=="function"&&(lm(l,u,A,p),M.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(u=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),u!==M.state&&bf.enqueueReplaceState(M,M.state,null),Cf(l,p,M,y),M.state=l.memoizedState),typeof M.componentDidMount=="function"&&(l.flags|=4194308)}var Ta=[],Aa=0,Pf=null,Lf=0,Wi=[],Xi=0,So=null,es=1,ts="";function wo(l,u){Ta[Aa++]=Lf,Ta[Aa++]=Pf,Pf=l,Lf=u}function tx(l,u,p){Wi[Xi++]=es,Wi[Xi++]=ts,Wi[Xi++]=So,So=l;var y=es;l=ts;var M=32-hr(y)-1;y&=~(1<<M),p+=1;var A=32-hr(u)+M;if(30<A){var O=M-M%5;A=(y&(1<<O)-1).toString(32),y>>=O,M-=O,es=1<<32-hr(u)+M|p<<M|y,ts=A+l}else es=1<<A|p<<M|y,ts=l}function cm(l){l.return!==null&&(wo(l,1),tx(l,1,0))}function fm(l){for(;l===Pf;)Pf=Ta[--Aa],Ta[Aa]=null,Lf=Ta[--Aa],Ta[Aa]=null;for(;l===So;)So=Wi[--Xi],Wi[Xi]=null,ts=Wi[--Xi],Wi[Xi]=null,es=Wi[--Xi],Wi[Xi]=null}var Ti=null,Ai=null,qt=!1,iu=!1,pr=null;function nx(l,u){var p=Zi(5,null,null,0);p.elementType="DELETED",p.stateNode=u,p.return=l,u=l.deletions,u===null?(l.deletions=[p],l.flags|=16):u.push(p)}function ix(l,u){switch(l.tag){case 5:return u=Hi(u,l.type,l.pendingProps),u!==null?(l.stateNode=u,Ti=l,Ai=ne(u),!0):!1;case 6:return u=wa(u,l.pendingProps),u!==null?(l.stateNode=u,Ti=l,Ai=null,!0):!1;case 13:if(u=pf(u),u!==null){var p=So!==null?{id:es,overflow:ts}:null;return l.memoizedState={dehydrated:u,treeContext:p,retryLane:1073741824},p=Zi(18,null,null,0),p.stateNode=u,p.return=l,l.child=p,Ti=l,Ai=null,!0}return!1;default:return!1}}function hm(l){return(l.mode&1)!==0&&(l.flags&128)===0}function dm(l){if(qt){var u=Ai;if(u){var p=u;if(!ix(l,u)){if(hm(l))throw Error(o(418));u=U(p);var y=Ti;u&&ix(l,u)?nx(y,p):(l.flags=l.flags&-4097|2,qt=!1,Ti=l)}}else{if(hm(l))throw Error(o(418));l.flags=l.flags&-4097|2,qt=!1,Ti=l}}}function rx(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;Ti=l}function ru(l){if(!se||l!==Ti)return!1;if(!qt)return rx(l),qt=!0,!1;if(l.tag!==3&&(l.tag!==5||Rt(l.type)&&!ye(l.type,l.memoizedProps))){var u=Ai;if(u){if(hm(l)){for(l=Ai;l;)l=U(l);throw Error(o(418))}for(;u;)nx(l,u),u=U(u)}}if(rx(l),l.tag===13){if(!se)throw Error(o(316));if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(o(317));Ai=it(l)}else Ai=Ti?U(l.stateNode):null;return!0}function Ca(){se&&(Ai=Ti=null,iu=qt=!1)}function pm(l){pr===null?pr=[l]:pr.push(l)}function su(l,u,p){if(l=p.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(o(309));var y=p.stateNode}if(!y)throw Error(o(147,l));var M=y,A=""+l;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===A?u.ref:(u=function(O){var j=M.refs;j===J_&&(j=M.refs={}),O===null?delete j[A]:j[A]=O},u._stringRef=A,u)}if(typeof l!="string")throw Error(o(284));if(!p._owner)throw Error(o(290,l))}return l}function Rf(l,u){throw l=Object.prototype.toString.call(u),Error(o(31,l==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":l))}function sx(l){var u=l._init;return u(l._payload)}function ox(l){function u(te,Z){if(l){var re=te.deletions;re===null?(te.deletions=[Z],te.flags|=16):re.push(Z)}}function p(te,Z){if(!l)return null;for(;Z!==null;)u(te,Z),Z=Z.sibling;return null}function y(te,Z){for(te=new Map;Z!==null;)Z.key!==null?te.set(Z.key,Z):te.set(Z.index,Z),Z=Z.sibling;return te}function M(te,Z){return te=Us(te,Z),te.index=0,te.sibling=null,te}function A(te,Z,re){return te.index=re,l?(re=te.alternate,re!==null?(re=re.index,re<Z?(te.flags|=2,Z):re):(te.flags|=2,Z)):(te.flags|=1048576,Z)}function O(te){return l&&te.alternate===null&&(te.flags|=2),te}function j(te,Z,re,Le){return Z===null||Z.tag!==6?(Z=Jm(re,te.mode,Le),Z.return=te,Z):(Z=M(Z,re),Z.return=te,Z)}function ae(te,Z,re,Le){var He=re.type;return He===h?Fe(te,Z,re.props.children,Le,re.key):Z!==null&&(Z.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===w&&sx(He)===Z.type)?(Le=M(Z,re.props),Le.ref=su(te,Z,re),Le.return=te,Le):(Le=lh(re.type,re.key,re.props,null,te.mode,Le),Le.ref=su(te,Z,re),Le.return=te,Le)}function Ee(te,Z,re,Le){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==re.containerInfo||Z.stateNode.implementation!==re.implementation?(Z=Km(re,te.mode,Le),Z.return=te,Z):(Z=M(Z,re.children||[]),Z.return=te,Z)}function Fe(te,Z,re,Le,He){return Z===null||Z.tag!==7?(Z=Po(re,te.mode,Le,He),Z.return=te,Z):(Z=M(Z,re),Z.return=te,Z)}function ot(te,Z,re){if(typeof Z=="string"&&Z!==""||typeof Z=="number")return Z=Jm(""+Z,te.mode,re),Z.return=te,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case c:return re=lh(Z.type,Z.key,Z.props,null,te.mode,re),re.ref=su(te,null,Z),re.return=te,re;case f:return Z=Km(Z,te.mode,re),Z.return=te,Z;case w:var Le=Z._init;return ot(te,Le(Z._payload),re)}if(ee(Z)||P(Z))return Z=Po(Z,te.mode,re,null),Z.return=te,Z;Rf(te,Z)}return null}function Je(te,Z,re,Le){var He=Z!==null?Z.key:null;if(typeof re=="string"&&re!==""||typeof re=="number")return He!==null?null:j(te,Z,""+re,Le);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case c:return re.key===He?ae(te,Z,re,Le):null;case f:return re.key===He?Ee(te,Z,re,Le):null;case w:return He=re._init,Je(te,Z,He(re._payload),Le)}if(ee(re)||P(re))return He!==null?null:Fe(te,Z,re,Le,null);Rf(te,re)}return null}function Ft(te,Z,re,Le,He){if(typeof Le=="string"&&Le!==""||typeof Le=="number")return te=te.get(re)||null,j(Z,te,""+Le,He);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case c:return te=te.get(Le.key===null?re:Le.key)||null,ae(Z,te,Le,He);case f:return te=te.get(Le.key===null?re:Le.key)||null,Ee(Z,te,Le,He);case w:var ft=Le._init;return Ft(te,Z,re,ft(Le._payload),He)}if(ee(Le)||P(Le))return te=te.get(re)||null,Fe(Z,te,Le,He,null);Rf(Z,Le)}return null}function Xe(te,Z,re,Le){for(var He=null,ft=null,at=Z,bt=Z=0,bn=null;at!==null&&bt<re.length;bt++){at.index>bt?(bn=at,at=null):bn=at.sibling;var Pt=Je(te,at,re[bt],Le);if(Pt===null){at===null&&(at=bn);break}l&&at&&Pt.alternate===null&&u(te,at),Z=A(Pt,Z,bt),ft===null?He=Pt:ft.sibling=Pt,ft=Pt,at=bn}if(bt===re.length)return p(te,at),qt&&wo(te,bt),He;if(at===null){for(;bt<re.length;bt++)at=ot(te,re[bt],Le),at!==null&&(Z=A(at,Z,bt),ft===null?He=at:ft.sibling=at,ft=at);return qt&&wo(te,bt),He}for(at=y(te,at);bt<re.length;bt++)bn=Ft(at,te,bt,re[bt],Le),bn!==null&&(l&&bn.alternate!==null&&at.delete(bn.key===null?bt:bn.key),Z=A(bn,Z,bt),ft===null?He=bn:ft.sibling=bn,ft=bn);return l&&at.forEach(function(Os){return u(te,Os)}),qt&&wo(te,bt),He}function Xn(te,Z,re,Le){var He=P(re);if(typeof He!="function")throw Error(o(150));if(re=He.call(re),re==null)throw Error(o(151));for(var ft=He=null,at=Z,bt=Z=0,bn=null,Pt=re.next();at!==null&&!Pt.done;bt++,Pt=re.next()){at.index>bt?(bn=at,at=null):bn=at.sibling;var Os=Je(te,at,Pt.value,Le);if(Os===null){at===null&&(at=bn);break}l&&at&&Os.alternate===null&&u(te,at),Z=A(Os,Z,bt),ft===null?He=Os:ft.sibling=Os,ft=Os,at=bn}if(Pt.done)return p(te,at),qt&&wo(te,bt),He;if(at===null){for(;!Pt.done;bt++,Pt=re.next())Pt=ot(te,Pt.value,Le),Pt!==null&&(Z=A(Pt,Z,bt),ft===null?He=Pt:ft.sibling=Pt,ft=Pt);return qt&&wo(te,bt),He}for(at=y(te,at);!Pt.done;bt++,Pt=re.next())Pt=Ft(at,te,bt,Pt.value,Le),Pt!==null&&(l&&Pt.alternate!==null&&at.delete(Pt.key===null?bt:Pt.key),Z=A(Pt,Z,bt),ft===null?He=Pt:ft.sibling=Pt,ft=Pt);return l&&at.forEach(function(iC){return u(te,iC)}),qt&&wo(te,bt),He}function Qi(te,Z,re,Le){if(typeof re=="object"&&re!==null&&re.type===h&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case c:e:{for(var He=re.key,ft=Z;ft!==null;){if(ft.key===He){if(He=re.type,He===h){if(ft.tag===7){p(te,ft.sibling),Z=M(ft,re.props.children),Z.return=te,te=Z;break e}}else if(ft.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===w&&sx(He)===ft.type){p(te,ft.sibling),Z=M(ft,re.props),Z.ref=su(te,ft,re),Z.return=te,te=Z;break e}p(te,ft);break}else u(te,ft);ft=ft.sibling}re.type===h?(Z=Po(re.props.children,te.mode,Le,re.key),Z.return=te,te=Z):(Le=lh(re.type,re.key,re.props,null,te.mode,Le),Le.ref=su(te,Z,re),Le.return=te,te=Le)}return O(te);case f:e:{for(ft=re.key;Z!==null;){if(Z.key===ft)if(Z.tag===4&&Z.stateNode.containerInfo===re.containerInfo&&Z.stateNode.implementation===re.implementation){p(te,Z.sibling),Z=M(Z,re.children||[]),Z.return=te,te=Z;break e}else{p(te,Z);break}else u(te,Z);Z=Z.sibling}Z=Km(re,te.mode,Le),Z.return=te,te=Z}return O(te);case w:return ft=re._init,Qi(te,Z,ft(re._payload),Le)}if(ee(re))return Xe(te,Z,re,Le);if(P(re))return Xn(te,Z,re,Le);Rf(te,re)}return typeof re=="string"&&re!==""||typeof re=="number"?(re=""+re,Z!==null&&Z.tag===6?(p(te,Z.sibling),Z=M(Z,re),Z.return=te,te=Z):(p(te,Z),Z=Jm(re,te.mode,Le),Z.return=te,te=Z),O(te)):p(te,Z)}return Qi}var ba=ox(!0),ax=ox(!1),ou={},ji=fi(ou),au=fi(ou),Pa=fi(ou);function Nr(l){if(l===ou)throw Error(o(174));return l}function mm(l,u){ct(Pa,u),ct(au,l),ct(ji,ou),l=ue(u),Dt(ji),ct(ji,l)}function La(){Dt(ji),Dt(au),Dt(Pa)}function lx(l){var u=Nr(Pa.current),p=Nr(ji.current);u=D(p,l.type,u),p!==u&&(ct(au,l),ct(ji,u))}function gm(l){au.current===l&&(Dt(ji),Dt(au))}var Kt=fi(0);function If(l){for(var u=l;u!==null;){if(u.tag===13){var p=u.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||mf(p)||eu(p)))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var vm=[];function ym(){for(var l=0;l<vm.length;l++){var u=vm[l];Me?u._workInProgressVersionPrimary=null:u._workInProgressVersionSecondary=null}vm.length=0}var Df=a.ReactCurrentDispatcher,Yi=a.ReactCurrentBatchConfig,Ra=0,sn=null,Hn=null,Cn=null,Nf=!1,lu=!1,uu=0,bA=0;function Gn(){throw Error(o(321))}function _m(l,u){if(u===null)return!1;for(var p=0;p<u.length&&p<l.length;p++)if(!Rr(l[p],u[p]))return!1;return!0}function xm(l,u,p,y,M,A){if(Ra=A,sn=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,Df.current=l===null||l.memoizedState===null?IA:DA,l=p(y,M),lu){A=0;do{if(lu=!1,uu=0,25<=A)throw Error(o(301));A+=1,Cn=Hn=null,u.updateQueue=null,Df.current=NA,l=p(y,M)}while(lu)}if(Df.current=Ff,u=Hn!==null&&Hn.next!==null,Ra=0,Cn=Hn=sn=null,Nf=!1,u)throw Error(o(300));return l}function Sm(){var l=uu!==0;return uu=0,l}function ns(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?sn.memoizedState=Cn=l:Cn=Cn.next=l,Cn}function kr(){if(Hn===null){var l=sn.alternate;l=l!==null?l.memoizedState:null}else l=Hn.next;var u=Cn===null?sn.memoizedState:Cn.next;if(u!==null)Cn=u,Hn=l;else{if(l===null)throw Error(o(310));Hn=l,l={memoizedState:Hn.memoizedState,baseState:Hn.baseState,baseQueue:Hn.baseQueue,queue:Hn.queue,next:null},Cn===null?sn.memoizedState=Cn=l:Cn=Cn.next=l}return Cn}function Mo(l,u){return typeof u=="function"?u(l):u}function kf(l){var u=kr(),p=u.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=l;var y=Hn,M=y.baseQueue,A=p.pending;if(A!==null){if(M!==null){var O=M.next;M.next=A.next,A.next=O}y.baseQueue=M=A,p.pending=null}if(M!==null){A=M.next,y=y.baseState;var j=O=null,ae=null,Ee=A;do{var Fe=Ee.lane;if((Ra&Fe)===Fe)ae!==null&&(ae=ae.next={lane:0,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null}),y=Ee.hasEagerState?Ee.eagerState:l(y,Ee.action);else{var ot={lane:Fe,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null};ae===null?(j=ae=ot,O=y):ae=ae.next=ot,sn.lanes|=Fe,Da|=Fe}Ee=Ee.next}while(Ee!==null&&Ee!==A);ae===null?O=y:ae.next=j,Rr(y,u.memoizedState)||(Ci=!0),u.memoizedState=y,u.baseState=O,u.baseQueue=ae,p.lastRenderedState=y}if(l=p.interleaved,l!==null){M=l;do A=M.lane,sn.lanes|=A,Da|=A,M=M.next;while(M!==l)}else M===null&&(p.lanes=0);return[u.memoizedState,p.dispatch]}function zf(l){var u=kr(),p=u.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=l;var y=p.dispatch,M=p.pending,A=u.memoizedState;if(M!==null){p.pending=null;var O=M=M.next;do A=l(A,O.action),O=O.next;while(O!==M);Rr(A,u.memoizedState)||(Ci=!0),u.memoizedState=A,u.baseQueue===null&&(u.baseState=A),p.lastRenderedState=A}return[A,y]}function ux(){}function cx(l,u){var p=sn,y=kr(),M=u(),A=!Rr(y.memoizedState,M);if(A&&(y.memoizedState=M,Ci=!0),y=y.queue,fu(dx.bind(null,p,y,l),[l]),y.getSnapshot!==u||A||Cn!==null&&Cn.memoizedState.tag&1){if(p.flags|=2048,cu(9,hx.bind(null,p,y,M,u),void 0,null),gn===null)throw Error(o(349));(Ra&30)!==0||fx(p,u,M)}return M}function fx(l,u,p){l.flags|=16384,l={getSnapshot:u,value:p},u=sn.updateQueue,u===null?(u={lastEffect:null,stores:null},sn.updateQueue=u,u.stores=[l]):(p=u.stores,p===null?u.stores=[l]:p.push(l))}function hx(l,u,p,y){u.value=p,u.getSnapshot=y,px(u)&&qi(l,1,-1)}function dx(l,u,p){return p(function(){px(u)&&qi(l,1,-1)})}function px(l){var u=l.getSnapshot;l=l.value;try{var p=u();return!Rr(l,p)}catch{return!0}}function wm(l){var u=ns();return typeof l=="function"&&(l=l()),u.memoizedState=u.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:l},u.queue=l,l=l.dispatch=RA.bind(null,sn,l),[u.memoizedState,l]}function cu(l,u,p,y){return l={tag:l,create:u,destroy:p,deps:y,next:null},u=sn.updateQueue,u===null?(u={lastEffect:null,stores:null},sn.updateQueue=u,u.lastEffect=l.next=l):(p=u.lastEffect,p===null?u.lastEffect=l.next=l:(y=p.next,p.next=l,l.next=y,u.lastEffect=l)),l}function mx(){return kr().memoizedState}function Uf(l,u,p,y){var M=ns();sn.flags|=l,M.memoizedState=cu(1|u,p,void 0,y===void 0?null:y)}function Of(l,u,p,y){var M=kr();y=y===void 0?null:y;var A=void 0;if(Hn!==null){var O=Hn.memoizedState;if(A=O.destroy,y!==null&&_m(y,O.deps)){M.memoizedState=cu(u,p,A,y);return}}sn.flags|=l,M.memoizedState=cu(1|u,p,A,y)}function Mm(l,u){return Uf(8390656,8,l,u)}function fu(l,u){return Of(2048,8,l,u)}function gx(l,u){return Of(4,2,l,u)}function vx(l,u){return Of(4,4,l,u)}function yx(l,u){if(typeof u=="function")return l=l(),u(l),function(){u(null)};if(u!=null)return l=l(),u.current=l,function(){u.current=null}}function _x(l,u,p){return p=p!=null?p.concat([l]):null,Of(4,4,yx.bind(null,u,l),p)}function Em(){}function xx(l,u){var p=kr();u=u===void 0?null:u;var y=p.memoizedState;return y!==null&&u!==null&&_m(u,y[1])?y[0]:(p.memoizedState=[l,u],l)}function Sx(l,u){var p=kr();u=u===void 0?null:u;var y=p.memoizedState;return y!==null&&u!==null&&_m(u,y[1])?y[0]:(l=l(),p.memoizedState=[l,u],l)}function PA(l,u){var p=Ct;Ct=p!==0&&4>p?p:4,l(!0);var y=Yi.transition;Yi.transition={};try{l(!1),u()}finally{Ct=p,Yi.transition=y}}function wx(){return kr().memoizedState}function LA(l,u,p){var y=ks(l);p={lane:y,action:p,hasEagerState:!1,eagerState:null,next:null},Mx(l)?Ex(u,p):(Tx(l,u,p),p=ni(),l=qi(l,y,p),l!==null&&Ax(l,u,y))}function RA(l,u,p){var y=ks(l),M={lane:y,action:p,hasEagerState:!1,eagerState:null,next:null};if(Mx(l))Ex(u,M);else{Tx(l,u,M);var A=l.alternate;if(l.lanes===0&&(A===null||A.lanes===0)&&(A=u.lastRenderedReducer,A!==null))try{var O=u.lastRenderedState,j=A(O,p);if(M.hasEagerState=!0,M.eagerState=j,Rr(j,O))return}catch{}finally{}p=ni(),l=qi(l,y,p),l!==null&&Ax(l,u,y)}}function Mx(l){var u=l.alternate;return l===sn||u!==null&&u===sn}function Ex(l,u){lu=Nf=!0;var p=l.pending;p===null?u.next=u:(u.next=p.next,p.next=u),l.pending=u}function Tx(l,u,p){gn!==null&&(l.mode&1)!==0&&(gt&2)===0?(l=u.interleaved,l===null?(p.next=p,Dr===null?Dr=[u]:Dr.push(u)):(p.next=l.next,l.next=p),u.interleaved=p):(l=u.pending,l===null?p.next=p:(p.next=l.next,l.next=p),u.pending=p)}function Ax(l,u,p){if((p&4194240)!==0){var y=u.lanes;y&=l.pendingLanes,p|=y,u.lanes=p,Kp(l,p)}}var Ff={readContext:Gi,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},IA={readContext:Gi,useCallback:function(l,u){return ns().memoizedState=[l,u===void 0?null:u],l},useContext:Gi,useEffect:Mm,useImperativeHandle:function(l,u,p){return p=p!=null?p.concat([l]):null,Uf(4194308,4,yx.bind(null,u,l),p)},useLayoutEffect:function(l,u){return Uf(4194308,4,l,u)},useInsertionEffect:function(l,u){return Uf(4,2,l,u)},useMemo:function(l,u){var p=ns();return u=u===void 0?null:u,l=l(),p.memoizedState=[l,u],l},useReducer:function(l,u,p){var y=ns();return u=p!==void 0?p(u):u,y.memoizedState=y.baseState=u,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},y.queue=l,l=l.dispatch=LA.bind(null,sn,l),[y.memoizedState,l]},useRef:function(l){var u=ns();return l={current:l},u.memoizedState=l},useState:wm,useDebugValue:Em,useDeferredValue:function(l){var u=wm(l),p=u[0],y=u[1];return Mm(function(){var M=Yi.transition;Yi.transition={};try{y(l)}finally{Yi.transition=M}},[l]),p},useTransition:function(){var l=wm(!1),u=l[0];return l=PA.bind(null,l[1]),ns().memoizedState=l,[u,l]},useMutableSource:function(){},useSyncExternalStore:function(l,u,p){var y=sn,M=ns();if(qt){if(p===void 0)throw Error(o(407));p=p()}else{if(p=u(),gn===null)throw Error(o(349));(Ra&30)!==0||fx(y,u,p)}M.memoizedState=p;var A={value:p,getSnapshot:u};return M.queue=A,Mm(dx.bind(null,y,A,l),[l]),y.flags|=2048,cu(9,hx.bind(null,y,A,p,u),void 0,null),p},useId:function(){var l=ns(),u=gn.identifierPrefix;if(qt){var p=ts,y=es;p=(y&~(1<<32-hr(y)-1)).toString(32)+p,u=":"+u+"R"+p,p=uu++,0<p&&(u+="H"+p.toString(32)),u+=":"}else p=bA++,u=":"+u+"r"+p.toString(32)+":";return l.memoizedState=u},unstable_isNewReconciler:!1},DA={readContext:Gi,useCallback:xx,useContext:Gi,useEffect:fu,useImperativeHandle:_x,useInsertionEffect:gx,useLayoutEffect:vx,useMemo:Sx,useReducer:kf,useRef:mx,useState:function(){return kf(Mo)},useDebugValue:Em,useDeferredValue:function(l){var u=kf(Mo),p=u[0],y=u[1];return fu(function(){var M=Yi.transition;Yi.transition={};try{y(l)}finally{Yi.transition=M}},[l]),p},useTransition:function(){var l=kf(Mo)[0],u=kr().memoizedState;return[l,u]},useMutableSource:ux,useSyncExternalStore:cx,useId:wx,unstable_isNewReconciler:!1},NA={readContext:Gi,useCallback:xx,useContext:Gi,useEffect:fu,useImperativeHandle:_x,useInsertionEffect:gx,useLayoutEffect:vx,useMemo:Sx,useReducer:zf,useRef:mx,useState:function(){return zf(Mo)},useDebugValue:Em,useDeferredValue:function(l){var u=zf(Mo),p=u[0],y=u[1];return fu(function(){var M=Yi.transition;Yi.transition={};try{y(l)}finally{Yi.transition=M}},[l]),p},useTransition:function(){var l=zf(Mo)[0],u=kr().memoizedState;return[l,u]},useMutableSource:ux,useSyncExternalStore:cx,useId:wx,unstable_isNewReconciler:!1};function Tm(l,u){try{var p="",y=u;do p+=CA(y),y=y.return;while(y);var M=p}catch(A){M=`
Error generating stack: `+A.message+`
`+A.stack}return{value:l,source:u,stack:M}}function Am(l,u){try{console.error(u.value)}catch(p){setTimeout(function(){throw p})}}var kA=typeof WeakMap=="function"?WeakMap:Map;function Cx(l,u,p){p=$r(-1,p),p.tag=3,p.payload={element:null};var y=u.value;return p.callback=function(){th||(th=!0,Wm=y),Am(l,u)},p}function bx(l,u,p){p=$r(-1,p),p.tag=3;var y=l.type.getDerivedStateFromError;if(typeof y=="function"){var M=u.value;p.payload=function(){return y(M)},p.callback=function(){Am(l,u)}}var A=l.stateNode;return A!==null&&typeof A.componentDidCatch=="function"&&(p.callback=function(){Am(l,u),typeof y!="function"&&(Ds===null?Ds=new Set([this]):Ds.add(this));var O=u.stack;this.componentDidCatch(u.value,{componentStack:O!==null?O:""})}),p}function Px(l,u,p){var y=l.pingCache;if(y===null){y=l.pingCache=new kA;var M=new Set;y.set(u,M)}else M=y.get(u),M===void 0&&(M=new Set,y.set(u,M));M.has(p)||(M.add(p),l=ZA.bind(null,l,u,p),u.then(l,l))}function Lx(l){do{var u;if((u=l.tag===13)&&(u=l.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return l;l=l.return}while(l!==null);return null}function Rx(l,u,p,y,M){return(l.mode&1)===0?(l===u?l.flags|=65536:(l.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(u=$r(-1,1),u.tag=2,Is(p,u))),p.lanes|=1),l):(l.flags|=65536,l.lanes=M,l)}function zr(l){l.flags|=4}function Ix(l,u){if(l!==null&&l.child===u.child)return!0;if((u.flags&16)!==0)return!1;for(l=u.child;l!==null;){if((l.flags&12854)!==0||(l.subtreeFlags&12854)!==0)return!1;l=l.sibling}return!0}var hu,du,Bf,Vf;if(De)hu=function(l,u){for(var p=u.child;p!==null;){if(p.tag===5||p.tag===6)Y(l,p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},du=function(){},Bf=function(l,u,p,y,M){if(l=l.memoizedProps,l!==y){var A=u.stateNode,O=Nr(ji.current);p=z(A,p,l,y,M,O),(u.updateQueue=p)&&zr(u)}},Vf=function(l,u,p,y){p!==y&&zr(u)};else if(me){hu=function(l,u,p,y){for(var M=u.child;M!==null;){if(M.tag===5){var A=M.stateNode;p&&y&&(A=Yt(A,M.type,M.memoizedProps,M)),Y(l,A)}else if(M.tag===6)A=M.stateNode,p&&y&&(A=ei(A,M.memoizedProps,M)),Y(l,A);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)A=M.child,A!==null&&(A.return=M),hu(l,M,!0,!0);else if(M.child!==null){M.child.return=M,M=M.child;continue}}if(M===u)break;for(;M.sibling===null;){if(M.return===null||M.return===u)return;M=M.return}M.sibling.return=M.return,M=M.sibling}};var Dx=function(l,u,p,y){for(var M=u.child;M!==null;){if(M.tag===5){var A=M.stateNode;p&&y&&(A=Yt(A,M.type,M.memoizedProps,M)),Vt(l,A)}else if(M.tag===6)A=M.stateNode,p&&y&&(A=ei(A,M.memoizedProps,M)),Vt(l,A);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)A=M.child,A!==null&&(A.return=M),Dx(l,M,!0,!0);else if(M.child!==null){M.child.return=M,M=M.child;continue}}if(M===u)break;for(;M.sibling===null;){if(M.return===null||M.return===u)return;M=M.return}M.sibling.return=M.return,M=M.sibling}};du=function(l,u){var p=u.stateNode;if(!Ix(l,u)){l=p.containerInfo;var y=zt(l);Dx(y,u,!1,!1),p.pendingChildren=y,zr(u),Tn(l,y)}},Bf=function(l,u,p,y,M){var A=l.stateNode,O=l.memoizedProps;if((l=Ix(l,u))&&O===y)u.stateNode=A;else{var j=u.stateNode,ae=Nr(ji.current),Ee=null;O!==y&&(Ee=z(j,p,O,y,M,ae)),l&&Ee===null?u.stateNode=A:(A=We(A,Ee,p,O,y,u,l,j),K(A,p,y,M,ae)&&zr(u),u.stateNode=A,l?zr(u):hu(A,u,!1,!1))}},Vf=function(l,u,p,y){p!==y?(l=Nr(Pa.current),p=Nr(ji.current),u.stateNode=pe(y,l,p,u),zr(u)):u.stateNode=l.stateNode}}else du=function(){},Bf=function(){},Vf=function(){};function pu(l,u){if(!qt)switch(l.tailMode){case"hidden":u=l.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?l.tail=null:p.sibling=null;break;case"collapsed":p=l.tail;for(var y=null;p!==null;)p.alternate!==null&&(y=p),p=p.sibling;y===null?u||l.tail===null?l.tail=null:l.tail.sibling=null:y.sibling=null}}function Wn(l){var u=l.alternate!==null&&l.alternate.child===l.child,p=0,y=0;if(u)for(var M=l.child;M!==null;)p|=M.lanes|M.childLanes,y|=M.subtreeFlags&14680064,y|=M.flags&14680064,M.return=l,M=M.sibling;else for(M=l.child;M!==null;)p|=M.lanes|M.childLanes,y|=M.subtreeFlags,y|=M.flags,M.return=l,M=M.sibling;return l.subtreeFlags|=y,l.childLanes=p,u}function zA(l,u,p){var y=u.pendingProps;switch(fm(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(u),null;case 1:return kn(u.type)&&gf(),Wn(u),null;case 3:return y=u.stateNode,La(),Dt(Ut),Dt(mn),ym(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(l===null||l.child===null)&&(ru(u)?zr(u):l===null||l.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,pr!==null&&(Ym(pr),pr=null))),du(l,u),Wn(u),null;case 5:gm(u),p=Nr(Pa.current);var M=u.type;if(l!==null&&u.stateNode!=null)Bf(l,u,M,y,p),l.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!y){if(u.stateNode===null)throw Error(o(166));return Wn(u),null}if(l=Nr(ji.current),ru(u)){if(!se)throw Error(o(175));l=de(u.stateNode,u.type,u.memoizedProps,p,l,u,!iu),u.updateQueue=l,l!==null&&zr(u)}else{var A=J(M,y,p,l,u);hu(A,u,!1,!1),u.stateNode=A,K(A,M,y,p,l)&&zr(u)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Wn(u),null;case 6:if(l&&u.stateNode!=null)Vf(l,u,l.memoizedProps,y);else{if(typeof y!="string"&&u.stateNode===null)throw Error(o(166));if(l=Nr(Pa.current),p=Nr(ji.current),ru(u)){if(!se)throw Error(o(176));if(l=u.stateNode,y=u.memoizedProps,(p=Ze(l,y,u,!iu))&&(M=Ti,M!==null))switch(A=(M.mode&1)!==0,M.tag){case 3:Nn(M.stateNode.containerInfo,l,y,A);break;case 5:Ei(M.type,M.memoizedProps,M.stateNode,l,y,A)}p&&zr(u)}else u.stateNode=pe(y,l,p,u)}return Wn(u),null;case 13:if(Dt(Kt),y=u.memoizedState,qt&&Ai!==null&&(u.mode&1)!==0&&(u.flags&128)===0){for(l=Ai;l;)l=U(l);return Ca(),u.flags|=98560,u}if(y!==null&&y.dehydrated!==null){if(y=ru(u),l===null){if(!y)throw Error(o(318));if(!se)throw Error(o(344));if(l=u.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(o(317));nt(l,u)}else Ca(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;return Wn(u),null}return pr!==null&&(Ym(pr),pr=null),(u.flags&128)!==0?(u.lanes=p,u):(y=y!==null,p=!1,l===null?ru(u):p=l.memoizedState!==null,y&&!p&&(u.child.flags|=8192,(u.mode&1)!==0&&(l===null||(Kt.current&1)!==0?xn===0&&(xn=3):Zm())),u.updateQueue!==null&&(u.flags|=4),Wn(u),null);case 4:return La(),du(l,u),l===null&&Ue(u.stateNode.containerInfo),Wn(u),null;case 10:return sm(u.type._context),Wn(u),null;case 17:return kn(u.type)&&gf(),Wn(u),null;case 19:if(Dt(Kt),M=u.memoizedState,M===null)return Wn(u),null;if(y=(u.flags&128)!==0,A=M.rendering,A===null)if(y)pu(M,!1);else{if(xn!==0||l!==null&&(l.flags&128)!==0)for(l=u.child;l!==null;){if(A=If(l),A!==null){for(u.flags|=128,pu(M,!1),l=A.updateQueue,l!==null&&(u.updateQueue=l,u.flags|=4),u.subtreeFlags=0,l=p,y=u.child;y!==null;)p=y,M=l,p.flags&=14680066,A=p.alternate,A===null?(p.childLanes=0,p.lanes=M,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=A.childLanes,p.lanes=A.lanes,p.child=A.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=A.memoizedProps,p.memoizedState=A.memoizedState,p.updateQueue=A.updateQueue,p.type=A.type,M=A.dependencies,p.dependencies=M===null?null:{lanes:M.lanes,firstContext:M.firstContext}),y=y.sibling;return ct(Kt,Kt.current&1|2),u.child}l=l.sibling}M.tail!==null&&An()>Gm&&(u.flags|=128,y=!0,pu(M,!1),u.lanes=4194304)}else{if(!y)if(l=If(A),l!==null){if(u.flags|=128,y=!0,l=l.updateQueue,l!==null&&(u.updateQueue=l,u.flags|=4),pu(M,!0),M.tail===null&&M.tailMode==="hidden"&&!A.alternate&&!qt)return Wn(u),null}else 2*An()-M.renderingStartTime>Gm&&p!==1073741824&&(u.flags|=128,y=!0,pu(M,!1),u.lanes=4194304);M.isBackwards?(A.sibling=u.child,u.child=A):(l=M.last,l!==null?l.sibling=A:u.child=A,M.last=A)}return M.tail!==null?(u=M.tail,M.rendering=u,M.tail=u.sibling,M.renderingStartTime=An(),u.sibling=null,l=Kt.current,ct(Kt,y?l&1|2:l&1),u):(Wn(u),null);case 22:case 23:return qm(),y=u.memoizedState!==null,l!==null&&l.memoizedState!==null!==y&&(u.flags|=8192),y&&(u.mode&1)!==0?(bi&1073741824)!==0&&(Wn(u),De&&u.subtreeFlags&6&&(u.flags|=8192)):Wn(u),null;case 24:return null;case 25:return null}throw Error(o(156,u.tag))}var UA=a.ReactCurrentOwner,Ci=!1;function ti(l,u,p,y){u.child=l===null?ax(u,null,p,y):ba(u,l.child,p,y)}function Nx(l,u,p,y,M){p=p.render;var A=u.ref;return Ea(u,M),y=xm(l,u,p,y,A,M),p=Sm(),l!==null&&!Ci?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~M,is(l,u,M)):(qt&&p&&cm(u),u.flags|=1,ti(l,u,y,M),u.child)}function kx(l,u,p,y,M){if(l===null){var A=p.type;return typeof A=="function"&&!Qm(A)&&A.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(u.tag=15,u.type=A,zx(l,u,A,y,M)):(l=lh(p.type,null,y,u,u.mode,M),l.ref=u.ref,l.return=u,u.child=l)}if(A=l.child,(l.lanes&M)===0){var O=A.memoizedProps;if(p=p.compare,p=p!==null?p:Mf,p(O,y)&&l.ref===u.ref)return is(l,u,M)}return u.flags|=1,l=Us(A,y),l.ref=u.ref,l.return=u,u.child=l}function zx(l,u,p,y,M){if(l!==null&&Mf(l.memoizedProps,y)&&l.ref===u.ref)if(Ci=!1,(l.lanes&M)!==0)(l.flags&131072)!==0&&(Ci=!0);else return u.lanes=l.lanes,is(l,u,M);return Cm(l,u,p,y,M)}function Ux(l,u,p){var y=u.pendingProps,M=y.children,A=l!==null?l.memoizedState:null;if(y.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null},ct(Ia,bi),bi|=p;else if((p&1073741824)!==0)u.memoizedState={baseLanes:0,cachePool:null},y=A!==null?A.baseLanes:p,ct(Ia,bi),bi|=y;else return l=A!==null?A.baseLanes|p:p,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:l,cachePool:null},u.updateQueue=null,ct(Ia,bi),bi|=l,null;else A!==null?(y=A.baseLanes|p,u.memoizedState=null):y=p,ct(Ia,bi),bi|=y;return ti(l,u,M,p),u.child}function Ox(l,u){var p=u.ref;(l===null&&p!==null||l!==null&&l.ref!==p)&&(u.flags|=512,u.flags|=2097152)}function Cm(l,u,p,y,M){var A=kn(p)?fr:mn.current;return A=Ls(u,A),Ea(u,M),p=xm(l,u,p,y,A,M),y=Sm(),l!==null&&!Ci?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~M,is(l,u,M)):(qt&&y&&cm(u),u.flags|=1,ti(l,u,p,M),u.child)}function Fx(l,u,p,y,M){if(kn(p)){var A=!0;vf(u)}else A=!1;if(Ea(u,M),u.stateNode===null)l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),$_(u,p,y),um(u,p,y,M),y=!0;else if(l===null){var O=u.stateNode,j=u.memoizedProps;O.props=j;var ae=O.context,Ee=p.contextType;typeof Ee=="object"&&Ee!==null?Ee=Gi(Ee):(Ee=kn(p)?fr:mn.current,Ee=Ls(u,Ee));var Fe=p.getDerivedStateFromProps,ot=typeof Fe=="function"||typeof O.getSnapshotBeforeUpdate=="function";ot||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(j!==y||ae!==Ee)&&ex(u,O,y,Ee),Rs=!1;var Je=u.memoizedState;O.state=Je,Cf(u,y,O,M),ae=u.memoizedState,j!==y||Je!==ae||Ut.current||Rs?(typeof Fe=="function"&&(lm(u,p,Fe,y),ae=u.memoizedState),(j=Rs||K_(u,p,j,y,Je,ae,Ee))?(ot||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(u.flags|=4194308)):(typeof O.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=y,u.memoizedState=ae),O.props=y,O.state=ae,O.context=Ee,y=j):(typeof O.componentDidMount=="function"&&(u.flags|=4194308),y=!1)}else{O=u.stateNode,q_(l,u),j=u.memoizedProps,Ee=u.type===u.elementType?j:dr(u.type,j),O.props=Ee,ot=u.pendingProps,Je=O.context,ae=p.contextType,typeof ae=="object"&&ae!==null?ae=Gi(ae):(ae=kn(p)?fr:mn.current,ae=Ls(u,ae));var Ft=p.getDerivedStateFromProps;(Fe=typeof Ft=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(j!==ot||Je!==ae)&&ex(u,O,y,ae),Rs=!1,Je=u.memoizedState,O.state=Je,Cf(u,y,O,M);var Xe=u.memoizedState;j!==ot||Je!==Xe||Ut.current||Rs?(typeof Ft=="function"&&(lm(u,p,Ft,y),Xe=u.memoizedState),(Ee=Rs||K_(u,p,Ee,y,Je,Xe,ae)||!1)?(Fe||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(y,Xe,ae),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(y,Xe,ae)),typeof O.componentDidUpdate=="function"&&(u.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof O.componentDidUpdate!="function"||j===l.memoizedProps&&Je===l.memoizedState||(u.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||j===l.memoizedProps&&Je===l.memoizedState||(u.flags|=1024),u.memoizedProps=y,u.memoizedState=Xe),O.props=y,O.state=Xe,O.context=ae,y=Ee):(typeof O.componentDidUpdate!="function"||j===l.memoizedProps&&Je===l.memoizedState||(u.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||j===l.memoizedProps&&Je===l.memoizedState||(u.flags|=1024),y=!1)}return bm(l,u,p,y,A,M)}function bm(l,u,p,y,M,A){Ox(l,u);var O=(u.flags&128)!==0;if(!y&&!O)return M&&G_(u,p,!1),is(l,u,A);y=u.stateNode,UA.current=u;var j=O&&typeof p.getDerivedStateFromError!="function"?null:y.render();return u.flags|=1,l!==null&&O?(u.child=ba(u,l.child,null,A),u.child=ba(u,null,j,A)):ti(l,u,j,A),u.memoizedState=y.state,M&&G_(u,p,!0),u.child}function Bx(l){var u=l.stateNode;u.pendingContext?V_(l,u.pendingContext,u.pendingContext!==u.context):u.context&&V_(l,u.context,!1),mm(l,u.containerInfo)}function Vx(l,u,p,y,M){return Ca(),pm(M),u.flags|=256,ti(l,u,p,y),u.child}var Hf={dehydrated:null,treeContext:null,retryLane:0};function Gf(l){return{baseLanes:l,cachePool:null}}function Hx(l,u,p){var y=u.pendingProps,M=Kt.current,A=!1,O=(u.flags&128)!==0,j;if((j=O)||(j=l!==null&&l.memoizedState===null?!1:(M&2)!==0),j?(A=!0,u.flags&=-129):(l===null||l.memoizedState!==null)&&(M|=1),ct(Kt,M&1),l===null)return dm(u),l=u.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((u.mode&1)===0?u.lanes=1:eu(l)?u.lanes=8:u.lanes=1073741824,null):(M=y.children,l=y.fallback,A?(y=u.mode,A=u.child,M={mode:"hidden",children:M},(y&1)===0&&A!==null?(A.childLanes=0,A.pendingProps=M):A=uh(M,y,0,null),l=Po(l,y,p,null),A.return=u,l.return=u,A.sibling=l,u.child=A,u.child.memoizedState=Gf(p),u.memoizedState=Hf,l):Pm(u,M));if(M=l.memoizedState,M!==null){if(j=M.dehydrated,j!==null){if(O)return u.flags&256?(u.flags&=-257,Wf(l,u,p,Error(o(422)))):u.memoizedState!==null?(u.child=l.child,u.flags|=128,null):(A=y.fallback,M=u.mode,y=uh({mode:"visible",children:y.children},M,0,null),A=Po(A,M,p,null),A.flags|=2,y.return=u,A.return=u,y.sibling=A,u.child=y,(u.mode&1)!==0&&ba(u,l.child,null,p),u.child.memoizedState=Gf(p),u.memoizedState=Hf,A);if((u.mode&1)===0)u=Wf(l,u,p,null);else if(eu(j))u=Wf(l,u,p,Error(o(419)));else if(y=(p&l.childLanes)!==0,Ci||y){if(y=gn,y!==null){switch(p&-p){case 4:A=2;break;case 16:A=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:A=32;break;case 536870912:A=268435456;break;default:A=0}y=(A&(y.suspendedLanes|p))!==0?0:A,y!==0&&y!==M.retryLane&&(M.retryLane=y,qi(l,y,-1))}Zm(),u=Wf(l,u,p,Error(o(421)))}else mf(j)?(u.flags|=128,u.child=l.child,u=QA.bind(null,l),Zp(j,u),u=null):(p=M.treeContext,se&&(Ai=$(j),Ti=u,qt=!0,pr=null,iu=!1,p!==null&&(Wi[Xi++]=es,Wi[Xi++]=ts,Wi[Xi++]=So,es=p.id,ts=p.overflow,So=u)),u=Pm(u,u.pendingProps.children),u.flags|=4096);return u}return A?(y=Wx(l,u,y.children,y.fallback,p),A=u.child,M=l.child.memoizedState,A.memoizedState=M===null?Gf(p):{baseLanes:M.baseLanes|p,cachePool:null},A.childLanes=l.childLanes&~p,u.memoizedState=Hf,y):(p=Gx(l,u,y.children,p),u.memoizedState=null,p)}return A?(y=Wx(l,u,y.children,y.fallback,p),A=u.child,M=l.child.memoizedState,A.memoizedState=M===null?Gf(p):{baseLanes:M.baseLanes|p,cachePool:null},A.childLanes=l.childLanes&~p,u.memoizedState=Hf,y):(p=Gx(l,u,y.children,p),u.memoizedState=null,p)}function Pm(l,u){return u=uh({mode:"visible",children:u},l.mode,0,null),u.return=l,l.child=u}function Gx(l,u,p,y){var M=l.child;return l=M.sibling,p=Us(M,{mode:"visible",children:p}),(u.mode&1)===0&&(p.lanes=y),p.return=u,p.sibling=null,l!==null&&(y=u.deletions,y===null?(u.deletions=[l],u.flags|=16):y.push(l)),u.child=p}function Wx(l,u,p,y,M){var A=u.mode;l=l.child;var O=l.sibling,j={mode:"hidden",children:p};return(A&1)===0&&u.child!==l?(p=u.child,p.childLanes=0,p.pendingProps=j,u.deletions=null):(p=Us(l,j),p.subtreeFlags=l.subtreeFlags&14680064),O!==null?y=Us(O,y):(y=Po(y,A,M,null),y.flags|=2),y.return=u,p.return=u,p.sibling=y,u.child=p,y}function Wf(l,u,p,y){return y!==null&&pm(y),ba(u,l.child,null,p),l=Pm(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function Xx(l,u,p){l.lanes|=u;var y=l.alternate;y!==null&&(y.lanes|=u),om(l.return,u,p)}function Lm(l,u,p,y,M){var A=l.memoizedState;A===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:y,tail:p,tailMode:M}:(A.isBackwards=u,A.rendering=null,A.renderingStartTime=0,A.last=y,A.tail=p,A.tailMode=M)}function jx(l,u,p){var y=u.pendingProps,M=y.revealOrder,A=y.tail;if(ti(l,u,y.children,p),y=Kt.current,(y&2)!==0)y=y&1|2,u.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&Xx(l,p,u);else if(l.tag===19)Xx(l,p,u);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===u)break e;for(;l.sibling===null;){if(l.return===null||l.return===u)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}y&=1}if(ct(Kt,y),(u.mode&1)===0)u.memoizedState=null;else switch(M){case"forwards":for(p=u.child,M=null;p!==null;)l=p.alternate,l!==null&&If(l)===null&&(M=p),p=p.sibling;p=M,p===null?(M=u.child,u.child=null):(M=p.sibling,p.sibling=null),Lm(u,!1,M,p,A);break;case"backwards":for(p=null,M=u.child,u.child=null;M!==null;){if(l=M.alternate,l!==null&&If(l)===null){u.child=M;break}l=M.sibling,M.sibling=p,p=M,M=l}Lm(u,!0,p,null,A);break;case"together":Lm(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function is(l,u,p){if(l!==null&&(u.dependencies=l.dependencies),Da|=u.lanes,(p&u.childLanes)===0)return null;if(l!==null&&u.child!==l.child)throw Error(o(153));if(u.child!==null){for(l=u.child,p=Us(l,l.pendingProps),u.child=p,p.return=u;l.sibling!==null;)l=l.sibling,p=p.sibling=Us(l,l.pendingProps),p.return=u;p.sibling=null}return u.child}function OA(l,u,p){switch(u.tag){case 3:Bx(u),Ca();break;case 5:lx(u);break;case 1:kn(u.type)&&vf(u);break;case 4:mm(u,u.stateNode.containerInfo);break;case 10:Y_(u,u.type._context,u.memoizedProps.value);break;case 13:var y=u.memoizedState;if(y!==null)return y.dehydrated!==null?(ct(Kt,Kt.current&1),u.flags|=128,null):(p&u.child.childLanes)!==0?Hx(l,u,p):(ct(Kt,Kt.current&1),l=is(l,u,p),l!==null?l.sibling:null);ct(Kt,Kt.current&1);break;case 19:if(y=(p&u.childLanes)!==0,(l.flags&128)!==0){if(y)return jx(l,u,p);u.flags|=128}var M=u.memoizedState;if(M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),ct(Kt,Kt.current),y)break;return null;case 22:case 23:return u.lanes=0,Ux(l,u,p)}return is(l,u,p)}function FA(l,u){switch(fm(u),u.tag){case 1:return kn(u.type)&&gf(),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return La(),Dt(Ut),Dt(mn),ym(),l=u.flags,(l&65536)!==0&&(l&128)===0?(u.flags=l&-65537|128,u):null;case 5:return gm(u),null;case 13:if(Dt(Kt),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(o(340));Ca()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return Dt(Kt),null;case 4:return La(),null;case 10:return sm(u.type._context),null;case 22:case 23:return qm(),null;case 24:return null;default:return null}}var Xf=!1,Eo=!1,BA=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function jf(l,u){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(y){pi(l,u,y)}else p.current=null}function Rm(l,u,p){try{p()}catch(y){pi(l,u,y)}}var Yx=!1;function VA(l,u){for(V(l.containerInfo),Pe=u;Pe!==null;)if(l=Pe,u=l.child,(l.subtreeFlags&1028)!==0&&u!==null)u.return=l,Pe=u;else for(;Pe!==null;){l=Pe;try{var p=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,M=p.memoizedState,A=l.stateNode,O=A.getSnapshotBeforeUpdate(l.elementType===l.type?y:dr(l.type,y),M);A.__reactInternalSnapshotBeforeUpdate=O}break;case 3:De&&Ie(l.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(j){pi(l,l.return,j)}if(u=l.sibling,u!==null){u.return=l.return,Pe=u;break}Pe=l.return}return p=Yx,Yx=!1,p}function To(l,u,p){var y=u.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var M=y=y.next;do{if((M.tag&l)===l){var A=M.destroy;M.destroy=void 0,A!==void 0&&Rm(u,p,A)}M=M.next}while(M!==y)}}function mu(l,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&l)===l){var y=p.create;p.destroy=y()}p=p.next}while(p!==u)}}function Im(l){var u=l.ref;if(u!==null){var p=l.stateNode;switch(l.tag){case 5:l=oe(p);break;default:l=p}typeof u=="function"?u(l):u.current=l}}function qx(l,u,p){if(Lr&&typeof Lr.onCommitFiberUnmount=="function")try{Lr.onCommitFiberUnmount(Sf,u)}catch{}switch(u.tag){case 0:case 11:case 14:case 15:if(l=u.updateQueue,l!==null&&(l=l.lastEffect,l!==null)){var y=l=l.next;do{var M=y,A=M.destroy;M=M.tag,A!==void 0&&((M&2)!==0||(M&4)!==0)&&Rm(u,p,A),y=y.next}while(y!==l)}break;case 1:if(jf(u,p),l=u.stateNode,typeof l.componentWillUnmount=="function")try{l.props=u.memoizedProps,l.state=u.memoizedState,l.componentWillUnmount()}catch(O){pi(u,p,O)}break;case 5:jf(u,p);break;case 4:De?e1(l,u,p):me&&me&&(u=u.stateNode.containerInfo,p=zt(u),lr(u,p))}}function Zx(l,u,p){for(var y=u;;)if(qx(l,y,p),y.child===null||De&&y.tag===4){if(y===u)break;for(;y.sibling===null;){if(y.return===null||y.return===u)return;y=y.return}y.sibling.return=y.return,y=y.sibling}else y.child.return=y,y=y.child}function Qx(l){var u=l.alternate;u!==null&&(l.alternate=null,Qx(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&Ke(u)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Jx(l){return l.tag===5||l.tag===3||l.tag===4}function Kx(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Jx(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function $x(l){if(De){e:{for(var u=l.return;u!==null;){if(Jx(u))break e;u=u.return}throw Error(o(160))}var p=u;switch(p.tag){case 5:u=p.stateNode,p.flags&32&&(Lt(u),p.flags&=-33),p=Kx(l),Nm(l,p,u);break;case 3:case 4:u=p.stateNode.containerInfo,p=Kx(l),Dm(l,p,u);break;default:throw Error(o(161))}}}function Dm(l,u,p){var y=l.tag;if(y===5||y===6)l=l.stateNode,u?Oe(p,l,u):ke(p,l);else if(y!==4&&(l=l.child,l!==null))for(Dm(l,u,p),l=l.sibling;l!==null;)Dm(l,u,p),l=l.sibling}function Nm(l,u,p){var y=l.tag;if(y===5||y===6)l=l.stateNode,u?et(p,l,u):tt(p,l);else if(y!==4&&(l=l.child,l!==null))for(Nm(l,u,p),l=l.sibling;l!==null;)Nm(l,u,p),l=l.sibling}function e1(l,u,p){for(var y=u,M=!1,A,O;;){if(!M){M=y.return;e:for(;;){if(M===null)throw Error(o(160));switch(A=M.stateNode,M.tag){case 5:O=!1;break e;case 3:A=A.containerInfo,O=!0;break e;case 4:A=A.containerInfo,O=!0;break e}M=M.return}M=!0}if(y.tag===5||y.tag===6)Zx(l,y,p),O?wt(A,y.stateNode):Ge(A,y.stateNode);else if(y.tag===18)O?yt(A,y.stateNode):mt(A,y.stateNode);else if(y.tag===4){if(y.child!==null){A=y.stateNode.containerInfo,O=!0,y.child.return=y,y=y.child;continue}}else if(qx(l,y,p),y.child!==null){y.child.return=y,y=y.child;continue}if(y===u)break;for(;y.sibling===null;){if(y.return===null||y.return===u)return;y=y.return,y.tag===4&&(M=!1)}y.sibling.return=y.return,y=y.sibling}}function km(l,u){if(De){switch(u.tag){case 0:case 11:case 14:case 15:To(3,u,u.return),mu(3,u),To(5,u,u.return);return;case 1:return;case 5:var p=u.stateNode;if(p!=null){var y=u.memoizedProps;l=l!==null?l.memoizedProps:y;var M=u.type,A=u.updateQueue;u.updateQueue=null,A!==null&&qe(p,A,M,l,y,u)}return;case 6:if(u.stateNode===null)throw Error(o(162));p=u.memoizedProps,he(u.stateNode,l!==null?l.memoizedProps:p,p);return;case 3:se&&l!==null&&l.memoizedState.isDehydrated&&ut(u.stateNode.containerInfo);return;case 12:return;case 13:Yf(u);return;case 19:Yf(u);return;case 17:return}throw Error(o(163))}switch(u.tag){case 0:case 11:case 14:case 15:To(3,u,u.return),mu(3,u),To(5,u,u.return);return;case 12:return;case 13:Yf(u);return;case 19:Yf(u);return;case 3:se&&l!==null&&l.memoizedState.isDehydrated&&ut(u.stateNode.containerInfo);break;case 22:case 23:return}e:if(me){switch(u.tag){case 1:case 5:case 6:break e;case 3:case 4:u=u.stateNode,lr(u.containerInfo,u.pendingChildren);break e}throw Error(o(163))}}function Yf(l){var u=l.updateQueue;if(u!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new BA),u.forEach(function(y){var M=JA.bind(null,l,y);p.has(y)||(p.add(y),y.then(M,M))})}}function HA(l,u){for(Pe=u;Pe!==null;){u=Pe;var p=u.deletions;if(p!==null)for(var y=0;y<p.length;y++){var M=p[y];try{var A=l;De?e1(A,M,u):Zx(A,M,u);var O=M.alternate;O!==null&&(O.return=null),M.return=null}catch(He){pi(M,u,He)}}if(p=u.child,(u.subtreeFlags&12854)!==0&&p!==null)p.return=u,Pe=p;else for(;Pe!==null;){u=Pe;try{var j=u.flags;if(j&32&&De&&Lt(u.stateNode),j&512){var ae=u.alternate;if(ae!==null){var Ee=ae.ref;Ee!==null&&(typeof Ee=="function"?Ee(null):Ee.current=null)}}if(j&8192)switch(u.tag){case 13:if(u.memoizedState!==null){var Fe=u.alternate;(Fe===null||Fe.memoizedState===null)&&(Hm=An())}break;case 22:var ot=u.memoizedState!==null,Je=u.alternate,Ft=Je!==null&&Je.memoizedState!==null;if(p=u,De){e:if(y=p,M=ot,A=null,De)for(var Xe=y;;){if(Xe.tag===5){if(A===null){A=Xe;var Xn=Xe.stateNode;M?Jt(Xn):fe(Xe.stateNode,Xe.memoizedProps)}}else if(Xe.tag===6){if(A===null){var Qi=Xe.stateNode;M?X(Qi):xe(Qi,Xe.memoizedProps)}}else if((Xe.tag!==22&&Xe.tag!==23||Xe.memoizedState===null||Xe===y)&&Xe.child!==null){Xe.child.return=Xe,Xe=Xe.child;continue}if(Xe===y)break;for(;Xe.sibling===null;){if(Xe.return===null||Xe.return===y)break e;A===Xe&&(A=null),Xe=Xe.return}A===Xe&&(A=null),Xe.sibling.return=Xe.return,Xe=Xe.sibling}}if(ot&&!Ft&&(p.mode&1)!==0){Pe=p;for(var te=p.child;te!==null;){for(p=Pe=te;Pe!==null;){y=Pe;var Z=y.child;switch(y.tag){case 0:case 11:case 14:case 15:To(4,y,y.return);break;case 1:jf(y,y.return);var re=y.stateNode;if(typeof re.componentWillUnmount=="function"){var Le=y.return;try{re.props=y.memoizedProps,re.state=y.memoizedState,re.componentWillUnmount()}catch(He){pi(y,Le,He)}}break;case 5:jf(y,y.return);break;case 22:if(y.memoizedState!==null){i1(p);continue}}Z!==null?(Z.return=y,Pe=Z):i1(p)}te=te.sibling}}}switch(j&4102){case 2:$x(u),u.flags&=-3;break;case 6:$x(u),u.flags&=-3,km(u.alternate,u);break;case 4096:u.flags&=-4097;break;case 4100:u.flags&=-4097,km(u.alternate,u);break;case 4:km(u.alternate,u)}}catch(He){pi(u,u.return,He)}if(p=u.sibling,p!==null){p.return=u.return,Pe=p;break}Pe=u.return}}}function GA(l,u,p){Pe=l,t1(l)}function t1(l,u,p){for(var y=(l.mode&1)!==0;Pe!==null;){var M=Pe,A=M.child;if(M.tag===22&&y){var O=M.memoizedState!==null||Xf;if(!O){var j=M.alternate,ae=j!==null&&j.memoizedState!==null||Eo;j=Xf;var Ee=Eo;if(Xf=O,(Eo=ae)&&!Ee)for(Pe=M;Pe!==null;)O=Pe,ae=O.child,O.tag===22&&O.memoizedState!==null?r1(M):ae!==null?(ae.return=O,Pe=ae):r1(M);for(;A!==null;)Pe=A,t1(A),A=A.sibling;Pe=M,Xf=j,Eo=Ee}n1(l)}else(M.subtreeFlags&8772)!==0&&A!==null?(A.return=M,Pe=A):n1(l)}}function n1(l){for(;Pe!==null;){var u=Pe;if((u.flags&8772)!==0){var p=u.alternate;try{if((u.flags&8772)!==0)switch(u.tag){case 0:case 11:case 15:Eo||mu(5,u);break;case 1:var y=u.stateNode;if(u.flags&4&&!Eo)if(p===null)y.componentDidMount();else{var M=u.elementType===u.type?p.memoizedProps:dr(u.type,p.memoizedProps);y.componentDidUpdate(M,p.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var A=u.updateQueue;A!==null&&Q_(u,A,y);break;case 3:var O=u.updateQueue;if(O!==null){if(p=null,u.child!==null)switch(u.child.tag){case 5:p=oe(u.child.stateNode);break;case 1:p=u.child.stateNode}Q_(u,O,p)}break;case 5:var j=u.stateNode;p===null&&u.flags&4&&Ve(j,u.type,u.memoizedProps,u);break;case 6:break;case 4:break;case 12:break;case 13:if(se&&u.memoizedState===null){var ae=u.alternate;if(ae!==null){var Ee=ae.memoizedState;if(Ee!==null){var Fe=Ee.dehydrated;Fe!==null&&pt(Fe)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}Eo||u.flags&512&&Im(u)}catch(ot){pi(u,u.return,ot)}}if(u===l){Pe=null;break}if(p=u.sibling,p!==null){p.return=u.return,Pe=p;break}Pe=u.return}}function i1(l){for(;Pe!==null;){var u=Pe;if(u===l){Pe=null;break}var p=u.sibling;if(p!==null){p.return=u.return,Pe=p;break}Pe=u.return}}function r1(l){for(;Pe!==null;){var u=Pe;try{switch(u.tag){case 0:case 11:case 15:var p=u.return;try{mu(4,u)}catch(ae){pi(u,p,ae)}break;case 1:var y=u.stateNode;if(typeof y.componentDidMount=="function"){var M=u.return;try{y.componentDidMount()}catch(ae){pi(u,M,ae)}}var A=u.return;try{Im(u)}catch(ae){pi(u,A,ae)}break;case 5:var O=u.return;try{Im(u)}catch(ae){pi(u,O,ae)}}}catch(ae){pi(u,u.return,ae)}if(u===l){Pe=null;break}var j=u.sibling;if(j!==null){j.return=u.return,Pe=j;break}Pe=u.return}}var qf=0,Zf=1,Qf=2,Jf=3,Kf=4;if(typeof Symbol=="function"&&Symbol.for){var gu=Symbol.for;qf=gu("selector.component"),Zf=gu("selector.has_pseudo_class"),Qf=gu("selector.role"),Jf=gu("selector.test_id"),Kf=gu("selector.text")}function zm(l){var u=ve(l);if(u!=null){if(typeof u.memoizedProps["data-testname"]!="string")throw Error(o(364));return u}if(l=Et(l),l===null)throw Error(o(362));return l.stateNode.current}function Um(l,u){switch(u.$$typeof){case qf:if(l.type===u.value)return!0;break;case Zf:e:{u=u.value,l=[l,0];for(var p=0;p<l.length;){var y=l[p++],M=l[p++],A=u[M];if(y.tag!==5||!ie(y)){for(;A!=null&&Um(y,A);)M++,A=u[M];if(M===u.length){u=!0;break e}else for(y=y.child;y!==null;)l.push(y,M),y=y.sibling}}u=!1}return u;case Qf:if(l.tag===5&&_e(l.stateNode,u.value))return!0;break;case Kf:if((l.tag===5||l.tag===6)&&(l=k(l),l!==null&&0<=l.indexOf(u.value)))return!0;break;case Jf:if(l.tag===5&&(l=l.memoizedProps["data-testname"],typeof l=="string"&&l.toLowerCase()===u.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function Om(l){switch(l.$$typeof){case qf:return"<"+(R(l.value)||"Unknown")+">";case Zf:return":has("+(Om(l)||"")+")";case Qf:return'[role="'+l.value+'"]';case Kf:return'"'+l.value+'"';case Jf:return'[data-testname="'+l.value+'"]';default:throw Error(o(365))}}function s1(l,u){var p=[];l=[l,0];for(var y=0;y<l.length;){var M=l[y++],A=l[y++],O=u[A];if(M.tag!==5||!ie(M)){for(;O!=null&&Um(M,O);)A++,O=u[A];if(A===u.length)p.push(M);else for(M=M.child;M!==null;)l.push(M,A),M=M.sibling}}return p}function Fm(l,u){if(!rt)throw Error(o(363));l=zm(l),l=s1(l,u),u=[],l=Array.from(l);for(var p=0;p<l.length;){var y=l[p++];if(y.tag===5)ie(y)||u.push(y.stateNode);else for(y=y.child;y!==null;)l.push(y),y=y.sibling}return u}var WA=Math.ceil,$f=a.ReactCurrentDispatcher,Bm=a.ReactCurrentOwner,cn=a.ReactCurrentBatchConfig,gt=0,gn=null,vn=null,zn=0,bi=0,Ia=fi(0),xn=0,vu=null,Da=0,eh=0,Vm=0,yu=null,hi=null,Hm=0,Gm=1/0;function Na(){Gm=An()+500}var th=!1,Wm=null,Ds=null,nh=!1,Ns=null,ih=0,_u=0,Xm=null,rh=-1,sh=0;function ni(){return(gt&6)!==0?An():rh!==-1?rh:rh=An()}function ks(l){return(l.mode&1)===0?1:(gt&2)!==0&&zn!==0?zn&-zn:AA.transition!==null?(sh===0&&(l=yf,yf<<=1,(yf&4194240)===0&&(yf=64),sh=l),sh):(l=Ct,l!==0?l:Ce())}function qi(l,u,p){if(50<_u)throw _u=0,Xm=null,Error(o(185));var y=oh(l,u);return y===null?null:(nu(y,u,p),((gt&2)===0||y!==gn)&&(y===gn&&((gt&2)===0&&(eh|=u),xn===4&&zs(y,zn)),di(y,p),u===1&&gt===0&&(l.mode&1)===0&&(Na(),wf&&Ir())),y)}function oh(l,u){l.lanes|=u;var p=l.alternate;for(p!==null&&(p.lanes|=u),p=l,l=l.return;l!==null;)l.childLanes|=u,p=l.alternate,p!==null&&(p.childLanes|=u),p=l,l=l.return;return p.tag===3?p.stateNode:null}function di(l,u){var p=l.callbackNode;vA(l,u);var y=xf(l,l===gn?zn:0);if(y===0)p!==null&&X_(p),l.callbackNode=null,l.callbackPriority=0;else if(u=y&-y,l.callbackPriority!==u){if(p!=null&&X_(p),u===1)l.tag===0?TA(a1.bind(null,l)):j_(a1.bind(null,l)),$e?Ye(function(){gt===0&&Ir()}):$p(em,Ir),p=null;else{switch(W_(y)){case 1:p=em;break;case 4:p=SA;break;case 16:p=tm;break;case 536870912:p=wA;break;default:p=tm}p=g1(p,o1.bind(null,l))}l.callbackPriority=u,l.callbackNode=p}}function o1(l,u){if(rh=-1,sh=0,(gt&6)!==0)throw Error(o(327));var p=l.callbackNode;if(bo()&&l.callbackNode!==p)return null;var y=xf(l,l===gn?zn:0);if(y===0)return null;if((y&30)!==0||(y&l.expiredLanes)!==0||u)u=ah(l,y);else{u=y;var M=gt;gt|=2;var A=c1();(gn!==l||zn!==u)&&(Na(),Ao(l,u));do try{YA();break}catch(j){u1(l,j)}while(1);rm(),$f.current=A,gt=M,vn!==null?u=0:(gn=null,zn=0,u=xn)}if(u!==0){if(u===2&&(M=Qp(l),M!==0&&(y=M,u=jm(l,M))),u===1)throw p=vu,Ao(l,0),zs(l,y),di(l,An()),p;if(u===6)zs(l,y);else{if(M=l.current.alternate,(y&30)===0&&!XA(M)&&(u=ah(l,y),u===2&&(A=Qp(l),A!==0&&(y=A,u=jm(l,A))),u===1))throw p=vu,Ao(l,0),zs(l,y),di(l,An()),p;switch(l.finishedWork=M,l.finishedLanes=y,u){case 0:case 1:throw Error(o(345));case 2:Co(l,hi);break;case 3:if(zs(l,y),(y&130023424)===y&&(u=Hm+500-An(),10<u)){if(xf(l,0)!==0)break;if(M=l.suspendedLanes,(M&y)!==y){ni(),l.pingedLanes|=l.suspendedLanes&M;break}l.timeoutHandle=Q(Co.bind(null,l,hi),u);break}Co(l,hi);break;case 4:if(zs(l,y),(y&4194240)===y)break;for(u=l.eventTimes,M=-1;0<y;){var O=31-hr(y);A=1<<O,O=u[O],O>M&&(M=O),y&=~A}if(y=M,y=An()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*WA(y/1960))-y,10<y){l.timeoutHandle=Q(Co.bind(null,l,hi),y);break}Co(l,hi);break;case 5:Co(l,hi);break;default:throw Error(o(329))}}}return di(l,An()),l.callbackNode===p?o1.bind(null,l):null}function jm(l,u){var p=yu;return l.current.memoizedState.isDehydrated&&(Ao(l,u).flags|=256),l=ah(l,u),l!==2&&(u=hi,hi=p,u!==null&&Ym(u)),l}function Ym(l){hi===null?hi=l:hi.push.apply(hi,l)}function XA(l){for(var u=l;;){if(u.flags&16384){var p=u.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var y=0;y<p.length;y++){var M=p[y],A=M.getSnapshot;M=M.value;try{if(!Rr(A(),M))return!1}catch{return!1}}}if(p=u.child,u.subtreeFlags&16384&&p!==null)p.return=u,u=p;else{if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function zs(l,u){for(u&=~Vm,u&=~eh,l.suspendedLanes|=u,l.pingedLanes&=~u,l=l.expirationTimes;0<u;){var p=31-hr(u),y=1<<p;l[p]=-1,u&=~y}}function a1(l){if((gt&6)!==0)throw Error(o(327));bo();var u=xf(l,0);if((u&1)===0)return di(l,An()),null;var p=ah(l,u);if(l.tag!==0&&p===2){var y=Qp(l);y!==0&&(u=y,p=jm(l,y))}if(p===1)throw p=vu,Ao(l,0),zs(l,u),di(l,An()),p;if(p===6)throw Error(o(345));return l.finishedWork=l.current.alternate,l.finishedLanes=u,Co(l,hi),di(l,An()),null}function l1(l){Ns!==null&&Ns.tag===0&&(gt&6)===0&&bo();var u=gt;gt|=1;var p=cn.transition,y=Ct;try{if(cn.transition=null,Ct=1,l)return l()}finally{Ct=y,cn.transition=p,gt=u,(gt&6)===0&&Ir()}}function qm(){bi=Ia.current,Dt(Ia)}function Ao(l,u){l.finishedWork=null,l.finishedLanes=0;var p=l.timeoutHandle;if(p!==je&&(l.timeoutHandle=je,Qe(p)),vn!==null)for(p=vn.return;p!==null;){var y=p;switch(fm(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&gf();break;case 3:La(),Dt(Ut),Dt(mn),ym();break;case 5:gm(y);break;case 4:La();break;case 13:Dt(Kt);break;case 19:Dt(Kt);break;case 10:sm(y.type._context);break;case 22:case 23:qm()}p=p.return}if(gn=l,vn=l=Us(l.current,null),zn=bi=u,xn=0,vu=null,Vm=eh=Da=0,hi=yu=null,Dr!==null){for(u=0;u<Dr.length;u++)if(p=Dr[u],y=p.interleaved,y!==null){p.interleaved=null;var M=y.next,A=p.pending;if(A!==null){var O=A.next;A.next=M,y.next=O}p.pending=y}Dr=null}return l}function u1(l,u){do{var p=vn;try{if(rm(),Df.current=Ff,Nf){for(var y=sn.memoizedState;y!==null;){var M=y.queue;M!==null&&(M.pending=null),y=y.next}Nf=!1}if(Ra=0,Cn=Hn=sn=null,lu=!1,uu=0,Bm.current=null,p===null||p.return===null){xn=1,vu=u,vn=null;break}e:{var A=l,O=p.return,j=p,ae=u;if(u=zn,j.flags|=32768,ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var Ee=ae,Fe=j,ot=Fe.tag;if((Fe.mode&1)===0&&(ot===0||ot===11||ot===15)){var Je=Fe.alternate;Je?(Fe.updateQueue=Je.updateQueue,Fe.memoizedState=Je.memoizedState,Fe.lanes=Je.lanes):(Fe.updateQueue=null,Fe.memoizedState=null)}var Ft=Lx(O);if(Ft!==null){Ft.flags&=-257,Rx(Ft,O,j,A,u),Ft.mode&1&&Px(A,Ee,u),u=Ft,ae=Ee;var Xe=u.updateQueue;if(Xe===null){var Xn=new Set;Xn.add(ae),u.updateQueue=Xn}else Xe.add(ae);break e}else{if((u&1)===0){Px(A,Ee,u),Zm();break e}ae=Error(o(426))}}else if(qt&&j.mode&1){var Qi=Lx(O);if(Qi!==null){(Qi.flags&65536)===0&&(Qi.flags|=256),Rx(Qi,O,j,A,u),pm(ae);break e}}A=ae,xn!==4&&(xn=2),yu===null?yu=[A]:yu.push(A),ae=Tm(ae,j),j=O;do{switch(j.tag){case 3:j.flags|=65536,u&=-u,j.lanes|=u;var te=Cx(j,ae,u);Z_(j,te);break e;case 1:A=ae;var Z=j.type,re=j.stateNode;if((j.flags&128)===0&&(typeof Z.getDerivedStateFromError=="function"||re!==null&&typeof re.componentDidCatch=="function"&&(Ds===null||!Ds.has(re)))){j.flags|=65536,u&=-u,j.lanes|=u;var Le=bx(j,A,u);Z_(j,Le);break e}}j=j.return}while(j!==null)}h1(p)}catch(He){u=He,vn===p&&p!==null&&(vn=p=p.return);continue}break}while(1)}function c1(){var l=$f.current;return $f.current=Ff,l===null?Ff:l}function Zm(){(xn===0||xn===3||xn===2)&&(xn=4),gn===null||(Da&268435455)===0&&(eh&268435455)===0||zs(gn,zn)}function ah(l,u){var p=gt;gt|=2;var y=c1();gn===l&&zn===u||Ao(l,u);do try{jA();break}catch(M){u1(l,M)}while(1);if(rm(),gt=p,$f.current=y,vn!==null)throw Error(o(261));return gn=null,zn=0,xn}function jA(){for(;vn!==null;)f1(vn)}function YA(){for(;vn!==null&&!_A();)f1(vn)}function f1(l){var u=m1(l.alternate,l,bi);l.memoizedProps=l.pendingProps,u===null?h1(l):vn=u,Bm.current=null}function h1(l){var u=l;do{var p=u.alternate;if(l=u.return,(u.flags&32768)===0){if(p=zA(p,u,bi),p!==null){vn=p;return}}else{if(p=FA(p,u),p!==null){p.flags&=32767,vn=p;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{xn=6,vn=null;return}}if(u=u.sibling,u!==null){vn=u;return}vn=u=l}while(u!==null);xn===0&&(xn=5)}function Co(l,u){var p=Ct,y=cn.transition;try{cn.transition=null,Ct=1,qA(l,u,p)}finally{cn.transition=y,Ct=p}return null}function qA(l,u,p){do bo();while(Ns!==null);if((gt&6)!==0)throw Error(o(327));var y=l.finishedWork,M=l.finishedLanes;if(y===null)return null;if(l.finishedWork=null,l.finishedLanes=0,y===l.current)throw Error(o(177));l.callbackNode=null,l.callbackPriority=0;var A=y.lanes|y.childLanes;if(yA(l,A),l===gn&&(vn=gn=null,zn=0),(y.subtreeFlags&2064)===0&&(y.flags&2064)===0||nh||(nh=!0,g1(tm,function(){return bo(),null})),A=(y.flags&15990)!==0,(y.subtreeFlags&15990)!==0||A){A=cn.transition,cn.transition=null;var O=Ct;Ct=1;var j=gt;gt|=4,Bm.current=null,VA(l,y),HA(l,y),B(l.containerInfo),l.current=y,GA(y),xA(),gt=j,Ct=O,cn.transition=A}else l.current=y;if(nh&&(nh=!1,Ns=l,ih=M),A=l.pendingLanes,A===0&&(Ds=null),MA(y.stateNode),di(l,An()),u!==null)for(p=l.onRecoverableError,y=0;y<u.length;y++)p(u[y]);if(th)throw th=!1,l=Wm,Wm=null,l;return(ih&1)!==0&&l.tag!==0&&bo(),A=l.pendingLanes,(A&1)!==0?l===Xm?_u++:(_u=0,Xm=l):_u=0,Ir(),null}function bo(){if(Ns!==null){var l=W_(ih),u=cn.transition,p=Ct;try{if(cn.transition=null,Ct=16>l?16:l,Ns===null)var y=!1;else{if(l=Ns,Ns=null,ih=0,(gt&6)!==0)throw Error(o(331));var M=gt;for(gt|=4,Pe=l.current;Pe!==null;){var A=Pe,O=A.child;if((Pe.flags&16)!==0){var j=A.deletions;if(j!==null){for(var ae=0;ae<j.length;ae++){var Ee=j[ae];for(Pe=Ee;Pe!==null;){var Fe=Pe;switch(Fe.tag){case 0:case 11:case 15:To(8,Fe,A)}var ot=Fe.child;if(ot!==null)ot.return=Fe,Pe=ot;else for(;Pe!==null;){Fe=Pe;var Je=Fe.sibling,Ft=Fe.return;if(Qx(Fe),Fe===Ee){Pe=null;break}if(Je!==null){Je.return=Ft,Pe=Je;break}Pe=Ft}}}var Xe=A.alternate;if(Xe!==null){var Xn=Xe.child;if(Xn!==null){Xe.child=null;do{var Qi=Xn.sibling;Xn.sibling=null,Xn=Qi}while(Xn!==null)}}Pe=A}}if((A.subtreeFlags&2064)!==0&&O!==null)O.return=A,Pe=O;else e:for(;Pe!==null;){if(A=Pe,(A.flags&2048)!==0)switch(A.tag){case 0:case 11:case 15:To(9,A,A.return)}var te=A.sibling;if(te!==null){te.return=A.return,Pe=te;break e}Pe=A.return}}var Z=l.current;for(Pe=Z;Pe!==null;){O=Pe;var re=O.child;if((O.subtreeFlags&2064)!==0&&re!==null)re.return=O,Pe=re;else e:for(O=Z;Pe!==null;){if(j=Pe,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:mu(9,j)}}catch(He){pi(j,j.return,He)}if(j===O){Pe=null;break e}var Le=j.sibling;if(Le!==null){Le.return=j.return,Pe=Le;break e}Pe=j.return}}if(gt=M,Ir(),Lr&&typeof Lr.onPostCommitFiberRoot=="function")try{Lr.onPostCommitFiberRoot(Sf,l)}catch{}y=!0}return y}finally{Ct=p,cn.transition=u}}return!1}function d1(l,u,p){u=Tm(p,u),u=Cx(l,u,1),Is(l,u),u=ni(),l=oh(l,1),l!==null&&(nu(l,1,u),di(l,u))}function pi(l,u,p){if(l.tag===3)d1(l,l,p);else for(;u!==null;){if(u.tag===3){d1(u,l,p);break}else if(u.tag===1){var y=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Ds===null||!Ds.has(y))){l=Tm(p,l),l=bx(u,l,1),Is(u,l),l=ni(),u=oh(u,1),u!==null&&(nu(u,1,l),di(u,l));break}}u=u.return}}function ZA(l,u,p){var y=l.pingCache;y!==null&&y.delete(u),u=ni(),l.pingedLanes|=l.suspendedLanes&p,gn===l&&(zn&p)===p&&(xn===4||xn===3&&(zn&130023424)===zn&&500>An()-Hm?Ao(l,0):Vm|=p),di(l,u)}function p1(l,u){u===0&&((l.mode&1)===0?u=1:(u=_f,_f<<=1,(_f&130023424)===0&&(_f=4194304)));var p=ni();l=oh(l,u),l!==null&&(nu(l,u,p),di(l,p))}function QA(l){var u=l.memoizedState,p=0;u!==null&&(p=u.retryLane),p1(l,p)}function JA(l,u){var p=0;switch(l.tag){case 13:var y=l.stateNode,M=l.memoizedState;M!==null&&(p=M.retryLane);break;case 19:y=l.stateNode;break;default:throw Error(o(314))}y!==null&&y.delete(u),p1(l,p)}var m1;m1=function(l,u,p){if(l!==null)if(l.memoizedProps!==u.pendingProps||Ut.current)Ci=!0;else{if((l.lanes&p)===0&&(u.flags&128)===0)return Ci=!1,OA(l,u,p);Ci=(l.flags&131072)!==0}else Ci=!1,qt&&(u.flags&1048576)!==0&&tx(u,Lf,u.index);switch(u.lanes=0,u.tag){case 2:var y=u.type;l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),l=u.pendingProps;var M=Ls(u,mn.current);Ea(u,p),M=xm(null,u,y,l,M,p);var A=Sm();return u.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,kn(y)?(A=!0,vf(u)):A=!1,u.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,am(u),M.updater=bf,u.stateNode=M,M._reactInternals=u,um(u,y,l,p),u=bm(null,u,y,!0,A,p)):(u.tag=0,qt&&A&&cm(u),ti(null,u,M,p),u=u.child),u;case 16:y=u.elementType;e:{switch(l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),l=u.pendingProps,M=y._init,y=M(y._payload),u.type=y,M=u.tag=$A(y),l=dr(y,l),M){case 0:u=Cm(null,u,y,l,p);break e;case 1:u=Fx(null,u,y,l,p);break e;case 11:u=Nx(null,u,y,l,p);break e;case 14:u=kx(null,u,y,dr(y.type,l),p);break e}throw Error(o(306,y,""))}return u;case 0:return y=u.type,M=u.pendingProps,M=u.elementType===y?M:dr(y,M),Cm(l,u,y,M,p);case 1:return y=u.type,M=u.pendingProps,M=u.elementType===y?M:dr(y,M),Fx(l,u,y,M,p);case 3:e:{if(Bx(u),l===null)throw Error(o(387));y=u.pendingProps,A=u.memoizedState,M=A.element,q_(l,u),Cf(u,y,null,p);var O=u.memoizedState;if(y=O.element,se&&A.isDehydrated)if(A={element:y,isDehydrated:!1,cache:O.cache,transitions:O.transitions},u.updateQueue.baseState=A,u.memoizedState=A,u.flags&256){M=Error(o(423)),u=Vx(l,u,y,p,M);break e}else if(y!==M){M=Error(o(424)),u=Vx(l,u,y,p,M);break e}else for(se&&(Ai=ce(u.stateNode.containerInfo),Ti=u,qt=!0,pr=null,iu=!1),p=ax(u,null,y,p),u.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Ca(),y===M){u=is(l,u,p);break e}ti(l,u,y,p)}u=u.child}return u;case 5:return lx(u),l===null&&dm(u),y=u.type,M=u.pendingProps,A=l!==null?l.memoizedProps:null,O=M.children,ye(y,M)?O=null:A!==null&&ye(y,A)&&(u.flags|=32),Ox(l,u),ti(l,u,O,p),u.child;case 6:return l===null&&dm(u),null;case 13:return Hx(l,u,p);case 4:return mm(u,u.stateNode.containerInfo),y=u.pendingProps,l===null?u.child=ba(u,null,y,p):ti(l,u,y,p),u.child;case 11:return y=u.type,M=u.pendingProps,M=u.elementType===y?M:dr(y,M),Nx(l,u,y,M,p);case 7:return ti(l,u,u.pendingProps,p),u.child;case 8:return ti(l,u,u.pendingProps.children,p),u.child;case 12:return ti(l,u,u.pendingProps.children,p),u.child;case 10:e:{if(y=u.type._context,M=u.pendingProps,A=u.memoizedProps,O=M.value,Y_(u,y,O),A!==null)if(Rr(A.value,O)){if(A.children===M.children&&!Ut.current){u=is(l,u,p);break e}}else for(A=u.child,A!==null&&(A.return=u);A!==null;){var j=A.dependencies;if(j!==null){O=A.child;for(var ae=j.firstContext;ae!==null;){if(ae.context===y){if(A.tag===1){ae=$r(-1,p&-p),ae.tag=2;var Ee=A.updateQueue;if(Ee!==null){Ee=Ee.shared;var Fe=Ee.pending;Fe===null?ae.next=ae:(ae.next=Fe.next,Fe.next=ae),Ee.pending=ae}}A.lanes|=p,ae=A.alternate,ae!==null&&(ae.lanes|=p),om(A.return,p,u),j.lanes|=p;break}ae=ae.next}}else if(A.tag===10)O=A.type===u.type?null:A.child;else if(A.tag===18){if(O=A.return,O===null)throw Error(o(341));O.lanes|=p,j=O.alternate,j!==null&&(j.lanes|=p),om(O,p,u),O=A.sibling}else O=A.child;if(O!==null)O.return=A;else for(O=A;O!==null;){if(O===u){O=null;break}if(A=O.sibling,A!==null){A.return=O.return,O=A;break}O=O.return}A=O}ti(l,u,M.children,p),u=u.child}return u;case 9:return M=u.type,y=u.pendingProps.children,Ea(u,p),M=Gi(M),y=y(M),u.flags|=1,ti(l,u,y,p),u.child;case 14:return y=u.type,M=dr(y,u.pendingProps),M=dr(y.type,M),kx(l,u,y,M,p);case 15:return zx(l,u,u.type,u.pendingProps,p);case 17:return y=u.type,M=u.pendingProps,M=u.elementType===y?M:dr(y,M),l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),u.tag=1,kn(y)?(l=!0,vf(u)):l=!1,Ea(u,p),$_(u,y,M),um(u,y,M,p),bm(null,u,y,!0,l,p);case 19:return jx(l,u,p);case 22:return Ux(l,u,p)}throw Error(o(156,u.tag))};function g1(l,u){return $p(l,u)}function KA(l,u,p,y){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zi(l,u,p,y){return new KA(l,u,p,y)}function Qm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function $A(l){if(typeof l=="function")return Qm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===E)return 11;if(l===x)return 14}return 2}function Us(l,u){var p=l.alternate;return p===null?(p=Zi(l.tag,u,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=u,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,u=l.dependencies,p.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function lh(l,u,p,y,M,A){var O=2;if(y=l,typeof l=="function")Qm(l)&&(O=1);else if(typeof l=="string")O=5;else e:switch(l){case h:return Po(p.children,M,A,u);case d:O=8,M|=8;break;case m:return l=Zi(12,p,u,M|2),l.elementType=m,l.lanes=A,l;case S:return l=Zi(13,p,u,M),l.elementType=S,l.lanes=A,l;case g:return l=Zi(19,p,u,M),l.elementType=g,l.lanes=A,l;case T:return uh(p,M,A,u);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case v:O=10;break e;case _:O=9;break e;case E:O=11;break e;case x:O=14;break e;case w:O=16,y=null;break e}throw Error(o(130,l==null?l:typeof l,""))}return u=Zi(O,p,u,M),u.elementType=l,u.type=y,u.lanes=A,u}function Po(l,u,p,y){return l=Zi(7,l,y,u),l.lanes=p,l}function uh(l,u,p,y){return l=Zi(22,l,y,u),l.elementType=T,l.lanes=p,l.stateNode={},l}function Jm(l,u,p){return l=Zi(6,l,null,u),l.lanes=p,l}function Km(l,u,p){return u=Zi(4,l.children!==null?l.children:[],l.key,u),u.lanes=p,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}function eC(l,u,p,y,M){this.tag=u,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=je,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jp(0),this.expirationTimes=Jp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jp(0),this.identifierPrefix=y,this.onRecoverableError=M,se&&(this.mutableSourceEagerHydrationData=null)}function v1(l,u,p,y,M,A,O,j,ae){return l=new eC(l,u,p,j,ae),u===1?(u=1,A===!0&&(u|=8)):u=0,A=Zi(3,null,null,u),l.current=A,A.stateNode=l,A.memoizedState={element:y,isDehydrated:p,cache:null,transitions:null},am(A),l}function y1(l){if(!l)return Vn;l=l._reactInternals;e:{if(b(l)!==l||l.tag!==1)throw Error(o(170));var u=l;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(kn(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(o(171))}if(l.tag===1){var p=l.type;if(kn(p))return H_(l,p,u)}return u}function _1(l){var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(o(188)):(l=Object.keys(l).join(","),Error(o(268,l)));return l=q(u),l===null?null:l.stateNode}function x1(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var p=l.retryLane;l.retryLane=p!==0&&p<u?p:u}}function $m(l,u){x1(l,u),(l=l.alternate)&&x1(l,u)}function tC(l){return l=q(l),l===null?null:l.stateNode}function nC(){return null}return t.attemptContinuousHydration=function(l){if(l.tag===13){var u=ni();qi(l,134217728,u),$m(l,134217728)}},t.attemptHydrationAtCurrentPriority=function(l){if(l.tag===13){var u=ni(),p=ks(l);qi(l,p,u),$m(l,p)}},t.attemptSynchronousHydration=function(l){switch(l.tag){case 3:var u=l.stateNode;if(u.current.memoizedState.isDehydrated){var p=tu(u.pendingLanes);p!==0&&(Kp(u,p|1),di(u,An()),(gt&6)===0&&(Na(),Ir()))}break;case 13:var y=ni();l1(function(){return qi(l,1,y)}),$m(l,1)}},t.batchedUpdates=function(l,u){var p=gt;gt|=1;try{return l(u)}finally{gt=p,gt===0&&(Na(),wf&&Ir())}},t.createComponentSelector=function(l){return{$$typeof:qf,value:l}},t.createContainer=function(l,u,p,y,M,A,O){return v1(l,u,!1,null,p,y,M,A,O)},t.createHasPseudoClassSelector=function(l){return{$$typeof:Zf,value:l}},t.createHydrationContainer=function(l,u,p,y,M,A,O,j,ae){return l=v1(p,y,!0,l,M,A,O,j,ae),l.context=y1(null),p=l.current,y=ni(),M=ks(p),A=$r(y,M),A.callback=u!=null?u:null,Is(p,A),l.current.lanes=M,nu(l,M,y),di(l,y),l},t.createPortal=function(l,u,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:y==null?null:""+y,children:l,containerInfo:u,implementation:p}},t.createRoleSelector=function(l){return{$$typeof:Qf,value:l}},t.createTestNameSelector=function(l){return{$$typeof:Jf,value:l}},t.createTextSelector=function(l){return{$$typeof:Kf,value:l}},t.deferredUpdates=function(l){var u=Ct,p=cn.transition;try{return cn.transition=null,Ct=16,l()}finally{Ct=u,cn.transition=p}},t.discreteUpdates=function(l,u,p,y,M){var A=Ct,O=cn.transition;try{return cn.transition=null,Ct=1,l(u,p,y,M)}finally{Ct=A,cn.transition=O,gt===0&&Na()}},t.findAllNodes=Fm,t.findBoundingRects=function(l,u){if(!rt)throw Error(o(363));u=Fm(l,u),l=[];for(var p=0;p<u.length;p++)l.push(F(u[p]));for(u=l.length-1;0<u;u--){p=l[u];for(var y=p.x,M=y+p.width,A=p.y,O=A+p.height,j=u-1;0<=j;j--)if(u!==j){var ae=l[j],Ee=ae.x,Fe=Ee+ae.width,ot=ae.y,Je=ot+ae.height;if(y>=Ee&&A>=ot&&M<=Fe&&O<=Je){l.splice(u,1);break}else if(y!==Ee||p.width!==ae.width||Je<A||ot>O){if(!(A!==ot||p.height!==ae.height||Fe<y||Ee>M)){Ee>y&&(ae.width+=Ee-y,ae.x=y),Fe<M&&(ae.width=M-Ee),l.splice(u,1);break}}else{ot>A&&(ae.height+=ot-A,ae.y=A),Je<O&&(ae.height=O-ot),l.splice(u,1);break}}}return l},t.findHostInstance=_1,t.findHostInstanceWithNoPortals=function(l){return l=H(l),l=l!==null?W(l):null,l===null?null:l.stateNode},t.findHostInstanceWithWarning=function(l){return _1(l)},t.flushControlled=function(l){var u=gt;gt|=1;var p=cn.transition,y=Ct;try{cn.transition=null,Ct=1,l()}finally{Ct=y,cn.transition=p,gt=u,gt===0&&(Na(),Ir())}},t.flushPassiveEffects=bo,t.flushSync=l1,t.focusWithin=function(l,u){if(!rt)throw Error(o(363));for(l=zm(l),u=s1(l,u),u=Array.from(u),l=0;l<u.length;){var p=u[l++];if(!ie(p)){if(p.tag===5&&Se(p.stateNode))return!0;for(p=p.child;p!==null;)u.push(p),p=p.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Ct},t.getFindAllNodesFailureDescription=function(l,u){if(!rt)throw Error(o(363));var p=0,y=[];l=[zm(l),0];for(var M=0;M<l.length;){var A=l[M++],O=l[M++],j=u[O];if((A.tag!==5||!ie(A))&&(Um(A,j)&&(y.push(Om(j)),O++,O>p&&(p=O)),O<u.length))for(A=A.child;A!==null;)l.push(A,O),A=A.sibling}if(p<u.length){for(l=[];p<u.length;p++)l.push(Om(u[p]));return`findAllNodes was able to match part of the selector:
`+(y.join(" > ")+`
No matching component was found for:
`)+l.join(" > ")}return null},t.getPublicRootInstance=function(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return oe(l.child.stateNode);default:return l.child.stateNode}},t.injectIntoDevTools=function(l){if(l={bundleType:l.bundleType,version:l.version,rendererPackageName:l.rendererPackageName,rendererConfig:l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:tC,findFiberByHostInstance:l.findFiberByHostInstance||nC,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")l=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)l=!0;else{try{Sf=u.inject(l),Lr=u}catch{}l=!!u.checkDCE}}return l},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(l,u,p,y){if(!rt)throw Error(o(363));l=Fm(l,u);var M=be(l,p,y).disconnect;return{disconnect:function(){M()}}},t.registerMutableSourceForHydration=function(l,u){var p=u._getVersion;p=p(u._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[u,p]:l.mutableSourceEagerHydrationData.push(u,p)},t.runWithPriority=function(l,u){var p=Ct;try{return Ct=l,u()}finally{Ct=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(l,u,p,y){var M=u.current,A=ni(),O=ks(M);return p=y1(p),u.context===null?u.context=p:u.pendingContext=p,u=$r(A,O),u.payload={element:l},y=y===void 0?null:y,y!==null&&(u.callback=y),Is(M,u),l=qi(M,O,A),l!==null&&Af(l,M,O),O},t};(function(n){n.exports=DU})(N3);const NU=rC(N3.exports);var Xv={exports:{}},k3={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(n){function e(D,V){var B=D.length;D.push(V);e:for(;0<B;){var J=B-1>>>1,Y=D[J];if(0<r(Y,V))D[J]=V,D[B]=Y,B=J;else break e}}function t(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var V=D[0],B=D.pop();if(B!==V){D[0]=B;e:for(var J=0,Y=D.length,K=Y>>>1;J<K;){var z=2*(J+1)-1,ye=D[z],pe=z+1,Q=D[pe];if(0>r(ye,B))pe<Y&&0>r(Q,ye)?(D[J]=Q,D[pe]=B,J=pe):(D[J]=ye,D[z]=B,J=z);else if(pe<Y&&0>r(Q,B))D[J]=Q,D[pe]=B,J=pe;else break e}}return V}function r(D,V){var B=D.sortIndex-V.sortIndex;return B!==0?B:D.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var c=[],f=[],h=1,d=null,m=3,v=!1,_=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(D){for(var V=t(f);V!==null;){if(V.callback===null)i(f);else if(V.startTime<=D)i(f),V.sortIndex=V.expirationTime,e(c,V);else break;V=t(f)}}function T(D){if(E=!1,w(D),!_)if(t(c)!==null)_=!0,oe(C);else{var V=t(f);V!==null&&ue(T,V.startTime-D)}}function C(D,V){_=!1,E&&(E=!1,g(I),I=-1),v=!0;var B=m;try{for(w(V),d=t(c);d!==null&&(!(d.expirationTime>V)||D&&!H());){var J=d.callback;if(typeof J=="function"){d.callback=null,m=d.priorityLevel;var Y=J(d.expirationTime<=V);V=n.unstable_now(),typeof Y=="function"?d.callback=Y:d===t(c)&&i(c),w(V)}else i(c);d=t(c)}if(d!==null)var K=!0;else{var z=t(f);z!==null&&ue(T,z.startTime-V),K=!1}return K}finally{d=null,m=B,v=!1}}var P=!1,R=null,I=-1,b=5,L=-1;function H(){return!(n.unstable_now()-L<b)}function q(){if(R!==null){var D=n.unstable_now();L=D;var V=!0;try{V=R(!0,D)}finally{V?G():(P=!1,R=null)}}else P=!1}var G;if(typeof x=="function")G=function(){x(q)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,ee=W.port2;W.port1.onmessage=q,G=function(){ee.postMessage(null)}}else G=function(){S(q,0)};function oe(D){R=D,P||(P=!0,G())}function ue(D,V){I=S(function(){D(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){_||v||(_=!0,oe(C))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_getFirstCallbackNode=function(){return t(c)},n.unstable_next=function(D){switch(m){case 1:case 2:case 3:var V=3;break;default:V=m}var B=m;m=V;try{return D()}finally{m=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,V){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var B=m;m=D;try{return V()}finally{m=B}},n.unstable_scheduleCallback=function(D,V,B){var J=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?J+B:J):B=J,D){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=B+Y,D={id:h++,callback:V,priorityLevel:D,startTime:B,expirationTime:Y,sortIndex:-1},B>J?(D.sortIndex=B,e(f,D),t(c)===null&&D===t(f)&&(E?(g(I),I=-1):E=!0,ue(T,B-J))):(D.sortIndex=Y,e(c,D),_||v||(_=!0,oe(C))),D},n.unstable_shouldYield=H,n.unstable_wrapCallback=function(D){var V=m;return function(){var B=m;m=V;try{return D.apply(this,arguments)}finally{m=B}}}})(k3);(function(n){n.exports=k3})(Xv);var Gp={exports:{}},Wp={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var kU=Te.exports,zU=Symbol.for("react.element"),UU=Symbol.for("react.fragment"),OU=Object.prototype.hasOwnProperty,FU=kU.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,BU={key:!0,ref:!0,__self:!0,__source:!0};function z3(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)OU.call(e,i)&&!BU.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:zU,type:n,key:s,ref:o,props:r,_owner:FU.current}}Wp.Fragment=UU;Wp.jsx=z3;Wp.jsxs=z3;(function(n){n.exports=Wp})(Gp);const L_=Gp.exports.Fragment,Gt=Gp.exports.jsx,Xp=Gp.exports.jsxs,R_={},VU=n=>void Object.assign(R_,n);function HU(n,e){function t(h,{args:d=[],attach:m,...v},_){let E=`${h[0].toUpperCase()}${h.slice(1)}`,S;if(h==="primitive"){if(v.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=v.object;S=sl(g,{type:h,root:_,attach:m,primitive:!0})}else{const g=R_[E];if(!g)throw new Error(`R3F: ${E} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");S=sl(new g(...d),{type:h,root:_,attach:m,memoizedProps:{args:d}})}return S.__r3f.attach===void 0&&(S instanceof lt?S.__r3f.attach="geometry":S instanceof Bn&&(S.__r3f.attach="material")),E!=="inject"&&o0(S,v),S}function i(h,d){let m=!1;if(d){var v,_;(v=d.__r3f)!=null&&v.attach?s0(h,d,d.__r3f.attach):d.isObject3D&&h.isObject3D&&(h.add(d),m=!0),m||(_=h.__r3f)==null||_.objects.push(d),d.__r3f||sl(d,{}),d.__r3f.parent=h,Yv(d),ol(d)}}function r(h,d,m){let v=!1;if(d){var _,E;if((_=d.__r3f)!=null&&_.attach)s0(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){d.parent=h,d.dispatchEvent({type:"added"});const S=h.children.filter(x=>x!==d),g=S.indexOf(m);h.children=[...S.slice(0,g),d,...S.slice(g)],v=!0}v||(E=h.__r3f)==null||E.objects.push(d),d.__r3f||sl(d,{}),d.__r3f.parent=h,Yv(d),ol(d)}}function s(h,d,m=!1){h&&[...h].forEach(v=>o(d,v,m))}function o(h,d,m){if(d){var v,_,E;if(d.__r3f&&(d.__r3f.parent=null),(v=h.__r3f)!=null&&v.objects&&(h.__r3f.objects=h.__r3f.objects.filter(T=>T!==d)),(_=d.__r3f)!=null&&_.attach)aM(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){var S;h.remove(d),(S=d.__r3f)!=null&&S.root&&ZU(d.__r3f.root,d)}const x=(E=d.__r3f)==null?void 0:E.primitive,w=m===void 0?d.dispose!==null&&!x:m;if(!x){var g;s((g=d.__r3f)==null?void 0:g.objects,d,w),s(d.children,d,w)}d.__r3f&&(delete d.__r3f.root,delete d.__r3f.objects,delete d.__r3f.handlers,delete d.__r3f.memoizedProps,x||delete d.__r3f),w&&d.dispose&&d.type!=="Scene"&&Xv.exports.unstable_scheduleCallback(Xv.exports.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),ol(h)}}function a(h,d,m,v){var _;const E=(_=h.__r3f)==null?void 0:_.parent;if(!E)return;const S=t(d,m,h.__r3f.root);if(h.children){for(const g of h.children)g.__r3f&&i(S,g);h.children=h.children.filter(g=>!g.__r3f)}h.__r3f.objects.forEach(g=>i(S,g)),h.__r3f.objects=[],h.__r3f.autoRemovedBeforeAppend||o(E,h),S.parent&&(S.__r3f.autoRemovedBeforeAppend=!0),i(E,S),S.raycast&&S.__r3f.eventCount&&S.__r3f.root.getState().internal.interaction.push(S),[v,v.alternate].forEach(g=>{g!==null&&(g.stateNode=S,g.ref&&(typeof g.ref=="function"?g.ref(S):g.ref.current=S))})}const c=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:NU({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(h,d)=>{if(!d)return;const m=h.getState().scene;!m.__r3f||(m.__r3f.root=h,i(m,d))},removeChildFromContainer:(h,d)=>{!d||o(h.getState().scene,d)},insertInContainerBefore:(h,d,m)=>{if(!d||!m)return;const v=h.getState().scene;!v.__r3f||r(v,d,m)},getRootHostContext:()=>null,getChildHostContext:h=>h,finalizeInitialChildren(h){var d;const m=(d=h==null?void 0:h.__r3f)!=null?d:{};return Boolean(m.handlers)},prepareUpdate(h,d,m,v){if(h.__r3f.primitive&&v.object&&v.object!==h)return[!0];{const{args:_=[],children:E,...S}=v,{args:g=[],children:x,...w}=m;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((C,P)=>C!==g[P]))return[!0];const T=G3(h,S,w,!0);return T.changes.length?[!1,T]:null}},commitUpdate(h,[d,m],v,_,E,S){d?a(h,v,E,S):o0(h,m)},commitMount(h,d,m,v){var _;const E=(_=h.__r3f)!=null?_:{};h.raycast&&E.handlers&&E.eventCount&&h.__r3f.root.getState().internal.interaction.push(h)},getPublicInstance:h=>h,prepareForCommit:()=>null,preparePortalMount:h=>sl(h.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(h){var d;const{attach:m,parent:v}=(d=h.__r3f)!=null?d:{};m&&v&&aM(v,h,m),h.isObject3D&&(h.visible=!1),ol(h)},unhideInstance(h,d){var m;const{attach:v,parent:_}=(m=h.__r3f)!=null?m:{};v&&_&&s0(_,h,v),(h.isObject3D&&d.visible==null||d.visible)&&(h.visible=!0),ol(h)},createTextInstance:c,hideTextInstance:c,unhideTextInstance:c,getCurrentEventPriority:()=>e?e():Jo.exports.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Zt.fun(performance.now)?performance.now:Zt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Zt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Zt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:o0}}var iM,rM;const U3=()=>{var n;return(n=R_.ColorManagement)!=null?n:null},O3=n=>n&&n.isOrthographicCamera,GU=n=>n&&n.hasOwnProperty("current"),df=typeof window<"u"&&((iM=window.document)!=null&&iM.createElement||((rM=window.navigator)==null?void 0:rM.product)==="ReactNative")?Te.exports.useLayoutEffect:Te.exports.useEffect;function F3(n){const e=Te.exports.useRef(n);return df(()=>void(e.current=n),[n]),e}function WU({set:n}){return df(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class B3 extends Te.exports.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}B3.getDerivedStateFromError=()=>({error:!0});const V3="__default",sM=new Map,XU=n=>n&&!!n.memoized&&!!n.changes;function H3(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const Ou=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},Zt={obj:n=>n===Object(n)&&!Zt.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(Zt.str(n)||Zt.num(n))return n===e;const s=Zt.obj(n);if(s&&i==="reference")return n===e;const o=Zt.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(a in r?e:n)if(!Zt.equ(n[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:n)if(n[a]!==e[a])return!1;if(Zt.und(a)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function jU(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function sl(n,e){const t=n;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),n}function jv(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const oM=/-\d+$/;function s0(n,e,t){if(Zt.str(t)){if(oM.test(t)){const s=t.replace(oM,""),{target:o,key:a}=jv(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=jv(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function aM(n,e,t){var i,r;if(Zt.str(t)){const{target:s,key:o}=jv(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function G3(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:a,...c}={},f=!1){var h;const d=(h=n==null?void 0:n.__r3f)!=null?h:{},m=Object.entries(r),v=[];if(f){const E=Object.keys(c);for(let S=0;S<E.length;S++)r.hasOwnProperty(E[S])||m.unshift([E[S],V3+"remove"])}m.forEach(([E,S])=>{var g;if((g=n.__r3f)!=null&&g.primitive&&E==="object"||Zt.equ(S,c[E]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(E))return v.push([E,S,!0,[]]);let x=[];E.includes("-")&&(x=E.split("-")),v.push([E,S,!1,x]);for(const w in r){const T=r[w];w.startsWith(`${E}-`)&&v.push([w,T,!1,w.split("-")])}});const _={...r};return d.memoizedProps&&d.memoizedProps.args&&(_.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(_.attach=d.memoizedProps.attach),{memoized:_,changes:v}}function o0(n,e){var t,i,r;const s=(t=n.__r3f)!=null?t:{},o=s.root,a=(i=o==null||o.getState==null?void 0:o.getState())!=null?i:{},{memoized:c,changes:f}=XU(e)?e:G3(n,e),h=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=c);for(let m=0;m<f.length;m++){let[v,_,E,S]=f[m],g=n,x=g[v];if(S.length&&(x=S.reduce((w,T)=>w[T],n),!(x&&x.set))){const[w,...T]=S.reverse();g=T.reverse().reduce((C,P)=>C[P],n),v=w}if(_===V3+"remove")if(g.constructor){let w=sM.get(g.constructor);w||(w=new g.constructor,sM.set(g.constructor,w)),_=w[v]}else _=0;if(E)_?s.handlers[v]=_:delete s.handlers[v],s.eventCount=Object.keys(s.handlers).length;else if(x&&x.set&&(x.copy||x instanceof ia)){if(Array.isArray(_))x.fromArray?x.fromArray(_):x.set(..._);else if(x.copy&&_&&_.constructor&&x.constructor===_.constructor)x.copy(_);else if(_!==void 0){const w=x instanceof Re;!w&&x.setScalar?x.setScalar(_):x instanceof ia&&_ instanceof ia?x.mask=_.mask:x.set(_),!U3()&&!a.linear&&w&&x.convertSRGBToLinear()}}else g[v]=_,!a.linear&&g[v]instanceof un&&g[v].format===_i&&g[v].type===Es&&(g[v].encoding=Ot);ol(n)}if(s.parent&&a.internal&&n.raycast&&h!==s.eventCount){const m=a.internal.interaction.indexOf(n);m>-1&&a.internal.interaction.splice(m,1),s.eventCount&&a.internal.interaction.push(n)}return!(f.length===1&&f[0][0]==="onUpdate")&&f.length&&(r=n.__r3f)!=null&&r.parent&&Yv(n),n}function ol(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function Yv(n){n.onUpdate==null||n.onUpdate(n)}function YU(n,e){n.manual||(O3(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function pd(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function qU(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Jo.exports.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Jo.exports.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Jo.exports.ContinuousEventPriority;default:return Jo.exports.DefaultEventPriority}}function W3(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function ZU(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{W3(t.capturedMap,e,i,r)})}function QU(n){function e(c){const{internal:f}=n.getState(),h=c.offsetX-f.initialClick[0],d=c.offsetY-f.initialClick[1];return Math.round(Math.sqrt(h*h+d*d))}function t(c){return c.filter(f=>["Move","Over","Enter","Out","Leave"].some(h=>{var d;return(d=f.__r3f)==null?void 0:d.handlers["onPointer"+h]}))}function i(c,f){const h=n.getState(),d=new Set,m=[],v=f?f(h.internal.interaction):h.internal.interaction;for(let g=0;g<v.length;g++){const x=Ou(v[g]);x&&(x.raycaster.camera=void 0)}h.previousRoot||h.events.compute==null||h.events.compute(c,h);function _(g){const x=Ou(g);if(!x||!x.events.enabled||x.raycaster.camera===null)return[];if(x.raycaster.camera===void 0){var w;x.events.compute==null||x.events.compute(c,x,(w=x.previousRoot)==null?void 0:w.getState()),x.raycaster.camera===void 0&&(x.raycaster.camera=null)}return x.raycaster.camera?x.raycaster.intersectObject(g,!0):[]}let E=v.flatMap(_).sort((g,x)=>{const w=Ou(g.object),T=Ou(x.object);return!w||!T?g.distance-x.distance:T.events.priority-w.events.priority||g.distance-x.distance}).filter(g=>{const x=pd(g);return d.has(x)?!1:(d.add(x),!0)});h.events.filter&&(E=h.events.filter(E,h));for(const g of E){let x=g.object;for(;x;){var S;(S=x.__r3f)!=null&&S.eventCount&&m.push({...g,eventObject:x}),x=x.parent}}if("pointerId"in c&&h.internal.capturedMap.has(c.pointerId))for(let g of h.internal.capturedMap.get(c.pointerId).values())d.has(pd(g.intersection))||m.push(g.intersection);return m}function r(c,f,h,d){const m=n.getState();if(c.length){const v={stopped:!1};for(const _ of c){const E=Ou(_.object)||m,{raycaster:S,pointer:g,camera:x,internal:w}=E,T=new N(g.x,g.y,0).unproject(x),C=L=>{var H,q;return(H=(q=w.capturedMap.get(L))==null?void 0:q.has(_.eventObject))!=null?H:!1},P=L=>{const H={intersection:_,target:f.target};w.capturedMap.has(L)?w.capturedMap.get(L).set(_.eventObject,H):w.capturedMap.set(L,new Map([[_.eventObject,H]])),f.target.setPointerCapture(L)},R=L=>{const H=w.capturedMap.get(L);H&&W3(w.capturedMap,_.eventObject,H,L)};let I={};for(let L in f){let H=f[L];typeof H!="function"&&(I[L]=H)}let b={..._,...I,pointer:g,intersections:c,stopped:v.stopped,delta:h,unprojectedPoint:T,ray:S.ray,camera:x,stopPropagation(){const L="pointerId"in f&&w.capturedMap.get(f.pointerId);if((!L||L.has(_.eventObject))&&(b.stopped=v.stopped=!0,w.hovered.size&&Array.from(w.hovered.values()).find(H=>H.eventObject===_.eventObject))){const H=c.slice(0,c.indexOf(_));s([...H,_])}},target:{hasPointerCapture:C,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:C,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(d(b),v.stopped===!0)break}}return c}function s(c){const{internal:f}=n.getState();for(const h of f.hovered.values())if(!c.length||!c.find(d=>d.object===h.object&&d.index===h.index&&d.instanceId===h.instanceId)){const m=h.eventObject.__r3f,v=m==null?void 0:m.handlers;if(f.hovered.delete(pd(h)),m!=null&&m.eventCount){const _={...h,intersections:c};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function o(c,f){for(let h=0;h<f.length;h++){const d=f[h].__r3f;d==null||d.handlers.onPointerMissed==null||d.handlers.onPointerMissed(c)}}function a(c){switch(c){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return f=>{const{internal:h}=n.getState();"pointerId"in f&&h.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{h.capturedMap.has(f.pointerId)&&(h.capturedMap.delete(f.pointerId),s([]))})}}return function(h){const{onPointerMissed:d,internal:m}=n.getState();m.lastEvent.current=h;const v=c==="onPointerMove",_=c==="onClick"||c==="onContextMenu"||c==="onDoubleClick",S=i(h,v?t:void 0),g=_?e(h):0;c==="onPointerDown"&&(m.initialClick=[h.offsetX,h.offsetY],m.initialHits=S.map(w=>w.eventObject)),_&&!S.length&&g<=2&&(o(h,m.interaction),d&&d(h)),v&&s(S);function x(w){const T=w.eventObject,C=T.__r3f,P=C==null?void 0:C.handlers;if(!!(C!=null&&C.eventCount))if(v){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const R=pd(w),I=m.hovered.get(R);I?I.stopped&&w.stopPropagation():(m.hovered.set(R,w),P.onPointerOver==null||P.onPointerOver(w),P.onPointerEnter==null||P.onPointerEnter(w))}P.onPointerMove==null||P.onPointerMove(w)}else{const R=P[c];R?(!_||m.initialHits.includes(T))&&(o(h,m.interaction.filter(I=>!m.initialHits.includes(I))),R(w)):_&&m.initialHits.includes(T)&&o(h,m.interaction.filter(I=>!m.initialHits.includes(I)))}}r(S,h,g,x)}}return{handlePointer:a}}const X3=n=>!!(n!=null&&n.render),j3=Te.exports.createContext(null),JU=(n,e)=>{const t=LU((a,c)=>{const f=new N,h=new N,d=new N;function m(g=c().camera,x=h,w=c().size){const{width:T,height:C,top:P,left:R}=w,I=T/C;x instanceof N?d.copy(x):d.set(...x);const b=g.getWorldPosition(f).distanceTo(d);if(O3(g))return{width:T/g.zoom,height:C/g.zoom,top:P,left:R,factor:1,distance:b,aspect:I};{const L=g.fov*Math.PI/180,H=2*Math.tan(L/2)*b,q=H*(T/C);return{width:q,height:H,top:P,left:R,factor:T/q,distance:b,aspect:I}}}let v;const _=g=>a(x=>({performance:{...x.performance,current:g}})),E=new ge;return{set:a,get:c,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>n(c(),g),advance:(g,x)=>e(g,x,c()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new T_,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=c();v&&clearTimeout(v),g.performance.current!==g.performance.min&&_(g.performance.min),v=setTimeout(()=>_(c().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:g=>a(x=>({...x,events:{...x.events,...g}})),setSize:(g,x,w,T,C)=>{const P=c().camera,R={width:g,height:x,top:T||0,left:C||0,updateStyle:w};a(I=>({size:R,viewport:{...I.viewport,...m(P,h,R)}}))},setDpr:g=>a(x=>{const w=H3(g);return{viewport:{...x.viewport,dpr:w,initialDpr:x.viewport.initialDpr||w}}}),setFrameloop:(g="always")=>{const x=c().clock;x.stop(),x.elapsedTime=0,g!=="never"&&(x.start(),x.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Te.exports.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,x,w)=>{const T=c().internal;return T.priority=T.priority+(x>0?1:0),T.subscribers.push({ref:g,priority:x,store:w}),T.subscribers=T.subscribers.sort((C,P)=>C.priority-P.priority),()=>{const C=c().internal;C!=null&&C.subscribers&&(C.priority=C.priority-(x>0?1:0),C.subscribers=C.subscribers.filter(P=>P.ref!==g))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:c,viewport:f,gl:h,set:d}=t.getState();if(c!==r||f.dpr!==s){var m;r=c,s=f.dpr,YU(a,c),h.setPixelRatio(f.dpr);const v=(m=c.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.setSize(c.width,c.height,v)}a!==o&&(o=a,d(v=>({viewport:{...v.viewport,...v.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let md,KU=new Set,$U=new Set,e4=new Set;function a0(n,e){if(!!n.size)for(const{callback:t}of n.values())t(e)}function Fu(n,e){switch(n){case"before":return a0(KU,e);case"after":return a0($U,e);case"tail":return a0(e4,e)}}let l0,u0;function c0(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),l0=e.internal.subscribers,md=0;md<l0.length;md++)u0=l0[md],u0.ref.current(u0.store.getState(),i,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}function t4(n){let e=!1,t,i,r;function s(c){i=requestAnimationFrame(s),e=!0,t=0,Fu("before",c);for(const h of n.values()){var f;r=h.store.getState(),r.internal.active&&(r.frameloop==="always"||r.internal.frames>0)&&!((f=r.gl.xr)!=null&&f.isPresenting)&&(t+=c0(c,r))}if(Fu("after",c),t===0)return Fu("tail",c),e=!1,cancelAnimationFrame(i)}function o(c,f=1){var h;if(!c)return n.forEach(d=>o(d.store.getState()),f);(h=c.gl.xr)!=null&&h.isPresenting||!c.internal.active||c.frameloop==="never"||(c.internal.frames=Math.min(60,c.internal.frames+f),e||(e=!0,requestAnimationFrame(s)))}function a(c,f=!0,h,d){if(f&&Fu("before",c),h)c0(c,h,d);else for(const m of n.values())c0(c,m.store.getState());f&&Fu("after",c)}return{loop:s,invalidate:o,advance:a}}function Y3(){const n=Te.exports.useContext(j3);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function $i(n=t=>t,e){return Y3()(n,e)}function n4(n,e=0){const t=Y3(),i=t.getState().internal.subscribe,r=F3(n);return df(()=>i(r,e,t),[e,i,t]),null}const Hl=new Map,{invalidate:lM,advance:uM}=t4(Hl),{reconciler:cp,applyProps:Bu}=HU(Hl,qU),rl={objects:"shallow",strict:!1},i4=(n,e)=>{const t=typeof n=="function"?n(e):n;return X3(t)?t:new o_({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function r4(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:r,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:r,left:s}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function s4(n){const e=Hl.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||JU(lM,uM),o=t||cp.createContainer(s,Jo.exports.ConcurrentRoot,null,!1,null,"",r,null);e||Hl.set(n,{fiber:o,store:s});let a,c=!1,f;return{configure(h={}){let{gl:d,size:m,scene:v,events:_,onCreated:E,shadows:S=!1,linear:g=!1,flat:x=!1,legacy:w=!1,orthographic:T=!1,frameloop:C="always",dpr:P=[1,2],performance:R,raycaster:I,camera:b,onPointerMissed:L}=h,H=s.getState(),q=H.gl;H.gl||H.set({gl:q=i4(d,n)});let G=H.raycaster;G||H.set({raycaster:G=new P_});const{params:W,...ee}=I||{};if(Zt.equ(ee,G,rl)||Bu(G,{...ee}),Zt.equ(W,G.params,rl)||Bu(G,{params:{...G.params,...W}}),!H.camera||H.camera===f&&!Zt.equ(f,b,rl)){f=b;const J=b instanceof Jc,Y=J?b:T?new $c(0,0,0,0,.1,1e3):new In(75,0,.1,1e3);J||(Y.position.z=5,b&&Bu(Y,b),!H.camera&&!(b!=null&&b.rotation)&&Y.lookAt(0,0,0)),H.set({camera:Y})}if(!H.scene){let J;v instanceof up?J=v:(J=new up,v&&Bu(J,v)),H.set({scene:sl(J)})}if(!H.xr){const J=(z,ye)=>{const pe=s.getState();pe.frameloop!=="never"&&uM(z,!0,pe,ye)},Y=()=>{const z=s.getState();z.gl.xr.enabled=z.gl.xr.isPresenting,z.gl.xr.setAnimationLoop(z.gl.xr.isPresenting?J:null),z.gl.xr.isPresenting||lM(z)},K={connect(){const z=s.getState().gl;z.xr.addEventListener("sessionstart",Y),z.xr.addEventListener("sessionend",Y)},disconnect(){const z=s.getState().gl;z.xr.removeEventListener("sessionstart",Y),z.xr.removeEventListener("sessionend",Y)}};q.xr&&K.connect(),H.set({xr:K})}if(q.shadowMap){const J=q.shadowMap.enabled,Y=q.shadowMap.type;if(q.shadowMap.enabled=!!S,Zt.boo(S))q.shadowMap.type=ic;else if(Zt.str(S)){var oe;const K={basic:NT,percentage:bp,soft:ic,variance:jo};q.shadowMap.type=(oe=K[S])!=null?oe:ic}else Zt.obj(S)&&Object.assign(q.shadowMap,S);(J!==q.shadowMap.enabled||Y!==q.shadowMap.type)&&(q.shadowMap.needsUpdate=!0)}const ue=U3();ue&&("enabled"in ue?ue.enabled=!w:"legacyMode"in ue&&(ue.legacyMode=w));const D=g?Ts:Ot,V=x?Ar:jy;q.outputEncoding!==D&&(q.outputEncoding=D),q.toneMapping!==V&&(q.toneMapping=V),H.legacy!==w&&H.set(()=>({legacy:w})),H.linear!==g&&H.set(()=>({linear:g})),H.flat!==x&&H.set(()=>({flat:x})),d&&!Zt.fun(d)&&!X3(d)&&!Zt.equ(d,q,rl)&&Bu(q,d),_&&!H.events.handlers&&H.set({events:_(s)});const B=r4(n,m);return Zt.equ(B,H.size,rl)||H.setSize(B.width,B.height,B.updateStyle,B.top,B.left),P&&H.viewport.dpr!==H3(P)&&H.setDpr(P),H.frameloop!==C&&H.setFrameloop(C),H.onPointerMissed||H.set({onPointerMissed:L}),R&&!Zt.equ(R,H.performance,rl)&&H.set(J=>({performance:{...J.performance,...R}})),a=E,c=!0,this},render(h){return c||this.configure(),cp.updateContainer(Gt(o4,{store:s,children:h,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){q3(n)}}}function o4({store:n,children:e,onCreated:t,rootElement:i}){return df(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),Te.exports.createElement(j3.Provider,{value:n},e)}function q3(n,e){const t=Hl.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),cp.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,c;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(c=r.gl)!=null&&c.xr&&r.xr.disconnect(),jU(r),Hl.delete(n),e&&e(n)}catch{}},500)})}}cp.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Te.exports.version});function qv(n,e,t){var i,r,s,o,a;e==null&&(e=100);function c(){var h=Date.now()-o;h<e&&h>=0?i=setTimeout(c,e-h):(i=null,t||(a=n.apply(s,r),s=r=null))}var f=function(){s=this,r=arguments,o=Date.now();var h=t&&!i;return i||(i=setTimeout(c,e)),h&&(a=n.apply(s,r),s=r=null),a};return f.clear=function(){i&&(clearTimeout(i),i=null)},f.flush=function(){i&&(a=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},f}qv.debounce=qv;var cM=qv;function a4(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:r}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)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,a]=Te.exports.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=Te.exports.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),f=e?typeof e=="number"?e:e.scroll:null,h=e?typeof e=="number"?e:e.resize:null,d=Te.exports.useRef(!1);Te.exports.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[m,v,_]=Te.exports.useMemo(()=>{const x=()=>{if(!c.current.element)return;const{left:w,top:T,width:C,height:P,bottom:R,right:I,x:b,y:L}=c.current.element.getBoundingClientRect(),H={left:w,top:T,width:C,height:P,bottom:R,right:I,x:b,y:L};c.current.element instanceof HTMLElement&&r&&(H.height=c.current.element.offsetHeight,H.width=c.current.element.offsetWidth),Object.freeze(H),d.current&&!f4(c.current.lastBounds,H)&&a(c.current.lastBounds=H)};return[x,h?cM(x,h):x,f?cM(x,f):x]},[a,r,f,h]);function E(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(x=>x.removeEventListener("scroll",_,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null)}function S(){!c.current.element||(c.current.resizeObserver=new s(_),c.current.resizeObserver.observe(c.current.element),t&&c.current.scrollContainers&&c.current.scrollContainers.forEach(x=>x.addEventListener("scroll",_,{capture:!0,passive:!0})))}const g=x=>{!x||x===c.current.element||(E(),c.current.element=x,c.current.scrollContainers=Z3(x),S())};return u4(_,Boolean(t)),l4(v),Te.exports.useEffect(()=>{E(),S()},[t,_,v]),Te.exports.useEffect(()=>E,[]),[g,o,m]}function l4(n){Te.exports.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function u4(n,e){Te.exports.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function Z3(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...Z3(n.parentElement)]}const c4=["x","y","top","bottom","left","right","width","height"],f4=(n,e)=>c4.every(t=>n[t]===e[t]);var h4=Object.defineProperty,d4=Object.defineProperties,p4=Object.getOwnPropertyDescriptors,fM=Object.getOwnPropertySymbols,m4=Object.prototype.hasOwnProperty,g4=Object.prototype.propertyIsEnumerable,hM=(n,e,t)=>e in n?h4(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,dM=(n,e)=>{for(var t in e||(e={}))m4.call(e,t)&&hM(n,t,e[t]);if(fM)for(var t of fM(e))g4.call(e,t)&&hM(n,t,e[t]);return n},v4=(n,e)=>d4(n,p4(e));function Q3(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const r=Q3(i,e,t);if(r)return r;i=e?null:i.sibling}}function J3(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const I_=J3(Te.exports.createContext(null));class K3 extends Te.exports.Component{render(){return Gt(I_.Provider,{value:this._reactInternals,children:this.props.children})}}const{ReactCurrentOwner:pM,ReactCurrentDispatcher:mM}=Te.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y4(){const n=Te.exports.useContext(I_);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Te.exports.useId();return Te.exports.useMemo(()=>{var i;return(i=pM==null?void 0:pM.current)!=null?i:Q3(n,!1,r=>{let s=r.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}})},[n,e])}function _4(){var n,e;const t=y4(),[i]=Te.exports.useState(()=>new Map);i.clear();let r=t;for(;r;){const s=(n=r.type)==null?void 0:n._context;s&&s!==I_&&!i.has(s)&&i.set(s,(e=mM==null?void 0:mM.current)==null?void 0:e.readContext(J3(s))),r=r.return}return i}function x4(){const n=_4();return Te.exports.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>Te.exports.createElement(e,null,Te.exports.createElement(t.Provider,v4(dM({},i),{value:n.get(t)}))),e=>Gt(K3,{...dM({},e)})),[n])}const f0={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 S4(n){const{handlePointer:e}=QU(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(f0).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[c,f]=f0[o];t.addEventListener(c,a,{passive:f})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=f0[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const w4=Te.exports.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=S4,eventSource:a,eventPrefix:c,shadows:f,linear:h,flat:d,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:S,raycaster:g,camera:x,onPointerMissed:w,onCreated:T,...C},P){Te.exports.useMemo(()=>VU(CU),[]);const R=x4(),[I,b]=a4({scroll:!0,debounce:{scroll:50,resize:0},...i}),L=Te.exports.useRef(null),H=Te.exports.useRef(null);Te.exports.useImperativeHandle(P,()=>L.current);const q=F3(w),[G,W]=Te.exports.useState(!1),[ee,oe]=Te.exports.useState(!1);if(G)throw G;if(ee)throw ee;const ue=Te.exports.useRef(null);return df(()=>{const V=L.current;b.width>0&&b.height>0&&V&&(ue.current||(ue.current=s4(V)),ue.current.configure({gl:s,events:o,shadows:f,linear:h,flat:d,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:S,raycaster:g,camera:x,size:b,onPointerMissed:(...B)=>q.current==null?void 0:q.current(...B),onCreated:B=>{B.events.connect==null||B.events.connect(a?GU(a)?a.current:a:H.current),c&&B.setEvents({compute:(J,Y)=>{const K=J[c+"X"],z=J[c+"Y"];Y.pointer.set(K/Y.size.width*2-1,-(z/Y.size.height)*2+1),Y.raycaster.setFromCamera(Y.pointer,Y.camera)}}),T==null||T(B)}}),ue.current.render(Gt(R,{children:Gt(B3,{set:oe,children:Gt(Te.exports.Suspense,{fallback:Gt(WU,{set:W}),children:e})})})))}),Te.exports.useEffect(()=>{const V=L.current;if(V)return()=>q3(V)},[]),Gt("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:a?"none":"auto",...r},...C,children:Gt("div",{ref:I,style:{width:"100%",height:"100%"},children:Gt("canvas",{ref:L,style:{display:"block"},children:t})})})}),M4=Te.exports.forwardRef(function(e,t){return Gt(K3,{children:Gt(w4,{...e,ref:t})})});function E4(n){return function(e){n.forEach(function(t){typeof t=="function"?t(e):t!=null&&(t.current=e)})}}function Hc(n){return Hc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hc(n)}function T4(n,e){if(Hc(n)!=="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(Hc(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function A4(n){var e=T4(n,"string");return Hc(e)==="symbol"?e:String(e)}function le(n,e,t){return e=A4(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class C4 extends St{constructor(e,t){super(),le(this,"isTransformControls",!0),le(this,"visible",!1),le(this,"domElement",void 0),le(this,"raycaster",new P_),le(this,"gizmo",void 0),le(this,"plane",void 0),le(this,"tempVector",new N),le(this,"tempVector2",new N),le(this,"tempQuaternion",new It),le(this,"unit",{X:new N(1,0,0),Y:new N(0,1,0),Z:new N(0,0,1)}),le(this,"pointStart",new N),le(this,"pointEnd",new N),le(this,"offset",new N),le(this,"rotationAxis",new N),le(this,"startNorm",new N),le(this,"endNorm",new N),le(this,"rotationAngle",0),le(this,"cameraPosition",new N),le(this,"cameraQuaternion",new It),le(this,"cameraScale",new N),le(this,"parentPosition",new N),le(this,"parentQuaternion",new It),le(this,"parentQuaternionInv",new It),le(this,"parentScale",new N),le(this,"worldPositionStart",new N),le(this,"worldQuaternionStart",new It),le(this,"worldScaleStart",new N),le(this,"worldPosition",new N),le(this,"worldQuaternion",new It),le(this,"worldQuaternionInv",new It),le(this,"worldScale",new N),le(this,"eye",new N),le(this,"positionStart",new N),le(this,"quaternionStart",new It),le(this,"scaleStart",new N),le(this,"camera",void 0),le(this,"object",void 0),le(this,"enabled",!0),le(this,"axis",null),le(this,"mode","translate"),le(this,"translationSnap",null),le(this,"rotationSnap",null),le(this,"scaleSnap",null),le(this,"space","world"),le(this,"size",1),le(this,"dragging",!1),le(this,"showX",!0),le(this,"showY",!0),le(this,"showZ",!0),le(this,"changeEvent",{type:"change"}),le(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),le(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),le(this,"objectChangeEvent",{type:"objectChange"}),le(this,"intersectObjectWithRay",(r,s,o)=>{const a=s.intersectObject(r,!0);for(let c=0;c<a.length;c++)if(a[c].object.visible||o)return a[c];return!1}),le(this,"attach",r=>(this.object=r,this.visible=!0,this)),le(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),le(this,"reset",()=>this.enabled?(this.dragging&&this.object!==void 0&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this):this),le(this,"updateMatrixWorld",()=>{this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()}),le(this,"pointerHover",r=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(r,this.camera);const s=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);s?this.axis=s.object.name:this.axis=null}),le(this,"pointerDown",r=>{if(!(this.object===void 0||this.dragging===!0||r.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(r,this.camera);const s=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(s){let o=this.space;if(this.mode==="scale"?o="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(o="world"),o==="local"&&this.mode==="rotate"){const a=this.rotationSnap;this.axis==="X"&&a&&(this.object.rotation.x=Math.round(this.object.rotation.x/a)*a),this.axis==="Y"&&a&&(this.object.rotation.y=Math.round(this.object.rotation.y/a)*a),this.axis==="Z"&&a&&(this.object.rotation.z=Math.round(this.object.rotation.z/a)*a)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(s.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),le(this,"pointerMove",r=>{const s=this.axis,o=this.mode,a=this.object;let c=this.space;if(o==="scale"?c="local":(s==="E"||s==="XYZE"||s==="XYZ")&&(c="world"),a===void 0||s===null||this.dragging===!1||r.button!==-1)return;this.raycaster.setFromCamera(r,this.camera);const f=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(!!f){if(this.pointEnd.copy(f.point).sub(this.worldPositionStart),o==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),c==="local"&&s!=="XYZ"&&this.offset.applyQuaternion(this.worldQuaternionInv),s.indexOf("X")===-1&&(this.offset.x=0),s.indexOf("Y")===-1&&(this.offset.y=0),s.indexOf("Z")===-1&&(this.offset.z=0),c==="local"&&s!=="XYZ"?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),a.position.copy(this.offset).add(this.positionStart),this.translationSnap&&(c==="local"&&(a.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),s.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.position.applyQuaternion(this.quaternionStart)),c==="world"&&(a.parent&&a.position.add(this.tempVector.setFromMatrixPosition(a.parent.matrixWorld)),s.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.parent&&a.position.sub(this.tempVector.setFromMatrixPosition(a.parent.matrixWorld))));else if(o==="scale"){if(s.search("XYZ")!==-1){let h=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(h*=-1),this.tempVector2.set(h,h,h)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),s.search("X")===-1&&(this.tempVector2.x=1),s.search("Y")===-1&&(this.tempVector2.y=1),s.search("Z")===-1&&(this.tempVector2.z=1);a.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(s.search("X")!==-1&&(this.object.scale.x=Math.round(a.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Y")!==-1&&(a.scale.y=Math.round(a.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Z")!==-1&&(a.scale.z=Math.round(a.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const h=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));s==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this.endNorm.cross(this.startNorm).dot(this.eye)<0?1:-1):s==="XYZE"?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*h):(s==="X"||s==="Y"||s==="Z")&&(this.rotationAxis.copy(this.unit[s]),this.tempVector.copy(this.unit[s]),c==="local"&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*h),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),c==="local"&&s!=="E"&&s!=="XYZE"?(a.quaternion.copy(this.quaternionStart),a.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),a.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),a.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),le(this,"pointerUp",r=>{r.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),le(this,"getPointer",r=>{var s;if(this.domElement&&(s=this.domElement.ownerDocument)!==null&&s!==void 0&&s.pointerLockElement)return{x:0,y:0,button:r.button};{var o;const a=r.changedTouches?r.changedTouches[0]:r,c=(o=this.domElement)===null||o===void 0?void 0:o.getBoundingClientRect();return{x:(a.clientX-c.left)/c.width*2-1,y:-(a.clientY-c.top)/c.height*2+1,button:r.button}}}),le(this,"onPointerHover",r=>{if(!!this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(r));break}}),le(this,"onPointerDown",r=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(r)),this.pointerDown(this.getPointer(r)))}),le(this,"onPointerMove",r=>{!this.enabled||this.pointerMove(this.getPointer(r))}),le(this,"onPointerUp",r=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(r)))}),le(this,"getMode",()=>this.mode),le(this,"setMode",r=>{this.mode=r}),le(this,"setTranslationSnap",r=>{this.translationSnap=r}),le(this,"setRotationSnap",r=>{this.rotationSnap=r}),le(this,"setScaleSnap",r=>{this.scaleSnap=r}),le(this,"setSize",r=>{this.size=r}),le(this,"setSpace",r=>{this.space=r}),le(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),le(this,"connect",r=>{r===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=r,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),le(this,"dispose",()=>{var r,s,o,a,c,f;(r=this.domElement)===null||r===void 0||r.removeEventListener("pointerdown",this.onPointerDown),(s=this.domElement)===null||s===void 0||s.removeEventListener("pointermove",this.onPointerHover),(o=this.domElement)===null||o===void 0||(a=o.ownerDocument)===null||a===void 0||a.removeEventListener("pointermove",this.onPointerMove),(c=this.domElement)===null||c===void 0||(f=c.ownerDocument)===null||f===void 0||f.removeEventListener("pointerup",this.onPointerUp),this.traverse(h=>{const d=h;d.geometry&&d.geometry.dispose(),d.material&&d.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new b4,this.add(this.gizmo),this.plane=new P4,this.add(this.plane);const i=(r,s)=>{let o=s;Object.defineProperty(this,r,{get:function(){return o!==void 0?o:s},set:function(a){o!==a&&(o=a,this.plane[r]=a,this.gizmo[r]=a,this.dispatchEvent({type:r+"-changed",value:a}),this.dispatchEvent(this.changeEvent))}}),this[r]=s,this.plane[r]=s,this.gizmo[r]=s};i("camera",this.camera),i("object",this.object),i("enabled",this.enabled),i("axis",this.axis),i("mode",this.mode),i("translationSnap",this.translationSnap),i("rotationSnap",this.rotationSnap),i("scaleSnap",this.scaleSnap),i("space",this.space),i("size",this.size),i("dragging",this.dragging),i("showX",this.showX),i("showY",this.showY),i("showZ",this.showZ),i("worldPosition",this.worldPosition),i("worldPositionStart",this.worldPositionStart),i("worldQuaternion",this.worldQuaternion),i("worldQuaternionStart",this.worldQuaternionStart),i("cameraPosition",this.cameraPosition),i("cameraQuaternion",this.cameraQuaternion),i("pointStart",this.pointStart),i("pointEnd",this.pointEnd),i("rotationAxis",this.rotationAxis),i("rotationAngle",this.rotationAngle),i("eye",this.eye),t!==void 0&&this.connect(t)}}class b4 extends St{constructor(){super(),le(this,"isTransformControlsGizmo",!0),le(this,"type","TransformControlsGizmo"),le(this,"tempVector",new N(0,0,0)),le(this,"tempEuler",new Yl),le(this,"alignVector",new N(0,1,0)),le(this,"zeroVector",new N(0,0,0)),le(this,"lookAtMatrix",new st),le(this,"tempQuaternion",new It),le(this,"tempQuaternion2",new It),le(this,"identityQuaternion",new It),le(this,"unitX",new N(1,0,0)),le(this,"unitY",new N(0,1,0)),le(this,"unitZ",new N(0,0,1)),le(this,"gizmo",void 0),le(this,"picker",void 0),le(this,"helper",void 0),le(this,"rotationAxis",new N),le(this,"cameraPosition",new N),le(this,"worldPositionStart",new N),le(this,"worldQuaternionStart",new It),le(this,"worldPosition",new N),le(this,"worldQuaternion",new It),le(this,"eye",new N),le(this,"camera",null),le(this,"enabled",!0),le(this,"axis",null),le(this,"mode","translate"),le(this,"space","world"),le(this,"size",1),le(this,"dragging",!1),le(this,"showX",!0),le(this,"showY",!0),le(this,"showZ",!0),le(this,"updateMatrixWorld",()=>{let B=this.space;this.mode==="scale"&&(B="local");const J=B==="local"?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let Y=[];Y=Y.concat(this.picker[this.mode].children),Y=Y.concat(this.gizmo[this.mode].children),Y=Y.concat(this.helper[this.mode].children);for(let K=0;K<Y.length;K++){const z=Y[K];z.visible=!0,z.rotation.set(0,0,0),z.position.copy(this.worldPosition);let ye;if(this.camera.isOrthographicCamera?ye=(this.camera.top-this.camera.bottom)/this.camera.zoom:ye=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),z.scale.set(1,1,1).multiplyScalar(ye*this.size/7),z.tag==="helper"){z.visible=!1,z.name==="AXIS"?(z.position.copy(this.worldPositionStart),z.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),z.quaternion.copy(J).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(J).dot(this.eye))>.9&&(z.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),z.quaternion.copy(J).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(J).dot(this.eye))>.9&&(z.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),z.quaternion.copy(J).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(J).dot(this.eye))>.9&&(z.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),z.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),z.quaternion.multiply(this.tempQuaternion),z.visible=this.dragging),this.axis==="E"&&(z.visible=!1)):z.name==="START"?(z.position.copy(this.worldPositionStart),z.visible=this.dragging):z.name==="END"?(z.position.copy(this.worldPosition),z.visible=this.dragging):z.name==="DELTA"?(z.position.copy(this.worldPositionStart),z.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),z.scale.copy(this.tempVector),z.visible=this.dragging):(z.quaternion.copy(J),this.dragging?z.position.copy(this.worldPositionStart):z.position.copy(this.worldPosition),this.axis&&(z.visible=this.axis.search(z.name)!==-1));continue}z.quaternion.copy(J),this.mode==="translate"||this.mode==="scale"?((z.name==="X"||z.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(J).dot(this.eye))>.99&&(z.scale.set(1e-10,1e-10,1e-10),z.visible=!1),(z.name==="Y"||z.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(J).dot(this.eye))>.99&&(z.scale.set(1e-10,1e-10,1e-10),z.visible=!1),(z.name==="Z"||z.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(J).dot(this.eye))>.99&&(z.scale.set(1e-10,1e-10,1e-10),z.visible=!1),z.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(J).dot(this.eye))<.2&&(z.scale.set(1e-10,1e-10,1e-10),z.visible=!1),z.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(J).dot(this.eye))<.2&&(z.scale.set(1e-10,1e-10,1e-10),z.visible=!1),z.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(J).dot(this.eye))<.2&&(z.scale.set(1e-10,1e-10,1e-10),z.visible=!1),z.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(J).dot(this.eye)<0?z.tag==="fwd"?z.visible=!1:z.scale.x*=-1:z.tag==="bwd"&&(z.visible=!1)),z.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(J).dot(this.eye)<0?z.tag==="fwd"?z.visible=!1:z.scale.y*=-1:z.tag==="bwd"&&(z.visible=!1)),z.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(J).dot(this.eye)<0?z.tag==="fwd"?z.visible=!1:z.scale.z*=-1:z.tag==="bwd"&&(z.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(J),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(J).invert()),z.name.search("E")!==-1&&z.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),z.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),z.quaternion.copy(this.tempQuaternion)),z.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),z.quaternion.copy(this.tempQuaternion)),z.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),z.quaternion.copy(this.tempQuaternion))),z.visible=z.visible&&(z.name.indexOf("X")===-1||this.showX),z.visible=z.visible&&(z.name.indexOf("Y")===-1||this.showY),z.visible=z.visible&&(z.name.indexOf("Z")===-1||this.showZ),z.visible=z.visible&&(z.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),z.material.tempOpacity=z.material.tempOpacity||z.material.opacity,z.material.tempColor=z.material.tempColor||z.material.color.clone(),z.material.color.copy(z.material.tempColor),z.material.opacity=z.material.tempOpacity,this.enabled?this.axis&&(z.name===this.axis?(z.material.opacity=1,z.material.color.lerp(new Re(1,1,1),.5)):this.axis.split("").some(function(pe){return z.name===pe})?(z.material.opacity=1,z.material.color.lerp(new Re(1,1,1),.5)):(z.material.opacity*=.25,z.material.color.lerp(new Re(1,1,1),.5))):(z.material.opacity*=.5,z.material.color.lerp(new Re(1,1,1),.5))}super.updateMatrixWorld()});const e=new Zr({depthTest:!1,depthWrite:!1,transparent:!0,side:nr,fog:!1,toneMapped:!1}),t=new $n({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),i=e.clone();i.opacity=.15;const r=e.clone();r.opacity=.33;const s=e.clone();s.color.set(16711680);const o=e.clone();o.color.set(65280);const a=e.clone();a.color.set(255);const c=e.clone();c.opacity=.25;const f=c.clone();f.color.set(16776960);const h=c.clone();h.color.set(65535);const d=c.clone();d.color.set(16711935),e.clone().color.set(16776960);const v=t.clone();v.color.set(16711680);const _=t.clone();_.color.set(65280);const E=t.clone();E.color.set(255);const S=t.clone();S.color.set(65535);const g=t.clone();g.color.set(16711935);const x=t.clone();x.color.set(16776960);const w=t.clone();w.color.set(7895160);const T=x.clone();T.opacity=.25;const C=new Ln(0,.05,.2,12,1,!1),P=new oi(.125,.125,.125),R=new lt;R.setAttribute("position",new Be([0,0,0,1,0,0],3));const I=(B,J)=>{const Y=new lt,K=[];for(let z=0;z<=64*J;++z)K.push(0,Math.cos(z/32*Math.PI)*B,Math.sin(z/32*Math.PI)*B);return Y.setAttribute("position",new Be(K,3)),Y},b=()=>{const B=new lt;return B.setAttribute("position",new Be([0,0,0,1,1,1],3)),B},L={X:[[new Ne(C,s),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new Ne(C,s),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new vt(R,v)]],Y:[[new Ne(C,o),[0,1,0],null,null,"fwd"],[new Ne(C,o),[0,1,0],[Math.PI,0,0],null,"bwd"],[new vt(R,_),null,[0,0,Math.PI/2]]],Z:[[new Ne(C,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new Ne(C,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new vt(R,E),null,[0,-Math.PI/2,0]]],XYZ:[[new Ne(new Ii(.1,0),c.clone()),[0,0,0],[0,0,0]]],XY:[[new Ne(new Di(.295,.295),f.clone()),[.15,.15,0]],[new vt(R,x),[.18,.3,0],null,[.125,1,1]],[new vt(R,x),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new Ne(new Di(.295,.295),h.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new vt(R,S),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new vt(R,S),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new Ne(new Di(.295,.295),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new vt(R,g),[.18,0,.3],null,[.125,1,1]],[new vt(R,g),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},H={X:[[new Ne(new Ln(.2,0,1,4,1,!1),i),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new Ne(new Ln(.2,0,1,4,1,!1),i),[0,.6,0]]],Z:[[new Ne(new Ln(.2,0,1,4,1,!1),i),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new Ne(new Ii(.2,0),i)]],XY:[[new Ne(new Di(.4,.4),i),[.2,.2,0]]],YZ:[[new Ne(new Di(.4,.4),i),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new Ne(new Di(.4,.4),i),[.2,0,.2],[-Math.PI/2,0,0]]]},q={START:[[new Ne(new Ii(.01,2),r),null,null,null,"helper"]],END:[[new Ne(new Ii(.01,2),r),null,null,null,"helper"]],DELTA:[[new vt(b(),r),null,null,null,"helper"]],X:[[new vt(R,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new vt(R,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new vt(R,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},G={X:[[new vt(I(1,.5),v)],[new Ne(new Ii(.04,0),s),[0,0,.99],null,[1,3,1]]],Y:[[new vt(I(1,.5),_),null,[0,0,-Math.PI/2]],[new Ne(new Ii(.04,0),o),[0,0,.99],null,[3,1,1]]],Z:[[new vt(I(1,.5),E),null,[0,Math.PI/2,0]],[new Ne(new Ii(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new vt(I(1.25,1),T),null,[0,Math.PI/2,0]],[new Ne(new Ln(.03,0,.15,4,1,!1),T),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new Ne(new Ln(.03,0,.15,4,1,!1),T),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new Ne(new Ln(.03,0,.15,4,1,!1),T),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new Ne(new Ln(.03,0,.15,4,1,!1),T),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new vt(I(1,1),w),null,[0,Math.PI/2,0]]]},W={AXIS:[[new vt(R,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},ee={X:[[new Ne(new gs(1,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Ne(new gs(1,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Ne(new gs(1,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new Ne(new gs(1.25,.1,2,24),i)]],XYZE:[[new Ne(new ya(.7,10,8),i)]]},oe={X:[[new Ne(P,s),[.8,0,0],[0,0,-Math.PI/2]],[new vt(R,v),null,null,[.8,1,1]]],Y:[[new Ne(P,o),[0,.8,0]],[new vt(R,_),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new Ne(P,a),[0,0,.8],[Math.PI/2,0,0]],[new vt(R,E),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new Ne(P,f),[.85,.85,0],null,[2,2,.2]],[new vt(R,x),[.855,.98,0],null,[.125,1,1]],[new vt(R,x),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new Ne(P,h),[0,.85,.85],null,[.2,2,2]],[new vt(R,S),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new vt(R,S),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new Ne(P,d),[.85,0,.85],null,[2,.2,2]],[new vt(R,g),[.855,0,.98],null,[.125,1,1]],[new vt(R,g),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new Ne(new oi(.125,.125,.125),c.clone()),[1.1,0,0]]],XYZY:[[new Ne(new oi(.125,.125,.125),c.clone()),[0,1.1,0]]],XYZZ:[[new Ne(new oi(.125,.125,.125),c.clone()),[0,0,1.1]]]},ue={X:[[new Ne(new Ln(.2,0,.8,4,1,!1),i),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new Ne(new Ln(.2,0,.8,4,1,!1),i),[0,.5,0]]],Z:[[new Ne(new Ln(.2,0,.8,4,1,!1),i),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new Ne(P,i),[.85,.85,0],null,[3,3,.2]]],YZ:[[new Ne(P,i),[0,.85,.85],null,[.2,3,3]]],XZ:[[new Ne(P,i),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new Ne(new oi(.2,.2,.2),i),[1.1,0,0]]],XYZY:[[new Ne(new oi(.2,.2,.2),i),[0,1.1,0]]],XYZZ:[[new Ne(new oi(.2,.2,.2),i),[0,0,1.1]]]},D={X:[[new vt(R,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new vt(R,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new vt(R,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},V=B=>{const J=new St;for(let Y in B)for(let K=B[Y].length;K--;){const z=B[Y][K][0].clone(),ye=B[Y][K][1],pe=B[Y][K][2],Q=B[Y][K][3],Qe=B[Y][K][4];z.name=Y,z.tag=Qe,ye&&z.position.set(ye[0],ye[1],ye[2]),pe&&z.rotation.set(pe[0],pe[1],pe[2]),Q&&z.scale.set(Q[0],Q[1],Q[2]),z.updateMatrix();const je=z.geometry.clone();je.applyMatrix4(z.matrix),z.geometry=je,z.renderOrder=1/0,z.position.set(0,0,0),z.rotation.set(0,0,0),z.scale.set(1,1,1),J.add(z)}return J};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=V(L)),this.add(this.gizmo.rotate=V(G)),this.add(this.gizmo.scale=V(oe)),this.add(this.picker.translate=V(H)),this.add(this.picker.rotate=V(ee)),this.add(this.picker.scale=V(ue)),this.add(this.helper.translate=V(q)),this.add(this.helper.rotate=V(W)),this.add(this.helper.scale=V(D)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class P4 extends Ne{constructor(){super(new Di(1e5,1e5,2,2),new Zr({visible:!1,wireframe:!0,side:nr,transparent:!0,opacity:.1,toneMapped:!1})),le(this,"isTransformControlsPlane",!0),le(this,"type","TransformControlsPlane"),le(this,"unitX",new N(1,0,0)),le(this,"unitY",new N(0,1,0)),le(this,"unitZ",new N(0,0,1)),le(this,"tempVector",new N),le(this,"dirVector",new N),le(this,"alignVector",new N),le(this,"tempMatrix",new st),le(this,"identityQuaternion",new It),le(this,"cameraQuaternion",new It),le(this,"worldPosition",new N),le(this,"worldQuaternion",new It),le(this,"eye",new N),le(this,"axis",null),le(this,"mode","translate"),le(this,"space","world"),le(this,"updateMatrixWorld",()=>{let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),this.unitX.set(1,0,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0);break}break;case"rotate":default:this.dirVector.set(0,0,0)}this.dirVector.length()===0?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()})}}var L4=1/0,R4=9007199254740991,I4="[object Arguments]",D4="[object Function]",N4="[object GeneratorFunction]",k4="[object Symbol]",z4=typeof Qs=="object"&&Qs&&Qs.Object===Object&&Qs,U4=typeof self=="object"&&self&&self.Object===Object&&self,O4=z4||U4||Function("return this")();function F4(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function B4(n,e){for(var t=-1,i=n?n.length:0,r=Array(i);++t<i;)r[t]=e(n[t],t,n);return r}function V4(n,e){for(var t=-1,i=e.length,r=n.length;++t<i;)n[r+t]=e[t];return n}var D_=Object.prototype,H4=D_.hasOwnProperty,N_=D_.toString,gM=O4.Symbol,G4=D_.propertyIsEnumerable,vM=gM?gM.isConcatSpreadable:void 0,yM=Math.max;function $3(n,e,t,i,r){var s=-1,o=n.length;for(t||(t=Y4),r||(r=[]);++s<o;){var a=n[s];e>0&&t(a)?e>1?$3(a,e-1,t,i,r):V4(r,a):i||(r[r.length]=a)}return r}function W4(n,e){return n=Object(n),X4(n,e,function(t,i){return i in n})}function X4(n,e,t){for(var i=-1,r=e.length,s={};++i<r;){var o=e[i],a=n[o];t(a,o)&&(s[o]=a)}return s}function j4(n,e){return e=yM(e===void 0?n.length-1:e,0),function(){for(var t=arguments,i=-1,r=yM(t.length-e,0),s=Array(r);++i<r;)s[i]=t[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=t[i];return o[e]=s,F4(n,this,o)}}function Y4(n){return Q4(n)||Z4(n)||!!(vM&&n&&n[vM])}function q4(n){if(typeof n=="string"||nO(n))return n;var e=n+"";return e=="0"&&1/n==-L4?"-0":e}function Z4(n){return K4(n)&&H4.call(n,"callee")&&(!G4.call(n,"callee")||N_.call(n)==I4)}var Q4=Array.isArray;function J4(n){return n!=null&&eO(n.length)&&!$4(n)}function K4(n){return eA(n)&&J4(n)}function $4(n){var e=tO(n)?N_.call(n):"";return e==D4||e==N4}function eO(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=R4}function tO(n){var e=typeof n;return!!n&&(e=="object"||e=="function")}function eA(n){return!!n&&typeof n=="object"}function nO(n){return typeof n=="symbol"||eA(n)&&N_.call(n)==k4}var iO=j4(function(n,e){return n==null?{}:W4(n,B4($3(e,1),q4))}),rO=iO;function sO(n,e,t){const{gl:i,size:r,viewport:s}=$i(),o=typeof n=="number"?n:r.width*s.dpr,a=typeof e=="number"?e:r.height*s.dpr,c=(typeof n=="number"?t:n)||{},{samples:f=0,depth:h,...d}=c,m=Te.exports.useMemo(()=>{let v;return v=new ar(o,a,{minFilter:en,magFilter:en,encoding:i.outputEncoding,type:ca,...d}),h&&(v.depthTexture=new s_(o,a,Hr)),v.samples=f,v},[]);return Te.exports.useLayoutEffect(()=>{m.setSize(o,a),f&&(m.samples=f)},[f,m,o,a]),Te.exports.useEffect(()=>()=>m.dispose(),[]),m}const oO=n=>typeof n=="function",aO=Te.exports.forwardRef(({envMap:n,resolution:e=256,frames:t=1/0,makeDefault:i,children:r,...s},o)=>{const a=$i(({set:S})=>S),c=$i(({camera:S})=>S),f=$i(({size:S})=>S),h=Te.exports.useRef(null),d=Te.exports.useRef(null),m=sO(e);Te.exports.useLayoutEffect(()=>{s.manual||(h.current.aspect=f.width/f.height)},[f,s]),Te.exports.useLayoutEffect(()=>{h.current.updateProjectionMatrix()});let v=0,_=null;const E=oO(r);return n4(S=>{E&&(t===1/0||v<t)&&(d.current.visible=!1,S.gl.setRenderTarget(m),_=S.scene.background,n&&(S.scene.background=n),S.gl.render(S.scene,h.current),S.scene.background=_,S.gl.setRenderTarget(null),d.current.visible=!0,v++)}),Te.exports.useLayoutEffect(()=>{if(i){const S=c;return a(()=>({camera:h.current})),()=>a(()=>({camera:S}))}},[h,i,a]),Xp(L_,{children:[Gt("perspectiveCamera",{ref:E4([h,o]),...s,children:!E&&r}),Gt("group",{ref:d,children:E&&r(m.texture)})]})});var lO=200,k_="__lodash_hash_undefined__",uO=1/0,tA=9007199254740991,cO="[object Arguments]",fO="[object Function]",hO="[object GeneratorFunction]",dO="[object Symbol]",pO=/[\\^$.*+?()[\]{}|]/g,mO=/^\[object .+?Constructor\]$/,gO=/^(?:0|[1-9]\d*)$/,vO=typeof Qs=="object"&&Qs&&Qs.Object===Object&&Qs,yO=typeof self=="object"&&self&&self.Object===Object&&self,z_=vO||yO||Function("return this")();function _O(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function xO(n,e){var t=n?n.length:0;return!!t&&MO(n,e,0)>-1}function SO(n,e,t){for(var i=-1,r=n?n.length:0;++i<r;)if(t(e,n[i]))return!0;return!1}function nA(n,e){for(var t=-1,i=n?n.length:0,r=Array(i);++t<i;)r[t]=e(n[t],t,n);return r}function U_(n,e){for(var t=-1,i=e.length,r=n.length;++t<i;)n[r+t]=e[t];return n}function wO(n,e,t,i){for(var r=n.length,s=t+(i?1:-1);i?s--:++s<r;)if(e(n[s],s,n))return s;return-1}function MO(n,e,t){if(e!==e)return wO(n,EO,t);for(var i=t-1,r=n.length;++i<r;)if(n[i]===e)return i;return-1}function EO(n){return n!==n}function TO(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}function AO(n){return function(e){return n(e)}}function CO(n,e){return n.has(e)}function bO(n,e){return n==null?void 0:n[e]}function PO(n){var e=!1;if(n!=null&&typeof n.toString!="function")try{e=!!(n+"")}catch{}return e}function iA(n,e){return function(t){return n(e(t))}}var LO=Array.prototype,RO=Function.prototype,jp=Object.prototype,h0=z_["__core-js_shared__"],_M=function(){var n=/[^.]+$/.exec(h0&&h0.keys&&h0.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),rA=RO.toString,Jl=jp.hasOwnProperty,O_=jp.toString,IO=RegExp("^"+rA.call(Jl).replace(pO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xM=z_.Symbol,DO=iA(Object.getPrototypeOf,Object),NO=jp.propertyIsEnumerable,kO=LO.splice,SM=xM?xM.isConcatSpreadable:void 0,Zv=Object.getOwnPropertySymbols,wM=Math.max,zO=oA(z_,"Map"),Gc=oA(Object,"create");function ma(n){var e=-1,t=n?n.length:0;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}function UO(){this.__data__=Gc?Gc(null):{}}function OO(n){return this.has(n)&&delete this.__data__[n]}function FO(n){var e=this.__data__;if(Gc){var t=e[n];return t===k_?void 0:t}return Jl.call(e,n)?e[n]:void 0}function BO(n){var e=this.__data__;return Gc?e[n]!==void 0:Jl.call(e,n)}function VO(n,e){var t=this.__data__;return t[n]=Gc&&e===void 0?k_:e,this}ma.prototype.clear=UO;ma.prototype.delete=OO;ma.prototype.get=FO;ma.prototype.has=BO;ma.prototype.set=VO;function Kl(n){var e=-1,t=n?n.length:0;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}function HO(){this.__data__=[]}function GO(n){var e=this.__data__,t=Yp(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():kO.call(e,t,1),!0}function WO(n){var e=this.__data__,t=Yp(e,n);return t<0?void 0:e[t][1]}function XO(n){return Yp(this.__data__,n)>-1}function jO(n,e){var t=this.__data__,i=Yp(t,n);return i<0?t.push([n,e]):t[i][1]=e,this}Kl.prototype.clear=HO;Kl.prototype.delete=GO;Kl.prototype.get=WO;Kl.prototype.has=XO;Kl.prototype.set=jO;function $l(n){var e=-1,t=n?n.length:0;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}function YO(){this.__data__={hash:new ma,map:new(zO||Kl),string:new ma}}function qO(n){return qp(this,n).delete(n)}function ZO(n){return qp(this,n).get(n)}function QO(n){return qp(this,n).has(n)}function JO(n,e){return qp(this,n).set(n,e),this}$l.prototype.clear=YO;$l.prototype.delete=qO;$l.prototype.get=ZO;$l.prototype.has=QO;$l.prototype.set=JO;function fp(n){var e=-1,t=n?n.length:0;for(this.__data__=new $l;++e<t;)this.add(n[e])}function KO(n){return this.__data__.set(n,k_),this}function $O(n){return this.__data__.has(n)}fp.prototype.add=fp.prototype.push=KO;fp.prototype.has=$O;function eF(n,e){var t=F_(n)||aA(n)?TO(n.length,String):[],i=t.length,r=!!i;for(var s in n)(e||Jl.call(n,s))&&!(r&&(s=="length"||hF(s,i)))&&t.push(s);return t}function Yp(n,e){for(var t=n.length;t--;)if(_F(n[t][0],e))return t;return-1}function tF(n,e,t,i){var r=-1,s=xO,o=!0,a=n.length,c=[],f=e.length;if(!a)return c;t&&(e=nA(e,AO(t))),i?(s=SO,o=!1):e.length>=lO&&(s=CO,o=!1,e=new fp(e));e:for(;++r<a;){var h=n[r],d=t?t(h):h;if(h=i||h!==0?h:0,o&&d===d){for(var m=f;m--;)if(e[m]===d)continue e;c.push(h)}else s(e,d,i)||c.push(h)}return c}function sA(n,e,t,i,r){var s=-1,o=n.length;for(t||(t=fF),r||(r=[]);++s<o;){var a=n[s];e>0&&t(a)?e>1?sA(a,e-1,t,i,r):U_(r,a):i||(r[r.length]=a)}return r}function nF(n,e,t){var i=e(n);return F_(n)?i:U_(i,t(n))}function iF(n){if(!B_(n)||pF(n))return!1;var e=uA(n)||PO(n)?IO:mO;return e.test(yF(n))}function rF(n){if(!B_(n))return gF(n);var e=mF(n),t=[];for(var i in n)i=="constructor"&&(e||!Jl.call(n,i))||t.push(i);return t}function sF(n,e){return n=Object(n),oF(n,e,function(t,i){return i in n})}function oF(n,e,t){for(var i=-1,r=e.length,s={};++i<r;){var o=e[i],a=n[o];t(a,o)&&(s[o]=a)}return s}function aF(n,e){return e=wM(e===void 0?n.length-1:e,0),function(){for(var t=arguments,i=-1,r=wM(t.length-e,0),s=Array(r);++i<r;)s[i]=t[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=t[i];return o[e]=s,_O(n,this,o)}}function lF(n){return nF(n,MF,cF)}function qp(n,e){var t=n.__data__;return dF(e)?t[typeof e=="string"?"string":"hash"]:t.map}function oA(n,e){var t=bO(n,e);return iF(t)?t:void 0}var uF=Zv?iA(Zv,Object):fA,cF=Zv?function(n){for(var e=[];n;)U_(e,uF(n)),n=DO(n);return e}:fA;function fF(n){return F_(n)||aA(n)||!!(SM&&n&&n[SM])}function hF(n,e){return e=e==null?tA:e,!!e&&(typeof n=="number"||gO.test(n))&&n>-1&&n%1==0&&n<e}function dF(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function pF(n){return!!_M&&_M in n}function mF(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||jp;return n===t}function gF(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}function vF(n){if(typeof n=="string"||wF(n))return n;var e=n+"";return e=="0"&&1/n==-uO?"-0":e}function yF(n){if(n!=null){try{return rA.call(n)}catch{}try{return n+""}catch{}}return""}function _F(n,e){return n===e||n!==n&&e!==e}function aA(n){return xF(n)&&Jl.call(n,"callee")&&(!NO.call(n,"callee")||O_.call(n)==cO)}var F_=Array.isArray;function lA(n){return n!=null&&SF(n.length)&&!uA(n)}function xF(n){return cA(n)&&lA(n)}function uA(n){var e=B_(n)?O_.call(n):"";return e==fO||e==hO}function SF(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=tA}function B_(n){var e=typeof n;return!!n&&(e=="object"||e=="function")}function cA(n){return!!n&&typeof n=="object"}function wF(n){return typeof n=="symbol"||cA(n)&&O_.call(n)==dO}function MF(n){return lA(n)?eF(n,!0):rF(n)}var EF=aF(function(n,e){return n==null?{}:(e=nA(sA(e,1),vF),sF(n,tF(lF(n),e)))});function fA(){return[]}var TF=EF;const AF=Te.exports.forwardRef(({children:n,domElement:e,onChange:t,onMouseDown:i,onMouseUp:r,onObjectChange:s,object:o,makeDefault:a,...c},f)=>{const h=["enabled","axis","mode","translationSnap","rotationSnap","scaleSnap","space","size","showX","showY","showZ"],{camera:d,...m}=c,v=rO(m,h),_=TF(m,h),E=$i(W=>W.controls),S=$i(W=>W.gl),g=$i(W=>W.events),x=$i(W=>W.camera),w=$i(W=>W.invalidate),T=$i(W=>W.get),C=$i(W=>W.set),P=d||x,R=e||g.connected||S.domElement,I=Te.exports.useMemo(()=>new C4(P,R),[P,R]),b=Te.exports.useRef();Te.exports.useLayoutEffect(()=>(o?I.attach(o instanceof St?o:o.current):b.current instanceof St&&I.attach(b.current),()=>void I.detach()),[o,n,I]),Te.exports.useEffect(()=>{if(E){const W=ee=>E.enabled=!ee.value;return I.addEventListener("dragging-changed",W),()=>I.removeEventListener("dragging-changed",W)}},[I,E]);const L=Te.exports.useRef(),H=Te.exports.useRef(),q=Te.exports.useRef(),G=Te.exports.useRef();return Te.exports.useLayoutEffect(()=>void(L.current=t),[t]),Te.exports.useLayoutEffect(()=>void(H.current=i),[i]),Te.exports.useLayoutEffect(()=>void(q.current=r),[r]),Te.exports.useLayoutEffect(()=>void(G.current=s),[s]),Te.exports.useEffect(()=>{const W=D=>{w(),L.current==null||L.current(D)},ee=D=>H.current==null?void 0:H.current(D),oe=D=>q.current==null?void 0:q.current(D),ue=D=>G.current==null?void 0:G.current(D);return I.addEventListener("change",W),I.addEventListener("mouseDown",ee),I.addEventListener("mouseUp",oe),I.addEventListener("objectChange",ue),()=>{I.removeEventListener("change",W),I.removeEventListener("mouseDown",ee),I.removeEventListener("mouseUp",oe),I.removeEventListener("objectChange",ue)}},[w,I]),Te.exports.useEffect(()=>{if(a){const W=T().controls;return C({controls:I}),()=>C({controls:W})}},[a,I]),I?Xp(L_,{children:[Gt("primitive",{ref:f,object:I,...v}),Gt("group",{ref:b,..._,children:n})]}):null}),CF=()=>!window.invokeNative,hA=(n,e)=>{const t=Te.exports.useRef(()=>{});Te.exports.useEffect(()=>{t.current=e},[e]),Te.exports.useEffect(()=>{const i=r=>{const{action:s,data:o}=r.data;t.current&&s===n&&t.current(o)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[n])};async function Vu(n,e,t){const i={method:"post",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)};if(CF()&&t)return t;const r=window.GetParentResourceName?window.GetParentResourceName():"nui-frame-app";return await(await fetch(`https://${r}/${n}`,i)).json()}const bF=()=>{const{camera:n}=$i(),e=(t,i)=>t>0&&t<90?i:t>-180&&t<-90||t>0?-i:i;return hA("setCameraPosition",({position:t,rotation:i})=>{n.position.set(t.x,t.z,-t.y),n.rotation.order="YZX",i&&n.rotation.set(Br.degToRad(i.x),Br.degToRad(e(i.x,i.z)),Br.degToRad(i.y)),n.updateProjectionMatrix()}),Gt(aO,{position:[0,0,10],makeDefault:!0,onUpdate:t=>t.updateProjectionMatrix()})},PF=()=>{const n=Te.exports.useRef(null),[e,t]=Te.exports.useState(),[i,r]=Te.exports.useState("translate"),s=()=>{const o={handle:e,position:{x:n.current.position.x,y:-n.current.position.z,z:n.current.position.y},rotation:{x:Br.radToDeg(n.current.rotation.x),y:Br.radToDeg(-n.current.rotation.z),z:Br.radToDeg(n.current.rotation.y)}};Vu("moveEntity",o)};return hA("setGizmoEntity",o=>{t(o.handle),o.handle&&(n.current.position.set(o.position.x,o.position.z,-o.position.y),n.current.rotation.order="YZX",n.current.rotation.set(Br.degToRad(o.rotation.x),Br.degToRad(o.rotation.z),Br.degToRad(o.rotation.y)))}),Te.exports.useEffect(()=>{const o=a=>{switch(a.code){case"KeyR":if(i=="rotate")return;r("rotate"),Vu("swapMode",{mode:"Rotate"});break;case"KeyW":if(i=="translate")return;r("translate"),Vu("swapMode",{mode:"Translate"});break;case"Escape":Vu("finishEdit");break;case"KeyQ":Vu("cam");break}};return window.addEventListener("keyup",o),()=>window.removeEventListener("keyup",o)}),Gt(L_,{children:Xp(Te.exports.Suspense,{fallback:Gt("p",{children:"Loading Gizmo"}),children:[e!=null&&Gt(AF,{size:.5,object:n,mode:i,onObjectChange:s}),Gt("mesh",{ref:n})]})})},LF=()=>Xp(M4,{style:{zIndex:1},children:[Gt(bF,{}),Gt(PF,{})]});function RF(){return Gt("div",{style:{width:"100vw",height:"100vh"},children:Gt(LF,{})})}d0.createRoot(document.getElementById("root")).render(Gt(RF,{}));