(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)}})();function LC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var NC={exports:{}},f0={},DC={exports:{}},It={};/**
 * @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 Uf=Symbol.for("react.element"),CN=Symbol.for("react.portal"),RN=Symbol.for("react.fragment"),PN=Symbol.for("react.strict_mode"),IN=Symbol.for("react.profiler"),LN=Symbol.for("react.provider"),NN=Symbol.for("react.context"),DN=Symbol.for("react.forward_ref"),ON=Symbol.for("react.suspense"),UN=Symbol.for("react.memo"),FN=Symbol.for("react.lazy"),kE=Symbol.iterator;function kN(n){return n===null||typeof n!="object"?null:(n=kE&&n[kE]||n["@@iterator"],typeof n=="function"?n:null)}var OC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UC=Object.assign,FC={};function au(n,e,t){this.props=n,this.context=e,this.refs=FC,this.updater=t||OC}au.prototype.isReactComponent={};au.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")};au.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function kC(){}kC.prototype=au.prototype;function ew(n,e,t){this.props=n,this.context=e,this.refs=FC,this.updater=t||OC}var tw=ew.prototype=new kC;tw.constructor=ew;UC(tw,au.prototype);tw.isPureReactComponent=!0;var zE=Array.isArray,zC=Object.prototype.hasOwnProperty,nw={current:null},BC={key:!0,ref:!0,__self:!0,__source:!0};function VC(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)zC.call(e,i)&&!BC.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var u=Array(a),d=0;d<a;d++)u[d]=arguments[d+2];r.children=u}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:Uf,type:n,key:s,ref:o,props:r,_owner:nw.current}}function zN(n,e){return{$$typeof:Uf,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function iw(n){return typeof n=="object"&&n!==null&&n.$$typeof===Uf}function BN(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var BE=/\/+/g;function gy(n,e){return typeof n=="object"&&n!==null&&n.key!=null?BN(""+n.key):e.toString(36)}function ym(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 Uf:case CN:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+gy(o,0):i,zE(r)?(t="",n!=null&&(t=n.replace(BE,"$&/")+"/"),ym(r,e,t,"",function(d){return d})):r!=null&&(iw(r)&&(r=zN(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(BE,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",zE(n))for(var a=0;a<n.length;a++){s=n[a];var u=i+gy(s,a);o+=ym(s,e,t,u,r)}else if(u=kN(n),typeof u=="function")for(n=u.call(n),a=0;!(s=n.next()).done;)s=s.value,u=i+gy(s,a++),o+=ym(s,e,t,u,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 Qh(n,e,t){if(n==null)return n;var i=[],r=0;return ym(n,i,"","",function(s){return e.call(t,s,r++)}),i}function VN(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 Ii={current:null},_m={transition:null},HN={ReactCurrentDispatcher:Ii,ReactCurrentBatchConfig:_m,ReactCurrentOwner:nw};function HC(){throw Error("act(...) is not supported in production builds of React.")}It.Children={map:Qh,forEach:function(n,e,t){Qh(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return Qh(n,function(){e++}),e},toArray:function(n){return Qh(n,function(e){return e})||[]},only:function(n){if(!iw(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};It.Component=au;It.Fragment=RN;It.Profiler=IN;It.PureComponent=ew;It.StrictMode=PN;It.Suspense=ON;It.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HN;It.act=HC;It.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=UC({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=nw.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(u in e)zC.call(e,u)&&!BC.hasOwnProperty(u)&&(i[u]=e[u]===void 0&&a!==void 0?a[u]:e[u])}var u=arguments.length-2;if(u===1)i.children=t;else if(1<u){a=Array(u);for(var d=0;d<u;d++)a[d]=arguments[d+2];i.children=a}return{$$typeof:Uf,type:n.type,key:r,ref:s,props:i,_owner:o}};It.createContext=function(n){return n={$$typeof:NN,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:LN,_context:n},n.Consumer=n};It.createElement=VC;It.createFactory=function(n){var e=VC.bind(null,n);return e.type=n,e};It.createRef=function(){return{current:null}};It.forwardRef=function(n){return{$$typeof:DN,render:n}};It.isValidElement=iw;It.lazy=function(n){return{$$typeof:FN,_payload:{_status:-1,_result:n},_init:VN}};It.memo=function(n,e){return{$$typeof:UN,type:n,compare:e===void 0?null:e}};It.startTransition=function(n){var e=_m.transition;_m.transition={};try{n()}finally{_m.transition=e}};It.unstable_act=HC;It.useCallback=function(n,e){return Ii.current.useCallback(n,e)};It.useContext=function(n){return Ii.current.useContext(n)};It.useDebugValue=function(){};It.useDeferredValue=function(n){return Ii.current.useDeferredValue(n)};It.useEffect=function(n,e){return Ii.current.useEffect(n,e)};It.useId=function(){return Ii.current.useId()};It.useImperativeHandle=function(n,e,t){return Ii.current.useImperativeHandle(n,e,t)};It.useInsertionEffect=function(n,e){return Ii.current.useInsertionEffect(n,e)};It.useLayoutEffect=function(n,e){return Ii.current.useLayoutEffect(n,e)};It.useMemo=function(n,e){return Ii.current.useMemo(n,e)};It.useReducer=function(n,e,t){return Ii.current.useReducer(n,e,t)};It.useRef=function(n){return Ii.current.useRef(n)};It.useState=function(n){return Ii.current.useState(n)};It.useSyncExternalStore=function(n,e,t){return Ii.current.useSyncExternalStore(n,e,t)};It.useTransition=function(){return Ii.current.useTransition()};It.version="18.3.1";DC.exports=It;var we=DC.exports;const Me=LC(we);/**
 * @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 GN=we,WN=Symbol.for("react.element"),jN=Symbol.for("react.fragment"),XN=Object.prototype.hasOwnProperty,qN=GN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,YN={key:!0,ref:!0,__self:!0,__source:!0};function GC(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)XN.call(e,i)&&!YN.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:WN,type:n,key:s,ref:o,props:r,_owner:qN.current}}f0.Fragment=jN;f0.jsx=GC;f0.jsxs=GC;NC.exports=f0;var B=NC.exports,J_={},WC={exports:{}},hr={},jC={exports:{}},XC={};/**
 * @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(O,Y){var K=O.length;O.push(Y);e:for(;0<K;){var ae=K-1>>>1,ge=O[ae];if(0<r(ge,Y))O[ae]=Y,O[K]=ge,K=ae;else break e}}function t(O){return O.length===0?null:O[0]}function i(O){if(O.length===0)return null;var Y=O[0],K=O.pop();if(K!==Y){O[0]=K;e:for(var ae=0,ge=O.length,Ue=ge>>>1;ae<Ue;){var se=2*(ae+1)-1,xe=O[se],Ae=se+1,Ce=O[Ae];if(0>r(xe,K))Ae<ge&&0>r(Ce,xe)?(O[ae]=Ce,O[Ae]=K,ae=Ae):(O[ae]=xe,O[se]=K,ae=se);else if(Ae<ge&&0>r(Ce,K))O[ae]=Ce,O[Ae]=K,ae=Ae;else break e}}return Y}function r(O,Y){var K=O.sortIndex-Y.sortIndex;return K!==0?K:O.id-Y.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 u=[],d=[],f=1,h=null,p=3,g=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(O){for(var Y=t(d);Y!==null;){if(Y.callback===null)i(d);else if(Y.startTime<=O)i(d),Y.sortIndex=Y.expirationTime,e(u,Y);else break;Y=t(d)}}function b(O){if(w=!1,M(O),!y)if(t(u)!==null)y=!0,ne(N);else{var Y=t(d);Y!==null&&le(b,Y.startTime-O)}}function N(O,Y){y=!1,w&&(w=!1,v(D),D=-1),g=!0;var K=p;try{for(M(Y),h=t(u);h!==null&&(!(h.expirationTime>Y)||O&&!U());){var ae=h.callback;if(typeof ae=="function"){h.callback=null,p=h.priorityLevel;var ge=ae(h.expirationTime<=Y);Y=n.unstable_now(),typeof ge=="function"?h.callback=ge:h===t(u)&&i(u),M(Y)}else i(u);h=t(u)}if(h!==null)var Ue=!0;else{var se=t(d);se!==null&&le(b,se.startTime-Y),Ue=!1}return Ue}finally{h=null,p=K,g=!1}}var C=!1,P=null,D=-1,I=5,A=-1;function U(){return!(n.unstable_now()-A<I)}function G(){if(P!==null){var O=n.unstable_now();A=O;var Y=!0;try{Y=P(!0,O)}finally{Y?z():(C=!1,P=null)}}else C=!1}var z;if(typeof _=="function")z=function(){_(G)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,J=Z.port2;Z.port1.onmessage=G,z=function(){J.postMessage(null)}}else z=function(){x(G,0)};function ne(O){P=O,C||(C=!0,z())}function le(O,Y){D=x(function(){O(n.unstable_now())},Y)}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(O){O.callback=null},n.unstable_continueExecution=function(){y||g||(y=!0,ne(N))},n.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<O?Math.floor(1e3/O):5},n.unstable_getCurrentPriorityLevel=function(){return p},n.unstable_getFirstCallbackNode=function(){return t(u)},n.unstable_next=function(O){switch(p){case 1:case 2:case 3:var Y=3;break;default:Y=p}var K=p;p=Y;try{return O()}finally{p=K}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(O,Y){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var K=p;p=O;try{return Y()}finally{p=K}},n.unstable_scheduleCallback=function(O,Y,K){var ae=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ae+K:ae):K=ae,O){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=K+ge,O={id:f++,callback:Y,priorityLevel:O,startTime:K,expirationTime:ge,sortIndex:-1},K>ae?(O.sortIndex=K,e(d,O),t(u)===null&&O===t(d)&&(w?(v(D),D=-1):w=!0,le(b,K-ae))):(O.sortIndex=ge,e(u,O),y||g||(y=!0,ne(N))),O},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(O){var Y=p;return function(){var K=p;p=Y;try{return O.apply(this,arguments)}finally{p=K}}}})(XC);jC.exports=XC;var $N=jC.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ZN=we,ur=$N;function Oe(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 qC=new Set,Gd={};function _l(n,e){$c(n,e),$c(n+"Capture",e)}function $c(n,e){for(Gd[n]=e,n=0;n<e.length;n++)qC.add(e[n])}var oo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),K_=Object.prototype.hasOwnProperty,JN=/^[: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]*$/,VE={},HE={};function KN(n){return K_.call(HE,n)?!0:K_.call(VE,n)?!1:JN.test(n)?HE[n]=!0:(VE[n]=!0,!1)}function QN(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 eD(n,e,t,i){if(e===null||typeof e>"u"||QN(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 Li(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 ti={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){ti[n]=new Li(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];ti[e]=new Li(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){ti[n]=new Li(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){ti[n]=new Li(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){ti[n]=new Li(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){ti[n]=new Li(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){ti[n]=new Li(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){ti[n]=new Li(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){ti[n]=new Li(n,5,!1,n.toLowerCase(),null,!1,!1)});var rw=/[\-:]([a-z])/g;function sw(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(rw,sw);ti[e]=new Li(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(rw,sw);ti[e]=new Li(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(rw,sw);ti[e]=new Li(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){ti[n]=new Li(n,1,!1,n.toLowerCase(),null,!1,!1)});ti.xlinkHref=new Li("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){ti[n]=new Li(n,1,!1,n.toLowerCase(),null,!0,!0)});function ow(n,e,t,i){var r=ti.hasOwnProperty(e)?ti[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(eD(e,t,r,i)&&(t=null),i||r===null?KN(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 ho=ZN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ep=Symbol.for("react.element"),yc=Symbol.for("react.portal"),_c=Symbol.for("react.fragment"),aw=Symbol.for("react.strict_mode"),Q_=Symbol.for("react.profiler"),YC=Symbol.for("react.provider"),$C=Symbol.for("react.context"),lw=Symbol.for("react.forward_ref"),ex=Symbol.for("react.suspense"),tx=Symbol.for("react.suspense_list"),cw=Symbol.for("react.memo"),ko=Symbol.for("react.lazy"),ZC=Symbol.for("react.offscreen"),GE=Symbol.iterator;function zu(n){return n===null||typeof n!="object"?null:(n=GE&&n[GE]||n["@@iterator"],typeof n=="function"?n:null)}var pn=Object.assign,vy;function ud(n){if(vy===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);vy=e&&e[1]||""}return`
`+vy+n}var yy=!1;function _y(n,e){if(!n||yy)return"";yy=!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(d){var i=d}Reflect.construct(n,[],e)}else{try{e.call()}catch(d){i=d}n.call(e.prototype)}else{try{throw Error()}catch(d){i=d}n()}}catch(d){if(d&&i&&typeof d.stack=="string"){for(var r=d.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 u=`
`+r[o].replace(" at new "," at ");return n.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",n.displayName)),u}while(1<=o&&0<=a);break}}}finally{yy=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?ud(n):""}function tD(n){switch(n.tag){case 5:return ud(n.type);case 16:return ud("Lazy");case 13:return ud("Suspense");case 19:return ud("SuspenseList");case 0:case 2:case 15:return n=_y(n.type,!1),n;case 11:return n=_y(n.type.render,!1),n;case 1:return n=_y(n.type,!0),n;default:return""}}function nx(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 _c:return"Fragment";case yc:return"Portal";case Q_:return"Profiler";case aw:return"StrictMode";case ex:return"Suspense";case tx:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case $C:return(n.displayName||"Context")+".Consumer";case YC:return(n._context.displayName||"Context")+".Provider";case lw:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case cw:return e=n.displayName||null,e!==null?e:nx(n.type)||"Memo";case ko:e=n._payload,n=n._init;try{return nx(n(e))}catch{}}return null}function nD(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 nx(e);case 8:return e===aw?"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 ra(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function JC(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function iD(n){var e=JC(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 tp(n){n._valueTracker||(n._valueTracker=iD(n))}function KC(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=JC(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Qm(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 ix(n,e){var t=e.checked;return pn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function WE(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=ra(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 QC(n,e){e=e.checked,e!=null&&ow(n,"checked",e,!1)}function rx(n,e){QC(n,e);var t=ra(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")?sx(n,e.type,t):e.hasOwnProperty("defaultValue")&&sx(n,e.type,ra(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function jE(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 sx(n,e,t){(e!=="number"||Qm(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var dd=Array.isArray;function Fc(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=""+ra(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 ox(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Oe(91));return pn({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function XE(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(Oe(92));if(dd(t)){if(1<t.length)throw Error(Oe(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:ra(t)}}function eR(n,e){var t=ra(e.value),i=ra(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 qE(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function tR(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 ax(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?tR(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var np,nR=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(np=np||document.createElement("div"),np.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=np.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function Wd(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Ad={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},rD=["Webkit","ms","Moz","O"];Object.keys(Ad).forEach(function(n){rD.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Ad[e]=Ad[n]})});function iR(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Ad.hasOwnProperty(n)&&Ad[n]?(""+e).trim():e+"px"}function rR(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=iR(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var sD=pn({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 lx(n,e){if(e){if(sD[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Oe(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Oe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Oe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Oe(62))}}function cx(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 ux=null;function uw(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var dx=null,kc=null,zc=null;function YE(n){if(n=zf(n)){if(typeof dx!="function")throw Error(Oe(280));var e=n.stateNode;e&&(e=v0(e),dx(n.stateNode,n.type,e))}}function sR(n){kc?zc?zc.push(n):zc=[n]:kc=n}function oR(){if(kc){var n=kc,e=zc;if(zc=kc=null,YE(n),e)for(n=0;n<e.length;n++)YE(e[n])}}function aR(n,e){return n(e)}function lR(){}var xy=!1;function cR(n,e,t){if(xy)return n(e,t);xy=!0;try{return aR(n,e,t)}finally{xy=!1,(kc!==null||zc!==null)&&(lR(),oR())}}function jd(n,e){var t=n.stateNode;if(t===null)return null;var i=v0(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(Oe(231,e,typeof t));return t}var fx=!1;if(oo)try{var Bu={};Object.defineProperty(Bu,"passive",{get:function(){fx=!0}}),window.addEventListener("test",Bu,Bu),window.removeEventListener("test",Bu,Bu)}catch{fx=!1}function oD(n,e,t,i,r,s,o,a,u){var d=Array.prototype.slice.call(arguments,3);try{e.apply(t,d)}catch(f){this.onError(f)}}var Td=!1,eg=null,tg=!1,hx=null,aD={onError:function(n){Td=!0,eg=n}};function lD(n,e,t,i,r,s,o,a,u){Td=!1,eg=null,oD.apply(aD,arguments)}function cD(n,e,t,i,r,s,o,a,u){if(lD.apply(this,arguments),Td){if(Td){var d=eg;Td=!1,eg=null}else throw Error(Oe(198));tg||(tg=!0,hx=d)}}function xl(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function uR(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 $E(n){if(xl(n)!==n)throw Error(Oe(188))}function uD(n){var e=n.alternate;if(!e){if(e=xl(n),e===null)throw Error(Oe(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 $E(r),n;if(s===i)return $E(r),e;s=s.sibling}throw Error(Oe(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(Oe(189))}}if(t.alternate!==i)throw Error(Oe(190))}if(t.tag!==3)throw Error(Oe(188));return t.stateNode.current===t?n:e}function dR(n){return n=uD(n),n!==null?fR(n):null}function fR(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=fR(n);if(e!==null)return e;n=n.sibling}return null}var hR=ur.unstable_scheduleCallback,ZE=ur.unstable_cancelCallback,dD=ur.unstable_shouldYield,fD=ur.unstable_requestPaint,wn=ur.unstable_now,hD=ur.unstable_getCurrentPriorityLevel,dw=ur.unstable_ImmediatePriority,pR=ur.unstable_UserBlockingPriority,ng=ur.unstable_NormalPriority,pD=ur.unstable_LowPriority,mR=ur.unstable_IdlePriority,h0=null,Rs=null;function mD(n){if(Rs&&typeof Rs.onCommitFiberRoot=="function")try{Rs.onCommitFiberRoot(h0,n,void 0,(n.current.flags&128)===128)}catch{}}var ns=Math.clz32?Math.clz32:yD,gD=Math.log,vD=Math.LN2;function yD(n){return n>>>=0,n===0?32:31-(gD(n)/vD|0)|0}var ip=64,rp=4194304;function fd(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 ig(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=fd(a):(s&=o,s!==0&&(i=fd(s)))}else o=t&~r,o!==0?i=fd(o):s!==0&&(i=fd(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-ns(e),r=1<<t,i|=n[t],e&=~r;return i}function _D(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 xD(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-ns(s),a=1<<o,u=r[o];u===-1?(!(a&t)||a&i)&&(r[o]=_D(a,e)):u<=e&&(n.expiredLanes|=a),s&=~a}}function px(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function gR(){var n=ip;return ip<<=1,!(ip&4194240)&&(ip=64),n}function Sy(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function Ff(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-ns(e),n[e]=t}function SD(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-ns(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function fw(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-ns(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var jt=0;function vR(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var yR,hw,_R,xR,SR,mx=!1,sp=[],Yo=null,$o=null,Zo=null,Xd=new Map,qd=new Map,Vo=[],wD="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 JE(n,e){switch(n){case"focusin":case"focusout":Yo=null;break;case"dragenter":case"dragleave":$o=null;break;case"mouseover":case"mouseout":Zo=null;break;case"pointerover":case"pointerout":Xd.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":qd.delete(e.pointerId)}}function Vu(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=zf(e),e!==null&&hw(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function MD(n,e,t,i,r){switch(e){case"focusin":return Yo=Vu(Yo,n,e,t,i,r),!0;case"dragenter":return $o=Vu($o,n,e,t,i,r),!0;case"mouseover":return Zo=Vu(Zo,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return Xd.set(s,Vu(Xd.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,qd.set(s,Vu(qd.get(s)||null,n,e,t,i,r)),!0}return!1}function wR(n){var e=Wa(n.target);if(e!==null){var t=xl(e);if(t!==null){if(e=t.tag,e===13){if(e=uR(t),e!==null){n.blockedOn=e,SR(n.priority,function(){_R(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 xm(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=gx(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);ux=i,t.target.dispatchEvent(i),ux=null}else return e=zf(t),e!==null&&hw(e),n.blockedOn=t,!1;e.shift()}return!0}function KE(n,e,t){xm(n)&&t.delete(e)}function ED(){mx=!1,Yo!==null&&xm(Yo)&&(Yo=null),$o!==null&&xm($o)&&($o=null),Zo!==null&&xm(Zo)&&(Zo=null),Xd.forEach(KE),qd.forEach(KE)}function Hu(n,e){n.blockedOn===e&&(n.blockedOn=null,mx||(mx=!0,ur.unstable_scheduleCallback(ur.unstable_NormalPriority,ED)))}function Yd(n){function e(r){return Hu(r,n)}if(0<sp.length){Hu(sp[0],n);for(var t=1;t<sp.length;t++){var i=sp[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Yo!==null&&Hu(Yo,n),$o!==null&&Hu($o,n),Zo!==null&&Hu(Zo,n),Xd.forEach(e),qd.forEach(e),t=0;t<Vo.length;t++)i=Vo[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<Vo.length&&(t=Vo[0],t.blockedOn===null);)wR(t),t.blockedOn===null&&Vo.shift()}var Bc=ho.ReactCurrentBatchConfig,rg=!0;function bD(n,e,t,i){var r=jt,s=Bc.transition;Bc.transition=null;try{jt=1,pw(n,e,t,i)}finally{jt=r,Bc.transition=s}}function AD(n,e,t,i){var r=jt,s=Bc.transition;Bc.transition=null;try{jt=4,pw(n,e,t,i)}finally{jt=r,Bc.transition=s}}function pw(n,e,t,i){if(rg){var r=gx(n,e,t,i);if(r===null)Iy(n,e,i,sg,t),JE(n,i);else if(MD(r,n,e,t,i))i.stopPropagation();else if(JE(n,i),e&4&&-1<wD.indexOf(n)){for(;r!==null;){var s=zf(r);if(s!==null&&yR(s),s=gx(n,e,t,i),s===null&&Iy(n,e,i,sg,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else Iy(n,e,i,null,t)}}var sg=null;function gx(n,e,t,i){if(sg=null,n=uw(i),n=Wa(n),n!==null)if(e=xl(n),e===null)n=null;else if(t=e.tag,t===13){if(n=uR(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 sg=n,null}function MR(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(hD()){case dw:return 1;case pR:return 4;case ng:case pD:return 16;case mR:return 536870912;default:return 16}default:return 16}}var jo=null,mw=null,Sm=null;function ER(){if(Sm)return Sm;var n,e=mw,t=e.length,i,r="value"in jo?jo.value:jo.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 Sm=r.slice(n,1<i?1-i:void 0)}function wm(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 op(){return!0}function QE(){return!1}function pr(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)?op:QE,this.isPropagationStopped=QE,this}return pn(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=op)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=op)},persist:function(){},isPersistent:op}),e}var lu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gw=pr(lu),kf=pn({},lu,{view:0,detail:0}),TD=pr(kf),wy,My,Gu,p0=pn({},kf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vw,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!==Gu&&(Gu&&n.type==="mousemove"?(wy=n.screenX-Gu.screenX,My=n.screenY-Gu.screenY):My=wy=0,Gu=n),wy)},movementY:function(n){return"movementY"in n?n.movementY:My}}),eb=pr(p0),CD=pn({},p0,{dataTransfer:0}),RD=pr(CD),PD=pn({},kf,{relatedTarget:0}),Ey=pr(PD),ID=pn({},lu,{animationName:0,elapsedTime:0,pseudoElement:0}),LD=pr(ID),ND=pn({},lu,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),DD=pr(ND),OD=pn({},lu,{data:0}),tb=pr(OD),UD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},FD={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},kD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zD(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=kD[n])?!!e[n]:!1}function vw(){return zD}var BD=pn({},kf,{key:function(n){if(n.key){var e=UD[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=wm(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?FD[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vw,charCode:function(n){return n.type==="keypress"?wm(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?wm(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),VD=pr(BD),HD=pn({},p0,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nb=pr(HD),GD=pn({},kf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vw}),WD=pr(GD),jD=pn({},lu,{propertyName:0,elapsedTime:0,pseudoElement:0}),XD=pr(jD),qD=pn({},p0,{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}),YD=pr(qD),$D=[9,13,27,32],yw=oo&&"CompositionEvent"in window,Cd=null;oo&&"documentMode"in document&&(Cd=document.documentMode);var ZD=oo&&"TextEvent"in window&&!Cd,bR=oo&&(!yw||Cd&&8<Cd&&11>=Cd),ib=" ",rb=!1;function AR(n,e){switch(n){case"keyup":return $D.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function TR(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var xc=!1;function JD(n,e){switch(n){case"compositionend":return TR(e);case"keypress":return e.which!==32?null:(rb=!0,ib);case"textInput":return n=e.data,n===ib&&rb?null:n;default:return null}}function KD(n,e){if(xc)return n==="compositionend"||!yw&&AR(n,e)?(n=ER(),Sm=mw=jo=null,xc=!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 bR&&e.locale!=="ko"?null:e.data;default:return null}}var QD={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 sb(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!QD[n.type]:e==="textarea"}function CR(n,e,t,i){sR(i),e=og(e,"onChange"),0<e.length&&(t=new gw("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var Rd=null,$d=null;function eO(n){zR(n,0)}function m0(n){var e=Mc(n);if(KC(e))return n}function tO(n,e){if(n==="change")return e}var RR=!1;if(oo){var by;if(oo){var Ay="oninput"in document;if(!Ay){var ob=document.createElement("div");ob.setAttribute("oninput","return;"),Ay=typeof ob.oninput=="function"}by=Ay}else by=!1;RR=by&&(!document.documentMode||9<document.documentMode)}function ab(){Rd&&(Rd.detachEvent("onpropertychange",PR),$d=Rd=null)}function PR(n){if(n.propertyName==="value"&&m0($d)){var e=[];CR(e,$d,n,uw(n)),cR(eO,e)}}function nO(n,e,t){n==="focusin"?(ab(),Rd=e,$d=t,Rd.attachEvent("onpropertychange",PR)):n==="focusout"&&ab()}function iO(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return m0($d)}function rO(n,e){if(n==="click")return m0(e)}function sO(n,e){if(n==="input"||n==="change")return m0(e)}function oO(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var ss=typeof Object.is=="function"?Object.is:oO;function Zd(n,e){if(ss(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(!K_.call(e,r)||!ss(n[r],e[r]))return!1}return!0}function lb(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function cb(n,e){var t=lb(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=lb(t)}}function IR(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?IR(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function LR(){for(var n=window,e=Qm();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Qm(n.document)}return e}function _w(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 aO(n){var e=LR(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&IR(t.ownerDocument.documentElement,t)){if(i!==null&&_w(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=cb(t,s);var o=cb(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 lO=oo&&"documentMode"in document&&11>=document.documentMode,Sc=null,vx=null,Pd=null,yx=!1;function ub(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;yx||Sc==null||Sc!==Qm(i)||(i=Sc,"selectionStart"in i&&_w(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}),Pd&&Zd(Pd,i)||(Pd=i,i=og(vx,"onSelect"),0<i.length&&(e=new gw("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=Sc)))}function ap(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var wc={animationend:ap("Animation","AnimationEnd"),animationiteration:ap("Animation","AnimationIteration"),animationstart:ap("Animation","AnimationStart"),transitionend:ap("Transition","TransitionEnd")},Ty={},NR={};oo&&(NR=document.createElement("div").style,"AnimationEvent"in window||(delete wc.animationend.animation,delete wc.animationiteration.animation,delete wc.animationstart.animation),"TransitionEvent"in window||delete wc.transitionend.transition);function g0(n){if(Ty[n])return Ty[n];if(!wc[n])return n;var e=wc[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in NR)return Ty[n]=e[t];return n}var DR=g0("animationend"),OR=g0("animationiteration"),UR=g0("animationstart"),FR=g0("transitionend"),kR=new Map,db="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 la(n,e){kR.set(n,e),_l(e,[n])}for(var Cy=0;Cy<db.length;Cy++){var Ry=db[Cy],cO=Ry.toLowerCase(),uO=Ry[0].toUpperCase()+Ry.slice(1);la(cO,"on"+uO)}la(DR,"onAnimationEnd");la(OR,"onAnimationIteration");la(UR,"onAnimationStart");la("dblclick","onDoubleClick");la("focusin","onFocus");la("focusout","onBlur");la(FR,"onTransitionEnd");$c("onMouseEnter",["mouseout","mouseover"]);$c("onMouseLeave",["mouseout","mouseover"]);$c("onPointerEnter",["pointerout","pointerover"]);$c("onPointerLeave",["pointerout","pointerover"]);_l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));_l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));_l("onBeforeInput",["compositionend","keypress","textInput","paste"]);_l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));_l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));_l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hd="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(" "),dO=new Set("cancel close invalid load scroll toggle".split(" ").concat(hd));function fb(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,cD(i,e,void 0,n),n.currentTarget=null}function zR(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],u=a.instance,d=a.currentTarget;if(a=a.listener,u!==s&&r.isPropagationStopped())break e;fb(r,a,d),s=u}else for(o=0;o<i.length;o++){if(a=i[o],u=a.instance,d=a.currentTarget,a=a.listener,u!==s&&r.isPropagationStopped())break e;fb(r,a,d),s=u}}}if(tg)throw n=hx,tg=!1,hx=null,n}function Jt(n,e){var t=e[Mx];t===void 0&&(t=e[Mx]=new Set);var i=n+"__bubble";t.has(i)||(BR(e,n,2,!1),t.add(i))}function Py(n,e,t){var i=0;e&&(i|=4),BR(t,n,i,e)}var lp="_reactListening"+Math.random().toString(36).slice(2);function Jd(n){if(!n[lp]){n[lp]=!0,qC.forEach(function(t){t!=="selectionchange"&&(dO.has(t)||Py(t,!1,n),Py(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[lp]||(e[lp]=!0,Py("selectionchange",!1,e))}}function BR(n,e,t,i){switch(MR(e)){case 1:var r=bD;break;case 4:r=AD;break;default:r=pw}t=r.bind(null,e,t,n),r=void 0,!fx||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 Iy(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&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 u=o.tag;if((u===3||u===4)&&(u=o.stateNode.containerInfo,u===r||u.nodeType===8&&u.parentNode===r))return;o=o.return}for(;a!==null;){if(o=Wa(a),o===null)return;if(u=o.tag,u===5||u===6){i=s=o;continue e}a=a.parentNode}}i=i.return}cR(function(){var d=s,f=uw(t),h=[];e:{var p=kR.get(n);if(p!==void 0){var g=gw,y=n;switch(n){case"keypress":if(wm(t)===0)break e;case"keydown":case"keyup":g=VD;break;case"focusin":y="focus",g=Ey;break;case"focusout":y="blur",g=Ey;break;case"beforeblur":case"afterblur":g=Ey;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":g=eb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=RD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=WD;break;case DR:case OR:case UR:g=LD;break;case FR:g=XD;break;case"scroll":g=TD;break;case"wheel":g=YD;break;case"copy":case"cut":case"paste":g=DD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=nb}var w=(e&4)!==0,x=!w&&n==="scroll",v=w?p!==null?p+"Capture":null:p;w=[];for(var _=d,M;_!==null;){M=_;var b=M.stateNode;if(M.tag===5&&b!==null&&(M=b,v!==null&&(b=jd(_,v),b!=null&&w.push(Kd(_,b,M)))),x)break;_=_.return}0<w.length&&(p=new g(p,y,null,t,f),h.push({event:p,listeners:w}))}}if(!(e&7)){e:{if(p=n==="mouseover"||n==="pointerover",g=n==="mouseout"||n==="pointerout",p&&t!==ux&&(y=t.relatedTarget||t.fromElement)&&(Wa(y)||y[ao]))break e;if((g||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,g?(y=t.relatedTarget||t.toElement,g=d,y=y?Wa(y):null,y!==null&&(x=xl(y),y!==x||y.tag!==5&&y.tag!==6)&&(y=null)):(g=null,y=d),g!==y)){if(w=eb,b="onMouseLeave",v="onMouseEnter",_="mouse",(n==="pointerout"||n==="pointerover")&&(w=nb,b="onPointerLeave",v="onPointerEnter",_="pointer"),x=g==null?p:Mc(g),M=y==null?p:Mc(y),p=new w(b,_+"leave",g,t,f),p.target=x,p.relatedTarget=M,b=null,Wa(f)===d&&(w=new w(v,_+"enter",y,t,f),w.target=M,w.relatedTarget=x,b=w),x=b,g&&y)t:{for(w=g,v=y,_=0,M=w;M;M=Bl(M))_++;for(M=0,b=v;b;b=Bl(b))M++;for(;0<_-M;)w=Bl(w),_--;for(;0<M-_;)v=Bl(v),M--;for(;_--;){if(w===v||v!==null&&w===v.alternate)break t;w=Bl(w),v=Bl(v)}w=null}else w=null;g!==null&&hb(h,p,g,w,!1),y!==null&&x!==null&&hb(h,x,y,w,!0)}}e:{if(p=d?Mc(d):window,g=p.nodeName&&p.nodeName.toLowerCase(),g==="select"||g==="input"&&p.type==="file")var N=tO;else if(sb(p))if(RR)N=sO;else{N=iO;var C=nO}else(g=p.nodeName)&&g.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(N=rO);if(N&&(N=N(n,d))){CR(h,N,t,f);break e}C&&C(n,p,d),n==="focusout"&&(C=p._wrapperState)&&C.controlled&&p.type==="number"&&sx(p,"number",p.value)}switch(C=d?Mc(d):window,n){case"focusin":(sb(C)||C.contentEditable==="true")&&(Sc=C,vx=d,Pd=null);break;case"focusout":Pd=vx=Sc=null;break;case"mousedown":yx=!0;break;case"contextmenu":case"mouseup":case"dragend":yx=!1,ub(h,t,f);break;case"selectionchange":if(lO)break;case"keydown":case"keyup":ub(h,t,f)}var P;if(yw)e:{switch(n){case"compositionstart":var D="onCompositionStart";break e;case"compositionend":D="onCompositionEnd";break e;case"compositionupdate":D="onCompositionUpdate";break e}D=void 0}else xc?AR(n,t)&&(D="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(D="onCompositionStart");D&&(bR&&t.locale!=="ko"&&(xc||D!=="onCompositionStart"?D==="onCompositionEnd"&&xc&&(P=ER()):(jo=f,mw="value"in jo?jo.value:jo.textContent,xc=!0)),C=og(d,D),0<C.length&&(D=new tb(D,n,null,t,f),h.push({event:D,listeners:C}),P?D.data=P:(P=TR(t),P!==null&&(D.data=P)))),(P=ZD?JD(n,t):KD(n,t))&&(d=og(d,"onBeforeInput"),0<d.length&&(f=new tb("onBeforeInput","beforeinput",null,t,f),h.push({event:f,listeners:d}),f.data=P))}zR(h,e)})}function Kd(n,e,t){return{instance:n,listener:e,currentTarget:t}}function og(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=jd(n,t),s!=null&&i.unshift(Kd(n,s,r)),s=jd(n,e),s!=null&&i.push(Kd(n,s,r))),n=n.return}return i}function Bl(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function hb(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,u=a.alternate,d=a.stateNode;if(u!==null&&u===i)break;a.tag===5&&d!==null&&(a=d,r?(u=jd(t,s),u!=null&&o.unshift(Kd(t,u,a))):r||(u=jd(t,s),u!=null&&o.push(Kd(t,u,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var fO=/\r\n?/g,hO=/\u0000|\uFFFD/g;function pb(n){return(typeof n=="string"?n:""+n).replace(fO,`
`).replace(hO,"")}function cp(n,e,t){if(e=pb(e),pb(n)!==e&&t)throw Error(Oe(425))}function ag(){}var _x=null,xx=null;function Sx(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 wx=typeof setTimeout=="function"?setTimeout:void 0,pO=typeof clearTimeout=="function"?clearTimeout:void 0,mb=typeof Promise=="function"?Promise:void 0,mO=typeof queueMicrotask=="function"?queueMicrotask:typeof mb<"u"?function(n){return mb.resolve(null).then(n).catch(gO)}:wx;function gO(n){setTimeout(function(){throw n})}function Ly(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),Yd(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);Yd(e)}function Jo(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 gb(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 cu=Math.random().toString(36).slice(2),Es="__reactFiber$"+cu,Qd="__reactProps$"+cu,ao="__reactContainer$"+cu,Mx="__reactEvents$"+cu,vO="__reactListeners$"+cu,yO="__reactHandles$"+cu;function Wa(n){var e=n[Es];if(e)return e;for(var t=n.parentNode;t;){if(e=t[ao]||t[Es]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=gb(n);n!==null;){if(t=n[Es])return t;n=gb(n)}return e}n=t,t=n.parentNode}return null}function zf(n){return n=n[Es]||n[ao],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Mc(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(Oe(33))}function v0(n){return n[Qd]||null}var Ex=[],Ec=-1;function ca(n){return{current:n}}function en(n){0>Ec||(n.current=Ex[Ec],Ex[Ec]=null,Ec--)}function $t(n,e){Ec++,Ex[Ec]=n.current,n.current=e}var sa={},yi=ca(sa),Vi=ca(!1),cl=sa;function Zc(n,e){var t=n.type.contextTypes;if(!t)return sa;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 Hi(n){return n=n.childContextTypes,n!=null}function lg(){en(Vi),en(yi)}function vb(n,e,t){if(yi.current!==sa)throw Error(Oe(168));$t(yi,e),$t(Vi,t)}function VR(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(Oe(108,nD(n)||"Unknown",r));return pn({},t,i)}function cg(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||sa,cl=yi.current,$t(yi,n),$t(Vi,Vi.current),!0}function yb(n,e,t){var i=n.stateNode;if(!i)throw Error(Oe(169));t?(n=VR(n,e,cl),i.__reactInternalMemoizedMergedChildContext=n,en(Vi),en(yi),$t(yi,n)):en(Vi),$t(Vi,t)}var Ks=null,y0=!1,Ny=!1;function HR(n){Ks===null?Ks=[n]:Ks.push(n)}function _O(n){y0=!0,HR(n)}function ua(){if(!Ny&&Ks!==null){Ny=!0;var n=0,e=jt;try{var t=Ks;for(jt=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}Ks=null,y0=!1}catch(r){throw Ks!==null&&(Ks=Ks.slice(n+1)),hR(dw,ua),r}finally{jt=e,Ny=!1}}return null}var bc=[],Ac=0,ug=null,dg=0,Ar=[],Tr=0,ul=null,to=1,no="";function Ua(n,e){bc[Ac++]=dg,bc[Ac++]=ug,ug=n,dg=e}function GR(n,e,t){Ar[Tr++]=to,Ar[Tr++]=no,Ar[Tr++]=ul,ul=n;var i=to;n=no;var r=32-ns(i)-1;i&=~(1<<r),t+=1;var s=32-ns(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,to=1<<32-ns(e)+r|t<<r|i,no=s+n}else to=1<<s|t<<r|i,no=n}function xw(n){n.return!==null&&(Ua(n,1),GR(n,1,0))}function Sw(n){for(;n===ug;)ug=bc[--Ac],bc[Ac]=null,dg=bc[--Ac],bc[Ac]=null;for(;n===ul;)ul=Ar[--Tr],Ar[Tr]=null,no=Ar[--Tr],Ar[Tr]=null,to=Ar[--Tr],Ar[Tr]=null}var lr=null,or=null,rn=!1,Jr=null;function WR(n,e){var t=Rr(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 _b(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,lr=n,or=Jo(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,lr=n,or=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=ul!==null?{id:to,overflow:no}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=Rr(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,lr=n,or=null,!0):!1;default:return!1}}function bx(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Ax(n){if(rn){var e=or;if(e){var t=e;if(!_b(n,e)){if(bx(n))throw Error(Oe(418));e=Jo(t.nextSibling);var i=lr;e&&_b(n,e)?WR(i,t):(n.flags=n.flags&-4097|2,rn=!1,lr=n)}}else{if(bx(n))throw Error(Oe(418));n.flags=n.flags&-4097|2,rn=!1,lr=n}}}function xb(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;lr=n}function up(n){if(n!==lr)return!1;if(!rn)return xb(n),rn=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!Sx(n.type,n.memoizedProps)),e&&(e=or)){if(bx(n))throw jR(),Error(Oe(418));for(;e;)WR(n,e),e=Jo(e.nextSibling)}if(xb(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(Oe(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){or=Jo(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}or=null}}else or=lr?Jo(n.stateNode.nextSibling):null;return!0}function jR(){for(var n=or;n;)n=Jo(n.nextSibling)}function Jc(){or=lr=null,rn=!1}function ww(n){Jr===null?Jr=[n]:Jr.push(n)}var xO=ho.ReactCurrentBatchConfig;function Wu(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(Oe(309));var i=t.stateNode}if(!i)throw Error(Oe(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;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(Oe(284));if(!t._owner)throw Error(Oe(290,n))}return n}function dp(n,e){throw n=Object.prototype.toString.call(e),Error(Oe(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function Sb(n){var e=n._init;return e(n._payload)}function XR(n){function e(v,_){if(n){var M=v.deletions;M===null?(v.deletions=[_],v.flags|=16):M.push(_)}}function t(v,_){if(!n)return null;for(;_!==null;)e(v,_),_=_.sibling;return null}function i(v,_){for(v=new Map;_!==null;)_.key!==null?v.set(_.key,_):v.set(_.index,_),_=_.sibling;return v}function r(v,_){return v=ta(v,_),v.index=0,v.sibling=null,v}function s(v,_,M){return v.index=M,n?(M=v.alternate,M!==null?(M=M.index,M<_?(v.flags|=2,_):M):(v.flags|=2,_)):(v.flags|=1048576,_)}function o(v){return n&&v.alternate===null&&(v.flags|=2),v}function a(v,_,M,b){return _===null||_.tag!==6?(_=By(M,v.mode,b),_.return=v,_):(_=r(_,M),_.return=v,_)}function u(v,_,M,b){var N=M.type;return N===_c?f(v,_,M.props.children,b,M.key):_!==null&&(_.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ko&&Sb(N)===_.type)?(b=r(_,M.props),b.ref=Wu(v,_,M),b.return=v,b):(b=Rm(M.type,M.key,M.props,null,v.mode,b),b.ref=Wu(v,_,M),b.return=v,b)}function d(v,_,M,b){return _===null||_.tag!==4||_.stateNode.containerInfo!==M.containerInfo||_.stateNode.implementation!==M.implementation?(_=Vy(M,v.mode,b),_.return=v,_):(_=r(_,M.children||[]),_.return=v,_)}function f(v,_,M,b,N){return _===null||_.tag!==7?(_=nl(M,v.mode,b,N),_.return=v,_):(_=r(_,M),_.return=v,_)}function h(v,_,M){if(typeof _=="string"&&_!==""||typeof _=="number")return _=By(""+_,v.mode,M),_.return=v,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case ep:return M=Rm(_.type,_.key,_.props,null,v.mode,M),M.ref=Wu(v,null,_),M.return=v,M;case yc:return _=Vy(_,v.mode,M),_.return=v,_;case ko:var b=_._init;return h(v,b(_._payload),M)}if(dd(_)||zu(_))return _=nl(_,v.mode,M,null),_.return=v,_;dp(v,_)}return null}function p(v,_,M,b){var N=_!==null?_.key:null;if(typeof M=="string"&&M!==""||typeof M=="number")return N!==null?null:a(v,_,""+M,b);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case ep:return M.key===N?u(v,_,M,b):null;case yc:return M.key===N?d(v,_,M,b):null;case ko:return N=M._init,p(v,_,N(M._payload),b)}if(dd(M)||zu(M))return N!==null?null:f(v,_,M,b,null);dp(v,M)}return null}function g(v,_,M,b,N){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(M)||null,a(_,v,""+b,N);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ep:return v=v.get(b.key===null?M:b.key)||null,u(_,v,b,N);case yc:return v=v.get(b.key===null?M:b.key)||null,d(_,v,b,N);case ko:var C=b._init;return g(v,_,M,C(b._payload),N)}if(dd(b)||zu(b))return v=v.get(M)||null,f(_,v,b,N,null);dp(_,b)}return null}function y(v,_,M,b){for(var N=null,C=null,P=_,D=_=0,I=null;P!==null&&D<M.length;D++){P.index>D?(I=P,P=null):I=P.sibling;var A=p(v,P,M[D],b);if(A===null){P===null&&(P=I);break}n&&P&&A.alternate===null&&e(v,P),_=s(A,_,D),C===null?N=A:C.sibling=A,C=A,P=I}if(D===M.length)return t(v,P),rn&&Ua(v,D),N;if(P===null){for(;D<M.length;D++)P=h(v,M[D],b),P!==null&&(_=s(P,_,D),C===null?N=P:C.sibling=P,C=P);return rn&&Ua(v,D),N}for(P=i(v,P);D<M.length;D++)I=g(P,v,D,M[D],b),I!==null&&(n&&I.alternate!==null&&P.delete(I.key===null?D:I.key),_=s(I,_,D),C===null?N=I:C.sibling=I,C=I);return n&&P.forEach(function(U){return e(v,U)}),rn&&Ua(v,D),N}function w(v,_,M,b){var N=zu(M);if(typeof N!="function")throw Error(Oe(150));if(M=N.call(M),M==null)throw Error(Oe(151));for(var C=N=null,P=_,D=_=0,I=null,A=M.next();P!==null&&!A.done;D++,A=M.next()){P.index>D?(I=P,P=null):I=P.sibling;var U=p(v,P,A.value,b);if(U===null){P===null&&(P=I);break}n&&P&&U.alternate===null&&e(v,P),_=s(U,_,D),C===null?N=U:C.sibling=U,C=U,P=I}if(A.done)return t(v,P),rn&&Ua(v,D),N;if(P===null){for(;!A.done;D++,A=M.next())A=h(v,A.value,b),A!==null&&(_=s(A,_,D),C===null?N=A:C.sibling=A,C=A);return rn&&Ua(v,D),N}for(P=i(v,P);!A.done;D++,A=M.next())A=g(P,v,D,A.value,b),A!==null&&(n&&A.alternate!==null&&P.delete(A.key===null?D:A.key),_=s(A,_,D),C===null?N=A:C.sibling=A,C=A);return n&&P.forEach(function(G){return e(v,G)}),rn&&Ua(v,D),N}function x(v,_,M,b){if(typeof M=="object"&&M!==null&&M.type===_c&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case ep:e:{for(var N=M.key,C=_;C!==null;){if(C.key===N){if(N=M.type,N===_c){if(C.tag===7){t(v,C.sibling),_=r(C,M.props.children),_.return=v,v=_;break e}}else if(C.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ko&&Sb(N)===C.type){t(v,C.sibling),_=r(C,M.props),_.ref=Wu(v,C,M),_.return=v,v=_;break e}t(v,C);break}else e(v,C);C=C.sibling}M.type===_c?(_=nl(M.props.children,v.mode,b,M.key),_.return=v,v=_):(b=Rm(M.type,M.key,M.props,null,v.mode,b),b.ref=Wu(v,_,M),b.return=v,v=b)}return o(v);case yc:e:{for(C=M.key;_!==null;){if(_.key===C)if(_.tag===4&&_.stateNode.containerInfo===M.containerInfo&&_.stateNode.implementation===M.implementation){t(v,_.sibling),_=r(_,M.children||[]),_.return=v,v=_;break e}else{t(v,_);break}else e(v,_);_=_.sibling}_=Vy(M,v.mode,b),_.return=v,v=_}return o(v);case ko:return C=M._init,x(v,_,C(M._payload),b)}if(dd(M))return y(v,_,M,b);if(zu(M))return w(v,_,M,b);dp(v,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,_!==null&&_.tag===6?(t(v,_.sibling),_=r(_,M),_.return=v,v=_):(t(v,_),_=By(M,v.mode,b),_.return=v,v=_),o(v)):t(v,_)}return x}var Kc=XR(!0),qR=XR(!1),fg=ca(null),hg=null,Tc=null,Mw=null;function Ew(){Mw=Tc=hg=null}function bw(n){var e=fg.current;en(fg),n._currentValue=e}function Tx(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 Vc(n,e){hg=n,Mw=Tc=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(zi=!0),n.firstContext=null)}function Dr(n){var e=n._currentValue;if(Mw!==n)if(n={context:n,memoizedValue:e,next:null},Tc===null){if(hg===null)throw Error(Oe(308));Tc=n,hg.dependencies={lanes:0,firstContext:n}}else Tc=Tc.next=n;return e}var ja=null;function Aw(n){ja===null?ja=[n]:ja.push(n)}function YR(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,Aw(e)):(t.next=r.next,r.next=t),e.interleaved=t,lo(n,i)}function lo(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 zo=!1;function Tw(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $R(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 ro(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Ko(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Ot&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,lo(n,t)}return r=i.interleaved,r===null?(e.next=e,Aw(i)):(e.next=r.next,r.next=e),i.interleaved=e,lo(n,t)}function Mm(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,fw(n,t)}}function wb(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 pg(n,e,t,i){var r=n.updateQueue;zo=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var u=a,d=u.next;u.next=null,o===null?s=d:o.next=d,o=u;var f=n.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=d:a.next=d,f.lastBaseUpdate=u))}if(s!==null){var h=r.baseState;o=0,f=d=u=null,a=s;do{var p=a.lane,g=a.eventTime;if((i&p)===p){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=n,w=a;switch(p=e,g=t,w.tag){case 1:if(y=w.payload,typeof y=="function"){h=y.call(g,h,p);break e}h=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,p=typeof y=="function"?y.call(g,h,p):y,p==null)break e;h=pn({},h,p);break e;case 2:zo=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,p=r.effects,p===null?r.effects=[a]:p.push(a))}else g={eventTime:g,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(d=f=g,u=h):f=f.next=g,o|=p;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);if(f===null&&(u=h),r.baseState=u,r.firstBaseUpdate=d,r.lastBaseUpdate=f,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);fl|=o,n.lanes=o,n.memoizedState=h}}function Mb(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(Oe(191,r));r.call(i)}}}var Bf={},Ps=ca(Bf),ef=ca(Bf),tf=ca(Bf);function Xa(n){if(n===Bf)throw Error(Oe(174));return n}function Cw(n,e){switch($t(tf,e),$t(ef,n),$t(Ps,Bf),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ax(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=ax(e,n)}en(Ps),$t(Ps,e)}function Qc(){en(Ps),en(ef),en(tf)}function ZR(n){Xa(tf.current);var e=Xa(Ps.current),t=ax(e,n.type);e!==t&&($t(ef,n),$t(Ps,t))}function Rw(n){ef.current===n&&(en(Ps),en(ef))}var un=ca(0);function mg(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)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 Dy=[];function Pw(){for(var n=0;n<Dy.length;n++)Dy[n]._workInProgressVersionPrimary=null;Dy.length=0}var Em=ho.ReactCurrentDispatcher,Oy=ho.ReactCurrentBatchConfig,dl=0,fn=null,Un=null,qn=null,gg=!1,Id=!1,nf=0,SO=0;function ci(){throw Error(Oe(321))}function Iw(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!ss(n[t],e[t]))return!1;return!0}function Lw(n,e,t,i,r,s){if(dl=s,fn=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Em.current=n===null||n.memoizedState===null?bO:AO,n=t(i,r),Id){s=0;do{if(Id=!1,nf=0,25<=s)throw Error(Oe(301));s+=1,qn=Un=null,e.updateQueue=null,Em.current=TO,n=t(i,r)}while(Id)}if(Em.current=vg,e=Un!==null&&Un.next!==null,dl=0,qn=Un=fn=null,gg=!1,e)throw Error(Oe(300));return n}function Nw(){var n=nf!==0;return nf=0,n}function ws(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qn===null?fn.memoizedState=qn=n:qn=qn.next=n,qn}function Or(){if(Un===null){var n=fn.alternate;n=n!==null?n.memoizedState:null}else n=Un.next;var e=qn===null?fn.memoizedState:qn.next;if(e!==null)qn=e,Un=n;else{if(n===null)throw Error(Oe(310));Un=n,n={memoizedState:Un.memoizedState,baseState:Un.baseState,baseQueue:Un.baseQueue,queue:Un.queue,next:null},qn===null?fn.memoizedState=qn=n:qn=qn.next=n}return qn}function rf(n,e){return typeof e=="function"?e(n):e}function Uy(n){var e=Or(),t=e.queue;if(t===null)throw Error(Oe(311));t.lastRenderedReducer=n;var i=Un,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,u=null,d=s;do{var f=d.lane;if((dl&f)===f)u!==null&&(u=u.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),i=d.hasEagerState?d.eagerState:n(i,d.action);else{var h={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};u===null?(a=u=h,o=i):u=u.next=h,fn.lanes|=f,fl|=f}d=d.next}while(d!==null&&d!==s);u===null?o=i:u.next=a,ss(i,e.memoizedState)||(zi=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=u,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,fn.lanes|=s,fl|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function Fy(n){var e=Or(),t=e.queue;if(t===null)throw Error(Oe(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);ss(s,e.memoizedState)||(zi=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function JR(){}function KR(n,e){var t=fn,i=Or(),r=e(),s=!ss(i.memoizedState,r);if(s&&(i.memoizedState=r,zi=!0),i=i.queue,Dw(tP.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||qn!==null&&qn.memoizedState.tag&1){if(t.flags|=2048,sf(9,eP.bind(null,t,i,r,e),void 0,null),$n===null)throw Error(Oe(349));dl&30||QR(t,e,r)}return r}function QR(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=fn.updateQueue,e===null?(e={lastEffect:null,stores:null},fn.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function eP(n,e,t,i){e.value=t,e.getSnapshot=i,nP(e)&&iP(n)}function tP(n,e,t){return t(function(){nP(e)&&iP(n)})}function nP(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!ss(n,t)}catch{return!0}}function iP(n){var e=lo(n,1);e!==null&&is(e,n,1,-1)}function Eb(n){var e=ws();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:rf,lastRenderedState:n},e.queue=n,n=n.dispatch=EO.bind(null,fn,n),[e.memoizedState,n]}function sf(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=fn.updateQueue,e===null?(e={lastEffect:null,stores:null},fn.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 rP(){return Or().memoizedState}function bm(n,e,t,i){var r=ws();fn.flags|=n,r.memoizedState=sf(1|e,t,void 0,i===void 0?null:i)}function _0(n,e,t,i){var r=Or();i=i===void 0?null:i;var s=void 0;if(Un!==null){var o=Un.memoizedState;if(s=o.destroy,i!==null&&Iw(i,o.deps)){r.memoizedState=sf(e,t,s,i);return}}fn.flags|=n,r.memoizedState=sf(1|e,t,s,i)}function bb(n,e){return bm(8390656,8,n,e)}function Dw(n,e){return _0(2048,8,n,e)}function sP(n,e){return _0(4,2,n,e)}function oP(n,e){return _0(4,4,n,e)}function aP(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 lP(n,e,t){return t=t!=null?t.concat([n]):null,_0(4,4,aP.bind(null,e,n),t)}function Ow(){}function cP(n,e){var t=Or();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Iw(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function uP(n,e){var t=Or();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Iw(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function dP(n,e,t){return dl&21?(ss(t,e)||(t=gR(),fn.lanes|=t,fl|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,zi=!0),n.memoizedState=t)}function wO(n,e){var t=jt;jt=t!==0&&4>t?t:4,n(!0);var i=Oy.transition;Oy.transition={};try{n(!1),e()}finally{jt=t,Oy.transition=i}}function fP(){return Or().memoizedState}function MO(n,e,t){var i=ea(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},hP(n))pP(e,t);else if(t=YR(n,e,t,i),t!==null){var r=Ri();is(t,n,i,r),mP(t,e,i)}}function EO(n,e,t){var i=ea(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(hP(n))pP(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,ss(a,o)){var u=e.interleaved;u===null?(r.next=r,Aw(e)):(r.next=u.next,u.next=r),e.interleaved=r;return}}catch{}finally{}t=YR(n,e,r,i),t!==null&&(r=Ri(),is(t,n,i,r),mP(t,e,i))}}function hP(n){var e=n.alternate;return n===fn||e!==null&&e===fn}function pP(n,e){Id=gg=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function mP(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,fw(n,t)}}var vg={readContext:Dr,useCallback:ci,useContext:ci,useEffect:ci,useImperativeHandle:ci,useInsertionEffect:ci,useLayoutEffect:ci,useMemo:ci,useReducer:ci,useRef:ci,useState:ci,useDebugValue:ci,useDeferredValue:ci,useTransition:ci,useMutableSource:ci,useSyncExternalStore:ci,useId:ci,unstable_isNewReconciler:!1},bO={readContext:Dr,useCallback:function(n,e){return ws().memoizedState=[n,e===void 0?null:e],n},useContext:Dr,useEffect:bb,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,bm(4194308,4,aP.bind(null,e,n),t)},useLayoutEffect:function(n,e){return bm(4194308,4,n,e)},useInsertionEffect:function(n,e){return bm(4,2,n,e)},useMemo:function(n,e){var t=ws();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=ws();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=MO.bind(null,fn,n),[i.memoizedState,n]},useRef:function(n){var e=ws();return n={current:n},e.memoizedState=n},useState:Eb,useDebugValue:Ow,useDeferredValue:function(n){return ws().memoizedState=n},useTransition:function(){var n=Eb(!1),e=n[0];return n=wO.bind(null,n[1]),ws().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=fn,r=ws();if(rn){if(t===void 0)throw Error(Oe(407));t=t()}else{if(t=e(),$n===null)throw Error(Oe(349));dl&30||QR(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,bb(tP.bind(null,i,s,n),[n]),i.flags|=2048,sf(9,eP.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=ws(),e=$n.identifierPrefix;if(rn){var t=no,i=to;t=(i&~(1<<32-ns(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=nf++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=SO++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},AO={readContext:Dr,useCallback:cP,useContext:Dr,useEffect:Dw,useImperativeHandle:lP,useInsertionEffect:sP,useLayoutEffect:oP,useMemo:uP,useReducer:Uy,useRef:rP,useState:function(){return Uy(rf)},useDebugValue:Ow,useDeferredValue:function(n){var e=Or();return dP(e,Un.memoizedState,n)},useTransition:function(){var n=Uy(rf)[0],e=Or().memoizedState;return[n,e]},useMutableSource:JR,useSyncExternalStore:KR,useId:fP,unstable_isNewReconciler:!1},TO={readContext:Dr,useCallback:cP,useContext:Dr,useEffect:Dw,useImperativeHandle:lP,useInsertionEffect:sP,useLayoutEffect:oP,useMemo:uP,useReducer:Fy,useRef:rP,useState:function(){return Fy(rf)},useDebugValue:Ow,useDeferredValue:function(n){var e=Or();return Un===null?e.memoizedState=n:dP(e,Un.memoizedState,n)},useTransition:function(){var n=Fy(rf)[0],e=Or().memoizedState;return[n,e]},useMutableSource:JR,useSyncExternalStore:KR,useId:fP,unstable_isNewReconciler:!1};function qr(n,e){if(n&&n.defaultProps){e=pn({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function Cx(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:pn({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var x0={isMounted:function(n){return(n=n._reactInternals)?xl(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=Ri(),r=ea(n),s=ro(i,r);s.payload=e,t!=null&&(s.callback=t),e=Ko(n,s,r),e!==null&&(is(e,n,r,i),Mm(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=Ri(),r=ea(n),s=ro(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Ko(n,s,r),e!==null&&(is(e,n,r,i),Mm(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=Ri(),i=ea(n),r=ro(t,i);r.tag=2,e!=null&&(r.callback=e),e=Ko(n,r,i),e!==null&&(is(e,n,i,t),Mm(e,n,i))}};function Ab(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?!Zd(t,i)||!Zd(r,s):!0}function gP(n,e,t){var i=!1,r=sa,s=e.contextType;return typeof s=="object"&&s!==null?s=Dr(s):(r=Hi(e)?cl:yi.current,i=e.contextTypes,s=(i=i!=null)?Zc(n,r):sa),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=x0,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function Tb(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&&x0.enqueueReplaceState(e,e.state,null)}function Rx(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},Tw(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=Dr(s):(s=Hi(e)?cl:yi.current,r.context=Zc(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(Cx(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&&x0.enqueueReplaceState(r,r.state,null),pg(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function eu(n,e){try{var t="",i=e;do t+=tD(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 ky(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function Px(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var CO=typeof WeakMap=="function"?WeakMap:Map;function vP(n,e,t){t=ro(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){_g||(_g=!0,Bx=i),Px(n,e)},t}function yP(n,e,t){t=ro(-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(){Px(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){Px(n,e),typeof i!="function"&&(Qo===null?Qo=new Set([this]):Qo.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function Cb(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new CO;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=HO.bind(null,n,e,t),e.then(n,n))}function Rb(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 Pb(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=ro(-1,1),e.tag=2,Ko(t,e,1))),t.lanes|=1),n)}var RO=ho.ReactCurrentOwner,zi=!1;function Ai(n,e,t,i){e.child=n===null?qR(e,null,t,i):Kc(e,n.child,t,i)}function Ib(n,e,t,i,r){t=t.render;var s=e.ref;return Vc(e,r),i=Lw(n,e,t,i,s,r),t=Nw(),n!==null&&!zi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,co(n,e,r)):(rn&&t&&xw(e),e.flags|=1,Ai(n,e,i,r),e.child)}function Lb(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Gw(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,_P(n,e,s,i,r)):(n=Rm(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)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:Zd,t(o,i)&&n.ref===e.ref)return co(n,e,r)}return e.flags|=1,n=ta(s,i),n.ref=e.ref,n.return=e,e.child=n}function _P(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(Zd(s,i)&&n.ref===e.ref)if(zi=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(zi=!0);else return e.lanes=n.lanes,co(n,e,r)}return Ix(n,e,t,i,r)}function xP(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},$t(Rc,rr),rr|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,$t(Rc,rr),rr|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,$t(Rc,rr),rr|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,$t(Rc,rr),rr|=i;return Ai(n,e,r,t),e.child}function SP(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function Ix(n,e,t,i,r){var s=Hi(t)?cl:yi.current;return s=Zc(e,s),Vc(e,r),t=Lw(n,e,t,i,s,r),i=Nw(),n!==null&&!zi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,co(n,e,r)):(rn&&i&&xw(e),e.flags|=1,Ai(n,e,t,r),e.child)}function Nb(n,e,t,i,r){if(Hi(t)){var s=!0;cg(e)}else s=!1;if(Vc(e,r),e.stateNode===null)Am(n,e),gP(e,t,i),Rx(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var u=o.context,d=t.contextType;typeof d=="object"&&d!==null?d=Dr(d):(d=Hi(t)?cl:yi.current,d=Zc(e,d));var f=t.getDerivedStateFromProps,h=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||u!==d)&&Tb(e,o,i,d),zo=!1;var p=e.memoizedState;o.state=p,pg(e,i,o,r),u=e.memoizedState,a!==i||p!==u||Vi.current||zo?(typeof f=="function"&&(Cx(e,t,f,i),u=e.memoizedState),(a=zo||Ab(e,t,a,i,p,u,d))?(h||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=u),o.props=i,o.state=u,o.context=d,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,$R(n,e),a=e.memoizedProps,d=e.type===e.elementType?a:qr(e.type,a),o.props=d,h=e.pendingProps,p=o.context,u=t.contextType,typeof u=="object"&&u!==null?u=Dr(u):(u=Hi(t)?cl:yi.current,u=Zc(e,u));var g=t.getDerivedStateFromProps;(f=typeof g=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||p!==u)&&Tb(e,o,i,u),zo=!1,p=e.memoizedState,o.state=p,pg(e,i,o,r);var y=e.memoizedState;a!==h||p!==y||Vi.current||zo?(typeof g=="function"&&(Cx(e,t,g,i),y=e.memoizedState),(d=zo||Ab(e,t,d,i,p,y,u)||!1)?(f||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,y,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,y,u)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=y),o.props=i,o.state=y,o.context=u,i=d):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=1024),i=!1)}return Lx(n,e,t,i,s,r)}function Lx(n,e,t,i,r,s){SP(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&yb(e,t,!1),co(n,e,s);i=e.stateNode,RO.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Kc(e,n.child,null,s),e.child=Kc(e,null,a,s)):Ai(n,e,a,s),e.memoizedState=i.state,r&&yb(e,t,!0),e.child}function wP(n){var e=n.stateNode;e.pendingContext?vb(n,e.pendingContext,e.pendingContext!==e.context):e.context&&vb(n,e.context,!1),Cw(n,e.containerInfo)}function Db(n,e,t,i,r){return Jc(),ww(r),e.flags|=256,Ai(n,e,t,i),e.child}var Nx={dehydrated:null,treeContext:null,retryLane:0};function Dx(n){return{baseLanes:n,cachePool:null,transitions:null}}function MP(n,e,t){var i=e.pendingProps,r=un.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),$t(un,r&1),n===null)return Ax(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=M0(o,i,0,null),n=nl(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=Dx(t),e.memoizedState=Nx,n):Uw(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return PO(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var u={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=u,e.deletions=null):(i=ta(r,u),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=ta(a,s):(s=nl(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?Dx(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=Nx,i}return s=n.child,n=s.sibling,i=ta(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(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 Uw(n,e){return e=M0({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function fp(n,e,t,i){return i!==null&&ww(i),Kc(e,n.child,null,t),n=Uw(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function PO(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=ky(Error(Oe(422))),fp(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=M0({mode:"visible",children:i.children},r,0,null),s=nl(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Kc(e,n.child,null,o),e.child.memoizedState=Dx(o),e.memoizedState=Nx,s);if(!(e.mode&1))return fp(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(Oe(419)),i=ky(s,i,void 0),fp(n,e,o,i)}if(a=(o&n.childLanes)!==0,zi||a){if(i=$n,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:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,lo(n,r),is(i,n,r,-1))}return Hw(),i=ky(Error(Oe(421))),fp(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=GO.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,or=Jo(r.nextSibling),lr=e,rn=!0,Jr=null,n!==null&&(Ar[Tr++]=to,Ar[Tr++]=no,Ar[Tr++]=ul,to=n.id,no=n.overflow,ul=e),e=Uw(e,i.children),e.flags|=4096,e)}function Ob(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),Tx(n.return,e,t)}function zy(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 EP(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(Ai(n,e,i.children,t),i=un.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Ob(n,t,e);else if(n.tag===19)Ob(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($t(un,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&mg(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),zy(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&&mg(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}zy(e,!0,t,null,s);break;case"together":zy(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Am(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function co(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),fl|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Oe(153));if(e.child!==null){for(n=e.child,t=ta(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=ta(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function IO(n,e,t){switch(e.tag){case 3:wP(e),Jc();break;case 5:ZR(e);break;case 1:Hi(e.type)&&cg(e);break;case 4:Cw(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;$t(fg,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?($t(un,un.current&1),e.flags|=128,null):t&e.child.childLanes?MP(n,e,t):($t(un,un.current&1),n=co(n,e,t),n!==null?n.sibling:null);$t(un,un.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return EP(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),$t(un,un.current),i)break;return null;case 22:case 23:return e.lanes=0,xP(n,e,t)}return co(n,e,t)}var bP,Ox,AP,TP;bP=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}};Ox=function(){};AP=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,Xa(Ps.current);var s=null;switch(t){case"input":r=ix(n,r),i=ix(n,i),s=[];break;case"select":r=pn({},r,{value:void 0}),i=pn({},i,{value:void 0}),s=[];break;case"textarea":r=ox(n,r),i=ox(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=ag)}lx(t,i);var o;t=null;for(d in r)if(!i.hasOwnProperty(d)&&r.hasOwnProperty(d)&&r[d]!=null)if(d==="style"){var a=r[d];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Gd.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in i){var u=i[d];if(a=r!=null?r[d]:void 0,i.hasOwnProperty(d)&&u!==a&&(u!=null||a!=null))if(d==="style")if(a){for(o in a)!a.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in u)u.hasOwnProperty(o)&&a[o]!==u[o]&&(t||(t={}),t[o]=u[o])}else t||(s||(s=[]),s.push(d,t)),t=u;else d==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(s=s||[]).push(d,u)):d==="children"?typeof u!="string"&&typeof u!="number"||(s=s||[]).push(d,""+u):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Gd.hasOwnProperty(d)?(u!=null&&d==="onScroll"&&Jt("scroll",n),s||a===u||(s=[])):(s=s||[]).push(d,u))}t&&(s=s||[]).push("style",t);var d=s;(e.updateQueue=d)&&(e.flags|=4)}};TP=function(n,e,t,i){t!==i&&(e.flags|=4)};function ju(n,e){if(!rn)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 ui(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 LO(n,e,t){var i=e.pendingProps;switch(Sw(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ui(e),null;case 1:return Hi(e.type)&&lg(),ui(e),null;case 3:return i=e.stateNode,Qc(),en(Vi),en(yi),Pw(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(up(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Jr!==null&&(Gx(Jr),Jr=null))),Ox(n,e),ui(e),null;case 5:Rw(e);var r=Xa(tf.current);if(t=e.type,n!==null&&e.stateNode!=null)AP(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(Oe(166));return ui(e),null}if(n=Xa(Ps.current),up(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[Es]=e,i[Qd]=s,n=(e.mode&1)!==0,t){case"dialog":Jt("cancel",i),Jt("close",i);break;case"iframe":case"object":case"embed":Jt("load",i);break;case"video":case"audio":for(r=0;r<hd.length;r++)Jt(hd[r],i);break;case"source":Jt("error",i);break;case"img":case"image":case"link":Jt("error",i),Jt("load",i);break;case"details":Jt("toggle",i);break;case"input":WE(i,s),Jt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},Jt("invalid",i);break;case"textarea":XE(i,s),Jt("invalid",i)}lx(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&&cp(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&cp(i.textContent,a,n),r=["children",""+a]):Gd.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Jt("scroll",i)}switch(t){case"input":tp(i),jE(i,s,!0);break;case"textarea":tp(i),qE(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=ag)}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=tR(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[Es]=e,n[Qd]=i,bP(n,e,!1,!1),e.stateNode=n;e:{switch(o=cx(t,i),t){case"dialog":Jt("cancel",n),Jt("close",n),r=i;break;case"iframe":case"object":case"embed":Jt("load",n),r=i;break;case"video":case"audio":for(r=0;r<hd.length;r++)Jt(hd[r],n);r=i;break;case"source":Jt("error",n),r=i;break;case"img":case"image":case"link":Jt("error",n),Jt("load",n),r=i;break;case"details":Jt("toggle",n),r=i;break;case"input":WE(n,i),r=ix(n,i),Jt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=pn({},i,{value:void 0}),Jt("invalid",n);break;case"textarea":XE(n,i),r=ox(n,i),Jt("invalid",n);break;default:r=i}lx(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var u=a[s];s==="style"?rR(n,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&nR(n,u)):s==="children"?typeof u=="string"?(t!=="textarea"||u!=="")&&Wd(n,u):typeof u=="number"&&Wd(n,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Gd.hasOwnProperty(s)?u!=null&&s==="onScroll"&&Jt("scroll",n):u!=null&&ow(n,s,u,o))}switch(t){case"input":tp(n),jE(n,i,!1);break;case"textarea":tp(n),qE(n);break;case"option":i.value!=null&&n.setAttribute("value",""+ra(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?Fc(n,!!i.multiple,s,!1):i.defaultValue!=null&&Fc(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=ag)}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 ui(e),null;case 6:if(n&&e.stateNode!=null)TP(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(Oe(166));if(t=Xa(tf.current),Xa(Ps.current),up(e)){if(i=e.stateNode,t=e.memoizedProps,i[Es]=e,(s=i.nodeValue!==t)&&(n=lr,n!==null))switch(n.tag){case 3:cp(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&cp(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[Es]=e,e.stateNode=i}return ui(e),null;case 13:if(en(un),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(rn&&or!==null&&e.mode&1&&!(e.flags&128))jR(),Jc(),e.flags|=98560,s=!1;else if(s=up(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(Oe(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Oe(317));s[Es]=e}else Jc(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ui(e),s=!1}else Jr!==null&&(Gx(Jr),Jr=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||un.current&1?Fn===0&&(Fn=3):Hw())),e.updateQueue!==null&&(e.flags|=4),ui(e),null);case 4:return Qc(),Ox(n,e),n===null&&Jd(e.stateNode.containerInfo),ui(e),null;case 10:return bw(e.type._context),ui(e),null;case 17:return Hi(e.type)&&lg(),ui(e),null;case 19:if(en(un),s=e.memoizedState,s===null)return ui(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)ju(s,!1);else{if(Fn!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=mg(n),o!==null){for(e.flags|=128,ju(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 $t(un,un.current&1|2),e.child}n=n.sibling}s.tail!==null&&wn()>tu&&(e.flags|=128,i=!0,ju(s,!1),e.lanes=4194304)}else{if(!i)if(n=mg(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),ju(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!rn)return ui(e),null}else 2*wn()-s.renderingStartTime>tu&&t!==1073741824&&(e.flags|=128,i=!0,ju(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=wn(),e.sibling=null,t=un.current,$t(un,i?t&1|2:t&1),e):(ui(e),null);case 22:case 23:return Vw(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?rr&1073741824&&(ui(e),e.subtreeFlags&6&&(e.flags|=8192)):ui(e),null;case 24:return null;case 25:return null}throw Error(Oe(156,e.tag))}function NO(n,e){switch(Sw(e),e.tag){case 1:return Hi(e.type)&&lg(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Qc(),en(Vi),en(yi),Pw(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Rw(e),null;case 13:if(en(un),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Oe(340));Jc()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return en(un),null;case 4:return Qc(),null;case 10:return bw(e.type._context),null;case 22:case 23:return Vw(),null;case 24:return null;default:return null}}var hp=!1,mi=!1,DO=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function Cc(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){vn(n,e,i)}else t.current=null}function Ux(n,e,t){try{t()}catch(i){vn(n,e,i)}}var Ub=!1;function OO(n,e){if(_x=rg,n=LR(),_w(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,u=-1,d=0,f=0,h=n,p=null;t:for(;;){for(var g;h!==t||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(u=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(g=h.firstChild)!==null;)p=h,h=g;for(;;){if(h===n)break t;if(p===t&&++d===r&&(a=o),p===s&&++f===i&&(u=o),(g=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=g}t=a===-1||u===-1?null:{start:a,end:u}}else t=null}t=t||{start:0,end:0}}else t=null;for(xx={focusedElem:n,selectionRange:t},rg=!1,Ye=e;Ye!==null;)if(e=Ye,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ye=n;else for(;Ye!==null;){e=Ye;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,x=y.memoizedState,v=e.stateNode,_=v.getSnapshotBeforeUpdate(e.elementType===e.type?w:qr(e.type,w),x);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var M=e.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(b){vn(e,e.return,b)}if(n=e.sibling,n!==null){n.return=e.return,Ye=n;break}Ye=e.return}return y=Ub,Ub=!1,y}function Ld(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&&Ux(e,t,s)}r=r.next}while(r!==i)}}function S0(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 Fx(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 CP(n){var e=n.alternate;e!==null&&(n.alternate=null,CP(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Es],delete e[Qd],delete e[Mx],delete e[vO],delete e[yO])),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 RP(n){return n.tag===5||n.tag===3||n.tag===4}function Fb(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||RP(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 kx(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=ag));else if(i!==4&&(n=n.child,n!==null))for(kx(n,e,t),n=n.sibling;n!==null;)kx(n,e,t),n=n.sibling}function zx(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(zx(n,e,t),n=n.sibling;n!==null;)zx(n,e,t),n=n.sibling}var Jn=null,Zr=!1;function Ao(n,e,t){for(t=t.child;t!==null;)PP(n,e,t),t=t.sibling}function PP(n,e,t){if(Rs&&typeof Rs.onCommitFiberUnmount=="function")try{Rs.onCommitFiberUnmount(h0,t)}catch{}switch(t.tag){case 5:mi||Cc(t,e);case 6:var i=Jn,r=Zr;Jn=null,Ao(n,e,t),Jn=i,Zr=r,Jn!==null&&(Zr?(n=Jn,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Jn.removeChild(t.stateNode));break;case 18:Jn!==null&&(Zr?(n=Jn,t=t.stateNode,n.nodeType===8?Ly(n.parentNode,t):n.nodeType===1&&Ly(n,t),Yd(n)):Ly(Jn,t.stateNode));break;case 4:i=Jn,r=Zr,Jn=t.stateNode.containerInfo,Zr=!0,Ao(n,e,t),Jn=i,Zr=r;break;case 0:case 11:case 14:case 15:if(!mi&&(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||s&4)&&Ux(t,e,o),r=r.next}while(r!==i)}Ao(n,e,t);break;case 1:if(!mi&&(Cc(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){vn(t,e,a)}Ao(n,e,t);break;case 21:Ao(n,e,t);break;case 22:t.mode&1?(mi=(i=mi)||t.memoizedState!==null,Ao(n,e,t),mi=i):Ao(n,e,t);break;default:Ao(n,e,t)}}function kb(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new DO),e.forEach(function(i){var r=WO.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Br(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:Jn=a.stateNode,Zr=!1;break e;case 3:Jn=a.stateNode.containerInfo,Zr=!0;break e;case 4:Jn=a.stateNode.containerInfo,Zr=!0;break e}a=a.return}if(Jn===null)throw Error(Oe(160));PP(s,o,r),Jn=null,Zr=!1;var u=r.alternate;u!==null&&(u.return=null),r.return=null}catch(d){vn(r,e,d)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)IP(e,n),e=e.sibling}function IP(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Br(e,n),xs(n),i&4){try{Ld(3,n,n.return),S0(3,n)}catch(w){vn(n,n.return,w)}try{Ld(5,n,n.return)}catch(w){vn(n,n.return,w)}}break;case 1:Br(e,n),xs(n),i&512&&t!==null&&Cc(t,t.return);break;case 5:if(Br(e,n),xs(n),i&512&&t!==null&&Cc(t,t.return),n.flags&32){var r=n.stateNode;try{Wd(r,"")}catch(w){vn(n,n.return,w)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,u=n.updateQueue;if(n.updateQueue=null,u!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&QC(r,s),cx(a,o);var d=cx(a,s);for(o=0;o<u.length;o+=2){var f=u[o],h=u[o+1];f==="style"?rR(r,h):f==="dangerouslySetInnerHTML"?nR(r,h):f==="children"?Wd(r,h):ow(r,f,h,d)}switch(a){case"input":rx(r,s);break;case"textarea":eR(r,s);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var g=s.value;g!=null?Fc(r,!!s.multiple,g,!1):p!==!!s.multiple&&(s.defaultValue!=null?Fc(r,!!s.multiple,s.defaultValue,!0):Fc(r,!!s.multiple,s.multiple?[]:"",!1))}r[Qd]=s}catch(w){vn(n,n.return,w)}}break;case 6:if(Br(e,n),xs(n),i&4){if(n.stateNode===null)throw Error(Oe(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(w){vn(n,n.return,w)}}break;case 3:if(Br(e,n),xs(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{Yd(e.containerInfo)}catch(w){vn(n,n.return,w)}break;case 4:Br(e,n),xs(n);break;case 13:Br(e,n),xs(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(zw=wn())),i&4&&kb(n);break;case 22:if(f=t!==null&&t.memoizedState!==null,n.mode&1?(mi=(d=mi)||f,Br(e,n),mi=d):Br(e,n),xs(n),i&8192){if(d=n.memoizedState!==null,(n.stateNode.isHidden=d)&&!f&&n.mode&1)for(Ye=n,f=n.child;f!==null;){for(h=Ye=f;Ye!==null;){switch(p=Ye,g=p.child,p.tag){case 0:case 11:case 14:case 15:Ld(4,p,p.return);break;case 1:Cc(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){i=p,t=p.return;try{e=i,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(w){vn(i,t,w)}}break;case 5:Cc(p,p.return);break;case 22:if(p.memoizedState!==null){Bb(h);continue}}g!==null?(g.return=p,Ye=g):Bb(h)}f=f.sibling}e:for(f=null,h=n;;){if(h.tag===5){if(f===null){f=h;try{r=h.stateNode,d?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,u=h.memoizedProps.style,o=u!=null&&u.hasOwnProperty("display")?u.display:null,a.style.display=iR("display",o))}catch(w){vn(n,n.return,w)}}}else if(h.tag===6){if(f===null)try{h.stateNode.nodeValue=d?"":h.memoizedProps}catch(w){vn(n,n.return,w)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;f===h&&(f=null),h=h.return}f===h&&(f=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Br(e,n),xs(n),i&4&&kb(n);break;case 21:break;default:Br(e,n),xs(n)}}function xs(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(RP(t)){var i=t;break e}t=t.return}throw Error(Oe(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(Wd(r,""),i.flags&=-33);var s=Fb(n);zx(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=Fb(n);kx(n,a,o);break;default:throw Error(Oe(161))}}catch(u){vn(n,n.return,u)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function UO(n,e,t){Ye=n,LP(n)}function LP(n,e,t){for(var i=(n.mode&1)!==0;Ye!==null;){var r=Ye,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||hp;if(!o){var a=r.alternate,u=a!==null&&a.memoizedState!==null||mi;a=hp;var d=mi;if(hp=o,(mi=u)&&!d)for(Ye=r;Ye!==null;)o=Ye,u=o.child,o.tag===22&&o.memoizedState!==null?Vb(r):u!==null?(u.return=o,Ye=u):Vb(r);for(;s!==null;)Ye=s,LP(s),s=s.sibling;Ye=r,hp=a,mi=d}zb(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,Ye=s):zb(n)}}function zb(n){for(;Ye!==null;){var e=Ye;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:mi||S0(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!mi)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:qr(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&Mb(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}Mb(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&t.focus();break;case"img":u.src&&(t.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var d=e.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var h=f.dehydrated;h!==null&&Yd(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Oe(163))}mi||e.flags&512&&Fx(e)}catch(p){vn(e,e.return,p)}}if(e===n){Ye=null;break}if(t=e.sibling,t!==null){t.return=e.return,Ye=t;break}Ye=e.return}}function Bb(n){for(;Ye!==null;){var e=Ye;if(e===n){Ye=null;break}var t=e.sibling;if(t!==null){t.return=e.return,Ye=t;break}Ye=e.return}}function Vb(n){for(;Ye!==null;){var e=Ye;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{S0(4,e)}catch(u){vn(e,t,u)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(u){vn(e,r,u)}}var s=e.return;try{Fx(e)}catch(u){vn(e,s,u)}break;case 5:var o=e.return;try{Fx(e)}catch(u){vn(e,o,u)}}}catch(u){vn(e,e.return,u)}if(e===n){Ye=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Ye=a;break}Ye=e.return}}var FO=Math.ceil,yg=ho.ReactCurrentDispatcher,Fw=ho.ReactCurrentOwner,Lr=ho.ReactCurrentBatchConfig,Ot=0,$n=null,Pn=null,Qn=0,rr=0,Rc=ca(0),Fn=0,of=null,fl=0,w0=0,kw=0,Nd=null,ki=null,zw=0,tu=1/0,Js=null,_g=!1,Bx=null,Qo=null,pp=!1,Xo=null,xg=0,Dd=0,Vx=null,Tm=-1,Cm=0;function Ri(){return Ot&6?wn():Tm!==-1?Tm:Tm=wn()}function ea(n){return n.mode&1?Ot&2&&Qn!==0?Qn&-Qn:xO.transition!==null?(Cm===0&&(Cm=gR()),Cm):(n=jt,n!==0||(n=window.event,n=n===void 0?16:MR(n.type)),n):1}function is(n,e,t,i){if(50<Dd)throw Dd=0,Vx=null,Error(Oe(185));Ff(n,t,i),(!(Ot&2)||n!==$n)&&(n===$n&&(!(Ot&2)&&(w0|=t),Fn===4&&Ho(n,Qn)),Gi(n,i),t===1&&Ot===0&&!(e.mode&1)&&(tu=wn()+500,y0&&ua()))}function Gi(n,e){var t=n.callbackNode;xD(n,e);var i=ig(n,n===$n?Qn:0);if(i===0)t!==null&&ZE(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&ZE(t),e===1)n.tag===0?_O(Hb.bind(null,n)):HR(Hb.bind(null,n)),mO(function(){!(Ot&6)&&ua()}),t=null;else{switch(vR(i)){case 1:t=dw;break;case 4:t=pR;break;case 16:t=ng;break;case 536870912:t=mR;break;default:t=ng}t=BP(t,NP.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function NP(n,e){if(Tm=-1,Cm=0,Ot&6)throw Error(Oe(327));var t=n.callbackNode;if(Hc()&&n.callbackNode!==t)return null;var i=ig(n,n===$n?Qn:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=Sg(n,i);else{e=i;var r=Ot;Ot|=2;var s=OP();($n!==n||Qn!==e)&&(Js=null,tu=wn()+500,tl(n,e));do try{BO();break}catch(a){DP(n,a)}while(!0);Ew(),yg.current=s,Ot=r,Pn!==null?e=0:($n=null,Qn=0,e=Fn)}if(e!==0){if(e===2&&(r=px(n),r!==0&&(i=r,e=Hx(n,r))),e===1)throw t=of,tl(n,0),Ho(n,i),Gi(n,wn()),t;if(e===6)Ho(n,i);else{if(r=n.current.alternate,!(i&30)&&!kO(r)&&(e=Sg(n,i),e===2&&(s=px(n),s!==0&&(i=s,e=Hx(n,s))),e===1))throw t=of,tl(n,0),Ho(n,i),Gi(n,wn()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(Oe(345));case 2:Fa(n,ki,Js);break;case 3:if(Ho(n,i),(i&130023424)===i&&(e=zw+500-wn(),10<e)){if(ig(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){Ri(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=wx(Fa.bind(null,n,ki,Js),e);break}Fa(n,ki,Js);break;case 4:if(Ho(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-ns(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=wn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*FO(i/1960))-i,10<i){n.timeoutHandle=wx(Fa.bind(null,n,ki,Js),i);break}Fa(n,ki,Js);break;case 5:Fa(n,ki,Js);break;default:throw Error(Oe(329))}}}return Gi(n,wn()),n.callbackNode===t?NP.bind(null,n):null}function Hx(n,e){var t=Nd;return n.current.memoizedState.isDehydrated&&(tl(n,e).flags|=256),n=Sg(n,e),n!==2&&(e=ki,ki=t,e!==null&&Gx(e)),n}function Gx(n){ki===null?ki=n:ki.push.apply(ki,n)}function kO(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(!ss(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 Ho(n,e){for(e&=~kw,e&=~w0,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-ns(e),i=1<<t;n[t]=-1,e&=~i}}function Hb(n){if(Ot&6)throw Error(Oe(327));Hc();var e=ig(n,0);if(!(e&1))return Gi(n,wn()),null;var t=Sg(n,e);if(n.tag!==0&&t===2){var i=px(n);i!==0&&(e=i,t=Hx(n,i))}if(t===1)throw t=of,tl(n,0),Ho(n,e),Gi(n,wn()),t;if(t===6)throw Error(Oe(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,Fa(n,ki,Js),Gi(n,wn()),null}function Bw(n,e){var t=Ot;Ot|=1;try{return n(e)}finally{Ot=t,Ot===0&&(tu=wn()+500,y0&&ua())}}function hl(n){Xo!==null&&Xo.tag===0&&!(Ot&6)&&Hc();var e=Ot;Ot|=1;var t=Lr.transition,i=jt;try{if(Lr.transition=null,jt=1,n)return n()}finally{jt=i,Lr.transition=t,Ot=e,!(Ot&6)&&ua()}}function Vw(){rr=Rc.current,en(Rc)}function tl(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,pO(t)),Pn!==null)for(t=Pn.return;t!==null;){var i=t;switch(Sw(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&lg();break;case 3:Qc(),en(Vi),en(yi),Pw();break;case 5:Rw(i);break;case 4:Qc();break;case 13:en(un);break;case 19:en(un);break;case 10:bw(i.type._context);break;case 22:case 23:Vw()}t=t.return}if($n=n,Pn=n=ta(n.current,null),Qn=rr=e,Fn=0,of=null,kw=w0=fl=0,ki=Nd=null,ja!==null){for(e=0;e<ja.length;e++)if(t=ja[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}ja=null}return n}function DP(n,e){do{var t=Pn;try{if(Ew(),Em.current=vg,gg){for(var i=fn.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}gg=!1}if(dl=0,qn=Un=fn=null,Id=!1,nf=0,Fw.current=null,t===null||t.return===null){Fn=1,of=e,Pn=null;break}e:{var s=n,o=t.return,a=t,u=e;if(e=Qn,a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var d=u,f=a,h=f.tag;if(!(f.mode&1)&&(h===0||h===11||h===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var g=Rb(o);if(g!==null){g.flags&=-257,Pb(g,o,a,s,e),g.mode&1&&Cb(s,d,e),e=g,u=d;var y=e.updateQueue;if(y===null){var w=new Set;w.add(u),e.updateQueue=w}else y.add(u);break e}else{if(!(e&1)){Cb(s,d,e),Hw();break e}u=Error(Oe(426))}}else if(rn&&a.mode&1){var x=Rb(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Pb(x,o,a,s,e),ww(eu(u,a));break e}}s=u=eu(u,a),Fn!==4&&(Fn=2),Nd===null?Nd=[s]:Nd.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var v=vP(s,u,e);wb(s,v);break e;case 1:a=u;var _=s.type,M=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(Qo===null||!Qo.has(M)))){s.flags|=65536,e&=-e,s.lanes|=e;var b=yP(s,a,e);wb(s,b);break e}}s=s.return}while(s!==null)}FP(t)}catch(N){e=N,Pn===t&&t!==null&&(Pn=t=t.return);continue}break}while(!0)}function OP(){var n=yg.current;return yg.current=vg,n===null?vg:n}function Hw(){(Fn===0||Fn===3||Fn===2)&&(Fn=4),$n===null||!(fl&268435455)&&!(w0&268435455)||Ho($n,Qn)}function Sg(n,e){var t=Ot;Ot|=2;var i=OP();($n!==n||Qn!==e)&&(Js=null,tl(n,e));do try{zO();break}catch(r){DP(n,r)}while(!0);if(Ew(),Ot=t,yg.current=i,Pn!==null)throw Error(Oe(261));return $n=null,Qn=0,Fn}function zO(){for(;Pn!==null;)UP(Pn)}function BO(){for(;Pn!==null&&!dD();)UP(Pn)}function UP(n){var e=zP(n.alternate,n,rr);n.memoizedProps=n.pendingProps,e===null?FP(n):Pn=e,Fw.current=null}function FP(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=NO(t,e),t!==null){t.flags&=32767,Pn=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Fn=6,Pn=null;return}}else if(t=LO(t,e,rr),t!==null){Pn=t;return}if(e=e.sibling,e!==null){Pn=e;return}Pn=e=n}while(e!==null);Fn===0&&(Fn=5)}function Fa(n,e,t){var i=jt,r=Lr.transition;try{Lr.transition=null,jt=1,VO(n,e,t,i)}finally{Lr.transition=r,jt=i}return null}function VO(n,e,t,i){do Hc();while(Xo!==null);if(Ot&6)throw Error(Oe(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(Oe(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(SD(n,s),n===$n&&(Pn=$n=null,Qn=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||pp||(pp=!0,BP(ng,function(){return Hc(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=Lr.transition,Lr.transition=null;var o=jt;jt=1;var a=Ot;Ot|=4,Fw.current=null,OO(n,t),IP(t,n),aO(xx),rg=!!_x,xx=_x=null,n.current=t,UO(t),fD(),Ot=a,jt=o,Lr.transition=s}else n.current=t;if(pp&&(pp=!1,Xo=n,xg=r),s=n.pendingLanes,s===0&&(Qo=null),mD(t.stateNode),Gi(n,wn()),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(_g)throw _g=!1,n=Bx,Bx=null,n;return xg&1&&n.tag!==0&&Hc(),s=n.pendingLanes,s&1?n===Vx?Dd++:(Dd=0,Vx=n):Dd=0,ua(),null}function Hc(){if(Xo!==null){var n=vR(xg),e=Lr.transition,t=jt;try{if(Lr.transition=null,jt=16>n?16:n,Xo===null)var i=!1;else{if(n=Xo,Xo=null,xg=0,Ot&6)throw Error(Oe(331));var r=Ot;for(Ot|=4,Ye=n.current;Ye!==null;){var s=Ye,o=s.child;if(Ye.flags&16){var a=s.deletions;if(a!==null){for(var u=0;u<a.length;u++){var d=a[u];for(Ye=d;Ye!==null;){var f=Ye;switch(f.tag){case 0:case 11:case 15:Ld(8,f,s)}var h=f.child;if(h!==null)h.return=f,Ye=h;else for(;Ye!==null;){f=Ye;var p=f.sibling,g=f.return;if(CP(f),f===d){Ye=null;break}if(p!==null){p.return=g,Ye=p;break}Ye=g}}}var y=s.alternate;if(y!==null){var w=y.child;if(w!==null){y.child=null;do{var x=w.sibling;w.sibling=null,w=x}while(w!==null)}}Ye=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Ye=o;else e:for(;Ye!==null;){if(s=Ye,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Ld(9,s,s.return)}var v=s.sibling;if(v!==null){v.return=s.return,Ye=v;break e}Ye=s.return}}var _=n.current;for(Ye=_;Ye!==null;){o=Ye;var M=o.child;if(o.subtreeFlags&2064&&M!==null)M.return=o,Ye=M;else e:for(o=_;Ye!==null;){if(a=Ye,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:S0(9,a)}}catch(N){vn(a,a.return,N)}if(a===o){Ye=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,Ye=b;break e}Ye=a.return}}if(Ot=r,ua(),Rs&&typeof Rs.onPostCommitFiberRoot=="function")try{Rs.onPostCommitFiberRoot(h0,n)}catch{}i=!0}return i}finally{jt=t,Lr.transition=e}}return!1}function Gb(n,e,t){e=eu(t,e),e=vP(n,e,1),n=Ko(n,e,1),e=Ri(),n!==null&&(Ff(n,1,e),Gi(n,e))}function vn(n,e,t){if(n.tag===3)Gb(n,n,t);else for(;e!==null;){if(e.tag===3){Gb(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Qo===null||!Qo.has(i))){n=eu(t,n),n=yP(e,n,1),e=Ko(e,n,1),n=Ri(),e!==null&&(Ff(e,1,n),Gi(e,n));break}}e=e.return}}function HO(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=Ri(),n.pingedLanes|=n.suspendedLanes&t,$n===n&&(Qn&t)===t&&(Fn===4||Fn===3&&(Qn&130023424)===Qn&&500>wn()-zw?tl(n,0):kw|=t),Gi(n,e)}function kP(n,e){e===0&&(n.mode&1?(e=rp,rp<<=1,!(rp&130023424)&&(rp=4194304)):e=1);var t=Ri();n=lo(n,e),n!==null&&(Ff(n,e,t),Gi(n,t))}function GO(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),kP(n,t)}function WO(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(Oe(314))}i!==null&&i.delete(e),kP(n,t)}var zP;zP=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Vi.current)zi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return zi=!1,IO(n,e,t);zi=!!(n.flags&131072)}else zi=!1,rn&&e.flags&1048576&&GR(e,dg,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Am(n,e),n=e.pendingProps;var r=Zc(e,yi.current);Vc(e,t),r=Lw(null,e,i,n,r,t);var s=Nw();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,Hi(i)?(s=!0,cg(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Tw(e),r.updater=x0,e.stateNode=r,r._reactInternals=e,Rx(e,i,n,t),e=Lx(null,e,i,!0,s,t)):(e.tag=0,rn&&s&&xw(e),Ai(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Am(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=XO(i),n=qr(i,n),r){case 0:e=Ix(null,e,i,n,t);break e;case 1:e=Nb(null,e,i,n,t);break e;case 11:e=Ib(null,e,i,n,t);break e;case 14:e=Lb(null,e,i,qr(i.type,n),t);break e}throw Error(Oe(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:qr(i,r),Ix(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:qr(i,r),Nb(n,e,i,r,t);case 3:e:{if(wP(e),n===null)throw Error(Oe(387));i=e.pendingProps,s=e.memoizedState,r=s.element,$R(n,e),pg(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=eu(Error(Oe(423)),e),e=Db(n,e,i,t,r);break e}else if(i!==r){r=eu(Error(Oe(424)),e),e=Db(n,e,i,t,r);break e}else for(or=Jo(e.stateNode.containerInfo.firstChild),lr=e,rn=!0,Jr=null,t=qR(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Jc(),i===r){e=co(n,e,t);break e}Ai(n,e,i,t)}e=e.child}return e;case 5:return ZR(e),n===null&&Ax(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,Sx(i,r)?o=null:s!==null&&Sx(i,s)&&(e.flags|=32),SP(n,e),Ai(n,e,o,t),e.child;case 6:return n===null&&Ax(e),null;case 13:return MP(n,e,t);case 4:return Cw(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Kc(e,null,i,t):Ai(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:qr(i,r),Ib(n,e,i,r,t);case 7:return Ai(n,e,e.pendingProps,t),e.child;case 8:return Ai(n,e,e.pendingProps.children,t),e.child;case 12:return Ai(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,$t(fg,i._currentValue),i._currentValue=o,s!==null)if(ss(s.value,o)){if(s.children===r.children&&!Vi.current){e=co(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 u=a.firstContext;u!==null;){if(u.context===i){if(s.tag===1){u=ro(-1,t&-t),u.tag=2;var d=s.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?u.next=u:(u.next=f.next,f.next=u),d.pending=u}}s.lanes|=t,u=s.alternate,u!==null&&(u.lanes|=t),Tx(s.return,t,e),a.lanes|=t;break}u=u.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(Oe(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),Tx(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}Ai(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Vc(e,t),r=Dr(r),i=i(r),e.flags|=1,Ai(n,e,i,t),e.child;case 14:return i=e.type,r=qr(i,e.pendingProps),r=qr(i.type,r),Lb(n,e,i,r,t);case 15:return _P(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:qr(i,r),Am(n,e),e.tag=1,Hi(i)?(n=!0,cg(e)):n=!1,Vc(e,t),gP(e,i,r),Rx(e,i,r,t),Lx(null,e,i,!0,n,t);case 19:return EP(n,e,t);case 22:return xP(n,e,t)}throw Error(Oe(156,e.tag))};function BP(n,e){return hR(n,e)}function jO(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 Rr(n,e,t,i){return new jO(n,e,t,i)}function Gw(n){return n=n.prototype,!(!n||!n.isReactComponent)}function XO(n){if(typeof n=="function")return Gw(n)?1:0;if(n!=null){if(n=n.$$typeof,n===lw)return 11;if(n===cw)return 14}return 2}function ta(n,e){var t=n.alternate;return t===null?(t=Rr(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 Rm(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Gw(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case _c:return nl(t.children,r,s,e);case aw:o=8,r|=8;break;case Q_:return n=Rr(12,t,e,r|2),n.elementType=Q_,n.lanes=s,n;case ex:return n=Rr(13,t,e,r),n.elementType=ex,n.lanes=s,n;case tx:return n=Rr(19,t,e,r),n.elementType=tx,n.lanes=s,n;case ZC:return M0(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case YC:o=10;break e;case $C:o=9;break e;case lw:o=11;break e;case cw:o=14;break e;case ko:o=16,i=null;break e}throw Error(Oe(130,n==null?n:typeof n,""))}return e=Rr(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function nl(n,e,t,i){return n=Rr(7,n,i,e),n.lanes=t,n}function M0(n,e,t,i){return n=Rr(22,n,i,e),n.elementType=ZC,n.lanes=t,n.stateNode={isHidden:!1},n}function By(n,e,t){return n=Rr(6,n,null,e),n.lanes=t,n}function Vy(n,e,t){return e=Rr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function qO(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=Sy(0),this.expirationTimes=Sy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sy(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Ww(n,e,t,i,r,s,o,a,u){return n=new qO(n,e,t,a,u),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Rr(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tw(s),n}function YO(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yc,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function VP(n){if(!n)return sa;n=n._reactInternals;e:{if(xl(n)!==n||n.tag!==1)throw Error(Oe(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Hi(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Oe(171))}if(n.tag===1){var t=n.type;if(Hi(t))return VR(n,t,e)}return e}function HP(n,e,t,i,r,s,o,a,u){return n=Ww(t,i,!0,n,r,s,o,a,u),n.context=VP(null),t=n.current,i=Ri(),r=ea(t),s=ro(i,r),s.callback=e??null,Ko(t,s,r),n.current.lanes=r,Ff(n,r,i),Gi(n,i),n}function E0(n,e,t,i){var r=e.current,s=Ri(),o=ea(r);return t=VP(t),e.context===null?e.context=t:e.pendingContext=t,e=ro(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Ko(r,e,o),n!==null&&(is(n,r,o,s),Mm(n,r,o)),o}function wg(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 Wb(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function jw(n,e){Wb(n,e),(n=n.alternate)&&Wb(n,e)}function $O(){return null}var GP=typeof reportError=="function"?reportError:function(n){console.error(n)};function Xw(n){this._internalRoot=n}b0.prototype.render=Xw.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(Oe(409));E0(n,e,null,null)};b0.prototype.unmount=Xw.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;hl(function(){E0(null,n,null,null)}),e[ao]=null}};function b0(n){this._internalRoot=n}b0.prototype.unstable_scheduleHydration=function(n){if(n){var e=xR();n={blockedOn:null,target:n,priority:e};for(var t=0;t<Vo.length&&e!==0&&e<Vo[t].priority;t++);Vo.splice(t,0,n),t===0&&wR(n)}};function qw(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function A0(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function jb(){}function ZO(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var d=wg(o);s.call(d)}}var o=HP(e,i,n,0,null,!1,!1,"",jb);return n._reactRootContainer=o,n[ao]=o.current,Jd(n.nodeType===8?n.parentNode:n),hl(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var d=wg(u);a.call(d)}}var u=Ww(n,0,!1,null,null,!1,!1,"",jb);return n._reactRootContainer=u,n[ao]=u.current,Jd(n.nodeType===8?n.parentNode:n),hl(function(){E0(e,u,t,i)}),u}function T0(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var u=wg(o);a.call(u)}}E0(e,o,n,r)}else o=ZO(t,e,n,r,i);return wg(o)}yR=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=fd(e.pendingLanes);t!==0&&(fw(e,t|1),Gi(e,wn()),!(Ot&6)&&(tu=wn()+500,ua()))}break;case 13:hl(function(){var i=lo(n,1);if(i!==null){var r=Ri();is(i,n,1,r)}}),jw(n,1)}};hw=function(n){if(n.tag===13){var e=lo(n,134217728);if(e!==null){var t=Ri();is(e,n,134217728,t)}jw(n,134217728)}};_R=function(n){if(n.tag===13){var e=ea(n),t=lo(n,e);if(t!==null){var i=Ri();is(t,n,e,i)}jw(n,e)}};xR=function(){return jt};SR=function(n,e){var t=jt;try{return jt=n,e()}finally{jt=t}};dx=function(n,e,t){switch(e){case"input":if(rx(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=v0(i);if(!r)throw Error(Oe(90));KC(i),rx(i,r)}}}break;case"textarea":eR(n,t);break;case"select":e=t.value,e!=null&&Fc(n,!!t.multiple,e,!1)}};aR=Bw;lR=hl;var JO={usingClientEntryPoint:!1,Events:[zf,Mc,v0,sR,oR,Bw]},Xu={findFiberByHostInstance:Wa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},KO={bundleType:Xu.bundleType,version:Xu.version,rendererPackageName:Xu.rendererPackageName,rendererConfig:Xu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ho.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=dR(n),n===null?null:n.stateNode},findFiberByHostInstance:Xu.findFiberByHostInstance||$O,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mp.isDisabled&&mp.supportsFiber)try{h0=mp.inject(KO),Rs=mp}catch{}}hr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=JO;hr.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!qw(e))throw Error(Oe(200));return YO(n,e,null,t)};hr.createRoot=function(n,e){if(!qw(n))throw Error(Oe(299));var t=!1,i="",r=GP;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Ww(n,1,!1,null,null,t,!1,i,r),n[ao]=e.current,Jd(n.nodeType===8?n.parentNode:n),new Xw(e)};hr.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(Oe(188)):(n=Object.keys(n).join(","),Error(Oe(268,n)));return n=dR(e),n=n===null?null:n.stateNode,n};hr.flushSync=function(n){return hl(n)};hr.hydrate=function(n,e,t){if(!A0(e))throw Error(Oe(200));return T0(null,n,e,!0,t)};hr.hydrateRoot=function(n,e,t){if(!qw(n))throw Error(Oe(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=GP;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=HP(e,null,n,1,t??null,r,!1,s,o),n[ao]=e.current,Jd(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 b0(e)};hr.render=function(n,e,t){if(!A0(e))throw Error(Oe(200));return T0(null,n,e,!1,t)};hr.unmountComponentAtNode=function(n){if(!A0(n))throw Error(Oe(40));return n._reactRootContainer?(hl(function(){T0(null,null,n,!1,function(){n._reactRootContainer=null,n[ao]=null})}),!0):!1};hr.unstable_batchedUpdates=Bw;hr.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!A0(t))throw Error(Oe(200));if(n==null||n._reactInternals===void 0)throw Error(Oe(38));return T0(n,e,t,!1,i)};hr.version="18.3.1-next-f1338f8080-20240426";function WP(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(WP)}catch(n){console.error(n)}}WP(),WC.exports=hr;var jP=WC.exports;const QO=LC(jP);var Xb=jP;J_.createRoot=Xb.createRoot,J_.hydrateRoot=Xb.hydrateRoot;var eU=n=>{switch(n){case"success":return iU;case"info":return sU;case"warning":return rU;case"error":return oU;default:return null}},tU=Array(12).fill(0),nU=({visible:n})=>Me.createElement("div",{className:"sonner-loading-wrapper","data-visible":n},Me.createElement("div",{className:"sonner-spinner"},tU.map((e,t)=>Me.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),iU=Me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Me.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),rU=Me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Me.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),sU=Me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Me.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),oU=Me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Me.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),aU=()=>{let[n,e]=Me.useState(document.hidden);return Me.useEffect(()=>{let t=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),n},Wx=1,lU=class{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{let e=this.subscribers.indexOf(n);this.subscribers.splice(e,1)}),this.publish=n=>{this.subscribers.forEach(e=>e(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var e;let{message:t,...i}=n,r=typeof(n==null?void 0:n.id)=="number"||((e=n.id)==null?void 0:e.length)>0?n.id:Wx++,s=this.toasts.find(a=>a.id===r),o=n.dismissible===void 0?!0:n.dismissible;return s?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...n,id:r,title:t}),{...a,...n,id:r,dismissible:o,title:t}):a):this.addToast({title:t,...i,dismissible:o,id:r}),r},this.dismiss=n=>(n||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:n,dismiss:!0})),n),this.message=(n,e)=>this.create({...e,message:n}),this.error=(n,e)=>this.create({...e,message:n,type:"error"}),this.success=(n,e)=>this.create({...e,type:"success",message:n}),this.info=(n,e)=>this.create({...e,type:"info",message:n}),this.warning=(n,e)=>this.create({...e,type:"warning",message:n}),this.loading=(n,e)=>this.create({...e,type:"loading",message:n}),this.promise=(n,e)=>{if(!e)return;let t;e.loading!==void 0&&(t=this.create({...e,promise:n,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let i=n instanceof Promise?n:n(),r=t!==void 0;return i.then(async s=>{if(uU(s)&&!s.ok){r=!1;let o=typeof e.error=="function"?await e.error(`HTTP error! status: ${s.status}`):e.error,a=typeof e.description=="function"?await e.description(`HTTP error! status: ${s.status}`):e.description;this.create({id:t,type:"error",message:o,description:a})}else if(e.success!==void 0){r=!1;let o=typeof e.success=="function"?await e.success(s):e.success,a=typeof e.description=="function"?await e.description(s):e.description;this.create({id:t,type:"success",message:o,description:a})}}).catch(async s=>{if(e.error!==void 0){r=!1;let o=typeof e.error=="function"?await e.error(s):e.error,a=typeof e.description=="function"?await e.description(s):e.description;this.create({id:t,type:"error",message:o,description:a})}}).finally(()=>{var s;r&&(this.dismiss(t),t=void 0),(s=e.finally)==null||s.call(e)}),t},this.custom=(n,e)=>{let t=(e==null?void 0:e.id)||Wx++;return this.create({jsx:n(t),id:t,...e}),t},this.subscribers=[],this.toasts=[]}},tr=new lU,cU=(n,e)=>{let t=(e==null?void 0:e.id)||Wx++;return tr.addToast({title:n,...e,id:t}),t},uU=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",dU=cU,fU=()=>tr.toasts,nr=Object.assign(dU,{success:tr.success,info:tr.info,warning:tr.warning,error:tr.error,custom:tr.custom,message:tr.message,promise:tr.promise,dismiss:tr.dismiss,loading:tr.loading},{getHistory:fU});function hU(n,{insertAt:e}={}){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",e==="top"&&t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n))}hU(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
`);function gp(n){return n.label!==void 0}var pU=3,mU="32px",gU=4e3,vU=356,yU=14,_U=20,xU=200;function SU(...n){return n.filter(Boolean).join(" ")}var wU=n=>{var e,t,i,r,s,o,a,u,d,f;let{invert:h,toast:p,unstyled:g,interacting:y,setHeights:w,visibleToasts:x,heights:v,index:_,toasts:M,expanded:b,removeToast:N,defaultRichColors:C,closeButton:P,style:D,cancelButtonStyle:I,actionButtonStyle:A,className:U="",descriptionClassName:G="",duration:z,position:Z,gap:J,loadingIcon:ne,expandByDefault:le,classNames:O,icons:Y,closeButtonAriaLabel:K="Close toast",pauseWhenPageIsHidden:ae,cn:ge}=n,[Ue,se]=Me.useState(!1),[xe,Ae]=Me.useState(!1),[Ce,tt]=Me.useState(!1),[Qe,Q]=Me.useState(!1),[nt,pe]=Me.useState(0),[be,Se]=Me.useState(0),Fe=Me.useRef(null),Te=Me.useRef(null),He=_===0,V=_+1<=x,L=p.type,R=p.dismissible!==!1,X=p.className||"",q=p.descriptionClassName||"",$=Me.useMemo(()=>v.findIndex(j=>j.toastId===p.id)||0,[v,p.id]),ie=Me.useMemo(()=>{var j;return(j=p.closeButton)!=null?j:P},[p.closeButton,P]),Ne=Me.useMemo(()=>p.duration||z||gU,[p.duration,z]),Re=Me.useRef(0),Pe=Me.useRef(0),st=Me.useRef(0),De=Me.useRef(null),[qe,ct]=Z.split("-"),W=Me.useMemo(()=>v.reduce((j,ve,ce)=>ce>=$?j:j+ve.height,0),[v,$]),oe=aU(),Ie=p.invert||h,ze=L==="loading";Pe.current=Me.useMemo(()=>$*J+W,[$,W]),Me.useEffect(()=>{se(!0)},[]),Me.useLayoutEffect(()=>{if(!Ue)return;let j=Te.current,ve=j.style.height;j.style.height="auto";let ce=j.getBoundingClientRect().height;j.style.height=ve,Se(ce),w(Le=>Le.find(Be=>Be.toastId===p.id)?Le.map(Be=>Be.toastId===p.id?{...Be,height:ce}:Be):[{toastId:p.id,height:ce,position:p.position},...Le])},[Ue,p.title,p.description,w,p.id]);let ot=Me.useCallback(()=>{Ae(!0),pe(Pe.current),w(j=>j.filter(ve=>ve.toastId!==p.id)),setTimeout(()=>{N(p)},xU)},[p,N,w,Pe]);Me.useEffect(()=>{if(p.promise&&L==="loading"||p.duration===1/0||p.type==="loading")return;let j,ve=Ne;return b||y||ae&&oe?(()=>{if(st.current<Re.current){let ce=new Date().getTime()-Re.current;ve=ve-ce}st.current=new Date().getTime()})():ve!==1/0&&(Re.current=new Date().getTime(),j=setTimeout(()=>{var ce;(ce=p.onAutoClose)==null||ce.call(p,p),ot()},ve)),()=>clearTimeout(j)},[b,y,le,p,Ne,ot,p.promise,L,ae,oe]),Me.useEffect(()=>{let j=Te.current;if(j){let ve=j.getBoundingClientRect().height;return Se(ve),w(ce=>[{toastId:p.id,height:ve,position:p.position},...ce]),()=>w(ce=>ce.filter(Le=>Le.toastId!==p.id))}},[w,p.id]),Me.useEffect(()=>{p.delete&&ot()},[ot,p.delete]);function Ke(){return Y!=null&&Y.loading?Me.createElement("div",{className:"sonner-loader","data-visible":L==="loading"},Y.loading):ne?Me.createElement("div",{className:"sonner-loader","data-visible":L==="loading"},ne):Me.createElement(nU,{visible:L==="loading"})}return Me.createElement("li",{"aria-live":p.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Te,className:ge(U,X,O==null?void 0:O.toast,(e=p==null?void 0:p.classNames)==null?void 0:e.toast,O==null?void 0:O.default,O==null?void 0:O[L],(t=p==null?void 0:p.classNames)==null?void 0:t[L]),"data-sonner-toast":"","data-rich-colors":(i=p.richColors)!=null?i:C,"data-styled":!(p.jsx||p.unstyled||g),"data-mounted":Ue,"data-promise":!!p.promise,"data-removed":xe,"data-visible":V,"data-y-position":qe,"data-x-position":ct,"data-index":_,"data-front":He,"data-swiping":Ce,"data-dismissible":R,"data-type":L,"data-invert":Ie,"data-swipe-out":Qe,"data-expanded":!!(b||le&&Ue),style:{"--index":_,"--toasts-before":_,"--z-index":M.length-_,"--offset":`${xe?nt:Pe.current}px`,"--initial-height":le?"auto":`${be}px`,...D,...p.style},onPointerDown:j=>{ze||!R||(Fe.current=new Date,pe(Pe.current),j.target.setPointerCapture(j.pointerId),j.target.tagName!=="BUTTON"&&(tt(!0),De.current={x:j.clientX,y:j.clientY}))},onPointerUp:()=>{var j,ve,ce,Le;if(Qe||!R)return;De.current=null;let Be=Number(((j=Te.current)==null?void 0:j.style.getPropertyValue("--swipe-amount").replace("px",""))||0),wt=new Date().getTime()-((ve=Fe.current)==null?void 0:ve.getTime()),Ht=Math.abs(Be)/wt;if(Math.abs(Be)>=_U||Ht>.11){pe(Pe.current),(ce=p.onDismiss)==null||ce.call(p,p),ot(),Q(!0);return}(Le=Te.current)==null||Le.style.setProperty("--swipe-amount","0px"),tt(!1)},onPointerMove:j=>{var ve;if(!De.current||!R)return;let ce=j.clientY-De.current.y,Le=j.clientX-De.current.x,Be=(qe==="top"?Math.min:Math.max)(0,ce),wt=j.pointerType==="touch"?10:2;Math.abs(Be)>wt?(ve=Te.current)==null||ve.style.setProperty("--swipe-amount",`${ce}px`):Math.abs(Le)>wt&&(De.current=null)}},ie&&!p.jsx?Me.createElement("button",{"aria-label":K,"data-disabled":ze,"data-close-button":!0,onClick:ze||!R?()=>{}:()=>{var j;ot(),(j=p.onDismiss)==null||j.call(p,p)},className:ge(O==null?void 0:O.closeButton,(r=p==null?void 0:p.classNames)==null?void 0:r.closeButton)},Me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Me.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Me.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,p.jsx||Me.isValidElement(p.title)?p.jsx||p.title:Me.createElement(Me.Fragment,null,L||p.icon||p.promise?Me.createElement("div",{"data-icon":"",className:ge(O==null?void 0:O.icon,(s=p==null?void 0:p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Ke():null,p.type!=="loading"?p.icon||(Y==null?void 0:Y[L])||eU(L):null):null,Me.createElement("div",{"data-content":"",className:ge(O==null?void 0:O.content,(o=p==null?void 0:p.classNames)==null?void 0:o.content)},Me.createElement("div",{"data-title":"",className:ge(O==null?void 0:O.title,(a=p==null?void 0:p.classNames)==null?void 0:a.title)},p.title),p.description?Me.createElement("div",{"data-description":"",className:ge(G,q,O==null?void 0:O.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},p.description):null),Me.isValidElement(p.cancel)?p.cancel:p.cancel&&gp(p.cancel)?Me.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||I,onClick:j=>{var ve,ce;gp(p.cancel)&&R&&((ce=(ve=p.cancel).onClick)==null||ce.call(ve,j),ot())},className:ge(O==null?void 0:O.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,Me.isValidElement(p.action)?p.action:p.action&&gp(p.action)?Me.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||A,onClick:j=>{var ve,ce;gp(p.action)&&(j.defaultPrevented||((ce=(ve=p.action).onClick)==null||ce.call(ve,j),ot()))},className:ge(O==null?void 0:O.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function qb(){if(typeof window>"u"||typeof document>"u")return"ltr";let n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}var MU=n=>{let{invert:e,position:t="bottom-right",hotkey:i=["altKey","KeyT"],expand:r,closeButton:s,className:o,offset:a,theme:u="light",richColors:d,duration:f,style:h,visibleToasts:p=pU,toastOptions:g,dir:y=qb(),gap:w=yU,loadingIcon:x,icons:v,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:M,cn:b=SU}=n,[N,C]=Me.useState([]),P=Me.useMemo(()=>Array.from(new Set([t].concat(N.filter(ae=>ae.position).map(ae=>ae.position)))),[N,t]),[D,I]=Me.useState([]),[A,U]=Me.useState(!1),[G,z]=Me.useState(!1),[Z,J]=Me.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ne=Me.useRef(null),le=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),O=Me.useRef(null),Y=Me.useRef(!1),K=Me.useCallback(ae=>{var ge;(ge=N.find(Ue=>Ue.id===ae.id))!=null&&ge.delete||tr.dismiss(ae.id),C(Ue=>Ue.filter(({id:se})=>se!==ae.id))},[N]);return Me.useEffect(()=>tr.subscribe(ae=>{if(ae.dismiss){C(ge=>ge.map(Ue=>Ue.id===ae.id?{...Ue,delete:!0}:Ue));return}setTimeout(()=>{QO.flushSync(()=>{C(ge=>{let Ue=ge.findIndex(se=>se.id===ae.id);return Ue!==-1?[...ge.slice(0,Ue),{...ge[Ue],...ae},...ge.slice(Ue+1)]:[ae,...ge]})})})}),[]),Me.useEffect(()=>{if(u!=="system"){J(u);return}u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?J("dark"):J("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:ae})=>{J(ae?"dark":"light")})},[u]),Me.useEffect(()=>{N.length<=1&&U(!1)},[N]),Me.useEffect(()=>{let ae=ge=>{var Ue,se;i.every(xe=>ge[xe]||ge.code===xe)&&(U(!0),(Ue=ne.current)==null||Ue.focus()),ge.code==="Escape"&&(document.activeElement===ne.current||(se=ne.current)!=null&&se.contains(document.activeElement))&&U(!1)};return document.addEventListener("keydown",ae),()=>document.removeEventListener("keydown",ae)},[i]),Me.useEffect(()=>{if(ne.current)return()=>{O.current&&(O.current.focus({preventScroll:!0}),O.current=null,Y.current=!1)}},[ne.current]),N.length?Me.createElement("section",{"aria-label":`${_} ${le}`,tabIndex:-1},P.map((ae,ge)=>{var Ue;let[se,xe]=ae.split("-");return Me.createElement("ol",{key:ae,dir:y==="auto"?qb():y,tabIndex:-1,ref:ne,className:o,"data-sonner-toaster":!0,"data-theme":Z,"data-y-position":se,"data-x-position":xe,style:{"--front-toast-height":`${((Ue=D[0])==null?void 0:Ue.height)||0}px`,"--offset":typeof a=="number"?`${a}px`:a||mU,"--width":`${vU}px`,"--gap":`${w}px`,...h},onBlur:Ae=>{Y.current&&!Ae.currentTarget.contains(Ae.relatedTarget)&&(Y.current=!1,O.current&&(O.current.focus({preventScroll:!0}),O.current=null))},onFocus:Ae=>{Ae.target instanceof HTMLElement&&Ae.target.dataset.dismissible==="false"||Y.current||(Y.current=!0,O.current=Ae.relatedTarget)},onMouseEnter:()=>U(!0),onMouseMove:()=>U(!0),onMouseLeave:()=>{G||U(!1)},onPointerDown:Ae=>{Ae.target instanceof HTMLElement&&Ae.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},N.filter(Ae=>!Ae.position&&ge===0||Ae.position===ae).map((Ae,Ce)=>{var tt,Qe;return Me.createElement(wU,{key:Ae.id,icons:v,index:Ce,toast:Ae,defaultRichColors:d,duration:(tt=g==null?void 0:g.duration)!=null?tt:f,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:e,visibleToasts:p,closeButton:(Qe=g==null?void 0:g.closeButton)!=null?Qe:s,interacting:G,position:ae,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:K,toasts:N.filter(Q=>Q.position==Ae.position),heights:D.filter(Q=>Q.position==Ae.position),setHeights:I,expandByDefault:r,gap:w,loadingIcon:x,expanded:A,pauseWhenPageIsHidden:M,cn:b})}))})):null};const hc="4.47.1";let Yb=!1,Od,XP,qP,jx,YP,$P,ZP,JP,KP;function EU(n,e={auto:!1}){if(Yb)throw new Error(`you must \`import 'openai/shims/${n.kind}'\` before importing anything else from openai`);if(Od)throw new Error(`can't \`import 'openai/shims/${n.kind}'\` after \`import 'openai/shims/${Od}'\``);Yb=e.auto,Od=n.kind,XP=n.fetch,qP=n.FormData,jx=n.File,YP=n.ReadableStream,$P=n.getMultipartRequestOptions,ZP=n.getDefaultAgent,JP=n.fileFromPath,KP=n.isFsReadStream}class bU{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}function AU({manuallyImported:n}={}){const e=n?"You may need to use polyfills":"Add one of these imports before your first `import … from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n";let t,i,r,s;try{t=fetch,i=Request,r=Response,s=Headers}catch(o){throw new Error(`this environment is missing the following Web Fetch API type: ${o.message}. ${e}`)}return{kind:"web",fetch:t,Request:i,Response:r,Headers:s,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(o,a)=>({...a,body:new bU(o)}),getDefaultAgent:o=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:o=>!1}}Od||EU(AU(),{auto:!0});class Nt extends Error{}class ni extends Nt{constructor(e,t,i,r){super(`${ni.makeMessage(e,t,i)}`),this.status=e,this.headers=r,this.request_id=r==null?void 0:r["x-request-id"];const s=t;this.error=s,this.code=s==null?void 0:s.code,this.param=s==null?void 0:s.param,this.type=s==null?void 0:s.type}static makeMessage(e,t,i){const r=t!=null&&t.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):i;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(e,t,i,r){if(!e)return new C0({cause:qx(t)});const s=t==null?void 0:t.error;return e===400?new QP(e,s,i,r):e===401?new e3(e,s,i,r):e===403?new t3(e,s,i,r):e===404?new n3(e,s,i,r):e===409?new i3(e,s,i,r):e===422?new r3(e,s,i,r):e===429?new s3(e,s,i,r):e>=500?new o3(e,s,i,r):new ni(e,s,i,r)}}class ar extends ni{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}}class C0 extends ni{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,t&&(this.cause=t)}}class Yw extends C0{constructor({message:e}={}){super({message:e??"Request timed out."})}}class QP extends ni{constructor(){super(...arguments),this.status=400}}class e3 extends ni{constructor(){super(...arguments),this.status=401}}class t3 extends ni{constructor(){super(...arguments),this.status=403}}class n3 extends ni{constructor(){super(...arguments),this.status=404}}class i3 extends ni{constructor(){super(...arguments),this.status=409}}class r3 extends ni{constructor(){super(...arguments),this.status=422}}class s3 extends ni{constructor(){super(...arguments),this.status=429}}class o3 extends ni{}class bs{constructor(e,t){this.iterator=e,this.controller=t}static fromSSEResponse(e,t){let i=!1;async function*r(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(const o of TU(e,t))if(!s){if(o.data.startsWith("[DONE]")){s=!0;continue}if(o.event===null){let a;try{a=JSON.parse(o.data)}catch(u){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),u}if(a&&a.error)throw new ni(void 0,a.error,void 0,void 0);yield a}else{let a;try{a=JSON.parse(o.data)}catch(u){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),u}if(o.event=="error")throw new ni(void 0,a.error,a.message,void 0);yield{event:o.event,data:a}}}s=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{s||t.abort()}}return new bs(r,t)}static fromReadableStream(e,t){let i=!1;async function*r(){const o=new pl,a=a3(e);for await(const u of a)for(const d of o.decode(u))yield d;for(const u of o.flush())yield u}async function*s(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let o=!1;try{for await(const a of r())o||a&&(yield JSON.parse(a));o=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{o||t.abort()}}return new bs(s,t)}[Symbol.asyncIterator](){return this.iterator()}tee(){const e=[],t=[],i=this.iterator(),r=s=>({next:()=>{if(s.length===0){const o=i.next();e.push(o),t.push(o)}return s.shift()}});return[new bs(()=>r(e),this.controller),new bs(()=>r(t),this.controller)]}toReadableStream(){const e=this;let t;const i=new TextEncoder;return new YP({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{const{value:s,done:o}=await t.next();if(o)return r.close();const a=i.encode(JSON.stringify(s)+`
`);r.enqueue(a)}catch(s){r.error(s)}},async cancel(){var r;await((r=t.return)==null?void 0:r.call(t))}})}}async function*TU(n,e){if(!n.body)throw e.abort(),new Nt("Attempted to iterate over a response with no body");const t=new PU,i=new pl,r=a3(n.body);for await(const s of CU(r))for(const o of i.decode(s)){const a=t.decode(o);a&&(yield a)}for(const s of i.flush()){const o=t.decode(s);o&&(yield o)}}async function*CU(n){let e=new Uint8Array;for await(const t of n){if(t==null)continue;const i=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?new TextEncoder().encode(t):t;let r=new Uint8Array(e.length+i.length);r.set(e),r.set(i,e.length),e=r;let s;for(;(s=RU(e))!==-1;)yield e.slice(0,s),e=e.slice(s)}e.length>0&&(yield e)}function RU(n){for(let i=0;i<n.length-2;i++){if(n[i]===10&&n[i+1]===10||n[i]===13&&n[i+1]===13)return i+2;if(n[i]===13&&n[i+1]===10&&i+3<n.length&&n[i+2]===13&&n[i+3]===10)return i+4}return-1}class PU{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;const s={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,i,r]=IU(e,":");return r.startsWith(" ")&&(r=r.substring(1)),t==="event"?this.event=r:t==="data"&&this.data.push(r),null}}class pl{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let t=this.decodeText(e);if(this.trailingCR&&(t="\r"+t,this.trailingCR=!1),t.endsWith("\r")&&(this.trailingCR=!0,t=t.slice(0,-1)),!t)return[];const i=pl.NEWLINE_CHARS.has(t[t.length-1]||"");let r=t.split(pl.NEWLINE_REGEXP);return i&&r.pop(),r.length===1&&!i?(this.buffer.push(r[0]),[]):(this.buffer.length>0&&(r=[this.buffer.join("")+r[0],...r.slice(1)],this.buffer=[]),i||(this.buffer=[r.pop()||""]),r)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Nt(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new Nt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Nt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];const e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}}pl.NEWLINE_CHARS=new Set([`
`,"\r"]);pl.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function IU(n,e){const t=n.indexOf(e);return t!==-1?[n.substring(0,t),e,n.substring(t+e.length)]:[n,"",""]}function a3(n){if(n[Symbol.asyncIterator])return n;const e=n.getReader();return{async next(){try{const t=await e.read();return t!=null&&t.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){const t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}const l3=n=>n!=null&&typeof n=="object"&&typeof n.url=="string"&&typeof n.blob=="function",c3=n=>n!=null&&typeof n=="object"&&typeof n.name=="string"&&typeof n.lastModified=="number"&&u3(n),u3=n=>n!=null&&typeof n=="object"&&typeof n.size=="number"&&typeof n.type=="string"&&typeof n.text=="function"&&typeof n.slice=="function"&&typeof n.arrayBuffer=="function",LU=n=>c3(n)||l3(n)||KP(n);async function d3(n,e,t){var r;if(n=await n,t??(t=c3(n)?{lastModified:n.lastModified,type:n.type}:{}),l3(n)){const s=await n.blob();return e||(e=new URL(n.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new jx([s],e,t)}const i=await NU(n);if(e||(e=OU(n)??"unknown_file"),!t.type){const s=(r=i[0])==null?void 0:r.type;typeof s=="string"&&(t={...t,type:s})}return new jx(i,e,t)}async function NU(n){var t;let e=[];if(typeof n=="string"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer)e.push(n);else if(u3(n))e.push(await n.arrayBuffer());else if(UU(n))for await(const i of n)e.push(i);else throw new Error(`Unexpected data type: ${typeof n}; constructor: ${(t=n==null?void 0:n.constructor)==null?void 0:t.name}; props: ${DU(n)}`);return e}function DU(n){return`[${Object.getOwnPropertyNames(n).map(t=>`"${t}"`).join(", ")}]`}function OU(n){var e;return Hy(n.name)||Hy(n.filename)||((e=Hy(n.path))==null?void 0:e.split(/[\\/]/).pop())}const Hy=n=>{if(typeof n=="string")return n;if(typeof Buffer<"u"&&n instanceof Buffer)return String(n)},UU=n=>n!=null&&typeof n=="object"&&typeof n[Symbol.asyncIterator]=="function",$b=n=>n&&typeof n=="object"&&n.body&&n[Symbol.toStringTag]==="MultipartBody",af=async n=>{const e=await FU(n.body);return $P(e,n)},FU=async n=>{const e=new qP;return await Promise.all(Object.entries(n||{}).map(([t,i])=>Xx(e,t,i))),e},Xx=async(n,e,t)=>{if(t!==void 0){if(t==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")n.append(e,String(t));else if(LU(t)){const i=await d3(t);n.append(e,i)}else if(Array.isArray(t))await Promise.all(t.map(i=>Xx(n,e+"[]",i)));else if(typeof t=="object")await Promise.all(Object.entries(t).map(([i,r])=>Xx(n,`${e}[${i}]`,r)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)}};var Gc={},kU=function(n,e,t,i,r){if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t},zU=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},vp;async function f3(n){const{response:e}=n;if(n.options.stream)return Wc("response",e.status,e.url,e.headers,e.body),n.options.__streamClass?n.options.__streamClass.fromSSEResponse(e,n.controller):bs.fromSSEResponse(e,n.controller);if(e.status===204)return null;if(n.options.__binaryResponse)return e;const t=e.headers.get("content-type");if((t==null?void 0:t.includes("application/json"))||(t==null?void 0:t.includes("application/vnd.api+json"))){const s=await e.json();return Wc("response",e.status,e.url,e.headers,s),s}const r=await e.text();return Wc("response",e.status,e.url,e.headers,r),r}class R0 extends Promise{constructor(e,t=f3){super(i=>{i(null)}),this.responsePromise=e,this.parseResponse=t}_thenUnwrap(e){return new R0(this.responsePromise,async t=>e(await this.parseResponse(t)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}class BU{constructor({baseURL:e,maxRetries:t=2,timeout:i=6e5,httpAgent:r,fetch:s}){this.baseURL=e,this.maxRetries=Gy("maxRetries",t),this.timeout=Gy("timeout",i),this.httpAgent=r,this.fetch=s??XP}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...XU(),...this.authHeaders(e)}}validateHeaders(e,t){}defaultIdempotencyKey(){return`stainless-node-retry-${ZU()}`}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,i){return this.request(Promise.resolve(i).then(r=>({method:e,path:t,...r})))}getAPIList(e,t,i){return this.requestAPIList(t,{method:"get",path:e,...i})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}return null}buildRequest(e){var y;const{method:t,path:i,query:r,headers:s={}}=e,o=$b(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,a=this.calculateContentLength(o),u=this.buildURL(i,r);"timeout"in e&&Gy("timeout",e.timeout);const d=e.timeout??this.timeout,f=e.httpAgent??this.httpAgent??ZP(u),h=d+1e3;typeof((y=f==null?void 0:f.options)==null?void 0:y.timeout)=="number"&&h>(f.options.timeout??0)&&(f.options.timeout=h),this.idempotencyHeader&&t!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);const p=this.buildHeaders({options:e,headers:s,contentLength:a});return{req:{method:t,...o&&{body:o},headers:p,...f&&{agent:f},signal:e.signal??null},url:u,timeout:d}}buildHeaders({options:e,headers:t,contentLength:i}){const r={};i&&(r["content-length"]=i);const s=this.defaultHeaders(e);return Qb(r,s),Qb(r,t),$b(e.body)&&Od!=="node"&&delete r["content-type"],this.validateHeaders(r,t),r}async prepareOptions(e){}async prepareRequest(e,{url:t,options:i}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(t=>[...t])):{...e}:{}}makeStatusError(e,t,i,r){return ni.generate(e,t,i,r)}request(e,t=null){return new R0(this.makeRequest(e,t))}async makeRequest(e,t){var f,h;const i=await e;t==null&&(t=i.maxRetries??this.maxRetries),await this.prepareOptions(i);const{req:r,url:s,timeout:o}=this.buildRequest(i);if(await this.prepareRequest(r,{url:s,options:i}),Wc("request",s,i,r.headers),(f=i.signal)!=null&&f.aborted)throw new ar;const a=new AbortController,u=await this.fetchWithTimeout(s,r,o,a).catch(qx);if(u instanceof Error){if((h=i.signal)!=null&&h.aborted)throw new ar;if(t)return this.retryRequest(i,t);throw u.name==="AbortError"?new Yw:new C0({cause:u})}const d=HU(u.headers);if(!u.ok){if(t&&this.shouldRetry(u)){const v=`retrying, ${t} attempts remaining`;return Wc(`response (error; ${v})`,u.status,s,d),this.retryRequest(i,t,d)}const p=await u.text().catch(v=>qx(v).message),g=qU(p),y=g?void 0:p;throw Wc(`response (error; ${t?"(error; no more retries left)":"(error; not retryable)"})`,u.status,s,d,y),this.makeStatusError(u.status,g,y,d)}return{response:u,options:i,controller:a}}requestAPIList(e,t){const i=this.makeRequest(t,null);return new VU(this,i,e)}buildURL(e,t){const i=$U(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),r=this.defaultQuery();return p3(r)||(t={...r,...t}),typeof t=="object"&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}stringifyQuery(e){return Object.entries(e).filter(([t,i])=>typeof i<"u").map(([t,i])=>{if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(i)}`;if(i===null)return`${encodeURIComponent(t)}=`;throw new Nt(`Cannot stringify type ${typeof i}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,t,i,r){const{signal:s,...o}=t||{};s&&s.addEventListener("abort",()=>r.abort());const a=setTimeout(()=>r.abort(),i);return this.getRequestClient().fetch.call(void 0,e,{signal:r.signal,...o}).finally(()=>{clearTimeout(a)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(e){const t=e.headers.get("x-should-retry");return t==="true"?!0:t==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,i){let r;const s=i==null?void 0:i["retry-after-ms"];if(s){const a=parseFloat(s);Number.isNaN(a)||(r=a)}const o=i==null?void 0:i["retry-after"];if(o&&!r){const a=parseFloat(o);Number.isNaN(a)?r=Date.parse(o)-Date.now():r=a*1e3}if(!(r&&0<=r&&r<60*1e3)){const a=e.maxRetries??this.maxRetries;r=this.calculateDefaultRetryTimeoutMillis(t,a)}return await Vf(r),this.makeRequest(e,t-1)}calculateDefaultRetryTimeoutMillis(e,t){const s=t-e,o=Math.min(.5*Math.pow(2,s),8),a=1-Math.random()*.25;return o*a*1e3}getUserAgent(){return`${this.constructor.name}/JS ${hc}`}}class h3{constructor(e,t,i,r){vp.set(this,void 0),kU(this,vp,e),this.options=r,this.response=t,this.body=i}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){const e=this.nextPageInfo();if(!e)throw new Nt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");const t={...this.options};if("params"in e&&typeof t.query=="object")t.query={...t.query,...e.params};else if("url"in e){const i=[...Object.entries(t.query||{}),...e.url.searchParams.entries()];for(const[r,s]of i)e.url.searchParams.set(r,s);t.query=void 0,t.path=e.url.toString()}return await zU(this,vp,"f").requestAPIList(this.constructor,t)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(vp=new WeakMap,Symbol.asyncIterator)](){for await(const e of this.iterPages())for(const t of e.getPaginatedItems())yield t}}class VU extends R0{constructor(e,t,i){super(t,async r=>new i(e,r.response,await f3(r),r.options))}async*[Symbol.asyncIterator](){const e=await this;for await(const t of e)yield t}}const HU=n=>new Proxy(Object.fromEntries(n.entries()),{get(e,t){const i=t.toString();return e[i.toLowerCase()]||e[i]}}),GU={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryResponse:!0,__streamClass:!0},dr=n=>typeof n=="object"&&n!==null&&!p3(n)&&Object.keys(n).every(e=>m3(GU,e)),WU=()=>{var e;if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jb(Deno.build.os),"X-Stainless-Arch":Zb(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:((e=Deno.version)==null?void 0:e.deno)??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jb(process.platform),"X-Stainless-Arch":Zb(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};const n=jU();return n?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${n.browser}`,"X-Stainless-Runtime-Version":n.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function jU(){if(typeof navigator>"u"||!navigator)return null;const n=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:e,pattern:t}of n){const i=t.exec(navigator.userAgent);if(i){const r=i[1]||0,s=i[2]||0,o=i[3]||0;return{browser:e,version:`${r}.${s}.${o}`}}}return null}const Zb=n=>n==="x32"?"x32":n==="x86_64"||n==="x64"?"x64":n==="arm"?"arm":n==="aarch64"||n==="arm64"?"arm64":n?`other:${n}`:"unknown",Jb=n=>(n=n.toLowerCase(),n.includes("ios")?"iOS":n==="android"?"Android":n==="darwin"?"MacOS":n==="win32"?"Windows":n==="freebsd"?"FreeBSD":n==="openbsd"?"OpenBSD":n==="linux"?"Linux":n?`Other:${n}`:"Unknown");let Kb;const XU=()=>Kb??(Kb=WU()),qU=n=>{try{return JSON.parse(n)}catch{return}},YU=new RegExp("^(?:[a-z]+:)?//","i"),$U=n=>YU.test(n),Vf=n=>new Promise(e=>setTimeout(e,n)),Gy=(n,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Nt(`${n} must be an integer`);if(e<0)throw new Nt(`${n} must be a positive integer`);return e},qx=n=>n instanceof Error?n:new Error(n),yp=n=>{var e,t,i,r;if(typeof process<"u")return((e=Gc==null?void 0:Gc[n])==null?void 0:e.trim())??void 0;if(typeof Deno<"u")return(r=(i=(t=Deno.env)==null?void 0:t.get)==null?void 0:i.call(t,n))==null?void 0:r.trim()};function p3(n){if(!n)return!0;for(const e in n)return!1;return!0}function m3(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Qb(n,e){for(const t in e){if(!m3(e,t))continue;const i=t.toLowerCase();if(!i)continue;const r=e[t];r===null?delete n[i]:r!==void 0&&(n[i]=r)}}function Wc(n,...e){typeof process<"u"&&(Gc==null?void 0:Gc.DEBUG)==="true"&&console.log(`OpenAI:DEBUG:${n}`,...e)}const ZU=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),JU=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function eA(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)}class $w extends h3{constructor(e,t,i,r){super(e,t,i,r),this.data=i.data||[],this.object=i.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}}class cs extends h3{constructor(e,t,i,r){super(e,t,i,r),this.data=i.data||[]}getPaginatedItems(){return this.data??[]}nextPageParams(){const e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;const t=Object.fromEntries(e.url.searchParams);return Object.keys(t).length?t:null}nextPageInfo(){var i;const e=this.getPaginatedItems();if(!e.length)return null;const t=(i=e[e.length-1])==null?void 0:i.id;return t?{params:{after:t}}:null}}class qt{constructor(e){this._client=e}}let Mg=class extends qt{create(e,t){return this._client.post("/chat/completions",{body:e,...t,stream:e.stream??!1})}};Mg||(Mg={});let Eg=class extends qt{constructor(){super(...arguments),this.completions=new Mg(this._client)}};(function(n){n.Completions=Mg})(Eg||(Eg={}));class bg extends qt{create(e,t){return this._client.post("/audio/speech",{body:e,...t,__binaryResponse:!0})}}bg||(bg={});class Ag extends qt{create(e,t){return this._client.post("/audio/transcriptions",af({body:e,...t}))}}Ag||(Ag={});class Tg extends qt{create(e,t){return this._client.post("/audio/translations",af({body:e,...t}))}}Tg||(Tg={});let Cg=class extends qt{constructor(){super(...arguments),this.transcriptions=new Ag(this._client),this.translations=new Tg(this._client),this.speech=new bg(this._client)}};(function(n){n.Transcriptions=Ag,n.Translations=Tg,n.Speech=bg})(Cg||(Cg={}));class Rg extends qt{create(e,t){return this._client.post("/batches",{body:e,...t})}retrieve(e,t){return this._client.get(`/batches/${e}`,t)}list(e={},t){return dr(e)?this.list({},e):this._client.getAPIList("/batches",Zw,{query:e,...t})}cancel(e,t){return this._client.post(`/batches/${e}/cancel`,t)}}class Zw extends cs{}(function(n){n.BatchesPage=Zw})(Rg||(Rg={}));class Pg extends qt{create(e,t){return this._client.post("/assistants",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}retrieve(e,t){return this._client.get(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}update(e,t,i){return this._client.post(`/assistants/${e}`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}list(e={},t){return dr(e)?this.list({},e):this._client.getAPIList("/assistants",Jw,{query:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}del(e,t){return this._client.delete(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}}class Jw extends cs{}(function(n){n.AssistantsPage=Jw})(Pg||(Pg={}));function tA(n){return typeof n.parse=="function"}const jc=n=>(n==null?void 0:n.role)==="assistant",g3=n=>(n==null?void 0:n.role)==="function",v3=n=>(n==null?void 0:n.role)==="tool";var Vr=function(n,e,t,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(n,t):r?r.value=t:e.set(n,t),t},Pt=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},pi,Pm,Im,pd,md,Lm,gd,$s,vd,Nm,Dm,pc,Yx,Ig,$x,Zx,Jx,Kx,y3,Qx;const nA=10;class _3{constructor(){pi.add(this),this.controller=new AbortController,Pm.set(this,void 0),Im.set(this,()=>{}),pd.set(this,()=>{}),md.set(this,void 0),Lm.set(this,()=>{}),gd.set(this,()=>{}),$s.set(this,{}),this._chatCompletions=[],this.messages=[],vd.set(this,!1),Nm.set(this,!1),Dm.set(this,!1),pc.set(this,!1),Kx.set(this,e=>{if(Vr(this,Nm,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ar),e instanceof ar)return Vr(this,Dm,!0,"f"),this._emit("abort",e);if(e instanceof Nt)return this._emit("error",e);if(e instanceof Error){const t=new Nt(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new Nt(String(e)))}),Vr(this,Pm,new Promise((e,t)=>{Vr(this,Im,e,"f"),Vr(this,pd,t,"f")}),"f"),Vr(this,md,new Promise((e,t)=>{Vr(this,Lm,e,"f"),Vr(this,gd,t,"f")}),"f"),Pt(this,Pm,"f").catch(()=>{}),Pt(this,md,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Pt(this,Kx,"f"))},0)}_addChatCompletion(e){var i;this._chatCompletions.push(e),this._emit("chatCompletion",e);const t=(i=e.choices[0])==null?void 0:i.message;return t&&this._addMessage(t),e}_addMessage(e,t=!0){if("content"in e||(e.content=null),this.messages.push(e),t){if(this._emit("message",e),(g3(e)||v3(e))&&e.content)this._emit("functionCallResult",e.content);else if(jc(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(jc(e)&&e.tool_calls)for(const i of e.tool_calls)i.type==="function"&&this._emit("functionCall",i.function)}}_connected(){this.ended||(Pt(this,Im,"f").call(this),this._emit("connect"))}get ended(){return Pt(this,vd,"f")}get errored(){return Pt(this,Nm,"f")}get aborted(){return Pt(this,Dm,"f")}abort(){this.controller.abort()}on(e,t){return(Pt(this,$s,"f")[e]||(Pt(this,$s,"f")[e]=[])).push({listener:t}),this}off(e,t){const i=Pt(this,$s,"f")[e];if(!i)return this;const r=i.findIndex(s=>s.listener===t);return r>=0&&i.splice(r,1),this}once(e,t){return(Pt(this,$s,"f")[e]||(Pt(this,$s,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{Vr(this,pc,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,t)})}async done(){Vr(this,pc,!0,"f"),await Pt(this,md,"f")}async finalChatCompletion(){await this.done();const e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new Nt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Pt(this,pi,"m",Yx).call(this)}async finalMessage(){return await this.done(),Pt(this,pi,"m",Ig).call(this)}async finalFunctionCall(){return await this.done(),Pt(this,pi,"m",$x).call(this)}async finalFunctionCallResult(){return await this.done(),Pt(this,pi,"m",Zx).call(this)}async totalUsage(){return await this.done(),Pt(this,pi,"m",Jx).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emit(e,...t){if(Pt(this,vd,"f"))return;e==="end"&&(Vr(this,vd,!0,"f"),Pt(this,Lm,"f").call(this));const i=Pt(this,$s,"f")[e];if(i&&(Pt(this,$s,"f")[e]=i.filter(r=>!r.once),i.forEach(({listener:r})=>r(...t))),e==="abort"){const r=t[0];!Pt(this,pc,"f")&&!(i!=null&&i.length)&&Promise.reject(r),Pt(this,pd,"f").call(this,r),Pt(this,gd,"f").call(this,r),this._emit("end");return}if(e==="error"){const r=t[0];!Pt(this,pc,"f")&&!(i!=null&&i.length)&&Promise.reject(r),Pt(this,pd,"f").call(this,r),Pt(this,gd,"f").call(this,r),this._emit("end")}}_emitFinal(){const e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);const t=Pt(this,pi,"m",Ig).call(this);t&&this._emit("finalMessage",t);const i=Pt(this,pi,"m",Yx).call(this);i&&this._emit("finalContent",i);const r=Pt(this,pi,"m",$x).call(this);r&&this._emit("finalFunctionCall",r);const s=Pt(this,pi,"m",Zx).call(this);s!=null&&this._emit("finalFunctionCallResult",s),this._chatCompletions.some(o=>o.usage)&&this._emit("totalUsage",Pt(this,pi,"m",Jx).call(this))}async _createChatCompletion(e,t,i){const r=i==null?void 0:i.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),Pt(this,pi,"m",y3).call(this,t);const s=await e.create({...t,stream:!1},{...i,signal:this.controller.signal});return this._connected(),this._addChatCompletion(s)}async _runChatCompletion(e,t,i){for(const r of t.messages)this._addMessage(r,!1);return await this._createChatCompletion(e,t,i)}async _runFunctions(e,t,i){var p;const r="function",{function_call:s="auto",stream:o,...a}=t,u=typeof s!="string"&&(s==null?void 0:s.name),{maxChatCompletions:d=nA}=i||{},f={};for(const g of t.functions)f[g.name||g.function.name]=g;const h=t.functions.map(g=>({name:g.name||g.function.name,parameters:g.parameters,description:g.description}));for(const g of t.messages)this._addMessage(g,!1);for(let g=0;g<d;++g){const w=(p=(await this._createChatCompletion(e,{...a,function_call:s,functions:h,messages:[...this.messages]},i)).choices[0])==null?void 0:p.message;if(!w)throw new Nt("missing message in ChatCompletion response");if(!w.function_call)return;const{name:x,arguments:v}=w.function_call,_=f[x];if(_){if(u&&u!==x){const C=`Invalid function_call: ${JSON.stringify(x)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:r,name:x,content:C});continue}}else{const C=`Invalid function_call: ${JSON.stringify(x)}. Available options are: ${h.map(P=>JSON.stringify(P.name)).join(", ")}. Please try again`;this._addMessage({role:r,name:x,content:C});continue}let M;try{M=tA(_)?await _.parse(v):v}catch(C){this._addMessage({role:r,name:x,content:C instanceof Error?C.message:String(C)});continue}const b=await _.function(M,this),N=Pt(this,pi,"m",Qx).call(this,b);if(this._addMessage({role:r,name:x,content:N}),u)return}}async _runTools(e,t,i){var p,g;const r="tool",{tool_choice:s="auto",stream:o,...a}=t,u=typeof s!="string"&&((p=s==null?void 0:s.function)==null?void 0:p.name),{maxChatCompletions:d=nA}=i||{},f={};for(const y of t.tools)y.type==="function"&&(f[y.function.name||y.function.function.name]=y.function);const h="tools"in t?t.tools.map(y=>y.type==="function"?{type:"function",function:{name:y.function.name||y.function.function.name,parameters:y.function.parameters,description:y.function.description}}:y):void 0;for(const y of t.messages)this._addMessage(y,!1);for(let y=0;y<d;++y){const x=(g=(await this._createChatCompletion(e,{...a,tool_choice:s,tools:h,messages:[...this.messages]},i)).choices[0])==null?void 0:g.message;if(!x)throw new Nt("missing message in ChatCompletion response");if(!x.tool_calls)return;for(const v of x.tool_calls){if(v.type!=="function")continue;const _=v.id,{name:M,arguments:b}=v.function,N=f[M];if(N){if(u&&u!==M){const I=`Invalid tool_call: ${JSON.stringify(M)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:r,tool_call_id:_,content:I});continue}}else{const I=`Invalid tool_call: ${JSON.stringify(M)}. Available options are: ${h.map(A=>JSON.stringify(A.function.name)).join(", ")}. Please try again`;this._addMessage({role:r,tool_call_id:_,content:I});continue}let C;try{C=tA(N)?await N.parse(b):b}catch(I){const A=I instanceof Error?I.message:String(I);this._addMessage({role:r,tool_call_id:_,content:A});continue}const P=await N.function(C,this),D=Pt(this,pi,"m",Qx).call(this,P);if(this._addMessage({role:r,tool_call_id:_,content:D}),u)return}}}}Pm=new WeakMap,Im=new WeakMap,pd=new WeakMap,md=new WeakMap,Lm=new WeakMap,gd=new WeakMap,$s=new WeakMap,vd=new WeakMap,Nm=new WeakMap,Dm=new WeakMap,pc=new WeakMap,Kx=new WeakMap,pi=new WeakSet,Yx=function(){return Pt(this,pi,"m",Ig).call(this).content??null},Ig=function(){let e=this.messages.length;for(;e-- >0;){const t=this.messages[e];if(jc(t))return{...t,content:t.content??null}}throw new Nt("stream ended without producing a ChatCompletionMessage with role=assistant")},$x=function(){var e,t;for(let i=this.messages.length-1;i>=0;i--){const r=this.messages[i];if(jc(r)&&(r!=null&&r.function_call))return r.function_call;if(jc(r)&&((e=r==null?void 0:r.tool_calls)!=null&&e.length))return(t=r.tool_calls.at(-1))==null?void 0:t.function}},Zx=function(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages[e];if(g3(t)&&t.content!=null||v3(t)&&t.content!=null&&this.messages.some(i=>{var r;return i.role==="assistant"&&((r=i.tool_calls)==null?void 0:r.some(s=>s.type==="function"&&s.id===t.tool_call_id))}))return t.content}},Jx=function(){const e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(const{usage:t}of this._chatCompletions)t&&(e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens);return e},y3=function(e){if(e.n!=null&&e.n>1)throw new Nt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Qx=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};class lf extends _3{static runFunctions(e,t,i){const r=new lf,s={...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"runFunctions"}};return r._run(()=>r._runFunctions(e,t,s)),r}static runTools(e,t,i){const r=new lf,s={...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"runTools"}};return r._run(()=>r._runTools(e,t,s)),r}_addMessage(e){super._addMessage(e),jc(e)&&e.content&&this._emit("content",e.content)}}var Hr=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},Wy=function(n,e,t,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(n,t):r?r.value=t:e.set(n,t),t},Ss,To,jy,Xy,_p,iA;class cf extends _3{constructor(){super(...arguments),Ss.add(this),To.set(this,void 0)}get currentChatCompletionSnapshot(){return Hr(this,To,"f")}static fromReadableStream(e){const t=new cf;return t._run(()=>t._fromReadableStream(e)),t}static createChatCompletion(e,t,i){const r=new cf;return r._run(()=>r._runChatCompletion(e,{...t,stream:!0},{...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"stream"}})),r}async _createChatCompletion(e,t,i){var o;const r=i==null?void 0:i.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),Hr(this,Ss,"m",jy).call(this);const s=await e.create({...t,stream:!0},{...i,signal:this.controller.signal});this._connected();for await(const a of s)Hr(this,Ss,"m",Xy).call(this,a);if((o=s.controller.signal)!=null&&o.aborted)throw new ar;return this._addChatCompletion(Hr(this,Ss,"m",_p).call(this))}async _fromReadableStream(e,t){var o;const i=t==null?void 0:t.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort())),Hr(this,Ss,"m",jy).call(this),this._connected();const r=bs.fromReadableStream(e,this.controller);let s;for await(const a of r)s&&s!==a.id&&this._addChatCompletion(Hr(this,Ss,"m",_p).call(this)),Hr(this,Ss,"m",Xy).call(this,a),s=a.id;if((o=r.controller.signal)!=null&&o.aborted)throw new ar;return this._addChatCompletion(Hr(this,Ss,"m",_p).call(this))}[(To=new WeakMap,Ss=new WeakSet,jy=function(){this.ended||Wy(this,To,void 0,"f")},Xy=function(t){var o,a,u;if(this.ended)return;const i=Hr(this,Ss,"m",iA).call(this,t);this._emit("chunk",t,i);const r=(a=(o=t.choices[0])==null?void 0:o.delta)==null?void 0:a.content,s=(u=i.choices[0])==null?void 0:u.message;r!=null&&(s==null?void 0:s.role)==="assistant"&&(s!=null&&s.content)&&this._emit("content",r,s.content)},_p=function(){if(this.ended)throw new Nt("stream has ended, this shouldn't happen");const t=Hr(this,To,"f");if(!t)throw new Nt("request ended without sending any chunks");return Wy(this,To,void 0,"f"),KU(t)},iA=function(t){var i,r,s;let o=Hr(this,To,"f");const{choices:a,...u}=t;o?Object.assign(o,u):o=Wy(this,To,{...u,choices:[]},"f");for(const{delta:d,finish_reason:f,index:h,logprobs:p=null,...g}of t.choices){let y=o.choices[h];if(y||(y=o.choices[h]={finish_reason:f,index:h,message:{},logprobs:p,...g}),p)if(!y.logprobs)y.logprobs=Object.assign({},p);else{const{content:b,...N}=p;Object.assign(y.logprobs,N),b&&((i=y.logprobs).content??(i.content=[]),y.logprobs.content.push(...b))}if(f&&(y.finish_reason=f),Object.assign(y,g),!d)continue;const{content:w,function_call:x,role:v,tool_calls:_,...M}=d;if(Object.assign(y.message,M),w&&(y.message.content=(y.message.content||"")+w),v&&(y.message.role=v),x&&(y.message.function_call?(x.name&&(y.message.function_call.name=x.name),x.arguments&&((r=y.message.function_call).arguments??(r.arguments=""),y.message.function_call.arguments+=x.arguments)):y.message.function_call=x),_){y.message.tool_calls||(y.message.tool_calls=[]);for(const{index:b,id:N,type:C,function:P,...D}of _){const I=(s=y.message.tool_calls)[b]??(s[b]={});Object.assign(I,D),N&&(I.id=N),C&&(I.type=C),P&&(I.function??(I.function={arguments:""})),P!=null&&P.name&&(I.function.name=P.name),P!=null&&P.arguments&&(I.function.arguments+=P.arguments)}}}return o},Symbol.asyncIterator)](){const e=[],t=[];let i=!1;return this.on("chunk",r=>{const s=t.shift();s?s.resolve(r):e.push(r)}),this.on("end",()=>{i=!0;for(const r of t)r.resolve(void 0);t.length=0}),this.on("abort",r=>{i=!0;for(const s of t)s.reject(r);t.length=0}),this.on("error",r=>{i=!0;for(const s of t)s.reject(r);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((s,o)=>t.push({resolve:s,reject:o})).then(s=>s?{value:s,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new bs(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function KU(n){const{id:e,choices:t,created:i,model:r,system_fingerprint:s,...o}=n;return{...o,id:e,choices:t.map(({message:a,finish_reason:u,index:d,logprobs:f,...h})=>{if(!u)throw new Nt(`missing finish_reason for choice ${d}`);const{content:p=null,function_call:g,tool_calls:y,...w}=a,x=a.role;if(!x)throw new Nt(`missing role for choice ${d}`);if(g){const{arguments:v,name:_}=g;if(v==null)throw new Nt(`missing function_call.arguments for choice ${d}`);if(!_)throw new Nt(`missing function_call.name for choice ${d}`);return{...h,message:{content:p,function_call:{arguments:v,name:_},role:x},finish_reason:u,index:d,logprobs:f}}return y?{...h,index:d,finish_reason:u,logprobs:f,message:{...w,role:x,content:p,tool_calls:y.map((v,_)=>{const{function:M,type:b,id:N,...C}=v,{arguments:P,name:D,...I}=M||{};if(N==null)throw new Nt(`missing choices[${d}].tool_calls[${_}].id
${xp(n)}`);if(b==null)throw new Nt(`missing choices[${d}].tool_calls[${_}].type
${xp(n)}`);if(D==null)throw new Nt(`missing choices[${d}].tool_calls[${_}].function.name
${xp(n)}`);if(P==null)throw new Nt(`missing choices[${d}].tool_calls[${_}].function.arguments
${xp(n)}`);return{...C,id:N,type:b,function:{...I,name:D,arguments:P}}})}}:{...h,message:{...w,content:p,role:x},finish_reason:u,index:d,logprobs:f}}),created:i,model:r,object:"chat.completion",...s?{system_fingerprint:s}:{}}}function xp(n){return JSON.stringify(n)}class Xc extends cf{static fromReadableStream(e){const t=new Xc;return t._run(()=>t._fromReadableStream(e)),t}static runFunctions(e,t,i){const r=new Xc,s={...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"runFunctions"}};return r._run(()=>r._runFunctions(e,t,s)),r}static runTools(e,t,i){const r=new Xc,s={...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"runTools"}};return r._run(()=>r._runTools(e,t,s)),r}}let x3=class extends qt{runFunctions(e,t){return e.stream?Xc.runFunctions(this._client.chat.completions,e,t):lf.runFunctions(this._client.chat.completions,e,t)}runTools(e,t){return e.stream?Xc.runTools(this._client.chat.completions,e,t):lf.runTools(this._client.chat.completions,e,t)}stream(e,t){return cf.createChatCompletion(this._client.chat.completions,e,t)}};class Lg extends qt{constructor(){super(...arguments),this.completions=new x3(this._client)}}(function(n){n.Completions=x3})(Lg||(Lg={}));var Gr=function(n,e,t,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(n,t):r?r.value=t:e.set(n,t),t},cn=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},Om,Um,yd,_d,Fm,xd,Zs,Sd,km,zm,mc,eS;class QU{constructor(){this.controller=new AbortController,Om.set(this,void 0),Um.set(this,()=>{}),yd.set(this,()=>{}),_d.set(this,void 0),Fm.set(this,()=>{}),xd.set(this,()=>{}),Zs.set(this,{}),Sd.set(this,!1),km.set(this,!1),zm.set(this,!1),mc.set(this,!1),eS.set(this,e=>{if(Gr(this,km,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ar),e instanceof ar)return Gr(this,zm,!0,"f"),this._emit("abort",e);if(e instanceof Nt)return this._emit("error",e);if(e instanceof Error){const t=new Nt(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new Nt(String(e)))}),Gr(this,Om,new Promise((e,t)=>{Gr(this,Um,e,"f"),Gr(this,yd,t,"f")}),"f"),Gr(this,_d,new Promise((e,t)=>{Gr(this,Fm,e,"f"),Gr(this,xd,t,"f")}),"f"),cn(this,Om,"f").catch(()=>{}),cn(this,_d,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emit("end")},cn(this,eS,"f"))},0)}_addRun(e){return e}_connected(){this.ended||(cn(this,Um,"f").call(this),this._emit("connect"))}get ended(){return cn(this,Sd,"f")}get errored(){return cn(this,km,"f")}get aborted(){return cn(this,zm,"f")}abort(){this.controller.abort()}on(e,t){return(cn(this,Zs,"f")[e]||(cn(this,Zs,"f")[e]=[])).push({listener:t}),this}off(e,t){const i=cn(this,Zs,"f")[e];if(!i)return this;const r=i.findIndex(s=>s.listener===t);return r>=0&&i.splice(r,1),this}once(e,t){return(cn(this,Zs,"f")[e]||(cn(this,Zs,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{Gr(this,mc,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,t)})}async done(){Gr(this,mc,!0,"f"),await cn(this,_d,"f")}_emit(e,...t){if(cn(this,Sd,"f"))return;e==="end"&&(Gr(this,Sd,!0,"f"),cn(this,Fm,"f").call(this));const i=cn(this,Zs,"f")[e];if(i&&(cn(this,Zs,"f")[e]=i.filter(r=>!r.once),i.forEach(({listener:r})=>r(...t))),e==="abort"){const r=t[0];!cn(this,mc,"f")&&!(i!=null&&i.length)&&Promise.reject(r),cn(this,yd,"f").call(this,r),cn(this,xd,"f").call(this,r),this._emit("end");return}if(e==="error"){const r=t[0];!cn(this,mc,"f")&&!(i!=null&&i.length)&&Promise.reject(r),cn(this,yd,"f").call(this,r),cn(this,xd,"f").call(this,r),this._emit("end")}}async _threadAssistantStream(e,t,i){return await this._createThreadAssistantStream(t,e,i)}async _runAssistantStream(e,t,i,r){return await this._createAssistantStream(t,e,i,r)}async _runToolAssistantStream(e,t,i,r,s){return await this._createToolAssistantStream(i,e,t,r,s)}async _createThreadAssistantStream(e,t,i){const r=i==null?void 0:i.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort()));const s=await e.createAndRun({...t,stream:!1},{...i,signal:this.controller.signal});return this._connected(),this._addRun(s)}async _createToolAssistantStream(e,t,i,r,s){const o=s==null?void 0:s.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));const a=await e.submitToolOutputs(t,i,{...r,stream:!1},{...s,signal:this.controller.signal});return this._connected(),this._addRun(a)}async _createAssistantStream(e,t,i,r){const s=r==null?void 0:r.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort()));const o=await e.create(t,{...i,stream:!1},{...r,signal:this.controller.signal});return this._connected(),this._addRun(o)}}Om=new WeakMap,Um=new WeakMap,yd=new WeakMap,_d=new WeakMap,Fm=new WeakMap,xd=new WeakMap,Zs=new WeakMap,Sd=new WeakMap,km=new WeakMap,zm=new WeakMap,mc=new WeakMap,eS=new WeakMap;var lt=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},Ji=function(n,e,t,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(n,t):r?r.value=t:e.set(n,t),t},Kn,tS,Ms,Bm,Yr,qa,Pc,Ha,Ng,er,Vm,Hm,Ud,wd,Md,rA,sA,oA,aA,lA,cA,uA;class ts extends QU{constructor(){super(...arguments),Kn.add(this),tS.set(this,[]),Ms.set(this,{}),Bm.set(this,{}),Yr.set(this,void 0),qa.set(this,void 0),Pc.set(this,void 0),Ha.set(this,void 0),Ng.set(this,void 0),er.set(this,void 0),Vm.set(this,void 0),Hm.set(this,void 0),Ud.set(this,void 0)}[(tS=new WeakMap,Ms=new WeakMap,Bm=new WeakMap,Yr=new WeakMap,qa=new WeakMap,Pc=new WeakMap,Ha=new WeakMap,Ng=new WeakMap,er=new WeakMap,Vm=new WeakMap,Hm=new WeakMap,Ud=new WeakMap,Kn=new WeakSet,Symbol.asyncIterator)](){const e=[],t=[];let i=!1;return this.on("event",r=>{const s=t.shift();s?s.resolve(r):e.push(r)}),this.on("end",()=>{i=!0;for(const r of t)r.resolve(void 0);t.length=0}),this.on("abort",r=>{i=!0;for(const s of t)s.reject(r);t.length=0}),this.on("error",r=>{i=!0;for(const s of t)s.reject(r);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((s,o)=>t.push({resolve:s,reject:o})).then(s=>s?{value:s,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){const t=new ts;return t._run(()=>t._fromReadableStream(e)),t}async _fromReadableStream(e,t){var s;const i=t==null?void 0:t.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort())),this._connected();const r=bs.fromReadableStream(e,this.controller);for await(const o of r)lt(this,Kn,"m",wd).call(this,o);if((s=r.controller.signal)!=null&&s.aborted)throw new ar;return this._addRun(lt(this,Kn,"m",Md).call(this))}toReadableStream(){return new bs(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,t,i,r,s){const o=new ts;return o._run(()=>o._runToolAssistantStream(e,t,i,r,{...s,headers:{...s==null?void 0:s.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createToolAssistantStream(e,t,i,r,s){var d;const o=s==null?void 0:s.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));const a={...r,stream:!0},u=await e.submitToolOutputs(t,i,a,{...s,signal:this.controller.signal});this._connected();for await(const f of u)lt(this,Kn,"m",wd).call(this,f);if((d=u.controller.signal)!=null&&d.aborted)throw new ar;return this._addRun(lt(this,Kn,"m",Md).call(this))}static createThreadAssistantStream(e,t,i){const r=new ts;return r._run(()=>r._threadAssistantStream(e,t,{...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"stream"}})),r}static createAssistantStream(e,t,i,r){const s=new ts;return s._run(()=>s._runAssistantStream(e,t,i,{...r,headers:{...r==null?void 0:r.headers,"X-Stainless-Helper-Method":"stream"}})),s}currentEvent(){return lt(this,Vm,"f")}currentRun(){return lt(this,Hm,"f")}currentMessageSnapshot(){return lt(this,Yr,"f")}currentRunStepSnapshot(){return lt(this,Ud,"f")}async finalRunSteps(){return await this.done(),Object.values(lt(this,Ms,"f"))}async finalMessages(){return await this.done(),Object.values(lt(this,Bm,"f"))}async finalRun(){if(await this.done(),!lt(this,qa,"f"))throw Error("Final run was not received.");return lt(this,qa,"f")}async _createThreadAssistantStream(e,t,i){var a;const r=i==null?void 0:i.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort()));const s={...t,stream:!0},o=await e.createAndRun(s,{...i,signal:this.controller.signal});this._connected();for await(const u of o)lt(this,Kn,"m",wd).call(this,u);if((a=o.controller.signal)!=null&&a.aborted)throw new ar;return this._addRun(lt(this,Kn,"m",Md).call(this))}async _createAssistantStream(e,t,i,r){var u;const s=r==null?void 0:r.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort()));const o={...i,stream:!0},a=await e.create(t,o,{...r,signal:this.controller.signal});this._connected();for await(const d of a)lt(this,Kn,"m",wd).call(this,d);if((u=a.controller.signal)!=null&&u.aborted)throw new ar;return this._addRun(lt(this,Kn,"m",Md).call(this))}static accumulateDelta(e,t){for(const[i,r]of Object.entries(t)){if(!e.hasOwnProperty(i)){e[i]=r;continue}let s=e[i];if(s==null){e[i]=r;continue}if(i==="index"||i==="type"){e[i]=r;continue}if(typeof s=="string"&&typeof r=="string")s+=r;else if(typeof s=="number"&&typeof r=="number")s+=r;else if(eA(s)&&eA(r))s=this.accumulateDelta(s,r);else if(Array.isArray(s)&&Array.isArray(r)){if(s.every(o=>typeof o=="string"||typeof o=="number")){s.push(...r);continue}}else throw Error(`Unhandled record type: ${i}, deltaValue: ${r}, accValue: ${s}`);e[i]=s}return e}}wd=function(e){if(!this.ended)switch(Ji(this,Vm,e,"f"),lt(this,Kn,"m",oA).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":lt(this,Kn,"m",uA).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":lt(this,Kn,"m",sA).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":lt(this,Kn,"m",rA).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier")}},Md=function(){if(this.ended)throw new Nt("stream has ended, this shouldn't happen");if(!lt(this,qa,"f"))throw Error("Final run has not been received");return lt(this,qa,"f")},rA=function(e){const[t,i]=lt(this,Kn,"m",lA).call(this,e,lt(this,Yr,"f"));Ji(this,Yr,t,"f"),lt(this,Bm,"f")[t.id]=t;for(const r of i){const s=t.content[r.index];(s==null?void 0:s.type)=="text"&&this._emit("textCreated",s.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,t),e.data.delta.content)for(const r of e.data.delta.content){if(r.type=="text"&&r.text){let s=r.text,o=t.content[r.index];if(o&&o.type=="text")this._emit("textDelta",s,o.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(r.index!=lt(this,Pc,"f")){if(lt(this,Ha,"f"))switch(lt(this,Ha,"f").type){case"text":this._emit("textDone",lt(this,Ha,"f").text,lt(this,Yr,"f"));break;case"image_file":this._emit("imageFileDone",lt(this,Ha,"f").image_file,lt(this,Yr,"f"));break}Ji(this,Pc,r.index,"f")}Ji(this,Ha,t.content[r.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(lt(this,Pc,"f")!==void 0){const r=e.data.content[lt(this,Pc,"f")];if(r)switch(r.type){case"image_file":this._emit("imageFileDone",r.image_file,lt(this,Yr,"f"));break;case"text":this._emit("textDone",r.text,lt(this,Yr,"f"));break}}lt(this,Yr,"f")&&this._emit("messageDone",e.data),Ji(this,Yr,void 0,"f")}},sA=function(e){const t=lt(this,Kn,"m",aA).call(this,e);switch(Ji(this,Ud,t,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":const i=e.data.delta;if(i.step_details&&i.step_details.type=="tool_calls"&&i.step_details.tool_calls&&t.step_details.type=="tool_calls")for(const s of i.step_details.tool_calls)s.index==lt(this,Ng,"f")?this._emit("toolCallDelta",s,t.step_details.tool_calls[s.index]):(lt(this,er,"f")&&this._emit("toolCallDone",lt(this,er,"f")),Ji(this,Ng,s.index,"f"),Ji(this,er,t.step_details.tool_calls[s.index],"f"),lt(this,er,"f")&&this._emit("toolCallCreated",lt(this,er,"f")));this._emit("runStepDelta",e.data.delta,t);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Ji(this,Ud,void 0,"f"),e.data.step_details.type=="tool_calls"&&lt(this,er,"f")&&(this._emit("toolCallDone",lt(this,er,"f")),Ji(this,er,void 0,"f")),this._emit("runStepDone",e.data,t);break}},oA=function(e){lt(this,tS,"f").push(e),this._emit("event",e)},aA=function(e){switch(e.event){case"thread.run.step.created":return lt(this,Ms,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let t=lt(this,Ms,"f")[e.data.id];if(!t)throw Error("Received a RunStepDelta before creation of a snapshot");let i=e.data;if(i.delta){const r=ts.accumulateDelta(t,i.delta);lt(this,Ms,"f")[e.data.id]=r}return lt(this,Ms,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":lt(this,Ms,"f")[e.data.id]=e.data;break}if(lt(this,Ms,"f")[e.data.id])return lt(this,Ms,"f")[e.data.id];throw new Error("No snapshot available")},lA=function(e,t){let i=[];switch(e.event){case"thread.message.created":return[e.data,i];case"thread.message.delta":if(!t)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let r=e.data;if(r.delta.content)for(const s of r.delta.content)if(s.index in t.content){let o=t.content[s.index];t.content[s.index]=lt(this,Kn,"m",cA).call(this,s,o)}else t.content[s.index]=s,i.push(s);return[t,i];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(t)return[t,i];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},cA=function(e,t){return ts.accumulateDelta(t,e)},uA=function(e){switch(Ji(this,Hm,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":Ji(this,qa,e.data,"f"),lt(this,er,"f")&&(this._emit("toolCallDone",lt(this,er,"f")),Ji(this,er,void 0,"f"));break}};class Dg extends qt{create(e,t,i){return this._client.post(`/threads/${e}/messages`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}retrieve(e,t,i){return this._client.get(`/threads/${e}/messages/${t}`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}update(e,t,i,r){return this._client.post(`/threads/${e}/messages/${t}`,{body:i,...r,headers:{"OpenAI-Beta":"assistants=v2",...r==null?void 0:r.headers}})}list(e,t={},i){return dr(t)?this.list(e,{},t):this._client.getAPIList(`/threads/${e}/messages`,Kw,{query:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}del(e,t,i){return this._client.delete(`/threads/${e}/messages/${t}`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}}class Kw extends cs{}(function(n){n.MessagesPage=Kw})(Dg||(Dg={}));class Og extends qt{retrieve(e,t,i,r){return this._client.get(`/threads/${e}/runs/${t}/steps/${i}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r==null?void 0:r.headers}})}list(e,t,i={},r){return dr(i)?this.list(e,t,{},i):this._client.getAPIList(`/threads/${e}/runs/${t}/steps`,Qw,{query:i,...r,headers:{"OpenAI-Beta":"assistants=v2",...r==null?void 0:r.headers}})}}class Qw extends cs{}(function(n){n.RunStepsPage=Qw})(Og||(Og={}));class Ug extends qt{constructor(){super(...arguments),this.steps=new Og(this._client)}create(e,t,i){return this._client.post(`/threads/${e}/runs`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers},stream:t.stream??!1})}retrieve(e,t,i){return this._client.get(`/threads/${e}/runs/${t}`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}update(e,t,i,r){return this._client.post(`/threads/${e}/runs/${t}`,{body:i,...r,headers:{"OpenAI-Beta":"assistants=v2",...r==null?void 0:r.headers}})}list(e,t={},i){return dr(t)?this.list(e,{},t):this._client.getAPIList(`/threads/${e}/runs`,e1,{query:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}cancel(e,t,i){return this._client.post(`/threads/${e}/runs/${t}/cancel`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}async createAndPoll(e,t,i){const r=await this.create(e,t,i);return await this.poll(e,r.id,i)}createAndStream(e,t,i){return ts.createAssistantStream(e,this._client.beta.threads.runs,t,i)}async poll(e,t,i){const r={...i==null?void 0:i.headers,"X-Stainless-Poll-Helper":"true"};for(i!=null&&i.pollIntervalMs&&(r["X-Stainless-Custom-Poll-Interval"]=i.pollIntervalMs.toString());;){const{data:s,response:o}=await this.retrieve(e,t,{...i,headers:{...i==null?void 0:i.headers,...r}}).withResponse();switch(s.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(i!=null&&i.pollIntervalMs)a=i.pollIntervalMs;else{const u=o.headers.get("openai-poll-after-ms");if(u){const d=parseInt(u);isNaN(d)||(a=d)}}await Vf(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return s}}}stream(e,t,i){return ts.createAssistantStream(e,this._client.beta.threads.runs,t,i)}submitToolOutputs(e,t,i,r){return this._client.post(`/threads/${e}/runs/${t}/submit_tool_outputs`,{body:i,...r,headers:{"OpenAI-Beta":"assistants=v2",...r==null?void 0:r.headers},stream:i.stream??!1})}async submitToolOutputsAndPoll(e,t,i,r){const s=await this.submitToolOutputs(e,t,i,r);return await this.poll(e,s.id,r)}submitToolOutputsStream(e,t,i,r){return ts.createToolAssistantStream(e,t,this._client.beta.threads.runs,i,r)}}class e1 extends cs{}(function(n){n.RunsPage=e1,n.Steps=Og,n.RunStepsPage=Qw})(Ug||(Ug={}));class Fg extends qt{constructor(){super(...arguments),this.runs=new Ug(this._client),this.messages=new Dg(this._client)}create(e={},t){return dr(e)?this.create({},e):this._client.post("/threads",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}retrieve(e,t){return this._client.get(`/threads/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}update(e,t,i){return this._client.post(`/threads/${e}`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}del(e,t){return this._client.delete(`/threads/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}createAndRun(e,t){return this._client.post("/threads/runs",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers},stream:e.stream??!1})}async createAndRunPoll(e,t){const i=await this.createAndRun(e,t);return await this.runs.poll(i.thread_id,i.id,t)}createAndRunStream(e,t){return ts.createThreadAssistantStream(e,this._client.beta.threads,t)}}(function(n){n.Runs=Ug,n.RunsPage=e1,n.Messages=Dg,n.MessagesPage=Kw})(Fg||(Fg={}));const eF=async n=>{const e=await Promise.allSettled(n),t=e.filter(r=>r.status==="rejected");if(t.length){for(const r of t)console.error(r.reason);throw new Error(`${t.length} promise(s) failed - see the above errors`)}const i=[];for(const r of e)r.status==="fulfilled"&&i.push(r.value);return i};let kg=class extends qt{create(e,t,i){return this._client.post(`/vector_stores/${e}/files`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}retrieve(e,t,i){return this._client.get(`/vector_stores/${e}/files/${t}`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}list(e,t={},i){return dr(t)?this.list(e,{},t):this._client.getAPIList(`/vector_stores/${e}/files`,P0,{query:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}del(e,t,i){return this._client.delete(`/vector_stores/${e}/files/${t}`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}async createAndPoll(e,t,i){const r=await this.create(e,t,i);return await this.poll(e,r.id,i)}async poll(e,t,i){const r={...i==null?void 0:i.headers,"X-Stainless-Poll-Helper":"true"};for(i!=null&&i.pollIntervalMs&&(r["X-Stainless-Custom-Poll-Interval"]=i.pollIntervalMs.toString());;){const s=await this.retrieve(e,t,{...i,headers:r}).withResponse(),o=s.data;switch(o.status){case"in_progress":let a=5e3;if(i!=null&&i.pollIntervalMs)a=i.pollIntervalMs;else{const u=s.response.headers.get("openai-poll-after-ms");if(u){const d=parseInt(u);isNaN(d)||(a=d)}}await Vf(a);break;case"failed":case"completed":return o}}}async upload(e,t,i){const r=await this._client.files.create({file:t,purpose:"assistants"},i);return this.create(e,{file_id:r.id},i)}async uploadAndPoll(e,t,i){const r=await this.upload(e,t,i);return await this.poll(e,r.id,i)}};class P0 extends cs{}(function(n){n.VectorStoreFilesPage=P0})(kg||(kg={}));class zg extends qt{create(e,t,i){return this._client.post(`/vector_stores/${e}/file_batches`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}retrieve(e,t,i){return this._client.get(`/vector_stores/${e}/file_batches/${t}`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}cancel(e,t,i){return this._client.post(`/vector_stores/${e}/file_batches/${t}/cancel`,{...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}async createAndPoll(e,t,i){const r=await this.create(e,t);return await this.poll(e,r.id,i)}listFiles(e,t,i={},r){return dr(i)?this.listFiles(e,t,{},i):this._client.getAPIList(`/vector_stores/${e}/file_batches/${t}/files`,P0,{query:i,...r,headers:{"OpenAI-Beta":"assistants=v2",...r==null?void 0:r.headers}})}async poll(e,t,i){const r={...i==null?void 0:i.headers,"X-Stainless-Poll-Helper":"true"};for(i!=null&&i.pollIntervalMs&&(r["X-Stainless-Custom-Poll-Interval"]=i.pollIntervalMs.toString());;){const{data:s,response:o}=await this.retrieve(e,t,{...i,headers:r}).withResponse();switch(s.status){case"in_progress":let a=5e3;if(i!=null&&i.pollIntervalMs)a=i.pollIntervalMs;else{const u=o.headers.get("openai-poll-after-ms");if(u){const d=parseInt(u);isNaN(d)||(a=d)}}await Vf(a);break;case"failed":case"cancelled":case"completed":return s}}}async uploadAndPoll(e,{files:t,fileIds:i=[]},r){if(t===null||t.length==0)throw new Error("No files provided to process.");const s=(r==null?void 0:r.maxConcurrency)??5,o=Math.min(s,t.length),a=this._client,u=t.values(),d=[...i];async function f(p){for(let g of p){const y=await a.files.create({file:g,purpose:"assistants"},r);d.push(y.id)}}const h=Array(o).fill(u).map(f);return await eF(h),await this.createAndPoll(e,{file_ids:d})}}zg||(zg={});class Bg extends qt{constructor(){super(...arguments),this.files=new kg(this._client),this.fileBatches=new zg(this._client)}create(e,t){return this._client.post("/vector_stores",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}retrieve(e,t){return this._client.get(`/vector_stores/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}update(e,t,i){return this._client.post(`/vector_stores/${e}`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}list(e={},t){return dr(e)?this.list({},e):this._client.getAPIList("/vector_stores",t1,{query:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}del(e,t){return this._client.delete(`/vector_stores/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}}class t1 extends cs{}(function(n){n.VectorStoresPage=t1,n.Files=kg,n.VectorStoreFilesPage=P0,n.FileBatches=zg})(Bg||(Bg={}));class Vg extends qt{constructor(){super(...arguments),this.vectorStores=new Bg(this._client),this.chat=new Lg(this._client),this.assistants=new Pg(this._client),this.threads=new Fg(this._client)}}(function(n){n.VectorStores=Bg,n.VectorStoresPage=t1,n.Chat=Lg,n.Assistants=Pg,n.AssistantsPage=Jw,n.Threads=Fg})(Vg||(Vg={}));class Hg extends qt{create(e,t){return this._client.post("/completions",{body:e,...t,stream:e.stream??!1})}}Hg||(Hg={});class Gg extends qt{create(e,t){return this._client.post("/embeddings",{body:e,...t})}}Gg||(Gg={});class Wg extends qt{create(e,t){return this._client.post("/files",af({body:e,...t}))}retrieve(e,t){return this._client.get(`/files/${e}`,t)}list(e={},t){return dr(e)?this.list({},e):this._client.getAPIList("/files",n1,{query:e,...t})}del(e,t){return this._client.delete(`/files/${e}`,t)}content(e,t){return this._client.get(`/files/${e}/content`,{...t,__binaryResponse:!0})}retrieveContent(e,t){return this._client.get(`/files/${e}/content`,{...t,headers:{Accept:"application/json",...t==null?void 0:t.headers}})}async waitForProcessing(e,{pollInterval:t=5e3,maxWait:i=30*60*1e3}={}){const r=new Set(["processed","error","deleted"]),s=Date.now();let o=await this.retrieve(e);for(;!o.status||!r.has(o.status);)if(await Vf(t),o=await this.retrieve(e),Date.now()-s>i)throw new Yw({message:`Giving up on waiting for file ${e} to finish processing after ${i} milliseconds.`});return o}}class n1 extends $w{}(function(n){n.FileObjectsPage=n1})(Wg||(Wg={}));class jg extends qt{list(e,t={},i){return dr(t)?this.list(e,{},t):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,i1,{query:t,...i})}}class i1 extends cs{}(function(n){n.FineTuningJobCheckpointsPage=i1})(jg||(jg={}));class Xg extends qt{constructor(){super(...arguments),this.checkpoints=new jg(this._client)}create(e,t){return this._client.post("/fine_tuning/jobs",{body:e,...t})}retrieve(e,t){return this._client.get(`/fine_tuning/jobs/${e}`,t)}list(e={},t){return dr(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",r1,{query:e,...t})}cancel(e,t){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,t)}listEvents(e,t={},i){return dr(t)?this.listEvents(e,{},t):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,s1,{query:t,...i})}}class r1 extends cs{}class s1 extends cs{}(function(n){n.FineTuningJobsPage=r1,n.FineTuningJobEventsPage=s1,n.Checkpoints=jg,n.FineTuningJobCheckpointsPage=i1})(Xg||(Xg={}));class qg extends qt{constructor(){super(...arguments),this.jobs=new Xg(this._client)}}(function(n){n.Jobs=Xg,n.FineTuningJobsPage=r1,n.FineTuningJobEventsPage=s1})(qg||(qg={}));class Yg extends qt{createVariation(e,t){return this._client.post("/images/variations",af({body:e,...t}))}edit(e,t){return this._client.post("/images/edits",af({body:e,...t}))}generate(e,t){return this._client.post("/images/generations",{body:e,...t})}}Yg||(Yg={});class $g extends qt{retrieve(e,t){return this._client.get(`/models/${e}`,t)}list(e){return this._client.getAPIList("/models",o1,e)}del(e,t){return this._client.delete(`/models/${e}`,t)}}class o1 extends $w{}(function(n){n.ModelsPage=o1})($g||($g={}));class Zg extends qt{create(e,t){return this._client.post("/moderations",{body:e,...t})}}Zg||(Zg={});var S3;class Ln extends BU{constructor({baseURL:e=yp("OPENAI_BASE_URL"),apiKey:t=yp("OPENAI_API_KEY"),organization:i=yp("OPENAI_ORG_ID")??null,project:r=yp("OPENAI_PROJECT_ID")??null,...s}={}){if(t===void 0)throw new Nt("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");const o={apiKey:t,organization:i,project:r,...s,baseURL:e||"https://api.openai.com/v1"};if(!o.dangerouslyAllowBrowser&&JU())throw new Nt(`It looks like you're running in a browser-like environment.

This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,

new OpenAI({ apiKey, dangerouslyAllowBrowser: true });

https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
`);super({baseURL:o.baseURL,timeout:o.timeout??6e5,httpAgent:o.httpAgent,maxRetries:o.maxRetries,fetch:o.fetch}),this.completions=new Hg(this),this.chat=new Eg(this),this.embeddings=new Gg(this),this.files=new Wg(this),this.images=new Yg(this),this.audio=new Cg(this),this.moderations=new Zg(this),this.models=new $g(this),this.fineTuning=new qg(this),this.beta=new Vg(this),this.batches=new Rg(this),this._options=o,this.apiKey=t,this.organization=i,this.project=r}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}}S3=Ln;Ln.OpenAI=S3;Ln.OpenAIError=Nt;Ln.APIError=ni;Ln.APIConnectionError=C0;Ln.APIConnectionTimeoutError=Yw;Ln.APIUserAbortError=ar;Ln.NotFoundError=n3;Ln.ConflictError=i3;Ln.RateLimitError=s3;Ln.BadRequestError=QP;Ln.AuthenticationError=e3;Ln.InternalServerError=o3;Ln.PermissionDeniedError=t3;Ln.UnprocessableEntityError=r3;Ln.toFile=d3;Ln.fileFromPath=JP;(function(n){n.Page=$w,n.CursorPage=cs,n.Completions=Hg,n.Chat=Eg,n.Embeddings=Gg,n.Files=Wg,n.FileObjectsPage=n1,n.Images=Yg,n.Audio=Cg,n.Moderations=Zg,n.Models=$g,n.ModelsPage=o1,n.FineTuning=qg,n.Beta=Vg,n.Batches=Rg,n.BatchesPage=Zw})(Ln||(Ln={}));var tF={VITE_OPENAI_KEY:"sk-proj-CLb7ZCLMHWBCrZix1AczT3BlbkFJTk1JipYdkliCnFpRwnQY",VITE_ASSISTANT_ID2:"asst_W4RBE82qWf9dcqQRv8PXlJ0V",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{VITE_OPENAI_KEY:nF,VITE_ASSISTANT_ID2:iF}=tF,Sp=new Ln({apiKey:nF,dangerouslyAllowBrowser:!0});async function rF(n,e,t,i){try{i(!0);const r=window.localStorage.getItem("threadId");if(!r){const u=await Sp.beta.threads.create();console.log("thread created",u),window.localStorage.setItem("threadId",u.id)}const s=await Sp.beta.threads.messages.create(r||window.localStorage.getItem("threadId"),{role:"user",content:n});console.log("message sent",s);let o=await Sp.beta.threads.runs.createAndPoll(s.thread_id,{assistant_id:iF});const a=[];if(o.status==="completed"){const u=await Sp.beta.threads.messages.list(o.thread_id);console.log("messages received",u);for(const d of u.data.reverse())console.log(`${d.role} > ${d.content[0].text.value}`),console.log("all messages",`${d.content.map(f=>f.text.value)}`),a.push(`${d.content.map(f=>f.text.value)}`),t(`${d.content[0].text.value}`),i(!1),e("");window.localStorage.setItem("messages",JSON.stringify(a))}else console.log(o)}catch(r){console.log(r)}}function sF({setChatClicked:n}){const[e,t]=we.useState(""),[i,r]=we.useState(""),[s,o]=we.useState(!1),a=we.useRef(null),u=JSON.parse(window.localStorage.getItem("messages"))||[];return console.log(u[0]),we.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[i,s]),B.jsx("div",{className:"flex flex-col w-[100%] h-full rounded-xl border-solid border-black border-[0.5px] items-center py-0 relative",children:B.jsxs("div",{className:"flex flex-col rounded-xl pt-2 w-full h-full bg-white mb-0 border-solid relative",children:[B.jsxs("header",{className:"flex gap-5 h-[10%] px-2 justify-between",children:[B.jsxs("div",{className:"flex gap-2.5 text-base font-medium leading-6 text-orange-600",children:[B.jsx("img",{src:"https://cdn.builder.io/api/v1/image/assets/TEMP/0cc2905e2e8ffa8c5b9a01adc73f8b593a230c1d67ec50ca69e15c32c946bade?apiKey=0606b2d678eb4509bb602f42cc7e51d6&",alt:"Icon for assistant",className:"shrink-0 w-8 aspect-square"}),B.jsxs("div",{className:"my-auto",children:[B.jsx("span",{className:"font-semibold text-indigo-800",children:"Claud"}),B.jsx("span",{className:"font-medium text-orange-600",children:"IA"})]})]}),B.jsx("div",{onClick:()=>{n(!1),window.localStorage.removeItem("messages"),window.localStorage.removeItem("threadId")},className:"flex cursor-pointer gap-3.5 my-auto text-3xl font-semibold leading-6 whitespace-nowrap text-neutral-400",children:B.jsx("div",{children:"x"})})]}),B.jsx("img",{src:"https://cdn.builder.io/api/v1/image/assets/TEMP/841799d15ebe0cbfd0f2306bb87e426cae3e956ca861de281be9bf764e73359a?apiKey=0606b2d678eb4509bb602f42cc7e51d6&",alt:"Banner for chat",className:"mt-2.5 w-full border border-solid aspect-[100] border-stone-300 stroke-[1px] stroke-stone-300"}),B.jsxs("div",{ref:a,className:"flex flex-col h-[70%] scrollbar-hide relative  overflow-scroll",children:[B.jsxs("section",{className:"flex flex-col px-4 mt-5 w-full text-xs leading-6",children:[B.jsx(dA,{align:"start",imageSrc:"https://cdn.builder.io/api/v1/image/assets/TEMP/aca30bfb8e586b2d263662d0c9086dbf1341564f18db94d8349c72beac697406?apiKey=0606b2d678eb4509bb602f42cc7e51d6&",imageAlt:"",bg:"bg-orange-600 bg-opacity-80",textColor:"text-white",children:B.jsxs("p",{className:"text-balance",children:["Hola, soy ClaudIA.",B.jsx("br",{}),B.jsx("br",{}),"Mi propósito principal es ayudarte a decidir qué tecnología y material se adecúa más a lo que quieres fabricar, aunque también puedo resolverte dudas complejas de procesos industriales.",B.jsx("br",{}),B.jsx("br",{}),"Puedes decirme lo que quieres fabricar, cómo se va a utilizar, preguntarme qué material o tecnología necesitas o especificaciones técnicas del material.",B.jsx("br",{}),B.jsx("br",{}),"Te recomiendo que utilices un lenguaje natural, como si estuvieras hablando con un humano, y que precises tus necesidades.",B.jsx("br",{}),"                           ",B.jsx("br",{}),"Te recuerdo que soy un modelo de lA entrenado para la industria de la fabricación y que mis respuestas son siempre recomendaciones no vinculantes.",B.jsx("br",{}),"                                ",B.jsx("br",{}),"Si necesitas que un humano revise la información, escríbenos a ",B.jsx("span",{className:"text-black",children:"info@manfacter.com"})]})}),B.jsx("div",{className:"",children:u.map((d,f)=>B.jsx("div",{children:B.jsx(dA,{align:f%2===0?"end":"start",imgSrc:f%2===0?"":"https://cdn.builder.io/api/v1/image/assets/TEMP/aca30bfb8e586b2d263662d0c9086dbf1341564f18db94d8349c72beac697406?apiKey=0606b2d678eb4509bb602f42cc7e51d6&",imgAlt:"",bg:f%2===0?"bg-zinc-100":"bg-orange-600 bg-opacity-80",textColor:f%2===0?"text-neutral-400":"text-white",children:d})},f))}),s&&B.jsxs("div",{className:"spinner center",children:[B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"}),B.jsx("div",{className:"spinner-blade"})]})]}),B.jsxs("footer",{className:"self-center mt-2 text-xs font-light text-orange-600",children:[" powered by"," ",B.jsx("span",{className:"font-semibold text-indigo-800",children:"manfacter"}),B.jsx("span",{className:"font-medium text-orange-600",children:"AI"})]})]}),B.jsx("div",{className:" h-[20%] rounded-2xl w-full",children:B.jsx(oF,{userInput:e,setUserInput:t,response:i,setResponse:r,setLoading:o})})]})})}function dA({align:n,children:e,imgSrc:t,imgAlt:i,bg:r,textColor:s}){return B.jsxs("div",{className:`flex w-full gap-4 text-xs mt-4 ${s} ${n==="end"?"justify-end":""}`,children:[t&&B.jsx("img",{src:t,alt:i,className:"shrink-0 self-end mb-4 aspect-square w-[22px]"}),B.jsx("div",{className:`justify-center w-[78%] px-2.5 py-3 rounded-3xl ${r} ${r==="bg-zinc-100"?"text-neutral-400":""} w-fit`,children:e})]})}function oF({userInput:n,setUserInput:e,response:t,setResponse:i,setLoading:r}){return B.jsxs("form",{onSubmit:s=>{s.preventDefault(),rF(n,e,i,r)},className:"flex justify-center items-center rounded-xl w-[100%] h-[100%] relative flex-col pb-4 mt-0 text-sm font-light leading-5  fill-zinc-100 text-neutral-400",children:[B.jsx("img",{src:"https://cdn.builder.io/api/v1/image/assets/TEMP/1f9fb1f16900e8728996f4cf5d2d7a471fe2d55ba655a3edcdcdde3d6572d6c8?apiKey=0606b2d678eb4509bb602f42cc7e51d6&",alt:"",className:"object-cover absolute inset-0 size-full"}),B.jsx("img",{src:"https://cdn.builder.io/api/v1/image/assets/TEMP/841799d15ebe0cbfd0f2306bb87e426cae3e956ca861de281be9bf764e73359a?apiKey=0606b2d678eb4509bb602f42cc7e51d6&",alt:"",className:"w-full border border-solid aspect-[100] border-stone-300 stroke-[1px] stroke-stone-300"}),B.jsxs("div",{className:"flex relative gap-5 self-center px-3 py-4 mt-2.5 w-[80%] bg-white rounded-lg",children:[B.jsx("label",{htmlFor:"messageInput",className:"sr-only bg-white",children:"Write your text here"}),B.jsx("input",{type:"text",id:"messageInput",name:"message",autoComplete:"off",placeholder:"Write your text here","aria-label":"Write your text here",onChange:s=>e(s.target.value),value:n,className:"flex-auto w-[100%] my-auto text-black bg-white outline-none overflow-hidden overflow-x-hidden overflow-y-hidden overflow-y-auto overflow-x-auto"}),B.jsx("button",{type:"submit",className:"bg-white outline-none",children:B.jsx("img",{src:"https://cdn.builder.io/api/v1/image/assets/TEMP/711cfa2d804dd27e96a53914f48b1035d695e3df8207fea67e48a84ff091b8ea?apiKey=0606b2d678eb4509bb602f42cc7e51d6&",alt:"",className:"shrink-0 z-10 aspect-square w-[23px]"})})]})]})}function aF({price:n,quantity:e,chatClicked:t,setChatClicked:i}){const[r,s]=we.useState(null),[o,a]=we.useState("anthracite"),d=(n*e).toFixed(2),f=p=>{a(p)},h=p=>{s(p.target.files[0].name)};return B.jsxs("div",{className:" relative left-0 ml-0 h-[70%]",children:[B.jsx("h3",{className:"mt-6 text-2xl font-medium leading-[4%] text-blue-700 max-md:max-w-full",children:"Technical specifications"}),B.jsx("aside",{className:"flex flex-col ml-[2%] w-[100%] max-md:ml-0 max-md:w-full",children:B.jsxs("div",{className:"flex flex-col grow mt-8 max-md:mt-10 max-md:max-w-full relative",children:[B.jsx("div",{className:r?"max-md:max-w-full mb-2 ":"max-md:max-w-full mb-0 ",children:B.jsxs("div",{className:"flex gap-5 max-md:flex-col max-md:gap-0",children:[B.jsx("span",{className:r?"ml-[2%] mt-0 pt-2 pb-2  bg-gray-300 rounded pr-4 pl-4 absolute top-[-2%]":"ml-[2%] mt-0 pt-2  rounded pr-4 pl-4",children:r}),B.jsxs("label",{className:"custom-file-upload w-[40%]  hover:bg-transparent hover:border-none hover:text-[#49474C] font-poppins text-[14px] absolute right-2 top-[-2%]",children:[B.jsx("p",{children:"Choose pdf"}),B.jsx("input",{type:"file",onChange:h})]})]})}),B.jsx("div",{className:"shrink-0 mt-9 max-w-full border-1 h-0.5 border-solid bg-black bg-opacity-40 border-black border-opacity-40   relative"}),B.jsx("div",{className:"z-10 mt-6 text-xl font-medium leading-[4%] text-blue-700 max-md:max-w-full",children:"Colors"}),B.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-6 ml-2",children:[B.jsx("div",{onClick:()=>f("white"),value:"white",className:`w-8 cursor-pointer h-8 bg-white border rounded-full
                        ${o==="white"?"border-blue-800 border-[3px] text-indigo-800 font-semibold":"border-zinc-700"}
                          `,children:B.jsx("p",{className:"ml-10 pt-1",children:"White"})}),B.jsx("div",{onClick:()=>f("black"),value:"black",className:` w-8 cursor-pointer h-8 bg-black border rounded-full
                            ${o==="black"?"border-indigo-800 border-[3px] text-indigo-800 font-semibold":"border-zinc-700"}
                        `,children:B.jsx("p",{className:"ml-10 pt-1",children:"Black"})}),B.jsx("div",{onClick:()=>f("anthracite"),value:"anthracite",className:` w-8 cursor-pointer h-8 bg-zinc-700 border rounded-full
                            ${o==="anthracite"?"border-indigo-800 border-[3px] text-indigo-800 font-semibold":"border-zinc-700"}
                        `,children:B.jsx("p",{className:"ml-10 pt-1",children:"Anthracite"})}),B.jsx("div",{onClick:()=>f("blue"),value:"blue",className:` w-8 cursor-pointer h-8 bg-blue-500 border rounded-full
                            ${o==="blue"?"border-indigo-800 border-[3px] text-indigo-800 font-semibold":"border-zinc-700"}
                        `,children:B.jsx("p",{className:"ml-10 pt-1",children:"Blue"})}),B.jsx("div",{onClick:()=>f("red"),value:"red",className:` w-8 cursor-pointer h-8 bg-red-500 border rounded-full
                            ${o==="red"?"border-indigo-800 border-[3px] text-indigo-800 font-semibold":"border-zinc-700"}
                        `,children:B.jsx("p",{className:"ml-10 pt-1",children:"Red"})}),B.jsx("div",{onClick:()=>f("green"),value:"green",className:` w-8 cursor-pointer h-8 bg-green-500 border rounded-full
                            ${o==="green"?"border-indigo-800 border-[3px] text-indigo-800 font-semibold":"border-zinc-700"}
                        `,children:B.jsx("p",{className:"ml-10 pt-1",children:"Green"})}),B.jsx("div",{onClick:()=>f("yellow"),value:"yellow",className:` w-8 cursor-pointer h-8 bg-yellow-500 border rounded-full
                            ${o==="yellow"?"border-indigo-800 border-[3px] text-indigo-800 font-semibold":"border-zinc-700"}
                        `,children:B.jsx("p",{className:"ml-10 pt-1",children:"Yellow"})})]}),B.jsx("div",{className:"self-end mt-2 mr-9 text-base font-medium leading-6 text-neutral-400 max-md:mr-2.5",children:"More colors"}),B.jsx("div",{className:"shrink-0 mt-2 max-w-full h-0.5 border-1 border-solid bg-black bg-opacity-40 border-black border-opacity-40 w-[535px]"}),B.jsxs("div",{className:"flex gap-2 justify-between mt-4 font-medium",children:[B.jsxs("div",{className:"flex flex-col",children:[B.jsx("h4",{className:"text-xl leading-4 text-blue-700",children:"Resume"}),B.jsxs("div",{className:"mt-5 text-[14px] leading-4 text-black",children:["Per part",B.jsx("br",{}),B.jsx("br",{}),"Quantity",B.jsx("br",{}),B.jsx("br",{}),"Total"]})]}),B.jsxs("div",{className:"mt-9 text-[14px] leading-4 mr-6 text-right text-black",children:[n,"€",B.jsx("br",{}),B.jsx("br",{}),e,B.jsx("br",{}),B.jsx("br",{}),d,"€"]})]}),B.jsx("div",{className:"shrink-0 mt-2 h-0.5 border-1 border-solid bg-black bg-opacity-40 border-black border-opacity-40 w-full"}),B.jsxs("div",{className:"flex flex-col self-end mt-[3%] max-w-full text-[14px] mr-0 font-medium leading-2 text-white w-[143px]",children:[B.jsx("button",{className:"flex hover:bg-transparent hover:border-none hover:text-[#49474C] font-poppins px-2 py-2 bg-blue-500 rounded-md w-6/6 ",children:B.jsx("div",{className:"flex-auto text-[14px] my-auto",children:"Submit"})}),B.jsx("img",{onClick:()=>i(!t),loading:"lazy",src:"https://cdn.builder.io/api/v1/image/assets/TEMP/b82b6fc188fa26c90c5551ec707310c47016c06d024c7335c60c05ce54aa0ae9?apiKey=1342f5df53a1444ebb376cd081066232&",alt:"",className:"cursor-pointer self-end mt-[15%] aspect-[1.06] fill-orange-600 w-[47px] absolute bottom-[-15%] right-0"})]})]})})]})}const qy="https://manfacter.com",lF=()=>B.jsxs("div",{className:"flex w-[89%] self-center flex-row h-12 items-end m-2",children:[B.jsx("img",{onClick:()=>window.location.href=qy,className:"w-[10rem] cursor-pointer",src:"https://res.cloudinary.com/dgtamgaup/image/upload/v1718525202/manfacter-logo_lhoyxe.png",alt:"manfacter logo"}),B.jsx("div",{className:"pb-1.5 pl-12 flex space-x-6 text-sm text-[#49474C]",children:B.jsx("span",{onClick:()=>window.location.href=qy,className:"hover:text-[#3A6AFD] cursor-pointer",children:"Home"})}),B.jsx("div",{className:"ml-auto",children:B.jsx("button",{onClick:()=>window.location.href=qy,className:"bg-[#FF6102] rounded-3xl font-poppins font-light hover:bg-[#fff] hover:text-[#49474C] hover:border-none text-[16px] px-10 text-white",children:"PRESUPUESTO IA"})})]});/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const I0="164",ka={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},za={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},w3=0,nS=1,M3=2,cF=3,E3=0,L0=1,qc=2,$r=3,uo=0,Pi=1,Qr=2,so=0,il=1,iS=2,rS=3,sS=4,b3=5,Go=100,A3=101,T3=102,C3=103,R3=104,P3=200,I3=201,L3=202,N3=203,Jg=204,Kg=205,D3=206,O3=207,U3=208,F3=209,k3=210,z3=211,B3=212,V3=213,H3=214,G3=0,W3=1,j3=2,uf=3,X3=4,q3=5,Y3=6,$3=7,Hf=0,Z3=1,J3=2,Is=0,K3=1,Q3=2,e2=3,a1=4,t2=5,n2=6,i2=7,oS="attached",r2="detached",N0=300,fo=301,oa=302,df=303,ff=304,uu=306,hf=1e3,Pr=1001,pf=1002,Yn=1003,l1=1004,uF=1004,Ic=1005,dF=1005,In=1006,Fd=1007,fF=1007,As=1008,hF=1008,Ns=1009,s2=1010,o2=1011,c1=1012,u1=1013,ml=1014,Ir=1015,Gf=1016,d1=1017,f1=1018,du=1020,a2=35902,l2=1021,c2=1022,Bi=1023,u2=1024,d2=1025,rl=1026,nu=1027,h1=1028,p1=1029,f2=1030,m1=1031,g1=1033,Gm=33776,Wm=33777,jm=33778,Xm=33779,aS=35840,lS=35841,cS=35842,uS=35843,dS=36196,fS=37492,hS=37496,pS=37808,mS=37809,gS=37810,vS=37811,yS=37812,_S=37813,xS=37814,SS=37815,wS=37816,MS=37817,ES=37818,bS=37819,AS=37820,TS=37821,qm=36492,CS=36494,RS=36495,h2=36283,PS=36284,IS=36285,LS=36286,p2=2200,m2=2201,g2=2202,mf=2300,gf=2301,Ym=2302,Ya=2400,$a=2401,vf=2402,D0=2500,v1=2501,pF=0,mF=1,gF=2,v2=3200,y2=3201,da=0,_2=1,Qs="",br="srgb",po="srgb-linear",O0="display-p3",Wf="display-p3-linear",yf="linear",Yt="srgb",_f="rec709",xf="p3",vF=0,Ba=7680,yF=7681,_F=7682,xF=7683,SF=34055,wF=34056,MF=5386,EF=512,bF=513,AF=514,TF=515,CF=516,RF=517,PF=518,NS=519,x2=512,S2=513,w2=514,y1=515,M2=516,E2=517,b2=518,A2=519,Sf=35044,IF=35048,LF=35040,NF=35045,DF=35049,OF=35041,UF=35046,FF=35050,kF=35042,zF="100",DS="300 es",Ts=2e3,wf=2001;class Ds{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 di=["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 fA=1234567;const sl=Math.PI/180,iu=180/Math.PI;function cr(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(di[n&255]+di[n>>8&255]+di[n>>16&255]+di[n>>24&255]+"-"+di[e&255]+di[e>>8&255]+"-"+di[e>>16&15|64]+di[e>>24&255]+"-"+di[t&63|128]+di[t>>8&255]+"-"+di[t>>16&255]+di[t>>24&255]+di[i&255]+di[i>>8&255]+di[i>>16&255]+di[i>>24&255]).toLowerCase()}function yn(n,e,t){return Math.max(e,Math.min(t,n))}function _1(n,e){return(n%e+e)%e}function BF(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function VF(n,e,t){return n!==e?(t-n)/(e-n):0}function kd(n,e,t){return(1-t)*n+t*e}function HF(n,e,t,i){return kd(n,e,1-Math.exp(-t*i))}function GF(n,e=1){return e-Math.abs(_1(n,e*2)-e)}function WF(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function jF(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function XF(n,e){return n+Math.floor(Math.random()*(e-n+1))}function qF(n,e){return n+Math.random()*(e-n)}function YF(n){return n*(.5-Math.random())}function $F(n){n!==void 0&&(fA=n);let e=fA+=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 ZF(n){return n*sl}function JF(n){return n*iu}function KF(n){return(n&n-1)===0&&n!==0}function QF(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function ek(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function tk(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),u=o(t/2),d=s((e+i)/2),f=o((e+i)/2),h=s((e-i)/2),p=o((e-i)/2),g=s((i-e)/2),y=o((i-e)/2);switch(r){case"XYX":n.set(a*f,u*h,u*p,a*d);break;case"YZY":n.set(u*p,a*f,u*h,a*d);break;case"ZXZ":n.set(u*h,u*p,a*f,a*d);break;case"XZX":n.set(a*f,u*y,u*g,a*d);break;case"YXY":n.set(u*g,a*f,u*y,a*d);break;case"ZYZ":n.set(u*y,u*g,a*f,a*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ci(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Et(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const nk={DEG2RAD:sl,RAD2DEG:iu,generateUUID:cr,clamp:yn,euclideanModulo:_1,mapLinear:BF,inverseLerp:VF,lerp:kd,damp:HF,pingpong:GF,smoothstep:WF,smootherstep:jF,randInt:XF,randFloat:qF,randFloatSpread:YF,seededRandom:$F,degToRad:ZF,radToDeg:JF,isPowerOfTwo:KF,ceilPowerOfTwo:QF,floorPowerOfTwo:ek,setQuaternionFromProperEuler:tk,normalize:Et,denormalize:Ci};class Ee{constructor(e=0,t=0){Ee.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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(yn(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 Mt{constructor(e,t,i,r,s,o,a,u,d){Mt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,u,d)}set(e,t,i,r,s,o,a,u,d){const f=this.elements;return f[0]=e,f[1]=r,f[2]=a,f[3]=t,f[4]=s,f[5]=u,f[6]=i,f[7]=o,f[8]=d,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],u=i[6],d=i[1],f=i[4],h=i[7],p=i[2],g=i[5],y=i[8],w=r[0],x=r[3],v=r[6],_=r[1],M=r[4],b=r[7],N=r[2],C=r[5],P=r[8];return s[0]=o*w+a*_+u*N,s[3]=o*x+a*M+u*C,s[6]=o*v+a*b+u*P,s[1]=d*w+f*_+h*N,s[4]=d*x+f*M+h*C,s[7]=d*v+f*b+h*P,s[2]=p*w+g*_+y*N,s[5]=p*x+g*M+y*C,s[8]=p*v+g*b+y*P,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],u=e[6],d=e[7],f=e[8];return t*o*f-t*a*d-i*s*f+i*a*u+r*s*d-r*o*u}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],u=e[6],d=e[7],f=e[8],h=f*o-a*d,p=a*u-f*s,g=d*s-o*u,y=t*h+i*p+r*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return e[0]=h*w,e[1]=(r*d-f*i)*w,e[2]=(a*i-r*o)*w,e[3]=p*w,e[4]=(f*t-r*u)*w,e[5]=(r*s-a*t)*w,e[6]=g*w,e[7]=(i*u-d*t)*w,e[8]=(o*t-i*s)*w,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 u=Math.cos(s),d=Math.sin(s);return this.set(i*u,i*d,-i*(u*o+d*a)+o+e,-r*d,r*u,-r*(-d*o+u*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yy.makeScale(e,t)),this}rotate(e){return this.premultiply(Yy.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yy.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),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 Yy=new Mt;function T2(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const ik={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Lc(n,e){return new ik[n](e)}function Mf(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function C2(){const n=Mf("canvas");return n.style.display="block",n}const hA={};function R2(n){n in hA||(hA[n]=!0,console.warn(n))}const pA=new Mt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),mA=new Mt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),wp={[po]:{transfer:yf,primaries:_f,toReference:n=>n,fromReference:n=>n},[br]:{transfer:Yt,primaries:_f,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Wf]:{transfer:yf,primaries:xf,toReference:n=>n.applyMatrix3(mA),fromReference:n=>n.applyMatrix3(pA)},[O0]:{transfer:Yt,primaries:xf,toReference:n=>n.convertSRGBToLinear().applyMatrix3(mA),fromReference:n=>n.applyMatrix3(pA).convertLinearToSRGB()}},rk=new Set([po,Wf]),Gt={enabled:!0,_workingColorSpace:po,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!rk.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=wp[e].toReference,r=wp[t].fromReference;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)},getPrimaries:function(n){return wp[n].primaries},getTransfer:function(n){return n===Qs?yf:wp[n].transfer}};function Yc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $y(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Vl;class P2{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Vl===void 0&&(Vl=Mf("canvas")),Vl.width=e.width,Vl.height=e.height;const i=Vl.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Vl}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=Mf("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]=Yc(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(Yc(t[i]/255)*255):t[i]=Yc(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}}let sk=0;class Za{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:sk++}),this.uuid=cr(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const 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(Zy(r[o].image)):s.push(Zy(r[o]))}else s=Zy(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Zy(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?P2.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 ok=0;class hn extends Ds{constructor(e=hn.DEFAULT_IMAGE,t=hn.DEFAULT_MAPPING,i=Pr,r=Pr,s=In,o=As,a=Bi,u=Ns,d=hn.DEFAULT_ANISOTROPY,f=Qs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ok++}),this.uuid=cr(),this.name="",this.source=new Za(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=d,this.format=a,this.internalFormat=null,this.type=u,this.offset=new Ee(0,0),this.repeat=new Ee(1,1),this.center=new Ee(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==N0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case hf:e.x=e.x-Math.floor(e.x);break;case Pr:e.x=e.x<0?0:1;break;case pf: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 hf:e.y=e.y-Math.floor(e.y);break;case Pr:e.y=e.y<0?0:1;break;case pf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}hn.DEFAULT_IMAGE=null;hn.DEFAULT_MAPPING=N0;hn.DEFAULT_ANISOTROPY=1;class Wt{constructor(e=0,t=0,i=0,r=1){Wt.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 u=e.elements,d=u[0],f=u[4],h=u[8],p=u[1],g=u[5],y=u[9],w=u[2],x=u[6],v=u[10];if(Math.abs(f-p)<.01&&Math.abs(h-w)<.01&&Math.abs(y-x)<.01){if(Math.abs(f+p)<.1&&Math.abs(h+w)<.1&&Math.abs(y+x)<.1&&Math.abs(d+g+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(d+1)/2,b=(g+1)/2,N=(v+1)/2,C=(f+p)/4,P=(h+w)/4,D=(y+x)/4;return M>b&&M>N?M<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(M),r=C/i,s=P/i):b>N?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=C/r,s=D/r):N<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(N),i=P/s,r=D/s),this.set(i,r,s,t),this}let _=Math.sqrt((x-y)*(x-y)+(h-w)*(h-w)+(p-f)*(p-f));return Math.abs(_)<.001&&(_=1),this.x=(x-y)/_,this.y=(h-w)/_,this.z=(p-f)/_,this.w=Math.acos((d+g+v-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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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 I2 extends Ds{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:In,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new hn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].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.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Za(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class os extends I2{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class U0 extends hn{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=Yn,this.minFilter=Yn,this.wrapR=Pr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ak extends os{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new U0(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class x1 extends hn{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=Yn,this.minFilter=Yn,this.wrapR=Pr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class lk extends os{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new x1(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class gi{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 u=i[r+0],d=i[r+1],f=i[r+2],h=i[r+3];const p=s[o+0],g=s[o+1],y=s[o+2],w=s[o+3];if(a===0){e[t+0]=u,e[t+1]=d,e[t+2]=f,e[t+3]=h;return}if(a===1){e[t+0]=p,e[t+1]=g,e[t+2]=y,e[t+3]=w;return}if(h!==w||u!==p||d!==g||f!==y){let x=1-a;const v=u*p+d*g+f*y+h*w,_=v>=0?1:-1,M=1-v*v;if(M>Number.EPSILON){const N=Math.sqrt(M),C=Math.atan2(N,v*_);x=Math.sin(x*C)/N,a=Math.sin(a*C)/N}const b=a*_;if(u=u*x+p*b,d=d*x+g*b,f=f*x+y*b,h=h*x+w*b,x===1-a){const N=1/Math.sqrt(u*u+d*d+f*f+h*h);u*=N,d*=N,f*=N,h*=N}}e[t]=u,e[t+1]=d,e[t+2]=f,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],u=i[r+1],d=i[r+2],f=i[r+3],h=s[o],p=s[o+1],g=s[o+2],y=s[o+3];return e[t]=a*y+f*h+u*g-d*p,e[t+1]=u*y+f*p+d*h-a*g,e[t+2]=d*y+f*g+a*p-u*h,e[t+3]=f*y-a*h-u*p-d*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,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=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,u=Math.sin,d=a(i/2),f=a(r/2),h=a(s/2),p=u(i/2),g=u(r/2),y=u(s/2);switch(o){case"XYZ":this._x=p*f*h+d*g*y,this._y=d*g*h-p*f*y,this._z=d*f*y+p*g*h,this._w=d*f*h-p*g*y;break;case"YXZ":this._x=p*f*h+d*g*y,this._y=d*g*h-p*f*y,this._z=d*f*y-p*g*h,this._w=d*f*h+p*g*y;break;case"ZXY":this._x=p*f*h-d*g*y,this._y=d*g*h+p*f*y,this._z=d*f*y+p*g*h,this._w=d*f*h-p*g*y;break;case"ZYX":this._x=p*f*h-d*g*y,this._y=d*g*h+p*f*y,this._z=d*f*y-p*g*h,this._w=d*f*h+p*g*y;break;case"YZX":this._x=p*f*h+d*g*y,this._y=d*g*h+p*f*y,this._z=d*f*y-p*g*h,this._w=d*f*h-p*g*y;break;case"XZY":this._x=p*f*h-d*g*y,this._y=d*g*h-p*f*y,this._z=d*f*y+p*g*h,this._w=d*f*h+p*g*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&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],u=t[9],d=t[2],f=t[6],h=t[10],p=i+a+h;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(f-u)*g,this._y=(s-d)*g,this._z=(o-r)*g}else if(i>a&&i>h){const g=2*Math.sqrt(1+i-a-h);this._w=(f-u)/g,this._x=.25*g,this._y=(r+o)/g,this._z=(s+d)/g}else if(a>h){const g=2*Math.sqrt(1+a-i-h);this._w=(s-d)/g,this._x=(r+o)/g,this._y=.25*g,this._z=(u+f)/g}else{const g=2*Math.sqrt(1+h-i-a);this._w=(o-r)/g,this._x=(s+d)/g,this._y=(u+f)/g,this._z=.25*g}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(yn(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,u=t._y,d=t._z,f=t._w;return this._x=i*f+o*a+r*d-s*u,this._y=r*f+o*u+s*a-i*d,this._z=s*f+o*d+i*u-r*a,this._w=o*f-i*a-r*u-s*d,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 u=1-a*a;if(u<=Number.EPSILON){const g=1-t;return this._w=g*o+t*this._w,this._x=g*i+t*this._x,this._y=g*r+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const d=Math.sqrt(u),f=Math.atan2(d,a),h=Math.sin((1-t)*f)/d,p=Math.sin(t*f)/d;return this._w=o*h+this._w*p,this._x=i*h+this._x*p,this._y=r*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class k{constructor(e=0,t=0,i=0){k.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(gA.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(gA.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,u=e.w,d=2*(o*r-a*i),f=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+u*d+o*h-a*f,this.y=i+u*f+a*d-s*h,this.z=r+u*h+s*f-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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,u=t.z;return this.x=r*u-s*a,this.y=s*o-i*u,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 Jy.copy(this).projectOnVector(e),this.sub(Jy)}reflect(e){return this.sub(Jy.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(yn(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()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Jy=new k,gA=new gi;class ei{constructor(e=new k(1/0,1/0,1/0),t=new k(-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(Wr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Wr.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=Wr.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){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Wr):Wr.fromBufferAttribute(s,o),Wr.applyMatrix4(e.matrixWorld),this.expandByPoint(Wr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Mp.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Mp.copy(i.boundingBox)),Mp.applyMatrix4(e.matrixWorld),this.union(Mp)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Wr),Wr.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(qu),Ep.subVectors(this.max,qu),Hl.subVectors(e.a,qu),Gl.subVectors(e.b,qu),Wl.subVectors(e.c,qu),Co.subVectors(Gl,Hl),Ro.subVectors(Wl,Gl),Ea.subVectors(Hl,Wl);let t=[0,-Co.z,Co.y,0,-Ro.z,Ro.y,0,-Ea.z,Ea.y,Co.z,0,-Co.x,Ro.z,0,-Ro.x,Ea.z,0,-Ea.x,-Co.y,Co.x,0,-Ro.y,Ro.x,0,-Ea.y,Ea.x,0];return!Ky(t,Hl,Gl,Wl,Ep)||(t=[1,0,0,0,1,0,0,0,1],!Ky(t,Hl,Gl,Wl,Ep))?!1:(bp.crossVectors(Co,Ro),t=[bp.x,bp.y,bp.z],Ky(t,Hl,Gl,Wl,Ep))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Wr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Wr).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:(Hs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hs),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 Hs=[new k,new k,new k,new k,new k,new k,new k,new k],Wr=new k,Mp=new ei,Hl=new k,Gl=new k,Wl=new k,Co=new k,Ro=new k,Ea=new k,qu=new k,Ep=new k,bp=new k,ba=new k;function Ky(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){ba.fromArray(n,s);const a=r.x*Math.abs(ba.x)+r.y*Math.abs(ba.y)+r.z*Math.abs(ba.z),u=e.dot(ba),d=t.dot(ba),f=i.dot(ba);if(Math.max(-Math.max(u,d,f),Math.min(u,d,f))>a)return!1}return!0}const ck=new ei,Yu=new k,Qy=new k;class vi{constructor(e=new k,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):ck.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;Yu.subVectors(e,this.center);const t=Yu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Yu,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):(Qy.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Yu.copy(e.center).add(Qy)),this.expandByPoint(Yu.copy(e.center).sub(Qy))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Gs=new k,e_=new k,Ap=new k,Po=new k,t_=new k,Tp=new k,n_=new k;class fu{constructor(e=new k,t=new k(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,Gs)),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=Gs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gs.copy(this.origin).addScaledVector(this.direction,t),Gs.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){e_.copy(e).add(t).multiplyScalar(.5),Ap.copy(t).sub(e).normalize(),Po.copy(this.origin).sub(e_);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Ap),a=Po.dot(this.direction),u=-Po.dot(Ap),d=Po.lengthSq(),f=Math.abs(1-o*o);let h,p,g,y;if(f>0)if(h=o*u-a,p=o*a-u,y=s*f,h>=0)if(p>=-y)if(p<=y){const w=1/f;h*=w,p*=w,g=h*(h+o*p+2*a)+p*(o*h+p+2*u)+d}else p=s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*u)+d;else p=-s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*u)+d;else p<=-y?(h=Math.max(0,-(-o*s+a)),p=h>0?-s:Math.min(Math.max(-s,-u),s),g=-h*h+p*(p+2*u)+d):p<=y?(h=0,p=Math.min(Math.max(-s,-u),s),g=p*(p+2*u)+d):(h=Math.max(0,-(o*s+a)),p=h>0?s:Math.min(Math.max(-s,-u),s),g=-h*h+p*(p+2*u)+d);else p=o>0?-s:s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(e_).addScaledVector(Ap,p),g}intersectSphere(e,t){Gs.subVectors(e.center,this.origin);const i=Gs.dot(this.direction),r=Gs.dot(Gs)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,u=i+o;return u<0?null:a<0?this.at(u,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,u;const d=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,p=this.origin;return d>=0?(i=(e.min.x-p.x)*d,r=(e.max.x-p.x)*d):(i=(e.max.x-p.x)*d,r=(e.min.x-p.x)*d),f>=0?(s=(e.min.y-p.y)*f,o=(e.max.y-p.y)*f):(s=(e.max.y-p.y)*f,o=(e.min.y-p.y)*f),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(e.min.z-p.z)*h,u=(e.max.z-p.z)*h):(a=(e.max.z-p.z)*h,u=(e.min.z-p.z)*h),i>u||a>r)||((a>i||i!==i)&&(i=a),(u<r||r!==r)&&(r=u),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Gs)!==null}intersectTriangle(e,t,i,r,s){t_.subVectors(t,e),Tp.subVectors(i,e),n_.crossVectors(t_,Tp);let o=this.direction.dot(n_),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Po.subVectors(this.origin,e);const u=a*this.direction.dot(Tp.crossVectors(Po,Tp));if(u<0)return null;const d=a*this.direction.dot(t_.cross(Po));if(d<0||u+d>o)return null;const f=-a*Po.dot(n_);return f<0?null:this.at(f/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 ht{constructor(e,t,i,r,s,o,a,u,d,f,h,p,g,y,w,x){ht.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,u,d,f,h,p,g,y,w,x)}set(e,t,i,r,s,o,a,u,d,f,h,p,g,y,w,x){const v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=r,v[1]=s,v[5]=o,v[9]=a,v[13]=u,v[2]=d,v[6]=f,v[10]=h,v[14]=p,v[3]=g,v[7]=y,v[11]=w,v[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ht().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/jl.setFromMatrixColumn(e,0).length(),s=1/jl.setFromMatrixColumn(e,1).length(),o=1/jl.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),u=Math.cos(r),d=Math.sin(r),f=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*f,g=o*h,y=a*f,w=a*h;t[0]=u*f,t[4]=-u*h,t[8]=d,t[1]=g+y*d,t[5]=p-w*d,t[9]=-a*u,t[2]=w-p*d,t[6]=y+g*d,t[10]=o*u}else if(e.order==="YXZ"){const p=u*f,g=u*h,y=d*f,w=d*h;t[0]=p+w*a,t[4]=y*a-g,t[8]=o*d,t[1]=o*h,t[5]=o*f,t[9]=-a,t[2]=g*a-y,t[6]=w+p*a,t[10]=o*u}else if(e.order==="ZXY"){const p=u*f,g=u*h,y=d*f,w=d*h;t[0]=p-w*a,t[4]=-o*h,t[8]=y+g*a,t[1]=g+y*a,t[5]=o*f,t[9]=w-p*a,t[2]=-o*d,t[6]=a,t[10]=o*u}else if(e.order==="ZYX"){const p=o*f,g=o*h,y=a*f,w=a*h;t[0]=u*f,t[4]=y*d-g,t[8]=p*d+w,t[1]=u*h,t[5]=w*d+p,t[9]=g*d-y,t[2]=-d,t[6]=a*u,t[10]=o*u}else if(e.order==="YZX"){const p=o*u,g=o*d,y=a*u,w=a*d;t[0]=u*f,t[4]=w-p*h,t[8]=y*h+g,t[1]=h,t[5]=o*f,t[9]=-a*f,t[2]=-d*f,t[6]=g*h+y,t[10]=p-w*h}else if(e.order==="XZY"){const p=o*u,g=o*d,y=a*u,w=a*d;t[0]=u*f,t[4]=-h,t[8]=d*f,t[1]=p*h+w,t[5]=o*f,t[9]=g*h-y,t[2]=y*h-g,t[6]=a*f,t[10]=w*h+p}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(uk,e,dk)}lookAt(e,t,i){const r=this.elements;return Ki.subVectors(e,t),Ki.lengthSq()===0&&(Ki.z=1),Ki.normalize(),Io.crossVectors(i,Ki),Io.lengthSq()===0&&(Math.abs(i.z)===1?Ki.x+=1e-4:Ki.z+=1e-4,Ki.normalize(),Io.crossVectors(i,Ki)),Io.normalize(),Cp.crossVectors(Ki,Io),r[0]=Io.x,r[4]=Cp.x,r[8]=Ki.x,r[1]=Io.y,r[5]=Cp.y,r[9]=Ki.y,r[2]=Io.z,r[6]=Cp.z,r[10]=Ki.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],u=i[8],d=i[12],f=i[1],h=i[5],p=i[9],g=i[13],y=i[2],w=i[6],x=i[10],v=i[14],_=i[3],M=i[7],b=i[11],N=i[15],C=r[0],P=r[4],D=r[8],I=r[12],A=r[1],U=r[5],G=r[9],z=r[13],Z=r[2],J=r[6],ne=r[10],le=r[14],O=r[3],Y=r[7],K=r[11],ae=r[15];return s[0]=o*C+a*A+u*Z+d*O,s[4]=o*P+a*U+u*J+d*Y,s[8]=o*D+a*G+u*ne+d*K,s[12]=o*I+a*z+u*le+d*ae,s[1]=f*C+h*A+p*Z+g*O,s[5]=f*P+h*U+p*J+g*Y,s[9]=f*D+h*G+p*ne+g*K,s[13]=f*I+h*z+p*le+g*ae,s[2]=y*C+w*A+x*Z+v*O,s[6]=y*P+w*U+x*J+v*Y,s[10]=y*D+w*G+x*ne+v*K,s[14]=y*I+w*z+x*le+v*ae,s[3]=_*C+M*A+b*Z+N*O,s[7]=_*P+M*U+b*J+N*Y,s[11]=_*D+M*G+b*ne+N*K,s[15]=_*I+M*z+b*le+N*ae,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],u=e[9],d=e[13],f=e[2],h=e[6],p=e[10],g=e[14],y=e[3],w=e[7],x=e[11],v=e[15];return y*(+s*u*h-r*d*h-s*a*p+i*d*p+r*a*g-i*u*g)+w*(+t*u*g-t*d*p+s*o*p-r*o*g+r*d*f-s*u*f)+x*(+t*d*h-t*a*g-s*o*h+i*o*g+s*a*f-i*d*f)+v*(-r*a*f-t*u*h+t*a*p+r*o*h-i*o*p+i*u*f)}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],u=e[6],d=e[7],f=e[8],h=e[9],p=e[10],g=e[11],y=e[12],w=e[13],x=e[14],v=e[15],_=h*x*d-w*p*d+w*u*g-a*x*g-h*u*v+a*p*v,M=y*p*d-f*x*d-y*u*g+o*x*g+f*u*v-o*p*v,b=f*w*d-y*h*d+y*a*g-o*w*g-f*a*v+o*h*v,N=y*h*u-f*w*u-y*a*p+o*w*p+f*a*x-o*h*x,C=t*_+i*M+r*b+s*N;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/C;return e[0]=_*P,e[1]=(w*p*s-h*x*s-w*r*g+i*x*g+h*r*v-i*p*v)*P,e[2]=(a*x*s-w*u*s+w*r*d-i*x*d-a*r*v+i*u*v)*P,e[3]=(h*u*s-a*p*s-h*r*d+i*p*d+a*r*g-i*u*g)*P,e[4]=M*P,e[5]=(f*x*s-y*p*s+y*r*g-t*x*g-f*r*v+t*p*v)*P,e[6]=(y*u*s-o*x*s-y*r*d+t*x*d+o*r*v-t*u*v)*P,e[7]=(o*p*s-f*u*s+f*r*d-t*p*d-o*r*g+t*u*g)*P,e[8]=b*P,e[9]=(y*h*s-f*w*s-y*i*g+t*w*g+f*i*v-t*h*v)*P,e[10]=(o*w*s-y*a*s+y*i*d-t*w*d-o*i*v+t*a*v)*P,e[11]=(f*a*s-o*h*s-f*i*d+t*h*d+o*i*g-t*a*g)*P,e[12]=N*P,e[13]=(f*w*r-y*h*r+y*i*p-t*w*p-f*i*x+t*h*x)*P,e[14]=(y*a*r-o*w*r-y*i*u+t*w*u+o*i*x-t*a*x)*P,e[15]=(o*h*r-f*a*r+f*i*u-t*h*u-o*i*p+t*a*p)*P,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 e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,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,u=e.z,d=s*o,f=s*a;return this.set(d*o+i,d*a-r*u,d*u+r*a,0,d*a+r*u,f*a+i,f*u-r*o,0,d*u-r*a,f*u+r*o,s*u*u+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,u=t._w,d=s+s,f=o+o,h=a+a,p=s*d,g=s*f,y=s*h,w=o*f,x=o*h,v=a*h,_=u*d,M=u*f,b=u*h,N=i.x,C=i.y,P=i.z;return r[0]=(1-(w+v))*N,r[1]=(g+b)*N,r[2]=(y-M)*N,r[3]=0,r[4]=(g-b)*C,r[5]=(1-(p+v))*C,r[6]=(x+_)*C,r[7]=0,r[8]=(y+M)*P,r[9]=(x-_)*P,r[10]=(1-(p+w))*P,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=jl.set(r[0],r[1],r[2]).length();const o=jl.set(r[4],r[5],r[6]).length(),a=jl.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],jr.copy(this);const d=1/s,f=1/o,h=1/a;return jr.elements[0]*=d,jr.elements[1]*=d,jr.elements[2]*=d,jr.elements[4]*=f,jr.elements[5]*=f,jr.elements[6]*=f,jr.elements[8]*=h,jr.elements[9]*=h,jr.elements[10]*=h,t.setFromRotationMatrix(jr),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Ts){const u=this.elements,d=2*s/(t-e),f=2*s/(i-r),h=(t+e)/(t-e),p=(i+r)/(i-r);let g,y;if(a===Ts)g=-(o+s)/(o-s),y=-2*o*s/(o-s);else if(a===wf)g=-o/(o-s),y=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return u[0]=d,u[4]=0,u[8]=h,u[12]=0,u[1]=0,u[5]=f,u[9]=p,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=y,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Ts){const u=this.elements,d=1/(t-e),f=1/(i-r),h=1/(o-s),p=(t+e)*d,g=(i+r)*f;let y,w;if(a===Ts)y=(o+s)*h,w=-2*h;else if(a===wf)y=s*h,w=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return u[0]=2*d,u[4]=0,u[8]=0,u[12]=-p,u[1]=0,u[5]=2*f,u[9]=0,u[13]=-g,u[2]=0,u[6]=0,u[10]=w,u[14]=-y,u[3]=0,u[7]=0,u[11]=0,u[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 jl=new k,jr=new ht,uk=new k(0,0,0),dk=new k(1,1,1),Io=new k,Cp=new k,Ki=new k,vA=new ht,yA=new gi;class fr{constructor(e=0,t=0,i=0,r=fr.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],u=r[1],d=r[5],f=r[9],h=r[2],p=r[6],g=r[10];switch(t){case"XYZ":this._y=Math.asin(yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,d),this._z=0);break;case"YXZ":this._x=Math.asin(-yn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,g),this._z=Math.atan2(u,d)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(yn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,g),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-yn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(yn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,d),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,g));break;case"XZY":this._z=Math.asin(-yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,d),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-f,g),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 vA.makeRotationFromQuaternion(e),this.setFromRotationMatrix(vA,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return yA.setFromEuler(this),this.setFromQuaternion(yA,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}}fr.DEFAULT_ORDER="XYZ";class ol{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 fk=0;const _A=new k,Xl=new gi,Ws=new ht,Rp=new k,$u=new k,hk=new k,pk=new gi,xA=new k(1,0,0),SA=new k(0,1,0),wA=new k(0,0,1),MA={type:"added"},mk={type:"removed"},ql={type:"childadded",child:null},i_={type:"childremoved",child:null};class Bt extends Ds{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:fk++}),this.uuid=cr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Bt.DEFAULT_UP.clone();const e=new k,t=new fr,i=new gi,r=new k(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 ht},normalMatrix:{value:new Mt}}),this.matrix=new ht,this.matrixWorld=new ht,this.matrixAutoUpdate=Bt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ol,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Xl.setFromAxisAngle(e,t),this.quaternion.multiply(Xl),this}rotateOnWorldAxis(e,t){return Xl.setFromAxisAngle(e,t),this.quaternion.premultiply(Xl),this}rotateX(e){return this.rotateOnAxis(xA,e)}rotateY(e){return this.rotateOnAxis(SA,e)}rotateZ(e){return this.rotateOnAxis(wA,e)}translateOnAxis(e,t){return _A.copy(e).applyQuaternion(this.quaternion),this.position.add(_A.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xA,e)}translateY(e){return this.translateOnAxis(SA,e)}translateZ(e){return this.translateOnAxis(wA,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ws.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Rp.copy(e):Rp.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),$u.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ws.lookAt($u,Rp,this.up):Ws.lookAt(Rp,$u,this.up),this.quaternion.setFromRotationMatrix(Ws),r&&(Ws.extractRotation(r.matrixWorld),Xl.setFromRotationMatrix(Ws),this.quaternion.premultiply(Xl.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(MA),ql.child=e,this.dispatchEvent(ql),ql.child=null):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(mk),i_.child=e,this.dispatchEvent(i_),i_.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ws.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ws.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ws),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(MA),ql.child=e,this.dispatchEvent(ql),ql.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let 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,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($u,e,hk),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($u,pk,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.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,u){return a[u.uuid]===void 0&&(a[u.uuid]=u.toJSON(e)),u.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 u=a.shapes;if(Array.isArray(u))for(let d=0,f=u.length;d<f;d++){const h=u[d];s(e.shapes,h)}else s(e.shapes,u)}}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 u=0,d=this.material.length;u<d;u++)a.push(s(e.materials,this.material[u]));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 u=this.animations[a];r.animations.push(s(e.animations,u))}}if(t){const a=o(e.geometries),u=o(e.materials),d=o(e.textures),f=o(e.images),h=o(e.shapes),p=o(e.skeletons),g=o(e.animations),y=o(e.nodes);a.length>0&&(i.geometries=a),u.length>0&&(i.materials=u),d.length>0&&(i.textures=d),f.length>0&&(i.images=f),h.length>0&&(i.shapes=h),p.length>0&&(i.skeletons=p),g.length>0&&(i.animations=g),y.length>0&&(i.nodes=y)}return i.object=r,i;function o(a){const u=[];for(const d in a){const f=a[d];delete f.metadata,u.push(f)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Bt.DEFAULT_UP=new k(0,1,0);Bt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Xr=new k,js=new k,r_=new k,Xs=new k,Yl=new k,$l=new k,EA=new k,s_=new k,o_=new k,a_=new k;class sr{constructor(e=new k,t=new k,i=new k){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Xr.subVectors(e,t),r.cross(Xr);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){Xr.subVectors(r,t),js.subVectors(i,t),r_.subVectors(e,t);const o=Xr.dot(Xr),a=Xr.dot(js),u=Xr.dot(r_),d=js.dot(js),f=js.dot(r_),h=o*d-a*a;if(h===0)return s.set(0,0,0),null;const p=1/h,g=(d*u-a*f)*p,y=(o*f-a*u)*p;return s.set(1-g-y,y,g)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Xs)===null?!1:Xs.x>=0&&Xs.y>=0&&Xs.x+Xs.y<=1}static getInterpolation(e,t,i,r,s,o,a,u){return this.getBarycoord(e,t,i,r,Xs)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,Xs.x),u.addScaledVector(o,Xs.y),u.addScaledVector(a,Xs.z),u)}static isFrontFacing(e,t,i,r){return Xr.subVectors(i,t),js.subVectors(e,t),Xr.cross(js).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 Xr.subVectors(this.c,this.b),js.subVectors(this.a,this.b),Xr.cross(js).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return sr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return sr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return sr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return sr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return sr.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;Yl.subVectors(r,i),$l.subVectors(s,i),s_.subVectors(e,i);const u=Yl.dot(s_),d=$l.dot(s_);if(u<=0&&d<=0)return t.copy(i);o_.subVectors(e,r);const f=Yl.dot(o_),h=$l.dot(o_);if(f>=0&&h<=f)return t.copy(r);const p=u*h-f*d;if(p<=0&&u>=0&&f<=0)return o=u/(u-f),t.copy(i).addScaledVector(Yl,o);a_.subVectors(e,s);const g=Yl.dot(a_),y=$l.dot(a_);if(y>=0&&g<=y)return t.copy(s);const w=g*d-u*y;if(w<=0&&d>=0&&y<=0)return a=d/(d-y),t.copy(i).addScaledVector($l,a);const x=f*y-g*h;if(x<=0&&h-f>=0&&g-y>=0)return EA.subVectors(s,r),a=(h-f)/(h-f+(g-y)),t.copy(r).addScaledVector(EA,a);const v=1/(x+w+p);return o=w*v,a=p*v,t.copy(i).addScaledVector(Yl,o).addScaledVector($l,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const L2={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},Lo={h:0,s:0,l:0},Pp={h:0,s:0,l:0};function l_(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 Xe{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=br){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Gt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Gt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Gt.workingColorSpace){if(e=_1(e,1),t=yn(t,0,1),i=yn(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=l_(o,s,e+1/3),this.g=l_(o,s,e),this.b=l_(o,s,e-1/3)}return Gt.toWorkingColorSpace(this,r),this}setStyle(e,t=br){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 i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],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=br){const i=L2[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=Yc(e.r),this.g=Yc(e.g),this.b=Yc(e.b),this}copyLinearToSRGB(e){return this.r=$y(e.r),this.g=$y(e.g),this.b=$y(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=br){return Gt.fromWorkingColorSpace(fi.copy(this),e),Math.round(yn(fi.r*255,0,255))*65536+Math.round(yn(fi.g*255,0,255))*256+Math.round(yn(fi.b*255,0,255))}getHexString(e=br){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gt.workingColorSpace){Gt.fromWorkingColorSpace(fi.copy(this),t);const i=fi.r,r=fi.g,s=fi.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let u,d;const f=(a+o)/2;if(a===o)u=0,d=0;else{const h=o-a;switch(d=f<=.5?h/(o+a):h/(2-o-a),o){case i:u=(r-s)/h+(r<s?6:0);break;case r:u=(s-i)/h+2;break;case s:u=(i-r)/h+4;break}u/=6}return e.h=u,e.s=d,e.l=f,e}getRGB(e,t=Gt.workingColorSpace){return Gt.fromWorkingColorSpace(fi.copy(this),t),e.r=fi.r,e.g=fi.g,e.b=fi.b,e}getStyle(e=br){Gt.fromWorkingColorSpace(fi.copy(this),e);const t=fi.r,i=fi.g,r=fi.b;return e!==br?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(Lo),this.setHSL(Lo.h+e,Lo.s+t,Lo.l+i)}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(Lo),e.getHSL(Pp);const i=kd(Lo.h,Pp.h,t),r=kd(Lo.s,Pp.s,t),s=kd(Lo.l,Pp.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 fi=new Xe;Xe.NAMES=L2;let gk=0;class ii extends Ds{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gk++}),this.uuid=cr(),this.name="",this.type="Material",this.blending=il,this.side=uo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jg,this.blendDst=Kg,this.blendEquation=Go,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xe(0,0,0),this.blendAlpha=0,this.depthFunc=uf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=NS,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ba,this.stencilZFail=Ba,this.stencilZPass=Ba,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.6,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!==void 0&&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.dispersion!==void 0&&(i.dispersion=this.dispersion),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.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.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.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),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!==il&&(i.blending=this.blending),this.side!==uo&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Jg&&(i.blendSrc=this.blendSrc),this.blendDst!==Kg&&(i.blendDst=this.blendDst),this.blendEquation!==Go&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==uf&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==NS&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ba&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ba&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ba&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),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.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),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=!0),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 u=s[a];delete u.metadata,o.push(u)}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let 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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class mo extends ii{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new fr,this.combine=Hf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const eo=vk();function vk(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let u=0;u<256;++u){const d=u-127;d<-27?(i[u]=0,i[u|256]=32768,r[u]=24,r[u|256]=24):d<-14?(i[u]=1024>>-d-14,i[u|256]=1024>>-d-14|32768,r[u]=-d-1,r[u|256]=-d-1):d<=15?(i[u]=d+15<<10,i[u|256]=d+15<<10|32768,r[u]=13,r[u|256]=13):d<128?(i[u]=31744,i[u|256]=64512,r[u]=24,r[u|256]=24):(i[u]=31744,i[u|256]=64512,r[u]=13,r[u|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let u=1;u<1024;++u){let d=u<<13,f=0;for(;!(d&8388608);)d<<=1,f-=8388608;d&=-8388609,f+=947912704,s[u]=d|f}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)o[u]=u<<23;o[31]=1199570944,o[32]=2147483648;for(let u=33;u<63;++u)o[u]=2147483648+(u-32<<23);o[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(a[u]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Fi(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=yn(n,-65504,65504),eo.floatView[0]=n;const e=eo.uint32View[0],t=e>>23&511;return eo.baseTable[t]+((e&8388607)>>eo.shiftTable[t])}function Ed(n){const e=n>>10;return eo.uint32View[0]=eo.mantissaTable[eo.offsetTable[e]+(n&1023)]+eo.exponentTable[e],eo.floatView[0]}const yk={toHalfFloat:Fi,fromHalfFloat:Ed},Rn=new k,Ip=new Ee;class Lt{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=Sf,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ir,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return R2("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,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++)Ip.fromBufferAttribute(this,t),Ip.applyMatrix3(e),this.setXY(t,Ip.x,Ip.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Rn.fromBufferAttribute(this,t),Rn.applyMatrix3(e),this.setXYZ(t,Rn.x,Rn.y,Rn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Rn.fromBufferAttribute(this,t),Rn.applyMatrix4(e),this.setXYZ(t,Rn.x,Rn.y,Rn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Rn.fromBufferAttribute(this,t),Rn.applyNormalMatrix(e),this.setXYZ(t,Rn.x,Rn.y,Rn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Rn.fromBufferAttribute(this,t),Rn.transformDirection(e),this.setXYZ(t,Rn.x,Rn.y,Rn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Ci(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Et(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ci(t,this.array)),t}setX(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ci(t,this.array)),t}setY(e,t){return this.normalized&&(t=Et(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=Ci(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Et(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=Ci(t,this.array)),t}setW(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),i=Et(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=Et(t,this.array),i=Et(i,this.array),r=Et(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=Et(t,this.array),i=Et(i,this.array),r=Et(r,this.array),s=Et(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!==Sf&&(e.usage=this.usage),e}}class _k extends Lt{constructor(e,t,i){super(new Int8Array(e),t,i)}}class xk extends Lt{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class Sk extends Lt{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class wk extends Lt{constructor(e,t,i){super(new Int16Array(e),t,i)}}class S1 extends Lt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class Mk extends Lt{constructor(e,t,i){super(new Int32Array(e),t,i)}}class w1 extends Lt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class Ek extends Lt{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=Ed(this.array[e*this.itemSize]);return this.normalized&&(t=Ci(t,this.array)),t}setX(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize]=Fi(t),this}getY(e){let t=Ed(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ci(t,this.array)),t}setY(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+1]=Fi(t),this}getZ(e){let t=Ed(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ci(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+2]=Fi(t),this}getW(e){let t=Ed(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ci(t,this.array)),t}setW(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+3]=Fi(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),i=Et(i,this.array)),this.array[e+0]=Fi(t),this.array[e+1]=Fi(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),i=Et(i,this.array),r=Et(r,this.array)),this.array[e+0]=Fi(t),this.array[e+1]=Fi(i),this.array[e+2]=Fi(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),i=Et(i,this.array),r=Et(r,this.array),s=Et(s,this.array)),this.array[e+0]=Fi(t),this.array[e+1]=Fi(i),this.array[e+2]=Fi(r),this.array[e+3]=Fi(s),this}}class Ze extends Lt{constructor(e,t,i){super(new Float32Array(e),t,i)}}let bk=0;const Mr=new ht,c_=new Bt,Zl=new k,Qi=new ei,Zu=new ei,Xn=new k;class mt extends Ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:bk++}),this.uuid=cr(),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(T2(e)?w1:S1)(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 Mt().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 Mr.makeRotationFromQuaternion(e),this.applyMatrix4(Mr),this}rotateX(e){return Mr.makeRotationX(e),this.applyMatrix4(Mr),this}rotateY(e){return Mr.makeRotationY(e),this.applyMatrix4(Mr),this}rotateZ(e){return Mr.makeRotationZ(e),this.applyMatrix4(Mr),this}translate(e,t,i){return Mr.makeTranslation(e,t,i),this.applyMatrix4(Mr),this}scale(e,t,i){return Mr.makeScale(e,t,i),this.applyMatrix4(Mr),this}lookAt(e){return c_.lookAt(e),c_.updateMatrix(),this.applyMatrix4(c_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zl).negate(),this.translate(Zl.x,Zl.y,Zl.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 Ze(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ei);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new k(-1/0,-1/0,-1/0),new k(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];Qi.setFromBufferAttribute(s),this.morphTargetsRelative?(Xn.addVectors(this.boundingBox.min,Qi.min),this.boundingBox.expandByPoint(Xn),Xn.addVectors(this.boundingBox.max,Qi.max),this.boundingBox.expandByPoint(Xn)):(this.boundingBox.expandByPoint(Qi.min),this.boundingBox.expandByPoint(Qi.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 vi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new k,1/0);return}if(e){const i=this.boundingSphere.center;if(Qi.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];Zu.setFromBufferAttribute(a),this.morphTargetsRelative?(Xn.addVectors(Qi.min,Zu.min),Qi.expandByPoint(Xn),Xn.addVectors(Qi.max,Zu.max),Qi.expandByPoint(Xn)):(Qi.expandByPoint(Zu.min),Qi.expandByPoint(Zu.max))}Qi.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Xn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Xn));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],u=this.morphTargetsRelative;for(let d=0,f=a.count;d<f;d++)Xn.fromBufferAttribute(a,d),u&&(Zl.fromBufferAttribute(e,d),Xn.add(Zl)),r=Math.max(r,i.distanceToSquared(Xn))}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=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Lt(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],u=[];for(let D=0;D<i.count;D++)a[D]=new k,u[D]=new k;const d=new k,f=new k,h=new k,p=new Ee,g=new Ee,y=new Ee,w=new k,x=new k;function v(D,I,A){d.fromBufferAttribute(i,D),f.fromBufferAttribute(i,I),h.fromBufferAttribute(i,A),p.fromBufferAttribute(s,D),g.fromBufferAttribute(s,I),y.fromBufferAttribute(s,A),f.sub(d),h.sub(d),g.sub(p),y.sub(p);const U=1/(g.x*y.y-y.x*g.y);isFinite(U)&&(w.copy(f).multiplyScalar(y.y).addScaledVector(h,-g.y).multiplyScalar(U),x.copy(h).multiplyScalar(g.x).addScaledVector(f,-y.x).multiplyScalar(U),a[D].add(w),a[I].add(w),a[A].add(w),u[D].add(x),u[I].add(x),u[A].add(x))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let D=0,I=_.length;D<I;++D){const A=_[D],U=A.start,G=A.count;for(let z=U,Z=U+G;z<Z;z+=3)v(e.getX(z+0),e.getX(z+1),e.getX(z+2))}const M=new k,b=new k,N=new k,C=new k;function P(D){N.fromBufferAttribute(r,D),C.copy(N);const I=a[D];M.copy(I),M.sub(N.multiplyScalar(N.dot(I))).normalize(),b.crossVectors(C,I);const U=b.dot(u[D])<0?-1:1;o.setXYZW(D,M.x,M.y,M.z,U)}for(let D=0,I=_.length;D<I;++D){const A=_[D],U=A.start,G=A.count;for(let z=U,Z=U+G;z<Z;z+=3)P(e.getX(z+0)),P(e.getX(z+1)),P(e.getX(z+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 Lt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let p=0,g=i.count;p<g;p++)i.setXYZ(p,0,0,0);const r=new k,s=new k,o=new k,a=new k,u=new k,d=new k,f=new k,h=new k;if(e)for(let p=0,g=e.count;p<g;p+=3){const y=e.getX(p+0),w=e.getX(p+1),x=e.getX(p+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,x),f.subVectors(o,s),h.subVectors(r,s),f.cross(h),a.fromBufferAttribute(i,y),u.fromBufferAttribute(i,w),d.fromBufferAttribute(i,x),a.add(f),u.add(f),d.add(f),i.setXYZ(y,a.x,a.y,a.z),i.setXYZ(w,u.x,u.y,u.z),i.setXYZ(x,d.x,d.y,d.z)}else for(let p=0,g=t.count;p<g;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),f.subVectors(o,s),h.subVectors(r,s),f.cross(h),i.setXYZ(p+0,f.x,f.y,f.z),i.setXYZ(p+1,f.x,f.y,f.z),i.setXYZ(p+2,f.x,f.y,f.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Xn.fromBufferAttribute(e,t),Xn.normalize(),e.setXYZ(t,Xn.x,Xn.y,Xn.z)}toNonIndexed(){function e(a,u){const d=a.array,f=a.itemSize,h=a.normalized,p=new d.constructor(u.length*f);let g=0,y=0;for(let w=0,x=u.length;w<x;w++){a.isInterleavedBufferAttribute?g=u[w]*a.data.stride+a.offset:g=u[w]*f;for(let v=0;v<f;v++)p[y++]=d[g++]}return new Lt(p,f,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new mt,i=this.index.array,r=this.attributes;for(const a in r){const u=r[a],d=e(u,i);t.setAttribute(a,d)}const s=this.morphAttributes;for(const a in s){const u=[],d=s[a];for(let f=0,h=d.length;f<h;f++){const p=d[f],g=e(p,i);u.push(g)}t.morphAttributes[a]=u}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,u=o.length;a<u;a++){const d=o[a];t.addGroup(d.start,d.count,d.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const d in u)u[d]!==void 0&&(e[d]=u[d]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const u in i){const d=i[u];e.data.attributes[u]=d.toJSON(e.data)}const r={};let s=!1;for(const u in this.morphAttributes){const d=this.morphAttributes[u],f=[];for(let h=0,p=d.length;h<p;h++){const g=d[h];f.push(g.toJSON(e.data))}f.length>0&&(r[u]=f,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 d in r){const f=r[d];this.setAttribute(d,f.clone(t))}const s=e.morphAttributes;for(const d in s){const f=[],h=s[d];for(let p=0,g=h.length;p<g;p++)f.push(h[p].clone(t));this.morphAttributes[d]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,f=o.length;d<f;d++){const h=o[d];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const bA=new ht,Aa=new fu,Lp=new vi,AA=new k,Jl=new k,Kl=new k,Ql=new k,u_=new k,Np=new k,Dp=new Ee,Op=new Ee,Up=new Ee,TA=new k,CA=new k,RA=new k,Fp=new k,kp=new k;class Mn extends Bt{constructor(e=new mt,t=new mo){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,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){Np.set(0,0,0);for(let u=0,d=s.length;u<d;u++){const f=a[u],h=s[u];f!==0&&(u_.fromBufferAttribute(h,e),o?Np.addScaledVector(u_,f):Np.addScaledVector(u_.sub(t),f))}t.add(Np)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Lp.copy(i.boundingSphere),Lp.applyMatrix4(s),Aa.copy(e.ray).recast(e.near),!(Lp.containsPoint(Aa.origin)===!1&&(Aa.intersectSphere(Lp,AA)===null||Aa.origin.distanceToSquared(AA)>(e.far-e.near)**2))&&(bA.copy(s).invert(),Aa.copy(e.ray).applyMatrix4(bA),!(i.boundingBox!==null&&Aa.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Aa)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,u=s.attributes.position,d=s.attributes.uv,f=s.attributes.uv1,h=s.attributes.normal,p=s.groups,g=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=p.length;y<w;y++){const x=p[y],v=o[x.materialIndex],_=Math.max(x.start,g.start),M=Math.min(a.count,Math.min(x.start+x.count,g.start+g.count));for(let b=_,N=M;b<N;b+=3){const C=a.getX(b),P=a.getX(b+1),D=a.getX(b+2);r=zp(this,v,e,i,d,f,h,C,P,D),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=x.materialIndex,t.push(r))}}else{const y=Math.max(0,g.start),w=Math.min(a.count,g.start+g.count);for(let x=y,v=w;x<v;x+=3){const _=a.getX(x),M=a.getX(x+1),b=a.getX(x+2);r=zp(this,o,e,i,d,f,h,_,M,b),r&&(r.faceIndex=Math.floor(x/3),t.push(r))}}else if(u!==void 0)if(Array.isArray(o))for(let y=0,w=p.length;y<w;y++){const x=p[y],v=o[x.materialIndex],_=Math.max(x.start,g.start),M=Math.min(u.count,Math.min(x.start+x.count,g.start+g.count));for(let b=_,N=M;b<N;b+=3){const C=b,P=b+1,D=b+2;r=zp(this,v,e,i,d,f,h,C,P,D),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=x.materialIndex,t.push(r))}}else{const y=Math.max(0,g.start),w=Math.min(u.count,g.start+g.count);for(let x=y,v=w;x<v;x+=3){const _=x,M=x+1,b=x+2;r=zp(this,o,e,i,d,f,h,_,M,b),r&&(r.faceIndex=Math.floor(x/3),t.push(r))}}}}function Ak(n,e,t,i,r,s,o,a){let u;if(e.side===Pi?u=i.intersectTriangle(o,s,r,!0,a):u=i.intersectTriangle(r,s,o,e.side===uo,a),u===null)return null;kp.copy(a),kp.applyMatrix4(n.matrixWorld);const d=t.ray.origin.distanceTo(kp);return d<t.near||d>t.far?null:{distance:d,point:kp.clone(),object:n}}function zp(n,e,t,i,r,s,o,a,u,d){n.getVertexPosition(a,Jl),n.getVertexPosition(u,Kl),n.getVertexPosition(d,Ql);const f=Ak(n,e,t,i,Jl,Kl,Ql,Fp);if(f){r&&(Dp.fromBufferAttribute(r,a),Op.fromBufferAttribute(r,u),Up.fromBufferAttribute(r,d),f.uv=sr.getInterpolation(Fp,Jl,Kl,Ql,Dp,Op,Up,new Ee)),s&&(Dp.fromBufferAttribute(s,a),Op.fromBufferAttribute(s,u),Up.fromBufferAttribute(s,d),f.uv1=sr.getInterpolation(Fp,Jl,Kl,Ql,Dp,Op,Up,new Ee)),o&&(TA.fromBufferAttribute(o,a),CA.fromBufferAttribute(o,u),RA.fromBufferAttribute(o,d),f.normal=sr.getInterpolation(Fp,Jl,Kl,Ql,TA,CA,RA,new k),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const h={a,b:u,c:d,normal:new k,materialIndex:0};sr.getNormal(Jl,Kl,Ql,h.normal),f.face=h}return f}class Sl extends mt{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 u=[],d=[],f=[],h=[];let p=0,g=0;y("z","y","x",-1,-1,i,t,e,o,s,0),y("z","y","x",1,-1,i,t,-e,o,s,1),y("x","z","y",1,1,e,i,t,r,o,2),y("x","z","y",1,-1,e,i,-t,r,o,3),y("x","y","z",1,-1,e,t,i,r,s,4),y("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(u),this.setAttribute("position",new Ze(d,3)),this.setAttribute("normal",new Ze(f,3)),this.setAttribute("uv",new Ze(h,2));function y(w,x,v,_,M,b,N,C,P,D,I){const A=b/P,U=N/D,G=b/2,z=N/2,Z=C/2,J=P+1,ne=D+1;let le=0,O=0;const Y=new k;for(let K=0;K<ne;K++){const ae=K*U-z;for(let ge=0;ge<J;ge++){const Ue=ge*A-G;Y[w]=Ue*_,Y[x]=ae*M,Y[v]=Z,d.push(Y.x,Y.y,Y.z),Y[w]=0,Y[x]=0,Y[v]=C>0?1:-1,f.push(Y.x,Y.y,Y.z),h.push(ge/P),h.push(1-K/D),le+=1}}for(let K=0;K<D;K++)for(let ae=0;ae<P;ae++){const ge=p+ae+J*K,Ue=p+ae+J*(K+1),se=p+(ae+1)+J*(K+1),xe=p+(ae+1)+J*K;u.push(ge,Ue,xe),u.push(Ue,se,xe),O+=6}a.addGroup(g,O,I),g+=O,p+=le}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sl(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ru(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 bi(n){const e={};for(let t=0;t<n.length;t++){const i=ru(n[t]);for(const r in i)e[r]=i[r]}return e}function Tk(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function N2(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Gt.workingColorSpace}const D2={clone:ru,merge:bi};var Ck=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Rk=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class as extends ii{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Ck,this.fragmentShader=Rk,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ru(e.uniforms),this.uniformsGroups=Tk(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,t.lights=this.lights,t.clipping=this.clipping;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}}let jf=class extends Bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ht,this.projectionMatrix=new ht,this.projectionMatrixInverse=new ht,this.coordinateSystem=Ts}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};const No=new k,PA=new Ee,IA=new Ee;class sn extends jf{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=iu*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(sl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return iu*2*Math.atan(Math.tan(sl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){No.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(No.x,No.y).multiplyScalar(-e/No.z),No.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(No.x,No.y).multiplyScalar(-e/No.z)}getViewSize(e,t){return this.getViewBounds(e,PA,IA),t.subVectors(IA,PA)}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(sl*.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 u=o.fullWidth,d=o.fullHeight;s+=o.offsetX*r/u,t-=o.offsetY*i/d,r*=o.width/u,i*=o.height/d}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ec=-90,tc=1;class O2 extends Bt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new sn(ec,tc,e,t);r.layers=this.layers,this.add(r);const s=new sn(ec,tc,e,t);s.layers=this.layers,this.add(s);const o=new sn(ec,tc,e,t);o.layers=this.layers,this.add(o);const a=new sn(ec,tc,e,t);a.layers=this.layers,this.add(a);const u=new sn(ec,tc,e,t);u.layers=this.layers,this.add(u);const d=new sn(ec,tc,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,u]=t;for(const d of t)this.remove(d);if(e===Ts)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===wf)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of t)this.add(d),d.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,u,d,f]=this.children,h=e.getRenderTarget(),p=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const w=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,u),e.setRenderTarget(i,4,r),e.render(t,d),i.texture.generateMipmaps=w,e.setRenderTarget(i,5,r),e.render(t,f),e.setRenderTarget(h,p,g),e.xr.enabled=y,i.texture.needsPMREMUpdate=!0}}class Xf extends hn{constructor(e,t,i,r,s,o,a,u,d,f){e=e!==void 0?e:[],t=t!==void 0?t:fo,super(e,t,i,r,s,o,a,u,d,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class U2 extends os{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 Xf(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:In}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const 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 Sl(5,5,5),s=new as({name:"CubemapFromEquirect",uniforms:ru(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Pi,blending:so});s.uniforms.tEquirect.value=t;const o=new Mn(r,s),a=t.minFilter;return t.minFilter===As&&(t.minFilter=In),new O2(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 d_=new k,Pk=new k,Ik=new Mt;class Bo{constructor(e=new k(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=d_.subVectors(i,t).cross(Pk.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(d_),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||Ik.getNormalMatrix(e),r=this.coplanarPoint(d_).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 Ta=new vi,Bp=new k;class qf{constructor(e=new Bo,t=new Bo,i=new Bo,r=new Bo,s=new Bo,o=new Bo){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,t=Ts){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],u=r[3],d=r[4],f=r[5],h=r[6],p=r[7],g=r[8],y=r[9],w=r[10],x=r[11],v=r[12],_=r[13],M=r[14],b=r[15];if(i[0].setComponents(u-s,p-d,x-g,b-v).normalize(),i[1].setComponents(u+s,p+d,x+g,b+v).normalize(),i[2].setComponents(u+o,p+f,x+y,b+_).normalize(),i[3].setComponents(u-o,p-f,x-y,b-_).normalize(),i[4].setComponents(u-a,p-h,x-w,b-M).normalize(),t===Ts)i[5].setComponents(u+a,p+h,x+w,b+M).normalize();else if(t===wf)i[5].setComponents(a,h,w,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ta.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ta.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ta)}intersectsSprite(e){return Ta.center.set(0,0,0),Ta.radius=.7071067811865476,Ta.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ta)}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(Bp.x=r.normal.x>0?e.max.x:e.min.x,Bp.y=r.normal.y>0?e.max.y:e.min.y,Bp.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Bp)<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 F2(){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 Lk(n){const e=new WeakMap;function t(a,u){const d=a.array,f=a.usage,h=d.byteLength,p=n.createBuffer();n.bindBuffer(u,p),n.bufferData(u,d,f),a.onUploadCallback();let g;if(d instanceof Float32Array)g=n.FLOAT;else if(d instanceof Uint16Array)a.isFloat16BufferAttribute?g=n.HALF_FLOAT:g=n.UNSIGNED_SHORT;else if(d instanceof Int16Array)g=n.SHORT;else if(d instanceof Uint32Array)g=n.UNSIGNED_INT;else if(d instanceof Int32Array)g=n.INT;else if(d instanceof Int8Array)g=n.BYTE;else if(d instanceof Uint8Array)g=n.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)g=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:p,type:g,bytesPerElement:d.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,u,d){const f=u.array,h=u._updateRange,p=u.updateRanges;if(n.bindBuffer(d,a),h.count===-1&&p.length===0&&n.bufferSubData(d,0,f),p.length!==0){for(let g=0,y=p.length;g<y;g++){const w=p[g];n.bufferSubData(d,w.start*f.BYTES_PER_ELEMENT,f,w.start,w.count)}u.clearUpdateRanges()}h.count!==-1&&(n.bufferSubData(d,h.offset*f.BYTES_PER_ELEMENT,f,h.offset,h.count),h.count=-1),u.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const u=e.get(a);u&&(n.deleteBuffer(u.buffer),e.delete(a))}function o(a,u){if(a.isGLBufferAttribute){const f=e.get(a);(!f||f.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}a.isInterleavedBufferAttribute&&(a=a.data);const d=e.get(a);if(d===void 0)e.set(a,t(a,u));else if(d.version<a.version){if(d.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(d.buffer,a,u),d.version=a.version}}return{get:r,remove:s,update:o}}class hu extends mt{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),u=Math.floor(r),d=a+1,f=u+1,h=e/a,p=t/u,g=[],y=[],w=[],x=[];for(let v=0;v<f;v++){const _=v*p-o;for(let M=0;M<d;M++){const b=M*h-s;y.push(b,-_,0),w.push(0,0,1),x.push(M/a),x.push(1-v/u)}}for(let v=0;v<u;v++)for(let _=0;_<a;_++){const M=_+d*v,b=_+d*(v+1),N=_+1+d*(v+1),C=_+1+d*v;g.push(M,b,C),g.push(b,N,C)}this.setIndex(g),this.setAttribute("position",new Ze(y,3)),this.setAttribute("normal",new Ze(w,3)),this.setAttribute("uv",new Ze(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hu(e.width,e.height,e.widthSegments,e.heightSegments)}}var Nk=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,Dk=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,Ok=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,Uk=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Fk=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,kk=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,zk=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,Bk=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,Vk=`#ifdef USE_BATCHING
	attribute float batchId;
	uniform highp sampler2D batchingTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,Hk=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( batchId );
#endif`,Gk=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,Wk=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,jk=`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`,Xk=`#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 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`,qk=`#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 = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( 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`,Yk=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#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
#endif`,$k=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Zk=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,Jk=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,Kk=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,Qk=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,ez=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	varying vec3 vColor;
#endif`,tz=`#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`,nz=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
float luminance( const in vec3 rgb ) {
	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
	return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,iz=`#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_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#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`,rz=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,sz=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,oz=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,az=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,lz=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,cz="gl_FragColor = linearToOutputTexel( gl_FragColor );",uz=`
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
	vec3( 0.8224621, 0.177538, 0.0 ),
	vec3( 0.0331941, 0.9668058, 0.0 ),
	vec3( 0.0170827, 0.0723974, 0.9105199 )
);
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
	vec3( 1.2249401, - 0.2249404, 0.0 ),
	vec3( - 0.0420569, 1.0420571, 0.0 ),
	vec3( - 0.0196376, - 0.0786361, 1.0982735 )
);
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
	return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
}
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
	return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
}
vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 LinearToLinear( in vec4 value ) {
	return value;
}
vec4 LinearTosRGB( in vec4 value ) {
	return sRGBTransferOETF( value );
}`,dz=`#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, envMapRotation * 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`,fz=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,hz=`#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`,pz=`#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`,mz=`#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`,gz=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,vz=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,yz=`#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`,_z=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,xz=`#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
}`,Sz=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,wz=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,Mz=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,Ez=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	#if defined ( LEGACY_LIGHTS )
		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
		}
		return 1.0;
	#else
		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
		if ( cutoffDistance > 0.0 ) {
			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
		}
		return distanceFalloff;
	#endif
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,bz=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,Az=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,Tz=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Cz=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,Rz=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Pz=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,Iz=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,Lz=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,Nz=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,Dz=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,Oz=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Uz=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Fz=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,kz=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,zz=`#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`,Bz=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,Vz=`#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`,Hz=`#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`,Gz=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,Wz=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,jz=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[MORPHTARGETS_COUNT];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,Xz=`#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`,qz=`#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`,Yz=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
	#endif
	#ifdef MORPHTARGETS_TEXTURE
		#ifndef USE_INSTANCING_MORPH
			uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
		#endif
		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`,$z=`#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`,Zz=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,Jz=`#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`,Kz=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Qz=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,e4=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,t4=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,n4=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,i4=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,r4=`#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`,s4=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,o4=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,a4=`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 );
}`,l4=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,c4=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,u4=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,d4=`#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`,f4=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,h4=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,p4=`#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 ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					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
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return shadow;
	}
#endif`,m4=`#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`,g4=`#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`,v4=`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;
}`,y4=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,_4=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,x4=`#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`,S4=`#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`,w4=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,M4=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,E4=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,b4=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,A4=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,T4=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], 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 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		
		#else
		
			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;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,C4=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,R4=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,P4=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,I4=`#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_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const L4=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,N4=`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 <colorspace_fragment>
}`,D4=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,O4=`#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;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * 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 <colorspace_fragment>
}`,U4=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,F4=`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 <colorspace_fragment>
}`,k4=`#include <common>
#include <batching_pars_vertex>
#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 <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_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;
}`,z4=`#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 <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_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
}`,B4=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#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 <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_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;
}`,V4=`#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 <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,H4=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,G4=`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 <colorspace_fragment>
}`,W4=`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 <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,j4=`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() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,X4=`#include <common>
#include <batching_pars_vertex>
#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 <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_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>
}`,q4=`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 <alphahash_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() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_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 <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Y4=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#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 <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_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>
}`,$4=`#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 <alphahash_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() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	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 <alphahash_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 <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Z4=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#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 <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_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;
}`,J4=`#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 <alphahash_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() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_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 <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,K4=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#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 <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_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
}`,Q4=`#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() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,eB=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#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 <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_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>
}`,tB=`#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 <alphahash_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() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	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 <alphahash_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 <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,nB=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#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 <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_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
}`,iB=`#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_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <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 <alphahash_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() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	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 <alphahash_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 + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,rB=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#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 <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_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>
}`,sB=`#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 <alphahash_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() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	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 <alphahash_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 <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,oB=`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 <morphinstance_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>
}`,aB=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,lB=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_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>
}`,cB=`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 <colorspace_fragment>
	#include <fog_fragment>
}`,uB=`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>
}`,dB=`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 <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,At={alphahash_fragment:Nk,alphahash_pars_fragment:Dk,alphamap_fragment:Ok,alphamap_pars_fragment:Uk,alphatest_fragment:Fk,alphatest_pars_fragment:kk,aomap_fragment:zk,aomap_pars_fragment:Bk,batching_pars_vertex:Vk,batching_vertex:Hk,begin_vertex:Gk,beginnormal_vertex:Wk,bsdfs:jk,iridescence_fragment:Xk,bumpmap_pars_fragment:qk,clipping_planes_fragment:Yk,clipping_planes_pars_fragment:$k,clipping_planes_pars_vertex:Zk,clipping_planes_vertex:Jk,color_fragment:Kk,color_pars_fragment:Qk,color_pars_vertex:ez,color_vertex:tz,common:nz,cube_uv_reflection_fragment:iz,defaultnormal_vertex:rz,displacementmap_pars_vertex:sz,displacementmap_vertex:oz,emissivemap_fragment:az,emissivemap_pars_fragment:lz,colorspace_fragment:cz,colorspace_pars_fragment:uz,envmap_fragment:dz,envmap_common_pars_fragment:fz,envmap_pars_fragment:hz,envmap_pars_vertex:pz,envmap_physical_pars_fragment:bz,envmap_vertex:mz,fog_vertex:gz,fog_pars_vertex:vz,fog_fragment:yz,fog_pars_fragment:_z,gradientmap_pars_fragment:xz,lightmap_pars_fragment:Sz,lights_lambert_fragment:wz,lights_lambert_pars_fragment:Mz,lights_pars_begin:Ez,lights_toon_fragment:Az,lights_toon_pars_fragment:Tz,lights_phong_fragment:Cz,lights_phong_pars_fragment:Rz,lights_physical_fragment:Pz,lights_physical_pars_fragment:Iz,lights_fragment_begin:Lz,lights_fragment_maps:Nz,lights_fragment_end:Dz,logdepthbuf_fragment:Oz,logdepthbuf_pars_fragment:Uz,logdepthbuf_pars_vertex:Fz,logdepthbuf_vertex:kz,map_fragment:zz,map_pars_fragment:Bz,map_particle_fragment:Vz,map_particle_pars_fragment:Hz,metalnessmap_fragment:Gz,metalnessmap_pars_fragment:Wz,morphinstance_vertex:jz,morphcolor_vertex:Xz,morphnormal_vertex:qz,morphtarget_pars_vertex:Yz,morphtarget_vertex:$z,normal_fragment_begin:Zz,normal_fragment_maps:Jz,normal_pars_fragment:Kz,normal_pars_vertex:Qz,normal_vertex:e4,normalmap_pars_fragment:t4,clearcoat_normal_fragment_begin:n4,clearcoat_normal_fragment_maps:i4,clearcoat_pars_fragment:r4,iridescence_pars_fragment:s4,opaque_fragment:o4,packing:a4,premultiplied_alpha_fragment:l4,project_vertex:c4,dithering_fragment:u4,dithering_pars_fragment:d4,roughnessmap_fragment:f4,roughnessmap_pars_fragment:h4,shadowmap_pars_fragment:p4,shadowmap_pars_vertex:m4,shadowmap_vertex:g4,shadowmask_pars_fragment:v4,skinbase_vertex:y4,skinning_pars_vertex:_4,skinning_vertex:x4,skinnormal_vertex:S4,specularmap_fragment:w4,specularmap_pars_fragment:M4,tonemapping_fragment:E4,tonemapping_pars_fragment:b4,transmission_fragment:A4,transmission_pars_fragment:T4,uv_pars_fragment:C4,uv_pars_vertex:R4,uv_vertex:P4,worldpos_vertex:I4,background_vert:L4,background_frag:N4,backgroundCube_vert:D4,backgroundCube_frag:O4,cube_vert:U4,cube_frag:F4,depth_vert:k4,depth_frag:z4,distanceRGBA_vert:B4,distanceRGBA_frag:V4,equirect_vert:H4,equirect_frag:G4,linedashed_vert:W4,linedashed_frag:j4,meshbasic_vert:X4,meshbasic_frag:q4,meshlambert_vert:Y4,meshlambert_frag:$4,meshmatcap_vert:Z4,meshmatcap_frag:J4,meshnormal_vert:K4,meshnormal_frag:Q4,meshphong_vert:eB,meshphong_frag:tB,meshphysical_vert:nB,meshphysical_frag:iB,meshtoon_vert:rB,meshtoon_frag:sB,points_vert:oB,points_frag:aB,shadow_vert:lB,shadow_frag:cB,sprite_vert:uB,sprite_frag:dB},Ve={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Mt},alphaMap:{value:null},alphaMapTransform:{value:new Mt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Mt}},envmap:{envMap:{value:null},envMapRotation:{value:new Mt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Mt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Mt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Mt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Mt},normalScale:{value:new Ee(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Mt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Mt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Mt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Mt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(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 Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Mt},alphaTest:{value:0},uvTransform:{value:new Mt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new Ee(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Mt},alphaMap:{value:null},alphaMapTransform:{value:new Mt},alphaTest:{value:0}}},Kr={basic:{uniforms:bi([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.fog]),vertexShader:At.meshbasic_vert,fragmentShader:At.meshbasic_frag},lambert:{uniforms:bi([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,Ve.lights,{emissive:{value:new Xe(0)}}]),vertexShader:At.meshlambert_vert,fragmentShader:At.meshlambert_frag},phong:{uniforms:bi([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,Ve.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30}}]),vertexShader:At.meshphong_vert,fragmentShader:At.meshphong_frag},standard:{uniforms:bi([Ve.common,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.roughnessmap,Ve.metalnessmap,Ve.fog,Ve.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:At.meshphysical_vert,fragmentShader:At.meshphysical_frag},toon:{uniforms:bi([Ve.common,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.gradientmap,Ve.fog,Ve.lights,{emissive:{value:new Xe(0)}}]),vertexShader:At.meshtoon_vert,fragmentShader:At.meshtoon_frag},matcap:{uniforms:bi([Ve.common,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,{matcap:{value:null}}]),vertexShader:At.meshmatcap_vert,fragmentShader:At.meshmatcap_frag},points:{uniforms:bi([Ve.points,Ve.fog]),vertexShader:At.points_vert,fragmentShader:At.points_frag},dashed:{uniforms:bi([Ve.common,Ve.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:At.linedashed_vert,fragmentShader:At.linedashed_frag},depth:{uniforms:bi([Ve.common,Ve.displacementmap]),vertexShader:At.depth_vert,fragmentShader:At.depth_frag},normal:{uniforms:bi([Ve.common,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,{opacity:{value:1}}]),vertexShader:At.meshnormal_vert,fragmentShader:At.meshnormal_frag},sprite:{uniforms:bi([Ve.sprite,Ve.fog]),vertexShader:At.sprite_vert,fragmentShader:At.sprite_frag},background:{uniforms:{uvTransform:{value:new Mt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:At.background_vert,fragmentShader:At.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Mt}},vertexShader:At.backgroundCube_vert,fragmentShader:At.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:At.cube_vert,fragmentShader:At.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:At.equirect_vert,fragmentShader:At.equirect_frag},distanceRGBA:{uniforms:bi([Ve.common,Ve.displacementmap,{referencePosition:{value:new k},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:At.distanceRGBA_vert,fragmentShader:At.distanceRGBA_frag},shadow:{uniforms:bi([Ve.lights,Ve.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:At.shadow_vert,fragmentShader:At.shadow_frag}};Kr.physical={uniforms:bi([Kr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Mt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Mt},clearcoatNormalScale:{value:new Ee(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Mt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Mt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Mt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Mt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Mt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Mt},transmissionSamplerSize:{value:new Ee},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Mt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Mt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Mt},anisotropyVector:{value:new Ee},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Mt}}]),vertexShader:At.meshphysical_vert,fragmentShader:At.meshphysical_frag};const Vp={r:0,b:0,g:0},Ca=new fr,fB=new ht;function hB(n,e,t,i,r,s,o){const a=new Xe(0);let u=s===!0?0:1,d,f,h=null,p=0,g=null;function y(_){let M=_.isScene===!0?_.background:null;return M&&M.isTexture&&(M=(_.backgroundBlurriness>0?t:e).get(M)),M}function w(_){let M=!1;const b=y(_);b===null?v(a,u):b&&b.isColor&&(v(b,1),M=!0);const N=n.xr.getEnvironmentBlendMode();N==="additive"?i.buffers.color.setClear(0,0,0,1,o):N==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||M)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil)}function x(_,M){const b=y(M);b&&(b.isCubeTexture||b.mapping===uu)?(f===void 0&&(f=new Mn(new Sl(1,1,1),new as({name:"BackgroundCubeMaterial",uniforms:ru(Kr.backgroundCube.uniforms),vertexShader:Kr.backgroundCube.vertexShader,fragmentShader:Kr.backgroundCube.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(N,C,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(f)),Ca.copy(M.backgroundRotation),Ca.x*=-1,Ca.y*=-1,Ca.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Ca.y*=-1,Ca.z*=-1),f.material.uniforms.envMap.value=b,f.material.uniforms.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(fB.makeRotationFromEuler(Ca)),f.material.toneMapped=Gt.getTransfer(b.colorSpace)!==Yt,(h!==b||p!==b.version||g!==n.toneMapping)&&(f.material.needsUpdate=!0,h=b,p=b.version,g=n.toneMapping),f.layers.enableAll(),_.unshift(f,f.geometry,f.material,0,0,null)):b&&b.isTexture&&(d===void 0&&(d=new Mn(new hu(2,2),new as({name:"BackgroundMaterial",uniforms:ru(Kr.background.uniforms),vertexShader:Kr.background.vertexShader,fragmentShader:Kr.background.fragmentShader,side:uo,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(d)),d.material.uniforms.t2D.value=b,d.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,d.material.toneMapped=Gt.getTransfer(b.colorSpace)!==Yt,b.matrixAutoUpdate===!0&&b.updateMatrix(),d.material.uniforms.uvTransform.value.copy(b.matrix),(h!==b||p!==b.version||g!==n.toneMapping)&&(d.material.needsUpdate=!0,h=b,p=b.version,g=n.toneMapping),d.layers.enableAll(),_.unshift(d,d.geometry,d.material,0,0,null))}function v(_,M){_.getRGB(Vp,N2(n)),i.buffers.color.setClear(Vp.r,Vp.g,Vp.b,M,o)}return{getClearColor:function(){return a},setClearColor:function(_,M=1){a.set(_),u=M,v(a,u)},getClearAlpha:function(){return u},setClearAlpha:function(_){u=_,v(a,u)},render:w,addToRenderList:x}}function pB(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=p(null);let s=r,o=!1;function a(A,U,G,z,Z){let J=!1;const ne=h(z,G,U);s!==ne&&(s=ne,d(s.object)),J=g(A,z,G,Z),J&&y(A,z,G,Z),Z!==null&&e.update(Z,n.ELEMENT_ARRAY_BUFFER),(J||o)&&(o=!1,b(A,U,G,z),Z!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(Z).buffer))}function u(){return n.createVertexArray()}function d(A){return n.bindVertexArray(A)}function f(A){return n.deleteVertexArray(A)}function h(A,U,G){const z=G.wireframe===!0;let Z=i[A.id];Z===void 0&&(Z={},i[A.id]=Z);let J=Z[U.id];J===void 0&&(J={},Z[U.id]=J);let ne=J[z];return ne===void 0&&(ne=p(u()),J[z]=ne),ne}function p(A){const U=[],G=[],z=[];for(let Z=0;Z<t;Z++)U[Z]=0,G[Z]=0,z[Z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:G,attributeDivisors:z,object:A,attributes:{},index:null}}function g(A,U,G,z){const Z=s.attributes,J=U.attributes;let ne=0;const le=G.getAttributes();for(const O in le)if(le[O].location>=0){const K=Z[O];let ae=J[O];if(ae===void 0&&(O==="instanceMatrix"&&A.instanceMatrix&&(ae=A.instanceMatrix),O==="instanceColor"&&A.instanceColor&&(ae=A.instanceColor)),K===void 0||K.attribute!==ae||ae&&K.data!==ae.data)return!0;ne++}return s.attributesNum!==ne||s.index!==z}function y(A,U,G,z){const Z={},J=U.attributes;let ne=0;const le=G.getAttributes();for(const O in le)if(le[O].location>=0){let K=J[O];K===void 0&&(O==="instanceMatrix"&&A.instanceMatrix&&(K=A.instanceMatrix),O==="instanceColor"&&A.instanceColor&&(K=A.instanceColor));const ae={};ae.attribute=K,K&&K.data&&(ae.data=K.data),Z[O]=ae,ne++}s.attributes=Z,s.attributesNum=ne,s.index=z}function w(){const A=s.newAttributes;for(let U=0,G=A.length;U<G;U++)A[U]=0}function x(A){v(A,0)}function v(A,U){const G=s.newAttributes,z=s.enabledAttributes,Z=s.attributeDivisors;G[A]=1,z[A]===0&&(n.enableVertexAttribArray(A),z[A]=1),Z[A]!==U&&(n.vertexAttribDivisor(A,U),Z[A]=U)}function _(){const A=s.newAttributes,U=s.enabledAttributes;for(let G=0,z=U.length;G<z;G++)U[G]!==A[G]&&(n.disableVertexAttribArray(G),U[G]=0)}function M(A,U,G,z,Z,J,ne){ne===!0?n.vertexAttribIPointer(A,U,G,Z,J):n.vertexAttribPointer(A,U,G,z,Z,J)}function b(A,U,G,z){w();const Z=z.attributes,J=G.getAttributes(),ne=U.defaultAttributeValues;for(const le in J){const O=J[le];if(O.location>=0){let Y=Z[le];if(Y===void 0&&(le==="instanceMatrix"&&A.instanceMatrix&&(Y=A.instanceMatrix),le==="instanceColor"&&A.instanceColor&&(Y=A.instanceColor)),Y!==void 0){const K=Y.normalized,ae=Y.itemSize,ge=e.get(Y);if(ge===void 0)continue;const Ue=ge.buffer,se=ge.type,xe=ge.bytesPerElement,Ae=se===n.INT||se===n.UNSIGNED_INT||Y.gpuType===u1;if(Y.isInterleavedBufferAttribute){const Ce=Y.data,tt=Ce.stride,Qe=Y.offset;if(Ce.isInstancedInterleavedBuffer){for(let Q=0;Q<O.locationSize;Q++)v(O.location+Q,Ce.meshPerAttribute);A.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=Ce.meshPerAttribute*Ce.count)}else for(let Q=0;Q<O.locationSize;Q++)x(O.location+Q);n.bindBuffer(n.ARRAY_BUFFER,Ue);for(let Q=0;Q<O.locationSize;Q++)M(O.location+Q,ae/O.locationSize,se,K,tt*xe,(Qe+ae/O.locationSize*Q)*xe,Ae)}else{if(Y.isInstancedBufferAttribute){for(let Ce=0;Ce<O.locationSize;Ce++)v(O.location+Ce,Y.meshPerAttribute);A.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=Y.meshPerAttribute*Y.count)}else for(let Ce=0;Ce<O.locationSize;Ce++)x(O.location+Ce);n.bindBuffer(n.ARRAY_BUFFER,Ue);for(let Ce=0;Ce<O.locationSize;Ce++)M(O.location+Ce,ae/O.locationSize,se,K,ae*xe,ae/O.locationSize*Ce*xe,Ae)}}else if(ne!==void 0){const K=ne[le];if(K!==void 0)switch(K.length){case 2:n.vertexAttrib2fv(O.location,K);break;case 3:n.vertexAttrib3fv(O.location,K);break;case 4:n.vertexAttrib4fv(O.location,K);break;default:n.vertexAttrib1fv(O.location,K)}}}}_()}function N(){D();for(const A in i){const U=i[A];for(const G in U){const z=U[G];for(const Z in z)f(z[Z].object),delete z[Z];delete U[G]}delete i[A]}}function C(A){if(i[A.id]===void 0)return;const U=i[A.id];for(const G in U){const z=U[G];for(const Z in z)f(z[Z].object),delete z[Z];delete U[G]}delete i[A.id]}function P(A){for(const U in i){const G=i[U];if(G[A.id]===void 0)continue;const z=G[A.id];for(const Z in z)f(z[Z].object),delete z[Z];delete G[A.id]}}function D(){I(),o=!0,s!==r&&(s=r,d(s.object))}function I(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:D,resetDefaultState:I,dispose:N,releaseStatesOfGeometry:C,releaseStatesOfProgram:P,initAttributes:w,enableAttribute:x,disableUnusedAttributes:_}}function mB(n,e,t){let i;function r(d){i=d}function s(d,f){n.drawArrays(i,d,f),t.update(f,i,1)}function o(d,f,h){h!==0&&(n.drawArraysInstanced(i,d,f,h),t.update(f,i,h))}function a(d,f,h){if(h===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<h;g++)this.render(d[g],f[g]);else{p.multiDrawArraysWEBGL(i,d,0,f,0,h);let g=0;for(let y=0;y<h;y++)g+=f[y];t.update(g,i,1)}}function u(d,f,h,p){if(h===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let y=0;y<d.length;y++)o(d[y],f[y],p[y]);else{g.multiDrawArraysInstancedWEBGL(i,d,0,f,0,p,0,h);let y=0;for(let w=0;w<h;w++)y+=f[w];for(let w=0;w<p.length;w++)t.update(y,i,p[w])}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=u}function gB(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(C){return!(C!==Bi&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(C){const P=C===Gf&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==Ns&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Ir&&!P)}function u(C){if(C==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=t.precision!==void 0?t.precision:"highp";const f=u(d);f!==d&&(console.warn("THREE.WebGLRenderer:",d,"not supported, using",f,"instead."),d=f);const h=t.logarithmicDepthBuffer===!0,p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=n.getParameter(n.MAX_TEXTURE_SIZE),w=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),x=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),_=n.getParameter(n.MAX_VARYING_VECTORS),M=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),b=g>0,N=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:a,precision:d,logarithmicDepthBuffer:h,maxTextures:p,maxVertexTextures:g,maxTextureSize:y,maxCubemapSize:w,maxAttributes:x,maxVertexUniforms:v,maxVaryings:_,maxFragmentUniforms:M,vertexTextures:b,maxSamples:N}}function vB(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Bo,a=new Mt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const g=h.length!==0||p||i!==0||r;return r=p,i=h.length,g},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,p){t=f(h,p,0)},this.setState=function(h,p,g){const y=h.clippingPlanes,w=h.clipIntersection,x=h.clipShadows,v=n.get(h);if(!r||y===null||y.length===0||s&&!x)s?f(null):d();else{const _=s?0:i,M=_*4;let b=v.clippingState||null;u.value=b,b=f(y,p,M,g);for(let N=0;N!==M;++N)b[N]=t[N];v.clippingState=b,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=_}};function d(){u.value!==t&&(u.value=t,u.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(h,p,g,y){const w=h!==null?h.length:0;let x=null;if(w!==0){if(x=u.value,y!==!0||x===null){const v=g+w*4,_=p.matrixWorldInverse;a.getNormalMatrix(_),(x===null||x.length<v)&&(x=new Float32Array(v));for(let M=0,b=g;M!==w;++M,b+=4)o.copy(h[M]).applyMatrix4(_,a),o.normal.toArray(x,b),x[b+3]=o.constant}u.value=x,u.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,x}}function yB(n){let e=new WeakMap;function t(o,a){return a===df?o.mapping=fo:a===ff&&(o.mapping=oa),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===df||a===ff)if(e.has(o)){const u=e.get(o).texture;return t(u,o.mapping)}else{const u=o.image;if(u&&u.height>0){const d=new U2(u.height);return d.fromEquirectangularTexture(n,o),e.set(o,d),o.addEventListener("dispose",r),t(d.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const u=e.get(a);u!==void 0&&(e.delete(a),u.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class na extends jf{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,u=r-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=d*this.view.offsetX,o=s+d*this.view.width,a-=f*this.view.offsetY,u=a-f*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,u,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Nc=4,LA=[.125,.215,.35,.446,.526,.582],Ga=20,f_=new na,NA=new Xe;let h_=null,p_=0,m_=0,g_=!1;const Va=(1+Math.sqrt(5))/2,nc=1/Va,DA=[new k(-Va,nc,0),new k(Va,nc,0),new k(-nc,0,Va),new k(nc,0,Va),new k(0,Va,-nc),new k(0,Va,nc),new k(-1,1,-1),new k(1,1,-1),new k(-1,1,1),new k(1,1,1)];class OS{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){h_=this._renderer.getRenderTarget(),p_=this._renderer.getActiveCubeFace(),m_=this._renderer.getActiveMipmapLevel(),g_=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,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=FA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=UA(),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(h_,p_,m_),this._renderer.xr.enabled=g_,e.scissorTest=!1,Hp(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===fo||e.mapping===oa?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),h_=this._renderer.getRenderTarget(),p_=this._renderer.getActiveCubeFace(),m_=this._renderer.getActiveMipmapLevel(),g_=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;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:In,minFilter:In,generateMipmaps:!1,type:Gf,format:Bi,colorSpace:po,depthBuffer:!1},r=OA(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=OA(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=_B(s)),this._blurMaterial=xB(s,e,t)}return r}_compileMaterial(e){const t=new Mn(this._lodPlanes[0],e);this._renderer.compile(t,f_)}_sceneToCubeUV(e,t,i,r){const a=new sn(90,1,t,i),u=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,h=f.autoClear,p=f.toneMapping;f.getClearColor(NA),f.toneMapping=Is,f.autoClear=!1;const g=new mo({name:"PMREM.Background",side:Pi,depthWrite:!1,depthTest:!1}),y=new Mn(new Sl,g);let w=!1;const x=e.background;x?x.isColor&&(g.color.copy(x),e.background=null,w=!0):(g.color.copy(NA),w=!0);for(let v=0;v<6;v++){const _=v%3;_===0?(a.up.set(0,u[v],0),a.lookAt(d[v],0,0)):_===1?(a.up.set(0,0,u[v]),a.lookAt(0,d[v],0)):(a.up.set(0,u[v],0),a.lookAt(0,0,d[v]));const M=this._cubeSize;Hp(r,_*M,v>2?M:0,M,M),f.setRenderTarget(r),w&&f.render(y,a),f.render(e,a)}y.geometry.dispose(),y.material.dispose(),f.toneMapping=p,f.autoClear=h,e.background=x}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===fo||e.mapping===oa;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=FA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=UA());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Mn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const u=this._cubeSize;Hp(t,0,0,3*u,2*u),i.setRenderTarget(t),i.render(o,f_)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=DA[(r-s-1)%DA.length];this._blur(e,s-1,s,o,a)}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 u=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,h=new Mn(this._lodPlanes[r],d),p=d.uniforms,g=this._sizeLods[i]-1,y=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*Ga-1),w=s/y,x=isFinite(s)?1+Math.floor(f*w):Ga;x>Ga&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Ga}`);const v=[];let _=0;for(let P=0;P<Ga;++P){const D=P/w,I=Math.exp(-D*D/2);v.push(I),P===0?_+=I:P<x&&(_+=2*I)}for(let P=0;P<v.length;P++)v[P]=v[P]/_;p.envMap.value=e.texture,p.samples.value=x,p.weights.value=v,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);const{_lodMax:M}=this;p.dTheta.value=y,p.mipInt.value=M-i;const b=this._sizeLods[r],N=3*b*(r>M-Nc?r-M+Nc:0),C=4*(this._cubeSize-b);Hp(t,N,C,3*b,2*b),u.setRenderTarget(t),u.render(h,f_)}}function _B(n){const e=[],t=[],i=[];let r=n;const s=n-Nc+1+LA.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let u=1/a;o>n-Nc?u=LA[o-n+Nc-1]:o===0&&(u=0),i.push(u);const d=1/(a-2),f=-d,h=1+d,p=[f,f,h,f,h,h,f,f,h,h,f,h],g=6,y=6,w=3,x=2,v=1,_=new Float32Array(w*y*g),M=new Float32Array(x*y*g),b=new Float32Array(v*y*g);for(let C=0;C<g;C++){const P=C%3*2/3-1,D=C>2?0:-1,I=[P,D,0,P+2/3,D,0,P+2/3,D+1,0,P,D,0,P+2/3,D+1,0,P,D+1,0];_.set(I,w*y*C),M.set(p,x*y*C);const A=[C,C,C,C,C,C];b.set(A,v*y*C)}const N=new mt;N.setAttribute("position",new Lt(_,w)),N.setAttribute("uv",new Lt(M,x)),N.setAttribute("faceIndex",new Lt(b,v)),e.push(N),r>Nc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function OA(n,e,t){const i=new os(n,e,t);return i.texture.mapping=uu,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Hp(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function xB(n,e,t){const i=new Float32Array(Ga),r=new k(0,1,0);return new as({name:"SphericalGaussianBlur",defines:{n:Ga,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:M1(),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:so,depthTest:!1,depthWrite:!1})}function UA(){return new as({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:M1(),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:so,depthTest:!1,depthWrite:!1})}function FA(){return new as({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:M1(),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:so,depthTest:!1,depthWrite:!1})}function M1(){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 SB(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const u=a.mapping,d=u===df||u===ff,f=u===fo||u===oa;if(d||f){let h=e.get(a);const p=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==p)return t===null&&(t=new OS(n)),h=d?t.fromEquirectangular(a,h):t.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),h.texture;if(h!==void 0)return h.texture;{const g=a.image;return d&&g&&g.height>0||f&&g&&r(g)?(t===null&&(t=new OS(n)),h=d?t.fromEquirectangular(a):t.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),a.addEventListener("dispose",s),h.texture):null}}}return a}function r(a){let u=0;const d=6;for(let f=0;f<d;f++)a[f]!==void 0&&u++;return u===d}function s(a){const u=a.target;u.removeEventListener("dispose",s);const d=e.get(u);d!==void 0&&(e.delete(u),d.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function wB(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(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function MB(n,e,t,i){const r={},s=new WeakMap;function o(h){const p=h.target;p.index!==null&&e.remove(p.index);for(const y in p.attributes)e.remove(p.attributes[y]);for(const y in p.morphAttributes){const w=p.morphAttributes[y];for(let x=0,v=w.length;x<v;x++)e.remove(w[x])}p.removeEventListener("dispose",o),delete r[p.id];const g=s.get(p);g&&(e.remove(g),s.delete(p)),i.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(h,p){return r[p.id]===!0||(p.addEventListener("dispose",o),r[p.id]=!0,t.memory.geometries++),p}function u(h){const p=h.attributes;for(const y in p)e.update(p[y],n.ARRAY_BUFFER);const g=h.morphAttributes;for(const y in g){const w=g[y];for(let x=0,v=w.length;x<v;x++)e.update(w[x],n.ARRAY_BUFFER)}}function d(h){const p=[],g=h.index,y=h.attributes.position;let w=0;if(g!==null){const _=g.array;w=g.version;for(let M=0,b=_.length;M<b;M+=3){const N=_[M+0],C=_[M+1],P=_[M+2];p.push(N,C,C,P,P,N)}}else if(y!==void 0){const _=y.array;w=y.version;for(let M=0,b=_.length/3-1;M<b;M+=3){const N=M+0,C=M+1,P=M+2;p.push(N,C,C,P,P,N)}}else return;const x=new(T2(p)?w1:S1)(p,1);x.version=w;const v=s.get(h);v&&e.remove(v),s.set(h,x)}function f(h){const p=s.get(h);if(p){const g=h.index;g!==null&&p.version<g.version&&d(h)}else d(h);return s.get(h)}return{get:a,update:u,getWireframeAttribute:f}}function EB(n,e,t){let i;function r(p){i=p}let s,o;function a(p){s=p.type,o=p.bytesPerElement}function u(p,g){n.drawElements(i,g,s,p*o),t.update(g,i,1)}function d(p,g,y){y!==0&&(n.drawElementsInstanced(i,g,s,p*o,y),t.update(g,i,y))}function f(p,g,y){if(y===0)return;const w=e.get("WEBGL_multi_draw");if(w===null)for(let x=0;x<y;x++)this.render(p[x]/o,g[x]);else{w.multiDrawElementsWEBGL(i,g,0,s,p,0,y);let x=0;for(let v=0;v<y;v++)x+=g[v];t.update(x,i,1)}}function h(p,g,y,w){if(y===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let v=0;v<p.length;v++)d(p[v]/o,g[v],w[v]);else{x.multiDrawElementsInstancedWEBGL(i,g,0,s,p,0,w,0,y);let v=0;for(let _=0;_<y;_++)v+=g[_];for(let _=0;_<w.length;_++)t.update(v,i,w[_])}}this.setMode=r,this.setIndex=a,this.render=u,this.renderInstances=d,this.renderMultiDraw=f,this.renderMultiDrawInstances=h}function bB(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 n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function AB(n,e,t){const i=new WeakMap,r=new Wt;function s(o,a,u){const d=o.morphTargetInfluences,f=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=f!==void 0?f.length:0;let p=i.get(a);if(p===void 0||p.count!==h){let A=function(){D.dispose(),i.delete(a),a.removeEventListener("dispose",A)};var g=A;p!==void 0&&p.texture.dispose();const y=a.morphAttributes.position!==void 0,w=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,v=a.morphAttributes.position||[],_=a.morphAttributes.normal||[],M=a.morphAttributes.color||[];let b=0;y===!0&&(b=1),w===!0&&(b=2),x===!0&&(b=3);let N=a.attributes.position.count*b,C=1;N>e.maxTextureSize&&(C=Math.ceil(N/e.maxTextureSize),N=e.maxTextureSize);const P=new Float32Array(N*C*4*h),D=new U0(P,N,C,h);D.type=Ir,D.needsUpdate=!0;const I=b*4;for(let U=0;U<h;U++){const G=v[U],z=_[U],Z=M[U],J=N*C*4*U;for(let ne=0;ne<G.count;ne++){const le=ne*I;y===!0&&(r.fromBufferAttribute(G,ne),P[J+le+0]=r.x,P[J+le+1]=r.y,P[J+le+2]=r.z,P[J+le+3]=0),w===!0&&(r.fromBufferAttribute(z,ne),P[J+le+4]=r.x,P[J+le+5]=r.y,P[J+le+6]=r.z,P[J+le+7]=0),x===!0&&(r.fromBufferAttribute(Z,ne),P[J+le+8]=r.x,P[J+le+9]=r.y,P[J+le+10]=r.z,P[J+le+11]=Z.itemSize===4?r.w:1)}}p={count:h,texture:D,size:new Ee(N,C)},i.set(a,p),a.addEventListener("dispose",A)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)u.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let y=0;for(let x=0;x<d.length;x++)y+=d[x];const w=a.morphTargetsRelative?1:1-y;u.getUniforms().setValue(n,"morphTargetBaseInfluence",w),u.getUniforms().setValue(n,"morphTargetInfluences",d)}u.getUniforms().setValue(n,"morphTargetsTexture",p.texture,t),u.getUniforms().setValue(n,"morphTargetsTextureSize",p.size)}return{update:s}}function TB(n,e,t,i){let r=new WeakMap;function s(u){const d=i.render.frame,f=u.geometry,h=e.get(u,f);if(r.get(h)!==d&&(e.update(h),r.set(h,d)),u.isInstancedMesh&&(u.hasEventListener("dispose",a)===!1&&u.addEventListener("dispose",a),r.get(u)!==d&&(t.update(u.instanceMatrix,n.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,n.ARRAY_BUFFER),r.set(u,d))),u.isSkinnedMesh){const p=u.skeleton;r.get(p)!==d&&(p.update(),r.set(p,d))}return h}function o(){r=new WeakMap}function a(u){const d=u.target;d.removeEventListener("dispose",a),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:s,dispose:o}}class E1 extends hn{constructor(e,t,i,r,s,o,a,u,d,f){if(f=f!==void 0?f:rl,f!==rl&&f!==nu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&f===rl&&(i=ml),i===void 0&&f===nu&&(i=du),super(null,r,s,o,a,u,f,i,d),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Yn,this.minFilter=u!==void 0?u:Yn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const k2=new hn,z2=new E1(1,1);z2.compareFunction=y1;const B2=new U0,V2=new x1,H2=new Xf,kA=[],zA=[],BA=new Float32Array(16),VA=new Float32Array(9),HA=new Float32Array(4);function pu(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=kA[r];if(s===void 0&&(s=new Float32Array(r),kA[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 kn(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 zn(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function F0(n,e){let t=zA[e];t===void 0&&(t=new Int32Array(e),zA[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function CB(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function RB(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(kn(t,e))return;n.uniform2fv(this.addr,e),zn(t,e)}}function PB(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(kn(t,e))return;n.uniform3fv(this.addr,e),zn(t,e)}}function IB(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(kn(t,e))return;n.uniform4fv(this.addr,e),zn(t,e)}}function LB(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(kn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),zn(t,e)}else{if(kn(t,i))return;HA.set(i),n.uniformMatrix2fv(this.addr,!1,HA),zn(t,i)}}function NB(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(kn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),zn(t,e)}else{if(kn(t,i))return;VA.set(i),n.uniformMatrix3fv(this.addr,!1,VA),zn(t,i)}}function DB(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(kn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),zn(t,e)}else{if(kn(t,i))return;BA.set(i),n.uniformMatrix4fv(this.addr,!1,BA),zn(t,i)}}function OB(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function UB(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(kn(t,e))return;n.uniform2iv(this.addr,e),zn(t,e)}}function FB(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(kn(t,e))return;n.uniform3iv(this.addr,e),zn(t,e)}}function kB(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(kn(t,e))return;n.uniform4iv(this.addr,e),zn(t,e)}}function zB(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function BB(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(kn(t,e))return;n.uniform2uiv(this.addr,e),zn(t,e)}}function VB(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(kn(t,e))return;n.uniform3uiv(this.addr,e),zn(t,e)}}function HB(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(kn(t,e))return;n.uniform4uiv(this.addr,e),zn(t,e)}}function GB(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);const s=this.type===n.SAMPLER_2D_SHADOW?z2:k2;t.setTexture2D(e||s,r)}function WB(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||V2,r)}function jB(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||H2,r)}function XB(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||B2,r)}function qB(n){switch(n){case 5126:return CB;case 35664:return RB;case 35665:return PB;case 35666:return IB;case 35674:return LB;case 35675:return NB;case 35676:return DB;case 5124:case 35670:return OB;case 35667:case 35671:return UB;case 35668:case 35672:return FB;case 35669:case 35673:return kB;case 5125:return zB;case 36294:return BB;case 36295:return VB;case 36296:return HB;case 35678:case 36198:case 36298:case 36306:case 35682:return GB;case 35679:case 36299:case 36307:return WB;case 35680:case 36300:case 36308:case 36293:return jB;case 36289:case 36303:case 36311:case 36292:return XB}}function YB(n,e){n.uniform1fv(this.addr,e)}function $B(n,e){const t=pu(e,this.size,2);n.uniform2fv(this.addr,t)}function ZB(n,e){const t=pu(e,this.size,3);n.uniform3fv(this.addr,t)}function JB(n,e){const t=pu(e,this.size,4);n.uniform4fv(this.addr,t)}function KB(n,e){const t=pu(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function QB(n,e){const t=pu(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function e5(n,e){const t=pu(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function t5(n,e){n.uniform1iv(this.addr,e)}function n5(n,e){n.uniform2iv(this.addr,e)}function i5(n,e){n.uniform3iv(this.addr,e)}function r5(n,e){n.uniform4iv(this.addr,e)}function s5(n,e){n.uniform1uiv(this.addr,e)}function o5(n,e){n.uniform2uiv(this.addr,e)}function a5(n,e){n.uniform3uiv(this.addr,e)}function l5(n,e){n.uniform4uiv(this.addr,e)}function c5(n,e,t){const i=this.cache,r=e.length,s=F0(t,r);kn(i,s)||(n.uniform1iv(this.addr,s),zn(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||k2,s[o])}function u5(n,e,t){const i=this.cache,r=e.length,s=F0(t,r);kn(i,s)||(n.uniform1iv(this.addr,s),zn(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||V2,s[o])}function d5(n,e,t){const i=this.cache,r=e.length,s=F0(t,r);kn(i,s)||(n.uniform1iv(this.addr,s),zn(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||H2,s[o])}function f5(n,e,t){const i=this.cache,r=e.length,s=F0(t,r);kn(i,s)||(n.uniform1iv(this.addr,s),zn(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||B2,s[o])}function h5(n){switch(n){case 5126:return YB;case 35664:return $B;case 35665:return ZB;case 35666:return JB;case 35674:return KB;case 35675:return QB;case 35676:return e5;case 5124:case 35670:return t5;case 35667:case 35671:return n5;case 35668:case 35672:return i5;case 35669:case 35673:return r5;case 5125:return s5;case 36294:return o5;case 36295:return a5;case 36296:return l5;case 35678:case 36198:case 36298:case 36306:case 35682:return c5;case 35679:case 36299:case 36307:return u5;case 35680:case 36300:case 36308:case 36293:return d5;case 36289:case 36303:case 36311:case 36292:return f5}}class p5{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=qB(t.type)}}class m5{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=h5(t.type)}}class g5{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 v_=/(\w+)(\])?(\[|\.)?/g;function GA(n,e){n.seq.push(e),n.map[e.id]=e}function v5(n,e,t){const i=n.name,r=i.length;for(v_.lastIndex=0;;){const s=v_.exec(i),o=v_.lastIndex;let a=s[1];const u=s[2]==="]",d=s[3];if(u&&(a=a|0),d===void 0||d==="["&&o+2===r){GA(t,d===void 0?new p5(a,n,e):new m5(a,n,e));break}else{let h=t.map[a];h===void 0&&(h=new g5(a),GA(t,h)),t=h}}}class $m{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);v5(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],u=i[a.id];u.needsUpdate!==!1&&a.setValue(e,u.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 WA(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const y5=37297;let _5=0;function x5(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 S5(n){const e=Gt.getPrimaries(Gt.workingColorSpace),t=Gt.getPrimaries(n);let i;switch(e===t?i="":e===xf&&t===_f?i="LinearDisplayP3ToLinearSRGB":e===_f&&t===xf&&(i="LinearSRGBToLinearDisplayP3"),n){case po:case Wf:return[i,"LinearTransferOETF"];case br:case O0:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function jA(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),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+`

`+x5(n.getShaderSource(e),o)}else return r}function w5(n,e){const t=S5(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function M5(n,e){let t;switch(e){case K3:t="Linear";break;case Q3:t="Reinhard";break;case e2:t="OptimizedCineon";break;case a1:t="ACESFilmic";break;case n2:t="AgX";break;case i2:t="Neutral";break;case t2:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function E5(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(bd).join(`
`)}function b5(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function A5(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function bd(n){return n!==""}function XA(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 qA(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const T5=/^[ \t]*#include +<([\w\d./]+)>/gm;function US(n){return n.replace(T5,R5)}const C5=new Map;function R5(n,e){let t=At[e];if(t===void 0){const i=C5.get(e);if(i!==void 0)t=At[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return US(t)}const P5=/#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 YA(n){return n.replace(P5,I5)}function I5(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 $A(n){let e=`precision ${n.precision} float;
	precision ${n.precision} int;
	precision ${n.precision} sampler2D;
	precision ${n.precision} samplerCube;
	precision ${n.precision} sampler3D;
	precision ${n.precision} sampler2DArray;
	precision ${n.precision} sampler2DShadow;
	precision ${n.precision} samplerCubeShadow;
	precision ${n.precision} sampler2DArrayShadow;
	precision ${n.precision} isampler2D;
	precision ${n.precision} isampler3D;
	precision ${n.precision} isamplerCube;
	precision ${n.precision} isampler2DArray;
	precision ${n.precision} usampler2D;
	precision ${n.precision} usampler3D;
	precision ${n.precision} usamplerCube;
	precision ${n.precision} usampler2DArray;
	`;return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function L5(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===L0?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===qc?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===$r&&(e="SHADOWMAP_TYPE_VSM"),e}function N5(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case fo:case oa:e="ENVMAP_TYPE_CUBE";break;case uu:e="ENVMAP_TYPE_CUBE_UV";break}return e}function D5(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case oa:e="ENVMAP_MODE_REFRACTION";break}return e}function O5(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Hf:e="ENVMAP_BLENDING_MULTIPLY";break;case Z3:e="ENVMAP_BLENDING_MIX";break;case J3:e="ENVMAP_BLENDING_ADD";break}return e}function U5(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 F5(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const u=L5(t),d=N5(t),f=D5(t),h=O5(t),p=U5(t),g=E5(t),y=b5(s),w=r.createProgram();let x,v,_=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(x=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(bd).join(`
`),x.length>0&&(x+=`
`),v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(bd).join(`
`),v.length>0&&(v+=`
`)):(x=[$A(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(bd).join(`
`),v=[$A(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.envMap?"#define "+f:"",t.envMap?"#define "+h:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Is?"#define TONE_MAPPING":"",t.toneMapping!==Is?At.tonemapping_pars_fragment:"",t.toneMapping!==Is?M5("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",At.colorspace_pars_fragment,w5("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(bd).join(`
`)),o=US(o),o=XA(o,t),o=qA(o,t),a=US(a),a=XA(a,t),a=qA(a,t),o=YA(o),a=YA(a),t.isRawShaderMaterial!==!0&&(_=`#version 300 es
`,x=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+x,v=["#define varying in",t.glslVersion===DS?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===DS?"":"#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(`
`)+`
`+v);const M=_+x+o,b=_+v+a,N=WA(r,r.VERTEX_SHADER,M),C=WA(r,r.FRAGMENT_SHADER,b);r.attachShader(w,N),r.attachShader(w,C),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function P(U){if(n.debug.checkShaderErrors){const G=r.getProgramInfoLog(w).trim(),z=r.getShaderInfoLog(N).trim(),Z=r.getShaderInfoLog(C).trim();let J=!0,ne=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(J=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,w,N,C);else{const le=jA(r,N,"vertex"),O=jA(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`

Material Name: `+U.name+`
Material Type: `+U.type+`

Program Info Log: `+G+`
`+le+`
`+O)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(z===""||Z==="")&&(ne=!1);ne&&(U.diagnostics={runnable:J,programLog:G,vertexShader:{log:z,prefix:x},fragmentShader:{log:Z,prefix:v}})}r.deleteShader(N),r.deleteShader(C),D=new $m(r,w),I=A5(r,w)}let D;this.getUniforms=function(){return D===void 0&&P(this),D};let I;this.getAttributes=function(){return I===void 0&&P(this),I};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=r.getProgramParameter(w,y5)),A},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=_5++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=N,this.fragmentShader=C,this}let k5=0;class z5{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 B5(e),t.set(e,i)),i}}class B5{constructor(e){this.id=k5++,this.code=e,this.usedTimes=0}}function V5(n,e,t,i,r,s,o){const a=new ol,u=new z5,d=new Set,f=[],h=r.logarithmicDepthBuffer,p=r.vertexTextures;let g=r.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function w(I){return d.add(I),I===0?"uv":`uv${I}`}function x(I,A,U,G,z){const Z=G.fog,J=z.geometry,ne=I.isMeshStandardMaterial?G.environment:null,le=(I.isMeshStandardMaterial?t:e).get(I.envMap||ne),O=le&&le.mapping===uu?le.image.height:null,Y=y[I.type];I.precision!==null&&(g=r.getMaxPrecision(I.precision),g!==I.precision&&console.warn("THREE.WebGLProgram.getParameters:",I.precision,"not supported, using",g,"instead."));const K=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,ae=K!==void 0?K.length:0;let ge=0;J.morphAttributes.position!==void 0&&(ge=1),J.morphAttributes.normal!==void 0&&(ge=2),J.morphAttributes.color!==void 0&&(ge=3);let Ue,se,xe,Ae;if(Y){const Ut=Kr[Y];Ue=Ut.vertexShader,se=Ut.fragmentShader}else Ue=I.vertexShader,se=I.fragmentShader,u.update(I),xe=u.getVertexShaderID(I),Ae=u.getFragmentShaderID(I);const Ce=n.getRenderTarget(),tt=z.isInstancedMesh===!0,Qe=z.isBatchedMesh===!0,Q=!!I.map,nt=!!I.matcap,pe=!!le,be=!!I.aoMap,Se=!!I.lightMap,Fe=!!I.bumpMap,Te=!!I.normalMap,He=!!I.displacementMap,V=!!I.emissiveMap,L=!!I.metalnessMap,R=!!I.roughnessMap,X=I.anisotropy>0,q=I.clearcoat>0,$=I.dispersion>0,ie=I.iridescence>0,Ne=I.sheen>0,Re=I.transmission>0,Pe=X&&!!I.anisotropyMap,st=q&&!!I.clearcoatMap,De=q&&!!I.clearcoatNormalMap,qe=q&&!!I.clearcoatRoughnessMap,ct=ie&&!!I.iridescenceMap,W=ie&&!!I.iridescenceThicknessMap,oe=Ne&&!!I.sheenColorMap,Ie=Ne&&!!I.sheenRoughnessMap,ze=!!I.specularMap,ot=!!I.specularColorMap,Ke=!!I.specularIntensityMap,j=Re&&!!I.transmissionMap,ve=Re&&!!I.thicknessMap,ce=!!I.gradientMap,Le=!!I.alphaMap,Be=I.alphaTest>0,wt=!!I.alphaHash,Ht=!!I.extensions;let Zt=Is;I.toneMapped&&(Ce===null||Ce.isXRRenderTarget===!0)&&(Zt=n.toneMapping);const Vn={shaderID:Y,shaderType:I.type,shaderName:I.name,vertexShader:Ue,fragmentShader:se,defines:I.defines,customVertexShaderID:xe,customFragmentShaderID:Ae,isRawShaderMaterial:I.isRawShaderMaterial===!0,glslVersion:I.glslVersion,precision:g,batching:Qe,instancing:tt,instancingColor:tt&&z.instanceColor!==null,instancingMorph:tt&&z.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:Ce===null?n.outputColorSpace:Ce.isXRRenderTarget===!0?Ce.texture.colorSpace:po,alphaToCoverage:!!I.alphaToCoverage,map:Q,matcap:nt,envMap:pe,envMapMode:pe&&le.mapping,envMapCubeUVHeight:O,aoMap:be,lightMap:Se,bumpMap:Fe,normalMap:Te,displacementMap:p&&He,emissiveMap:V,normalMapObjectSpace:Te&&I.normalMapType===_2,normalMapTangentSpace:Te&&I.normalMapType===da,metalnessMap:L,roughnessMap:R,anisotropy:X,anisotropyMap:Pe,clearcoat:q,clearcoatMap:st,clearcoatNormalMap:De,clearcoatRoughnessMap:qe,dispersion:$,iridescence:ie,iridescenceMap:ct,iridescenceThicknessMap:W,sheen:Ne,sheenColorMap:oe,sheenRoughnessMap:Ie,specularMap:ze,specularColorMap:ot,specularIntensityMap:Ke,transmission:Re,transmissionMap:j,thicknessMap:ve,gradientMap:ce,opaque:I.transparent===!1&&I.blending===il&&I.alphaToCoverage===!1,alphaMap:Le,alphaTest:Be,alphaHash:wt,combine:I.combine,mapUv:Q&&w(I.map.channel),aoMapUv:be&&w(I.aoMap.channel),lightMapUv:Se&&w(I.lightMap.channel),bumpMapUv:Fe&&w(I.bumpMap.channel),normalMapUv:Te&&w(I.normalMap.channel),displacementMapUv:He&&w(I.displacementMap.channel),emissiveMapUv:V&&w(I.emissiveMap.channel),metalnessMapUv:L&&w(I.metalnessMap.channel),roughnessMapUv:R&&w(I.roughnessMap.channel),anisotropyMapUv:Pe&&w(I.anisotropyMap.channel),clearcoatMapUv:st&&w(I.clearcoatMap.channel),clearcoatNormalMapUv:De&&w(I.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:qe&&w(I.clearcoatRoughnessMap.channel),iridescenceMapUv:ct&&w(I.iridescenceMap.channel),iridescenceThicknessMapUv:W&&w(I.iridescenceThicknessMap.channel),sheenColorMapUv:oe&&w(I.sheenColorMap.channel),sheenRoughnessMapUv:Ie&&w(I.sheenRoughnessMap.channel),specularMapUv:ze&&w(I.specularMap.channel),specularColorMapUv:ot&&w(I.specularColorMap.channel),specularIntensityMapUv:Ke&&w(I.specularIntensityMap.channel),transmissionMapUv:j&&w(I.transmissionMap.channel),thicknessMapUv:ve&&w(I.thicknessMap.channel),alphaMapUv:Le&&w(I.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(Te||X),vertexColors:I.vertexColors,vertexAlphas:I.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!J.attributes.uv&&(Q||Le),fog:!!Z,useFog:I.fog===!0,fogExp2:!!Z&&Z.isFogExp2,flatShading:I.flatShading===!0,sizeAttenuation:I.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:z.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:ge,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:I.dithering,shadowMapEnabled:n.shadowMap.enabled&&U.length>0,shadowMapType:n.shadowMap.type,toneMapping:Zt,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Q&&I.map.isVideoTexture===!0&&Gt.getTransfer(I.map.colorSpace)===Yt,premultipliedAlpha:I.premultipliedAlpha,doubleSided:I.side===Qr,flipSided:I.side===Pi,useDepthPacking:I.depthPacking>=0,depthPacking:I.depthPacking||0,index0AttributeName:I.index0AttributeName,extensionClipCullDistance:Ht&&I.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ht&&I.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:I.customProgramCacheKey()};return Vn.vertexUv1s=d.has(1),Vn.vertexUv2s=d.has(2),Vn.vertexUv3s=d.has(3),d.clear(),Vn}function v(I){const A=[];if(I.shaderID?A.push(I.shaderID):(A.push(I.customVertexShaderID),A.push(I.customFragmentShaderID)),I.defines!==void 0)for(const U in I.defines)A.push(U),A.push(I.defines[U]);return I.isRawShaderMaterial===!1&&(_(A,I),M(A,I),A.push(n.outputColorSpace)),A.push(I.customProgramCacheKey),A.join()}function _(I,A){I.push(A.precision),I.push(A.outputColorSpace),I.push(A.envMapMode),I.push(A.envMapCubeUVHeight),I.push(A.mapUv),I.push(A.alphaMapUv),I.push(A.lightMapUv),I.push(A.aoMapUv),I.push(A.bumpMapUv),I.push(A.normalMapUv),I.push(A.displacementMapUv),I.push(A.emissiveMapUv),I.push(A.metalnessMapUv),I.push(A.roughnessMapUv),I.push(A.anisotropyMapUv),I.push(A.clearcoatMapUv),I.push(A.clearcoatNormalMapUv),I.push(A.clearcoatRoughnessMapUv),I.push(A.iridescenceMapUv),I.push(A.iridescenceThicknessMapUv),I.push(A.sheenColorMapUv),I.push(A.sheenRoughnessMapUv),I.push(A.specularMapUv),I.push(A.specularColorMapUv),I.push(A.specularIntensityMapUv),I.push(A.transmissionMapUv),I.push(A.thicknessMapUv),I.push(A.combine),I.push(A.fogExp2),I.push(A.sizeAttenuation),I.push(A.morphTargetsCount),I.push(A.morphAttributeCount),I.push(A.numDirLights),I.push(A.numPointLights),I.push(A.numSpotLights),I.push(A.numSpotLightMaps),I.push(A.numHemiLights),I.push(A.numRectAreaLights),I.push(A.numDirLightShadows),I.push(A.numPointLightShadows),I.push(A.numSpotLightShadows),I.push(A.numSpotLightShadowsWithMaps),I.push(A.numLightProbes),I.push(A.shadowMapType),I.push(A.toneMapping),I.push(A.numClippingPlanes),I.push(A.numClipIntersection),I.push(A.depthPacking)}function M(I,A){a.disableAll(),A.supportsVertexTextures&&a.enable(0),A.instancing&&a.enable(1),A.instancingColor&&a.enable(2),A.instancingMorph&&a.enable(3),A.matcap&&a.enable(4),A.envMap&&a.enable(5),A.normalMapObjectSpace&&a.enable(6),A.normalMapTangentSpace&&a.enable(7),A.clearcoat&&a.enable(8),A.iridescence&&a.enable(9),A.alphaTest&&a.enable(10),A.vertexColors&&a.enable(11),A.vertexAlphas&&a.enable(12),A.vertexUv1s&&a.enable(13),A.vertexUv2s&&a.enable(14),A.vertexUv3s&&a.enable(15),A.vertexTangents&&a.enable(16),A.anisotropy&&a.enable(17),A.alphaHash&&a.enable(18),A.batching&&a.enable(19),A.dispersion&&a.enable(20),I.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.useLegacyLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),A.alphaToCoverage&&a.enable(20),I.push(a.mask)}function b(I){const A=y[I.type];let U;if(A){const G=Kr[A];U=D2.clone(G.uniforms)}else U=I.uniforms;return U}function N(I,A){let U;for(let G=0,z=f.length;G<z;G++){const Z=f[G];if(Z.cacheKey===A){U=Z,++U.usedTimes;break}}return U===void 0&&(U=new F5(n,A,I,s),f.push(U)),U}function C(I){if(--I.usedTimes===0){const A=f.indexOf(I);f[A]=f[f.length-1],f.pop(),I.destroy()}}function P(I){u.remove(I)}function D(){u.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:b,acquireProgram:N,releaseProgram:C,releaseShaderCache:P,programs:f,dispose:D}}function H5(){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 G5(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 ZA(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 JA(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(h,p,g,y,w,x){let v=n[e];return v===void 0?(v={id:h.id,object:h,geometry:p,material:g,groupOrder:y,renderOrder:h.renderOrder,z:w,group:x},n[e]=v):(v.id=h.id,v.object=h,v.geometry=p,v.material=g,v.groupOrder=y,v.renderOrder=h.renderOrder,v.z=w,v.group=x),e++,v}function a(h,p,g,y,w,x){const v=o(h,p,g,y,w,x);g.transmission>0?i.push(v):g.transparent===!0?r.push(v):t.push(v)}function u(h,p,g,y,w,x){const v=o(h,p,g,y,w,x);g.transmission>0?i.unshift(v):g.transparent===!0?r.unshift(v):t.unshift(v)}function d(h,p){t.length>1&&t.sort(h||G5),i.length>1&&i.sort(p||ZA),r.length>1&&r.sort(p||ZA)}function f(){for(let h=e,p=n.length;h<p;h++){const g=n[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:u,finish:f,sort:d}}function W5(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new JA,n.set(i,[o])):r>=s.length?(o=new JA,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function j5(){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 k,color:new Xe};break;case"SpotLight":t={position:new k,direction:new k,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new k,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new k,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new k,halfWidth:new k,halfHeight:new k};break}return n[e.id]=t,t}}}function X5(){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 Ee};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ee};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ee,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let q5=0;function Y5(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function $5(n){const e=new j5,t=X5(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new k);const r=new k,s=new ht,o=new ht;function a(d,f){let h=0,p=0,g=0;for(let U=0;U<9;U++)i.probe[U].set(0,0,0);let y=0,w=0,x=0,v=0,_=0,M=0,b=0,N=0,C=0,P=0,D=0;d.sort(Y5);const I=f===!0?Math.PI:1;for(let U=0,G=d.length;U<G;U++){const z=d[U],Z=z.color,J=z.intensity,ne=z.distance,le=z.shadow&&z.shadow.map?z.shadow.map.texture:null;if(z.isAmbientLight)h+=Z.r*J*I,p+=Z.g*J*I,g+=Z.b*J*I;else if(z.isLightProbe){for(let O=0;O<9;O++)i.probe[O].addScaledVector(z.sh.coefficients[O],J);D++}else if(z.isDirectionalLight){const O=e.get(z);if(O.color.copy(z.color).multiplyScalar(z.intensity*I),z.castShadow){const Y=z.shadow,K=t.get(z);K.shadowBias=Y.bias,K.shadowNormalBias=Y.normalBias,K.shadowRadius=Y.radius,K.shadowMapSize=Y.mapSize,i.directionalShadow[y]=K,i.directionalShadowMap[y]=le,i.directionalShadowMatrix[y]=z.shadow.matrix,M++}i.directional[y]=O,y++}else if(z.isSpotLight){const O=e.get(z);O.position.setFromMatrixPosition(z.matrixWorld),O.color.copy(Z).multiplyScalar(J*I),O.distance=ne,O.coneCos=Math.cos(z.angle),O.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),O.decay=z.decay,i.spot[x]=O;const Y=z.shadow;if(z.map&&(i.spotLightMap[C]=z.map,C++,Y.updateMatrices(z),z.castShadow&&P++),i.spotLightMatrix[x]=Y.matrix,z.castShadow){const K=t.get(z);K.shadowBias=Y.bias,K.shadowNormalBias=Y.normalBias,K.shadowRadius=Y.radius,K.shadowMapSize=Y.mapSize,i.spotShadow[x]=K,i.spotShadowMap[x]=le,N++}x++}else if(z.isRectAreaLight){const O=e.get(z);O.color.copy(Z).multiplyScalar(J),O.halfWidth.set(z.width*.5,0,0),O.halfHeight.set(0,z.height*.5,0),i.rectArea[v]=O,v++}else if(z.isPointLight){const O=e.get(z);if(O.color.copy(z.color).multiplyScalar(z.intensity*I),O.distance=z.distance,O.decay=z.decay,z.castShadow){const Y=z.shadow,K=t.get(z);K.shadowBias=Y.bias,K.shadowNormalBias=Y.normalBias,K.shadowRadius=Y.radius,K.shadowMapSize=Y.mapSize,K.shadowCameraNear=Y.camera.near,K.shadowCameraFar=Y.camera.far,i.pointShadow[w]=K,i.pointShadowMap[w]=le,i.pointShadowMatrix[w]=z.shadow.matrix,b++}i.point[w]=O,w++}else if(z.isHemisphereLight){const O=e.get(z);O.skyColor.copy(z.color).multiplyScalar(J*I),O.groundColor.copy(z.groundColor).multiplyScalar(J*I),i.hemi[_]=O,_++}}v>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ve.LTC_FLOAT_1,i.rectAreaLTC2=Ve.LTC_FLOAT_2):(i.rectAreaLTC1=Ve.LTC_HALF_1,i.rectAreaLTC2=Ve.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=g;const A=i.hash;(A.directionalLength!==y||A.pointLength!==w||A.spotLength!==x||A.rectAreaLength!==v||A.hemiLength!==_||A.numDirectionalShadows!==M||A.numPointShadows!==b||A.numSpotShadows!==N||A.numSpotMaps!==C||A.numLightProbes!==D)&&(i.directional.length=y,i.spot.length=x,i.rectArea.length=v,i.point.length=w,i.hemi.length=_,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=N,i.spotShadowMap.length=N,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=N+C-P,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=D,A.directionalLength=y,A.pointLength=w,A.spotLength=x,A.rectAreaLength=v,A.hemiLength=_,A.numDirectionalShadows=M,A.numPointShadows=b,A.numSpotShadows=N,A.numSpotMaps=C,A.numLightProbes=D,i.version=q5++)}function u(d,f){let h=0,p=0,g=0,y=0,w=0;const x=f.matrixWorldInverse;for(let v=0,_=d.length;v<_;v++){const M=d[v];if(M.isDirectionalLight){const b=i.directional[h];b.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(x),h++}else if(M.isSpotLight){const b=i.spot[g];b.position.setFromMatrixPosition(M.matrixWorld),b.position.applyMatrix4(x),b.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(x),g++}else if(M.isRectAreaLight){const b=i.rectArea[y];b.position.setFromMatrixPosition(M.matrixWorld),b.position.applyMatrix4(x),o.identity(),s.copy(M.matrixWorld),s.premultiply(x),o.extractRotation(s),b.halfWidth.set(M.width*.5,0,0),b.halfHeight.set(0,M.height*.5,0),b.halfWidth.applyMatrix4(o),b.halfHeight.applyMatrix4(o),y++}else if(M.isPointLight){const b=i.point[p];b.position.setFromMatrixPosition(M.matrixWorld),b.position.applyMatrix4(x),p++}else if(M.isHemisphereLight){const b=i.hemi[w];b.direction.setFromMatrixPosition(M.matrixWorld),b.direction.transformDirection(x),w++}}}return{setup:a,setupView:u,state:i}}function KA(n){const e=new $5(n),t=[],i=[];function r(f){d.camera=f,t.length=0,i.length=0}function s(f){t.push(f)}function o(f){i.push(f)}function a(f){e.setup(t,f)}function u(f){e.setupView(t,f)}const d={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:d,setupLights:a,setupLightsView:u,pushLight:s,pushShadow:o}}function Z5(n){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new KA(n),e.set(r,[a])):s>=o.length?(a=new KA(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class b1 extends ii{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=v2,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 A1 extends ii{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 J5=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,K5=`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 Q5(n,e,t){let i=new qf;const r=new Ee,s=new Ee,o=new Wt,a=new b1({depthPacking:y2}),u=new A1,d={},f=t.maxTextureSize,h={[uo]:Pi,[Pi]:uo,[Qr]:Qr},p=new as({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ee},radius:{value:4}},vertexShader:J5,fragmentShader:K5}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const y=new mt;y.setAttribute("position",new Lt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const w=new Mn(y,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=L0;let v=this.type;this.render=function(C,P,D){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||C.length===0)return;const I=n.getRenderTarget(),A=n.getActiveCubeFace(),U=n.getActiveMipmapLevel(),G=n.state;G.setBlending(so),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const z=v!==$r&&this.type===$r,Z=v===$r&&this.type!==$r;for(let J=0,ne=C.length;J<ne;J++){const le=C[J],O=le.shadow;if(O===void 0){console.warn("THREE.WebGLShadowMap:",le,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;r.copy(O.mapSize);const Y=O.getFrameExtents();if(r.multiply(Y),s.copy(O.mapSize),(r.x>f||r.y>f)&&(r.x>f&&(s.x=Math.floor(f/Y.x),r.x=s.x*Y.x,O.mapSize.x=s.x),r.y>f&&(s.y=Math.floor(f/Y.y),r.y=s.y*Y.y,O.mapSize.y=s.y)),O.map===null||z===!0||Z===!0){const ae=this.type!==$r?{minFilter:Yn,magFilter:Yn}:{};O.map!==null&&O.map.dispose(),O.map=new os(r.x,r.y,ae),O.map.texture.name=le.name+".shadowMap",O.camera.updateProjectionMatrix()}n.setRenderTarget(O.map),n.clear();const K=O.getViewportCount();for(let ae=0;ae<K;ae++){const ge=O.getViewport(ae);o.set(s.x*ge.x,s.y*ge.y,s.x*ge.z,s.y*ge.w),G.viewport(o),O.updateMatrices(le,ae),i=O.getFrustum(),b(P,D,O.camera,le,this.type)}O.isPointLightShadow!==!0&&this.type===$r&&_(O,D),O.needsUpdate=!1}v=this.type,x.needsUpdate=!1,n.setRenderTarget(I,A,U)};function _(C,P){const D=e.update(w);p.defines.VSM_SAMPLES!==C.blurSamples&&(p.defines.VSM_SAMPLES=C.blurSamples,g.defines.VSM_SAMPLES=C.blurSamples,p.needsUpdate=!0,g.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new os(r.x,r.y)),p.uniforms.shadow_pass.value=C.map.texture,p.uniforms.resolution.value=C.mapSize,p.uniforms.radius.value=C.radius,n.setRenderTarget(C.mapPass),n.clear(),n.renderBufferDirect(P,null,D,p,w,null),g.uniforms.shadow_pass.value=C.mapPass.texture,g.uniforms.resolution.value=C.mapSize,g.uniforms.radius.value=C.radius,n.setRenderTarget(C.map),n.clear(),n.renderBufferDirect(P,null,D,g,w,null)}function M(C,P,D,I){let A=null;const U=D.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(U!==void 0)A=U;else if(A=D.isPointLight===!0?u:a,n.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0){const G=A.uuid,z=P.uuid;let Z=d[G];Z===void 0&&(Z={},d[G]=Z);let J=Z[z];J===void 0&&(J=A.clone(),Z[z]=J,P.addEventListener("dispose",N)),A=J}if(A.visible=P.visible,A.wireframe=P.wireframe,I===$r?A.side=P.shadowSide!==null?P.shadowSide:P.side:A.side=P.shadowSide!==null?P.shadowSide:h[P.side],A.alphaMap=P.alphaMap,A.alphaTest=P.alphaTest,A.map=P.map,A.clipShadows=P.clipShadows,A.clippingPlanes=P.clippingPlanes,A.clipIntersection=P.clipIntersection,A.displacementMap=P.displacementMap,A.displacementScale=P.displacementScale,A.displacementBias=P.displacementBias,A.wireframeLinewidth=P.wireframeLinewidth,A.linewidth=P.linewidth,D.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const G=n.properties.get(A);G.light=D}return A}function b(C,P,D,I,A){if(C.visible===!1)return;if(C.layers.test(P.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&A===$r)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,C.matrixWorld);const z=e.update(C),Z=C.material;if(Array.isArray(Z)){const J=z.groups;for(let ne=0,le=J.length;ne<le;ne++){const O=J[ne],Y=Z[O.materialIndex];if(Y&&Y.visible){const K=M(C,Y,I,A);C.onBeforeShadow(n,C,P,D,z,K,O),n.renderBufferDirect(D,null,z,K,C,O),C.onAfterShadow(n,C,P,D,z,K,O)}}}else if(Z.visible){const J=M(C,Z,I,A);C.onBeforeShadow(n,C,P,D,z,J,null),n.renderBufferDirect(D,null,z,J,C,null),C.onAfterShadow(n,C,P,D,z,J,null)}}const G=C.children;for(let z=0,Z=G.length;z<Z;z++)b(G[z],P,D,I,A)}function N(C){C.target.removeEventListener("dispose",N);for(const D in d){const I=d[D],A=C.target.uuid;A in I&&(I[A].dispose(),delete I[A])}}}function eV(n){function e(){let j=!1;const ve=new Wt;let ce=null;const Le=new Wt(0,0,0,0);return{setMask:function(Be){ce!==Be&&!j&&(n.colorMask(Be,Be,Be,Be),ce=Be)},setLocked:function(Be){j=Be},setClear:function(Be,wt,Ht,Zt,Vn){Vn===!0&&(Be*=Zt,wt*=Zt,Ht*=Zt),ve.set(Be,wt,Ht,Zt),Le.equals(ve)===!1&&(n.clearColor(Be,wt,Ht,Zt),Le.copy(ve))},reset:function(){j=!1,ce=null,Le.set(-1,0,0,0)}}}function t(){let j=!1,ve=null,ce=null,Le=null;return{setTest:function(Be){Be?Ae(n.DEPTH_TEST):Ce(n.DEPTH_TEST)},setMask:function(Be){ve!==Be&&!j&&(n.depthMask(Be),ve=Be)},setFunc:function(Be){if(ce!==Be){switch(Be){case G3:n.depthFunc(n.NEVER);break;case W3:n.depthFunc(n.ALWAYS);break;case j3:n.depthFunc(n.LESS);break;case uf:n.depthFunc(n.LEQUAL);break;case X3:n.depthFunc(n.EQUAL);break;case q3:n.depthFunc(n.GEQUAL);break;case Y3:n.depthFunc(n.GREATER);break;case $3:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}ce=Be}},setLocked:function(Be){j=Be},setClear:function(Be){Le!==Be&&(n.clearDepth(Be),Le=Be)},reset:function(){j=!1,ve=null,ce=null,Le=null}}}function i(){let j=!1,ve=null,ce=null,Le=null,Be=null,wt=null,Ht=null,Zt=null,Vn=null;return{setTest:function(Ut){j||(Ut?Ae(n.STENCIL_TEST):Ce(n.STENCIL_TEST))},setMask:function(Ut){ve!==Ut&&!j&&(n.stencilMask(Ut),ve=Ut)},setFunc:function(Ut,ji,Hn){(ce!==Ut||Le!==ji||Be!==Hn)&&(n.stencilFunc(Ut,ji,Hn),ce=Ut,Le=ji,Be=Hn)},setOp:function(Ut,ji,Hn){(wt!==Ut||Ht!==ji||Zt!==Hn)&&(n.stencilOp(Ut,ji,Hn),wt=Ut,Ht=ji,Zt=Hn)},setLocked:function(Ut){j=Ut},setClear:function(Ut){Vn!==Ut&&(n.clearStencil(Ut),Vn=Ut)},reset:function(){j=!1,ve=null,ce=null,Le=null,Be=null,wt=null,Ht=null,Zt=null,Vn=null}}}const r=new e,s=new t,o=new i,a=new WeakMap,u=new WeakMap;let d={},f={},h=new WeakMap,p=[],g=null,y=!1,w=null,x=null,v=null,_=null,M=null,b=null,N=null,C=new Xe(0,0,0),P=0,D=!1,I=null,A=null,U=null,G=null,z=null;const Z=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let J=!1,ne=0;const le=n.getParameter(n.VERSION);le.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(le)[1]),J=ne>=1):le.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(le)[1]),J=ne>=2);let O=null,Y={};const K=n.getParameter(n.SCISSOR_BOX),ae=n.getParameter(n.VIEWPORT),ge=new Wt().fromArray(K),Ue=new Wt().fromArray(ae);function se(j,ve,ce,Le){const Be=new Uint8Array(4),wt=n.createTexture();n.bindTexture(j,wt),n.texParameteri(j,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(j,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ht=0;Ht<ce;Ht++)j===n.TEXTURE_3D||j===n.TEXTURE_2D_ARRAY?n.texImage3D(ve,0,n.RGBA,1,1,Le,0,n.RGBA,n.UNSIGNED_BYTE,Be):n.texImage2D(ve+Ht,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Be);return wt}const xe={};xe[n.TEXTURE_2D]=se(n.TEXTURE_2D,n.TEXTURE_2D,1),xe[n.TEXTURE_CUBE_MAP]=se(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),xe[n.TEXTURE_2D_ARRAY]=se(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),xe[n.TEXTURE_3D]=se(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),Ae(n.DEPTH_TEST),s.setFunc(uf),Fe(!1),Te(nS),Ae(n.CULL_FACE),be(so);function Ae(j){d[j]!==!0&&(n.enable(j),d[j]=!0)}function Ce(j){d[j]!==!1&&(n.disable(j),d[j]=!1)}function tt(j,ve){return f[j]!==ve?(n.bindFramebuffer(j,ve),f[j]=ve,j===n.DRAW_FRAMEBUFFER&&(f[n.FRAMEBUFFER]=ve),j===n.FRAMEBUFFER&&(f[n.DRAW_FRAMEBUFFER]=ve),!0):!1}function Qe(j,ve){let ce=p,Le=!1;if(j){ce=h.get(ve),ce===void 0&&(ce=[],h.set(ve,ce));const Be=j.textures;if(ce.length!==Be.length||ce[0]!==n.COLOR_ATTACHMENT0){for(let wt=0,Ht=Be.length;wt<Ht;wt++)ce[wt]=n.COLOR_ATTACHMENT0+wt;ce.length=Be.length,Le=!0}}else ce[0]!==n.BACK&&(ce[0]=n.BACK,Le=!0);Le&&n.drawBuffers(ce)}function Q(j){return g!==j?(n.useProgram(j),g=j,!0):!1}const nt={[Go]:n.FUNC_ADD,[A3]:n.FUNC_SUBTRACT,[T3]:n.FUNC_REVERSE_SUBTRACT};nt[C3]=n.MIN,nt[R3]=n.MAX;const pe={[P3]:n.ZERO,[I3]:n.ONE,[L3]:n.SRC_COLOR,[Jg]:n.SRC_ALPHA,[k3]:n.SRC_ALPHA_SATURATE,[U3]:n.DST_COLOR,[D3]:n.DST_ALPHA,[N3]:n.ONE_MINUS_SRC_COLOR,[Kg]:n.ONE_MINUS_SRC_ALPHA,[F3]:n.ONE_MINUS_DST_COLOR,[O3]:n.ONE_MINUS_DST_ALPHA,[z3]:n.CONSTANT_COLOR,[B3]:n.ONE_MINUS_CONSTANT_COLOR,[V3]:n.CONSTANT_ALPHA,[H3]:n.ONE_MINUS_CONSTANT_ALPHA};function be(j,ve,ce,Le,Be,wt,Ht,Zt,Vn,Ut){if(j===so){y===!0&&(Ce(n.BLEND),y=!1);return}if(y===!1&&(Ae(n.BLEND),y=!0),j!==b3){if(j!==w||Ut!==D){if((x!==Go||M!==Go)&&(n.blendEquation(n.FUNC_ADD),x=Go,M=Go),Ut)switch(j){case il:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case iS:n.blendFunc(n.ONE,n.ONE);break;case rS:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case sS:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",j);break}else switch(j){case il:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case iS:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case rS:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case sS:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",j);break}v=null,_=null,b=null,N=null,C.set(0,0,0),P=0,w=j,D=Ut}return}Be=Be||ve,wt=wt||ce,Ht=Ht||Le,(ve!==x||Be!==M)&&(n.blendEquationSeparate(nt[ve],nt[Be]),x=ve,M=Be),(ce!==v||Le!==_||wt!==b||Ht!==N)&&(n.blendFuncSeparate(pe[ce],pe[Le],pe[wt],pe[Ht]),v=ce,_=Le,b=wt,N=Ht),(Zt.equals(C)===!1||Vn!==P)&&(n.blendColor(Zt.r,Zt.g,Zt.b,Vn),C.copy(Zt),P=Vn),w=j,D=!1}function Se(j,ve){j.side===Qr?Ce(n.CULL_FACE):Ae(n.CULL_FACE);let ce=j.side===Pi;ve&&(ce=!ce),Fe(ce),j.blending===il&&j.transparent===!1?be(so):be(j.blending,j.blendEquation,j.blendSrc,j.blendDst,j.blendEquationAlpha,j.blendSrcAlpha,j.blendDstAlpha,j.blendColor,j.blendAlpha,j.premultipliedAlpha),s.setFunc(j.depthFunc),s.setTest(j.depthTest),s.setMask(j.depthWrite),r.setMask(j.colorWrite);const Le=j.stencilWrite;o.setTest(Le),Le&&(o.setMask(j.stencilWriteMask),o.setFunc(j.stencilFunc,j.stencilRef,j.stencilFuncMask),o.setOp(j.stencilFail,j.stencilZFail,j.stencilZPass)),V(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits),j.alphaToCoverage===!0?Ae(n.SAMPLE_ALPHA_TO_COVERAGE):Ce(n.SAMPLE_ALPHA_TO_COVERAGE)}function Fe(j){I!==j&&(j?n.frontFace(n.CW):n.frontFace(n.CCW),I=j)}function Te(j){j!==w3?(Ae(n.CULL_FACE),j!==A&&(j===nS?n.cullFace(n.BACK):j===M3?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ce(n.CULL_FACE),A=j}function He(j){j!==U&&(J&&n.lineWidth(j),U=j)}function V(j,ve,ce){j?(Ae(n.POLYGON_OFFSET_FILL),(G!==ve||z!==ce)&&(n.polygonOffset(ve,ce),G=ve,z=ce)):Ce(n.POLYGON_OFFSET_FILL)}function L(j){j?Ae(n.SCISSOR_TEST):Ce(n.SCISSOR_TEST)}function R(j){j===void 0&&(j=n.TEXTURE0+Z-1),O!==j&&(n.activeTexture(j),O=j)}function X(j,ve,ce){ce===void 0&&(O===null?ce=n.TEXTURE0+Z-1:ce=O);let Le=Y[ce];Le===void 0&&(Le={type:void 0,texture:void 0},Y[ce]=Le),(Le.type!==j||Le.texture!==ve)&&(O!==ce&&(n.activeTexture(ce),O=ce),n.bindTexture(j,ve||xe[j]),Le.type=j,Le.texture=ve)}function q(){const j=Y[O];j!==void 0&&j.type!==void 0&&(n.bindTexture(j.type,null),j.type=void 0,j.texture=void 0)}function $(){try{n.compressedTexImage2D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function ie(){try{n.compressedTexImage3D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function Ne(){try{n.texSubImage2D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function Re(){try{n.texSubImage3D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function Pe(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function st(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function De(){try{n.texStorage2D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function qe(){try{n.texStorage3D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function ct(){try{n.texImage2D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function W(){try{n.texImage3D.apply(n,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function oe(j){ge.equals(j)===!1&&(n.scissor(j.x,j.y,j.z,j.w),ge.copy(j))}function Ie(j){Ue.equals(j)===!1&&(n.viewport(j.x,j.y,j.z,j.w),Ue.copy(j))}function ze(j,ve){let ce=u.get(ve);ce===void 0&&(ce=new WeakMap,u.set(ve,ce));let Le=ce.get(j);Le===void 0&&(Le=n.getUniformBlockIndex(ve,j.name),ce.set(j,Le))}function ot(j,ve){const Le=u.get(ve).get(j);a.get(ve)!==Le&&(n.uniformBlockBinding(ve,Le,j.__bindingPointIndex),a.set(ve,Le))}function Ke(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,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),d={},O=null,Y={},f={},h=new WeakMap,p=[],g=null,y=!1,w=null,x=null,v=null,_=null,M=null,b=null,N=null,C=new Xe(0,0,0),P=0,D=!1,I=null,A=null,U=null,G=null,z=null,ge.set(0,0,n.canvas.width,n.canvas.height),Ue.set(0,0,n.canvas.width,n.canvas.height),r.reset(),s.reset(),o.reset()}return{buffers:{color:r,depth:s,stencil:o},enable:Ae,disable:Ce,bindFramebuffer:tt,drawBuffers:Qe,useProgram:Q,setBlending:be,setMaterial:Se,setFlipSided:Fe,setCullFace:Te,setLineWidth:He,setPolygonOffset:V,setScissorTest:L,activeTexture:R,bindTexture:X,unbindTexture:q,compressedTexImage2D:$,compressedTexImage3D:ie,texImage2D:ct,texImage3D:W,updateUBOMapping:ze,uniformBlockBinding:ot,texStorage2D:De,texStorage3D:qe,texSubImage2D:Ne,texSubImage3D:Re,compressedTexSubImage2D:Pe,compressedTexSubImage3D:st,scissor:oe,viewport:Ie,reset:Ke}}function tV(n,e,t,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new Ee,f=new WeakMap;let h;const p=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(L,R){return g?new OffscreenCanvas(L,R):Mf("canvas")}function w(L,R,X){let q=1;const $=V(L);if(($.width>X||$.height>X)&&(q=X/Math.max($.width,$.height)),q<1)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap||typeof VideoFrame<"u"&&L instanceof VideoFrame){const ie=Math.floor(q*$.width),Ne=Math.floor(q*$.height);h===void 0&&(h=y(ie,Ne));const Re=R?y(ie,Ne):h;return Re.width=ie,Re.height=Ne,Re.getContext("2d").drawImage(L,0,0,ie,Ne),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+ie+"x"+Ne+")."),Re}else return"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),L;return L}function x(L){return L.generateMipmaps&&L.minFilter!==Yn&&L.minFilter!==In}function v(L){n.generateMipmap(L)}function _(L,R,X,q,$=!1){if(L!==null){if(n[L]!==void 0)return n[L];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let ie=R;if(R===n.RED&&(X===n.FLOAT&&(ie=n.R32F),X===n.HALF_FLOAT&&(ie=n.R16F),X===n.UNSIGNED_BYTE&&(ie=n.R8)),R===n.RED_INTEGER&&(X===n.UNSIGNED_BYTE&&(ie=n.R8UI),X===n.UNSIGNED_SHORT&&(ie=n.R16UI),X===n.UNSIGNED_INT&&(ie=n.R32UI),X===n.BYTE&&(ie=n.R8I),X===n.SHORT&&(ie=n.R16I),X===n.INT&&(ie=n.R32I)),R===n.RG&&(X===n.FLOAT&&(ie=n.RG32F),X===n.HALF_FLOAT&&(ie=n.RG16F),X===n.UNSIGNED_BYTE&&(ie=n.RG8)),R===n.RG_INTEGER&&(X===n.UNSIGNED_BYTE&&(ie=n.RG8UI),X===n.UNSIGNED_SHORT&&(ie=n.RG16UI),X===n.UNSIGNED_INT&&(ie=n.RG32UI),X===n.BYTE&&(ie=n.RG8I),X===n.SHORT&&(ie=n.RG16I),X===n.INT&&(ie=n.RG32I)),R===n.RGB&&X===n.UNSIGNED_INT_5_9_9_9_REV&&(ie=n.RGB9_E5),R===n.RGBA){const Ne=$?yf:Gt.getTransfer(q);X===n.FLOAT&&(ie=n.RGBA32F),X===n.HALF_FLOAT&&(ie=n.RGBA16F),X===n.UNSIGNED_BYTE&&(ie=Ne===Yt?n.SRGB8_ALPHA8:n.RGBA8),X===n.UNSIGNED_SHORT_4_4_4_4&&(ie=n.RGBA4),X===n.UNSIGNED_SHORT_5_5_5_1&&(ie=n.RGB5_A1)}return(ie===n.R16F||ie===n.R32F||ie===n.RG16F||ie===n.RG32F||ie===n.RGBA16F||ie===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function M(L,R){return x(L)===!0||L.isFramebufferTexture&&L.minFilter!==Yn&&L.minFilter!==In?Math.log2(Math.max(R.width,R.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?R.mipmaps.length:1}function b(L){const R=L.target;R.removeEventListener("dispose",b),C(R),R.isVideoTexture&&f.delete(R)}function N(L){const R=L.target;R.removeEventListener("dispose",N),D(R)}function C(L){const R=i.get(L);if(R.__webglInit===void 0)return;const X=L.source,q=p.get(X);if(q){const $=q[R.__cacheKey];$.usedTimes--,$.usedTimes===0&&P(L),Object.keys(q).length===0&&p.delete(X)}i.remove(L)}function P(L){const R=i.get(L);n.deleteTexture(R.__webglTexture);const X=L.source,q=p.get(X);delete q[R.__cacheKey],o.memory.textures--}function D(L){const R=i.get(L);if(L.depthTexture&&L.depthTexture.dispose(),L.isWebGLCubeRenderTarget)for(let q=0;q<6;q++){if(Array.isArray(R.__webglFramebuffer[q]))for(let $=0;$<R.__webglFramebuffer[q].length;$++)n.deleteFramebuffer(R.__webglFramebuffer[q][$]);else n.deleteFramebuffer(R.__webglFramebuffer[q]);R.__webglDepthbuffer&&n.deleteRenderbuffer(R.__webglDepthbuffer[q])}else{if(Array.isArray(R.__webglFramebuffer))for(let q=0;q<R.__webglFramebuffer.length;q++)n.deleteFramebuffer(R.__webglFramebuffer[q]);else n.deleteFramebuffer(R.__webglFramebuffer);if(R.__webglDepthbuffer&&n.deleteRenderbuffer(R.__webglDepthbuffer),R.__webglMultisampledFramebuffer&&n.deleteFramebuffer(R.__webglMultisampledFramebuffer),R.__webglColorRenderbuffer)for(let q=0;q<R.__webglColorRenderbuffer.length;q++)R.__webglColorRenderbuffer[q]&&n.deleteRenderbuffer(R.__webglColorRenderbuffer[q]);R.__webglDepthRenderbuffer&&n.deleteRenderbuffer(R.__webglDepthRenderbuffer)}const X=L.textures;for(let q=0,$=X.length;q<$;q++){const ie=i.get(X[q]);ie.__webglTexture&&(n.deleteTexture(ie.__webglTexture),o.memory.textures--),i.remove(X[q])}i.remove(L)}let I=0;function A(){I=0}function U(){const L=I;return L>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+r.maxTextures),I+=1,L}function G(L){const R=[];return R.push(L.wrapS),R.push(L.wrapT),R.push(L.wrapR||0),R.push(L.magFilter),R.push(L.minFilter),R.push(L.anisotropy),R.push(L.internalFormat),R.push(L.format),R.push(L.type),R.push(L.generateMipmaps),R.push(L.premultiplyAlpha),R.push(L.flipY),R.push(L.unpackAlignment),R.push(L.colorSpace),R.join()}function z(L,R){const X=i.get(L);if(L.isVideoTexture&&Te(L),L.isRenderTargetTexture===!1&&L.version>0&&X.__version!==L.version){const q=L.image;if(q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ge(X,L,R);return}}t.bindTexture(n.TEXTURE_2D,X.__webglTexture,n.TEXTURE0+R)}function Z(L,R){const X=i.get(L);if(L.version>0&&X.__version!==L.version){ge(X,L,R);return}t.bindTexture(n.TEXTURE_2D_ARRAY,X.__webglTexture,n.TEXTURE0+R)}function J(L,R){const X=i.get(L);if(L.version>0&&X.__version!==L.version){ge(X,L,R);return}t.bindTexture(n.TEXTURE_3D,X.__webglTexture,n.TEXTURE0+R)}function ne(L,R){const X=i.get(L);if(L.version>0&&X.__version!==L.version){Ue(X,L,R);return}t.bindTexture(n.TEXTURE_CUBE_MAP,X.__webglTexture,n.TEXTURE0+R)}const le={[hf]:n.REPEAT,[Pr]:n.CLAMP_TO_EDGE,[pf]:n.MIRRORED_REPEAT},O={[Yn]:n.NEAREST,[l1]:n.NEAREST_MIPMAP_NEAREST,[Ic]:n.NEAREST_MIPMAP_LINEAR,[In]:n.LINEAR,[Fd]:n.LINEAR_MIPMAP_NEAREST,[As]:n.LINEAR_MIPMAP_LINEAR},Y={[x2]:n.NEVER,[A2]:n.ALWAYS,[S2]:n.LESS,[y1]:n.LEQUAL,[w2]:n.EQUAL,[b2]:n.GEQUAL,[M2]:n.GREATER,[E2]:n.NOTEQUAL};function K(L,R){if(R.type===Ir&&e.has("OES_texture_float_linear")===!1&&(R.magFilter===In||R.magFilter===Fd||R.magFilter===Ic||R.magFilter===As||R.minFilter===In||R.minFilter===Fd||R.minFilter===Ic||R.minFilter===As)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(L,n.TEXTURE_WRAP_S,le[R.wrapS]),n.texParameteri(L,n.TEXTURE_WRAP_T,le[R.wrapT]),(L===n.TEXTURE_3D||L===n.TEXTURE_2D_ARRAY)&&n.texParameteri(L,n.TEXTURE_WRAP_R,le[R.wrapR]),n.texParameteri(L,n.TEXTURE_MAG_FILTER,O[R.magFilter]),n.texParameteri(L,n.TEXTURE_MIN_FILTER,O[R.minFilter]),R.compareFunction&&(n.texParameteri(L,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(L,n.TEXTURE_COMPARE_FUNC,Y[R.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(R.magFilter===Yn||R.minFilter!==Ic&&R.minFilter!==As||R.type===Ir&&e.has("OES_texture_float_linear")===!1)return;if(R.anisotropy>1||i.get(R).__currentAnisotropy){const X=e.get("EXT_texture_filter_anisotropic");n.texParameterf(L,X.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,r.getMaxAnisotropy())),i.get(R).__currentAnisotropy=R.anisotropy}}}function ae(L,R){let X=!1;L.__webglInit===void 0&&(L.__webglInit=!0,R.addEventListener("dispose",b));const q=R.source;let $=p.get(q);$===void 0&&($={},p.set(q,$));const ie=G(R);if(ie!==L.__cacheKey){$[ie]===void 0&&($[ie]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,X=!0),$[ie].usedTimes++;const Ne=$[L.__cacheKey];Ne!==void 0&&($[L.__cacheKey].usedTimes--,Ne.usedTimes===0&&P(R)),L.__cacheKey=ie,L.__webglTexture=$[ie].texture}return X}function ge(L,R,X){let q=n.TEXTURE_2D;(R.isDataArrayTexture||R.isCompressedArrayTexture)&&(q=n.TEXTURE_2D_ARRAY),R.isData3DTexture&&(q=n.TEXTURE_3D);const $=ae(L,R),ie=R.source;t.bindTexture(q,L.__webglTexture,n.TEXTURE0+X);const Ne=i.get(ie);if(ie.version!==Ne.__version||$===!0){t.activeTexture(n.TEXTURE0+X);const Re=Gt.getPrimaries(Gt.workingColorSpace),Pe=R.colorSpace===Qs?null:Gt.getPrimaries(R.colorSpace),st=R.colorSpace===Qs||Re===Pe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,R.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,R.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,st);let De=w(R.image,!1,r.maxTextureSize);De=He(R,De);const qe=s.convert(R.format,R.colorSpace),ct=s.convert(R.type);let W=_(R.internalFormat,qe,ct,R.colorSpace,R.isVideoTexture);K(q,R);let oe;const Ie=R.mipmaps,ze=R.isVideoTexture!==!0,ot=Ne.__version===void 0||$===!0,Ke=ie.dataReady,j=M(R,De);if(R.isDepthTexture)W=n.DEPTH_COMPONENT16,R.type===Ir?W=n.DEPTH_COMPONENT32F:R.type===ml?W=n.DEPTH_COMPONENT24:R.type===du&&(W=n.DEPTH24_STENCIL8),ot&&(ze?t.texStorage2D(n.TEXTURE_2D,1,W,De.width,De.height):t.texImage2D(n.TEXTURE_2D,0,W,De.width,De.height,0,qe,ct,null));else if(R.isDataTexture)if(Ie.length>0){ze&&ot&&t.texStorage2D(n.TEXTURE_2D,j,W,Ie[0].width,Ie[0].height);for(let ve=0,ce=Ie.length;ve<ce;ve++)oe=Ie[ve],ze?Ke&&t.texSubImage2D(n.TEXTURE_2D,ve,0,0,oe.width,oe.height,qe,ct,oe.data):t.texImage2D(n.TEXTURE_2D,ve,W,oe.width,oe.height,0,qe,ct,oe.data);R.generateMipmaps=!1}else ze?(ot&&t.texStorage2D(n.TEXTURE_2D,j,W,De.width,De.height),Ke&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,De.width,De.height,qe,ct,De.data)):t.texImage2D(n.TEXTURE_2D,0,W,De.width,De.height,0,qe,ct,De.data);else if(R.isCompressedTexture)if(R.isCompressedArrayTexture){ze&&ot&&t.texStorage3D(n.TEXTURE_2D_ARRAY,j,W,Ie[0].width,Ie[0].height,De.depth);for(let ve=0,ce=Ie.length;ve<ce;ve++)oe=Ie[ve],R.format!==Bi?qe!==null?ze?Ke&&t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ve,0,0,0,oe.width,oe.height,De.depth,qe,oe.data,0,0):t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,ve,W,oe.width,oe.height,De.depth,0,oe.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ze?Ke&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,ve,0,0,0,oe.width,oe.height,De.depth,qe,ct,oe.data):t.texImage3D(n.TEXTURE_2D_ARRAY,ve,W,oe.width,oe.height,De.depth,0,qe,ct,oe.data)}else{ze&&ot&&t.texStorage2D(n.TEXTURE_2D,j,W,Ie[0].width,Ie[0].height);for(let ve=0,ce=Ie.length;ve<ce;ve++)oe=Ie[ve],R.format!==Bi?qe!==null?ze?Ke&&t.compressedTexSubImage2D(n.TEXTURE_2D,ve,0,0,oe.width,oe.height,qe,oe.data):t.compressedTexImage2D(n.TEXTURE_2D,ve,W,oe.width,oe.height,0,oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ze?Ke&&t.texSubImage2D(n.TEXTURE_2D,ve,0,0,oe.width,oe.height,qe,ct,oe.data):t.texImage2D(n.TEXTURE_2D,ve,W,oe.width,oe.height,0,qe,ct,oe.data)}else if(R.isDataArrayTexture)ze?(ot&&t.texStorage3D(n.TEXTURE_2D_ARRAY,j,W,De.width,De.height,De.depth),Ke&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,De.width,De.height,De.depth,qe,ct,De.data)):t.texImage3D(n.TEXTURE_2D_ARRAY,0,W,De.width,De.height,De.depth,0,qe,ct,De.data);else if(R.isData3DTexture)ze?(ot&&t.texStorage3D(n.TEXTURE_3D,j,W,De.width,De.height,De.depth),Ke&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,De.width,De.height,De.depth,qe,ct,De.data)):t.texImage3D(n.TEXTURE_3D,0,W,De.width,De.height,De.depth,0,qe,ct,De.data);else if(R.isFramebufferTexture){if(ot)if(ze)t.texStorage2D(n.TEXTURE_2D,j,W,De.width,De.height);else{let ve=De.width,ce=De.height;for(let Le=0;Le<j;Le++)t.texImage2D(n.TEXTURE_2D,Le,W,ve,ce,0,qe,ct,null),ve>>=1,ce>>=1}}else if(Ie.length>0){if(ze&&ot){const ve=V(Ie[0]);t.texStorage2D(n.TEXTURE_2D,j,W,ve.width,ve.height)}for(let ve=0,ce=Ie.length;ve<ce;ve++)oe=Ie[ve],ze?Ke&&t.texSubImage2D(n.TEXTURE_2D,ve,0,0,qe,ct,oe):t.texImage2D(n.TEXTURE_2D,ve,W,qe,ct,oe);R.generateMipmaps=!1}else if(ze){if(ot){const ve=V(De);t.texStorage2D(n.TEXTURE_2D,j,W,ve.width,ve.height)}Ke&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,qe,ct,De)}else t.texImage2D(n.TEXTURE_2D,0,W,qe,ct,De);x(R)&&v(q),Ne.__version=ie.version,R.onUpdate&&R.onUpdate(R)}L.__version=R.version}function Ue(L,R,X){if(R.image.length!==6)return;const q=ae(L,R),$=R.source;t.bindTexture(n.TEXTURE_CUBE_MAP,L.__webglTexture,n.TEXTURE0+X);const ie=i.get($);if($.version!==ie.__version||q===!0){t.activeTexture(n.TEXTURE0+X);const Ne=Gt.getPrimaries(Gt.workingColorSpace),Re=R.colorSpace===Qs?null:Gt.getPrimaries(R.colorSpace),Pe=R.colorSpace===Qs||Ne===Re?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,R.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,R.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Pe);const st=R.isCompressedTexture||R.image[0].isCompressedTexture,De=R.image[0]&&R.image[0].isDataTexture,qe=[];for(let ce=0;ce<6;ce++)!st&&!De?qe[ce]=w(R.image[ce],!0,r.maxCubemapSize):qe[ce]=De?R.image[ce].image:R.image[ce],qe[ce]=He(R,qe[ce]);const ct=qe[0],W=s.convert(R.format,R.colorSpace),oe=s.convert(R.type),Ie=_(R.internalFormat,W,oe,R.colorSpace),ze=R.isVideoTexture!==!0,ot=ie.__version===void 0||q===!0,Ke=$.dataReady;let j=M(R,ct);K(n.TEXTURE_CUBE_MAP,R);let ve;if(st){ze&&ot&&t.texStorage2D(n.TEXTURE_CUBE_MAP,j,Ie,ct.width,ct.height);for(let ce=0;ce<6;ce++){ve=qe[ce].mipmaps;for(let Le=0;Le<ve.length;Le++){const Be=ve[Le];R.format!==Bi?W!==null?ze?Ke&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le,0,0,Be.width,Be.height,W,Be.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le,Ie,Be.width,Be.height,0,Be.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ze?Ke&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le,0,0,Be.width,Be.height,W,oe,Be.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le,Ie,Be.width,Be.height,0,W,oe,Be.data)}}}else{if(ve=R.mipmaps,ze&&ot){ve.length>0&&j++;const ce=V(qe[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,j,Ie,ce.width,ce.height)}for(let ce=0;ce<6;ce++)if(De){ze?Ke&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,0,0,qe[ce].width,qe[ce].height,W,oe,qe[ce].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,Ie,qe[ce].width,qe[ce].height,0,W,oe,qe[ce].data);for(let Le=0;Le<ve.length;Le++){const wt=ve[Le].image[ce].image;ze?Ke&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le+1,0,0,wt.width,wt.height,W,oe,wt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le+1,Ie,wt.width,wt.height,0,W,oe,wt.data)}}else{ze?Ke&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,0,0,W,oe,qe[ce]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,Ie,W,oe,qe[ce]);for(let Le=0;Le<ve.length;Le++){const Be=ve[Le];ze?Ke&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le+1,0,0,W,oe,Be.image[ce]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Le+1,Ie,W,oe,Be.image[ce])}}}x(R)&&v(n.TEXTURE_CUBE_MAP),ie.__version=$.version,R.onUpdate&&R.onUpdate(R)}L.__version=R.version}function se(L,R,X,q,$,ie){const Ne=s.convert(X.format,X.colorSpace),Re=s.convert(X.type),Pe=_(X.internalFormat,Ne,Re,X.colorSpace);if(!i.get(R).__hasExternalTextures){const De=Math.max(1,R.width>>ie),qe=Math.max(1,R.height>>ie);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,ie,Pe,De,qe,R.depth,0,Ne,Re,null):t.texImage2D($,ie,Pe,De,qe,0,Ne,Re,null)}t.bindFramebuffer(n.FRAMEBUFFER,L),Fe(R)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,q,$,i.get(X).__webglTexture,0,Se(R)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,q,$,i.get(X).__webglTexture,ie),t.bindFramebuffer(n.FRAMEBUFFER,null)}function xe(L,R,X){if(n.bindRenderbuffer(n.RENDERBUFFER,L),R.depthBuffer&&!R.stencilBuffer){let q=n.DEPTH_COMPONENT24;if(X||Fe(R)){const $=R.depthTexture;$&&$.isDepthTexture&&($.type===Ir?q=n.DEPTH_COMPONENT32F:$.type===ml&&(q=n.DEPTH_COMPONENT24));const ie=Se(R);Fe(R)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ie,q,R.width,R.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ie,q,R.width,R.height)}else n.renderbufferStorage(n.RENDERBUFFER,q,R.width,R.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,L)}else if(R.depthBuffer&&R.stencilBuffer){const q=Se(R);X&&Fe(R)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,q,n.DEPTH24_STENCIL8,R.width,R.height):Fe(R)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,q,n.DEPTH24_STENCIL8,R.width,R.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,R.width,R.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,L)}else{const q=R.textures;for(let $=0;$<q.length;$++){const ie=q[$],Ne=s.convert(ie.format,ie.colorSpace),Re=s.convert(ie.type),Pe=_(ie.internalFormat,Ne,Re,ie.colorSpace),st=Se(R);X&&Fe(R)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,st,Pe,R.width,R.height):Fe(R)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,st,Pe,R.width,R.height):n.renderbufferStorage(n.RENDERBUFFER,Pe,R.width,R.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ae(L,R){if(R&&R.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,L),!(R.depthTexture&&R.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(R.depthTexture).__webglTexture||R.depthTexture.image.width!==R.width||R.depthTexture.image.height!==R.height)&&(R.depthTexture.image.width=R.width,R.depthTexture.image.height=R.height,R.depthTexture.needsUpdate=!0),z(R.depthTexture,0);const q=i.get(R.depthTexture).__webglTexture,$=Se(R);if(R.depthTexture.format===rl)Fe(R)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,q,0,$):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,q,0);else if(R.depthTexture.format===nu)Fe(R)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,q,0,$):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,q,0);else throw new Error("Unknown depthTexture format")}function Ce(L){const R=i.get(L),X=L.isWebGLCubeRenderTarget===!0;if(L.depthTexture&&!R.__autoAllocateDepthBuffer){if(X)throw new Error("target.depthTexture not supported in Cube render targets");Ae(R.__webglFramebuffer,L)}else if(X){R.__webglDepthbuffer=[];for(let q=0;q<6;q++)t.bindFramebuffer(n.FRAMEBUFFER,R.__webglFramebuffer[q]),R.__webglDepthbuffer[q]=n.createRenderbuffer(),xe(R.__webglDepthbuffer[q],L,!1)}else t.bindFramebuffer(n.FRAMEBUFFER,R.__webglFramebuffer),R.__webglDepthbuffer=n.createRenderbuffer(),xe(R.__webglDepthbuffer,L,!1);t.bindFramebuffer(n.FRAMEBUFFER,null)}function tt(L,R,X){const q=i.get(L);R!==void 0&&se(q.__webglFramebuffer,L,L.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),X!==void 0&&Ce(L)}function Qe(L){const R=L.texture,X=i.get(L),q=i.get(R);L.addEventListener("dispose",N);const $=L.textures,ie=L.isWebGLCubeRenderTarget===!0,Ne=$.length>1;if(Ne||(q.__webglTexture===void 0&&(q.__webglTexture=n.createTexture()),q.__version=R.version,o.memory.textures++),ie){X.__webglFramebuffer=[];for(let Re=0;Re<6;Re++)if(R.mipmaps&&R.mipmaps.length>0){X.__webglFramebuffer[Re]=[];for(let Pe=0;Pe<R.mipmaps.length;Pe++)X.__webglFramebuffer[Re][Pe]=n.createFramebuffer()}else X.__webglFramebuffer[Re]=n.createFramebuffer()}else{if(R.mipmaps&&R.mipmaps.length>0){X.__webglFramebuffer=[];for(let Re=0;Re<R.mipmaps.length;Re++)X.__webglFramebuffer[Re]=n.createFramebuffer()}else X.__webglFramebuffer=n.createFramebuffer();if(Ne)for(let Re=0,Pe=$.length;Re<Pe;Re++){const st=i.get($[Re]);st.__webglTexture===void 0&&(st.__webglTexture=n.createTexture(),o.memory.textures++)}if(L.samples>0&&Fe(L)===!1){X.__webglMultisampledFramebuffer=n.createFramebuffer(),X.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,X.__webglMultisampledFramebuffer);for(let Re=0;Re<$.length;Re++){const Pe=$[Re];X.__webglColorRenderbuffer[Re]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,X.__webglColorRenderbuffer[Re]);const st=s.convert(Pe.format,Pe.colorSpace),De=s.convert(Pe.type),qe=_(Pe.internalFormat,st,De,Pe.colorSpace,L.isXRRenderTarget===!0),ct=Se(L);n.renderbufferStorageMultisample(n.RENDERBUFFER,ct,qe,L.width,L.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.RENDERBUFFER,X.__webglColorRenderbuffer[Re])}n.bindRenderbuffer(n.RENDERBUFFER,null),L.depthBuffer&&(X.__webglDepthRenderbuffer=n.createRenderbuffer(),xe(X.__webglDepthRenderbuffer,L,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(ie){t.bindTexture(n.TEXTURE_CUBE_MAP,q.__webglTexture),K(n.TEXTURE_CUBE_MAP,R);for(let Re=0;Re<6;Re++)if(R.mipmaps&&R.mipmaps.length>0)for(let Pe=0;Pe<R.mipmaps.length;Pe++)se(X.__webglFramebuffer[Re][Pe],L,R,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,Pe);else se(X.__webglFramebuffer[Re],L,R,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0);x(R)&&v(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ne){for(let Re=0,Pe=$.length;Re<Pe;Re++){const st=$[Re],De=i.get(st);t.bindTexture(n.TEXTURE_2D,De.__webglTexture),K(n.TEXTURE_2D,st),se(X.__webglFramebuffer,L,st,n.COLOR_ATTACHMENT0+Re,n.TEXTURE_2D,0),x(st)&&v(n.TEXTURE_2D)}t.unbindTexture()}else{let Re=n.TEXTURE_2D;if((L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(Re=L.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Re,q.__webglTexture),K(Re,R),R.mipmaps&&R.mipmaps.length>0)for(let Pe=0;Pe<R.mipmaps.length;Pe++)se(X.__webglFramebuffer[Pe],L,R,n.COLOR_ATTACHMENT0,Re,Pe);else se(X.__webglFramebuffer,L,R,n.COLOR_ATTACHMENT0,Re,0);x(R)&&v(Re),t.unbindTexture()}L.depthBuffer&&Ce(L)}function Q(L){const R=L.textures;for(let X=0,q=R.length;X<q;X++){const $=R[X];if(x($)){const ie=L.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Ne=i.get($).__webglTexture;t.bindTexture(ie,Ne),v(ie),t.unbindTexture()}}}const nt=[],pe=[];function be(L){if(L.samples>0){if(Fe(L)===!1){const R=L.textures,X=L.width,q=L.height;let $=n.COLOR_BUFFER_BIT;const ie=L.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ne=i.get(L),Re=R.length>1;if(Re)for(let Pe=0;Pe<R.length;Pe++)t.bindFramebuffer(n.FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Pe,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Ne.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Pe,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ne.__webglFramebuffer);for(let Pe=0;Pe<R.length;Pe++){if(L.resolveDepthBuffer&&(L.depthBuffer&&($|=n.DEPTH_BUFFER_BIT),L.stencilBuffer&&L.resolveStencilBuffer&&($|=n.STENCIL_BUFFER_BIT)),Re){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Ne.__webglColorRenderbuffer[Pe]);const st=i.get(R[Pe]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,st,0)}n.blitFramebuffer(0,0,X,q,0,0,X,q,$,n.NEAREST),u===!0&&(nt.length=0,pe.length=0,nt.push(n.COLOR_ATTACHMENT0+Pe),L.depthBuffer&&L.resolveDepthBuffer===!1&&(nt.push(ie),pe.push(ie),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,pe)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,nt))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Re)for(let Pe=0;Pe<R.length;Pe++){t.bindFramebuffer(n.FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Pe,n.RENDERBUFFER,Ne.__webglColorRenderbuffer[Pe]);const st=i.get(R[Pe]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Ne.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Pe,n.TEXTURE_2D,st,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ne.__webglMultisampledFramebuffer)}else if(L.depthBuffer&&L.resolveDepthBuffer===!1&&u){const R=L.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[R])}}}function Se(L){return Math.min(r.maxSamples,L.samples)}function Fe(L){const R=i.get(L);return L.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&R.__useRenderToTexture!==!1}function Te(L){const R=o.render.frame;f.get(L)!==R&&(f.set(L,R),L.update())}function He(L,R){const X=L.colorSpace,q=L.format,$=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||X!==po&&X!==Qs&&(Gt.getTransfer(X)===Yt?(q!==Bi||$!==Ns)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",X)),R}function V(L){return typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement?(d.width=L.naturalWidth||L.width,d.height=L.naturalHeight||L.height):typeof VideoFrame<"u"&&L instanceof VideoFrame?(d.width=L.displayWidth,d.height=L.displayHeight):(d.width=L.width,d.height=L.height),d}this.allocateTextureUnit=U,this.resetTextureUnits=A,this.setTexture2D=z,this.setTexture2DArray=Z,this.setTexture3D=J,this.setTextureCube=ne,this.rebindTextures=tt,this.setupRenderTarget=Qe,this.updateRenderTargetMipmap=Q,this.updateMultisampleRenderTarget=be,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=se,this.useMultisampledRTT=Fe}function G2(n,e){function t(i,r=Qs){let s;const o=Gt.getTransfer(r);if(i===Ns)return n.UNSIGNED_BYTE;if(i===d1)return n.UNSIGNED_SHORT_4_4_4_4;if(i===f1)return n.UNSIGNED_SHORT_5_5_5_1;if(i===a2)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===s2)return n.BYTE;if(i===o2)return n.SHORT;if(i===c1)return n.UNSIGNED_SHORT;if(i===u1)return n.INT;if(i===ml)return n.UNSIGNED_INT;if(i===Ir)return n.FLOAT;if(i===Gf)return n.HALF_FLOAT;if(i===l2)return n.ALPHA;if(i===c2)return n.RGB;if(i===Bi)return n.RGBA;if(i===u2)return n.LUMINANCE;if(i===d2)return n.LUMINANCE_ALPHA;if(i===rl)return n.DEPTH_COMPONENT;if(i===nu)return n.DEPTH_STENCIL;if(i===h1)return n.RED;if(i===p1)return n.RED_INTEGER;if(i===f2)return n.RG;if(i===m1)return n.RG_INTEGER;if(i===g1)return n.RGBA_INTEGER;if(i===Gm||i===Wm||i===jm||i===Xm)if(o===Yt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Gm)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Wm)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===jm)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Xm)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Gm)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Wm)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===jm)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Xm)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===aS||i===lS||i===cS||i===uS)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===aS)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===lS)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===cS)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===uS)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===dS||i===fS||i===hS)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===dS||i===fS)return o===Yt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===hS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===pS||i===mS||i===gS||i===vS||i===yS||i===_S||i===xS||i===SS||i===wS||i===MS||i===ES||i===bS||i===AS||i===TS)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===pS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===mS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===gS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===vS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===yS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===_S)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===xS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===SS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===wS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===MS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===ES)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===bS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===AS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===TS)return o===Yt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===qm||i===CS||i===RS)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===qm)return o===Yt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===CS)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===RS)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===h2||i===PS||i===IS||i===LS)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===qm)return s.COMPRESSED_RED_RGTC1_EXT;if(i===PS)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===IS)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===LS)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===du?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class W2 extends sn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Dc extends Bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const nV={type:"move"};class y_{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Dc,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 Dc,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new k,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new k),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Dc,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new k,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new k),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,u=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const w of e.hand.values()){const x=t.getJointPose(w,i),v=this._getHandJoint(d,w);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}const f=d.joints["index-finger-tip"],h=d.joints["thumb-tip"],p=f.position.distanceTo(h.position),g=.02,y=.005;d.inputState.pinching&&p>g+y?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&p<=g-y&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.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),a.matrixWorldNeedsUpdate=!0,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(nV)))}return a!==null&&(a.visible=r!==null),u!==null&&(u.visible=s!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Dc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const iV=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,rV=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class sV{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new hn,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){const i=t.cameras[0].viewport,r=new as({vertexShader:iV,fragmentShader:rV,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new Mn(new hu(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class oV extends Ds{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",u=1,d=null,f=null,h=null,p=null,g=null,y=null;const w=new sV,x=t.getContextAttributes();let v=null,_=null;const M=[],b=[],N=new Ee;let C=null;const P=new sn;P.layers.enable(1),P.viewport=new Wt;const D=new sn;D.layers.enable(2),D.viewport=new Wt;const I=[P,D],A=new W2;A.layers.enable(1),A.layers.enable(2);let U=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let xe=M[se];return xe===void 0&&(xe=new y_,M[se]=xe),xe.getTargetRaySpace()},this.getControllerGrip=function(se){let xe=M[se];return xe===void 0&&(xe=new y_,M[se]=xe),xe.getGripSpace()},this.getHand=function(se){let xe=M[se];return xe===void 0&&(xe=new y_,M[se]=xe),xe.getHandSpace()};function z(se){const xe=b.indexOf(se.inputSource);if(xe===-1)return;const Ae=M[xe];Ae!==void 0&&(Ae.update(se.inputSource,se.frame,d||o),Ae.dispatchEvent({type:se.type,data:se.inputSource}))}function Z(){r.removeEventListener("select",z),r.removeEventListener("selectstart",z),r.removeEventListener("selectend",z),r.removeEventListener("squeeze",z),r.removeEventListener("squeezestart",z),r.removeEventListener("squeezeend",z),r.removeEventListener("end",Z),r.removeEventListener("inputsourceschange",J);for(let se=0;se<M.length;se++){const xe=b[se];xe!==null&&(b[se]=null,M[se].disconnect(xe))}U=null,G=null,w.reset(),e.setRenderTarget(v),g=null,p=null,h=null,r=null,_=null,Ue.stop(),i.isPresenting=!1,e.setPixelRatio(C),e.setSize(N.width,N.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(se){s=se,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(se){a=se,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||o},this.setReferenceSpace=function(se){d=se},this.getBaseLayer=function(){return p!==null?p:g},this.getBinding=function(){return h},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(se){if(r=se,r!==null){if(v=e.getRenderTarget(),r.addEventListener("select",z),r.addEventListener("selectstart",z),r.addEventListener("selectend",z),r.addEventListener("squeeze",z),r.addEventListener("squeezestart",z),r.addEventListener("squeezeend",z),r.addEventListener("end",Z),r.addEventListener("inputsourceschange",J),x.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(N),r.renderState.layers===void 0){const xe={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(r,t,xe),r.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),_=new os(g.framebufferWidth,g.framebufferHeight,{format:Bi,type:Ns,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil})}else{let xe=null,Ae=null,Ce=null;x.depth&&(Ce=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,xe=x.stencil?nu:rl,Ae=x.stencil?du:ml);const tt={colorFormat:t.RGBA8,depthFormat:Ce,scaleFactor:s};h=new XRWebGLBinding(r,t),p=h.createProjectionLayer(tt),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),_=new os(p.textureWidth,p.textureHeight,{format:Bi,type:Ns,depthTexture:new E1(p.textureWidth,p.textureHeight,Ae,void 0,void 0,void 0,void 0,void 0,void 0,xe),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1})}_.isXRRenderTarget=!0,this.setFoveation(u),d=null,o=await r.requestReferenceSpace(a),Ue.setContext(r),Ue.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function J(se){for(let xe=0;xe<se.removed.length;xe++){const Ae=se.removed[xe],Ce=b.indexOf(Ae);Ce>=0&&(b[Ce]=null,M[Ce].disconnect(Ae))}for(let xe=0;xe<se.added.length;xe++){const Ae=se.added[xe];let Ce=b.indexOf(Ae);if(Ce===-1){for(let Qe=0;Qe<M.length;Qe++)if(Qe>=b.length){b.push(Ae),Ce=Qe;break}else if(b[Qe]===null){b[Qe]=Ae,Ce=Qe;break}if(Ce===-1)break}const tt=M[Ce];tt&&tt.connect(Ae)}}const ne=new k,le=new k;function O(se,xe,Ae){ne.setFromMatrixPosition(xe.matrixWorld),le.setFromMatrixPosition(Ae.matrixWorld);const Ce=ne.distanceTo(le),tt=xe.projectionMatrix.elements,Qe=Ae.projectionMatrix.elements,Q=tt[14]/(tt[10]-1),nt=tt[14]/(tt[10]+1),pe=(tt[9]+1)/tt[5],be=(tt[9]-1)/tt[5],Se=(tt[8]-1)/tt[0],Fe=(Qe[8]+1)/Qe[0],Te=Q*Se,He=Q*Fe,V=Ce/(-Se+Fe),L=V*-Se;xe.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(L),se.translateZ(V),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert();const R=Q+V,X=nt+V,q=Te-L,$=He+(Ce-L),ie=pe*nt/X*R,Ne=be*nt/X*R;se.projectionMatrix.makePerspective(q,$,ie,Ne,R,X),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}function Y(se,xe){xe===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(xe.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(r===null)return;w.texture!==null&&(se.near=w.depthNear,se.far=w.depthFar),A.near=D.near=P.near=se.near,A.far=D.far=P.far=se.far,(U!==A.near||G!==A.far)&&(r.updateRenderState({depthNear:A.near,depthFar:A.far}),U=A.near,G=A.far,P.near=U,P.far=G,D.near=U,D.far=G,P.updateProjectionMatrix(),D.updateProjectionMatrix(),se.updateProjectionMatrix());const xe=se.parent,Ae=A.cameras;Y(A,xe);for(let Ce=0;Ce<Ae.length;Ce++)Y(Ae[Ce],xe);Ae.length===2?O(A,P,D):A.projectionMatrix.copy(P.projectionMatrix),K(se,A,xe)};function K(se,xe,Ae){Ae===null?se.matrix.copy(xe.matrixWorld):(se.matrix.copy(Ae.matrixWorld),se.matrix.invert(),se.matrix.multiply(xe.matrixWorld)),se.matrix.decompose(se.position,se.quaternion,se.scale),se.updateMatrixWorld(!0),se.projectionMatrix.copy(xe.projectionMatrix),se.projectionMatrixInverse.copy(xe.projectionMatrixInverse),se.isPerspectiveCamera&&(se.fov=iu*2*Math.atan(1/se.projectionMatrix.elements[5]),se.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(p===null&&g===null))return u},this.setFoveation=function(se){u=se,p!==null&&(p.fixedFoveation=se),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=se)},this.hasDepthSensing=function(){return w.texture!==null};let ae=null;function ge(se,xe){if(f=xe.getViewerPose(d||o),y=xe,f!==null){const Ae=f.views;g!==null&&(e.setRenderTargetFramebuffer(_,g.framebuffer),e.setRenderTarget(_));let Ce=!1;Ae.length!==A.cameras.length&&(A.cameras.length=0,Ce=!0);for(let Qe=0;Qe<Ae.length;Qe++){const Q=Ae[Qe];let nt=null;if(g!==null)nt=g.getViewport(Q);else{const be=h.getViewSubImage(p,Q);nt=be.viewport,Qe===0&&(e.setRenderTargetTextures(_,be.colorTexture,p.ignoreDepthValues?void 0:be.depthStencilTexture),e.setRenderTarget(_))}let pe=I[Qe];pe===void 0&&(pe=new sn,pe.layers.enable(Qe),pe.viewport=new Wt,I[Qe]=pe),pe.matrix.fromArray(Q.transform.matrix),pe.matrix.decompose(pe.position,pe.quaternion,pe.scale),pe.projectionMatrix.fromArray(Q.projectionMatrix),pe.projectionMatrixInverse.copy(pe.projectionMatrix).invert(),pe.viewport.set(nt.x,nt.y,nt.width,nt.height),Qe===0&&(A.matrix.copy(pe.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),Ce===!0&&A.cameras.push(pe)}const tt=r.enabledFeatures;if(tt&&tt.includes("depth-sensing")){const Qe=h.getDepthInformation(Ae[0]);Qe&&Qe.isValid&&Qe.texture&&w.init(e,Qe,r.renderState)}}for(let Ae=0;Ae<M.length;Ae++){const Ce=b[Ae],tt=M[Ae];Ce!==null&&tt!==void 0&&tt.update(Ce,xe,d||o)}w.render(e,A),ae&&ae(se,xe),xe.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:xe}),y=null}const Ue=new F2;Ue.setAnimationLoop(ge),this.setAnimationLoop=function(se){ae=se},this.dispose=function(){}}}const Ra=new fr,aV=new ht;function lV(n,e){function t(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function i(x,v){v.color.getRGB(x.fogColor.value,N2(n)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function r(x,v,_,M,b){v.isMeshBasicMaterial||v.isMeshLambertMaterial?s(x,v):v.isMeshToonMaterial?(s(x,v),h(x,v)):v.isMeshPhongMaterial?(s(x,v),f(x,v)):v.isMeshStandardMaterial?(s(x,v),p(x,v),v.isMeshPhysicalMaterial&&g(x,v,b)):v.isMeshMatcapMaterial?(s(x,v),y(x,v)):v.isMeshDepthMaterial?s(x,v):v.isMeshDistanceMaterial?(s(x,v),w(x,v)):v.isMeshNormalMaterial?s(x,v):v.isLineBasicMaterial?(o(x,v),v.isLineDashedMaterial&&a(x,v)):v.isPointsMaterial?u(x,v,_,M):v.isSpriteMaterial?d(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,t(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,t(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,t(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===Pi&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,t(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===Pi&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,t(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,t(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);const _=e.get(v),M=_.envMap,b=_.envMapRotation;if(M&&(x.envMap.value=M,Ra.copy(b),Ra.x*=-1,Ra.y*=-1,Ra.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(Ra.y*=-1,Ra.z*=-1),x.envMapRotation.value.setFromMatrix4(aV.makeRotationFromEuler(Ra)),x.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap){x.lightMap.value=v.lightMap;const N=n._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*N,t(v.lightMap,x.lightMapTransform)}v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,x.aoMapTransform))}function o(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,t(v.map,x.mapTransform))}function a(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function u(x,v,_,M){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*_,x.scale.value=M*.5,v.map&&(x.map.value=v.map,t(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,t(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,t(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,t(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function f(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function h(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function p(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,x.roughnessMapTransform)),v.envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function g(x,v,_){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Pi&&x.clearcoatNormalScale.value.negate())),v.dispersion>0&&(x.dispersion.value=v.dispersion),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=_.texture,x.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,v){v.matcap&&(x.matcap.value=v.matcap)}function w(x,v){const _=e.get(v).light;x.referencePosition.value.setFromMatrixPosition(_.matrixWorld),x.nearDistance.value=_.shadow.camera.near,x.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function cV(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function u(_,M){const b=M.program;i.uniformBlockBinding(_,b)}function d(_,M){let b=r[_.id];b===void 0&&(y(_),b=f(_),r[_.id]=b,_.addEventListener("dispose",x));const N=M.program;i.updateUBOMapping(_,N);const C=e.render.frame;s[_.id]!==C&&(p(_),s[_.id]=C)}function f(_){const M=h();_.__bindingPointIndex=M;const b=n.createBuffer(),N=_.__size,C=_.usage;return n.bindBuffer(n.UNIFORM_BUFFER,b),n.bufferData(n.UNIFORM_BUFFER,N,C),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,M,b),b}function h(){for(let _=0;_<a;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(_){const M=r[_.id],b=_.uniforms,N=_.__cache;n.bindBuffer(n.UNIFORM_BUFFER,M);for(let C=0,P=b.length;C<P;C++){const D=Array.isArray(b[C])?b[C]:[b[C]];for(let I=0,A=D.length;I<A;I++){const U=D[I];if(g(U,C,I,N)===!0){const G=U.__offset,z=Array.isArray(U.value)?U.value:[U.value];let Z=0;for(let J=0;J<z.length;J++){const ne=z[J],le=w(ne);typeof ne=="number"||typeof ne=="boolean"?(U.__data[0]=ne,n.bufferSubData(n.UNIFORM_BUFFER,G+Z,U.__data)):ne.isMatrix3?(U.__data[0]=ne.elements[0],U.__data[1]=ne.elements[1],U.__data[2]=ne.elements[2],U.__data[3]=0,U.__data[4]=ne.elements[3],U.__data[5]=ne.elements[4],U.__data[6]=ne.elements[5],U.__data[7]=0,U.__data[8]=ne.elements[6],U.__data[9]=ne.elements[7],U.__data[10]=ne.elements[8],U.__data[11]=0):(ne.toArray(U.__data,Z),Z+=le.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,G,U.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function g(_,M,b,N){const C=_.value,P=M+"_"+b;if(N[P]===void 0)return typeof C=="number"||typeof C=="boolean"?N[P]=C:N[P]=C.clone(),!0;{const D=N[P];if(typeof C=="number"||typeof C=="boolean"){if(D!==C)return N[P]=C,!0}else if(D.equals(C)===!1)return D.copy(C),!0}return!1}function y(_){const M=_.uniforms;let b=0;const N=16;for(let P=0,D=M.length;P<D;P++){const I=Array.isArray(M[P])?M[P]:[M[P]];for(let A=0,U=I.length;A<U;A++){const G=I[A],z=Array.isArray(G.value)?G.value:[G.value];for(let Z=0,J=z.length;Z<J;Z++){const ne=z[Z],le=w(ne),O=b%N;O!==0&&N-O<le.boundary&&(b+=N-O),G.__data=new Float32Array(le.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=b,b+=le.storage}}}const C=b%N;return C>0&&(b+=N-C),_.__size=b,_.__cache={},this}function w(_){const M={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(M.boundary=4,M.storage=4):_.isVector2?(M.boundary=8,M.storage=8):_.isVector3||_.isColor?(M.boundary=16,M.storage=12):_.isVector4?(M.boundary=16,M.storage=16):_.isMatrix3?(M.boundary=48,M.storage=48):_.isMatrix4?(M.boundary=64,M.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),M}function x(_){const M=_.target;M.removeEventListener("dispose",x);const b=o.indexOf(M.__bindingPointIndex);o.splice(b,1),n.deleteBuffer(r[M.id]),delete r[M.id],delete s[M.id]}function v(){for(const _ in r)n.deleteBuffer(r[_]);o=[],r={},s={}}return{bind:u,update:d,dispose:v}}class j2{constructor(e={}){const{canvas:t=C2(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:d=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=o;const g=new Uint32Array(4),y=new Int32Array(4);let w=null,x=null;const v=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=br,this._useLegacyLights=!1,this.toneMapping=Is,this.toneMappingExposure=1;const M=this;let b=!1,N=0,C=0,P=null,D=-1,I=null;const A=new Wt,U=new Wt;let G=null;const z=new Xe(0);let Z=0,J=t.width,ne=t.height,le=1,O=null,Y=null;const K=new Wt(0,0,J,ne),ae=new Wt(0,0,J,ne);let ge=!1;const Ue=new qf;let se=!1,xe=!1;const Ae=new ht,Ce=new k,tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Qe(){return P===null?le:1}let Q=i;function nt(F,re){return t.getContext(F,re)}try{const F={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:u,preserveDrawingBuffer:d,powerPreference:f,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${I0}`),t.addEventListener("webglcontextlost",j,!1),t.addEventListener("webglcontextrestored",ve,!1),t.addEventListener("webglcontextcreationerror",ce,!1),Q===null){const re="webgl2";if(Q=nt(re,F),Q===null)throw nt(re)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(F){throw console.error("THREE.WebGLRenderer: "+F.message),F}let pe,be,Se,Fe,Te,He,V,L,R,X,q,$,ie,Ne,Re,Pe,st,De,qe,ct,W,oe,Ie,ze;function ot(){pe=new wB(Q),pe.init(),oe=new G2(Q,pe),be=new gB(Q,pe,e,oe),Se=new eV(Q),Fe=new bB(Q),Te=new H5,He=new tV(Q,pe,Se,Te,be,oe,Fe),V=new yB(M),L=new SB(M),R=new Lk(Q),Ie=new pB(Q,R),X=new MB(Q,R,Fe,Ie),q=new TB(Q,X,R,Fe),qe=new AB(Q,be,He),Pe=new vB(Te),$=new V5(M,V,L,pe,be,Ie,Pe),ie=new lV(M,Te),Ne=new W5,Re=new Z5(pe),De=new hB(M,V,L,Se,q,p,u),st=new Q5(M,q,be),ze=new cV(Q,Fe,be,Se),ct=new mB(Q,pe,Fe),W=new EB(Q,pe,Fe),Fe.programs=$.programs,M.capabilities=be,M.extensions=pe,M.properties=Te,M.renderLists=Ne,M.shadowMap=st,M.state=Se,M.info=Fe}ot();const Ke=new oV(M,Q);this.xr=Ke,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const F=pe.get("WEBGL_lose_context");F&&F.loseContext()},this.forceContextRestore=function(){const F=pe.get("WEBGL_lose_context");F&&F.restoreContext()},this.getPixelRatio=function(){return le},this.setPixelRatio=function(F){F!==void 0&&(le=F,this.setSize(J,ne,!1))},this.getSize=function(F){return F.set(J,ne)},this.setSize=function(F,re,he=!0){if(Ke.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}J=F,ne=re,t.width=Math.floor(F*le),t.height=Math.floor(re*le),he===!0&&(t.style.width=F+"px",t.style.height=re+"px"),this.setViewport(0,0,F,re)},this.getDrawingBufferSize=function(F){return F.set(J*le,ne*le).floor()},this.setDrawingBufferSize=function(F,re,he){J=F,ne=re,le=he,t.width=Math.floor(F*he),t.height=Math.floor(re*he),this.setViewport(0,0,F,re)},this.getCurrentViewport=function(F){return F.copy(A)},this.getViewport=function(F){return F.copy(K)},this.setViewport=function(F,re,he,de){F.isVector4?K.set(F.x,F.y,F.z,F.w):K.set(F,re,he,de),Se.viewport(A.copy(K).multiplyScalar(le).round())},this.getScissor=function(F){return F.copy(ae)},this.setScissor=function(F,re,he,de){F.isVector4?ae.set(F.x,F.y,F.z,F.w):ae.set(F,re,he,de),Se.scissor(U.copy(ae).multiplyScalar(le).round())},this.getScissorTest=function(){return ge},this.setScissorTest=function(F){Se.setScissorTest(ge=F)},this.setOpaqueSort=function(F){O=F},this.setTransparentSort=function(F){Y=F},this.getClearColor=function(F){return F.copy(De.getClearColor())},this.setClearColor=function(){De.setClearColor.apply(De,arguments)},this.getClearAlpha=function(){return De.getClearAlpha()},this.setClearAlpha=function(){De.setClearAlpha.apply(De,arguments)},this.clear=function(F=!0,re=!0,he=!0){let de=0;if(F){let fe=!1;if(P!==null){const Ge=P.texture.format;fe=Ge===g1||Ge===m1||Ge===p1}if(fe){const Ge=P.texture.type,et=Ge===Ns||Ge===ml||Ge===c1||Ge===du||Ge===d1||Ge===f1,it=De.getClearColor(),pt=De.getClearAlpha(),gt=it.r,vt=it.g,yt=it.b;et?(g[0]=gt,g[1]=vt,g[2]=yt,g[3]=pt,Q.clearBufferuiv(Q.COLOR,0,g)):(y[0]=gt,y[1]=vt,y[2]=yt,y[3]=pt,Q.clearBufferiv(Q.COLOR,0,y))}else de|=Q.COLOR_BUFFER_BIT}re&&(de|=Q.DEPTH_BUFFER_BIT),he&&(de|=Q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Q.clear(de)},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",j,!1),t.removeEventListener("webglcontextrestored",ve,!1),t.removeEventListener("webglcontextcreationerror",ce,!1),Ne.dispose(),Re.dispose(),Te.dispose(),V.dispose(),L.dispose(),q.dispose(),Ie.dispose(),ze.dispose(),$.dispose(),Ke.dispose(),Ke.removeEventListener("sessionstart",Ut),Ke.removeEventListener("sessionend",ji),Hn.stop()};function j(F){F.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function ve(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const F=Fe.autoReset,re=st.enabled,he=st.autoUpdate,de=st.needsUpdate,fe=st.type;ot(),Fe.autoReset=F,st.enabled=re,st.autoUpdate=he,st.needsUpdate=de,st.type=fe}function ce(F){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",F.statusMessage)}function Le(F){const re=F.target;re.removeEventListener("dispose",Le),Be(re)}function Be(F){wt(F),Te.remove(F)}function wt(F){const re=Te.get(F).programs;re!==void 0&&(re.forEach(function(he){$.releaseProgram(he)}),F.isShaderMaterial&&$.releaseShaderCache(F))}this.renderBufferDirect=function(F,re,he,de,fe,Ge){re===null&&(re=tt);const et=fe.isMesh&&fe.matrixWorld.determinant()<0,it=cv(F,re,he,de,fe);Se.setMaterial(de,et);let pt=he.index,gt=1;if(de.wireframe===!0){if(pt=X.getWireframeAttribute(he),pt===void 0)return;gt=2}const vt=he.drawRange,yt=he.attributes.position;let tn=vt.start*gt,bn=(vt.start+vt.count)*gt;Ge!==null&&(tn=Math.max(tn,Ge.start*gt),bn=Math.min(bn,(Ge.start+Ge.count)*gt)),pt!==null?(tn=Math.max(tn,0),bn=Math.min(bn,pt.count)):yt!=null&&(tn=Math.max(tn,0),bn=Math.min(bn,yt.count));const xi=bn-tn;if(xi<0||xi===1/0)return;Ie.setup(fe,de,it,he,pt);let Xi,Rt=ct;if(pt!==null&&(Xi=R.get(pt),Rt=W,Rt.setIndex(Xi)),fe.isMesh)de.wireframe===!0?(Se.setLineWidth(de.wireframeLinewidth*Qe()),Rt.setMode(Q.LINES)):Rt.setMode(Q.TRIANGLES);else if(fe.isLine){let dt=de.linewidth;dt===void 0&&(dt=1),Se.setLineWidth(dt*Qe()),fe.isLineSegments?Rt.setMode(Q.LINES):fe.isLineLoop?Rt.setMode(Q.LINE_LOOP):Rt.setMode(Q.LINE_STRIP)}else fe.isPoints?Rt.setMode(Q.POINTS):fe.isSprite&&Rt.setMode(Q.TRIANGLES);if(fe.isBatchedMesh)fe._multiDrawInstances!==null?Rt.renderMultiDrawInstances(fe._multiDrawStarts,fe._multiDrawCounts,fe._multiDrawCount,fe._multiDrawInstances):Rt.renderMultiDraw(fe._multiDrawStarts,fe._multiDrawCounts,fe._multiDrawCount);else if(fe.isInstancedMesh)Rt.renderInstances(tn,xi,fe.count);else if(he.isInstancedBufferGeometry){const dt=he._maxInstanceCount!==void 0?he._maxInstanceCount:1/0,Vt=Math.min(he.instanceCount,dt);Rt.renderInstances(tn,xi,Vt)}else Rt.render(tn,xi)};function Ht(F,re,he){F.transparent===!0&&F.side===Qr&&F.forceSinglePass===!1?(F.side=Pi,F.needsUpdate=!0,bl(F,re,he),F.side=uo,F.needsUpdate=!0,bl(F,re,he),F.side=Qr):bl(F,re,he)}this.compile=function(F,re,he=null){he===null&&(he=F),x=Re.get(he),x.init(re),_.push(x),he.traverseVisible(function(fe){fe.isLight&&fe.layers.test(re.layers)&&(x.pushLight(fe),fe.castShadow&&x.pushShadow(fe))}),F!==he&&F.traverseVisible(function(fe){fe.isLight&&fe.layers.test(re.layers)&&(x.pushLight(fe),fe.castShadow&&x.pushShadow(fe))}),x.setupLights(M._useLegacyLights);const de=new Set;return F.traverse(function(fe){const Ge=fe.material;if(Ge)if(Array.isArray(Ge))for(let et=0;et<Ge.length;et++){const it=Ge[et];Ht(it,he,fe),de.add(it)}else Ht(Ge,he,fe),de.add(Ge)}),_.pop(),x=null,de},this.compileAsync=function(F,re,he=null){const de=this.compile(F,re,he);return new Promise(fe=>{function Ge(){if(de.forEach(function(et){Te.get(et).currentProgram.isReady()&&de.delete(et)}),de.size===0){fe(F);return}setTimeout(Ge,10)}pe.get("KHR_parallel_shader_compile")!==null?Ge():setTimeout(Ge,10)})};let Zt=null;function Vn(F){Zt&&Zt(F)}function Ut(){Hn.stop()}function ji(){Hn.start()}const Hn=new F2;Hn.setAnimationLoop(Vn),typeof self<"u"&&Hn.setContext(self),this.setAnimationLoop=function(F){Zt=F,Ke.setAnimationLoop(F),F===null?Hn.stop():Hn.start()},Ke.addEventListener("sessionstart",Ut),Ke.addEventListener("sessionend",ji),this.render=function(F,re){if(re!==void 0&&re.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),re.parent===null&&re.matrixWorldAutoUpdate===!0&&re.updateMatrixWorld(),Ke.enabled===!0&&Ke.isPresenting===!0&&(Ke.cameraAutoUpdate===!0&&Ke.updateCamera(re),re=Ke.getCamera()),F.isScene===!0&&F.onBeforeRender(M,F,re,P),x=Re.get(F,_.length),x.init(re),_.push(x),Ae.multiplyMatrices(re.projectionMatrix,re.matrixWorldInverse),Ue.setFromProjectionMatrix(Ae),xe=this.localClippingEnabled,se=Pe.init(this.clippingPlanes,xe),w=Ne.get(F,v.length),w.init(),v.push(w),ih(F,re,0,M.sortObjects),w.finish(),M.sortObjects===!0&&w.sort(O,Y);const he=Ke.enabled===!1||Ke.isPresenting===!1||Ke.hasDepthSensing()===!1;he&&De.addToRenderList(w,F),this.info.render.frame++,se===!0&&Pe.beginShadows();const de=x.state.shadowsArray;st.render(de,F,re),se===!0&&Pe.endShadows(),this.info.autoReset===!0&&this.info.reset();const fe=w.opaque,Ge=w.transmissive;if(x.setupLights(M._useLegacyLights),re.isArrayCamera){const et=re.cameras;if(Ge.length>0)for(let it=0,pt=et.length;it<pt;it++){const gt=et[it];sh(fe,Ge,F,gt)}he&&De.render(F);for(let it=0,pt=et.length;it<pt;it++){const gt=et[it];rh(w,F,gt,gt.viewport)}}else Ge.length>0&&sh(fe,Ge,F,re),he&&De.render(F),rh(w,F,re);P!==null&&(He.updateMultisampleRenderTarget(P),He.updateRenderTargetMipmap(P)),F.isScene===!0&&F.onAfterRender(M,F,re),Ie.resetDefaultState(),D=-1,I=null,_.pop(),_.length>0?(x=_[_.length-1],se===!0&&Pe.setGlobalState(M.clippingPlanes,x.state.camera)):x=null,v.pop(),v.length>0?w=v[v.length-1]:w=null};function ih(F,re,he,de){if(F.visible===!1)return;if(F.layers.test(re.layers)){if(F.isGroup)he=F.renderOrder;else if(F.isLOD)F.autoUpdate===!0&&F.update(re);else if(F.isLight)x.pushLight(F),F.castShadow&&x.pushShadow(F);else if(F.isSprite){if(!F.frustumCulled||Ue.intersectsSprite(F)){de&&Ce.setFromMatrixPosition(F.matrixWorld).applyMatrix4(Ae);const et=q.update(F),it=F.material;it.visible&&w.push(F,et,it,he,Ce.z,null)}}else if((F.isMesh||F.isLine||F.isPoints)&&(!F.frustumCulled||Ue.intersectsObject(F))){const et=q.update(F),it=F.material;if(de&&(F.boundingSphere!==void 0?(F.boundingSphere===null&&F.computeBoundingSphere(),Ce.copy(F.boundingSphere.center)):(et.boundingSphere===null&&et.computeBoundingSphere(),Ce.copy(et.boundingSphere.center)),Ce.applyMatrix4(F.matrixWorld).applyMatrix4(Ae)),Array.isArray(it)){const pt=et.groups;for(let gt=0,vt=pt.length;gt<vt;gt++){const yt=pt[gt],tn=it[yt.materialIndex];tn&&tn.visible&&w.push(F,et,tn,he,Ce.z,yt)}}else it.visible&&w.push(F,et,it,he,Ce.z,null)}}const Ge=F.children;for(let et=0,it=Ge.length;et<it;et++)ih(Ge[et],re,he,de)}function rh(F,re,he,de){const fe=F.opaque,Ge=F.transmissive,et=F.transparent;x.setupLightsView(he),se===!0&&Pe.setGlobalState(M.clippingPlanes,he),de&&Se.viewport(A.copy(de)),fe.length>0&&pa(fe,re,he),Ge.length>0&&pa(Ge,re,he),et.length>0&&pa(et,re,he),Se.buffers.depth.setTest(!0),Se.buffers.depth.setMask(!0),Se.buffers.color.setMask(!0),Se.setPolygonOffset(!1)}function sh(F,re,he,de){if((he.isScene===!0?he.overrideMaterial:null)!==null)return;x.state.transmissionRenderTarget[de.id]===void 0&&(x.state.transmissionRenderTarget[de.id]=new os(1,1,{generateMipmaps:!0,type:pe.has("EXT_color_buffer_half_float")||pe.has("EXT_color_buffer_float")?Gf:Ns,minFilter:As,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1}));const Ge=x.state.transmissionRenderTarget[de.id],et=de.viewport||A;Ge.setSize(et.z,et.w);const it=M.getRenderTarget();M.setRenderTarget(Ge),M.getClearColor(z),Z=M.getClearAlpha(),Z<1&&M.setClearColor(16777215,.5),M.clear();const pt=M.toneMapping;M.toneMapping=Is;const gt=de.viewport;if(de.viewport!==void 0&&(de.viewport=void 0),x.setupLightsView(de),se===!0&&Pe.setGlobalState(M.clippingPlanes,de),pa(F,he,de),He.updateMultisampleRenderTarget(Ge),He.updateRenderTargetMipmap(Ge),pe.has("WEBGL_multisampled_render_to_texture")===!1){let vt=!1;for(let yt=0,tn=re.length;yt<tn;yt++){const bn=re[yt],xi=bn.object,Xi=bn.geometry,Rt=bn.material,dt=bn.group;if(Rt.side===Qr&&xi.layers.test(de.layers)){const Vt=Rt.side;Rt.side=Pi,Rt.needsUpdate=!0,El(xi,he,de,Xi,Rt,dt),Rt.side=Vt,Rt.needsUpdate=!0,vt=!0}}vt===!0&&(He.updateMultisampleRenderTarget(Ge),He.updateRenderTargetMipmap(Ge))}M.setRenderTarget(it),M.setClearColor(z,Z),gt!==void 0&&(de.viewport=gt),M.toneMapping=pt}function pa(F,re,he){const de=re.isScene===!0?re.overrideMaterial:null;for(let fe=0,Ge=F.length;fe<Ge;fe++){const et=F[fe],it=et.object,pt=et.geometry,gt=de===null?et.material:de,vt=et.group;it.layers.test(he.layers)&&El(it,re,he,pt,gt,vt)}}function El(F,re,he,de,fe,Ge){F.onBeforeRender(M,re,he,de,fe,Ge),F.modelViewMatrix.multiplyMatrices(he.matrixWorldInverse,F.matrixWorld),F.normalMatrix.getNormalMatrix(F.modelViewMatrix),fe.onBeforeRender(M,re,he,de,F,Ge),fe.transparent===!0&&fe.side===Qr&&fe.forceSinglePass===!1?(fe.side=Pi,fe.needsUpdate=!0,M.renderBufferDirect(he,re,de,fe,F,Ge),fe.side=uo,fe.needsUpdate=!0,M.renderBufferDirect(he,re,de,fe,F,Ge),fe.side=Qr):M.renderBufferDirect(he,re,de,fe,F,Ge),F.onAfterRender(M,re,he,de,fe,Ge)}function bl(F,re,he){re.isScene!==!0&&(re=tt);const de=Te.get(F),fe=x.state.lights,Ge=x.state.shadowsArray,et=fe.state.version,it=$.getParameters(F,fe.state,Ge,re,he),pt=$.getProgramCacheKey(it);let gt=de.programs;de.environment=F.isMeshStandardMaterial?re.environment:null,de.fog=re.fog,de.envMap=(F.isMeshStandardMaterial?L:V).get(F.envMap||de.environment),de.envMapRotation=de.environment!==null&&F.envMap===null?re.environmentRotation:F.envMapRotation,gt===void 0&&(F.addEventListener("dispose",Le),gt=new Map,de.programs=gt);let vt=gt.get(pt);if(vt!==void 0){if(de.currentProgram===vt&&de.lightsStateVersion===et)return oh(F,it),vt}else it.uniforms=$.getUniforms(F),F.onBuild(he,it,M),F.onBeforeCompile(it,M),vt=$.acquireProgram(it,pt),gt.set(pt,vt),de.uniforms=it.uniforms;const yt=de.uniforms;return(!F.isShaderMaterial&&!F.isRawShaderMaterial||F.clipping===!0)&&(yt.clippingPlanes=Pe.uniform),oh(F,it),de.needsLights=dv(F),de.lightsStateVersion=et,de.needsLights&&(yt.ambientLightColor.value=fe.state.ambient,yt.lightProbe.value=fe.state.probe,yt.directionalLights.value=fe.state.directional,yt.directionalLightShadows.value=fe.state.directionalShadow,yt.spotLights.value=fe.state.spot,yt.spotLightShadows.value=fe.state.spotShadow,yt.rectAreaLights.value=fe.state.rectArea,yt.ltc_1.value=fe.state.rectAreaLTC1,yt.ltc_2.value=fe.state.rectAreaLTC2,yt.pointLights.value=fe.state.point,yt.pointLightShadows.value=fe.state.pointShadow,yt.hemisphereLights.value=fe.state.hemi,yt.directionalShadowMap.value=fe.state.directionalShadowMap,yt.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,yt.spotShadowMap.value=fe.state.spotShadowMap,yt.spotLightMatrix.value=fe.state.spotLightMatrix,yt.spotLightMap.value=fe.state.spotLightMap,yt.pointShadowMap.value=fe.state.pointShadowMap,yt.pointShadowMatrix.value=fe.state.pointShadowMatrix),de.currentProgram=vt,de.uniformsList=null,vt}function go(F){if(F.uniformsList===null){const re=F.currentProgram.getUniforms();F.uniformsList=$m.seqWithValue(re.seq,F.uniforms)}return F.uniformsList}function oh(F,re){const he=Te.get(F);he.outputColorSpace=re.outputColorSpace,he.batching=re.batching,he.instancing=re.instancing,he.instancingColor=re.instancingColor,he.instancingMorph=re.instancingMorph,he.skinning=re.skinning,he.morphTargets=re.morphTargets,he.morphNormals=re.morphNormals,he.morphColors=re.morphColors,he.morphTargetsCount=re.morphTargetsCount,he.numClippingPlanes=re.numClippingPlanes,he.numIntersection=re.numClipIntersection,he.vertexAlphas=re.vertexAlphas,he.vertexTangents=re.vertexTangents,he.toneMapping=re.toneMapping}function cv(F,re,he,de,fe){re.isScene!==!0&&(re=tt),He.resetTextureUnits();const Ge=re.fog,et=de.isMeshStandardMaterial?re.environment:null,it=P===null?M.outputColorSpace:P.isXRRenderTarget===!0?P.texture.colorSpace:po,pt=(de.isMeshStandardMaterial?L:V).get(de.envMap||et),gt=de.vertexColors===!0&&!!he.attributes.color&&he.attributes.color.itemSize===4,vt=!!he.attributes.tangent&&(!!de.normalMap||de.anisotropy>0),yt=!!he.morphAttributes.position,tn=!!he.morphAttributes.normal,bn=!!he.morphAttributes.color;let xi=Is;de.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(xi=M.toneMapping);const Xi=he.morphAttributes.position||he.morphAttributes.normal||he.morphAttributes.color,Rt=Xi!==void 0?Xi.length:0,dt=Te.get(de),Vt=x.state.lights;if(se===!0&&(xe===!0||F!==I)){const Si=F===I&&de.id===D;Pe.setState(de,F,Si)}let ft=!1;de.version===dt.__version?(dt.needsLights&&dt.lightsStateVersion!==Vt.state.version||dt.outputColorSpace!==it||fe.isBatchedMesh&&dt.batching===!1||!fe.isBatchedMesh&&dt.batching===!0||fe.isInstancedMesh&&dt.instancing===!1||!fe.isInstancedMesh&&dt.instancing===!0||fe.isSkinnedMesh&&dt.skinning===!1||!fe.isSkinnedMesh&&dt.skinning===!0||fe.isInstancedMesh&&dt.instancingColor===!0&&fe.instanceColor===null||fe.isInstancedMesh&&dt.instancingColor===!1&&fe.instanceColor!==null||fe.isInstancedMesh&&dt.instancingMorph===!0&&fe.morphTexture===null||fe.isInstancedMesh&&dt.instancingMorph===!1&&fe.morphTexture!==null||dt.envMap!==pt||de.fog===!0&&dt.fog!==Ge||dt.numClippingPlanes!==void 0&&(dt.numClippingPlanes!==Pe.numPlanes||dt.numIntersection!==Pe.numIntersection)||dt.vertexAlphas!==gt||dt.vertexTangents!==vt||dt.morphTargets!==yt||dt.morphNormals!==tn||dt.morphColors!==bn||dt.toneMapping!==xi||dt.morphTargetsCount!==Rt)&&(ft=!0):(ft=!0,dt.__version=de.version);let ri=dt.currentProgram;ft===!0&&(ri=bl(de,re,fe));let Nn=!1,An=!1,Ur=!1;const on=ri.getUniforms(),an=dt.uniforms;if(Se.useProgram(ri.program)&&(Nn=!0,An=!0,Ur=!0),de.id!==D&&(D=de.id,An=!0),Nn||I!==F){on.setValue(Q,"projectionMatrix",F.projectionMatrix),on.setValue(Q,"viewMatrix",F.matrixWorldInverse);const Si=on.map.cameraPosition;Si!==void 0&&Si.setValue(Q,Ce.setFromMatrixPosition(F.matrixWorld)),be.logarithmicDepthBuffer&&on.setValue(Q,"logDepthBufFC",2/(Math.log(F.far+1)/Math.LN2)),(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial)&&on.setValue(Q,"isOrthographic",F.isOrthographicCamera===!0),I!==F&&(I=F,An=!0,Ur=!0)}if(fe.isSkinnedMesh){on.setOptional(Q,fe,"bindMatrix"),on.setOptional(Q,fe,"bindMatrixInverse");const Si=fe.skeleton;Si&&(Si.boneTexture===null&&Si.computeBoneTexture(),on.setValue(Q,"boneTexture",Si.boneTexture,He))}fe.isBatchedMesh&&(on.setOptional(Q,fe,"batchingTexture"),on.setValue(Q,"batchingTexture",fe._matricesTexture,He));const vo=he.morphAttributes;if((vo.position!==void 0||vo.normal!==void 0||vo.color!==void 0)&&qe.update(fe,he,ri),(An||dt.receiveShadow!==fe.receiveShadow)&&(dt.receiveShadow=fe.receiveShadow,on.setValue(Q,"receiveShadow",fe.receiveShadow)),de.isMeshGouraudMaterial&&de.envMap!==null&&(an.envMap.value=pt,an.flipEnvMap.value=pt.isCubeTexture&&pt.isRenderTargetTexture===!1?-1:1),de.isMeshStandardMaterial&&de.envMap===null&&re.environment!==null&&(an.envMapIntensity.value=re.environmentIntensity),An&&(on.setValue(Q,"toneMappingExposure",M.toneMappingExposure),dt.needsLights&&uv(an,Ur),Ge&&de.fog===!0&&ie.refreshFogUniforms(an,Ge),ie.refreshMaterialUniforms(an,de,le,ne,x.state.transmissionRenderTarget[F.id]),$m.upload(Q,go(dt),an,He)),de.isShaderMaterial&&de.uniformsNeedUpdate===!0&&($m.upload(Q,go(dt),an,He),de.uniformsNeedUpdate=!1),de.isSpriteMaterial&&on.setValue(Q,"center",fe.center),on.setValue(Q,"modelViewMatrix",fe.modelViewMatrix),on.setValue(Q,"normalMatrix",fe.normalMatrix),on.setValue(Q,"modelMatrix",fe.matrixWorld),de.isShaderMaterial||de.isRawShaderMaterial){const Si=de.uniformsGroups;for(let Al=0,Tl=Si.length;Al<Tl;Al++){const _u=Si[Al];ze.update(_u,ri),ze.bind(_u,ri)}}return ri}function uv(F,re){F.ambientLightColor.needsUpdate=re,F.lightProbe.needsUpdate=re,F.directionalLights.needsUpdate=re,F.directionalLightShadows.needsUpdate=re,F.pointLights.needsUpdate=re,F.pointLightShadows.needsUpdate=re,F.spotLights.needsUpdate=re,F.spotLightShadows.needsUpdate=re,F.rectAreaLights.needsUpdate=re,F.hemisphereLights.needsUpdate=re}function dv(F){return F.isMeshLambertMaterial||F.isMeshToonMaterial||F.isMeshPhongMaterial||F.isMeshStandardMaterial||F.isShadowMaterial||F.isShaderMaterial&&F.lights===!0}this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return P},this.setRenderTargetTextures=function(F,re,he){Te.get(F.texture).__webglTexture=re,Te.get(F.depthTexture).__webglTexture=he;const de=Te.get(F);de.__hasExternalTextures=!0,de.__autoAllocateDepthBuffer=he===void 0,de.__autoAllocateDepthBuffer||pe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),de.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(F,re){const he=Te.get(F);he.__webglFramebuffer=re,he.__useDefaultFramebuffer=re===void 0},this.setRenderTarget=function(F,re=0,he=0){P=F,N=re,C=he;let de=!0,fe=null,Ge=!1,et=!1;if(F){const pt=Te.get(F);pt.__useDefaultFramebuffer!==void 0?(Se.bindFramebuffer(Q.FRAMEBUFFER,null),de=!1):pt.__webglFramebuffer===void 0?He.setupRenderTarget(F):pt.__hasExternalTextures&&He.rebindTextures(F,Te.get(F.texture).__webglTexture,Te.get(F.depthTexture).__webglTexture);const gt=F.texture;(gt.isData3DTexture||gt.isDataArrayTexture||gt.isCompressedArrayTexture)&&(et=!0);const vt=Te.get(F).__webglFramebuffer;F.isWebGLCubeRenderTarget?(Array.isArray(vt[re])?fe=vt[re][he]:fe=vt[re],Ge=!0):F.samples>0&&He.useMultisampledRTT(F)===!1?fe=Te.get(F).__webglMultisampledFramebuffer:Array.isArray(vt)?fe=vt[he]:fe=vt,A.copy(F.viewport),U.copy(F.scissor),G=F.scissorTest}else A.copy(K).multiplyScalar(le).floor(),U.copy(ae).multiplyScalar(le).floor(),G=ge;if(Se.bindFramebuffer(Q.FRAMEBUFFER,fe)&&de&&Se.drawBuffers(F,fe),Se.viewport(A),Se.scissor(U),Se.setScissorTest(G),Ge){const pt=Te.get(F.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+re,pt.__webglTexture,he)}else if(et){const pt=Te.get(F.texture),gt=re||0;Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,pt.__webglTexture,he||0,gt)}D=-1},this.readRenderTargetPixels=function(F,re,he,de,fe,Ge,et){if(!(F&&F.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Te.get(F).__webglFramebuffer;if(F.isWebGLCubeRenderTarget&&et!==void 0&&(it=it[et]),it){Se.bindFramebuffer(Q.FRAMEBUFFER,it);try{const pt=F.texture,gt=pt.format,vt=pt.type;if(!be.textureFormatReadable(gt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!be.textureTypeReadable(vt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}re>=0&&re<=F.width-de&&he>=0&&he<=F.height-fe&&Q.readPixels(re,he,de,fe,oe.convert(gt),oe.convert(vt),Ge)}finally{const pt=P!==null?Te.get(P).__webglFramebuffer:null;Se.bindFramebuffer(Q.FRAMEBUFFER,pt)}}},this.copyFramebufferToTexture=function(F,re,he=0){const de=Math.pow(2,-he),fe=Math.floor(re.image.width*de),Ge=Math.floor(re.image.height*de);He.setTexture2D(re,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,he,0,0,F.x,F.y,fe,Ge),Se.unbindTexture()},this.copyTextureToTexture=function(F,re,he,de=0){const fe=re.image.width,Ge=re.image.height,et=oe.convert(he.format),it=oe.convert(he.type);He.setTexture2D(he,0),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,he.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,he.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,he.unpackAlignment),re.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,de,F.x,F.y,fe,Ge,et,it,re.image.data):re.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,de,F.x,F.y,re.mipmaps[0].width,re.mipmaps[0].height,et,re.mipmaps[0].data):Q.texSubImage2D(Q.TEXTURE_2D,de,F.x,F.y,et,it,re.image),de===0&&he.generateMipmaps&&Q.generateMipmap(Q.TEXTURE_2D),Se.unbindTexture()},this.copyTextureToTexture3D=function(F,re,he,de,fe=0){const Ge=F.max.x-F.min.x,et=F.max.y-F.min.y,it=F.max.z-F.min.z,pt=oe.convert(de.format),gt=oe.convert(de.type);let vt;if(de.isData3DTexture)He.setTexture3D(de,0),vt=Q.TEXTURE_3D;else if(de.isDataArrayTexture||de.isCompressedArrayTexture)He.setTexture2DArray(de,0),vt=Q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,de.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,de.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,de.unpackAlignment);const yt=Q.getParameter(Q.UNPACK_ROW_LENGTH),tn=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),bn=Q.getParameter(Q.UNPACK_SKIP_PIXELS),xi=Q.getParameter(Q.UNPACK_SKIP_ROWS),Xi=Q.getParameter(Q.UNPACK_SKIP_IMAGES),Rt=he.isCompressedTexture?he.mipmaps[fe]:he.image;Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Rt.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,Rt.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,F.min.x),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,F.min.y),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,F.min.z),he.isDataTexture||he.isData3DTexture?Q.texSubImage3D(vt,fe,re.x,re.y,re.z,Ge,et,it,pt,gt,Rt.data):de.isCompressedArrayTexture?Q.compressedTexSubImage3D(vt,fe,re.x,re.y,re.z,Ge,et,it,pt,Rt.data):Q.texSubImage3D(vt,fe,re.x,re.y,re.z,Ge,et,it,pt,gt,Rt),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,yt),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,tn),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,bn),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,xi),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,Xi),fe===0&&de.generateMipmaps&&Q.generateMipmap(vt),Se.unbindTexture()},this.initTexture=function(F){F.isCubeTexture?He.setTextureCube(F,0):F.isData3DTexture?He.setTexture3D(F,0):F.isDataArrayTexture||F.isCompressedArrayTexture?He.setTexture2DArray(F,0):He.setTexture2D(F,0),Se.unbindTexture()},this.resetState=function(){N=0,C=0,P=null,Se.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ts}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===O0?"display-p3":"srgb",t.unpackColorSpace=Gt.workingColorSpace===Wf?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class k0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Xe(e),this.density=t}clone(){return new k0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class z0{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Xe(e),this.near=t,this.far=i}clone(){return new z0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Ef extends Bt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new fr,this.environmentIntensity=1,this.environmentRotation=new fr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class B0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Sf,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=cr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return R2("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.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=cr()),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=cr()),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 Ei=new k;class gl{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++)Ei.fromBufferAttribute(this,t),Ei.applyMatrix4(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.applyNormalMatrix(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.transformDirection(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=Ci(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Et(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Et(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Et(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Et(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Et(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=Ci(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ci(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ci(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ci(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Et(t,this.array),i=Et(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=Et(t,this.array),i=Et(i,this.array),r=Et(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=Et(t,this.array),i=Et(i,this.array),r=Et(r,this.array),s=Et(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 Lt(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 gl(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 T1 extends ii{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let ic;const Ju=new k,rc=new k,sc=new k,oc=new Ee,Ku=new Ee,X2=new ht,Gp=new k,Qu=new k,Wp=new k,QA=new Ee,__=new Ee,eT=new Ee;class q2 extends Bt{constructor(e=new T1){if(super(),this.isSprite=!0,this.type="Sprite",ic===void 0){ic=new mt;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 B0(t,5);ic.setIndex([0,1,2,0,2,3]),ic.setAttribute("position",new gl(i,3,0,!1)),ic.setAttribute("uv",new gl(i,2,3,!1))}this.geometry=ic,this.material=e,this.center=new Ee(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),rc.setFromMatrixScale(this.matrixWorld),X2.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),sc.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&rc.multiplyScalar(-sc.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;jp(Gp.set(-.5,-.5,0),sc,o,rc,r,s),jp(Qu.set(.5,-.5,0),sc,o,rc,r,s),jp(Wp.set(.5,.5,0),sc,o,rc,r,s),QA.set(0,0),__.set(1,0),eT.set(1,1);let a=e.ray.intersectTriangle(Gp,Qu,Wp,!1,Ju);if(a===null&&(jp(Qu.set(-.5,.5,0),sc,o,rc,r,s),__.set(0,1),a=e.ray.intersectTriangle(Gp,Wp,Qu,!1,Ju),a===null))return;const u=e.ray.origin.distanceTo(Ju);u<e.near||u>e.far||t.push({distance:u,point:Ju.clone(),uv:sr.getInterpolation(Ju,Gp,Qu,Wp,QA,__,eT,new Ee),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 jp(n,e,t,i,r,s){oc.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Ku.x=s*oc.x-r*oc.y,Ku.y=r*oc.x+s*oc.y):Ku.copy(oc),n.copy(e),n.x+=Ku.x,n.y+=Ku.y,n.applyMatrix4(X2)}const Xp=new k,tT=new k;class Y2 extends Bt{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){Xp.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Xp);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Xp.setFromMatrixPosition(e.matrixWorld),tT.setFromMatrixPosition(this.matrixWorld);const i=Xp.distanceTo(tT)/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 nT=new k,iT=new Wt,rT=new Wt,uV=new k,sT=new ht,qp=new k,x_=new vi,oT=new ht,S_=new fu;class $2 extends Mn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=oS,this.bindMatrix=new ht,this.bindMatrixInverse=new ht,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ei),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,qp),this.boundingBox.expandByPoint(qp)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new vi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,qp),this.boundingSphere.expandByPoint(qp)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),x_.copy(this.boundingSphere),x_.applyMatrix4(r),e.ray.intersectsSphere(x_)!==!1&&(oT.copy(r).invert(),S_.copy(e.ray).applyMatrix4(oT),!(this.boundingBox!==null&&S_.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,S_)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Wt,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===oS?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===r2?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;iT.fromBufferAttribute(r.attributes.skinIndex,e),rT.fromBufferAttribute(r.attributes.skinWeight,e),nT.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=rT.getComponent(s);if(o!==0){const a=iT.getComponent(s);sT.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(uV.copy(nT).applyMatrix4(sT),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class C1 extends Bt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ia extends hn{constructor(e=null,t=1,i=1,r,s,o,a,u,d=Yn,f=Yn,h,p){super(null,o,a,u,d,f,r,s,h,p),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const aT=new ht,dV=new ht;class V0{constructor(e=[],t=[]){this.uuid=cr(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){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 ht)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ht;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:dV;aT.multiplyMatrices(a,t[s]),aT.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new V0(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new ia(t,e,e,Bi,Ir);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,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 C1),this.bones.push(o),this.boneInverses.push(new ht().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,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 su extends Lt{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 ac=new ht,lT=new ht,Yp=[],cT=new ei,fV=new ht,ed=new Mn,td=new vi;class Z2 extends Mn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new su(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,fV)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ei),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,ac),cT.copy(e.boundingBox).applyMatrix4(ac),this.boundingBox.union(cT)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new vi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,ac),td.copy(e.boundingSphere).applyMatrix4(ac),this.boundingSphere.union(td)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(ed.geometry=this.geometry,ed.material=this.material,ed.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),td.copy(this.boundingSphere),td.applyMatrix4(i),e.ray.intersectsSphere(td)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,ac),lT.multiplyMatrices(i,ac),ed.matrixWorld=lT,ed.raycast(e,Yp);for(let o=0,a=Yp.length;o<a;o++){const u=Yp[o];u.instanceId=s,u.object=this,t.push(u)}Yp.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new su(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new ia(new Float32Array(r*this.count),r,this.count,h1,Ir));const s=this.morphTexture.source.data.data;let o=0;for(let d=0;d<i.length;d++)o+=i[d];const a=this.geometry.morphTargetsRelative?1:1-o,u=r*e;s[u]=a,s.set(i,u+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function hV(n,e){return n.z-e.z}function pV(n,e){return e.z-n.z}class mV{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1});const s=i[this.index];r.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t}reset(){this.list.length=0,this.index=0}}const lc="batchId",Do=new ht,uT=new ht,gV=new ht,dT=new ht,w_=new qf,$p=new ei,Pa=new vi,nd=new k,M_=new mV,hi=new Mn,Zp=[];function vV(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}class J2 extends Mn{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,t,i=t*2,r){super(new mt,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new ia(t,e,e,Bi,Ir);this._matricesTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxGeometryCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const a in e.attributes){const u=e.getAttribute(a),{array:d,itemSize:f,normalized:h}=u,p=new d.constructor(i*f),g=new Lt(p,f,h);t.setAttribute(a,g)}if(e.getIndex()!==null){const a=i>65536?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Lt(a,1))}const o=r>65536?new Uint32Array(i):new Uint16Array(i);t.setAttribute(lc,new Lt(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(lc))throw new Error(`BatchedMesh: Geometry cannot use attribute "${lc}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(i===lc)continue;if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ei);const e=this._geometryCount,t=this.boundingBox,i=this._active;t.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,Do),this.getBoundingBoxAt(r,$p).applyMatrix4(Do),t.union($p))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vi);const e=this._geometryCount,t=this.boundingSphere,i=this._active;t.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,Do),this.getBoundingSphereAt(r,Pa).applyMatrix4(Do),t.union(Pa))}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,u=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const d=e.getIndex(),f=d!==null;if(f&&(i===-1?r.indexCount=d.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,p=this._active,g=this._matricesTexture,y=this._matricesTexture.image.data;h.push(!0),p.push(!0);const w=this._geometryCount;this._geometryCount++,gV.toArray(y,w*16),g.needsUpdate=!0,o.push(r),a.push({start:f?r.indexStart:r.vertexStart,count:-1}),u.push({boxInitialized:!1,box:new ei,sphereInitialized:!1,sphere:new vi});const x=this.geometry.getAttribute(lc);for(let v=0;v<r.vertexCount;v++)x.setX(r.vertexStart+v,w);return x.needsUpdate=!0,this.setGeometryAt(w,e),w}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const u=a.vertexStart,d=a.vertexCount;for(const g in i.attributes){if(g===lc)continue;const y=t.getAttribute(g),w=i.getAttribute(g);vV(y,w,u);const x=y.itemSize;for(let v=y.count,_=d;v<_;v++){const M=u+v;for(let b=0;b<x;b++)w.setComponent(M,b,0)}w.needsUpdate=!0,w.addUpdateRange(u*x,d*x)}if(r){const g=a.indexStart;for(let y=0;y<o.count;y++)s.setX(g+y,u+o.getX(y));for(let y=o.count,w=a.indexCount;y<w;y++)s.setX(g+y,u);s.needsUpdate=!0,s.addUpdateRange(g,a.indexCount)}const f=this._bounds[e];t.boundingBox!==null?(f.box.copy(t.boundingBox),f.boxInitialized=!0):f.boxInitialized=!1,t.boundingSphere!==null?(f.sphere.copy(t.boundingSphere),f.sphereInitialized=!0):f.sphereInitialized=!1;const h=this._drawRanges[e],p=t.getAttribute("position");return h.count=r?o.count:p.count,this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._active;return e>=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getInstanceCountAt(e){return this._multiDrawInstances===null?null:this._multiDrawInstances[e]}setInstanceCountAt(e,t){return this._multiDrawInstances===null&&(this._multiDrawInstances=new Int32Array(this._maxGeometryCount).fill(1)),this._multiDrawInstances[e]=t,e}getBoundingBoxAt(e,t){if(this._active[e]===!1)return null;const r=this._bounds[e],s=r.box,o=this.geometry;if(r.boxInitialized===!1){s.makeEmpty();const a=o.index,u=o.attributes.position,d=this._drawRanges[e];for(let f=d.start,h=d.start+d.count;f<h;f++){let p=f;a&&(p=a.getX(p)),s.expandByPoint(nd.fromBufferAttribute(u,p))}r.boxInitialized=!0}return t.copy(s),t}getBoundingSphereAt(e,t){if(this._active[e]===!1)return null;const r=this._bounds[e],s=r.sphere,o=this.geometry;if(r.sphereInitialized===!1){s.makeEmpty(),this.getBoundingBoxAt(e,$p),$p.getCenter(s.center);const a=o.index,u=o.attributes.position,d=this._drawRanges[e];let f=0;for(let h=d.start,p=d.start+d.count;h<p;h++){let g=h;a&&(g=a.getX(g)),nd.fromBufferAttribute(u,g),f=Math.max(f,s.center.distanceToSquared(nd))}s.radius=Math.sqrt(f),r.sphereInitialized=!0}return t.copy(s),t}setMatrixAt(e,t){const i=this._active,r=this._matricesTexture,s=this._matricesTexture.image.data,o=this._geometryCount;return e>=o||i[e]===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._active,r=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||i[e]===!1?null:t.fromArray(r,e*16)}setVisibleAt(e,t){const i=this._visibility,r=this._active,s=this._geometryCount;return e>=s||r[e]===!1||i[e]===t?this:(i[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,i=this._active,r=this._geometryCount;return e>=r||i[e]===!1?!1:t[e]}raycast(e,t){const i=this._visibility,r=this._active,s=this._drawRanges,o=this._geometryCount,a=this.matrixWorld,u=this.geometry;hi.material=this.material,hi.geometry.index=u.index,hi.geometry.attributes=u.attributes,hi.geometry.boundingBox===null&&(hi.geometry.boundingBox=new ei),hi.geometry.boundingSphere===null&&(hi.geometry.boundingSphere=new vi);for(let d=0;d<o;d++){if(!i[d]||!r[d])continue;const f=s[d];hi.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(d,hi.matrixWorld).premultiply(a),this.getBoundingBoxAt(d,hi.geometry.boundingBox),this.getBoundingSphereAt(d,hi.geometry.boundingSphere),hi.raycast(e,Zp);for(let h=0,p=Zp.length;h<p;h++){const g=Zp[h];g.object=this,g.batchId=d,t.push(g)}Zp.length=0}hi.material=null,hi.geometry.index=null,hi.geometry.attributes={},hi.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,u=this._active,d=this._visibility,f=this._multiDrawStarts,h=this._multiDrawCounts,p=this._drawRanges,g=this.perObjectFrustumCulled;g&&(dT.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),w_.setFromProjectionMatrix(dT,e.coordinateSystem));let y=0;if(this.sortObjects){uT.copy(this.matrixWorld).invert(),nd.setFromMatrixPosition(i.matrixWorld).applyMatrix4(uT);for(let v=0,_=d.length;v<_;v++)if(d[v]&&u[v]){this.getMatrixAt(v,Do),this.getBoundingSphereAt(v,Pa).applyMatrix4(Do);let M=!1;if(g&&(M=!w_.intersectsSphere(Pa)),!M){const b=nd.distanceTo(Pa.center);M_.push(p[v],b)}}const w=M_.list,x=this.customSort;x===null?w.sort(s.transparent?pV:hV):x.call(this,w,i);for(let v=0,_=w.length;v<_;v++){const M=w[v];f[y]=M.start*a,h[y]=M.count,y++}M_.reset()}else for(let w=0,x=d.length;w<x;w++)if(d[w]&&u[w]){let v=!1;if(g&&(this.getMatrixAt(w,Do),this.getBoundingSphereAt(w,Pa).applyMatrix4(Do),v=!w_.intersectsSphere(Pa)),!v){const _=p[w];f[y]=_.start*a,h[y]=_.count,y++}}this._multiDrawCount=y,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class Ni extends ii{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Qg=new k,e0=new k,fT=new ht,id=new fu,Jp=new vi,E_=new k,hT=new k;class aa extends Bt{constructor(e=new mt,t=new Ni){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)Qg.fromBufferAttribute(t,r-1),e0.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=Qg.distanceTo(e0);e.setAttribute("lineDistance",new Ze(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(),Jp.copy(i.boundingSphere),Jp.applyMatrix4(r),Jp.radius+=s,e.ray.intersectsSphere(Jp)===!1)return;fT.copy(r).invert(),id.copy(e.ray).applyMatrix4(fT);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=a*a,d=this.isLineSegments?2:1,f=i.index,p=i.attributes.position;if(f!==null){const g=Math.max(0,o.start),y=Math.min(f.count,o.start+o.count);for(let w=g,x=y-1;w<x;w+=d){const v=f.getX(w),_=f.getX(w+1),M=Kp(this,e,id,u,v,_);M&&t.push(M)}if(this.isLineLoop){const w=f.getX(y-1),x=f.getX(g),v=Kp(this,e,id,u,w,x);v&&t.push(v)}}else{const g=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let w=g,x=y-1;w<x;w+=d){const v=Kp(this,e,id,u,w,w+1);v&&t.push(v)}if(this.isLineLoop){const w=Kp(this,e,id,u,y-1,g);w&&t.push(w)}}}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 Kp(n,e,t,i,r,s){const o=n.geometry.attributes.position;if(Qg.fromBufferAttribute(o,r),e0.fromBufferAttribute(o,s),t.distanceSqToSegment(Qg,e0,E_,hT)>i)return;E_.applyMatrix4(n.matrixWorld);const u=e.ray.origin.distanceTo(E_);if(!(u<e.near||u>e.far))return{distance:u,point:hT.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const pT=new k,mT=new k;class Os extends aa{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)pT.fromBufferAttribute(t,r),mT.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+pT.distanceTo(mT);e.setAttribute("lineDistance",new Ze(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class K2 extends aa{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class R1 extends ii{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const gT=new ht,FS=new fu,Qp=new vi,em=new k;class Q2 extends Bt{constructor(e=new mt,t=new R1){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Qp.copy(i.boundingSphere),Qp.applyMatrix4(r),Qp.radius+=s,e.ray.intersectsSphere(Qp)===!1)return;gT.copy(r).invert(),FS.copy(e.ray).applyMatrix4(gT);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=a*a,d=i.index,h=i.attributes.position;if(d!==null){const p=Math.max(0,o.start),g=Math.min(d.count,o.start+o.count);for(let y=p,w=g;y<w;y++){const x=d.getX(y);em.fromBufferAttribute(h,x),vT(em,x,u,r,e,t,this)}}else{const p=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let y=p,w=g;y<w;y++)em.fromBufferAttribute(h,y),vT(em,y,u,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 vT(n,e,t,i,r,s,o){const a=FS.distanceSqToPoint(n);if(a<t){const u=new k;FS.closestPointToPoint(n,u),u.applyMatrix4(i);const d=r.ray.origin.distanceTo(u);if(d<r.near||d>r.far)return;s.push({distance:d,distanceToRay:Math.sqrt(a),point:u,index:e,face:null,object:o})}}class yV extends hn{constructor(e,t,i,r,s,o,a,u,d){super(e,t,i,r,s,o,a,u,d),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:In,this.magFilter=s!==void 0?s:In,this.generateMipmaps=!1;const f=this;function h(){f.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class _V extends hn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Yn,this.minFilter=Yn,this.generateMipmaps=!1,this.needsUpdate=!0}}class H0 extends hn{constructor(e,t,i,r,s,o,a,u,d,f,h,p){super(null,o,a,u,d,f,r,s,h,p),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class xV extends H0{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Pr}}class SV extends H0{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,fo),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class wV extends hn{constructor(e,t,i,r,s,o,a,u,d){super(e,t,i,r,s,o,a,u,d),this.isCanvasTexture=!0,this.needsUpdate=!0}}class us{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,u=s-1,d;for(;a<=u;)if(r=Math.floor(a+(u-a)/2),d=i[r]-o,d<0)a=r+1;else if(d>0)u=r-1;else{u=r;break}if(r=u,i[r]===o)return r/(s-1);const f=i[r],p=i[r+1]-f,g=(o-f)/p;return(r+g)/(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),u=t||(o.isVector2?new Ee:new k);return u.copy(a).sub(o).normalize(),u}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new k,r=[],s=[],o=[],a=new k,u=new ht;for(let g=0;g<=e;g++){const y=g/e;r[g]=this.getTangentAt(y,new k)}s[0]=new k,o[0]=new k;let d=Number.MAX_VALUE;const f=Math.abs(r[0].x),h=Math.abs(r[0].y),p=Math.abs(r[0].z);f<=d&&(d=f,i.set(1,0,0)),h<=d&&(d=h,i.set(0,1,0)),p<=d&&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 g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),a.crossVectors(r[g-1],r[g]),a.length()>Number.EPSILON){a.normalize();const y=Math.acos(yn(r[g-1].dot(r[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(a,y))}o[g].crossVectors(r[g],s[g])}if(t===!0){let g=Math.acos(yn(s[0].dot(s[e]),-1,1));g/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(g=-g);for(let y=1;y<=e;y++)s[y].applyMatrix4(u.makeRotationAxis(r[y],g*y)),o[y].crossVectors(r[y],s[y])}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.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class G0 extends us{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,u=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=u}getPoint(e,t=new Ee){const i=t,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 u=this.aX+this.xRadius*Math.cos(a),d=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const f=Math.cos(this.aRotation),h=Math.sin(this.aRotation),p=u-this.aX,g=d-this.aY;u=p*f-g*h+this.aX,d=p*h+g*f+this.aY}return i.set(u,d)}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 eI extends G0{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function P1(){let n=0,e=0,t=0,i=0;function r(s,o,a,u){n=s,e=a,t=-3*s+3*o-2*a-u,i=2*s-2*o+a+u}return{initCatmullRom:function(s,o,a,u,d){r(o,a,d*(a-s),d*(u-o))},initNonuniformCatmullRom:function(s,o,a,u,d,f,h){let p=(o-s)/d-(a-s)/(d+f)+(a-o)/f,g=(a-o)/f-(u-o)/(f+h)+(u-a)/h;p*=f,g*=f,r(o,a,p,g)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const tm=new k,b_=new P1,A_=new P1,T_=new P1;class tI extends us{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 k){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),u=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:u===0&&a===s-1&&(a=s-2,u=1);let d,f;this.closed||a>0?d=r[(a-1)%s]:(tm.subVectors(r[0],r[1]).add(r[0]),d=tm);const h=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?f=r[(a+2)%s]:(tm.subVectors(r[s-1],r[s-2]).add(r[s-1]),f=tm),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let y=Math.pow(d.distanceToSquared(h),g),w=Math.pow(h.distanceToSquared(p),g),x=Math.pow(p.distanceToSquared(f),g);w<1e-4&&(w=1),y<1e-4&&(y=w),x<1e-4&&(x=w),b_.initNonuniformCatmullRom(d.x,h.x,p.x,f.x,y,w,x),A_.initNonuniformCatmullRom(d.y,h.y,p.y,f.y,y,w,x),T_.initNonuniformCatmullRom(d.z,h.z,p.z,f.z,y,w,x)}else this.curveType==="catmullrom"&&(b_.initCatmullRom(d.x,h.x,p.x,f.x,this.tension),A_.initCatmullRom(d.y,h.y,p.y,f.y,this.tension),T_.initCatmullRom(d.z,h.z,p.z,f.z,this.tension));return i.set(b_.calc(u),A_.calc(u),T_.calc(u)),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 k().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function yT(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,u=n*a;return(2*t-2*i+s+o)*u+(-3*t+3*i-2*s-o)*a+s*n+t}function MV(n,e){const t=1-n;return t*t*e}function EV(n,e){return 2*(1-n)*n*e}function bV(n,e){return n*n*e}function zd(n,e,t,i){return MV(n,e)+EV(n,t)+bV(n,i)}function AV(n,e){const t=1-n;return t*t*t*e}function TV(n,e){const t=1-n;return 3*t*t*n*e}function CV(n,e){return 3*(1-n)*n*n*e}function RV(n,e){return n*n*n*e}function Bd(n,e,t,i,r){return AV(n,e)+TV(n,t)+CV(n,i)+RV(n,r)}class I1 extends us{constructor(e=new Ee,t=new Ee,i=new Ee,r=new Ee){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Ee){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Bd(e,r.x,s.x,o.x,a.x),Bd(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 nI extends us{constructor(e=new k,t=new k,i=new k,r=new k){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new k){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Bd(e,r.x,s.x,o.x,a.x),Bd(e,r.y,s.y,o.y,a.y),Bd(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 L1 extends us{constructor(e=new Ee,t=new Ee){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Ee){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 Ee){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 iI extends us{constructor(e=new k,t=new k){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new k){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 k){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 N1 extends us{constructor(e=new Ee,t=new Ee,i=new Ee){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Ee){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(zd(e,r.x,s.x,o.x),zd(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 D1 extends us{constructor(e=new k,t=new k,i=new k){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new k){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(zd(e,r.x,s.x,o.x),zd(e,r.y,s.y,o.y),zd(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 O1 extends us{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Ee){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,u=r[o===0?o:o-1],d=r[o],f=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(yT(a,u.x,d.x,f.x,h.x),yT(a,u.y,d.y,f.y,h.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 Ee().fromArray(r))}return this}}var t0=Object.freeze({__proto__:null,ArcCurve:eI,CatmullRomCurve3:tI,CubicBezierCurve:I1,CubicBezierCurve3:nI,EllipseCurve:G0,LineCurve:L1,LineCurve3:iI,QuadraticBezierCurve:N1,QuadraticBezierCurve3:D1,SplineCurve:O1});class rI extends us{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new t0[i](t,e))}return this}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],u=a.getLength(),d=u===0?0:1-o/u;return a.getPointAt(d,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,u=o.getPoints(a);for(let d=0;d<u.length;d++){const f=u[d];i&&i.equals(f)||(t.push(f),i=f)}}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 t0[r.type]().fromJSON(r))}return this}}class bf extends rI{constructor(e){super(),this.type="Path",this.currentPoint=new Ee,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 L1(this.currentPoint.clone(),new Ee(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new N1(this.currentPoint.clone(),new Ee(e,t),new Ee(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new I1(this.currentPoint.clone(),new Ee(e,t),new Ee(i,r),new Ee(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new O1(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,u=this.currentPoint.y;return this.absarc(e+a,t+u,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,u){const d=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+d,t+f,i,r,s,o,a,u),this}absellipse(e,t,i,r,s,o,a,u){const d=new G0(e,t,i,r,s,o,a,u);if(this.curves.length>0){const h=d.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(d);const f=d.getPoint(1);return this.currentPoint.copy(f),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 Yf extends mt{constructor(e=[new Ee(0,-.5),new Ee(.5,0),new Ee(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=yn(r,0,Math.PI*2);const s=[],o=[],a=[],u=[],d=[],f=1/t,h=new k,p=new Ee,g=new k,y=new k,w=new k;let x=0,v=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:x=e[_+1].x-e[_].x,v=e[_+1].y-e[_].y,g.x=v*1,g.y=-x,g.z=v*0,w.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(w.x,w.y,w.z);break;default:x=e[_+1].x-e[_].x,v=e[_+1].y-e[_].y,g.x=v*1,g.y=-x,g.z=v*0,y.copy(g),g.x+=w.x,g.y+=w.y,g.z+=w.z,g.normalize(),u.push(g.x,g.y,g.z),w.copy(y)}for(let _=0;_<=t;_++){const M=i+_*f*r,b=Math.sin(M),N=Math.cos(M);for(let C=0;C<=e.length-1;C++){h.x=e[C].x*b,h.y=e[C].y,h.z=e[C].x*N,o.push(h.x,h.y,h.z),p.x=_/t,p.y=C/(e.length-1),a.push(p.x,p.y);const P=u[3*C+0]*b,D=u[3*C+1],I=u[3*C+0]*N;d.push(P,D,I)}}for(let _=0;_<t;_++)for(let M=0;M<e.length-1;M++){const b=M+_*e.length,N=b,C=b+e.length,P=b+e.length+1,D=b+1;s.push(N,C,D),s.push(P,D,C)}this.setIndex(s),this.setAttribute("position",new Ze(o,3)),this.setAttribute("uv",new Ze(a,2)),this.setAttribute("normal",new Ze(d,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yf(e.points,e.segments,e.phiStart,e.phiLength)}}class W0 extends Yf{constructor(e=1,t=1,i=4,r=8){const s=new bf;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,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new W0(e.radius,e.length,e.capSegments,e.radialSegments)}}class j0 extends mt{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=[],u=[],d=new k,f=new Ee;o.push(0,0,0),a.push(0,0,1),u.push(.5,.5);for(let h=0,p=3;h<=t;h++,p+=3){const g=i+h/t*r;d.x=e*Math.cos(g),d.y=e*Math.sin(g),o.push(d.x,d.y,d.z),a.push(0,0,1),f.x=(o[p]/e+1)/2,f.y=(o[p+1]/e+1)/2,u.push(f.x,f.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new Ze(o,3)),this.setAttribute("normal",new Ze(a,3)),this.setAttribute("uv",new Ze(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new j0(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class mu extends mt{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:u};const d=this;r=Math.floor(r),s=Math.floor(s);const f=[],h=[],p=[],g=[];let y=0;const w=[],x=i/2;let v=0;_(),o===!1&&(e>0&&M(!0),t>0&&M(!1)),this.setIndex(f),this.setAttribute("position",new Ze(h,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(){const b=new k,N=new k;let C=0;const P=(t-e)/i;for(let D=0;D<=s;D++){const I=[],A=D/s,U=A*(t-e)+e;for(let G=0;G<=r;G++){const z=G/r,Z=z*u+a,J=Math.sin(Z),ne=Math.cos(Z);N.x=U*J,N.y=-A*i+x,N.z=U*ne,h.push(N.x,N.y,N.z),b.set(J,P,ne).normalize(),p.push(b.x,b.y,b.z),g.push(z,1-A),I.push(y++)}w.push(I)}for(let D=0;D<r;D++)for(let I=0;I<s;I++){const A=w[I][D],U=w[I+1][D],G=w[I+1][D+1],z=w[I][D+1];f.push(A,U,z),f.push(U,G,z),C+=6}d.addGroup(v,C,0),v+=C}function M(b){const N=y,C=new Ee,P=new k;let D=0;const I=b===!0?e:t,A=b===!0?1:-1;for(let G=1;G<=r;G++)h.push(0,x*A,0),p.push(0,A,0),g.push(.5,.5),y++;const U=y;for(let G=0;G<=r;G++){const Z=G/r*u+a,J=Math.cos(Z),ne=Math.sin(Z);P.x=I*ne,P.y=x*A,P.z=I*J,h.push(P.x,P.y,P.z),p.push(0,A,0),C.x=J*.5+.5,C.y=ne*.5*A+.5,g.push(C.x,C.y),y++}for(let G=0;G<r;G++){const z=N+G,Z=U+G;b===!0?f.push(Z,Z+1,z):f.push(Z+1,Z,z),D+=3}d.addGroup(v,D,b===!0?1:2),v+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class X0 extends mu{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 X0(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class fa extends mt{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),d(i),f(),this.setAttribute("position",new Ze(s,3)),this.setAttribute("normal",new Ze(s.slice(),3)),this.setAttribute("uv",new Ze(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(_){const M=new k,b=new k,N=new k;for(let C=0;C<t.length;C+=3)g(t[C+0],M),g(t[C+1],b),g(t[C+2],N),u(M,b,N,_)}function u(_,M,b,N){const C=N+1,P=[];for(let D=0;D<=C;D++){P[D]=[];const I=_.clone().lerp(b,D/C),A=M.clone().lerp(b,D/C),U=C-D;for(let G=0;G<=U;G++)G===0&&D===C?P[D][G]=I:P[D][G]=I.clone().lerp(A,G/U)}for(let D=0;D<C;D++)for(let I=0;I<2*(C-D)-1;I++){const A=Math.floor(I/2);I%2===0?(p(P[D][A+1]),p(P[D+1][A]),p(P[D][A])):(p(P[D][A+1]),p(P[D+1][A+1]),p(P[D+1][A]))}}function d(_){const M=new k;for(let b=0;b<s.length;b+=3)M.x=s[b+0],M.y=s[b+1],M.z=s[b+2],M.normalize().multiplyScalar(_),s[b+0]=M.x,s[b+1]=M.y,s[b+2]=M.z}function f(){const _=new k;for(let M=0;M<s.length;M+=3){_.x=s[M+0],_.y=s[M+1],_.z=s[M+2];const b=x(_)/2/Math.PI+.5,N=v(_)/Math.PI+.5;o.push(b,1-N)}y(),h()}function h(){for(let _=0;_<o.length;_+=6){const M=o[_+0],b=o[_+2],N=o[_+4],C=Math.max(M,b,N),P=Math.min(M,b,N);C>.9&&P<.1&&(M<.2&&(o[_+0]+=1),b<.2&&(o[_+2]+=1),N<.2&&(o[_+4]+=1))}}function p(_){s.push(_.x,_.y,_.z)}function g(_,M){const b=_*3;M.x=e[b+0],M.y=e[b+1],M.z=e[b+2]}function y(){const _=new k,M=new k,b=new k,N=new k,C=new Ee,P=new Ee,D=new Ee;for(let I=0,A=0;I<s.length;I+=9,A+=6){_.set(s[I+0],s[I+1],s[I+2]),M.set(s[I+3],s[I+4],s[I+5]),b.set(s[I+6],s[I+7],s[I+8]),C.set(o[A+0],o[A+1]),P.set(o[A+2],o[A+3]),D.set(o[A+4],o[A+5]),N.copy(_).add(M).add(b).divideScalar(3);const U=x(N);w(C,A+0,_,U),w(P,A+2,M,U),w(D,A+4,b,U)}}function w(_,M,b,N){N<0&&_.x===1&&(o[M]=_.x-1),b.x===0&&b.z===0&&(o[M]=N/2/Math.PI+.5)}function x(_){return Math.atan2(_.z,-_.x)}function v(_){return Math.atan2(-_.y,Math.sqrt(_.x*_.x+_.z*_.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fa(e.vertices,e.indices,e.radius,e.details)}}class q0 extends fa{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 q0(e.radius,e.detail)}}const nm=new k,im=new k,C_=new k,rm=new sr;class sI extends mt{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(sl*t),o=e.getIndex(),a=e.getAttribute("position"),u=o?o.count:a.count,d=[0,0,0],f=["a","b","c"],h=new Array(3),p={},g=[];for(let y=0;y<u;y+=3){o?(d[0]=o.getX(y),d[1]=o.getX(y+1),d[2]=o.getX(y+2)):(d[0]=y,d[1]=y+1,d[2]=y+2);const{a:w,b:x,c:v}=rm;if(w.fromBufferAttribute(a,d[0]),x.fromBufferAttribute(a,d[1]),v.fromBufferAttribute(a,d[2]),rm.getNormal(C_),h[0]=`${Math.round(w.x*r)},${Math.round(w.y*r)},${Math.round(w.z*r)}`,h[1]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,h[2]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let _=0;_<3;_++){const M=(_+1)%3,b=h[_],N=h[M],C=rm[f[_]],P=rm[f[M]],D=`${b}_${N}`,I=`${N}_${b}`;I in p&&p[I]?(C_.dot(p[I].normal)<=s&&(g.push(C.x,C.y,C.z),g.push(P.x,P.y,P.z)),p[I]=null):D in p||(p[D]={index0:d[_],index1:d[M],normal:C_.clone()})}}for(const y in p)if(p[y]){const{index0:w,index1:x}=p[y];nm.fromBufferAttribute(a,w),im.fromBufferAttribute(a,x),g.push(nm.x,nm.y,nm.z),g.push(im.x,im.y,im.z)}this.setAttribute("position",new Ze(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class al extends bf{constructor(e){super(e),this.uuid=cr(),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 bf().fromJSON(r))}return this}}const PV={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=oI(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,u,d,f,h,p,g;if(i&&(s=OV(n,e,s,t)),n.length>80*t){a=d=n[0],u=f=n[1];for(let y=t;y<r;y+=t)h=n[y],p=n[y+1],h<a&&(a=h),p<u&&(u=p),h>d&&(d=h),p>f&&(f=p);g=Math.max(d-a,f-u),g=g!==0?32767/g:0}return Af(s,o,t,a,u,g,0),o}};function oI(n,e,t,i,r){let s,o;if(r===XV(n,e,t,i)>0)for(s=e;s<t;s+=i)o=_T(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=_T(s,n[s],n[s+1],o);return o&&Y0(o,o.next)&&(Cf(o),o=o.next),o}function vl(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Y0(t,t.next)||dn(t.prev,t,t.next)===0)){if(Cf(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Af(n,e,t,i,r,s,o){if(!n)return;!o&&s&&BV(n,i,r,s);let a=n,u,d;for(;n.prev!==n.next;){if(u=n.prev,d=n.next,s?LV(n,i,r,s):IV(n)){e.push(u.i/t|0),e.push(n.i/t|0),e.push(d.i/t|0),Cf(n),n=d.next,a=d.next;continue}if(n=d,n===a){o?o===1?(n=NV(vl(n),e,t),Af(n,e,t,i,r,s,2)):o===2&&DV(n,e,t,i,r,s):Af(vl(n),e,t,i,r,s,1);break}}}function IV(n){const e=n.prev,t=n,i=n.next;if(dn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,u=t.y,d=i.y,f=r<s?r<o?r:o:s<o?s:o,h=a<u?a<d?a:d:u<d?u:d,p=r>s?r>o?r:o:s>o?s:o,g=a>u?a>d?a:d:u>d?u:d;let y=i.next;for(;y!==e;){if(y.x>=f&&y.x<=p&&y.y>=h&&y.y<=g&&Oc(r,a,s,u,o,d,y.x,y.y)&&dn(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function LV(n,e,t,i){const r=n.prev,s=n,o=n.next;if(dn(r,s,o)>=0)return!1;const a=r.x,u=s.x,d=o.x,f=r.y,h=s.y,p=o.y,g=a<u?a<d?a:d:u<d?u:d,y=f<h?f<p?f:p:h<p?h:p,w=a>u?a>d?a:d:u>d?u:d,x=f>h?f>p?f:p:h>p?h:p,v=kS(g,y,e,t,i),_=kS(w,x,e,t,i);let M=n.prevZ,b=n.nextZ;for(;M&&M.z>=v&&b&&b.z<=_;){if(M.x>=g&&M.x<=w&&M.y>=y&&M.y<=x&&M!==r&&M!==o&&Oc(a,f,u,h,d,p,M.x,M.y)&&dn(M.prev,M,M.next)>=0||(M=M.prevZ,b.x>=g&&b.x<=w&&b.y>=y&&b.y<=x&&b!==r&&b!==o&&Oc(a,f,u,h,d,p,b.x,b.y)&&dn(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;M&&M.z>=v;){if(M.x>=g&&M.x<=w&&M.y>=y&&M.y<=x&&M!==r&&M!==o&&Oc(a,f,u,h,d,p,M.x,M.y)&&dn(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;b&&b.z<=_;){if(b.x>=g&&b.x<=w&&b.y>=y&&b.y<=x&&b!==r&&b!==o&&Oc(a,f,u,h,d,p,b.x,b.y)&&dn(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function NV(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Y0(r,s)&&aI(r,i,i.next,s)&&Tf(r,s)&&Tf(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Cf(i),Cf(i.next),i=n=s),i=i.next}while(i!==n);return vl(i)}function DV(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&GV(o,a)){let u=lI(o,a);o=vl(o,o.next),u=vl(u,u.next),Af(o,e,t,i,r,s,0),Af(u,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function OV(n,e,t,i){const r=[];let s,o,a,u,d;for(s=0,o=e.length;s<o;s++)a=e[s]*i,u=s<o-1?e[s+1]*i:n.length,d=oI(n,a,u,i,!1),d===d.next&&(d.steiner=!0),r.push(HV(d));for(r.sort(UV),s=0;s<r.length;s++)t=FV(r[s],t);return t}function UV(n,e){return n.x-e.x}function FV(n,e){const t=kV(n,e);if(!t)return e;const i=lI(t,n);return vl(i,i.next),vl(t,t.next)}function kV(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 p=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=s&&p>i&&(i=p,r=t.x<t.next.x?t:t.next,p===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,u=r.x,d=r.y;let f=1/0,h;t=r;do s>=t.x&&t.x>=u&&s!==t.x&&Oc(o<d?s:i,o,u,d,o<d?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),Tf(t,n)&&(h<f||h===f&&(t.x>r.x||t.x===r.x&&zV(r,t)))&&(r=t,f=h)),t=t.next;while(t!==a);return r}function zV(n,e){return dn(n.prev,n,e.prev)<0&&dn(e.next,n,n.next)<0}function BV(n,e,t,i){let r=n;do r.z===0&&(r.z=kS(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,VV(r)}function VV(n){let e,t,i,r,s,o,a,u,d=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<d&&(a++,i=i.nextZ,!!i);e++);for(u=d;a>0||u>0&&i;)a!==0&&(u===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,u--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,d*=2}while(o>1);return n}function kS(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 HV(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 Oc(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 GV(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!WV(n,e)&&(Tf(n,e)&&Tf(e,n)&&jV(n,e)&&(dn(n.prev,n,e.prev)||dn(n,e.prev,e))||Y0(n,e)&&dn(n.prev,n,n.next)>0&&dn(e.prev,e,e.next)>0)}function dn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Y0(n,e){return n.x===e.x&&n.y===e.y}function aI(n,e,t,i){const r=om(dn(n,e,t)),s=om(dn(n,e,i)),o=om(dn(t,i,n)),a=om(dn(t,i,e));return!!(r!==s&&o!==a||r===0&&sm(n,t,e)||s===0&&sm(n,i,e)||o===0&&sm(t,n,i)||a===0&&sm(t,e,i))}function sm(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 om(n){return n>0?1:n<0?-1:0}function WV(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&&aI(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Tf(n,e){return dn(n.prev,n,n.next)<0?dn(n,e,n.next)>=0&&dn(n,n.prev,e)>=0:dn(n,e,n.prev)<0||dn(n,n.next,e)<0}function jV(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 lI(n,e){const t=new zS(n.i,n.x,n.y),i=new zS(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 _T(n,e,t,i){const r=new zS(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 Cf(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 zS(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 XV(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 Ls{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 Ls.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];xT(e),ST(i,e);let o=e.length;t.forEach(xT);for(let u=0;u<t.length;u++)r.push(o),o+=t[u].length,ST(i,t[u]);const a=PV.triangulate(i,r);for(let u=0;u<a.length;u+=3)s.push(a.slice(u,u+3));return s}}function xT(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function ST(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class $0 extends mt{constructor(e=new al([new Ee(.5,.5),new Ee(-.5,.5),new Ee(-.5,-.5),new Ee(.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,u=e.length;a<u;a++){const d=e[a];o(d)}this.setAttribute("position",new Ze(r,3)),this.setAttribute("uv",new Ze(s,2)),this.computeVertexNormals();function o(a){const u=[],d=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:g-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3;const v=t.extrudePath,_=t.UVGenerator!==void 0?t.UVGenerator:qV;let M,b=!1,N,C,P,D;v&&(M=v.getSpacedPoints(f),b=!0,p=!1,N=v.computeFrenetFrames(f,!1),C=new k,P=new k,D=new k),p||(x=0,g=0,y=0,w=0);const I=a.extractPoints(d);let A=I.shape;const U=I.holes;if(!Ls.isClockWise(A)){A=A.reverse();for(let pe=0,be=U.length;pe<be;pe++){const Se=U[pe];Ls.isClockWise(Se)&&(U[pe]=Se.reverse())}}const z=Ls.triangulateShape(A,U),Z=A;for(let pe=0,be=U.length;pe<be;pe++){const Se=U[pe];A=A.concat(Se)}function J(pe,be,Se){return be||console.error("THREE.ExtrudeGeometry: vec does not exist"),pe.clone().addScaledVector(be,Se)}const ne=A.length,le=z.length;function O(pe,be,Se){let Fe,Te,He;const V=pe.x-be.x,L=pe.y-be.y,R=Se.x-pe.x,X=Se.y-pe.y,q=V*V+L*L,$=V*X-L*R;if(Math.abs($)>Number.EPSILON){const ie=Math.sqrt(q),Ne=Math.sqrt(R*R+X*X),Re=be.x-L/ie,Pe=be.y+V/ie,st=Se.x-X/Ne,De=Se.y+R/Ne,qe=((st-Re)*X-(De-Pe)*R)/(V*X-L*R);Fe=Re+V*qe-pe.x,Te=Pe+L*qe-pe.y;const ct=Fe*Fe+Te*Te;if(ct<=2)return new Ee(Fe,Te);He=Math.sqrt(ct/2)}else{let ie=!1;V>Number.EPSILON?R>Number.EPSILON&&(ie=!0):V<-Number.EPSILON?R<-Number.EPSILON&&(ie=!0):Math.sign(L)===Math.sign(X)&&(ie=!0),ie?(Fe=-L,Te=V,He=Math.sqrt(q)):(Fe=V,Te=L,He=Math.sqrt(q/2))}return new Ee(Fe/He,Te/He)}const Y=[];for(let pe=0,be=Z.length,Se=be-1,Fe=pe+1;pe<be;pe++,Se++,Fe++)Se===be&&(Se=0),Fe===be&&(Fe=0),Y[pe]=O(Z[pe],Z[Se],Z[Fe]);const K=[];let ae,ge=Y.concat();for(let pe=0,be=U.length;pe<be;pe++){const Se=U[pe];ae=[];for(let Fe=0,Te=Se.length,He=Te-1,V=Fe+1;Fe<Te;Fe++,He++,V++)He===Te&&(He=0),V===Te&&(V=0),ae[Fe]=O(Se[Fe],Se[He],Se[V]);K.push(ae),ge=ge.concat(ae)}for(let pe=0;pe<x;pe++){const be=pe/x,Se=g*Math.cos(be*Math.PI/2),Fe=y*Math.sin(be*Math.PI/2)+w;for(let Te=0,He=Z.length;Te<He;Te++){const V=J(Z[Te],Y[Te],Fe);Ce(V.x,V.y,-Se)}for(let Te=0,He=U.length;Te<He;Te++){const V=U[Te];ae=K[Te];for(let L=0,R=V.length;L<R;L++){const X=J(V[L],ae[L],Fe);Ce(X.x,X.y,-Se)}}}const Ue=y+w;for(let pe=0;pe<ne;pe++){const be=p?J(A[pe],ge[pe],Ue):A[pe];b?(P.copy(N.normals[0]).multiplyScalar(be.x),C.copy(N.binormals[0]).multiplyScalar(be.y),D.copy(M[0]).add(P).add(C),Ce(D.x,D.y,D.z)):Ce(be.x,be.y,0)}for(let pe=1;pe<=f;pe++)for(let be=0;be<ne;be++){const Se=p?J(A[be],ge[be],Ue):A[be];b?(P.copy(N.normals[pe]).multiplyScalar(Se.x),C.copy(N.binormals[pe]).multiplyScalar(Se.y),D.copy(M[pe]).add(P).add(C),Ce(D.x,D.y,D.z)):Ce(Se.x,Se.y,h/f*pe)}for(let pe=x-1;pe>=0;pe--){const be=pe/x,Se=g*Math.cos(be*Math.PI/2),Fe=y*Math.sin(be*Math.PI/2)+w;for(let Te=0,He=Z.length;Te<He;Te++){const V=J(Z[Te],Y[Te],Fe);Ce(V.x,V.y,h+Se)}for(let Te=0,He=U.length;Te<He;Te++){const V=U[Te];ae=K[Te];for(let L=0,R=V.length;L<R;L++){const X=J(V[L],ae[L],Fe);b?Ce(X.x,X.y+M[f-1].y,M[f-1].x+Se):Ce(X.x,X.y,h+Se)}}}se(),xe();function se(){const pe=r.length/3;if(p){let be=0,Se=ne*be;for(let Fe=0;Fe<le;Fe++){const Te=z[Fe];tt(Te[2]+Se,Te[1]+Se,Te[0]+Se)}be=f+x*2,Se=ne*be;for(let Fe=0;Fe<le;Fe++){const Te=z[Fe];tt(Te[0]+Se,Te[1]+Se,Te[2]+Se)}}else{for(let be=0;be<le;be++){const Se=z[be];tt(Se[2],Se[1],Se[0])}for(let be=0;be<le;be++){const Se=z[be];tt(Se[0]+ne*f,Se[1]+ne*f,Se[2]+ne*f)}}i.addGroup(pe,r.length/3-pe,0)}function xe(){const pe=r.length/3;let be=0;Ae(Z,be),be+=Z.length;for(let Se=0,Fe=U.length;Se<Fe;Se++){const Te=U[Se];Ae(Te,be),be+=Te.length}i.addGroup(pe,r.length/3-pe,1)}function Ae(pe,be){let Se=pe.length;for(;--Se>=0;){const Fe=Se;let Te=Se-1;Te<0&&(Te=pe.length-1);for(let He=0,V=f+x*2;He<V;He++){const L=ne*He,R=ne*(He+1),X=be+Fe+L,q=be+Te+L,$=be+Te+R,ie=be+Fe+R;Qe(X,q,$,ie)}}}function Ce(pe,be,Se){u.push(pe),u.push(be),u.push(Se)}function tt(pe,be,Se){Q(pe),Q(be),Q(Se);const Fe=r.length/3,Te=_.generateTopUV(i,r,Fe-3,Fe-2,Fe-1);nt(Te[0]),nt(Te[1]),nt(Te[2])}function Qe(pe,be,Se,Fe){Q(pe),Q(be),Q(Fe),Q(be),Q(Se),Q(Fe);const Te=r.length/3,He=_.generateSideWallUV(i,r,Te-6,Te-3,Te-2,Te-1);nt(He[0]),nt(He[1]),nt(He[3]),nt(He[1]),nt(He[2]),nt(He[3])}function Q(pe){r.push(u[pe*3+0]),r.push(u[pe*3+1]),r.push(u[pe*3+2])}function nt(pe){s.push(pe.x),s.push(pe.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 YV(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 t0[r.type]().fromJSON(r)),new $0(i,e.options)}}const qV={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],u=e[i*3+1],d=e[r*3],f=e[r*3+1];return[new Ee(s,o),new Ee(a,u),new Ee(d,f)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],u=e[t*3+2],d=e[i*3],f=e[i*3+1],h=e[i*3+2],p=e[r*3],g=e[r*3+1],y=e[r*3+2],w=e[s*3],x=e[s*3+1],v=e[s*3+2];return Math.abs(a-f)<Math.abs(o-d)?[new Ee(o,1-u),new Ee(d,1-h),new Ee(p,1-y),new Ee(w,1-v)]:[new Ee(a,1-u),new Ee(f,1-h),new Ee(g,1-y),new Ee(x,1-v)]}};function YV(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 Z0 extends fa{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 Z0(e.radius,e.detail)}}class $f extends fa{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 $f(e.radius,e.detail)}}class J0 extends mt{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=[],u=[],d=[],f=[];let h=e;const p=(t-e)/r,g=new k,y=new Ee;for(let w=0;w<=r;w++){for(let x=0;x<=i;x++){const v=s+x/i*o;g.x=h*Math.cos(v),g.y=h*Math.sin(v),u.push(g.x,g.y,g.z),d.push(0,0,1),y.x=(g.x/t+1)/2,y.y=(g.y/t+1)/2,f.push(y.x,y.y)}h+=p}for(let w=0;w<r;w++){const x=w*(i+1);for(let v=0;v<i;v++){const _=v+x,M=_,b=_+i+1,N=_+i+2,C=_+1;a.push(M,b,C),a.push(b,N,C)}}this.setIndex(a),this.setAttribute("position",new Ze(u,3)),this.setAttribute("normal",new Ze(d,3)),this.setAttribute("uv",new Ze(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new J0(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class K0 extends mt{constructor(e=new al([new Ee(0,.5),new Ee(-.5,-.5),new Ee(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,u=0;if(Array.isArray(e)===!1)d(e);else for(let f=0;f<e.length;f++)d(e[f]),this.addGroup(a,u,f),a+=u,u=0;this.setIndex(i),this.setAttribute("position",new Ze(r,3)),this.setAttribute("normal",new Ze(s,3)),this.setAttribute("uv",new Ze(o,2));function d(f){const h=r.length/3,p=f.extractPoints(t);let g=p.shape;const y=p.holes;Ls.isClockWise(g)===!1&&(g=g.reverse());for(let x=0,v=y.length;x<v;x++){const _=y[x];Ls.isClockWise(_)===!0&&(y[x]=_.reverse())}const w=Ls.triangulateShape(g,y);for(let x=0,v=y.length;x<v;x++){const _=y[x];g=g.concat(_)}for(let x=0,v=g.length;x<v;x++){const _=g[x];r.push(_.x,_.y,0),s.push(0,0,1),o.push(_.x,_.y)}for(let x=0,v=w.length;x<v;x++){const _=w[x],M=_[0]+h,b=_[1]+h,N=_[2]+h;i.push(M,b,N),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return $V(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 K0(i,e.curveSegments)}}function $V(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 Zf extends mt{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 u=Math.min(o+a,Math.PI);let d=0;const f=[],h=new k,p=new k,g=[],y=[],w=[],x=[];for(let v=0;v<=i;v++){const _=[],M=v/i;let b=0;v===0&&o===0?b=.5/t:v===i&&u===Math.PI&&(b=-.5/t);for(let N=0;N<=t;N++){const C=N/t;h.x=-e*Math.cos(r+C*s)*Math.sin(o+M*a),h.y=e*Math.cos(o+M*a),h.z=e*Math.sin(r+C*s)*Math.sin(o+M*a),y.push(h.x,h.y,h.z),p.copy(h).normalize(),w.push(p.x,p.y,p.z),x.push(C+b,1-M),_.push(d++)}f.push(_)}for(let v=0;v<i;v++)for(let _=0;_<t;_++){const M=f[v][_+1],b=f[v][_],N=f[v+1][_],C=f[v+1][_+1];(v!==0||o>0)&&g.push(M,b,C),(v!==i-1||u<Math.PI)&&g.push(b,N,C)}this.setIndex(g),this.setAttribute("position",new Ze(y,3)),this.setAttribute("normal",new Ze(w,3)),this.setAttribute("uv",new Ze(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zf(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Q0 extends fa{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 Q0(e.radius,e.detail)}}class ev extends mt{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=[],u=[],d=[],f=new k,h=new k,p=new k;for(let g=0;g<=i;g++)for(let y=0;y<=r;y++){const w=y/r*s,x=g/i*Math.PI*2;h.x=(e+t*Math.cos(x))*Math.cos(w),h.y=(e+t*Math.cos(x))*Math.sin(w),h.z=t*Math.sin(x),a.push(h.x,h.y,h.z),f.x=e*Math.cos(w),f.y=e*Math.sin(w),p.subVectors(h,f).normalize(),u.push(p.x,p.y,p.z),d.push(y/r),d.push(g/i)}for(let g=1;g<=i;g++)for(let y=1;y<=r;y++){const w=(r+1)*g+y-1,x=(r+1)*(g-1)+y-1,v=(r+1)*(g-1)+y,_=(r+1)*g+y;o.push(w,x,_),o.push(x,v,_)}this.setIndex(o),this.setAttribute("position",new Ze(a,3)),this.setAttribute("normal",new Ze(u,3)),this.setAttribute("uv",new Ze(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ev(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class tv extends mt{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=[],u=[],d=[],f=[],h=new k,p=new k,g=new k,y=new k,w=new k,x=new k,v=new k;for(let M=0;M<=i;++M){const b=M/i*s*Math.PI*2;_(b,s,o,e,g),_(b+.01,s,o,e,y),x.subVectors(y,g),v.addVectors(y,g),w.crossVectors(x,v),v.crossVectors(w,x),w.normalize(),v.normalize();for(let N=0;N<=r;++N){const C=N/r*Math.PI*2,P=-t*Math.cos(C),D=t*Math.sin(C);h.x=g.x+(P*v.x+D*w.x),h.y=g.y+(P*v.y+D*w.y),h.z=g.z+(P*v.z+D*w.z),u.push(h.x,h.y,h.z),p.subVectors(h,g).normalize(),d.push(p.x,p.y,p.z),f.push(M/i),f.push(N/r)}}for(let M=1;M<=i;M++)for(let b=1;b<=r;b++){const N=(r+1)*(M-1)+(b-1),C=(r+1)*M+(b-1),P=(r+1)*M+b,D=(r+1)*(M-1)+b;a.push(N,C,D),a.push(C,P,D)}this.setIndex(a),this.setAttribute("position",new Ze(u,3)),this.setAttribute("normal",new Ze(d,3)),this.setAttribute("uv",new Ze(f,2));function _(M,b,N,C,P){const D=Math.cos(M),I=Math.sin(M),A=N/b*M,U=Math.cos(A);P.x=C*(2+U)*.5*D,P.y=C*(2+U)*I*.5,P.z=C*Math.sin(A)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tv(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class nv extends mt{constructor(e=new D1(new k(-1,-1,0),new k(-1,1,0),new k(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 k,u=new k,d=new Ee;let f=new k;const h=[],p=[],g=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ze(h,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function w(){for(let M=0;M<t;M++)x(M);x(s===!1?t:0),_(),v()}function x(M){f=e.getPointAt(M/t,f);const b=o.normals[M],N=o.binormals[M];for(let C=0;C<=r;C++){const P=C/r*Math.PI*2,D=Math.sin(P),I=-Math.cos(P);u.x=I*b.x+D*N.x,u.y=I*b.y+D*N.y,u.z=I*b.z+D*N.z,u.normalize(),p.push(u.x,u.y,u.z),a.x=f.x+i*u.x,a.y=f.y+i*u.y,a.z=f.z+i*u.z,h.push(a.x,a.y,a.z)}}function v(){for(let M=1;M<=t;M++)for(let b=1;b<=r;b++){const N=(r+1)*(M-1)+(b-1),C=(r+1)*M+(b-1),P=(r+1)*M+b,D=(r+1)*(M-1)+b;y.push(N,C,D),y.push(C,P,D)}}function _(){for(let M=0;M<=t;M++)for(let b=0;b<=r;b++)d.x=M/t,d.y=b/r,g.push(d.x,d.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 nv(new t0[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class cI extends mt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new k,s=new k;if(e.index!==null){const o=e.attributes.position,a=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:a.count,materialIndex:0}]);for(let d=0,f=u.length;d<f;++d){const h=u[d],p=h.start,g=h.count;for(let y=p,w=p+g;y<w;y+=3)for(let x=0;x<3;x++){const v=a.getX(y+x),_=a.getX(y+(x+1)%3);r.fromBufferAttribute(o,v),s.fromBufferAttribute(o,_),wT(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,u=o.count/3;a<u;a++)for(let d=0;d<3;d++){const f=3*a+d,h=3*a+(d+1)%3;r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,h),wT(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ze(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function wT(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 MT=Object.freeze({__proto__:null,BoxGeometry:Sl,CapsuleGeometry:W0,CircleGeometry:j0,ConeGeometry:X0,CylinderGeometry:mu,DodecahedronGeometry:q0,EdgesGeometry:sI,ExtrudeGeometry:$0,IcosahedronGeometry:Z0,LatheGeometry:Yf,OctahedronGeometry:$f,PlaneGeometry:hu,PolyhedronGeometry:fa,RingGeometry:J0,ShapeGeometry:K0,SphereGeometry:Zf,TetrahedronGeometry:Q0,TorusGeometry:ev,TorusKnotGeometry:tv,TubeGeometry:nv,WireframeGeometry:cI});class uI extends ii{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Xe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class dI extends as{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class U1 extends ii{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new fr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class fI extends U1{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ee(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class hI extends ii{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new fr,this.combine=Hf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class pI extends ii{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Ee(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 mI extends ii{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Ee(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 gI extends ii{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new fr,this.combine=Hf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vI extends ii{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=da,this.normalScale=new Ee(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 yI extends Ni{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 Ja(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 _I(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function xI(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 BS(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 u=0;u!==e;++u)r[o++]=n[a+u]}return r}function F1(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 ZV(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let u=0;u<s.tracks.length;++u){const d=s.tracks[u],f=d.getValueSize(),h=[],p=[];for(let g=0;g<d.times.length;++g){const y=d.times[g]*r;if(!(y<t||y>=i)){h.push(d.times[g]);for(let w=0;w<f;++w)p.push(d.values[g*f+w])}}h.length!==0&&(d.times=Ja(h,d.times.constructor),d.values=Ja(p,d.values.constructor),o.push(d))}s.tracks=o;let a=1/0;for(let u=0;u<s.tracks.length;++u)a>s.tracks[u].times[0]&&(a=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*a);return s.resetDuration(),s}function JV(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],u=a.ValueTypeName;if(u==="bool"||u==="string")continue;const d=n.tracks.find(function(v){return v.name===a.name&&v.ValueTypeName===u});if(d===void 0)continue;let f=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=h/3);let p=0;const g=d.getValueSize();d.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);const y=a.times.length-1;let w;if(s<=a.times[0]){const v=f,_=h-f;w=a.values.slice(v,_)}else if(s>=a.times[y]){const v=y*h+f,_=v+h-f;w=a.values.slice(v,_)}else{const v=a.createInterpolant(),_=f,M=h-f;v.evaluate(s),w=v.resultBuffer.slice(_,M)}u==="quaternion"&&new gi().fromArray(w).normalize().conjugate().toArray(w);const x=d.times.length;for(let v=0;v<x;++v){const _=v*g+p;if(u==="quaternion")gi.multiplyQuaternionsFlat(d.values,_,w,0,d.values,_);else{const M=g-p*2;for(let b=0;b<M;++b)d.values[_+b]-=w[b]}}}return n.blendMode=v1,n}const KV={convertArray:Ja,isTypedArray:_I,getKeyframeOrder:xI,sortedArray:BS,flattenJSON:F1,subclip:ZV,makeClipAdditive:JV};class Jf{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 u=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===u)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 SI extends Jf{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:Ya,endingEnd:Ya}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],u=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case $a:s=e,a=2*t-i;break;case vf:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(u===void 0)switch(this.getSettings_().endingEnd){case $a:o=e,u=2*i-t;break;case vf:o=1,u=i+r[1]-r[0];break;default:o=e-1,u=t}const d=(i-t)*.5,f=this.valueSize;this._weightPrev=d/(t-a),this._weightNext=d/(u-i),this._offsetPrev=s*f,this._offsetNext=o*f}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,u=e*a,d=u-a,f=this._offsetPrev,h=this._offsetNext,p=this._weightPrev,g=this._weightNext,y=(i-t)/(r-t),w=y*y,x=w*y,v=-p*x+2*p*w-p*y,_=(1+p)*x+(-1.5-2*p)*w+(-.5+p)*y+1,M=(-1-g)*x+(1.5+g)*w+.5*y,b=g*x-g*w;for(let N=0;N!==a;++N)s[N]=v*o[f+N]+_*o[d+N]+M*o[u+N]+b*o[h+N];return s}}class k1 extends Jf{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,u=e*a,d=u-a,f=(i-t)/(r-t),h=1-f;for(let p=0;p!==a;++p)s[p]=o[d+p]*h+o[u+p]*f;return s}}class wI extends Jf{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class ds{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=Ja(t,this.TimeBufferType),this.values=Ja(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:Ja(e.times,Array),values:Ja(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new wI(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new k1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new SI(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case mf:t=this.InterpolantFactoryMethodDiscrete;break;case gf:t=this.InterpolantFactoryMethodLinear;break;case Ym: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 mf;case this.InterpolantFactoryMethodLinear:return gf;case this.InterpolantFactoryMethodSmooth:return Ym}}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=i.slice(s,o),this.values=this.values.slice(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 u=i[a];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,u),e=!1;break}if(o!==null&&o>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,u,o),e=!1;break}o=u}if(r!==void 0&&_I(r))for(let a=0,u=r.length;a!==u;++a){const d=r[a];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,d),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Ym,s=e.length-1;let o=1;for(let a=1;a<s;++a){let u=!1;const d=e[a],f=e[a+1];if(d!==f&&(a!==1||d!==e[0]))if(r)u=!0;else{const h=a*i,p=h-i,g=h+i;for(let y=0;y!==i;++y){const w=t[h+y];if(w!==t[p+y]||w!==t[g+y]){u=!0;break}}}if(u){if(a!==o){e[o]=e[a];const h=a*i,p=o*i;for(let g=0;g!==i;++g)t[p+g]=t[h+g]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,u=o*i,d=0;d!==i;++d)t[u+d]=t[a+d];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}ds.prototype.TimeBufferType=Float32Array;ds.prototype.ValueBufferType=Float32Array;ds.prototype.DefaultInterpolation=gf;class wl extends ds{}wl.prototype.ValueTypeName="bool";wl.prototype.ValueBufferType=Array;wl.prototype.DefaultInterpolation=mf;wl.prototype.InterpolantFactoryMethodLinear=void 0;wl.prototype.InterpolantFactoryMethodSmooth=void 0;class z1 extends ds{}z1.prototype.ValueTypeName="color";class Rf extends ds{}Rf.prototype.ValueTypeName="number";class MI extends Jf{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,u=(i-t)/(r-t);let d=e*a;for(let f=d+a;d!==f;d+=4)gi.slerpFlat(s,0,o,d-a,o,d,u);return s}}class gu extends ds{InterpolantFactoryMethodLinear(e){return new MI(this.times,this.values,this.getValueSize(),e)}}gu.prototype.ValueTypeName="quaternion";gu.prototype.DefaultInterpolation=gf;gu.prototype.InterpolantFactoryMethodSmooth=void 0;class Ml extends ds{}Ml.prototype.ValueTypeName="string";Ml.prototype.ValueBufferType=Array;Ml.prototype.DefaultInterpolation=mf;Ml.prototype.InterpolantFactoryMethodLinear=void 0;Ml.prototype.InterpolantFactoryMethodSmooth=void 0;class Pf extends ds{}Pf.prototype.ValueTypeName="vector";class If{constructor(e="",t=-1,i=[],r=D0){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=cr(),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(eH(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(ds.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let u=[],d=[];u.push((a+s-1)%s,a,(a+1)%s),d.push(0,1,0);const f=xI(u);u=BS(u,1,f),d=BS(d,1,f),!r&&u[0]===0&&(u.push(s),d.push(d[0])),o.push(new Rf(".morphTargetInfluences["+t[a].name+"]",u,d).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,u=e.length;a<u;a++){const d=e[a],f=d.name.match(s);if(f&&f.length>1){const h=f[1];let p=r[h];p||(r[h]=p=[]),p.push(d)}}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(h,p,g,y,w){if(g.length!==0){const x=[],v=[];F1(g,x,v,y),x.length!==0&&w.push(new h(p,x,v))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let u=e.length||-1;const d=e.hierarchy||[];for(let h=0;h<d.length;h++){const p=d[h].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const g={};let y;for(y=0;y<p.length;y++)if(p[y].morphTargets)for(let w=0;w<p[y].morphTargets.length;w++)g[p[y].morphTargets[w]]=-1;for(const w in g){const x=[],v=[];for(let _=0;_!==p[y].morphTargets.length;++_){const M=p[y];x.push(M.time),v.push(M.morphTarget===w?1:0)}r.push(new Rf(".morphTargetInfluence["+w+"]",x,v))}u=g.length*o}else{const g=".bones["+t[h].name+"]";i(Pf,g+".position",p,"pos",r),i(gu,g+".quaternion",p,"rot",r),i(Pf,g+".scale",p,"scl",r)}}return r.length===0?null:new this(s,u,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 QV(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Rf;case"vector":case"vector2":case"vector3":case"vector4":return Pf;case"color":return z1;case"quaternion":return gu;case"bool":case"boolean":return wl;case"string":return Ml}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function eH(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=QV(n.type);if(n.times===void 0){const t=[],i=[];F1(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 io={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 B1{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,u;const d=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(f){a++,s===!1&&r.onStart!==void 0&&r.onStart(f,o,a),s=!0},this.itemEnd=function(f){o++,r.onProgress!==void 0&&r.onProgress(f,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(f){r.onError!==void 0&&r.onError(f)},this.resolveURL=function(f){return u?u(f):f},this.setURLModifier=function(f){return u=f,this},this.addHandler=function(f,h){return d.push(f,h),this},this.removeHandler=function(f){const h=d.indexOf(f);return h!==-1&&d.splice(h,2),this},this.getHandler=function(f){for(let h=0,p=d.length;h<p;h+=2){const g=d[h],y=d[h+1];if(g.global&&(g.lastIndex=0),g.test(f))return y}return null}}}const EI=new B1;class _i{constructor(e){this.manager=e!==void 0?e:EI,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}}_i.DEFAULT_MATERIAL_NAME="__DEFAULT";const qs={};class tH extends Error{constructor(e,t){super(e),this.response=t}}class ls extends _i{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=io.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(qs[e]!==void 0){qs[e].push({onLoad:t,onProgress:i,onError:r});return}qs[e]=[],qs[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,u=this.responseType;fetch(o).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const f=qs[e],h=d.body.getReader(),p=d.headers.get("X-File-Size")||d.headers.get("Content-Length"),g=p?parseInt(p):0,y=g!==0;let w=0;const x=new ReadableStream({start(v){_();function _(){h.read().then(({done:M,value:b})=>{if(M)v.close();else{w+=b.byteLength;const N=new ProgressEvent("progress",{lengthComputable:y,loaded:w,total:g});for(let C=0,P=f.length;C<P;C++){const D=f[C];D.onProgress&&D.onProgress(N)}v.enqueue(b),_()}})}}});return new Response(x)}else throw new tH(`fetch for "${d.url}" responded with ${d.status}: ${d.statusText}`,d)}).then(d=>{switch(u){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(f=>new DOMParser().parseFromString(f,a));case"json":return d.json();default:if(a===void 0)return d.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),p=h&&h[1]?h[1].toLowerCase():void 0,g=new TextDecoder(p);return d.arrayBuffer().then(y=>g.decode(y))}}}).then(d=>{io.add(e,d);const f=qs[e];delete qs[e];for(let h=0,p=f.length;h<p;h++){const g=f[h];g.onLoad&&g.onLoad(d)}}).catch(d=>{const f=qs[e];if(f===void 0)throw this.manager.itemError(e),d;delete qs[e];for(let h=0,p=f.length;h<p;h++){const g=f[h];g.onError&&g.onError(d)}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 nH extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new ls(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(u){r?r(u):console.error(u),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=If.parse(e[i]);t.push(r)}return t}}class iH extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new H0,u=new ls(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let d=0;function f(h){u.load(e[h],function(p){const g=s.parse(p,!0);o[h]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},d+=1,d===6&&(g.mipmapCount===1&&(a.minFilter=In),a.image=o,a.format=g.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let h=0,p=e.length;h<p;++h)f(h);else u.load(e,function(h){const p=s.parse(h,!0);if(p.isCubemap){const g=p.mipmaps.length/p.mipmapCount;for(let y=0;y<g;y++){o[y]={mipmaps:[]};for(let w=0;w<p.mipmapCount;w++)o[y].mipmaps.push(p.mipmaps[y*p.mipmapCount+w]),o[y].format=p.format,o[y].width=p.width,o[y].height=p.height}a.image=o}else a.image.width=p.width,a.image.height=p.height,a.mipmaps=p.mipmaps;p.mipmapCount===1&&(a.minFilter=In),a.format=p.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class Lf extends _i{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=io.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Mf("img");function u(){f(),io.add(e,this),t&&t(this),s.manager.itemEnd(e)}function d(h){f(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){a.removeEventListener("load",u,!1),a.removeEventListener("error",d,!1)}return a.addEventListener("load",u,!1),a.addEventListener("error",d,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class rH extends _i{constructor(e){super(e)}load(e,t,i,r){const s=new Xf;s.colorSpace=br;const o=new Lf(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function u(d){o.load(e[d],function(f){s.images[d]=f,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let d=0;d<e.length;++d)u(d);return s}}class sH extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new ia,a=new ls(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(u){let d;try{d=s.parse(u)}catch(f){if(r!==void 0)r(f);else{console.error(f);return}}d.image!==void 0?o.image=d.image:d.data!==void 0&&(o.image.width=d.width,o.image.height=d.height,o.image.data=d.data),o.wrapS=d.wrapS!==void 0?d.wrapS:Pr,o.wrapT=d.wrapT!==void 0?d.wrapT:Pr,o.magFilter=d.magFilter!==void 0?d.magFilter:In,o.minFilter=d.minFilter!==void 0?d.minFilter:In,o.anisotropy=d.anisotropy!==void 0?d.anisotropy:1,d.colorSpace!==void 0&&(o.colorSpace=d.colorSpace),d.flipY!==void 0&&(o.flipY=d.flipY),d.format!==void 0&&(o.format=d.format),d.type!==void 0&&(o.type=d.type),d.mipmaps!==void 0&&(o.mipmaps=d.mipmaps,o.minFilter=As),d.mipmapCount===1&&(o.minFilter=In),d.generateMipmaps!==void 0&&(o.generateMipmaps=d.generateMipmaps),o.needsUpdate=!0,t&&t(o,d)},i,r),o}}class oH extends _i{constructor(e){super(e)}load(e,t,i,r){const s=new hn,o=new Lf(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 ha extends Bt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Xe(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 bI extends ha{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Bt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Xe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const R_=new ht,ET=new k,bT=new k;class V1{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ee(512,512),this.map=null,this.mapPass=null,this.matrix=new ht,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qf,this._frameExtents=new Ee(1,1),this._viewportCount=1,this._viewports=[new Wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;ET.setFromMatrixPosition(e.matrixWorld),t.position.copy(ET),bT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(bT),t.updateMatrixWorld(),R_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(R_),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(R_)}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 aH extends V1{constructor(){super(new sn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=iu*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 AI extends ha{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(Bt.DEFAULT_UP),this.updateMatrix(),this.target=new Bt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new aH}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 AT=new ht,rd=new k,P_=new k;class lH extends V1{constructor(){super(new sn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ee(4,2),this._viewportCount=6,this._viewports=[new Wt(2,1,1,1),new Wt(0,1,1,1),new Wt(3,1,1,1),new Wt(1,1,1,1),new Wt(3,0,1,1),new Wt(1,0,1,1)],this._cubeDirections=[new k(1,0,0),new k(-1,0,0),new k(0,0,1),new k(0,0,-1),new k(0,1,0),new k(0,-1,0)],this._cubeUps=[new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,0,1),new k(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()),rd.setFromMatrixPosition(e.matrixWorld),i.position.copy(rd),P_.copy(i.position),P_.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(P_),i.updateMatrixWorld(),r.makeTranslation(-rd.x,-rd.y,-rd.z),AT.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(AT)}}class TI extends ha{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 lH}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 cH extends V1{constructor(){super(new na(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class CI extends ha{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Bt.DEFAULT_UP),this.updateMatrix(),this.target=new Bt,this.shadow=new cH}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class RI extends ha{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class PI extends ha{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 II{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new k)}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 LI extends ha{constructor(e=new II,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 iv extends _i{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new ls(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(u){r?r(u):console.error(u),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=iv.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 Xe().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.dispersion!==void 0&&(r.dispersion=e.dispersion),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.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),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.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),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.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),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.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),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!==void 0&&(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 Xe().setHex(o.value);break;case"v2":r.uniforms[s].value=new Ee().fromArray(o.value);break;case"v3":r.uniforms[s].value=new k().fromArray(o.value);break;case"v4":r.uniforms[s].value=new Wt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new Mt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new ht().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.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),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 Ee().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.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),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 Ee().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.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),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:uI,SpriteMaterial:T1,RawShaderMaterial:dI,ShaderMaterial:as,PointsMaterial:R1,MeshPhysicalMaterial:fI,MeshStandardMaterial:U1,MeshPhongMaterial:hI,MeshToonMaterial:pI,MeshNormalMaterial:mI,MeshLambertMaterial:gI,MeshDepthMaterial:b1,MeshDistanceMaterial:A1,MeshBasicMaterial:mo,MeshMatcapMaterial:vI,LineDashedMaterial:yI,LineBasicMaterial:Ni,Material:ii};return new t[e]}}class n0{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 NI extends mt{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 DI extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new ls(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(u){r?r(u):console.error(u),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(g,y){if(t[y]!==void 0)return t[y];const x=g.interleavedBuffers[y],v=s(g,x.buffer),_=Lc(x.type,v),M=new B0(_,x.stride);return M.uuid=x.uuid,t[y]=M,M}function s(g,y){if(i[y]!==void 0)return i[y];const x=g.arrayBuffers[y],v=new Uint32Array(x).buffer;return i[y]=v,v}const o=e.isInstancedBufferGeometry?new NI:new mt,a=e.data.index;if(a!==void 0){const g=Lc(a.type,a.array);o.setIndex(new Lt(g,1))}const u=e.data.attributes;for(const g in u){const y=u[g];let w;if(y.isInterleavedBufferAttribute){const x=r(e.data,y.data);w=new gl(x,y.itemSize,y.offset,y.normalized)}else{const x=Lc(y.type,y.array),v=y.isInstancedBufferAttribute?su:Lt;w=new v(x,y.itemSize,y.normalized)}y.name!==void 0&&(w.name=y.name),y.usage!==void 0&&w.setUsage(y.usage),o.setAttribute(g,w)}const d=e.data.morphAttributes;if(d)for(const g in d){const y=d[g],w=[];for(let x=0,v=y.length;x<v;x++){const _=y[x];let M;if(_.isInterleavedBufferAttribute){const b=r(e.data,_.data);M=new gl(b,_.itemSize,_.offset,_.normalized)}else{const b=Lc(_.type,_.array);M=new Lt(b,_.itemSize,_.normalized)}_.name!==void 0&&(M.name=_.name),w.push(M)}o.morphAttributes[g]=w}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let g=0,y=h.length;g!==y;++g){const w=h[g];o.addGroup(w.start,w.count,w.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const g=new k;p.center!==void 0&&g.fromArray(p.center),o.boundingSphere=new vi(g,p.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class uH extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?n0.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new ls(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(u){let d=null;try{d=JSON.parse(u)}catch(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const f=d.metadata;if(f===void 0||f.type===void 0||f.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(d,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?n0.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new ls(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),u=a.metadata;if(u===void 0||u.type===void 0||u.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(d)}),a=this.parseTextures(e.textures,o),u=this.parseMaterials(e.materials,a),d=this.parseObject(e.object,s,u,a,i),f=this.parseSkeletons(e.skeletons,d);if(this.bindSkeletons(d,f),t!==void 0){let h=!1;for(const p in o)if(o[p].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(d)}return d}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),u=this.parseObject(e.object,r,a,o,t),d=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,d),u}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new al().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 V0().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new DI;for(let s=0,o=e.length;s<o;s++){let a;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(u);break;default:u.type in MT?a=MT[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}a.uuid=u.uuid,u.name!==void 0&&(a.name=u.name),u.userData!==void 0&&(a.userData=u.userData),i[u.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new iv;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const u=e[o];i[u.uuid]===void 0&&(i[u.uuid]=s.parse(u)),r[u.uuid]=i[u.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=If.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(u){return i.manager.itemStart(u),s.load(u,function(){i.manager.itemEnd(u)},void 0,function(){i.manager.itemError(u),i.manager.itemEnd(u)})}function a(u){if(typeof u=="string"){const d=u,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:i.resourcePath+d;return o(f)}else return u.data?{data:Lc(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new B1(t);s=new Lf(u),s.setCrossOrigin(this.crossOrigin);for(let d=0,f=e.length;d<f;d++){const h=e[d],p=h.url;if(Array.isArray(p)){const g=[];for(let y=0,w=p.length;y<w;y++){const x=p[y],v=a(x);v!==null&&(v instanceof HTMLImageElement?g.push(v):g.push(new ia(v.data,v.width,v.height)))}r[h.uuid]=new Za(g)}else{const g=a(h.url);r[h.uuid]=new Za(g)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(u)}else return o.data?{data:Lc(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Lf(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const u=e[o],d=u.url;if(Array.isArray(d)){const f=[];for(let h=0,p=d.length;h<p;h++){const g=d[h],y=await s(g);y!==null&&(y instanceof HTMLImageElement?f.push(y):f.push(new ia(y.data,y.width,y.height)))}i[u.uuid]=new Za(f)}else{const f=await s(u.url);i[u.uuid]=new Za(f)}}}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 u=t[a.image],d=u.data;let f;Array.isArray(d)?(f=new Xf,d.length===6&&(f.needsUpdate=!0)):(d&&d.data?f=new ia:f=new hn,d&&(f.needsUpdate=!0)),f.source=u,f.uuid=a.uuid,a.name!==void 0&&(f.name=a.name),a.mapping!==void 0&&(f.mapping=i(a.mapping,dH)),a.channel!==void 0&&(f.channel=a.channel),a.offset!==void 0&&f.offset.fromArray(a.offset),a.repeat!==void 0&&f.repeat.fromArray(a.repeat),a.center!==void 0&&f.center.fromArray(a.center),a.rotation!==void 0&&(f.rotation=a.rotation),a.wrap!==void 0&&(f.wrapS=i(a.wrap[0],TT),f.wrapT=i(a.wrap[1],TT)),a.format!==void 0&&(f.format=a.format),a.internalFormat!==void 0&&(f.internalFormat=a.internalFormat),a.type!==void 0&&(f.type=a.type),a.colorSpace!==void 0&&(f.colorSpace=a.colorSpace),a.minFilter!==void 0&&(f.minFilter=i(a.minFilter,CT)),a.magFilter!==void 0&&(f.magFilter=i(a.magFilter,CT)),a.anisotropy!==void 0&&(f.anisotropy=a.anisotropy),a.flipY!==void 0&&(f.flipY=a.flipY),a.generateMipmaps!==void 0&&(f.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(f.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(f.compareFunction=a.compareFunction),a.userData!==void 0&&(f.userData=a.userData),r[a.uuid]=f}return r}parseObject(e,t,i,r,s){let o;function a(p){return t[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),t[p]}function u(p){if(p!==void 0){if(Array.isArray(p)){const g=[];for(let y=0,w=p.length;y<w;y++){const x=p[y];i[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),g.push(i[x])}return g}return i[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),i[p]}}function d(p){return r[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),r[p]}let f,h;switch(e.type){case"Scene":o=new Ef,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Xe(e.background):o.background=d(e.background)),e.environment!==void 0&&(o.environment=d(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new z0(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new k0(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new sn(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 na(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 RI(e.color,e.intensity);break;case"DirectionalLight":o=new CI(e.color,e.intensity);break;case"PointLight":o=new TI(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new PI(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new AI(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new bI(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new LI().fromJSON(e);break;case"SkinnedMesh":f=a(e.geometry),h=u(e.material),o=new $2(f,h),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":f=a(e.geometry),h=u(e.material),o=new Mn(f,h);break;case"InstancedMesh":f=a(e.geometry),h=u(e.material);const p=e.count,g=e.instanceMatrix,y=e.instanceColor;o=new Z2(f,h,p),o.instanceMatrix=new su(new Float32Array(g.array),16),y!==void 0&&(o.instanceColor=new su(new Float32Array(y.array),y.itemSize));break;case"BatchedMesh":f=a(e.geometry),h=u(e.material),o=new J2(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=f,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(w=>{const x=new ei;x.min.fromArray(w.boxMin),x.max.fromArray(w.boxMax);const v=new vi;return v.radius=w.sphereRadius,v.center.fromArray(w.sphereCenter),{boxInitialized:w.boxInitialized,box:x,sphereInitialized:w.sphereInitialized,sphere:v}}),o._maxGeometryCount=e.maxGeometryCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=d(e.matricesTexture.uuid);break;case"LOD":o=new Y2;break;case"Line":o=new aa(a(e.geometry),u(e.material));break;case"LineLoop":o=new K2(a(e.geometry),u(e.material));break;case"LineSegments":o=new Os(a(e.geometry),u(e.material));break;case"PointCloud":case"Points":o=new Q2(a(e.geometry),u(e.material));break;case"Sprite":o=new q2(u(e.material));break;case"Group":o=new Dc;break;case"Bone":o=new C1;break;default:o=new Bt}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 p=e.children;for(let g=0;g<p.length;g++)o.add(this.parseObject(p[g],t,i,r,s))}if(e.animations!==void 0){const p=e.animations;for(let g=0;g<p.length;g++){const y=p[g];o.animations.push(s[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const p=e.levels;for(let g=0;g<p.length;g++){const y=p[g],w=o.getObjectByProperty("uuid",y.object);w!==void 0&&o.addLevel(w,y.distance,y.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 dH={UVMapping:N0,CubeReflectionMapping:fo,CubeRefractionMapping:oa,EquirectangularReflectionMapping:df,EquirectangularRefractionMapping:ff,CubeUVReflectionMapping:uu},TT={RepeatWrapping:hf,ClampToEdgeWrapping:Pr,MirroredRepeatWrapping:pf},CT={NearestFilter:Yn,NearestMipmapNearestFilter:l1,NearestMipmapLinearFilter:Ic,LinearFilter:In,LinearMipmapNearestFilter:Fd,LinearMipmapLinearFilter:As};class fH extends _i{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=io.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(d=>{t&&t(d),s.manager.itemEnd(e)}).catch(d=>{r&&r(d)});return}return 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;const u=fetch(e,a).then(function(d){return d.blob()}).then(function(d){return createImageBitmap(d,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(d){return io.add(e,d),t&&t(d),s.manager.itemEnd(e),d}).catch(function(d){r&&r(d),io.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});io.add(e,u),s.manager.itemStart(e)}}let am;class H1{static getContext(){return am===void 0&&(am=new(window.AudioContext||window.webkitAudioContext)),am}static setContext(e){am=e}}class hH extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new ls(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){try{const d=u.slice(0);H1.getContext().decodeAudioData(d,function(h){t(h)}).catch(a)}catch(d){a(d)}},i,r);function a(u){r?r(u):console.error(u),s.manager.itemError(e)}}}const RT=new ht,PT=new ht,Ia=new ht;class pH{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new sn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new sn,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,Ia.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(sl*t.fov*.5)/t.zoom;let a,u;PT.elements[12]=-r,RT.elements[12]=r,a=-o*t.aspect+s,u=o*t.aspect+s,Ia.elements[0]=2*t.near/(u-a),Ia.elements[8]=(u+a)/(u-a),this.cameraL.projectionMatrix.copy(Ia),a=-o*t.aspect-s,u=o*t.aspect-s,Ia.elements[0]=2*t.near/(u-a),Ia.elements[8]=(u+a)/(u-a),this.cameraR.projectionMatrix.copy(Ia)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(PT),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(RT)}}class G1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=IT(),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=IT();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function IT(){return(typeof performance>"u"?Date:performance).now()}const La=new k,LT=new gi,mH=new k,Na=new k;class gH extends Bt{constructor(){super(),this.type="AudioListener",this.context=H1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new G1}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(La,LT,mH),Na.set(0,0,-1).applyQuaternion(LT),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(La.x,r),t.positionY.linearRampToValueAtTime(La.y,r),t.positionZ.linearRampToValueAtTime(La.z,r),t.forwardX.linearRampToValueAtTime(Na.x,r),t.forwardY.linearRampToValueAtTime(Na.y,r),t.forwardZ.linearRampToValueAtTime(Na.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(La.x,La.y,La.z),t.setOrientation(Na.x,Na.y,Na.z,i.x,i.y,i.z)}}class OI extends Bt{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._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){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 Da=new k,NT=new gi,vH=new k,Oa=new k;class yH extends OI{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),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(Da,NT,vH),Oa.set(0,0,1).applyQuaternion(NT);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Da.x,i),t.positionY.linearRampToValueAtTime(Da.y,i),t.positionZ.linearRampToValueAtTime(Da.z,i),t.orientationX.linearRampToValueAtTime(Oa.x,i),t.orientationY.linearRampToValueAtTime(Oa.y,i),t.orientationZ.linearRampToValueAtTime(Oa.z,i)}else t.setPosition(Da.x,Da.y,Da.z),t.setOrientation(Oa.x,Oa.y,Oa.z)}}class _H{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 UI{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 u=t*this._origIndex;this._mixBufferRegion(i,r,u,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let u=t,d=t+t;u!==d;++u)if(i[u]!==i[u+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){gi.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;gi.multiplyQuaternionsFlat(e,o,e,t,e,i),gi.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 u=t+a;e[u]=e[u]*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 W1="\\[\\]\\.:\\/",xH=new RegExp("["+W1+"]","g"),j1="[^"+W1+"]",SH="[^"+W1.replace("\\.","")+"]",wH=/((?:WC+[\/:])*)/.source.replace("WC",j1),MH=/(WCOD+)?/.source.replace("WCOD",SH),EH=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",j1),bH=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",j1),AH=new RegExp("^"+wH+MH+EH+bH+"$"),TH=["material","materials","bones","map"];class CH{constructor(e,t,i){const r=i||Dt.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 Dt{constructor(e,t,i){this.path=t,this.parsedPath=i||Dt.parseTrackName(t),this.node=Dt.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 Dt.Composite(e,t,i):new Dt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(xH,"")}static parseTrackName(e){const t=AH.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);TH.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 u=i(a.children);if(u)return u}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=Dt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let d=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 f=0;f<e.length;f++)if(e[f].name===d){d=f;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(d!==void 0){if(e[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[d]}}const o=e[r];if(o===void 0){const d=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+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 u=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])}u=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(u=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Dt.Composite=CH;Dt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Dt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Dt.prototype.GetterByBindingType=[Dt.prototype._getValue_direct,Dt.prototype._getValue_array,Dt.prototype._getValue_arrayElement,Dt.prototype._getValue_toArray];Dt.prototype.SetterByBindingTypeAndVersioning=[[Dt.prototype._setValue_direct,Dt.prototype._setValue_direct_setNeedsUpdate,Dt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Dt.prototype._setValue_array,Dt.prototype._setValue_array_setNeedsUpdate,Dt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Dt.prototype._setValue_arrayElement,Dt.prototype._setValue_arrayElement_setNeedsUpdate,Dt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Dt.prototype._setValue_fromArray,Dt.prototype._setValue_fromArray_setNeedsUpdate,Dt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class RH{constructor(){this.isAnimationObjectGroup=!0,this.uuid=cr(),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,u=e.length,d=this.nCachedObjects_;for(let f=0,h=arguments.length;f!==h;++f){const p=arguments[f],g=p.uuid;let y=t[g];if(y===void 0){y=u++,t[g]=y,e.push(p);for(let w=0,x=o;w!==x;++w)s[w].push(new Dt(p,i[w],r[w]))}else if(y<d){a=e[y];const w=--d,x=e[w];t[x.uuid]=y,e[y]=x,t[g]=w,e[w]=p;for(let v=0,_=o;v!==_;++v){const M=s[v],b=M[w];let N=M[y];M[y]=b,N===void 0&&(N=new Dt(p,i[v],r[v])),M[w]=N}}else e[y]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=d}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 u=arguments[o],d=u.uuid,f=t[d];if(f!==void 0&&f>=s){const h=s++,p=e[h];t[p.uuid]=f,e[f]=p,t[d]=h,e[h]=u;for(let g=0,y=r;g!==y;++g){const w=i[g],x=w[h],v=w[f];w[f]=x,w[h]=v}}}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,u=arguments.length;a!==u;++a){const d=arguments[a],f=d.uuid,h=t[f];if(h!==void 0)if(delete t[f],h<s){const p=--s,g=e[p],y=--o,w=e[y];t[g.uuid]=h,e[h]=g,t[w.uuid]=p,e[p]=w,e.pop();for(let x=0,v=r;x!==v;++x){const _=i[x],M=_[p],b=_[y];_[h]=M,_[p]=b,_.pop()}}else{const p=--o,g=e[p];p>0&&(t[g.uuid]=h),e[h]=g,e.pop();for(let y=0,w=r;y!==w;++y){const x=i[y];x[h]=x[p],x.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,u=this._objects,d=u.length,f=this.nCachedObjects_,h=new Array(d);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let p=f,g=u.length;p!==g;++p){const y=u[p];h[p]=new Dt(y,e,t)}return h}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,u=o[a],d=e[a];t[d]=i,o[i]=u,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class FI{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),u={endingStart:Ya,endingEnd:Ya};for(let d=0;d!==o;++d){const f=s[d].createInterpolant(null);a[d]=f,f.settings=u}this._interpolantSettings=u,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=m2,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 u=a.parameterPositions,d=a.sampleValues;return u[0]=s,u[1]=s+i,d[0]=e/o,d[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 u=(e-s)*i;u<0||i===0?t=0:(this._startTime=null,t=i*u)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const u=this._interpolants,d=this._propertyBindings;switch(this.blendMode){case v1:for(let f=0,h=u.length;f!==h;++f)u[f].evaluate(o),d[f].accumulateAdditive(a);break;case D0:default:for(let f=0,h=u.length;f!==h;++f)u[f].evaluate(o),d[f].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===g2;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===p2){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 u=this.repetitions-s;if(u<=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(u===1){const d=e<0;this._setEndings(d,!d,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=$a,r.endingEnd=$a):(e?r.endingStart=this.zeroSlopeAtStart?$a:Ya:r.endingStart=vf,t?r.endingEnd=this.zeroSlopeAtEnd?$a:Ya:r.endingEnd=vf)}_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,u=o.sampleValues;return a[0]=s,u[0]=t,a[1]=s+e,u[1]=i,this}}const PH=new Float32Array(1);class IH extends Ds{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,u=i.uuid,d=this._bindingsByRootAndName;let f=d[u];f===void 0&&(f={},d[u]=f);for(let h=0;h!==s;++h){const p=r[h],g=p.name;let y=f[g];if(y!==void 0)++y.referenceCount,o[h]=y;else{if(y=o[h],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,u,g));continue}const w=t&&t._propertyBindings[h].binding.parsedPath;y=new UI(Dt.create(i,g,w),p.ValueTypeName,p.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,u,g),o[h]=y}a[h].resultBuffer=y.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],u=a.knownActions,d=u[u.length-1],f=e._byClipCacheIndex;d._byClipCacheIndex=f,u[f]=d,u.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,p=(e._localRoot||this._root).uuid;delete h[p],u.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],u=t[t.length-1],d=e._cacheIndex;u._cacheIndex=d,t[d]=u,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 k1(new Float32Array(2),new Float32Array(2),1,PH),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"?If.findByName(r,e):e;const a=o!==null?o.uuid:e,u=this._actionsByClip[a];let d=null;if(i===void 0&&(o!==null?i=o.blendMode:i=D0),u!==void 0){const h=u.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;d=u.knownActions[0],o===null&&(o=d._clip)}if(o===null)return null;const f=new FI(this,o,t,i);return this._bindAction(f,d),this._addInactiveAction(f,a,s),f}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?If.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 d=0;d!==i;++d)t[d]._update(r,e,s,o);const a=this._bindings,u=this._nActiveBindings;for(let d=0;d!==u;++d)a[d].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,u=o.length;a!==u;++a){const d=o[a];this._deactivateAction(d);const f=d._cacheIndex,h=t[t.length-1];d._cacheIndex=null,d._byClipCacheIndex=null,h._cacheIndex=f,t[f]=h,t.pop(),this._removeInactiveBindingsForAction(d)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,u=a[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}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 X1{constructor(e){this.value=e}clone(){return new X1(this.value.clone===void 0?this.value:this.value.clone())}}let LH=0;class NH extends Ds{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:LH++}),this.name="",this.usage=Sf,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++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class DH extends B0{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 OH{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}}const DT=new ht;class kI{constructor(e,t,i=0,r=1/0){this.ray=new fu(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new ol,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)}setFromXRController(e){return DT.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(DT),this}intersectObject(e,t=!0,i=[]){return VS(e,this,i,t),i.sort(OT),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)VS(e[r],this,i,t);return i.sort(OT),i}}function OT(n,e){return n.distance-e.distance}function VS(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++)VS(r[s],e,t,!0)}}class HS{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(yn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class UH{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 UT=new Ee;class FH{constructor(e=new Ee(1/0,1/0),t=new Ee(-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=UT.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,UT).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 FT=new k,lm=new k;class kH{constructor(e=new k,t=new k){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){FT.subVectors(e,this.start),lm.subVectors(this.end,this.start);const i=lm.dot(lm);let s=lm.dot(FT)/i;return t&&(s=yn(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 kT=new k;class zH extends Bt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new mt,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,u=32;o<u;o++,a++){const d=o/u*Math.PI*2,f=a/u*Math.PI*2;r.push(Math.cos(d),Math.sin(d),1,Math.cos(f),Math.sin(f),1)}i.setAttribute("position",new Ze(r,3));const s=new Ni({fog:!1,toneMapped:!1});this.cone=new Os(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),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),kT.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(kT),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Oo=new k,cm=new ht,I_=new ht;class BH extends Os{constructor(e){const t=zI(e),i=new mt,r=[],s=[],o=new Xe(0,0,1),a=new Xe(0,1,0);for(let d=0;d<t.length;d++){const f=t[d];f.parent&&f.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 Ze(r,3)),i.setAttribute("color",new Ze(s,3));const u=new Ni({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,u),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");I_.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(cm.multiplyMatrices(I_,a.matrixWorld),Oo.setFromMatrixPosition(cm),r.setXYZ(o,Oo.x,Oo.y,Oo.z),cm.multiplyMatrices(I_,a.parent.matrixWorld),Oo.setFromMatrixPosition(cm),r.setXYZ(o+1,Oo.x,Oo.y,Oo.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function zI(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,zI(n.children[t]));return e}class VH extends Mn{constructor(e,t,i){const r=new Zf(t,4,2),s=new mo({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 HH=new k,zT=new Xe,BT=new Xe;class GH extends Bt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new $f(t);r.rotateY(Math.PI*.5),this.material=new mo({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 Lt(o,3)),this.add(new Mn(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");zT.copy(this.light.color),BT.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?zT:BT;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(HH.setFromMatrixPosition(this.light.matrixWorld).negate())}}class WH extends Os{constructor(e=10,t=10,i=4473924,r=8947848){i=new Xe(i),r=new Xe(r);const s=t/2,o=e/t,a=e/2,u=[],d=[];for(let p=0,g=0,y=-a;p<=t;p++,y+=o){u.push(-a,0,y,a,0,y),u.push(y,0,-a,y,0,a);const w=p===s?i:r;w.toArray(d,g),g+=3,w.toArray(d,g),g+=3,w.toArray(d,g),g+=3,w.toArray(d,g),g+=3}const f=new mt;f.setAttribute("position",new Ze(u,3)),f.setAttribute("color",new Ze(d,3));const h=new Ni({vertexColors:!0,toneMapped:!1});super(f,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class jH extends Os{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new Xe(s),o=new Xe(o);const a=[],u=[];if(t>1)for(let h=0;h<t;h++){const p=h/t*(Math.PI*2),g=Math.sin(p)*e,y=Math.cos(p)*e;a.push(0,0,0),a.push(g,0,y);const w=h&1?s:o;u.push(w.r,w.g,w.b),u.push(w.r,w.g,w.b)}for(let h=0;h<i;h++){const p=h&1?s:o,g=e-e/i*h;for(let y=0;y<r;y++){let w=y/r*(Math.PI*2),x=Math.sin(w)*g,v=Math.cos(w)*g;a.push(x,0,v),u.push(p.r,p.g,p.b),w=(y+1)/r*(Math.PI*2),x=Math.sin(w)*g,v=Math.cos(w)*g,a.push(x,0,v),u.push(p.r,p.g,p.b)}}const d=new mt;d.setAttribute("position",new Ze(a,3)),d.setAttribute("color",new Ze(u,3));const f=new Ni({vertexColors:!0,toneMapped:!1});super(d,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const VT=new k,um=new k,HT=new k;class XH extends Bt{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 mt;r.setAttribute("position",new Ze([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Ni({fog:!1,toneMapped:!1});this.lightPlane=new aa(r,s),this.add(this.lightPlane),r=new mt,r.setAttribute("position",new Ze([0,0,0,0,0,1],3)),this.targetLine=new aa(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),VT.setFromMatrixPosition(this.light.matrixWorld),um.setFromMatrixPosition(this.light.target.matrixWorld),HT.subVectors(um,VT),this.lightPlane.lookAt(um),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(um),this.targetLine.scale.z=HT.length()}}const dm=new k,gn=new jf;class qH extends Os{constructor(e){const t=new mt,i=new Ni({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(y,w){u(y),u(w)}function u(y){r.push(0,0,0),s.push(0,0,0),o[y]===void 0&&(o[y]=[]),o[y].push(r.length/3-1)}t.setAttribute("position",new Ze(r,3)),t.setAttribute("color",new Ze(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 d=new Xe(16755200),f=new Xe(16711680),h=new Xe(43775),p=new Xe(16777215),g=new Xe(3355443);this.setColors(d,f,h,p,g)}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;gn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xn("c",t,e,gn,0,0,-1),xn("t",t,e,gn,0,0,1),xn("n1",t,e,gn,-i,-r,-1),xn("n2",t,e,gn,i,-r,-1),xn("n3",t,e,gn,-i,r,-1),xn("n4",t,e,gn,i,r,-1),xn("f1",t,e,gn,-i,-r,1),xn("f2",t,e,gn,i,-r,1),xn("f3",t,e,gn,-i,r,1),xn("f4",t,e,gn,i,r,1),xn("u1",t,e,gn,i*.7,r*1.1,-1),xn("u2",t,e,gn,-i*.7,r*1.1,-1),xn("u3",t,e,gn,0,r*2,-1),xn("cf1",t,e,gn,-i,0,1),xn("cf2",t,e,gn,i,0,1),xn("cf3",t,e,gn,0,-r,1),xn("cf4",t,e,gn,0,r,1),xn("cn1",t,e,gn,-i,0,-1),xn("cn2",t,e,gn,i,0,-1),xn("cn3",t,e,gn,0,-r,-1),xn("cn4",t,e,gn,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function xn(n,e,t,i,r,s,o){dm.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const u=t.getAttribute("position");for(let d=0,f=a.length;d<f;d++)u.setXYZ(a[d],dm.x,dm.y,dm.z)}}const fm=new ei;class YH extends Os{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 mt;s.setIndex(new Lt(i,1)),s.setAttribute("position",new Lt(r,3)),super(s,new Ni({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&&fm.setFromObject(this.object),fm.isEmpty())return;const t=fm.min,i=fm.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 $H extends Os{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 mt;s.setIndex(new Lt(i,1)),s.setAttribute("position",new Ze(r,3)),super(s,new Ni({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 ZH extends aa{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 mt;o.setAttribute("position",new Ze(s,3)),o.computeBoundingSphere(),super(o,new Ni({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],u=new mt;u.setAttribute("position",new Ze(a,3)),u.computeBoundingSphere(),this.add(new Mn(u,new mo({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 GT=new k;let hm,L_;class JH extends Bt{constructor(e=new k(0,0,1),t=new k(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",hm===void 0&&(hm=new mt,hm.setAttribute("position",new Ze([0,0,0,0,1,0],3)),L_=new mu(0,.5,1,5,1),L_.translate(0,-.5,0)),this.position.copy(t),this.line=new aa(hm,new Ni({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mn(L_,new mo({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{GT.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(GT,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 KH extends Os{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 mt;r.setAttribute("position",new Ze(t,3)),r.setAttribute("color",new Ze(i,3));const s=new Ni({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Xe,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 QH{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new bf,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(v){const _=[];for(let M=0,b=v.length;M<b;M++){const N=v[M],C=new al;C.curves=N.curves,_.push(C)}return _}function i(v,_){const M=_.length;let b=!1;for(let N=M-1,C=0;C<M;N=C++){let P=_[N],D=_[C],I=D.x-P.x,A=D.y-P.y;if(Math.abs(A)>Number.EPSILON){if(A<0&&(P=_[C],I=-I,D=_[N],A=-A),v.y<P.y||v.y>D.y)continue;if(v.y===P.y){if(v.x===P.x)return!0}else{const U=A*(v.x-P.x)-I*(v.y-P.y);if(U===0)return!0;if(U<0)continue;b=!b}}else{if(v.y!==P.y)continue;if(D.x<=v.x&&v.x<=P.x||P.x<=v.x&&v.x<=D.x)return!0}}return b}const r=Ls.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,u;const d=[];if(s.length===1)return a=s[0],u=new al,u.curves=a.curves,d.push(u),d;let f=!r(s[0].getPoints());f=e?!f:f;const h=[],p=[];let g=[],y=0,w;p[y]=void 0,g[y]=[];for(let v=0,_=s.length;v<_;v++)a=s[v],w=a.getPoints(),o=r(w),o=e?!o:o,o?(!f&&p[y]&&y++,p[y]={s:new al,p:w},p[y].s.curves=a.curves,f&&y++,g[y]=[]):g[y].push({h:a,p:w[0]});if(!p[0])return t(s);if(p.length>1){let v=!1,_=0;for(let M=0,b=p.length;M<b;M++)h[M]=[];for(let M=0,b=p.length;M<b;M++){const N=g[M];for(let C=0;C<N.length;C++){const P=N[C];let D=!0;for(let I=0;I<p.length;I++)i(P.p,p[I].p)&&(M!==I&&_++,D?(D=!1,h[I].push(P)):v=!0);D&&h[M].push(P)}}_>0&&v===!1&&(g=h)}let x;for(let v=0,_=p.length;v<_;v++){u=p[v].s,d.push(u),x=g[v];for(let M=0,b=x.length;M<b;M++)u.holes.push(x[M].h)}return d}}class e8 extends os{constructor(e=1,t=1,i=1,r={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:I0}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=I0);const t8=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:a1,AddEquation:Go,AddOperation:J3,AdditiveAnimationBlendMode:v1,AdditiveBlending:iS,AgXToneMapping:n2,AlphaFormat:l2,AlwaysCompare:A2,AlwaysDepth:W3,AlwaysStencilFunc:NS,AmbientLight:RI,AnimationAction:FI,AnimationClip:If,AnimationLoader:nH,AnimationMixer:IH,AnimationObjectGroup:RH,AnimationUtils:KV,ArcCurve:eI,ArrayCamera:W2,ArrowHelper:JH,AttachedBindMode:oS,Audio:OI,AudioAnalyser:_H,AudioContext:H1,AudioListener:gH,AudioLoader:hH,AxesHelper:KH,BackSide:Pi,BasicDepthPacking:v2,BasicShadowMap:E3,BatchedMesh:J2,Bone:C1,BooleanKeyframeTrack:wl,Box2:FH,Box3:ei,Box3Helper:$H,BoxGeometry:Sl,BoxHelper:YH,BufferAttribute:Lt,BufferGeometry:mt,BufferGeometryLoader:DI,ByteType:s2,Cache:io,Camera:jf,CameraHelper:qH,CanvasTexture:wV,CapsuleGeometry:W0,CatmullRomCurve3:tI,CineonToneMapping:e2,CircleGeometry:j0,ClampToEdgeWrapping:Pr,Clock:G1,Color:Xe,ColorKeyframeTrack:z1,ColorManagement:Gt,CompressedArrayTexture:xV,CompressedCubeTexture:SV,CompressedTexture:H0,CompressedTextureLoader:iH,ConeGeometry:X0,ConstantAlphaFactor:V3,ConstantColorFactor:z3,CubeCamera:O2,CubeReflectionMapping:fo,CubeRefractionMapping:oa,CubeTexture:Xf,CubeTextureLoader:rH,CubeUVReflectionMapping:uu,CubicBezierCurve:I1,CubicBezierCurve3:nI,CubicInterpolant:SI,CullFaceBack:nS,CullFaceFront:M3,CullFaceFrontBack:cF,CullFaceNone:w3,Curve:us,CurvePath:rI,CustomBlending:b3,CustomToneMapping:t2,CylinderGeometry:mu,Cylindrical:UH,Data3DTexture:x1,DataArrayTexture:U0,DataTexture:ia,DataTextureLoader:sH,DataUtils:yk,DecrementStencilOp:xF,DecrementWrapStencilOp:wF,DefaultLoadingManager:EI,DepthFormat:rl,DepthStencilFormat:nu,DepthTexture:E1,DetachedBindMode:r2,DirectionalLight:CI,DirectionalLightHelper:XH,DiscreteInterpolant:wI,DisplayP3ColorSpace:O0,DodecahedronGeometry:q0,DoubleSide:Qr,DstAlphaFactor:D3,DstColorFactor:U3,DynamicCopyUsage:FF,DynamicDrawUsage:IF,DynamicReadUsage:DF,EdgesGeometry:sI,EllipseCurve:G0,EqualCompare:w2,EqualDepth:X3,EqualStencilFunc:AF,EquirectangularReflectionMapping:df,EquirectangularRefractionMapping:ff,Euler:fr,EventDispatcher:Ds,ExtrudeGeometry:$0,FileLoader:ls,Float16BufferAttribute:Ek,Float32BufferAttribute:Ze,FloatType:Ir,Fog:z0,FogExp2:k0,FramebufferTexture:_V,FrontSide:uo,Frustum:qf,GLBufferAttribute:OH,GLSL1:zF,GLSL3:DS,GreaterCompare:M2,GreaterDepth:Y3,GreaterEqualCompare:b2,GreaterEqualDepth:q3,GreaterEqualStencilFunc:PF,GreaterStencilFunc:CF,GridHelper:WH,Group:Dc,HalfFloatType:Gf,HemisphereLight:bI,HemisphereLightHelper:GH,IcosahedronGeometry:Z0,ImageBitmapLoader:fH,ImageLoader:Lf,ImageUtils:P2,IncrementStencilOp:_F,IncrementWrapStencilOp:SF,InstancedBufferAttribute:su,InstancedBufferGeometry:NI,InstancedInterleavedBuffer:DH,InstancedMesh:Z2,Int16BufferAttribute:wk,Int32BufferAttribute:Mk,Int8BufferAttribute:_k,IntType:u1,InterleavedBuffer:B0,InterleavedBufferAttribute:gl,Interpolant:Jf,InterpolateDiscrete:mf,InterpolateLinear:gf,InterpolateSmooth:Ym,InvertStencilOp:MF,KeepStencilOp:Ba,KeyframeTrack:ds,LOD:Y2,LatheGeometry:Yf,Layers:ol,LessCompare:S2,LessDepth:j3,LessEqualCompare:y1,LessEqualDepth:uf,LessEqualStencilFunc:TF,LessStencilFunc:bF,Light:ha,LightProbe:LI,Line:aa,Line3:kH,LineBasicMaterial:Ni,LineCurve:L1,LineCurve3:iI,LineDashedMaterial:yI,LineLoop:K2,LineSegments:Os,LinearDisplayP3ColorSpace:Wf,LinearFilter:In,LinearInterpolant:k1,LinearMipMapLinearFilter:hF,LinearMipMapNearestFilter:fF,LinearMipmapLinearFilter:As,LinearMipmapNearestFilter:Fd,LinearSRGBColorSpace:po,LinearToneMapping:K3,LinearTransfer:yf,Loader:_i,LoaderUtils:n0,LoadingManager:B1,LoopOnce:p2,LoopPingPong:g2,LoopRepeat:m2,LuminanceAlphaFormat:d2,LuminanceFormat:u2,MOUSE:ka,Material:ii,MaterialLoader:iv,MathUtils:nk,Matrix3:Mt,Matrix4:ht,MaxEquation:R3,Mesh:Mn,MeshBasicMaterial:mo,MeshDepthMaterial:b1,MeshDistanceMaterial:A1,MeshLambertMaterial:gI,MeshMatcapMaterial:vI,MeshNormalMaterial:mI,MeshPhongMaterial:hI,MeshPhysicalMaterial:fI,MeshStandardMaterial:U1,MeshToonMaterial:pI,MinEquation:C3,MirroredRepeatWrapping:pf,MixOperation:Z3,MultiplyBlending:sS,MultiplyOperation:Hf,NearestFilter:Yn,NearestMipMapLinearFilter:dF,NearestMipMapNearestFilter:uF,NearestMipmapLinearFilter:Ic,NearestMipmapNearestFilter:l1,NeutralToneMapping:i2,NeverCompare:x2,NeverDepth:G3,NeverStencilFunc:EF,NoBlending:so,NoColorSpace:Qs,NoToneMapping:Is,NormalAnimationBlendMode:D0,NormalBlending:il,NotEqualCompare:E2,NotEqualDepth:$3,NotEqualStencilFunc:RF,NumberKeyframeTrack:Rf,Object3D:Bt,ObjectLoader:uH,ObjectSpaceNormalMap:_2,OctahedronGeometry:$f,OneFactor:I3,OneMinusConstantAlphaFactor:H3,OneMinusConstantColorFactor:B3,OneMinusDstAlphaFactor:O3,OneMinusDstColorFactor:F3,OneMinusSrcAlphaFactor:Kg,OneMinusSrcColorFactor:N3,OrthographicCamera:na,P3Primaries:xf,PCFShadowMap:L0,PCFSoftShadowMap:qc,PMREMGenerator:OS,Path:bf,PerspectiveCamera:sn,Plane:Bo,PlaneGeometry:hu,PlaneHelper:ZH,PointLight:TI,PointLightHelper:VH,Points:Q2,PointsMaterial:R1,PolarGridHelper:jH,PolyhedronGeometry:fa,PositionalAudio:yH,PropertyBinding:Dt,PropertyMixer:UI,QuadraticBezierCurve:N1,QuadraticBezierCurve3:D1,Quaternion:gi,QuaternionKeyframeTrack:gu,QuaternionLinearInterpolant:MI,RED_GREEN_RGTC2_Format:IS,RED_RGTC1_Format:h2,REVISION:I0,RGBADepthPacking:y2,RGBAFormat:Bi,RGBAIntegerFormat:g1,RGBA_ASTC_10x10_Format:bS,RGBA_ASTC_10x5_Format:wS,RGBA_ASTC_10x6_Format:MS,RGBA_ASTC_10x8_Format:ES,RGBA_ASTC_12x10_Format:AS,RGBA_ASTC_12x12_Format:TS,RGBA_ASTC_4x4_Format:pS,RGBA_ASTC_5x4_Format:mS,RGBA_ASTC_5x5_Format:gS,RGBA_ASTC_6x5_Format:vS,RGBA_ASTC_6x6_Format:yS,RGBA_ASTC_8x5_Format:_S,RGBA_ASTC_8x6_Format:xS,RGBA_ASTC_8x8_Format:SS,RGBA_BPTC_Format:qm,RGBA_ETC2_EAC_Format:hS,RGBA_PVRTC_2BPPV1_Format:uS,RGBA_PVRTC_4BPPV1_Format:cS,RGBA_S3TC_DXT1_Format:Wm,RGBA_S3TC_DXT3_Format:jm,RGBA_S3TC_DXT5_Format:Xm,RGBFormat:c2,RGB_BPTC_SIGNED_Format:CS,RGB_BPTC_UNSIGNED_Format:RS,RGB_ETC1_Format:dS,RGB_ETC2_Format:fS,RGB_PVRTC_2BPPV1_Format:lS,RGB_PVRTC_4BPPV1_Format:aS,RGB_S3TC_DXT1_Format:Gm,RGFormat:f2,RGIntegerFormat:m1,RawShaderMaterial:dI,Ray:fu,Raycaster:kI,Rec709Primaries:_f,RectAreaLight:PI,RedFormat:h1,RedIntegerFormat:p1,ReinhardToneMapping:Q3,RenderTarget:I2,RepeatWrapping:hf,ReplaceStencilOp:yF,ReverseSubtractEquation:T3,RingGeometry:J0,SIGNED_RED_GREEN_RGTC2_Format:LS,SIGNED_RED_RGTC1_Format:PS,SRGBColorSpace:br,SRGBTransfer:Yt,Scene:Ef,ShaderChunk:At,ShaderLib:Kr,ShaderMaterial:as,ShadowMaterial:uI,Shape:al,ShapeGeometry:K0,ShapePath:QH,ShapeUtils:Ls,ShortType:o2,Skeleton:V0,SkeletonHelper:BH,SkinnedMesh:$2,Source:Za,Sphere:vi,SphereGeometry:Zf,Spherical:HS,SphericalHarmonics3:II,SplineCurve:O1,SpotLight:AI,SpotLightHelper:zH,Sprite:q2,SpriteMaterial:T1,SrcAlphaFactor:Jg,SrcAlphaSaturateFactor:k3,SrcColorFactor:L3,StaticCopyUsage:UF,StaticDrawUsage:Sf,StaticReadUsage:NF,StereoCamera:pH,StreamCopyUsage:kF,StreamDrawUsage:LF,StreamReadUsage:OF,StringKeyframeTrack:Ml,SubtractEquation:A3,SubtractiveBlending:rS,TOUCH:za,TangentSpaceNormalMap:da,TetrahedronGeometry:Q0,Texture:hn,TextureLoader:oH,TorusGeometry:ev,TorusKnotGeometry:tv,Triangle:sr,TriangleFanDrawMode:gF,TriangleStripDrawMode:mF,TrianglesDrawMode:pF,TubeGeometry:nv,UVMapping:N0,Uint16BufferAttribute:S1,Uint32BufferAttribute:w1,Uint8BufferAttribute:xk,Uint8ClampedBufferAttribute:Sk,Uniform:X1,UniformsGroup:NH,UniformsLib:Ve,UniformsUtils:D2,UnsignedByteType:Ns,UnsignedInt248Type:du,UnsignedInt5999Type:a2,UnsignedIntType:ml,UnsignedShort4444Type:d1,UnsignedShort5551Type:f1,UnsignedShortType:c1,VSMShadowMap:$r,Vector2:Ee,Vector3:k,Vector4:Wt,VectorKeyframeTrack:Pf,VideoTexture:yV,WebGL3DRenderTarget:lk,WebGLArrayRenderTarget:ak,WebGLCoordinateSystem:Ts,WebGLCubeRenderTarget:U2,WebGLMultipleRenderTargets:e8,WebGLRenderTarget:os,WebGLRenderer:j2,WebGLUtils:G2,WebGPUCoordinateSystem:wf,WireframeGeometry:cI,WrapAroundEnding:vf,ZeroCurvatureEnding:Ya,ZeroFactor:P3,ZeroSlopeEnding:$a,ZeroStencilOp:vF,createCanvasElement:C2},Symbol.toStringTag,{value:"Module"}));var GS=function(n,e){return GS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])},GS(n,e)};function n8(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");GS(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Cr=function(){return Cr=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Cr.apply(this,arguments)};function Nf(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t}function i8(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ka={exports:{}},Uo={};/**
 * @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.
 */var WT;function r8(){return WT||(WT=1,Uo.ConcurrentRoot=1,Uo.ContinuousEventPriority=4,Uo.DefaultEventPriority=16,Uo.DiscreteEventPriority=1,Uo.IdleEventPriority=536870912,Uo.LegacyRoot=0),Uo}(function(n){n.exports=r8()})(Ka);function s8(n){let e;const t=new Set,i=(d,f)=>{const h=typeof d=="function"?d(e):d;if(h!==e){const p=e;e=f?h:Object.assign({},e,h),t.forEach(g=>g(e,p))}},r=()=>e,s=(d,f=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=f(e);function g(){const y=f(e);if(!h(p,y)){const w=p;d(p=y,w)}}return t.add(g),()=>t.delete(g)},u={setState:i,getState:r,subscribe:(d,f,h)=>f||h?s(d,f,h):(t.add(d),()=>t.delete(d)),destroy:()=>t.clear()};return e=n(i,r,u),u}const o8=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),jT=o8?we.useEffect:we.useLayoutEffect;function a8(n){const e=typeof n=="function"?s8(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=we.useReducer(x=>x+1,0),o=e.getState(),a=we.useRef(o),u=we.useRef(i),d=we.useRef(r),f=we.useRef(!1),h=we.useRef();h.current===void 0&&(h.current=i(o));let p,g=!1;(a.current!==o||u.current!==i||d.current!==r||f.current)&&(p=i(o),g=!r(h.current,p)),jT(()=>{g&&(h.current=p),a.current=o,u.current=i,d.current=r,f.current=!1});const y=we.useRef(o);jT(()=>{const x=()=>{try{const _=e.getState(),M=u.current(_);d.current(h.current,M)||(a.current=_,h.current=M,s())}catch{f.current=!0,s()}},v=e.subscribe(x);return e.getState()!==y.current&&x(),v},[]);const w=g?p:h.current;return we.useDebugValue(w),w};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 BI={exports:{}},i0={exports:{}},N_={};/**
 * @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 XT;function l8(){return XT||(XT=1,function(n){function e(O,Y){var K=O.length;O.push(Y);e:for(;0<K;){var ae=K-1>>>1,ge=O[ae];if(0<r(ge,Y))O[ae]=Y,O[K]=ge,K=ae;else break e}}function t(O){return O.length===0?null:O[0]}function i(O){if(O.length===0)return null;var Y=O[0],K=O.pop();if(K!==Y){O[0]=K;e:for(var ae=0,ge=O.length,Ue=ge>>>1;ae<Ue;){var se=2*(ae+1)-1,xe=O[se],Ae=se+1,Ce=O[Ae];if(0>r(xe,K))Ae<ge&&0>r(Ce,xe)?(O[ae]=Ce,O[Ae]=K,ae=Ae):(O[ae]=xe,O[se]=K,ae=se);else if(Ae<ge&&0>r(Ce,K))O[ae]=Ce,O[Ae]=K,ae=Ae;else break e}}return Y}function r(O,Y){var K=O.sortIndex-Y.sortIndex;return K!==0?K:O.id-Y.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 u=[],d=[],f=1,h=null,p=3,g=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(O){for(var Y=t(d);Y!==null;){if(Y.callback===null)i(d);else if(Y.startTime<=O)i(d),Y.sortIndex=Y.expirationTime,e(u,Y);else break;Y=t(d)}}function b(O){if(w=!1,M(O),!y)if(t(u)!==null)y=!0,ne(N);else{var Y=t(d);Y!==null&&le(b,Y.startTime-O)}}function N(O,Y){y=!1,w&&(w=!1,v(D),D=-1),g=!0;var K=p;try{for(M(Y),h=t(u);h!==null&&(!(h.expirationTime>Y)||O&&!U());){var ae=h.callback;if(typeof ae=="function"){h.callback=null,p=h.priorityLevel;var ge=ae(h.expirationTime<=Y);Y=n.unstable_now(),typeof ge=="function"?h.callback=ge:h===t(u)&&i(u),M(Y)}else i(u);h=t(u)}if(h!==null)var Ue=!0;else{var se=t(d);se!==null&&le(b,se.startTime-Y),Ue=!1}return Ue}finally{h=null,p=K,g=!1}}var C=!1,P=null,D=-1,I=5,A=-1;function U(){return!(n.unstable_now()-A<I)}function G(){if(P!==null){var O=n.unstable_now();A=O;var Y=!0;try{Y=P(!0,O)}finally{Y?z():(C=!1,P=null)}}else C=!1}var z;if(typeof _=="function")z=function(){_(G)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,J=Z.port2;Z.port1.onmessage=G,z=function(){J.postMessage(null)}}else z=function(){x(G,0)};function ne(O){P=O,C||(C=!0,z())}function le(O,Y){D=x(function(){O(n.unstable_now())},Y)}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(O){O.callback=null},n.unstable_continueExecution=function(){y||g||(y=!0,ne(N))},n.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<O?Math.floor(1e3/O):5},n.unstable_getCurrentPriorityLevel=function(){return p},n.unstable_getFirstCallbackNode=function(){return t(u)},n.unstable_next=function(O){switch(p){case 1:case 2:case 3:var Y=3;break;default:Y=p}var K=p;p=Y;try{return O()}finally{p=K}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(O,Y){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var K=p;p=O;try{return Y()}finally{p=K}},n.unstable_scheduleCallback=function(O,Y,K){var ae=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ae+K:ae):K=ae,O){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=K+ge,O={id:f++,callback:Y,priorityLevel:O,startTime:K,expirationTime:ge,sortIndex:-1},K>ae?(O.sortIndex=K,e(d,O),t(u)===null&&O===t(d)&&(w?(v(D),D=-1):w=!0,le(b,K-ae))):(O.sortIndex=ge,e(u,O),y||g||(y=!0,ne(N))),O},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(O){var Y=p;return function(){var K=p;p=Y;try{return O.apply(this,arguments)}finally{p=K}}}}(N_)),N_}(function(n){n.exports=l8()})(i0);/**
 * @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 D_,qT;function c8(){return qT||(qT=1,D_=function(e){var t={},i=Me,r=i0.exports,s=Object.assign;function o(l){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+l,m=1;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+l+"; visit "+c+" 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,u=Symbol.for("react.element"),d=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),y=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),N=Symbol.iterator;function C(l){return l===null||typeof l!="object"?null:(l=N&&l[N]||l["@@iterator"],typeof l=="function"?l:null)}function P(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 f:return"Fragment";case d:return"Portal";case p:return"Profiler";case h:return"StrictMode";case x:return"Suspense";case v:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case y:return(l.displayName||"Context")+".Consumer";case g:return(l._context.displayName||"Context")+".Provider";case w:var c=l.render;return l=l.displayName,l||(l=c.displayName||c.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case _:return c=l.displayName||null,c!==null?c:P(l.type)||"Memo";case M:c=l._payload,l=l._init;try{return P(l(c))}catch{}}return null}function D(l){var c=l.type;switch(l.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=c.render,l=l.displayName||l.name||"",c.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return P(c);case 8:return c===h?"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 c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function I(l){var c=l,m=l;if(l.alternate)for(;c.return;)c=c.return;else{l=c;do c=l,c.flags&4098&&(m=c.return),l=c.return;while(l)}return c.tag===3?m:null}function A(l){if(I(l)!==l)throw Error(o(188))}function U(l){var c=l.alternate;if(!c){if(c=I(l),c===null)throw Error(o(188));return c!==l?null:l}for(var m=l,S=c;;){var E=m.return;if(E===null)break;var T=E.alternate;if(T===null){if(S=E.return,S!==null){m=S;continue}break}if(E.child===T.child){for(T=E.child;T;){if(T===m)return A(E),l;if(T===S)return A(E),c;T=T.sibling}throw Error(o(188))}if(m.return!==S.return)m=E,S=T;else{for(var H=!1,ee=E.child;ee;){if(ee===m){H=!0,m=E,S=T;break}if(ee===S){H=!0,S=E,m=T;break}ee=ee.sibling}if(!H){for(ee=T.child;ee;){if(ee===m){H=!0,m=T,S=E;break}if(ee===S){H=!0,S=T,m=E;break}ee=ee.sibling}if(!H)throw Error(o(189))}}if(m.alternate!==S)throw Error(o(190))}if(m.tag!==3)throw Error(o(188));return m.stateNode.current===m?l:c}function G(l){return l=U(l),l!==null?z(l):null}function z(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var c=z(l);if(c!==null)return c;l=l.sibling}return null}function Z(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){if(l.tag!==4){var c=Z(l);if(c!==null)return c}l=l.sibling}return null}var J=Array.isArray,ne=e.getPublicInstance,le=e.getRootHostContext,O=e.getChildHostContext,Y=e.prepareForCommit,K=e.resetAfterCommit,ae=e.createInstance,ge=e.appendInitialChild,Ue=e.finalizeInitialChildren,se=e.prepareUpdate,xe=e.shouldSetTextContent,Ae=e.createTextInstance,Ce=e.scheduleTimeout,tt=e.cancelTimeout,Qe=e.noTimeout,Q=e.isPrimaryRenderer,nt=e.supportsMutation,pe=e.supportsPersistence,be=e.supportsHydration,Se=e.getInstanceFromNode,Fe=e.preparePortalMount,Te=e.getCurrentEventPriority,He=e.detachDeletedInstance,V=e.supportsMicrotasks,L=e.scheduleMicrotask,R=e.supportsTestSelectors,X=e.findFiberRoot,q=e.getBoundingRect,$=e.getTextContent,ie=e.isHiddenSubtree,Ne=e.matchAccessibilityRole,Re=e.setFocusIfFocusable,Pe=e.setupIntersectionObserver,st=e.appendChild,De=e.appendChildToContainer,qe=e.commitTextUpdate,ct=e.commitMount,W=e.commitUpdate,oe=e.insertBefore,Ie=e.insertInContainerBefore,ze=e.removeChild,ot=e.removeChildFromContainer,Ke=e.resetTextContent,j=e.hideInstance,ve=e.hideTextInstance,ce=e.unhideInstance,Le=e.unhideTextInstance,Be=e.clearContainer,wt=e.cloneInstance,Ht=e.createContainerChildSet,Zt=e.appendChildToContainerChildSet,Vn=e.finalizeContainerChildren,Ut=e.replaceContainerChildren,ji=e.cloneHiddenInstance,Hn=e.cloneHiddenTextInstance,ih=e.canHydrateInstance,rh=e.canHydrateTextInstance,sh=e.canHydrateSuspenseInstance,pa=e.isSuspenseInstancePending,El=e.isSuspenseInstanceFallback,bl=e.registerSuspenseInstanceRetry,go=e.getNextHydratableSibling,oh=e.getFirstHydratableChild,cv=e.getFirstHydratableChildWithinContainer,uv=e.getFirstHydratableChildWithinSuspenseInstance,dv=e.hydrateInstance,F=e.hydrateTextInstance,re=e.hydrateSuspenseInstance,he=e.getNextHydratableInstanceAfterSuspenseInstance,de=e.commitHydratedContainer,fe=e.commitHydratedSuspenseInstance,Ge=e.clearSuspenseBoundary,et=e.clearSuspenseBoundaryFromContainer,it=e.shouldDeleteUnhydratedTailInstances,pt=e.didNotMatchHydratedContainerTextInstance,gt=e.didNotMatchHydratedTextInstance,vt;function yt(l){if(vt===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);vt=c&&c[1]||""}return`
`+vt+l}var tn=!1;function bn(l,c){if(!l||tn)return"";tn=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(ke){var S=ke}Reflect.construct(l,[],c)}else{try{c.call()}catch(ke){S=ke}l.call(c.prototype)}else{try{throw Error()}catch(ke){S=ke}l()}}catch(ke){if(ke&&S&&typeof ke.stack=="string"){for(var E=ke.stack.split(`
`),T=S.stack.split(`
`),H=E.length-1,ee=T.length-1;1<=H&&0<=ee&&E[H]!==T[ee];)ee--;for(;1<=H&&0<=ee;H--,ee--)if(E[H]!==T[ee]){if(H!==1||ee!==1)do if(H--,ee--,0>ee||E[H]!==T[ee]){var _e=`
`+E[H].replace(" at new "," at ");return l.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",l.displayName)),_e}while(1<=H&&0<=ee);break}}}finally{tn=!1,Error.prepareStackTrace=m}return(l=l?l.displayName||l.name:"")?yt(l):""}var xi=Object.prototype.hasOwnProperty,Xi=[],Rt=-1;function dt(l){return{current:l}}function Vt(l){0>Rt||(l.current=Xi[Rt],Xi[Rt]=null,Rt--)}function ft(l,c){Rt++,Xi[Rt]=l.current,l.current=c}var ri={},Nn=dt(ri),An=dt(!1),Ur=ri;function on(l,c){var m=l.type.contextTypes;if(!m)return ri;var S=l.stateNode;if(S&&S.__reactInternalMemoizedUnmaskedChildContext===c)return S.__reactInternalMemoizedMaskedChildContext;var E={},T;for(T in m)E[T]=c[T];return S&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=E),E}function an(l){return l=l.childContextTypes,l!=null}function vo(){Vt(An),Vt(Nn)}function Si(l,c,m){if(Nn.current!==ri)throw Error(o(168));ft(Nn,c),ft(An,m)}function Al(l,c,m){var S=l.stateNode;if(c=c.childContextTypes,typeof S.getChildContext!="function")return m;S=S.getChildContext();for(var E in S)if(!(E in c))throw Error(o(108,D(l)||"Unknown",E));return s({},m,S)}function Tl(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||ri,Ur=Nn.current,ft(Nn,l),ft(An,An.current),!0}function _u(l,c,m){var S=l.stateNode;if(!S)throw Error(o(169));m?(l=Al(l,c,Ur),S.__reactInternalMemoizedMergedChildContext=l,Vt(An),Vt(Nn),ft(Nn,l)):Vt(An),ft(An,m)}var Fr=Math.clz32?Math.clz32:zL,FL=Math.log,kL=Math.LN2;function zL(l){return l>>>=0,l===0?32:31-(FL(l)/kL|0)|0}var ah=64,lh=4194304;function xu(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 ch(l,c){var m=l.pendingLanes;if(m===0)return 0;var S=0,E=l.suspendedLanes,T=l.pingedLanes,H=m&268435455;if(H!==0){var ee=H&~E;ee!==0?S=xu(ee):(T&=H,T!==0&&(S=xu(T)))}else H=m&~E,H!==0?S=xu(H):T!==0&&(S=xu(T));if(S===0)return 0;if(c!==0&&c!==S&&!(c&E)&&(E=S&-S,T=c&-c,E>=T||E===16&&(T&4194240)!==0))return c;if(S&4&&(S|=m&16),c=l.entangledLanes,c!==0)for(l=l.entanglements,c&=S;0<c;)m=31-Fr(c),E=1<<m,S|=l[m],c&=~E;return S}function BL(l,c){switch(l){case 1:case 2:case 4:return c+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 c+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 VL(l,c){for(var m=l.suspendedLanes,S=l.pingedLanes,E=l.expirationTimes,T=l.pendingLanes;0<T;){var H=31-Fr(T),ee=1<<H,_e=E[H];_e===-1?(!(ee&m)||ee&S)&&(E[H]=BL(ee,c)):_e<=c&&(l.expiredLanes|=ee),T&=~ee}}function fv(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function hv(l){for(var c=[],m=0;31>m;m++)c.push(l);return c}function Su(l,c,m){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-Fr(c),l[c]=m}function HL(l,c){var m=l.pendingLanes&~c;l.pendingLanes=c,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=c,l.mutableReadLanes&=c,l.entangledLanes&=c,c=l.entanglements;var S=l.eventTimes;for(l=l.expirationTimes;0<m;){var E=31-Fr(m),T=1<<E;c[E]=0,S[E]=-1,l[E]=-1,m&=~T}}function pv(l,c){var m=l.entangledLanes|=c;for(l=l.entanglements;m;){var S=31-Fr(m),E=1<<S;E&c|l[S]&c&&(l[S]|=c),m&=~E}}var Ft=0;function aM(l){return l&=-l,1<l?4<l?l&268435455?16:536870912:4:1}var mv=r.unstable_scheduleCallback,lM=r.unstable_cancelCallback,GL=r.unstable_shouldYield,WL=r.unstable_requestPaint,Gn=r.unstable_now,gv=r.unstable_ImmediatePriority,jL=r.unstable_UserBlockingPriority,vv=r.unstable_NormalPriority,XL=r.unstable_IdlePriority,uh=null,hs=null;function qL(l){if(hs&&typeof hs.onCommitFiberRoot=="function")try{hs.onCommitFiberRoot(uh,l,void 0,(l.current.flags&128)===128)}catch{}}function YL(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var ps=typeof Object.is=="function"?Object.is:YL,Us=null,dh=!1,yv=!1;function cM(l){Us===null?Us=[l]:Us.push(l)}function $L(l){dh=!0,cM(l)}function ms(){if(!yv&&Us!==null){yv=!0;var l=0,c=Ft;try{var m=Us;for(Ft=1;l<m.length;l++){var S=m[l];do S=S(!0);while(S!==null)}Us=null,dh=!1}catch(E){throw Us!==null&&(Us=Us.slice(l+1)),mv(gv,ms),E}finally{Ft=c,yv=!1}}return null}var ZL=a.ReactCurrentBatchConfig;function fh(l,c){if(ps(l,c))return!0;if(typeof l!="object"||l===null||typeof c!="object"||c===null)return!1;var m=Object.keys(l),S=Object.keys(c);if(m.length!==S.length)return!1;for(S=0;S<m.length;S++){var E=m[S];if(!xi.call(c,E)||!ps(l[E],c[E]))return!1}return!0}function JL(l){switch(l.tag){case 5:return yt(l.type);case 16:return yt("Lazy");case 13:return yt("Suspense");case 19:return yt("SuspenseList");case 0:case 2:case 15:return l=bn(l.type,!1),l;case 11:return l=bn(l.type.render,!1),l;case 1:return l=bn(l.type,!0),l;default:return""}}function kr(l,c){if(l&&l.defaultProps){c=s({},c),l=l.defaultProps;for(var m in l)c[m]===void 0&&(c[m]=l[m]);return c}return c}var hh=dt(null),ph=null,Cl=null,_v=null;function xv(){_v=Cl=ph=null}function uM(l,c,m){Q?(ft(hh,c._currentValue),c._currentValue=m):(ft(hh,c._currentValue2),c._currentValue2=m)}function Sv(l){var c=hh.current;Vt(hh),Q?l._currentValue=c:l._currentValue2=c}function wv(l,c,m){for(;l!==null;){var S=l.alternate;if((l.childLanes&c)!==c?(l.childLanes|=c,S!==null&&(S.childLanes|=c)):S!==null&&(S.childLanes&c)!==c&&(S.childLanes|=c),l===m)break;l=l.return}}function Rl(l,c){ph=l,_v=Cl=null,l=l.dependencies,l!==null&&l.firstContext!==null&&(l.lanes&c&&($i=!0),l.firstContext=null)}function mr(l){var c=Q?l._currentValue:l._currentValue2;if(_v!==l)if(l={context:l,memoizedValue:c,next:null},Cl===null){if(ph===null)throw Error(o(308));Cl=l,ph.dependencies={lanes:0,firstContext:l}}else Cl=Cl.next=l;return c}var gs=null,yo=!1;function Mv(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dM(l,c){l=l.updateQueue,c.updateQueue===l&&(c.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function Fs(l,c){return{eventTime:l,lane:c,tag:0,payload:null,callback:null,next:null}}function _o(l,c){var m=l.updateQueue;m!==null&&(m=m.shared,Tn!==null&&l.mode&1&&!(Ct&2)?(l=m.interleaved,l===null?(c.next=c,gs===null?gs=[m]:gs.push(m)):(c.next=l.next,l.next=c),m.interleaved=c):(l=m.pending,l===null?c.next=c:(c.next=l.next,l.next=c),m.pending=c))}function mh(l,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194240)!==0)){var S=c.lanes;S&=l.pendingLanes,m|=S,c.lanes=m,pv(l,m)}}function fM(l,c){var m=l.updateQueue,S=l.alternate;if(S!==null&&(S=S.updateQueue,m===S)){var E=null,T=null;if(m=m.firstBaseUpdate,m!==null){do{var H={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};T===null?E=T=H:T=T.next=H,m=m.next}while(m!==null);T===null?E=T=c:T=T.next=c}else E=T=c;m={baseState:S.baseState,firstBaseUpdate:E,lastBaseUpdate:T,shared:S.shared,effects:S.effects},l.updateQueue=m;return}l=m.lastBaseUpdate,l===null?m.firstBaseUpdate=c:l.next=c,m.lastBaseUpdate=c}function gh(l,c,m,S){var E=l.updateQueue;yo=!1;var T=E.firstBaseUpdate,H=E.lastBaseUpdate,ee=E.shared.pending;if(ee!==null){E.shared.pending=null;var _e=ee,ke=_e.next;_e.next=null,H===null?T=ke:H.next=ke,H=_e;var $e=l.alternate;$e!==null&&($e=$e.updateQueue,ee=$e.lastBaseUpdate,ee!==H&&(ee===null?$e.firstBaseUpdate=ke:ee.next=ke,$e.lastBaseUpdate=_e))}if(T!==null){var _t=E.baseState;H=0,$e=ke=_e=null,ee=T;do{var ut=ee.lane,Xt=ee.eventTime;if((S&ut)===ut){$e!==null&&($e=$e.next={eventTime:Xt,lane:0,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null});e:{var at=l,li=ee;switch(ut=c,Xt=m,li.tag){case 1:if(at=li.payload,typeof at=="function"){_t=at.call(Xt,_t,ut);break e}_t=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=li.payload,ut=typeof at=="function"?at.call(Xt,_t,ut):at,ut==null)break e;_t=s({},_t,ut);break e;case 2:yo=!0}}ee.callback!==null&&ee.lane!==0&&(l.flags|=64,ut=E.effects,ut===null?E.effects=[ee]:ut.push(ee))}else Xt={eventTime:Xt,lane:ut,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},$e===null?(ke=$e=Xt,_e=_t):$e=$e.next=Xt,H|=ut;if(ee=ee.next,ee===null){if(ee=E.shared.pending,ee===null)break;ut=ee,ee=ut.next,ut.next=null,E.lastBaseUpdate=ut,E.shared.pending=null}}while(!0);if($e===null&&(_e=_t),E.baseState=_e,E.firstBaseUpdate=ke,E.lastBaseUpdate=$e,c=E.shared.interleaved,c!==null){E=c;do H|=E.lane,E=E.next;while(E!==c)}else T===null&&(E.shared.lanes=0);kl|=H,l.lanes=H,l.memoizedState=_t}}function hM(l,c,m){if(l=c.effects,c.effects=null,l!==null)for(c=0;c<l.length;c++){var S=l[c],E=S.callback;if(E!==null){if(S.callback=null,S=m,typeof E!="function")throw Error(o(191,E));E.call(S)}}}var pM=new i.Component().refs;function Ev(l,c,m,S){c=l.memoizedState,m=m(S,c),m=m==null?c:s({},c,m),l.memoizedState=m,l.lanes===0&&(l.updateQueue.baseState=m)}var vh={isMounted:function(l){return(l=l._reactInternals)?I(l)===l:!1},enqueueSetState:function(l,c,m){l=l._reactInternals;var S=Mi(),E=wo(l),T=Fs(S,E);T.payload=c,m!=null&&(T.callback=m),_o(l,T),c=xr(l,E,S),c!==null&&mh(c,l,E)},enqueueReplaceState:function(l,c,m){l=l._reactInternals;var S=Mi(),E=wo(l),T=Fs(S,E);T.tag=1,T.payload=c,m!=null&&(T.callback=m),_o(l,T),c=xr(l,E,S),c!==null&&mh(c,l,E)},enqueueForceUpdate:function(l,c){l=l._reactInternals;var m=Mi(),S=wo(l),E=Fs(m,S);E.tag=2,c!=null&&(E.callback=c),_o(l,E),c=xr(l,S,m),c!==null&&mh(c,l,S)}};function mM(l,c,m,S,E,T,H){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(S,T,H):c.prototype&&c.prototype.isPureReactComponent?!fh(m,S)||!fh(E,T):!0}function gM(l,c,m){var S=!1,E=ri,T=c.contextType;return typeof T=="object"&&T!==null?T=mr(T):(E=an(c)?Ur:Nn.current,S=c.contextTypes,T=(S=S!=null)?on(l,E):ri),c=new c(m,T),l.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=vh,l.stateNode=c,c._reactInternals=l,S&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=E,l.__reactInternalMemoizedMaskedChildContext=T),c}function vM(l,c,m,S){l=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,S),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,S),c.state!==l&&vh.enqueueReplaceState(c,c.state,null)}function bv(l,c,m,S){var E=l.stateNode;E.props=m,E.state=l.memoizedState,E.refs=pM,Mv(l);var T=c.contextType;typeof T=="object"&&T!==null?E.context=mr(T):(T=an(c)?Ur:Nn.current,E.context=on(l,T)),E.state=l.memoizedState,T=c.getDerivedStateFromProps,typeof T=="function"&&(Ev(l,c,T,m),E.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(c=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),c!==E.state&&vh.enqueueReplaceState(E,E.state,null),gh(l,m,E,S),E.state=l.memoizedState),typeof E.componentDidMount=="function"&&(l.flags|=4194308)}var Pl=[],Il=0,yh=null,_h=0,gr=[],vr=0,ma=null,ks=1,zs="";function ga(l,c){Pl[Il++]=_h,Pl[Il++]=yh,yh=l,_h=c}function yM(l,c,m){gr[vr++]=ks,gr[vr++]=zs,gr[vr++]=ma,ma=l;var S=ks;l=zs;var E=32-Fr(S)-1;S&=~(1<<E),m+=1;var T=32-Fr(c)+E;if(30<T){var H=E-E%5;T=(S&(1<<H)-1).toString(32),S>>=H,E-=H,ks=1<<32-Fr(c)+E|m<<E|S,zs=T+l}else ks=1<<T|m<<E|S,zs=l}function Av(l){l.return!==null&&(ga(l,1),yM(l,1,0))}function Tv(l){for(;l===yh;)yh=Pl[--Il],Pl[Il]=null,_h=Pl[--Il],Pl[Il]=null;for(;l===ma;)ma=gr[--vr],gr[vr]=null,zs=gr[--vr],gr[vr]=null,ks=gr[--vr],gr[vr]=null}var qi=null,Yi=null,nn=!1,wu=!1,zr=null;function _M(l,c){var m=Sr(5,null,null,0);m.elementType="DELETED",m.stateNode=c,m.return=l,c=l.deletions,c===null?(l.deletions=[m],l.flags|=16):c.push(m)}function xM(l,c){switch(l.tag){case 5:return c=ih(c,l.type,l.pendingProps),c!==null?(l.stateNode=c,qi=l,Yi=oh(c),!0):!1;case 6:return c=rh(c,l.pendingProps),c!==null?(l.stateNode=c,qi=l,Yi=null,!0):!1;case 13:if(c=sh(c),c!==null){var m=ma!==null?{id:ks,overflow:zs}:null;return l.memoizedState={dehydrated:c,treeContext:m,retryLane:1073741824},m=Sr(18,null,null,0),m.stateNode=c,m.return=l,l.child=m,qi=l,Yi=null,!0}return!1;default:return!1}}function Cv(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Rv(l){if(nn){var c=Yi;if(c){var m=c;if(!xM(l,c)){if(Cv(l))throw Error(o(418));c=go(m);var S=qi;c&&xM(l,c)?_M(S,m):(l.flags=l.flags&-4097|2,nn=!1,qi=l)}}else{if(Cv(l))throw Error(o(418));l.flags=l.flags&-4097|2,nn=!1,qi=l}}}function SM(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;qi=l}function Mu(l){if(!be||l!==qi)return!1;if(!nn)return SM(l),nn=!0,!1;if(l.tag!==3&&(l.tag!==5||it(l.type)&&!xe(l.type,l.memoizedProps))){var c=Yi;if(c){if(Cv(l)){for(l=Yi;l;)l=go(l);throw Error(o(418))}for(;c;)_M(l,c),c=go(c)}}if(SM(l),l.tag===13){if(!be)throw Error(o(316));if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(o(317));Yi=he(l)}else Yi=qi?go(l.stateNode):null;return!0}function Ll(){be&&(Yi=qi=null,wu=nn=!1)}function Pv(l){zr===null?zr=[l]:zr.push(l)}function Eu(l,c,m){if(l=m.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(o(309));var S=m.stateNode}if(!S)throw Error(o(147,l));var E=S,T=""+l;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===T?c.ref:(c=function(H){var ee=E.refs;ee===pM&&(ee=E.refs={}),H===null?delete ee[T]:ee[T]=H},c._stringRef=T,c)}if(typeof l!="string")throw Error(o(284));if(!m._owner)throw Error(o(290,l))}return l}function xh(l,c){throw l=Object.prototype.toString.call(c),Error(o(31,l==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":l))}function wM(l){var c=l._init;return c(l._payload)}function MM(l){function c(ue,te){if(l){var me=ue.deletions;me===null?(ue.deletions=[te],ue.flags|=16):me.push(te)}}function m(ue,te){if(!l)return null;for(;te!==null;)c(ue,te),te=te.sibling;return null}function S(ue,te){for(ue=new Map;te!==null;)te.key!==null?ue.set(te.key,te):ue.set(te.index,te),te=te.sibling;return ue}function E(ue,te){return ue=Eo(ue,te),ue.index=0,ue.sibling=null,ue}function T(ue,te,me){return ue.index=me,l?(me=ue.alternate,me!==null?(me=me.index,me<te?(ue.flags|=2,te):me):(ue.flags|=2,te)):(ue.flags|=1048576,te)}function H(ue){return l&&ue.alternate===null&&(ue.flags|=2),ue}function ee(ue,te,me,je){return te===null||te.tag!==6?(te=hy(me,ue.mode,je),te.return=ue,te):(te=E(te,me),te.return=ue,te)}function _e(ue,te,me,je){var rt=me.type;return rt===f?$e(ue,te,me.props.children,je,me.key):te!==null&&(te.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===M&&wM(rt)===te.type)?(je=E(te,me.props),je.ref=Eu(ue,te,me),je.return=ue,je):(je=Jh(me.type,me.key,me.props,null,ue.mode,je),je.ref=Eu(ue,te,me),je.return=ue,je)}function ke(ue,te,me,je){return te===null||te.tag!==4||te.stateNode.containerInfo!==me.containerInfo||te.stateNode.implementation!==me.implementation?(te=py(me,ue.mode,je),te.return=ue,te):(te=E(te,me.children||[]),te.return=ue,te)}function $e(ue,te,me,je,rt){return te===null||te.tag!==7?(te=Ma(me,ue.mode,je,rt),te.return=ue,te):(te=E(te,me),te.return=ue,te)}function _t(ue,te,me){if(typeof te=="string"&&te!==""||typeof te=="number")return te=hy(""+te,ue.mode,me),te.return=ue,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case u:return me=Jh(te.type,te.key,te.props,null,ue.mode,me),me.ref=Eu(ue,null,te),me.return=ue,me;case d:return te=py(te,ue.mode,me),te.return=ue,te;case M:var je=te._init;return _t(ue,je(te._payload),me)}if(J(te)||C(te))return te=Ma(te,ue.mode,me,null),te.return=ue,te;xh(ue,te)}return null}function ut(ue,te,me,je){var rt=te!==null?te.key:null;if(typeof me=="string"&&me!==""||typeof me=="number")return rt!==null?null:ee(ue,te,""+me,je);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case u:return me.key===rt?_e(ue,te,me,je):null;case d:return me.key===rt?ke(ue,te,me,je):null;case M:return rt=me._init,ut(ue,te,rt(me._payload),je)}if(J(me)||C(me))return rt!==null?null:$e(ue,te,me,je,null);xh(ue,me)}return null}function Xt(ue,te,me,je,rt){if(typeof je=="string"&&je!==""||typeof je=="number")return ue=ue.get(me)||null,ee(te,ue,""+je,rt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case u:return ue=ue.get(je.key===null?me:je.key)||null,_e(te,ue,je,rt);case d:return ue=ue.get(je.key===null?me:je.key)||null,ke(te,ue,je,rt);case M:var Tt=je._init;return Xt(ue,te,me,Tt(je._payload),rt)}if(J(je)||C(je))return ue=ue.get(me)||null,$e(te,ue,je,rt,null);xh(te,je)}return null}function at(ue,te,me,je){for(var rt=null,Tt=null,xt=te,kt=te=0,jn=null;xt!==null&&kt<me.length;kt++){xt.index>kt?(jn=xt,xt=null):jn=xt.sibling;var zt=ut(ue,xt,me[kt],je);if(zt===null){xt===null&&(xt=jn);break}l&&xt&&zt.alternate===null&&c(ue,xt),te=T(zt,te,kt),Tt===null?rt=zt:Tt.sibling=zt,Tt=zt,xt=jn}if(kt===me.length)return m(ue,xt),nn&&ga(ue,kt),rt;if(xt===null){for(;kt<me.length;kt++)xt=_t(ue,me[kt],je),xt!==null&&(te=T(xt,te,kt),Tt===null?rt=xt:Tt.sibling=xt,Tt=xt);return nn&&ga(ue,kt),rt}for(xt=S(ue,xt);kt<me.length;kt++)jn=Xt(xt,ue,kt,me[kt],je),jn!==null&&(l&&jn.alternate!==null&&xt.delete(jn.key===null?kt:jn.key),te=T(jn,te,kt),Tt===null?rt=jn:Tt.sibling=jn,Tt=jn);return l&&xt.forEach(function(bo){return c(ue,bo)}),nn&&ga(ue,kt),rt}function li(ue,te,me,je){var rt=C(me);if(typeof rt!="function")throw Error(o(150));if(me=rt.call(me),me==null)throw Error(o(151));for(var Tt=rt=null,xt=te,kt=te=0,jn=null,zt=me.next();xt!==null&&!zt.done;kt++,zt=me.next()){xt.index>kt?(jn=xt,xt=null):jn=xt.sibling;var bo=ut(ue,xt,zt.value,je);if(bo===null){xt===null&&(xt=jn);break}l&&xt&&bo.alternate===null&&c(ue,xt),te=T(bo,te,kt),Tt===null?rt=bo:Tt.sibling=bo,Tt=bo,xt=jn}if(zt.done)return m(ue,xt),nn&&ga(ue,kt),rt;if(xt===null){for(;!zt.done;kt++,zt=me.next())zt=_t(ue,zt.value,je),zt!==null&&(te=T(zt,te,kt),Tt===null?rt=zt:Tt.sibling=zt,Tt=zt);return nn&&ga(ue,kt),rt}for(xt=S(ue,xt);!zt.done;kt++,zt=me.next())zt=Xt(xt,ue,kt,zt.value,je),zt!==null&&(l&&zt.alternate!==null&&xt.delete(zt.key===null?kt:zt.key),te=T(zt,te,kt),Tt===null?rt=zt:Tt.sibling=zt,Tt=zt);return l&&xt.forEach(function(TN){return c(ue,TN)}),nn&&ga(ue,kt),rt}function wr(ue,te,me,je){if(typeof me=="object"&&me!==null&&me.type===f&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case u:e:{for(var rt=me.key,Tt=te;Tt!==null;){if(Tt.key===rt){if(rt=me.type,rt===f){if(Tt.tag===7){m(ue,Tt.sibling),te=E(Tt,me.props.children),te.return=ue,ue=te;break e}}else if(Tt.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===M&&wM(rt)===Tt.type){m(ue,Tt.sibling),te=E(Tt,me.props),te.ref=Eu(ue,Tt,me),te.return=ue,ue=te;break e}m(ue,Tt);break}else c(ue,Tt);Tt=Tt.sibling}me.type===f?(te=Ma(me.props.children,ue.mode,je,me.key),te.return=ue,ue=te):(je=Jh(me.type,me.key,me.props,null,ue.mode,je),je.ref=Eu(ue,te,me),je.return=ue,ue=je)}return H(ue);case d:e:{for(Tt=me.key;te!==null;){if(te.key===Tt)if(te.tag===4&&te.stateNode.containerInfo===me.containerInfo&&te.stateNode.implementation===me.implementation){m(ue,te.sibling),te=E(te,me.children||[]),te.return=ue,ue=te;break e}else{m(ue,te);break}else c(ue,te);te=te.sibling}te=py(me,ue.mode,je),te.return=ue,ue=te}return H(ue);case M:return Tt=me._init,wr(ue,te,Tt(me._payload),je)}if(J(me))return at(ue,te,me,je);if(C(me))return li(ue,te,me,je);xh(ue,me)}return typeof me=="string"&&me!==""||typeof me=="number"?(me=""+me,te!==null&&te.tag===6?(m(ue,te.sibling),te=E(te,me),te.return=ue,ue=te):(m(ue,te),te=hy(me,ue.mode,je),te.return=ue,ue=te),H(ue)):m(ue,te)}return wr}var Nl=MM(!0),EM=MM(!1),bu={},yr=dt(bu),Au=dt(bu),Dl=dt(bu);function vs(l){if(l===bu)throw Error(o(174));return l}function Iv(l,c){ft(Dl,c),ft(Au,l),ft(yr,bu),l=le(c),Vt(yr),ft(yr,l)}function Ol(){Vt(yr),Vt(Au),Vt(Dl)}function bM(l){var c=vs(Dl.current),m=vs(yr.current);c=O(m,l.type,c),m!==c&&(ft(Au,l),ft(yr,c))}function Lv(l){Au.current===l&&(Vt(yr),Vt(Au))}var ln=dt(0);function Sh(l){for(var c=l;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||pa(m)||El(m)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if(c.flags&128)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Nv=[];function Dv(){for(var l=0;l<Nv.length;l++){var c=Nv[l];Q?c._workInProgressVersionPrimary=null:c._workInProgressVersionSecondary=null}Nv.length=0}var wh=a.ReactCurrentDispatcher,_r=a.ReactCurrentBatchConfig,Ul=0,mn=null,si=null,Wn=null,Mh=!1,Tu=!1,Cu=0,KL=0;function oi(){throw Error(o(321))}function Ov(l,c){if(c===null)return!1;for(var m=0;m<c.length&&m<l.length;m++)if(!ps(l[m],c[m]))return!1;return!0}function Uv(l,c,m,S,E,T){if(Ul=T,mn=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,wh.current=l===null||l.memoizedState===null?nN:iN,l=m(S,E),Tu){T=0;do{if(Tu=!1,Cu=0,25<=T)throw Error(o(301));T+=1,Wn=si=null,c.updateQueue=null,wh.current=rN,l=m(S,E)}while(Tu)}if(wh.current=Ch,c=si!==null&&si.next!==null,Ul=0,Wn=si=mn=null,Mh=!1,c)throw Error(o(300));return l}function Fv(){var l=Cu!==0;return Cu=0,l}function Bs(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wn===null?mn.memoizedState=Wn=l:Wn=Wn.next=l,Wn}function ys(){if(si===null){var l=mn.alternate;l=l!==null?l.memoizedState:null}else l=si.next;var c=Wn===null?mn.memoizedState:Wn.next;if(c!==null)Wn=c,si=l;else{if(l===null)throw Error(o(310));si=l,l={memoizedState:si.memoizedState,baseState:si.baseState,baseQueue:si.baseQueue,queue:si.queue,next:null},Wn===null?mn.memoizedState=Wn=l:Wn=Wn.next=l}return Wn}function va(l,c){return typeof c=="function"?c(l):c}function Eh(l){var c=ys(),m=c.queue;if(m===null)throw Error(o(311));m.lastRenderedReducer=l;var S=si,E=S.baseQueue,T=m.pending;if(T!==null){if(E!==null){var H=E.next;E.next=T.next,T.next=H}S.baseQueue=E=T,m.pending=null}if(E!==null){T=E.next,S=S.baseState;var ee=H=null,_e=null,ke=T;do{var $e=ke.lane;if((Ul&$e)===$e)_e!==null&&(_e=_e.next={lane:0,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null}),S=ke.hasEagerState?ke.eagerState:l(S,ke.action);else{var _t={lane:$e,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null};_e===null?(ee=_e=_t,H=S):_e=_e.next=_t,mn.lanes|=$e,kl|=$e}ke=ke.next}while(ke!==null&&ke!==T);_e===null?H=S:_e.next=ee,ps(S,c.memoizedState)||($i=!0),c.memoizedState=S,c.baseState=H,c.baseQueue=_e,m.lastRenderedState=S}if(l=m.interleaved,l!==null){E=l;do T=E.lane,mn.lanes|=T,kl|=T,E=E.next;while(E!==l)}else E===null&&(m.lanes=0);return[c.memoizedState,m.dispatch]}function bh(l){var c=ys(),m=c.queue;if(m===null)throw Error(o(311));m.lastRenderedReducer=l;var S=m.dispatch,E=m.pending,T=c.memoizedState;if(E!==null){m.pending=null;var H=E=E.next;do T=l(T,H.action),H=H.next;while(H!==E);ps(T,c.memoizedState)||($i=!0),c.memoizedState=T,c.baseQueue===null&&(c.baseState=T),m.lastRenderedState=T}return[T,S]}function AM(){}function TM(l,c){var m=mn,S=ys(),E=c(),T=!ps(S.memoizedState,E);if(T&&(S.memoizedState=E,$i=!0),S=S.queue,Pu(PM.bind(null,m,S,l),[l]),S.getSnapshot!==c||T||Wn!==null&&Wn.memoizedState.tag&1){if(m.flags|=2048,Ru(9,RM.bind(null,m,S,E,c),void 0,null),Tn===null)throw Error(o(349));Ul&30||CM(m,c,E)}return E}function CM(l,c,m){l.flags|=16384,l={getSnapshot:c,value:m},c=mn.updateQueue,c===null?(c={lastEffect:null,stores:null},mn.updateQueue=c,c.stores=[l]):(m=c.stores,m===null?c.stores=[l]:m.push(l))}function RM(l,c,m,S){c.value=m,c.getSnapshot=S,IM(c)&&xr(l,1,-1)}function PM(l,c,m){return m(function(){IM(c)&&xr(l,1,-1)})}function IM(l){var c=l.getSnapshot;l=l.value;try{var m=c();return!ps(l,m)}catch{return!0}}function kv(l){var c=Bs();return typeof l=="function"&&(l=l()),c.memoizedState=c.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:l},c.queue=l,l=l.dispatch=tN.bind(null,mn,l),[c.memoizedState,l]}function Ru(l,c,m,S){return l={tag:l,create:c,destroy:m,deps:S,next:null},c=mn.updateQueue,c===null?(c={lastEffect:null,stores:null},mn.updateQueue=c,c.lastEffect=l.next=l):(m=c.lastEffect,m===null?c.lastEffect=l.next=l:(S=m.next,m.next=l,l.next=S,c.lastEffect=l)),l}function LM(){return ys().memoizedState}function Ah(l,c,m,S){var E=Bs();mn.flags|=l,E.memoizedState=Ru(1|c,m,void 0,S===void 0?null:S)}function Th(l,c,m,S){var E=ys();S=S===void 0?null:S;var T=void 0;if(si!==null){var H=si.memoizedState;if(T=H.destroy,S!==null&&Ov(S,H.deps)){E.memoizedState=Ru(c,m,T,S);return}}mn.flags|=l,E.memoizedState=Ru(1|c,m,T,S)}function zv(l,c){return Ah(8390656,8,l,c)}function Pu(l,c){return Th(2048,8,l,c)}function NM(l,c){return Th(4,2,l,c)}function DM(l,c){return Th(4,4,l,c)}function OM(l,c){if(typeof c=="function")return l=l(),c(l),function(){c(null)};if(c!=null)return l=l(),c.current=l,function(){c.current=null}}function UM(l,c,m){return m=m!=null?m.concat([l]):null,Th(4,4,OM.bind(null,c,l),m)}function Bv(){}function FM(l,c){var m=ys();c=c===void 0?null:c;var S=m.memoizedState;return S!==null&&c!==null&&Ov(c,S[1])?S[0]:(m.memoizedState=[l,c],l)}function kM(l,c){var m=ys();c=c===void 0?null:c;var S=m.memoizedState;return S!==null&&c!==null&&Ov(c,S[1])?S[0]:(l=l(),m.memoizedState=[l,c],l)}function QL(l,c){var m=Ft;Ft=m!==0&&4>m?m:4,l(!0);var S=_r.transition;_r.transition={};try{l(!1),c()}finally{Ft=m,_r.transition=S}}function zM(){return ys().memoizedState}function eN(l,c,m){var S=wo(l);m={lane:S,action:m,hasEagerState:!1,eagerState:null,next:null},BM(l)?VM(c,m):(HM(l,c,m),m=Mi(),l=xr(l,S,m),l!==null&&GM(l,c,S))}function tN(l,c,m){var S=wo(l),E={lane:S,action:m,hasEagerState:!1,eagerState:null,next:null};if(BM(l))VM(c,E);else{HM(l,c,E);var T=l.alternate;if(l.lanes===0&&(T===null||T.lanes===0)&&(T=c.lastRenderedReducer,T!==null))try{var H=c.lastRenderedState,ee=T(H,m);if(E.hasEagerState=!0,E.eagerState=ee,ps(ee,H))return}catch{}finally{}m=Mi(),l=xr(l,S,m),l!==null&&GM(l,c,S)}}function BM(l){var c=l.alternate;return l===mn||c!==null&&c===mn}function VM(l,c){Tu=Mh=!0;var m=l.pending;m===null?c.next=c:(c.next=m.next,m.next=c),l.pending=c}function HM(l,c,m){Tn!==null&&l.mode&1&&!(Ct&2)?(l=c.interleaved,l===null?(m.next=m,gs===null?gs=[c]:gs.push(c)):(m.next=l.next,l.next=m),c.interleaved=m):(l=c.pending,l===null?m.next=m:(m.next=l.next,l.next=m),c.pending=m)}function GM(l,c,m){if(m&4194240){var S=c.lanes;S&=l.pendingLanes,m|=S,c.lanes=m,pv(l,m)}}var Ch={readContext:mr,useCallback:oi,useContext:oi,useEffect:oi,useImperativeHandle:oi,useInsertionEffect:oi,useLayoutEffect:oi,useMemo:oi,useReducer:oi,useRef:oi,useState:oi,useDebugValue:oi,useDeferredValue:oi,useTransition:oi,useMutableSource:oi,useSyncExternalStore:oi,useId:oi,unstable_isNewReconciler:!1},nN={readContext:mr,useCallback:function(l,c){return Bs().memoizedState=[l,c===void 0?null:c],l},useContext:mr,useEffect:zv,useImperativeHandle:function(l,c,m){return m=m!=null?m.concat([l]):null,Ah(4194308,4,OM.bind(null,c,l),m)},useLayoutEffect:function(l,c){return Ah(4194308,4,l,c)},useInsertionEffect:function(l,c){return Ah(4,2,l,c)},useMemo:function(l,c){var m=Bs();return c=c===void 0?null:c,l=l(),m.memoizedState=[l,c],l},useReducer:function(l,c,m){var S=Bs();return c=m!==void 0?m(c):c,S.memoizedState=S.baseState=c,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:c},S.queue=l,l=l.dispatch=eN.bind(null,mn,l),[S.memoizedState,l]},useRef:function(l){var c=Bs();return l={current:l},c.memoizedState=l},useState:kv,useDebugValue:Bv,useDeferredValue:function(l){var c=kv(l),m=c[0],S=c[1];return zv(function(){var E=_r.transition;_r.transition={};try{S(l)}finally{_r.transition=E}},[l]),m},useTransition:function(){var l=kv(!1),c=l[0];return l=QL.bind(null,l[1]),Bs().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,m){var S=mn,E=Bs();if(nn){if(m===void 0)throw Error(o(407));m=m()}else{if(m=c(),Tn===null)throw Error(o(349));Ul&30||CM(S,c,m)}E.memoizedState=m;var T={value:m,getSnapshot:c};return E.queue=T,zv(PM.bind(null,S,T,l),[l]),S.flags|=2048,Ru(9,RM.bind(null,S,T,m,c),void 0,null),m},useId:function(){var l=Bs(),c=Tn.identifierPrefix;if(nn){var m=zs,S=ks;m=(S&~(1<<32-Fr(S)-1)).toString(32)+m,c=":"+c+"R"+m,m=Cu++,0<m&&(c+="H"+m.toString(32)),c+=":"}else m=KL++,c=":"+c+"r"+m.toString(32)+":";return l.memoizedState=c},unstable_isNewReconciler:!1},iN={readContext:mr,useCallback:FM,useContext:mr,useEffect:Pu,useImperativeHandle:UM,useInsertionEffect:NM,useLayoutEffect:DM,useMemo:kM,useReducer:Eh,useRef:LM,useState:function(){return Eh(va)},useDebugValue:Bv,useDeferredValue:function(l){var c=Eh(va),m=c[0],S=c[1];return Pu(function(){var E=_r.transition;_r.transition={};try{S(l)}finally{_r.transition=E}},[l]),m},useTransition:function(){var l=Eh(va)[0],c=ys().memoizedState;return[l,c]},useMutableSource:AM,useSyncExternalStore:TM,useId:zM,unstable_isNewReconciler:!1},rN={readContext:mr,useCallback:FM,useContext:mr,useEffect:Pu,useImperativeHandle:UM,useInsertionEffect:NM,useLayoutEffect:DM,useMemo:kM,useReducer:bh,useRef:LM,useState:function(){return bh(va)},useDebugValue:Bv,useDeferredValue:function(l){var c=bh(va),m=c[0],S=c[1];return Pu(function(){var E=_r.transition;_r.transition={};try{S(l)}finally{_r.transition=E}},[l]),m},useTransition:function(){var l=bh(va)[0],c=ys().memoizedState;return[l,c]},useMutableSource:AM,useSyncExternalStore:TM,useId:zM,unstable_isNewReconciler:!1};function Vv(l,c){try{var m="",S=c;do m+=JL(S),S=S.return;while(S);var E=m}catch(T){E=`
Error generating stack: `+T.message+`
`+T.stack}return{value:l,source:c,stack:E}}function Hv(l,c){try{console.error(c.value)}catch(m){setTimeout(function(){throw m})}}var sN=typeof WeakMap=="function"?WeakMap:Map;function WM(l,c,m){m=Fs(-1,m),m.tag=3,m.payload={element:null};var S=c.value;return m.callback=function(){Wh||(Wh=!0,oy=S),Hv(l,c)},m}function jM(l,c,m){m=Fs(-1,m),m.tag=3;var S=l.type.getDerivedStateFromError;if(typeof S=="function"){var E=c.value;m.payload=function(){return S(E)},m.callback=function(){Hv(l,c)}}var T=l.stateNode;return T!==null&&typeof T.componentDidCatch=="function"&&(m.callback=function(){Hv(l,c),typeof S!="function"&&(xo===null?xo=new Set([this]):xo.add(this));var H=c.stack;this.componentDidCatch(c.value,{componentStack:H!==null?H:""})}),m}function XM(l,c,m){var S=l.pingCache;if(S===null){S=l.pingCache=new sN;var E=new Set;S.set(c,E)}else E=S.get(c),E===void 0&&(E=new Set,S.set(c,E));E.has(m)||(E.add(m),l=_N.bind(null,l,c,m),c.then(l,l))}function qM(l){do{var c;if((c=l.tag===13)&&(c=l.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return l;l=l.return}while(l!==null);return null}function YM(l,c,m,S,E){return l.mode&1?(l.flags|=65536,l.lanes=E,l):(l===c?l.flags|=65536:(l.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(c=Fs(-1,1),c.tag=2,_o(m,c))),m.lanes|=1),l)}function _s(l){l.flags|=4}function $M(l,c){if(l!==null&&l.child===c.child)return!0;if(c.flags&16)return!1;for(l=c.child;l!==null;){if(l.flags&12854||l.subtreeFlags&12854)return!1;l=l.sibling}return!0}var Iu,Lu,Rh,Ph;if(nt)Iu=function(l,c){for(var m=c.child;m!==null;){if(m.tag===5||m.tag===6)ge(l,m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===c)break;for(;m.sibling===null;){if(m.return===null||m.return===c)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},Lu=function(){},Rh=function(l,c,m,S,E){if(l=l.memoizedProps,l!==S){var T=c.stateNode,H=vs(yr.current);m=se(T,m,l,S,E,H),(c.updateQueue=m)&&_s(c)}},Ph=function(l,c,m,S){m!==S&&_s(c)};else if(pe){Iu=function(l,c,m,S){for(var E=c.child;E!==null;){if(E.tag===5){var T=E.stateNode;m&&S&&(T=ji(T,E.type,E.memoizedProps,E)),ge(l,T)}else if(E.tag===6)T=E.stateNode,m&&S&&(T=Hn(T,E.memoizedProps,E)),ge(l,T);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)T=E.child,T!==null&&(T.return=E),Iu(l,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===c)break;for(;E.sibling===null;){if(E.return===null||E.return===c)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};var ZM=function(l,c,m,S){for(var E=c.child;E!==null;){if(E.tag===5){var T=E.stateNode;m&&S&&(T=ji(T,E.type,E.memoizedProps,E)),Zt(l,T)}else if(E.tag===6)T=E.stateNode,m&&S&&(T=Hn(T,E.memoizedProps,E)),Zt(l,T);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)T=E.child,T!==null&&(T.return=E),ZM(l,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===c)break;for(;E.sibling===null;){if(E.return===null||E.return===c)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};Lu=function(l,c){var m=c.stateNode;if(!$M(l,c)){l=m.containerInfo;var S=Ht(l);ZM(S,c,!1,!1),m.pendingChildren=S,_s(c),Vn(l,S)}},Rh=function(l,c,m,S,E){var T=l.stateNode,H=l.memoizedProps;if((l=$M(l,c))&&H===S)c.stateNode=T;else{var ee=c.stateNode,_e=vs(yr.current),ke=null;H!==S&&(ke=se(ee,m,H,S,E,_e)),l&&ke===null?c.stateNode=T:(T=wt(T,ke,m,H,S,c,l,ee),Ue(T,m,S,E,_e)&&_s(c),c.stateNode=T,l?_s(c):Iu(T,c,!1,!1))}},Ph=function(l,c,m,S){m!==S?(l=vs(Dl.current),m=vs(yr.current),c.stateNode=Ae(S,l,m,c),_s(c)):c.stateNode=l.stateNode}}else Lu=function(){},Rh=function(){},Ph=function(){};function Nu(l,c){if(!nn)switch(l.tailMode){case"hidden":c=l.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?l.tail=null:m.sibling=null;break;case"collapsed":m=l.tail;for(var S=null;m!==null;)m.alternate!==null&&(S=m),m=m.sibling;S===null?c||l.tail===null?l.tail=null:l.tail.sibling=null:S.sibling=null}}function ai(l){var c=l.alternate!==null&&l.alternate.child===l.child,m=0,S=0;if(c)for(var E=l.child;E!==null;)m|=E.lanes|E.childLanes,S|=E.subtreeFlags&14680064,S|=E.flags&14680064,E.return=l,E=E.sibling;else for(E=l.child;E!==null;)m|=E.lanes|E.childLanes,S|=E.subtreeFlags,S|=E.flags,E.return=l,E=E.sibling;return l.subtreeFlags|=S,l.childLanes=m,c}function oN(l,c,m){var S=c.pendingProps;switch(Tv(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ai(c),null;case 1:return an(c.type)&&vo(),ai(c),null;case 3:return S=c.stateNode,Ol(),Vt(An),Vt(Nn),Dv(),S.pendingContext&&(S.context=S.pendingContext,S.pendingContext=null),(l===null||l.child===null)&&(Mu(c)?_s(c):l===null||l.memoizedState.isDehydrated&&!(c.flags&256)||(c.flags|=1024,zr!==null&&(cy(zr),zr=null))),Lu(l,c),ai(c),null;case 5:Lv(c),m=vs(Dl.current);var E=c.type;if(l!==null&&c.stateNode!=null)Rh(l,c,E,S,m),l.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!S){if(c.stateNode===null)throw Error(o(166));return ai(c),null}if(l=vs(yr.current),Mu(c)){if(!be)throw Error(o(175));l=dv(c.stateNode,c.type,c.memoizedProps,m,l,c,!wu),c.updateQueue=l,l!==null&&_s(c)}else{var T=ae(E,S,m,l,c);Iu(T,c,!1,!1),c.stateNode=T,Ue(T,E,S,m,l)&&_s(c)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return ai(c),null;case 6:if(l&&c.stateNode!=null)Ph(l,c,l.memoizedProps,S);else{if(typeof S!="string"&&c.stateNode===null)throw Error(o(166));if(l=vs(Dl.current),m=vs(yr.current),Mu(c)){if(!be)throw Error(o(176));if(l=c.stateNode,S=c.memoizedProps,(m=F(l,S,c,!wu))&&(E=qi,E!==null))switch(T=(E.mode&1)!==0,E.tag){case 3:pt(E.stateNode.containerInfo,l,S,T);break;case 5:gt(E.type,E.memoizedProps,E.stateNode,l,S,T)}m&&_s(c)}else c.stateNode=Ae(S,l,m,c)}return ai(c),null;case 13:if(Vt(ln),S=c.memoizedState,nn&&Yi!==null&&c.mode&1&&!(c.flags&128)){for(l=Yi;l;)l=go(l);return Ll(),c.flags|=98560,c}if(S!==null&&S.dehydrated!==null){if(S=Mu(c),l===null){if(!S)throw Error(o(318));if(!be)throw Error(o(344));if(l=c.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(o(317));re(l,c)}else Ll(),!(c.flags&128)&&(c.memoizedState=null),c.flags|=4;return ai(c),null}return zr!==null&&(cy(zr),zr=null),c.flags&128?(c.lanes=m,c):(S=S!==null,m=!1,l===null?Mu(c):m=l.memoizedState!==null,S&&!m&&(c.child.flags|=8192,c.mode&1&&(l===null||ln.current&1?Dn===0&&(Dn=3):dy())),c.updateQueue!==null&&(c.flags|=4),ai(c),null);case 4:return Ol(),Lu(l,c),l===null&&Fe(c.stateNode.containerInfo),ai(c),null;case 10:return Sv(c.type._context),ai(c),null;case 17:return an(c.type)&&vo(),ai(c),null;case 19:if(Vt(ln),E=c.memoizedState,E===null)return ai(c),null;if(S=(c.flags&128)!==0,T=E.rendering,T===null)if(S)Nu(E,!1);else{if(Dn!==0||l!==null&&l.flags&128)for(l=c.child;l!==null;){if(T=Sh(l),T!==null){for(c.flags|=128,Nu(E,!1),l=T.updateQueue,l!==null&&(c.updateQueue=l,c.flags|=4),c.subtreeFlags=0,l=m,S=c.child;S!==null;)m=S,E=l,m.flags&=14680066,T=m.alternate,T===null?(m.childLanes=0,m.lanes=E,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=T.childLanes,m.lanes=T.lanes,m.child=T.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=T.memoizedProps,m.memoizedState=T.memoizedState,m.updateQueue=T.updateQueue,m.type=T.type,E=T.dependencies,m.dependencies=E===null?null:{lanes:E.lanes,firstContext:E.firstContext}),S=S.sibling;return ft(ln,ln.current&1|2),c.child}l=l.sibling}E.tail!==null&&Gn()>sy&&(c.flags|=128,S=!0,Nu(E,!1),c.lanes=4194304)}else{if(!S)if(l=Sh(T),l!==null){if(c.flags|=128,S=!0,l=l.updateQueue,l!==null&&(c.updateQueue=l,c.flags|=4),Nu(E,!0),E.tail===null&&E.tailMode==="hidden"&&!T.alternate&&!nn)return ai(c),null}else 2*Gn()-E.renderingStartTime>sy&&m!==1073741824&&(c.flags|=128,S=!0,Nu(E,!1),c.lanes=4194304);E.isBackwards?(T.sibling=c.child,c.child=T):(l=E.last,l!==null?l.sibling=T:c.child=T,E.last=T)}return E.tail!==null?(c=E.tail,E.rendering=c,E.tail=c.sibling,E.renderingStartTime=Gn(),c.sibling=null,l=ln.current,ft(ln,S?l&1|2:l&1),c):(ai(c),null);case 22:case 23:return uy(),S=c.memoizedState!==null,l!==null&&l.memoizedState!==null!==S&&(c.flags|=8192),S&&c.mode&1?Zi&1073741824&&(ai(c),nt&&c.subtreeFlags&6&&(c.flags|=8192)):ai(c),null;case 24:return null;case 25:return null}throw Error(o(156,c.tag))}var aN=a.ReactCurrentOwner,$i=!1;function wi(l,c,m,S){c.child=l===null?EM(c,null,m,S):Nl(c,l.child,m,S)}function JM(l,c,m,S,E){m=m.render;var T=c.ref;return Rl(c,E),S=Uv(l,c,m,S,T,E),m=Fv(),l!==null&&!$i?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~E,Vs(l,c,E)):(nn&&m&&Av(c),c.flags|=1,wi(l,c,S,E),c.child)}function KM(l,c,m,S,E){if(l===null){var T=m.type;return typeof T=="function"&&!fy(T)&&T.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(c.tag=15,c.type=T,QM(l,c,T,S,E)):(l=Jh(m.type,null,S,c,c.mode,E),l.ref=c.ref,l.return=c,c.child=l)}if(T=l.child,!(l.lanes&E)){var H=T.memoizedProps;if(m=m.compare,m=m!==null?m:fh,m(H,S)&&l.ref===c.ref)return Vs(l,c,E)}return c.flags|=1,l=Eo(T,S),l.ref=c.ref,l.return=c,c.child=l}function QM(l,c,m,S,E){if(l!==null&&fh(l.memoizedProps,S)&&l.ref===c.ref)if($i=!1,(l.lanes&E)!==0)l.flags&131072&&($i=!0);else return c.lanes=l.lanes,Vs(l,c,E);return Gv(l,c,m,S,E)}function eE(l,c,m){var S=c.pendingProps,E=S.children,T=l!==null?l.memoizedState:null;if(S.mode==="hidden")if(!(c.mode&1))c.memoizedState={baseLanes:0,cachePool:null},ft(Fl,Zi),Zi|=m;else if(m&1073741824)c.memoizedState={baseLanes:0,cachePool:null},S=T!==null?T.baseLanes:m,ft(Fl,Zi),Zi|=S;else return l=T!==null?T.baseLanes|m:m,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:l,cachePool:null},c.updateQueue=null,ft(Fl,Zi),Zi|=l,null;else T!==null?(S=T.baseLanes|m,c.memoizedState=null):S=m,ft(Fl,Zi),Zi|=S;return wi(l,c,E,m),c.child}function tE(l,c){var m=c.ref;(l===null&&m!==null||l!==null&&l.ref!==m)&&(c.flags|=512,c.flags|=2097152)}function Gv(l,c,m,S,E){var T=an(m)?Ur:Nn.current;return T=on(c,T),Rl(c,E),m=Uv(l,c,m,S,T,E),S=Fv(),l!==null&&!$i?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~E,Vs(l,c,E)):(nn&&S&&Av(c),c.flags|=1,wi(l,c,m,E),c.child)}function nE(l,c,m,S,E){if(an(m)){var T=!0;Tl(c)}else T=!1;if(Rl(c,E),c.stateNode===null)l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),gM(c,m,S),bv(c,m,S,E),S=!0;else if(l===null){var H=c.stateNode,ee=c.memoizedProps;H.props=ee;var _e=H.context,ke=m.contextType;typeof ke=="object"&&ke!==null?ke=mr(ke):(ke=an(m)?Ur:Nn.current,ke=on(c,ke));var $e=m.getDerivedStateFromProps,_t=typeof $e=="function"||typeof H.getSnapshotBeforeUpdate=="function";_t||typeof H.UNSAFE_componentWillReceiveProps!="function"&&typeof H.componentWillReceiveProps!="function"||(ee!==S||_e!==ke)&&vM(c,H,S,ke),yo=!1;var ut=c.memoizedState;H.state=ut,gh(c,S,H,E),_e=c.memoizedState,ee!==S||ut!==_e||An.current||yo?(typeof $e=="function"&&(Ev(c,m,$e,S),_e=c.memoizedState),(ee=yo||mM(c,m,ee,S,ut,_e,ke))?(_t||typeof H.UNSAFE_componentWillMount!="function"&&typeof H.componentWillMount!="function"||(typeof H.componentWillMount=="function"&&H.componentWillMount(),typeof H.UNSAFE_componentWillMount=="function"&&H.UNSAFE_componentWillMount()),typeof H.componentDidMount=="function"&&(c.flags|=4194308)):(typeof H.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=S,c.memoizedState=_e),H.props=S,H.state=_e,H.context=ke,S=ee):(typeof H.componentDidMount=="function"&&(c.flags|=4194308),S=!1)}else{H=c.stateNode,dM(l,c),ee=c.memoizedProps,ke=c.type===c.elementType?ee:kr(c.type,ee),H.props=ke,_t=c.pendingProps,ut=H.context,_e=m.contextType,typeof _e=="object"&&_e!==null?_e=mr(_e):(_e=an(m)?Ur:Nn.current,_e=on(c,_e));var Xt=m.getDerivedStateFromProps;($e=typeof Xt=="function"||typeof H.getSnapshotBeforeUpdate=="function")||typeof H.UNSAFE_componentWillReceiveProps!="function"&&typeof H.componentWillReceiveProps!="function"||(ee!==_t||ut!==_e)&&vM(c,H,S,_e),yo=!1,ut=c.memoizedState,H.state=ut,gh(c,S,H,E);var at=c.memoizedState;ee!==_t||ut!==at||An.current||yo?(typeof Xt=="function"&&(Ev(c,m,Xt,S),at=c.memoizedState),(ke=yo||mM(c,m,ke,S,ut,at,_e)||!1)?($e||typeof H.UNSAFE_componentWillUpdate!="function"&&typeof H.componentWillUpdate!="function"||(typeof H.componentWillUpdate=="function"&&H.componentWillUpdate(S,at,_e),typeof H.UNSAFE_componentWillUpdate=="function"&&H.UNSAFE_componentWillUpdate(S,at,_e)),typeof H.componentDidUpdate=="function"&&(c.flags|=4),typeof H.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof H.componentDidUpdate!="function"||ee===l.memoizedProps&&ut===l.memoizedState||(c.flags|=4),typeof H.getSnapshotBeforeUpdate!="function"||ee===l.memoizedProps&&ut===l.memoizedState||(c.flags|=1024),c.memoizedProps=S,c.memoizedState=at),H.props=S,H.state=at,H.context=_e,S=ke):(typeof H.componentDidUpdate!="function"||ee===l.memoizedProps&&ut===l.memoizedState||(c.flags|=4),typeof H.getSnapshotBeforeUpdate!="function"||ee===l.memoizedProps&&ut===l.memoizedState||(c.flags|=1024),S=!1)}return Wv(l,c,m,S,T,E)}function Wv(l,c,m,S,E,T){tE(l,c);var H=(c.flags&128)!==0;if(!S&&!H)return E&&_u(c,m,!1),Vs(l,c,T);S=c.stateNode,aN.current=c;var ee=H&&typeof m.getDerivedStateFromError!="function"?null:S.render();return c.flags|=1,l!==null&&H?(c.child=Nl(c,l.child,null,T),c.child=Nl(c,null,ee,T)):wi(l,c,ee,T),c.memoizedState=S.state,E&&_u(c,m,!0),c.child}function iE(l){var c=l.stateNode;c.pendingContext?Si(l,c.pendingContext,c.pendingContext!==c.context):c.context&&Si(l,c.context,!1),Iv(l,c.containerInfo)}function rE(l,c,m,S,E){return Ll(),Pv(E),c.flags|=256,wi(l,c,m,S),c.child}var Ih={dehydrated:null,treeContext:null,retryLane:0};function Lh(l){return{baseLanes:l,cachePool:null}}function sE(l,c,m){var S=c.pendingProps,E=ln.current,T=!1,H=(c.flags&128)!==0,ee;if((ee=H)||(ee=l!==null&&l.memoizedState===null?!1:(E&2)!==0),ee?(T=!0,c.flags&=-129):(l===null||l.memoizedState!==null)&&(E|=1),ft(ln,E&1),l===null)return Rv(c),l=c.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?(c.mode&1?El(l)?c.lanes=8:c.lanes=1073741824:c.lanes=1,null):(E=S.children,l=S.fallback,T?(S=c.mode,T=c.child,E={mode:"hidden",children:E},!(S&1)&&T!==null?(T.childLanes=0,T.pendingProps=E):T=Kh(E,S,0,null),l=Ma(l,S,m,null),T.return=c,l.return=c,T.sibling=l,c.child=T,c.child.memoizedState=Lh(m),c.memoizedState=Ih,l):jv(c,E));if(E=l.memoizedState,E!==null){if(ee=E.dehydrated,ee!==null){if(H)return c.flags&256?(c.flags&=-257,Nh(l,c,m,Error(o(422)))):c.memoizedState!==null?(c.child=l.child,c.flags|=128,null):(T=S.fallback,E=c.mode,S=Kh({mode:"visible",children:S.children},E,0,null),T=Ma(T,E,m,null),T.flags|=2,S.return=c,T.return=c,S.sibling=T,c.child=S,c.mode&1&&Nl(c,l.child,null,m),c.child.memoizedState=Lh(m),c.memoizedState=Ih,T);if(!(c.mode&1))c=Nh(l,c,m,null);else if(El(ee))c=Nh(l,c,m,Error(o(419)));else if(S=(m&l.childLanes)!==0,$i||S){if(S=Tn,S!==null){switch(m&-m){case 4:T=2;break;case 16:T=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:T=32;break;case 536870912:T=268435456;break;default:T=0}S=T&(S.suspendedLanes|m)?0:T,S!==0&&S!==E.retryLane&&(E.retryLane=S,xr(l,S,-1))}dy(),c=Nh(l,c,m,Error(o(421)))}else pa(ee)?(c.flags|=128,c.child=l.child,c=xN.bind(null,l),bl(ee,c),c=null):(m=E.treeContext,be&&(Yi=uv(ee),qi=c,nn=!0,zr=null,wu=!1,m!==null&&(gr[vr++]=ks,gr[vr++]=zs,gr[vr++]=ma,ks=m.id,zs=m.overflow,ma=c)),c=jv(c,c.pendingProps.children),c.flags|=4096);return c}return T?(S=aE(l,c,S.children,S.fallback,m),T=c.child,E=l.child.memoizedState,T.memoizedState=E===null?Lh(m):{baseLanes:E.baseLanes|m,cachePool:null},T.childLanes=l.childLanes&~m,c.memoizedState=Ih,S):(m=oE(l,c,S.children,m),c.memoizedState=null,m)}return T?(S=aE(l,c,S.children,S.fallback,m),T=c.child,E=l.child.memoizedState,T.memoizedState=E===null?Lh(m):{baseLanes:E.baseLanes|m,cachePool:null},T.childLanes=l.childLanes&~m,c.memoizedState=Ih,S):(m=oE(l,c,S.children,m),c.memoizedState=null,m)}function jv(l,c){return c=Kh({mode:"visible",children:c},l.mode,0,null),c.return=l,l.child=c}function oE(l,c,m,S){var E=l.child;return l=E.sibling,m=Eo(E,{mode:"visible",children:m}),!(c.mode&1)&&(m.lanes=S),m.return=c,m.sibling=null,l!==null&&(S=c.deletions,S===null?(c.deletions=[l],c.flags|=16):S.push(l)),c.child=m}function aE(l,c,m,S,E){var T=c.mode;l=l.child;var H=l.sibling,ee={mode:"hidden",children:m};return!(T&1)&&c.child!==l?(m=c.child,m.childLanes=0,m.pendingProps=ee,c.deletions=null):(m=Eo(l,ee),m.subtreeFlags=l.subtreeFlags&14680064),H!==null?S=Eo(H,S):(S=Ma(S,T,E,null),S.flags|=2),S.return=c,m.return=c,m.sibling=S,c.child=m,S}function Nh(l,c,m,S){return S!==null&&Pv(S),Nl(c,l.child,null,m),l=jv(c,c.pendingProps.children),l.flags|=2,c.memoizedState=null,l}function lE(l,c,m){l.lanes|=c;var S=l.alternate;S!==null&&(S.lanes|=c),wv(l.return,c,m)}function Xv(l,c,m,S,E){var T=l.memoizedState;T===null?l.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:S,tail:m,tailMode:E}:(T.isBackwards=c,T.rendering=null,T.renderingStartTime=0,T.last=S,T.tail=m,T.tailMode=E)}function cE(l,c,m){var S=c.pendingProps,E=S.revealOrder,T=S.tail;if(wi(l,c,S.children,m),S=ln.current,S&2)S=S&1|2,c.flags|=128;else{if(l!==null&&l.flags&128)e:for(l=c.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&lE(l,m,c);else if(l.tag===19)lE(l,m,c);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===c)break e;for(;l.sibling===null;){if(l.return===null||l.return===c)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}S&=1}if(ft(ln,S),!(c.mode&1))c.memoizedState=null;else switch(E){case"forwards":for(m=c.child,E=null;m!==null;)l=m.alternate,l!==null&&Sh(l)===null&&(E=m),m=m.sibling;m=E,m===null?(E=c.child,c.child=null):(E=m.sibling,m.sibling=null),Xv(c,!1,E,m,T);break;case"backwards":for(m=null,E=c.child,c.child=null;E!==null;){if(l=E.alternate,l!==null&&Sh(l)===null){c.child=E;break}l=E.sibling,E.sibling=m,m=E,E=l}Xv(c,!0,m,null,T);break;case"together":Xv(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Vs(l,c,m){if(l!==null&&(c.dependencies=l.dependencies),kl|=c.lanes,!(m&c.childLanes))return null;if(l!==null&&c.child!==l.child)throw Error(o(153));if(c.child!==null){for(l=c.child,m=Eo(l,l.pendingProps),c.child=m,m.return=c;l.sibling!==null;)l=l.sibling,m=m.sibling=Eo(l,l.pendingProps),m.return=c;m.sibling=null}return c.child}function lN(l,c,m){switch(c.tag){case 3:iE(c),Ll();break;case 5:bM(c);break;case 1:an(c.type)&&Tl(c);break;case 4:Iv(c,c.stateNode.containerInfo);break;case 10:uM(c,c.type._context,c.memoizedProps.value);break;case 13:var S=c.memoizedState;if(S!==null)return S.dehydrated!==null?(ft(ln,ln.current&1),c.flags|=128,null):m&c.child.childLanes?sE(l,c,m):(ft(ln,ln.current&1),l=Vs(l,c,m),l!==null?l.sibling:null);ft(ln,ln.current&1);break;case 19:if(S=(m&c.childLanes)!==0,l.flags&128){if(S)return cE(l,c,m);c.flags|=128}var E=c.memoizedState;if(E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),ft(ln,ln.current),S)break;return null;case 22:case 23:return c.lanes=0,eE(l,c,m)}return Vs(l,c,m)}function cN(l,c){switch(Tv(c),c.tag){case 1:return an(c.type)&&vo(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Ol(),Vt(An),Vt(Nn),Dv(),l=c.flags,l&65536&&!(l&128)?(c.flags=l&-65537|128,c):null;case 5:return Lv(c),null;case 13:if(Vt(ln),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(o(340));Ll()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return Vt(ln),null;case 4:return Ol(),null;case 10:return Sv(c.type._context),null;case 22:case 23:return uy(),null;case 24:return null;default:return null}}var Dh=!1,ya=!1,uN=typeof WeakSet=="function"?WeakSet:Set,We=null;function Oh(l,c){var m=l.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(S){Ui(l,c,S)}else m.current=null}function qv(l,c,m){try{m()}catch(S){Ui(l,c,S)}}var uE=!1;function dN(l,c){for(Y(l.containerInfo),We=c;We!==null;)if(l=We,c=l.child,(l.subtreeFlags&1028)!==0&&c!==null)c.return=l,We=c;else for(;We!==null;){l=We;try{var m=l.alternate;if(l.flags&1024)switch(l.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var S=m.memoizedProps,E=m.memoizedState,T=l.stateNode,H=T.getSnapshotBeforeUpdate(l.elementType===l.type?S:kr(l.type,S),E);T.__reactInternalSnapshotBeforeUpdate=H}break;case 3:nt&&Be(l.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ee){Ui(l,l.return,ee)}if(c=l.sibling,c!==null){c.return=l.return,We=c;break}We=l.return}return m=uE,uE=!1,m}function _a(l,c,m){var S=c.updateQueue;if(S=S!==null?S.lastEffect:null,S!==null){var E=S=S.next;do{if((E.tag&l)===l){var T=E.destroy;E.destroy=void 0,T!==void 0&&qv(c,m,T)}E=E.next}while(E!==S)}}function Du(l,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&l)===l){var S=m.create;m.destroy=S()}m=m.next}while(m!==c)}}function Yv(l){var c=l.ref;if(c!==null){var m=l.stateNode;switch(l.tag){case 5:l=ne(m);break;default:l=m}typeof c=="function"?c(l):c.current=l}}function dE(l,c,m){if(hs&&typeof hs.onCommitFiberUnmount=="function")try{hs.onCommitFiberUnmount(uh,c)}catch{}switch(c.tag){case 0:case 11:case 14:case 15:if(l=c.updateQueue,l!==null&&(l=l.lastEffect,l!==null)){var S=l=l.next;do{var E=S,T=E.destroy;E=E.tag,T!==void 0&&(E&2||E&4)&&qv(c,m,T),S=S.next}while(S!==l)}break;case 1:if(Oh(c,m),l=c.stateNode,typeof l.componentWillUnmount=="function")try{l.props=c.memoizedProps,l.state=c.memoizedState,l.componentWillUnmount()}catch(H){Ui(c,m,H)}break;case 5:Oh(c,m);break;case 4:nt?vE(l,c,m):pe&&pe&&(c=c.stateNode.containerInfo,m=Ht(c),Ut(c,m))}}function fE(l,c,m){for(var S=c;;)if(dE(l,S,m),S.child===null||nt&&S.tag===4){if(S===c)break;for(;S.sibling===null;){if(S.return===null||S.return===c)return;S=S.return}S.sibling.return=S.return,S=S.sibling}else S.child.return=S,S=S.child}function hE(l){var c=l.alternate;c!==null&&(l.alternate=null,hE(c)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(c=l.stateNode,c!==null&&He(c)),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 pE(l){return l.tag===5||l.tag===3||l.tag===4}function mE(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||pE(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 gE(l){if(nt){e:{for(var c=l.return;c!==null;){if(pE(c))break e;c=c.return}throw Error(o(160))}var m=c;switch(m.tag){case 5:c=m.stateNode,m.flags&32&&(Ke(c),m.flags&=-33),m=mE(l),Zv(l,m,c);break;case 3:case 4:c=m.stateNode.containerInfo,m=mE(l),$v(l,m,c);break;default:throw Error(o(161))}}}function $v(l,c,m){var S=l.tag;if(S===5||S===6)l=l.stateNode,c?Ie(m,l,c):De(m,l);else if(S!==4&&(l=l.child,l!==null))for($v(l,c,m),l=l.sibling;l!==null;)$v(l,c,m),l=l.sibling}function Zv(l,c,m){var S=l.tag;if(S===5||S===6)l=l.stateNode,c?oe(m,l,c):st(m,l);else if(S!==4&&(l=l.child,l!==null))for(Zv(l,c,m),l=l.sibling;l!==null;)Zv(l,c,m),l=l.sibling}function vE(l,c,m){for(var S=c,E=!1,T,H;;){if(!E){E=S.return;e:for(;;){if(E===null)throw Error(o(160));switch(T=E.stateNode,E.tag){case 5:H=!1;break e;case 3:T=T.containerInfo,H=!0;break e;case 4:T=T.containerInfo,H=!0;break e}E=E.return}E=!0}if(S.tag===5||S.tag===6)fE(l,S,m),H?ot(T,S.stateNode):ze(T,S.stateNode);else if(S.tag===18)H?et(T,S.stateNode):Ge(T,S.stateNode);else if(S.tag===4){if(S.child!==null){T=S.stateNode.containerInfo,H=!0,S.child.return=S,S=S.child;continue}}else if(dE(l,S,m),S.child!==null){S.child.return=S,S=S.child;continue}if(S===c)break;for(;S.sibling===null;){if(S.return===null||S.return===c)return;S=S.return,S.tag===4&&(E=!1)}S.sibling.return=S.return,S=S.sibling}}function Jv(l,c){if(nt){switch(c.tag){case 0:case 11:case 14:case 15:_a(3,c,c.return),Du(3,c),_a(5,c,c.return);return;case 1:return;case 5:var m=c.stateNode;if(m!=null){var S=c.memoizedProps;l=l!==null?l.memoizedProps:S;var E=c.type,T=c.updateQueue;c.updateQueue=null,T!==null&&W(m,T,E,l,S,c)}return;case 6:if(c.stateNode===null)throw Error(o(162));m=c.memoizedProps,qe(c.stateNode,l!==null?l.memoizedProps:m,m);return;case 3:be&&l!==null&&l.memoizedState.isDehydrated&&de(c.stateNode.containerInfo);return;case 12:return;case 13:Uh(c);return;case 19:Uh(c);return;case 17:return}throw Error(o(163))}switch(c.tag){case 0:case 11:case 14:case 15:_a(3,c,c.return),Du(3,c),_a(5,c,c.return);return;case 12:return;case 13:Uh(c);return;case 19:Uh(c);return;case 3:be&&l!==null&&l.memoizedState.isDehydrated&&de(c.stateNode.containerInfo);break;case 22:case 23:return}e:if(pe){switch(c.tag){case 1:case 5:case 6:break e;case 3:case 4:c=c.stateNode,Ut(c.containerInfo,c.pendingChildren);break e}throw Error(o(163))}}function Uh(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var m=l.stateNode;m===null&&(m=l.stateNode=new uN),c.forEach(function(S){var E=SN.bind(null,l,S);m.has(S)||(m.add(S),S.then(E,E))})}}function fN(l,c){for(We=c;We!==null;){c=We;var m=c.deletions;if(m!==null)for(var S=0;S<m.length;S++){var E=m[S];try{var T=l;nt?vE(T,E,c):fE(T,E,c);var H=E.alternate;H!==null&&(H.return=null),E.return=null}catch(rt){Ui(E,c,rt)}}if(m=c.child,c.subtreeFlags&12854&&m!==null)m.return=c,We=m;else for(;We!==null;){c=We;try{var ee=c.flags;if(ee&32&&nt&&Ke(c.stateNode),ee&512){var _e=c.alternate;if(_e!==null){var ke=_e.ref;ke!==null&&(typeof ke=="function"?ke(null):ke.current=null)}}if(ee&8192)switch(c.tag){case 13:if(c.memoizedState!==null){var $e=c.alternate;($e===null||$e.memoizedState===null)&&(ry=Gn())}break;case 22:var _t=c.memoizedState!==null,ut=c.alternate,Xt=ut!==null&&ut.memoizedState!==null;if(m=c,nt){e:if(S=m,E=_t,T=null,nt)for(var at=S;;){if(at.tag===5){if(T===null){T=at;var li=at.stateNode;E?j(li):ce(at.stateNode,at.memoizedProps)}}else if(at.tag===6){if(T===null){var wr=at.stateNode;E?ve(wr):Le(wr,at.memoizedProps)}}else if((at.tag!==22&&at.tag!==23||at.memoizedState===null||at===S)&&at.child!==null){at.child.return=at,at=at.child;continue}if(at===S)break;for(;at.sibling===null;){if(at.return===null||at.return===S)break e;T===at&&(T=null),at=at.return}T===at&&(T=null),at.sibling.return=at.return,at=at.sibling}}if(_t&&!Xt&&m.mode&1){We=m;for(var ue=m.child;ue!==null;){for(m=We=ue;We!==null;){S=We;var te=S.child;switch(S.tag){case 0:case 11:case 14:case 15:_a(4,S,S.return);break;case 1:Oh(S,S.return);var me=S.stateNode;if(typeof me.componentWillUnmount=="function"){var je=S.return;try{me.props=S.memoizedProps,me.state=S.memoizedState,me.componentWillUnmount()}catch(rt){Ui(S,je,rt)}}break;case 5:Oh(S,S.return);break;case 22:if(S.memoizedState!==null){xE(m);continue}}te!==null?(te.return=S,We=te):xE(m)}ue=ue.sibling}}}switch(ee&4102){case 2:gE(c),c.flags&=-3;break;case 6:gE(c),c.flags&=-3,Jv(c.alternate,c);break;case 4096:c.flags&=-4097;break;case 4100:c.flags&=-4097,Jv(c.alternate,c);break;case 4:Jv(c.alternate,c)}}catch(rt){Ui(c,c.return,rt)}if(m=c.sibling,m!==null){m.return=c.return,We=m;break}We=c.return}}}function hN(l,c,m){We=l,yE(l)}function yE(l,c,m){for(var S=(l.mode&1)!==0;We!==null;){var E=We,T=E.child;if(E.tag===22&&S){var H=E.memoizedState!==null||Dh;if(!H){var ee=E.alternate,_e=ee!==null&&ee.memoizedState!==null||ya;ee=Dh;var ke=ya;if(Dh=H,(ya=_e)&&!ke)for(We=E;We!==null;)H=We,_e=H.child,H.tag===22&&H.memoizedState!==null?SE(E):_e!==null?(_e.return=H,We=_e):SE(E);for(;T!==null;)We=T,yE(T),T=T.sibling;We=E,Dh=ee,ya=ke}_E(l)}else E.subtreeFlags&8772&&T!==null?(T.return=E,We=T):_E(l)}}function _E(l){for(;We!==null;){var c=We;if(c.flags&8772){var m=c.alternate;try{if(c.flags&8772)switch(c.tag){case 0:case 11:case 15:ya||Du(5,c);break;case 1:var S=c.stateNode;if(c.flags&4&&!ya)if(m===null)S.componentDidMount();else{var E=c.elementType===c.type?m.memoizedProps:kr(c.type,m.memoizedProps);S.componentDidUpdate(E,m.memoizedState,S.__reactInternalSnapshotBeforeUpdate)}var T=c.updateQueue;T!==null&&hM(c,T,S);break;case 3:var H=c.updateQueue;if(H!==null){if(m=null,c.child!==null)switch(c.child.tag){case 5:m=ne(c.child.stateNode);break;case 1:m=c.child.stateNode}hM(c,H,m)}break;case 5:var ee=c.stateNode;m===null&&c.flags&4&&ct(ee,c.type,c.memoizedProps,c);break;case 6:break;case 4:break;case 12:break;case 13:if(be&&c.memoizedState===null){var _e=c.alternate;if(_e!==null){var ke=_e.memoizedState;if(ke!==null){var $e=ke.dehydrated;$e!==null&&fe($e)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}ya||c.flags&512&&Yv(c)}catch(_t){Ui(c,c.return,_t)}}if(c===l){We=null;break}if(m=c.sibling,m!==null){m.return=c.return,We=m;break}We=c.return}}function xE(l){for(;We!==null;){var c=We;if(c===l){We=null;break}var m=c.sibling;if(m!==null){m.return=c.return,We=m;break}We=c.return}}function SE(l){for(;We!==null;){var c=We;try{switch(c.tag){case 0:case 11:case 15:var m=c.return;try{Du(4,c)}catch(_e){Ui(c,m,_e)}break;case 1:var S=c.stateNode;if(typeof S.componentDidMount=="function"){var E=c.return;try{S.componentDidMount()}catch(_e){Ui(c,E,_e)}}var T=c.return;try{Yv(c)}catch(_e){Ui(c,T,_e)}break;case 5:var H=c.return;try{Yv(c)}catch(_e){Ui(c,H,_e)}}}catch(_e){Ui(c,c.return,_e)}if(c===l){We=null;break}var ee=c.sibling;if(ee!==null){ee.return=c.return,We=ee;break}We=c.return}}var Fh=0,kh=1,zh=2,Bh=3,Vh=4;if(typeof Symbol=="function"&&Symbol.for){var Ou=Symbol.for;Fh=Ou("selector.component"),kh=Ou("selector.has_pseudo_class"),zh=Ou("selector.role"),Bh=Ou("selector.test_id"),Vh=Ou("selector.text")}function Kv(l){var c=Se(l);if(c!=null){if(typeof c.memoizedProps["data-testname"]!="string")throw Error(o(364));return c}if(l=X(l),l===null)throw Error(o(362));return l.stateNode.current}function Qv(l,c){switch(c.$$typeof){case Fh:if(l.type===c.value)return!0;break;case kh:e:{c=c.value,l=[l,0];for(var m=0;m<l.length;){var S=l[m++],E=l[m++],T=c[E];if(S.tag!==5||!ie(S)){for(;T!=null&&Qv(S,T);)E++,T=c[E];if(E===c.length){c=!0;break e}else for(S=S.child;S!==null;)l.push(S,E),S=S.sibling}}c=!1}return c;case zh:if(l.tag===5&&Ne(l.stateNode,c.value))return!0;break;case Vh:if((l.tag===5||l.tag===6)&&(l=$(l),l!==null&&0<=l.indexOf(c.value)))return!0;break;case Bh:if(l.tag===5&&(l=l.memoizedProps["data-testname"],typeof l=="string"&&l.toLowerCase()===c.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function ey(l){switch(l.$$typeof){case Fh:return"<"+(P(l.value)||"Unknown")+">";case kh:return":has("+(ey(l)||"")+")";case zh:return'[role="'+l.value+'"]';case Vh:return'"'+l.value+'"';case Bh:return'[data-testname="'+l.value+'"]';default:throw Error(o(365))}}function wE(l,c){var m=[];l=[l,0];for(var S=0;S<l.length;){var E=l[S++],T=l[S++],H=c[T];if(E.tag!==5||!ie(E)){for(;H!=null&&Qv(E,H);)T++,H=c[T];if(T===c.length)m.push(E);else for(E=E.child;E!==null;)l.push(E,T),E=E.sibling}}return m}function ty(l,c){if(!R)throw Error(o(363));l=Kv(l),l=wE(l,c),c=[],l=Array.from(l);for(var m=0;m<l.length;){var S=l[m++];if(S.tag===5)ie(S)||c.push(S.stateNode);else for(S=S.child;S!==null;)l.push(S),S=S.sibling}return c}var pN=Math.ceil,Hh=a.ReactCurrentDispatcher,ny=a.ReactCurrentOwner,_n=a.ReactCurrentBatchConfig,Ct=0,Tn=null,Cn=null,Zn=0,Zi=0,Fl=dt(0),Dn=0,Uu=null,kl=0,Gh=0,iy=0,Fu=null,Di=null,ry=0,sy=1/0;function zl(){sy=Gn()+500}var Wh=!1,oy=null,xo=null,jh=!1,So=null,Xh=0,ku=0,ay=null,qh=-1,Yh=0;function Mi(){return Ct&6?Gn():qh!==-1?qh:qh=Gn()}function wo(l){return l.mode&1?Ct&2&&Zn!==0?Zn&-Zn:ZL.transition!==null?(Yh===0&&(l=ah,ah<<=1,!(ah&4194240)&&(ah=64),Yh=l),Yh):(l=Ft,l!==0?l:Te()):1}function xr(l,c,m){if(50<ku)throw ku=0,ay=null,Error(o(185));var S=$h(l,c);return S===null?null:(Su(S,c,m),(!(Ct&2)||S!==Tn)&&(S===Tn&&(!(Ct&2)&&(Gh|=c),Dn===4&&Mo(S,Zn)),Oi(S,m),c===1&&Ct===0&&!(l.mode&1)&&(zl(),dh&&ms())),S)}function $h(l,c){l.lanes|=c;var m=l.alternate;for(m!==null&&(m.lanes|=c),m=l,l=l.return;l!==null;)l.childLanes|=c,m=l.alternate,m!==null&&(m.childLanes|=c),m=l,l=l.return;return m.tag===3?m.stateNode:null}function Oi(l,c){var m=l.callbackNode;VL(l,c);var S=ch(l,l===Tn?Zn:0);if(S===0)m!==null&&lM(m),l.callbackNode=null,l.callbackPriority=0;else if(c=S&-S,l.callbackPriority!==c){if(m!=null&&lM(m),c===1)l.tag===0?$L(EE.bind(null,l)):cM(EE.bind(null,l)),V?L(function(){Ct===0&&ms()}):mv(gv,ms),m=null;else{switch(aM(S)){case 1:m=gv;break;case 4:m=jL;break;case 16:m=vv;break;case 536870912:m=XL;break;default:m=vv}m=NE(m,ME.bind(null,l))}l.callbackPriority=c,l.callbackNode=m}}function ME(l,c){if(qh=-1,Yh=0,Ct&6)throw Error(o(327));var m=l.callbackNode;if(wa()&&l.callbackNode!==m)return null;var S=ch(l,l===Tn?Zn:0);if(S===0)return null;if(S&30||S&l.expiredLanes||c)c=Zh(l,S);else{c=S;var E=Ct;Ct|=2;var T=TE();(Tn!==l||Zn!==c)&&(zl(),xa(l,c));do try{vN();break}catch(ee){AE(l,ee)}while(!0);xv(),Hh.current=T,Ct=E,Cn!==null?c=0:(Tn=null,Zn=0,c=Dn)}if(c!==0){if(c===2&&(E=fv(l),E!==0&&(S=E,c=ly(l,E))),c===1)throw m=Uu,xa(l,0),Mo(l,S),Oi(l,Gn()),m;if(c===6)Mo(l,S);else{if(E=l.current.alternate,!(S&30)&&!mN(E)&&(c=Zh(l,S),c===2&&(T=fv(l),T!==0&&(S=T,c=ly(l,T))),c===1))throw m=Uu,xa(l,0),Mo(l,S),Oi(l,Gn()),m;switch(l.finishedWork=E,l.finishedLanes=S,c){case 0:case 1:throw Error(o(345));case 2:Sa(l,Di);break;case 3:if(Mo(l,S),(S&130023424)===S&&(c=ry+500-Gn(),10<c)){if(ch(l,0)!==0)break;if(E=l.suspendedLanes,(E&S)!==S){Mi(),l.pingedLanes|=l.suspendedLanes&E;break}l.timeoutHandle=Ce(Sa.bind(null,l,Di),c);break}Sa(l,Di);break;case 4:if(Mo(l,S),(S&4194240)===S)break;for(c=l.eventTimes,E=-1;0<S;){var H=31-Fr(S);T=1<<H,H=c[H],H>E&&(E=H),S&=~T}if(S=E,S=Gn()-S,S=(120>S?120:480>S?480:1080>S?1080:1920>S?1920:3e3>S?3e3:4320>S?4320:1960*pN(S/1960))-S,10<S){l.timeoutHandle=Ce(Sa.bind(null,l,Di),S);break}Sa(l,Di);break;case 5:Sa(l,Di);break;default:throw Error(o(329))}}}return Oi(l,Gn()),l.callbackNode===m?ME.bind(null,l):null}function ly(l,c){var m=Fu;return l.current.memoizedState.isDehydrated&&(xa(l,c).flags|=256),l=Zh(l,c),l!==2&&(c=Di,Di=m,c!==null&&cy(c)),l}function cy(l){Di===null?Di=l:Di.push.apply(Di,l)}function mN(l){for(var c=l;;){if(c.flags&16384){var m=c.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var S=0;S<m.length;S++){var E=m[S],T=E.getSnapshot;E=E.value;try{if(!ps(T(),E))return!1}catch{return!1}}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Mo(l,c){for(c&=~iy,c&=~Gh,l.suspendedLanes|=c,l.pingedLanes&=~c,l=l.expirationTimes;0<c;){var m=31-Fr(c),S=1<<m;l[m]=-1,c&=~S}}function EE(l){if(Ct&6)throw Error(o(327));wa();var c=ch(l,0);if(!(c&1))return Oi(l,Gn()),null;var m=Zh(l,c);if(l.tag!==0&&m===2){var S=fv(l);S!==0&&(c=S,m=ly(l,S))}if(m===1)throw m=Uu,xa(l,0),Mo(l,c),Oi(l,Gn()),m;if(m===6)throw Error(o(345));return l.finishedWork=l.current.alternate,l.finishedLanes=c,Sa(l,Di),Oi(l,Gn()),null}function bE(l){So!==null&&So.tag===0&&!(Ct&6)&&wa();var c=Ct;Ct|=1;var m=_n.transition,S=Ft;try{if(_n.transition=null,Ft=1,l)return l()}finally{Ft=S,_n.transition=m,Ct=c,!(Ct&6)&&ms()}}function uy(){Zi=Fl.current,Vt(Fl)}function xa(l,c){l.finishedWork=null,l.finishedLanes=0;var m=l.timeoutHandle;if(m!==Qe&&(l.timeoutHandle=Qe,tt(m)),Cn!==null)for(m=Cn.return;m!==null;){var S=m;switch(Tv(S),S.tag){case 1:S=S.type.childContextTypes,S!=null&&vo();break;case 3:Ol(),Vt(An),Vt(Nn),Dv();break;case 5:Lv(S);break;case 4:Ol();break;case 13:Vt(ln);break;case 19:Vt(ln);break;case 10:Sv(S.type._context);break;case 22:case 23:uy()}m=m.return}if(Tn=l,Cn=l=Eo(l.current,null),Zn=Zi=c,Dn=0,Uu=null,iy=Gh=kl=0,Di=Fu=null,gs!==null){for(c=0;c<gs.length;c++)if(m=gs[c],S=m.interleaved,S!==null){m.interleaved=null;var E=S.next,T=m.pending;if(T!==null){var H=T.next;T.next=E,S.next=H}m.pending=S}gs=null}return l}function AE(l,c){do{var m=Cn;try{if(xv(),wh.current=Ch,Mh){for(var S=mn.memoizedState;S!==null;){var E=S.queue;E!==null&&(E.pending=null),S=S.next}Mh=!1}if(Ul=0,Wn=si=mn=null,Tu=!1,Cu=0,ny.current=null,m===null||m.return===null){Dn=1,Uu=c,Cn=null;break}e:{var T=l,H=m.return,ee=m,_e=c;if(c=Zn,ee.flags|=32768,_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var ke=_e,$e=ee,_t=$e.tag;if(!($e.mode&1)&&(_t===0||_t===11||_t===15)){var ut=$e.alternate;ut?($e.updateQueue=ut.updateQueue,$e.memoizedState=ut.memoizedState,$e.lanes=ut.lanes):($e.updateQueue=null,$e.memoizedState=null)}var Xt=qM(H);if(Xt!==null){Xt.flags&=-257,YM(Xt,H,ee,T,c),Xt.mode&1&&XM(T,ke,c),c=Xt,_e=ke;var at=c.updateQueue;if(at===null){var li=new Set;li.add(_e),c.updateQueue=li}else at.add(_e);break e}else{if(!(c&1)){XM(T,ke,c),dy();break e}_e=Error(o(426))}}else if(nn&&ee.mode&1){var wr=qM(H);if(wr!==null){!(wr.flags&65536)&&(wr.flags|=256),YM(wr,H,ee,T,c),Pv(_e);break e}}T=_e,Dn!==4&&(Dn=2),Fu===null?Fu=[T]:Fu.push(T),_e=Vv(_e,ee),ee=H;do{switch(ee.tag){case 3:ee.flags|=65536,c&=-c,ee.lanes|=c;var ue=WM(ee,_e,c);fM(ee,ue);break e;case 1:T=_e;var te=ee.type,me=ee.stateNode;if(!(ee.flags&128)&&(typeof te.getDerivedStateFromError=="function"||me!==null&&typeof me.componentDidCatch=="function"&&(xo===null||!xo.has(me)))){ee.flags|=65536,c&=-c,ee.lanes|=c;var je=jM(ee,T,c);fM(ee,je);break e}}ee=ee.return}while(ee!==null)}RE(m)}catch(rt){c=rt,Cn===m&&m!==null&&(Cn=m=m.return);continue}break}while(!0)}function TE(){var l=Hh.current;return Hh.current=Ch,l===null?Ch:l}function dy(){(Dn===0||Dn===3||Dn===2)&&(Dn=4),Tn===null||!(kl&268435455)&&!(Gh&268435455)||Mo(Tn,Zn)}function Zh(l,c){var m=Ct;Ct|=2;var S=TE();Tn===l&&Zn===c||xa(l,c);do try{gN();break}catch(E){AE(l,E)}while(!0);if(xv(),Ct=m,Hh.current=S,Cn!==null)throw Error(o(261));return Tn=null,Zn=0,Dn}function gN(){for(;Cn!==null;)CE(Cn)}function vN(){for(;Cn!==null&&!GL();)CE(Cn)}function CE(l){var c=LE(l.alternate,l,Zi);l.memoizedProps=l.pendingProps,c===null?RE(l):Cn=c,ny.current=null}function RE(l){var c=l;do{var m=c.alternate;if(l=c.return,c.flags&32768){if(m=cN(m,c),m!==null){m.flags&=32767,Cn=m;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{Dn=6,Cn=null;return}}else if(m=oN(m,c,Zi),m!==null){Cn=m;return}if(c=c.sibling,c!==null){Cn=c;return}Cn=c=l}while(c!==null);Dn===0&&(Dn=5)}function Sa(l,c){var m=Ft,S=_n.transition;try{_n.transition=null,Ft=1,yN(l,c,m)}finally{_n.transition=S,Ft=m}return null}function yN(l,c,m){do wa();while(So!==null);if(Ct&6)throw Error(o(327));var S=l.finishedWork,E=l.finishedLanes;if(S===null)return null;if(l.finishedWork=null,l.finishedLanes=0,S===l.current)throw Error(o(177));l.callbackNode=null,l.callbackPriority=0;var T=S.lanes|S.childLanes;if(HL(l,T),l===Tn&&(Cn=Tn=null,Zn=0),!(S.subtreeFlags&2064)&&!(S.flags&2064)||jh||(jh=!0,NE(vv,function(){return wa(),null})),T=(S.flags&15990)!==0,S.subtreeFlags&15990||T){T=_n.transition,_n.transition=null;var H=Ft;Ft=1;var ee=Ct;Ct|=4,ny.current=null,dN(l,S),fN(l,S),K(l.containerInfo),l.current=S,hN(S),WL(),Ct=ee,Ft=H,_n.transition=T}else l.current=S;if(jh&&(jh=!1,So=l,Xh=E),T=l.pendingLanes,T===0&&(xo=null),qL(S.stateNode),Oi(l,Gn()),c!==null)for(m=l.onRecoverableError,S=0;S<c.length;S++)m(c[S]);if(Wh)throw Wh=!1,l=oy,oy=null,l;return Xh&1&&l.tag!==0&&wa(),T=l.pendingLanes,T&1?l===ay?ku++:(ku=0,ay=l):ku=0,ms(),null}function wa(){if(So!==null){var l=aM(Xh),c=_n.transition,m=Ft;try{if(_n.transition=null,Ft=16>l?16:l,So===null)var S=!1;else{if(l=So,So=null,Xh=0,Ct&6)throw Error(o(331));var E=Ct;for(Ct|=4,We=l.current;We!==null;){var T=We,H=T.child;if(We.flags&16){var ee=T.deletions;if(ee!==null){for(var _e=0;_e<ee.length;_e++){var ke=ee[_e];for(We=ke;We!==null;){var $e=We;switch($e.tag){case 0:case 11:case 15:_a(8,$e,T)}var _t=$e.child;if(_t!==null)_t.return=$e,We=_t;else for(;We!==null;){$e=We;var ut=$e.sibling,Xt=$e.return;if(hE($e),$e===ke){We=null;break}if(ut!==null){ut.return=Xt,We=ut;break}We=Xt}}}var at=T.alternate;if(at!==null){var li=at.child;if(li!==null){at.child=null;do{var wr=li.sibling;li.sibling=null,li=wr}while(li!==null)}}We=T}}if(T.subtreeFlags&2064&&H!==null)H.return=T,We=H;else e:for(;We!==null;){if(T=We,T.flags&2048)switch(T.tag){case 0:case 11:case 15:_a(9,T,T.return)}var ue=T.sibling;if(ue!==null){ue.return=T.return,We=ue;break e}We=T.return}}var te=l.current;for(We=te;We!==null;){H=We;var me=H.child;if(H.subtreeFlags&2064&&me!==null)me.return=H,We=me;else e:for(H=te;We!==null;){if(ee=We,ee.flags&2048)try{switch(ee.tag){case 0:case 11:case 15:Du(9,ee)}}catch(rt){Ui(ee,ee.return,rt)}if(ee===H){We=null;break e}var je=ee.sibling;if(je!==null){je.return=ee.return,We=je;break e}We=ee.return}}if(Ct=E,ms(),hs&&typeof hs.onPostCommitFiberRoot=="function")try{hs.onPostCommitFiberRoot(uh,l)}catch{}S=!0}return S}finally{Ft=m,_n.transition=c}}return!1}function PE(l,c,m){c=Vv(m,c),c=WM(l,c,1),_o(l,c),c=Mi(),l=$h(l,1),l!==null&&(Su(l,1,c),Oi(l,c))}function Ui(l,c,m){if(l.tag===3)PE(l,l,m);else for(;c!==null;){if(c.tag===3){PE(c,l,m);break}else if(c.tag===1){var S=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof S.componentDidCatch=="function"&&(xo===null||!xo.has(S))){l=Vv(m,l),l=jM(c,l,1),_o(c,l),l=Mi(),c=$h(c,1),c!==null&&(Su(c,1,l),Oi(c,l));break}}c=c.return}}function _N(l,c,m){var S=l.pingCache;S!==null&&S.delete(c),c=Mi(),l.pingedLanes|=l.suspendedLanes&m,Tn===l&&(Zn&m)===m&&(Dn===4||Dn===3&&(Zn&130023424)===Zn&&500>Gn()-ry?xa(l,0):iy|=m),Oi(l,c)}function IE(l,c){c===0&&(l.mode&1?(c=lh,lh<<=1,!(lh&130023424)&&(lh=4194304)):c=1);var m=Mi();l=$h(l,c),l!==null&&(Su(l,c,m),Oi(l,m))}function xN(l){var c=l.memoizedState,m=0;c!==null&&(m=c.retryLane),IE(l,m)}function SN(l,c){var m=0;switch(l.tag){case 13:var S=l.stateNode,E=l.memoizedState;E!==null&&(m=E.retryLane);break;case 19:S=l.stateNode;break;default:throw Error(o(314))}S!==null&&S.delete(c),IE(l,m)}var LE;LE=function(l,c,m){if(l!==null)if(l.memoizedProps!==c.pendingProps||An.current)$i=!0;else{if(!(l.lanes&m)&&!(c.flags&128))return $i=!1,lN(l,c,m);$i=!!(l.flags&131072)}else $i=!1,nn&&c.flags&1048576&&yM(c,_h,c.index);switch(c.lanes=0,c.tag){case 2:var S=c.type;l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),l=c.pendingProps;var E=on(c,Nn.current);Rl(c,m),E=Uv(null,c,S,l,E,m);var T=Fv();return c.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,an(S)?(T=!0,Tl(c)):T=!1,c.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Mv(c),E.updater=vh,c.stateNode=E,E._reactInternals=c,bv(c,S,l,m),c=Wv(null,c,S,!0,T,m)):(c.tag=0,nn&&T&&Av(c),wi(null,c,E,m),c=c.child),c;case 16:S=c.elementType;e:{switch(l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),l=c.pendingProps,E=S._init,S=E(S._payload),c.type=S,E=c.tag=MN(S),l=kr(S,l),E){case 0:c=Gv(null,c,S,l,m);break e;case 1:c=nE(null,c,S,l,m);break e;case 11:c=JM(null,c,S,l,m);break e;case 14:c=KM(null,c,S,kr(S.type,l),m);break e}throw Error(o(306,S,""))}return c;case 0:return S=c.type,E=c.pendingProps,E=c.elementType===S?E:kr(S,E),Gv(l,c,S,E,m);case 1:return S=c.type,E=c.pendingProps,E=c.elementType===S?E:kr(S,E),nE(l,c,S,E,m);case 3:e:{if(iE(c),l===null)throw Error(o(387));S=c.pendingProps,T=c.memoizedState,E=T.element,dM(l,c),gh(c,S,null,m);var H=c.memoizedState;if(S=H.element,be&&T.isDehydrated)if(T={element:S,isDehydrated:!1,cache:H.cache,transitions:H.transitions},c.updateQueue.baseState=T,c.memoizedState=T,c.flags&256){E=Error(o(423)),c=rE(l,c,S,m,E);break e}else if(S!==E){E=Error(o(424)),c=rE(l,c,S,m,E);break e}else for(be&&(Yi=cv(c.stateNode.containerInfo),qi=c,nn=!0,zr=null,wu=!1),m=EM(c,null,S,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Ll(),S===E){c=Vs(l,c,m);break e}wi(l,c,S,m)}c=c.child}return c;case 5:return bM(c),l===null&&Rv(c),S=c.type,E=c.pendingProps,T=l!==null?l.memoizedProps:null,H=E.children,xe(S,E)?H=null:T!==null&&xe(S,T)&&(c.flags|=32),tE(l,c),wi(l,c,H,m),c.child;case 6:return l===null&&Rv(c),null;case 13:return sE(l,c,m);case 4:return Iv(c,c.stateNode.containerInfo),S=c.pendingProps,l===null?c.child=Nl(c,null,S,m):wi(l,c,S,m),c.child;case 11:return S=c.type,E=c.pendingProps,E=c.elementType===S?E:kr(S,E),JM(l,c,S,E,m);case 7:return wi(l,c,c.pendingProps,m),c.child;case 8:return wi(l,c,c.pendingProps.children,m),c.child;case 12:return wi(l,c,c.pendingProps.children,m),c.child;case 10:e:{if(S=c.type._context,E=c.pendingProps,T=c.memoizedProps,H=E.value,uM(c,S,H),T!==null)if(ps(T.value,H)){if(T.children===E.children&&!An.current){c=Vs(l,c,m);break e}}else for(T=c.child,T!==null&&(T.return=c);T!==null;){var ee=T.dependencies;if(ee!==null){H=T.child;for(var _e=ee.firstContext;_e!==null;){if(_e.context===S){if(T.tag===1){_e=Fs(-1,m&-m),_e.tag=2;var ke=T.updateQueue;if(ke!==null){ke=ke.shared;var $e=ke.pending;$e===null?_e.next=_e:(_e.next=$e.next,$e.next=_e),ke.pending=_e}}T.lanes|=m,_e=T.alternate,_e!==null&&(_e.lanes|=m),wv(T.return,m,c),ee.lanes|=m;break}_e=_e.next}}else if(T.tag===10)H=T.type===c.type?null:T.child;else if(T.tag===18){if(H=T.return,H===null)throw Error(o(341));H.lanes|=m,ee=H.alternate,ee!==null&&(ee.lanes|=m),wv(H,m,c),H=T.sibling}else H=T.child;if(H!==null)H.return=T;else for(H=T;H!==null;){if(H===c){H=null;break}if(T=H.sibling,T!==null){T.return=H.return,H=T;break}H=H.return}T=H}wi(l,c,E.children,m),c=c.child}return c;case 9:return E=c.type,S=c.pendingProps.children,Rl(c,m),E=mr(E),S=S(E),c.flags|=1,wi(l,c,S,m),c.child;case 14:return S=c.type,E=kr(S,c.pendingProps),E=kr(S.type,E),KM(l,c,S,E,m);case 15:return QM(l,c,c.type,c.pendingProps,m);case 17:return S=c.type,E=c.pendingProps,E=c.elementType===S?E:kr(S,E),l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),c.tag=1,an(S)?(l=!0,Tl(c)):l=!1,Rl(c,m),gM(c,S,E),bv(c,S,E,m),Wv(null,c,S,!0,l,m);case 19:return cE(l,c,m);case 22:return eE(l,c,m)}throw Error(o(156,c.tag))};function NE(l,c){return mv(l,c)}function wN(l,c,m,S){this.tag=l,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(l,c,m,S){return new wN(l,c,m,S)}function fy(l){return l=l.prototype,!(!l||!l.isReactComponent)}function MN(l){if(typeof l=="function")return fy(l)?1:0;if(l!=null){if(l=l.$$typeof,l===w)return 11;if(l===_)return 14}return 2}function Eo(l,c){var m=l.alternate;return m===null?(m=Sr(l.tag,c,l.key,l.mode),m.elementType=l.elementType,m.type=l.type,m.stateNode=l.stateNode,m.alternate=l,l.alternate=m):(m.pendingProps=c,m.type=l.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=l.flags&14680064,m.childLanes=l.childLanes,m.lanes=l.lanes,m.child=l.child,m.memoizedProps=l.memoizedProps,m.memoizedState=l.memoizedState,m.updateQueue=l.updateQueue,c=l.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=l.sibling,m.index=l.index,m.ref=l.ref,m}function Jh(l,c,m,S,E,T){var H=2;if(S=l,typeof l=="function")fy(l)&&(H=1);else if(typeof l=="string")H=5;else e:switch(l){case f:return Ma(m.children,E,T,c);case h:H=8,E|=8;break;case p:return l=Sr(12,m,c,E|2),l.elementType=p,l.lanes=T,l;case x:return l=Sr(13,m,c,E),l.elementType=x,l.lanes=T,l;case v:return l=Sr(19,m,c,E),l.elementType=v,l.lanes=T,l;case b:return Kh(m,E,T,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case g:H=10;break e;case y:H=9;break e;case w:H=11;break e;case _:H=14;break e;case M:H=16,S=null;break e}throw Error(o(130,l==null?l:typeof l,""))}return c=Sr(H,m,c,E),c.elementType=l,c.type=S,c.lanes=T,c}function Ma(l,c,m,S){return l=Sr(7,l,S,c),l.lanes=m,l}function Kh(l,c,m,S){return l=Sr(22,l,S,c),l.elementType=b,l.lanes=m,l.stateNode={},l}function hy(l,c,m){return l=Sr(6,l,null,c),l.lanes=m,l}function py(l,c,m){return c=Sr(4,l.children!==null?l.children:[],l.key,c),c.lanes=m,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function EN(l,c,m,S,E){this.tag=c,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Qe,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hv(0),this.expirationTimes=hv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hv(0),this.identifierPrefix=S,this.onRecoverableError=E,be&&(this.mutableSourceEagerHydrationData=null)}function DE(l,c,m,S,E,T,H,ee,_e){return l=new EN(l,c,m,ee,_e),c===1?(c=1,T===!0&&(c|=8)):c=0,T=Sr(3,null,null,c),l.current=T,T.stateNode=l,T.memoizedState={element:S,isDehydrated:m,cache:null,transitions:null},Mv(T),l}function OE(l){if(!l)return ri;l=l._reactInternals;e:{if(I(l)!==l||l.tag!==1)throw Error(o(170));var c=l;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(an(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(o(171))}if(l.tag===1){var m=l.type;if(an(m))return Al(l,m,c)}return c}function UE(l){var c=l._reactInternals;if(c===void 0)throw typeof l.render=="function"?Error(o(188)):(l=Object.keys(l).join(","),Error(o(268,l)));return l=G(c),l===null?null:l.stateNode}function FE(l,c){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var m=l.retryLane;l.retryLane=m!==0&&m<c?m:c}}function my(l,c){FE(l,c),(l=l.alternate)&&FE(l,c)}function bN(l){return l=G(l),l===null?null:l.stateNode}function AN(){return null}return t.attemptContinuousHydration=function(l){if(l.tag===13){var c=Mi();xr(l,134217728,c),my(l,134217728)}},t.attemptHydrationAtCurrentPriority=function(l){if(l.tag===13){var c=Mi(),m=wo(l);xr(l,m,c),my(l,m)}},t.attemptSynchronousHydration=function(l){switch(l.tag){case 3:var c=l.stateNode;if(c.current.memoizedState.isDehydrated){var m=xu(c.pendingLanes);m!==0&&(pv(c,m|1),Oi(c,Gn()),!(Ct&6)&&(zl(),ms()))}break;case 13:var S=Mi();bE(function(){return xr(l,1,S)}),my(l,1)}},t.batchedUpdates=function(l,c){var m=Ct;Ct|=1;try{return l(c)}finally{Ct=m,Ct===0&&(zl(),dh&&ms())}},t.createComponentSelector=function(l){return{$$typeof:Fh,value:l}},t.createContainer=function(l,c,m,S,E,T,H){return DE(l,c,!1,null,m,S,E,T,H)},t.createHasPseudoClassSelector=function(l){return{$$typeof:kh,value:l}},t.createHydrationContainer=function(l,c,m,S,E,T,H,ee,_e){return l=DE(m,S,!0,l,E,T,H,ee,_e),l.context=OE(null),m=l.current,S=Mi(),E=wo(m),T=Fs(S,E),T.callback=c??null,_o(m,T),l.current.lanes=E,Su(l,E,S),Oi(l,S),l},t.createPortal=function(l,c,m){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:S==null?null:""+S,children:l,containerInfo:c,implementation:m}},t.createRoleSelector=function(l){return{$$typeof:zh,value:l}},t.createTestNameSelector=function(l){return{$$typeof:Bh,value:l}},t.createTextSelector=function(l){return{$$typeof:Vh,value:l}},t.deferredUpdates=function(l){var c=Ft,m=_n.transition;try{return _n.transition=null,Ft=16,l()}finally{Ft=c,_n.transition=m}},t.discreteUpdates=function(l,c,m,S,E){var T=Ft,H=_n.transition;try{return _n.transition=null,Ft=1,l(c,m,S,E)}finally{Ft=T,_n.transition=H,Ct===0&&zl()}},t.findAllNodes=ty,t.findBoundingRects=function(l,c){if(!R)throw Error(o(363));c=ty(l,c),l=[];for(var m=0;m<c.length;m++)l.push(q(c[m]));for(c=l.length-1;0<c;c--){m=l[c];for(var S=m.x,E=S+m.width,T=m.y,H=T+m.height,ee=c-1;0<=ee;ee--)if(c!==ee){var _e=l[ee],ke=_e.x,$e=ke+_e.width,_t=_e.y,ut=_t+_e.height;if(S>=ke&&T>=_t&&E<=$e&&H<=ut){l.splice(c,1);break}else if(S!==ke||m.width!==_e.width||ut<T||_t>H){if(!(T!==_t||m.height!==_e.height||$e<S||ke>E)){ke>S&&(_e.width+=ke-S,_e.x=S),$e<E&&(_e.width=E-ke),l.splice(c,1);break}}else{_t>T&&(_e.height+=_t-T,_e.y=T),ut<H&&(_e.height=H-_t),l.splice(c,1);break}}}return l},t.findHostInstance=UE,t.findHostInstanceWithNoPortals=function(l){return l=U(l),l=l!==null?Z(l):null,l===null?null:l.stateNode},t.findHostInstanceWithWarning=function(l){return UE(l)},t.flushControlled=function(l){var c=Ct;Ct|=1;var m=_n.transition,S=Ft;try{_n.transition=null,Ft=1,l()}finally{Ft=S,_n.transition=m,Ct=c,Ct===0&&(zl(),ms())}},t.flushPassiveEffects=wa,t.flushSync=bE,t.focusWithin=function(l,c){if(!R)throw Error(o(363));for(l=Kv(l),c=wE(l,c),c=Array.from(c),l=0;l<c.length;){var m=c[l++];if(!ie(m)){if(m.tag===5&&Re(m.stateNode))return!0;for(m=m.child;m!==null;)c.push(m),m=m.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Ft},t.getFindAllNodesFailureDescription=function(l,c){if(!R)throw Error(o(363));var m=0,S=[];l=[Kv(l),0];for(var E=0;E<l.length;){var T=l[E++],H=l[E++],ee=c[H];if((T.tag!==5||!ie(T))&&(Qv(T,ee)&&(S.push(ey(ee)),H++,H>m&&(m=H)),H<c.length))for(T=T.child;T!==null;)l.push(T,H),T=T.sibling}if(m<c.length){for(l=[];m<c.length;m++)l.push(ey(c[m]));return`findAllNodes was able to match part of the selector:
  `+(S.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 ne(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:bN,findFiberByHostInstance:l.findFiberByHostInstance||AN,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 c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled||!c.supportsFiber)l=!0;else{try{uh=c.inject(l),hs=c}catch{}l=!!c.checkDCE}}return l},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(l,c,m,S){if(!R)throw Error(o(363));l=ty(l,c);var E=Pe(l,m,S).disconnect;return{disconnect:function(){E()}}},t.registerMutableSourceForHydration=function(l,c){var m=c._getVersion;m=m(c._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[c,m]:l.mutableSourceEagerHydrationData.push(c,m)},t.runWithPriority=function(l,c){var m=Ft;try{return Ft=l,c()}finally{Ft=m}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(l,c,m,S){var E=c.current,T=Mi(),H=wo(E);return m=OE(m),c.context===null?c.context=m:c.pendingContext=m,c=Fs(T,H),c.payload={element:l},S=S===void 0?null:S,S!==null&&(c.callback=S),_o(E,c),l=xr(E,H,T),l!==null&&mh(l,E,H),H},t}),D_}(function(n){n.exports=c8()})(BI);var u8=i8(BI.exports);const d8=n=>typeof n=="object"&&typeof n.then=="function",Qa=[];function VI(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r<i;r++)if(!t(n[r],e[r]))return!1;return!0}function HI(n,e=null,t=!1,i={}){e===null&&(e=[n]);for(const s of Qa)if(VI(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return i.lifespan&&i.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=Qa.indexOf(r);s!==-1&&Qa.splice(s,1)},promise:(d8(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(Qa.push(r),!t)throw r.promise}const f8=(n,e,t)=>HI(n,e,!1,t),h8=(n,e,t)=>void HI(n,e,!0,t),p8=n=>{if(n===void 0||n.length===0)Qa.splice(0,Qa.length);else{const e=Qa.find(t=>VI(n,t.keys,t.equal));e&&e.remove()}},q1={},m8=n=>void Object.assign(q1,n);function g8(n,e){function t(f,{args:h=[],attach:p,...g},y){let w=`${f[0].toUpperCase()}${f.slice(1)}`,x;if(f==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const v=g.object;x=gc(v,{type:f,root:y,attach:p,primitive:!0})}else{const v=q1[w];if(!v)throw new Error(`R3F: ${w} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");x=gc(new v(...h),{type:f,root:y,attach:p,memoizedProps:{args:h}})}return x.__r3f.attach===void 0&&(x instanceof mt?x.__r3f.attach="geometry":x instanceof ii&&(x.__r3f.attach="material")),w!=="inject"&&F_(x,g),x}function i(f,h){let p=!1;if(h){var g,y;(g=h.__r3f)!=null&&g.attach?U_(f,h,h.__r3f.attach):h.isObject3D&&f.isObject3D&&(f.add(h),p=!0),p||(y=f.__r3f)==null||y.objects.push(h),h.__r3f||gc(h,{}),h.__r3f.parent=f,jS(h),vc(h)}}function r(f,h,p){let g=!1;if(h){var y,w;if((y=h.__r3f)!=null&&y.attach)U_(f,h,h.__r3f.attach);else if(h.isObject3D&&f.isObject3D){h.parent=f,h.dispatchEvent({type:"added"});const x=f.children.filter(_=>_!==h),v=x.indexOf(p);f.children=[...x.slice(0,v),h,...x.slice(v)],g=!0}g||(w=f.__r3f)==null||w.objects.push(h),h.__r3f||gc(h,{}),h.__r3f.parent=f,jS(h),vc(h)}}function s(f,h,p=!1){f&&[...f].forEach(g=>o(h,g,p))}function o(f,h,p){if(h){var g,y,w;if(h.__r3f&&(h.__r3f.parent=null),(g=f.__r3f)!=null&&g.objects&&(f.__r3f.objects=f.__r3f.objects.filter(b=>b!==h)),(y=h.__r3f)!=null&&y.attach)KT(f,h,h.__r3f.attach);else if(h.isObject3D&&f.isObject3D){var x;f.remove(h),(x=h.__r3f)!=null&&x.root&&b8(h.__r3f.root,h)}const _=(w=h.__r3f)==null?void 0:w.primitive,M=p===void 0?h.dispose!==null&&!_:p;if(!_){var v;s((v=h.__r3f)==null?void 0:v.objects,h,M),s(h.children,h,M)}delete h.__r3f,M&&h.dispose&&h.type!=="Scene"&&i0.exports.unstable_scheduleCallback(i0.exports.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),vc(f)}}function a(f,h,p,g){var y;const w=(y=f.__r3f)==null?void 0:y.parent;if(!w)return;const x=t(h,p,f.__r3f.root);if(f.children){for(const v of f.children)v.__r3f&&i(x,v);f.children=f.children.filter(v=>!v.__r3f)}f.__r3f.objects.forEach(v=>i(x,v)),f.__r3f.objects=[],f.__r3f.autoRemovedBeforeAppend||o(w,f),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),i(w,x),x.raycast&&x.__r3f.eventCount&&x.__r3f.root.getState().internal.interaction.push(x),[g,g.alternate].forEach(v=>{v!==null&&(v.stateNode=x,v.ref&&(typeof v.ref=="function"?v.ref(x):v.ref.current=x))})}const u=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:u8({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(f,h)=>{if(!h)return;const p=f.getState().scene;p.__r3f&&(p.__r3f.root=f,i(p,h))},removeChildFromContainer:(f,h)=>{h&&o(f.getState().scene,h)},insertInContainerBefore:(f,h,p)=>{if(!h||!p)return;const g=f.getState().scene;g.__r3f&&r(g,h,p)},getRootHostContext:()=>null,getChildHostContext:f=>f,finalizeInitialChildren(f){var h;return!!((h=f==null?void 0:f.__r3f)!=null?h:{}).handlers},prepareUpdate(f,h,p,g){var y;if(((y=f==null?void 0:f.__r3f)!=null?y:{}).primitive&&g.object&&g.object!==f)return[!0];{const{args:x=[],children:v,..._}=g,{args:M=[],children:b,...N}=p;if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((P,D)=>P!==M[D]))return[!0];const C=$I(f,_,N,!0);return C.changes.length?[!1,C]:null}},commitUpdate(f,[h,p],g,y,w,x){h?a(f,g,w,x):F_(f,p)},commitMount(f,h,p,g){var y;const w=(y=f.__r3f)!=null?y:{};f.raycast&&w.handlers&&w.eventCount&&f.__r3f.root.getState().internal.interaction.push(f)},getPublicInstance:f=>f,prepareForCommit:()=>null,preparePortalMount:f=>gc(f.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(f){var h;const{attach:p,parent:g}=(h=f.__r3f)!=null?h:{};p&&g&&KT(g,f,p),f.isObject3D&&(f.visible=!1),vc(f)},unhideInstance(f,h){var p;const{attach:g,parent:y}=(p=f.__r3f)!=null?p:{};g&&y&&U_(y,f,g),(f.isObject3D&&h.visible==null||h.visible)&&(f.visible=!0),vc(f)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():Ka.exports.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Qt.fun(performance.now)?performance.now:Qt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Qt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Qt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:F_}}var YT,$T;const O_=n=>"colorSpace"in n||"outputColorSpace"in n,GI=()=>{var n;return(n=q1.ColorManagement)!=null?n:null},WI=n=>n&&n.isOrthographicCamera,v8=n=>n&&n.hasOwnProperty("current"),Kf=typeof window<"u"&&((YT=window.document)!=null&&YT.createElement||(($T=window.navigator)==null?void 0:$T.product)==="ReactNative")?we.useLayoutEffect:we.useEffect;function jI(n){const e=we.useRef(n);return Kf(()=>void(e.current=n),[n]),e}function y8({set:n}){return Kf(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}let XI=class extends we.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}};XI.getDerivedStateFromError=()=>({error:!0});const qI="__default",ZT=new Map,_8=n=>n&&!!n.memoized&&!!n.changes;function YI(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 sd=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},Qt={obj:n=>n===Object(n)&&!Qt.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(Qt.str(n)||Qt.num(n))return n===e;const s=Qt.obj(n);if(s&&i==="reference")return n===e;const o=Qt.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(!Qt.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(Qt.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 x8(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function S8(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function gc(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function WS(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 JT=/-\d+$/;function U_(n,e,t){if(Qt.str(t)){if(JT.test(t)){const s=t.replace(JT,""),{target:o,key:a}=WS(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=WS(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function KT(n,e,t){var i,r;if(Qt.str(t)){const{target:s,key:o}=WS(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 $I(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:a,...u}={},d=!1){var f;const h=(f=n==null?void 0:n.__r3f)!=null?f:{},p=Object.entries(r),g=[];if(d){const w=Object.keys(u);for(let x=0;x<w.length;x++)r.hasOwnProperty(w[x])||p.unshift([w[x],qI+"remove"])}p.forEach(([w,x])=>{var v;if((v=n.__r3f)!=null&&v.primitive&&w==="object"||Qt.equ(x,u[w]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(w))return g.push([w,x,!0,[]]);let _=[];w.includes("-")&&(_=w.split("-")),g.push([w,x,!1,_]);for(const M in r){const b=r[M];M.startsWith(`${w}-`)&&g.push([M,b,!1,M.split("-")])}});const y={...r};return h.memoizedProps&&h.memoizedProps.args&&(y.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(y.attach=h.memoizedProps.attach),{memoized:y,changes:g}}const w8=typeof process<"u"&&!1;function F_(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:u,changes:d}=_8(e)?e:$I(n,e),f=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=u);for(let p=0;p<d.length;p++){let[g,y,w,x]=d[p];if(O_(n)){const b="srgb",N="srgb-linear";g==="encoding"?(g="colorSpace",y=y===3001?b:N):g==="outputEncoding"&&(g="outputColorSpace",y=y===3001?b:N)}let v=n,_=v[g];if(x.length&&(_=x.reduce((M,b)=>M[b],n),!(_&&_.set))){const[M,...b]=x.reverse();v=b.reverse().reduce((N,C)=>N[C],n),g=M}if(y===qI+"remove")if(v.constructor){let M=ZT.get(v.constructor);M||(M=new v.constructor,ZT.set(v.constructor,M)),y=M[g]}else y=0;if(w)y?s.handlers[g]=y:delete s.handlers[g],s.eventCount=Object.keys(s.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof ol)){if(Array.isArray(y))_.fromArray?_.fromArray(y):_.set(...y);else if(_.copy&&y&&y.constructor&&(w8?_.constructor.name===y.constructor.name:_.constructor===y.constructor))_.copy(y);else if(y!==void 0){const M=_ instanceof Xe;!M&&_.setScalar?_.setScalar(y):_ instanceof ol&&y instanceof ol?_.mask=y.mask:_.set(y),!GI()&&!a.linear&&M&&_.convertSRGBToLinear()}}else if(v[g]=y,v[g]instanceof hn&&v[g].format===Bi&&v[g].type===Ns){const M=v[g];O_(M)&&O_(a.gl)?M.colorSpace=a.gl.outputColorSpace:M.encoding=a.gl.outputEncoding}vc(n)}if(s.parent&&a.internal&&n.raycast&&f!==s.eventCount){const p=a.internal.interaction.indexOf(n);p>-1&&a.internal.interaction.splice(p,1),s.eventCount&&a.internal.interaction.push(n)}return!(d.length===1&&d[0][0]==="onUpdate")&&d.length&&(r=n.__r3f)!=null&&r.parent&&jS(n),n}function vc(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 jS(n){n.onUpdate==null||n.onUpdate(n)}function M8(n,e){n.manual||(WI(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 pm(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function E8(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ka.exports.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ka.exports.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ka.exports.ContinuousEventPriority;default:return Ka.exports.DefaultEventPriority}}function ZI(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function b8(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)=>{ZI(t.capturedMap,e,i,r)})}function A8(n){function e(u){const{internal:d}=n.getState(),f=u.offsetX-d.initialClick[0],h=u.offsetY-d.initialClick[1];return Math.round(Math.sqrt(f*f+h*h))}function t(u){return u.filter(d=>["Move","Over","Enter","Out","Leave"].some(f=>{var h;return(h=d.__r3f)==null?void 0:h.handlers["onPointer"+f]}))}function i(u,d){const f=n.getState(),h=new Set,p=[],g=d?d(f.internal.interaction):f.internal.interaction;for(let v=0;v<g.length;v++){const _=sd(g[v]);_&&(_.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(u,f);function y(v){const _=sd(v);if(!_||!_.events.enabled||_.raycaster.camera===null)return[];if(_.raycaster.camera===void 0){var M;_.events.compute==null||_.events.compute(u,_,(M=_.previousRoot)==null?void 0:M.getState()),_.raycaster.camera===void 0&&(_.raycaster.camera=null)}return _.raycaster.camera?_.raycaster.intersectObject(v,!0):[]}let w=g.flatMap(y).sort((v,_)=>{const M=sd(v.object),b=sd(_.object);return!M||!b?v.distance-_.distance:b.events.priority-M.events.priority||v.distance-_.distance}).filter(v=>{const _=pm(v);return h.has(_)?!1:(h.add(_),!0)});f.events.filter&&(w=f.events.filter(w,f));for(const v of w){let _=v.object;for(;_;){var x;(x=_.__r3f)!=null&&x.eventCount&&p.push({...v,eventObject:_}),_=_.parent}}if("pointerId"in u&&f.internal.capturedMap.has(u.pointerId))for(let v of f.internal.capturedMap.get(u.pointerId).values())h.has(pm(v.intersection))||p.push(v.intersection);return p}function r(u,d,f,h){const p=n.getState();if(u.length){const g={stopped:!1};for(const y of u){const w=sd(y.object)||p,{raycaster:x,pointer:v,camera:_,internal:M}=w,b=new k(v.x,v.y,0).unproject(_),N=A=>{var U,G;return(U=(G=M.capturedMap.get(A))==null?void 0:G.has(y.eventObject))!=null?U:!1},C=A=>{const U={intersection:y,target:d.target};M.capturedMap.has(A)?M.capturedMap.get(A).set(y.eventObject,U):M.capturedMap.set(A,new Map([[y.eventObject,U]])),d.target.setPointerCapture(A)},P=A=>{const U=M.capturedMap.get(A);U&&ZI(M.capturedMap,y.eventObject,U,A)};let D={};for(let A in d){let U=d[A];typeof U!="function"&&(D[A]=U)}let I={...y,...D,pointer:v,intersections:u,stopped:g.stopped,delta:f,unprojectedPoint:b,ray:x.ray,camera:_,stopPropagation(){const A="pointerId"in d&&M.capturedMap.get(d.pointerId);if((!A||A.has(y.eventObject))&&(I.stopped=g.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(U=>U.eventObject===y.eventObject))){const U=u.slice(0,u.indexOf(y));s([...U,y])}},target:{hasPointerCapture:N,setPointerCapture:C,releasePointerCapture:P},currentTarget:{hasPointerCapture:N,setPointerCapture:C,releasePointerCapture:P},nativeEvent:d};if(h(I),g.stopped===!0)break}}return u}function s(u){const{internal:d}=n.getState();for(const f of d.hovered.values())if(!u.length||!u.find(h=>h.object===f.object&&h.index===f.index&&h.instanceId===f.instanceId)){const p=f.eventObject.__r3f,g=p==null?void 0:p.handlers;if(d.hovered.delete(pm(f)),p!=null&&p.eventCount){const y={...f,intersections:u};g.onPointerOut==null||g.onPointerOut(y),g.onPointerLeave==null||g.onPointerLeave(y)}}}function o(u,d){for(let f=0;f<d.length;f++){const h=d[f].__r3f;h==null||h.handlers.onPointerMissed==null||h.handlers.onPointerMissed(u)}}function a(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return d=>{const{internal:f}=n.getState();"pointerId"in d&&f.capturedMap.has(d.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(d.pointerId)&&(f.capturedMap.delete(d.pointerId),s([]))})}}return function(f){const{onPointerMissed:h,internal:p}=n.getState();p.lastEvent.current=f;const g=u==="onPointerMove",y=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",x=i(f,g?t:void 0),v=y?e(f):0;u==="onPointerDown"&&(p.initialClick=[f.offsetX,f.offsetY],p.initialHits=x.map(M=>M.eventObject)),y&&!x.length&&v<=2&&(o(f,p.interaction),h&&h(f)),g&&s(x);function _(M){const b=M.eventObject,N=b.__r3f,C=N==null?void 0:N.handlers;if(N!=null&&N.eventCount)if(g){if(C.onPointerOver||C.onPointerEnter||C.onPointerOut||C.onPointerLeave){const P=pm(M),D=p.hovered.get(P);D?D.stopped&&M.stopPropagation():(p.hovered.set(P,M),C.onPointerOver==null||C.onPointerOver(M),C.onPointerEnter==null||C.onPointerEnter(M))}C.onPointerMove==null||C.onPointerMove(M)}else{const P=C[u];P?(!y||p.initialHits.includes(b))&&(o(f,p.interaction.filter(D=>!p.initialHits.includes(D))),P(M)):y&&p.initialHits.includes(b)&&o(f,p.interaction.filter(D=>!p.initialHits.includes(D)))}}r(x,f,v,_)}}return{handlePointer:a}}const JI=n=>!!(n!=null&&n.render),KI=we.createContext(null),T8=(n,e)=>{const t=a8((a,u)=>{const d=new k,f=new k,h=new k;function p(v=u().camera,_=f,M=u().size){const{width:b,height:N,top:C,left:P}=M,D=b/N;_ instanceof k?h.copy(_):h.set(..._);const I=v.getWorldPosition(d).distanceTo(h);if(WI(v))return{width:b/v.zoom,height:N/v.zoom,top:C,left:P,factor:1,distance:I,aspect:D};{const A=v.fov*Math.PI/180,U=2*Math.tan(A/2)*I,G=U*(b/N);return{width:G,height:U,top:C,left:P,factor:b/G,distance:I,aspect:D}}}let g;const y=v=>a(_=>({performance:{..._.performance,current:v}})),w=new Ee;return{set:a,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(v=1)=>n(u(),v),advance:(v,_)=>e(v,_,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new G1,pointer:w,mouse:w,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const v=u();g&&clearTimeout(g),v.performance.current!==v.performance.min&&y(v.performance.min),g=setTimeout(()=>y(u().performance.max),v.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:v=>a(_=>({..._,events:{..._.events,...v}})),setSize:(v,_,M,b,N)=>{const C=u().camera,P={width:v,height:_,top:b||0,left:N||0,updateStyle:M};a(D=>({size:P,viewport:{...D.viewport,...p(C,f,P)}}))},setDpr:v=>a(_=>{const M=YI(v);return{viewport:{..._.viewport,dpr:M,initialDpr:_.viewport.initialDpr||M}}}),setFrameloop:(v="always")=>{const _=u().clock;_.stop(),_.elapsedTime=0,v!=="never"&&(_.start(),_.elapsedTime=0),a(()=>({frameloop:v}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:we.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(v,_,M)=>{const b=u().internal;return b.priority=b.priority+(_>0?1:0),b.subscribers.push({ref:v,priority:_,store:M}),b.subscribers=b.subscribers.sort((N,C)=>N.priority-C.priority),()=>{const N=u().internal;N!=null&&N.subscribers&&(N.priority=N.priority-(_>0?1:0),N.subscribers=N.subscribers.filter(C=>C.ref!==v))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:u,viewport:d,gl:f,set:h}=t.getState();if(u.width!==r.width||u.height!==r.height||d.dpr!==s){var p;r=u,s=d.dpr,M8(a,u),f.setPixelRatio(d.dpr);const g=(p=u.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.setSize(u.width,u.height,g)}a!==o&&(o=a,h(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let mm,C8=new Set,R8=new Set,P8=new Set;function k_(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function od(n,e){switch(n){case"before":return k_(C8,e);case"after":return k_(R8,e);case"tail":return k_(P8,e)}}let z_,B_;function V_(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),z_=e.internal.subscribers,mm=0;mm<z_.length;mm++)B_=z_[mm],B_.ref.current(B_.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 I8(n){let e=!1,t,i,r;function s(u){i=requestAnimationFrame(s),e=!0,t=0,od("before",u);for(const f of n.values()){var d;r=f.store.getState(),r.internal.active&&(r.frameloop==="always"||r.internal.frames>0)&&!((d=r.gl.xr)!=null&&d.isPresenting)&&(t+=V_(u,r))}if(od("after",u),t===0)return od("tail",u),e=!1,cancelAnimationFrame(i)}function o(u,d=1){var f;if(!u)return n.forEach(h=>o(h.store.getState()),d);(f=u.gl.xr)!=null&&f.isPresenting||!u.internal.active||u.frameloop==="never"||(u.internal.frames=Math.min(60,u.internal.frames+d),e||(e=!0,requestAnimationFrame(s)))}function a(u,d=!0,f,h){if(d&&od("before",u),f)V_(u,f,h);else for(const p of n.values())V_(u,p.store.getState());d&&od("after",u)}return{loop:s,invalidate:o,advance:a}}function QI(){const n=we.useContext(KI);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function Vd(n=t=>t,e){return QI()(n,e)}function Y1(n,e=0){const t=QI(),i=t.getState().internal.subscribe,r=jI(n);return Kf(()=>i(r,e,t),[e,i,t]),null}const QT=new WeakMap;function eL(n,e){return function(t,...i){let r=QT.get(t);return r||(r=new t,QT.set(t,r)),n&&n(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,u=>{u.scene&&Object.assign(u,x8(u.scene)),o(u)},e,u=>a(new Error(`Could not load ${s}: ${u==null?void 0:u.message}`)))))).finally(()=>r.dispose==null?void 0:r.dispose())}}function $1(n,e,t,i){const r=Array.isArray(e)?e:[e],s=f8(eL(t,i),[n,...r],{equal:Qt.equ});return Array.isArray(e)?s:s[0]}$1.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return h8(eL(t),[n,...i])};$1.clear=function(n,e){const t=Array.isArray(e)?e:[e];return p8([n,...t])};const ou=new Map,{invalidate:eC,advance:tC}=I8(ou),{reconciler:r0,applyProps:cc}=g8(ou,E8),uc={objects:"shallow",strict:!1},L8=(n,e)=>{const t=typeof n=="function"?n(e):n;return JI(t)?t:new j2({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function N8(n,e){const t=typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:s,left:o,updateStyle:a=t}=e;return{width:i,height:r,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:i,height:r,top:s,left:o}=n.parentElement.getBoundingClientRect();return{width:i,height:r,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function D8(n){const e=ou.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||T8(eC,tC),o=t||r0.createContainer(s,Ka.exports.ConcurrentRoot,null,!1,null,"",r,null);e||ou.set(n,{fiber:o,store:s});let a,u=!1,d;return{configure(f={}){let{gl:h,size:p,scene:g,events:y,onCreated:w,shadows:x=!1,linear:v=!1,flat:_=!1,legacy:M=!1,orthographic:b=!1,frameloop:N="always",dpr:C=[1,2],performance:P,raycaster:D,camera:I,onPointerMissed:A}=f,U=s.getState(),G=U.gl;U.gl||U.set({gl:G=L8(h,n)});let z=U.raycaster;z||U.set({raycaster:z=new kI});const{params:Z,...J}=D||{};if(Qt.equ(J,z,uc)||cc(z,{...J}),Qt.equ(Z,z.params,uc)||cc(z,{params:{...z.params,...Z}}),!U.camera||U.camera===d&&!Qt.equ(d,I,uc)){d=I;const ge=I instanceof jf,Ue=ge?I:b?new na(0,0,0,0,.1,1e3):new sn(75,0,.1,1e3);ge||(Ue.position.z=5,I&&cc(Ue,I),!U.camera&&!(I!=null&&I.rotation)&&Ue.lookAt(0,0,0)),U.set({camera:Ue}),z.camera=Ue}if(!U.scene){let ge;g instanceof Ef?ge=g:(ge=new Ef,g&&cc(ge,g)),U.set({scene:gc(ge)})}if(!U.xr){var ne;const ge=(xe,Ae)=>{const Ce=s.getState();Ce.frameloop!=="never"&&tC(xe,!0,Ce,Ae)},Ue=()=>{const xe=s.getState();xe.gl.xr.enabled=xe.gl.xr.isPresenting,xe.gl.xr.setAnimationLoop(xe.gl.xr.isPresenting?ge:null),xe.gl.xr.isPresenting||eC(xe)},se={connect(){const xe=s.getState().gl;xe.xr.addEventListener("sessionstart",Ue),xe.xr.addEventListener("sessionend",Ue)},disconnect(){const xe=s.getState().gl;xe.xr.removeEventListener("sessionstart",Ue),xe.xr.removeEventListener("sessionend",Ue)}};typeof((ne=G.xr)==null?void 0:ne.addEventListener)=="function"&&se.connect(),U.set({xr:se})}if(G.shadowMap){const ge=G.shadowMap.enabled,Ue=G.shadowMap.type;if(G.shadowMap.enabled=!!x,Qt.boo(x))G.shadowMap.type=qc;else if(Qt.str(x)){var le;const se={basic:E3,percentage:L0,soft:qc,variance:$r};G.shadowMap.type=(le=se[x])!=null?le:qc}else Qt.obj(x)&&Object.assign(G.shadowMap,x);(ge!==G.shadowMap.enabled||Ue!==G.shadowMap.type)&&(G.shadowMap.needsUpdate=!0)}const O=GI();O&&("enabled"in O?O.enabled=!M:"legacyMode"in O&&(O.legacyMode=M)),cc(G,{outputEncoding:v?3e3:3001,toneMapping:_?Is:a1}),U.legacy!==M&&U.set(()=>({legacy:M})),U.linear!==v&&U.set(()=>({linear:v})),U.flat!==_&&U.set(()=>({flat:_})),h&&!Qt.fun(h)&&!JI(h)&&!Qt.equ(h,G,uc)&&cc(G,h),y&&!U.events.handlers&&U.set({events:y(s)});const ae=N8(n,p);return Qt.equ(ae,U.size,uc)||U.setSize(ae.width,ae.height,ae.updateStyle,ae.top,ae.left),C&&U.viewport.dpr!==YI(C)&&U.setDpr(C),U.frameloop!==N&&U.setFrameloop(N),U.onPointerMissed||U.set({onPointerMissed:A}),P&&!Qt.equ(P,U.performance,uc)&&U.set(ge=>({performance:{...ge.performance,...P}})),a=w,u=!0,this},render(f){return u||this.configure(),r0.updateContainer(we.createElement(O8,{store:s,children:f,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){tL(n)}}}function O8({store:n,children:e,onCreated:t,rootElement:i}){return Kf(()=>{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)},[]),we.createElement(KI.Provider,{value:n},e)}function tL(n,e){const t=ou.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),r0.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,u;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(),(u=r.gl)!=null&&u.xr&&r.xr.disconnect(),S8(r),ou.delete(n)}catch{}},500)})}}r0.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:we.version});function s0(){return s0=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},s0.apply(this,arguments)}function XS(n,e,t){var i,r,s,o,a;e==null&&(e=100);function u(){var f=Date.now()-o;f<e&&f>=0?i=setTimeout(u,e-f):(i=null,t||(a=n.apply(s,r),s=r=null))}var d=function(){s=this,r=arguments,o=Date.now();var f=t&&!i;return i||(i=setTimeout(u,e)),f&&(a=n.apply(s,r),s=r=null),a};return d.clear=function(){i&&(clearTimeout(i),i=null)},d.flush=function(){i&&(a=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},d}XS.debounce=XS;var nC=XS;function U8(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]=we.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=we.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),d=e?typeof e=="number"?e:e.scroll:null,f=e?typeof e=="number"?e:e.resize:null,h=we.useRef(!1);we.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[p,g,y]=we.useMemo(()=>{const _=()=>{if(!u.current.element)return;const{left:M,top:b,width:N,height:C,bottom:P,right:D,x:I,y:A}=u.current.element.getBoundingClientRect(),U={left:M,top:b,width:N,height:C,bottom:P,right:D,x:I,y:A};u.current.element instanceof HTMLElement&&r&&(U.height=u.current.element.offsetHeight,U.width=u.current.element.offsetWidth),Object.freeze(U),h.current&&!B8(u.current.lastBounds,U)&&a(u.current.lastBounds=U)};return[_,f?nC(_,f):_,d?nC(_,d):_]},[a,r,d,f]);function w(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",y,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null)}function x(){u.current.element&&(u.current.resizeObserver=new s(y),u.current.resizeObserver.observe(u.current.element),t&&u.current.scrollContainers&&u.current.scrollContainers.forEach(_=>_.addEventListener("scroll",y,{capture:!0,passive:!0})))}const v=_=>{!_||_===u.current.element||(w(),u.current.element=_,u.current.scrollContainers=nL(_),x())};return k8(y,!!t),F8(g),we.useEffect(()=>{w(),x()},[t,y,g]),we.useEffect(()=>w,[]),[v,o,p]}function F8(n){we.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function k8(n,e){we.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function nL(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,...nL(n.parentElement)]}const z8=["x","y","top","bottom","left","right","width","height"],B8=(n,e)=>z8.every(t=>n[t]===e[t]);var V8=Object.defineProperty,H8=Object.defineProperties,G8=Object.getOwnPropertyDescriptors,iC=Object.getOwnPropertySymbols,W8=Object.prototype.hasOwnProperty,j8=Object.prototype.propertyIsEnumerable,rC=(n,e,t)=>e in n?V8(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,sC=(n,e)=>{for(var t in e||(e={}))W8.call(e,t)&&rC(n,t,e[t]);if(iC)for(var t of iC(e))j8.call(e,t)&&rC(n,t,e[t]);return n},X8=(n,e)=>H8(n,G8(e));function Z1(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const r=Z1(i,e,t);if(r)return r;i=e?null:i.sibling}}function iL(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const J1=iL(we.createContext(null));class rL extends we.Component{render(){return we.createElement(J1.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:q8,ReactCurrentDispatcher:Y8}=we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function $8(){const n=we.useContext(J1);if(!n)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=we.useId();return we.useMemo(()=>{var i;return(i=q8.current)!=null?i:Z1(n,!1,r=>{let s=r.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}})},[n,e])}const ad=[],oC=new WeakMap;function Z8(){var n;const e=$8();ad.splice(0,ad.length),Z1(e,!0,t=>{var i;const r=(i=t.type)==null?void 0:i._context;r&&r!==J1&&ad.push(iL(r))});for(const t of ad){const i=(n=Y8.current)==null?void 0:n.readContext(t);oC.set(t,i)}return we.useMemo(()=>ad.reduce((t,i)=>r=>we.createElement(t,null,we.createElement(i.Provider,X8(sC({},r),{value:oC.get(i)}))),t=>we.createElement(rL,sC({},t))),[])}const H_={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 J8(n){const{handlePointer:e}=A8(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(H_).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[u,d]=H_[o];t.addEventListener(u,a,{passive:d})})},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]=H_[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const K8=we.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=J8,eventSource:a,eventPrefix:u,shadows:d,linear:f,flat:h,legacy:p,orthographic:g,frameloop:y,dpr:w,performance:x,raycaster:v,camera:_,scene:M,onPointerMissed:b,onCreated:N,...C},P){we.useMemo(()=>m8(t8),[]);const D=Z8(),[I,A]=U8({scroll:!0,debounce:{scroll:50,resize:0},...i}),U=we.useRef(null),G=we.useRef(null);we.useImperativeHandle(P,()=>U.current);const z=jI(b),[Z,J]=we.useState(!1),[ne,le]=we.useState(!1);if(Z)throw Z;if(ne)throw ne;const O=we.useRef(null);Kf(()=>{const K=U.current;A.width>0&&A.height>0&&K&&(O.current||(O.current=D8(K)),O.current.configure({gl:s,events:o,shadows:d,linear:f,flat:h,legacy:p,orthographic:g,frameloop:y,dpr:w,performance:x,raycaster:v,camera:_,scene:M,size:A,onPointerMissed:(...ae)=>z.current==null?void 0:z.current(...ae),onCreated:ae=>{ae.events.connect==null||ae.events.connect(a?v8(a)?a.current:a:G.current),u&&ae.setEvents({compute:(ge,Ue)=>{const se=ge[u+"X"],xe=ge[u+"Y"];Ue.pointer.set(se/Ue.size.width*2-1,-(xe/Ue.size.height)*2+1),Ue.raycaster.setFromCamera(Ue.pointer,Ue.camera)}}),N==null||N(ae)}}),O.current.render(we.createElement(D,null,we.createElement(XI,{set:le},we.createElement(we.Suspense,{fallback:we.createElement(y8,{set:J})},e)))))}),we.useEffect(()=>{const K=U.current;if(K)return()=>tL(K)},[]);const Y=a?"none":"auto";return we.createElement("div",s0({ref:G,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Y,...r}},C),we.createElement("div",{ref:I,style:{width:"100%",height:"100%"}},we.createElement("canvas",{ref:U,style:{display:"block"}},t)))}),Q8=we.forwardRef(function(e,t){return we.createElement(rL,null,we.createElement(K8,s0({},e,{ref:t})))});let e6=class extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new ls(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(u){r?r(u):console.error(u),s.manager.itemError(e)}},i,r)}parse(e){function t(d){const f=new DataView(d),h=32/8*3+32/8*3*3+16/8,p=f.getUint32(80,!0);if(80+32/8+p*h===f.byteLength)return!0;const y=[115,111,108,105,100];for(let w=0;w<5;w++)if(i(y,f,w))return!1;return!0}function i(d,f,h){for(let p=0,g=d.length;p<g;p++)if(d[p]!==f.getUint8(h+p,!1))return!1;return!0}function r(d){const f=new DataView(d),h=f.getUint32(80,!0);let p,g,y,w=!1,x,v,_,M,b;for(let A=0;A<70;A++)f.getUint32(A,!1)==1129270351&&f.getUint8(A+4)==82&&f.getUint8(A+5)==61&&(w=!0,x=new Float32Array(h*3*3),v=f.getUint8(A+6)/255,_=f.getUint8(A+7)/255,M=f.getUint8(A+8)/255,b=f.getUint8(A+9)/255);const N=84,C=12*4+2,P=new mt,D=new Float32Array(h*3*3),I=new Float32Array(h*3*3);for(let A=0;A<h;A++){const U=N+A*C,G=f.getFloat32(U,!0),z=f.getFloat32(U+4,!0),Z=f.getFloat32(U+8,!0);if(w){const J=f.getUint16(U+48,!0);J&32768?(p=v,g=_,y=M):(p=(J&31)/31,g=(J>>5&31)/31,y=(J>>10&31)/31)}for(let J=1;J<=3;J++){const ne=U+J*12,le=A*3*3+(J-1)*3;D[le]=f.getFloat32(ne,!0),D[le+1]=f.getFloat32(ne+4,!0),D[le+2]=f.getFloat32(ne+8,!0),I[le]=G,I[le+1]=z,I[le+2]=Z,w&&(x[le]=p,x[le+1]=g,x[le+2]=y)}}return P.setAttribute("position",new Lt(D,3)),P.setAttribute("normal",new Lt(I,3)),w&&(P.setAttribute("color",new Lt(x,3)),P.hasColors=!0,P.alpha=b),P}function s(d){const f=new mt,h=/solid([\s\S]*?)endsolid/g,p=/facet([\s\S]*?)endfacet/g;let g=0;const y=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,w=new RegExp("vertex"+y+y+y,"g"),x=new RegExp("normal"+y+y+y,"g"),v=[],_=[],M=new k;let b,N=0,C=0,P=0;for(;(b=h.exec(d))!==null;){C=P;const D=b[0];for(;(b=p.exec(D))!==null;){let U=0,G=0;const z=b[0];for(;(b=x.exec(z))!==null;)M.x=parseFloat(b[1]),M.y=parseFloat(b[2]),M.z=parseFloat(b[3]),G++;for(;(b=w.exec(z))!==null;)v.push(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3])),_.push(M.x,M.y,M.z),U++,P++;G!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+g),U!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+g),g++}const I=C,A=P-C;f.addGroup(I,A,N),N++}return f.setAttribute("position",new Ze(v,3)),f.setAttribute("normal",new Ze(_,3)),f}function o(d){return typeof d!="string"?n0.decodeText(new Uint8Array(d)):d}function a(d){if(typeof d=="string"){const f=new Uint8Array(d.length);for(let h=0;h<d.length;h++)f[h]=d.charCodeAt(h)&255;return f.buffer||f}else return d}const u=a(e);return t(u)?r(u):s(o(e))}};var t6=function(){function n(){}return n.prototype.parse=function(e,t){t===void 0&&(t={});var i=t.binary!==void 0?t.binary:!1,r=[],s=0;e.traverse(function(z){if(z.isMesh){var Z=z.geometry;if(Z.isBufferGeometry!==!0)throw new Error("THREE.STLExporter: Geometry is not of type THREE.BufferGeometry.");var J=Z.index,ne=Z.getAttribute("position");s+=J!==null?J.count/3:ne.count/3,r.push({object3d:z,geometry:Z})}});var o,a=80;if(i===!0){var u=s*2+s*3*4*4+80+4,d=new ArrayBuffer(u);o=new DataView(d),o.setUint32(a,s,!0),a+=4}else o="",o+=`solid exported
`;for(var f=new k,h=new k,p=new k,g=new k,y=new k,w=new k,x=0,v=r.length;x<v;x++){var _=r[x].object3d,M=r[x].geometry,b=M.index,N=M.getAttribute("position");if(b!==null)for(var C=0;C<b.count;C+=3){var P=b.getX(C+0),D=b.getX(C+1),I=b.getX(C+2);A(P,D,I,N,_)}else for(var C=0;C<N.count;C+=3){var P=C+0,D=C+1,I=C+2;A(P,D,I,N,_)}}return i===!1&&(o+=`endsolid exported
`),o;function A(z,Z,J,ne,le){f.fromBufferAttribute(ne,z),h.fromBufferAttribute(ne,Z),p.fromBufferAttribute(ne,J),le.isSkinnedMesh===!0&&(le.boneTransform(z,f),le.boneTransform(Z,h),le.boneTransform(J,p)),f.applyMatrix4(le.matrixWorld),h.applyMatrix4(le.matrixWorld),p.applyMatrix4(le.matrixWorld),U(f,h,p),G(f),G(h),G(p),i===!0?(o.setUint16(a,0,!0),a+=2):(o+=`		endloop
`,o+=`	endfacet
`)}function U(z,Z,J){g.subVectors(J,Z),y.subVectors(z,Z),g.cross(y).normalize(),w.copy(g).normalize(),i===!0?(o.setFloat32(a,w.x,!0),a+=4,o.setFloat32(a,w.y,!0),a+=4,o.setFloat32(a,w.z,!0),a+=4):(o+="	facet normal "+w.x+" "+w.y+" "+w.z+`
`,o+=`		outer loop
`)}function G(z){i===!0?(o.setFloat32(a,z.x,!0),a+=4,o.setFloat32(a,z.y,!0),a+=4,o.setFloat32(a,z.z,!0),a+=4):o+="			vertex "+z.x+" "+z.y+" "+z.z+`
`}},n}(),n6=function(n){var e=n.scale,t=e===void 0?1:e,i=n.visible,r=i===void 0?!1:i,s=n.geometry,o=n.meshProps,a=n.materialProps,u=a.opacity,d=u===void 0?1:u,f=Nf(a,["opacity"]),h=n.onLoaded,p=Nf(n,["scale","visible","geometry","meshProps","materialProps","onLoaded"]),g=we.useRef(null),y=we.useRef(null),w=we.useState(!1),x=w[0],v=w[1];return we.useEffect(function(){v(!0)},[s]),Y1(function(){var _;if(!(!x||s.boundingSphere==null||g.current==null||y.current==null)){new ei().setFromObject(g.current);var M=(_=s.boundingBox)!==null&&_!==void 0?_:{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}},b=M.min,N=M.max;s.computeVertexNormals();var C={width:N.x-b.x,length:N.y-b.y,height:N.z-b.z};s.applyMatrix4(new ht().makeTranslation(-b.x-C.width/2,-b.y-C.length/2,-b.z-C.height/2)),h(Cr(Cr({},C),{boundingRadius:s.boundingSphere.radius}),g.current,y.current),v(!1)}}),Me.createElement("group",Cr({ref:y},p),Me.createElement("mesh",Cr({ref:g,scale:[t,t,t],castShadow:!0},o),Me.createElement("primitive",{object:s,attach:"geometry"}),Me.createElement("meshStandardMaterial",Cr({side:Qr,opacity:r?d:0},f))))},aC=Math.pow(2,16),i6=function(n){var e=n.visible,t=e===void 0?!1:e,i=n.width,r=n.length,s=n.noShadow,o=s===void 0?!1:s,a=n.offset,u=a===void 0?0:a,d=Nf(n,["visible","width","length","noShadow","offset"]),f=[(i??0)/2,(r??0)/2,-u],h=[i??aC,r??aC,Math.floor((i??20)/20),Math.floor((r??20)/20)];return t?Me.createElement("group",Cr({},d),i!=null&&r!=null&&Me.createElement("mesh",{receiveShadow:!0,position:f},Me.createElement("planeGeometry",{args:h}),Me.createElement("meshStandardMaterial",{wireframe:!0,color:"#777"})),!o&&Me.createElement("mesh",{receiveShadow:!0,position:f},Me.createElement("planeGeometry",{args:h}),Me.createElement("shadowMaterial",{opacity:.2}))):null},r6=function(n){var e=n.offsetX,t=e===void 0?0:e,i=n.offsetY,r=i===void 0?0:i,s=n.offsetZ,o=s===void 0?0:s,a=n.distance;return Me.createElement(Me.Fragment,null,Me.createElement("ambientLight",null),Me.createElement("spotLight",{castShadow:!0,position:[t,r,a+o]}),[[-a+t,r,a+o],[t,-a+r,a+o],[t,a+r,o]].map(function(u,d){return Me.createElement("directionalLight",{key:d,intensity:2,position:u})}))};function lC(n,e,t){return Math.max(Math.min(e,t),n)}var gm=.01;function sL(n){var e=lC(-Math.PI/2+gm,n.latitude,Math.PI/2-gm),t=lC(-Math.PI+gm,n.longitude,Math.PI-gm);return[n.distance*Math.cos(e)*Math.sin(t),-n.distance*Math.cos(t)*Math.cos(e),n.distance*Math.sin(e)]}var s6=function(n){var e=n.initialPosition,t=n.center,i=Nf(n,["initialPosition","center"]),r=Vd().camera;return we.useEffect(function(){r.up.applyAxisAngle(new k(1,0,0),Math.PI/2)},[r]),we.useEffect(function(){var s=sL(e);r.position.set(s[0]+t[0],s[1]+t[1],s[2]+t[2]),r.lookAt.apply(r,t)},[r,t]),Me.createElement("perspectiveCamera",Cr({near:1,far:1e3},i))};function Df(n){"@babel/helpers - typeof";return Df=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},Df(n)}function o6(n,e){if(Df(n)!=="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(Df(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function a6(n){var e=o6(n,"string");return Df(e)==="symbol"?e:String(e)}function St(n,e,t){return e=a6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}const cC=(n,e)=>(n%e+e)%e;let l6=class extends Ds{constructor(e,t){super(),St(this,"object",void 0),St(this,"domElement",void 0),St(this,"enabled",!0),St(this,"target",new k),St(this,"minDistance",0),St(this,"maxDistance",1/0),St(this,"minZoom",0),St(this,"maxZoom",1/0),St(this,"minPolarAngle",0),St(this,"maxPolarAngle",Math.PI),St(this,"minAzimuthAngle",-1/0),St(this,"maxAzimuthAngle",1/0),St(this,"enableDamping",!1),St(this,"dampingFactor",.05),St(this,"enableZoom",!0),St(this,"zoomSpeed",1),St(this,"enableRotate",!0),St(this,"rotateSpeed",1),St(this,"enablePan",!0),St(this,"panSpeed",1),St(this,"screenSpacePanning",!0),St(this,"keyPanSpeed",7),St(this,"autoRotate",!1),St(this,"autoRotateSpeed",2),St(this,"reverseOrbit",!1),St(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),St(this,"mouseButtons",{LEFT:ka.ROTATE,MIDDLE:ka.DOLLY,RIGHT:ka.PAN}),St(this,"touches",{ONE:za.ROTATE,TWO:za.DOLLY_PAN}),St(this,"target0",void 0),St(this,"position0",void 0),St(this,"zoom0",void 0),St(this,"_domElementKeyEvents",null),St(this,"getPolarAngle",void 0),St(this,"getAzimuthalAngle",void 0),St(this,"setPolarAngle",void 0),St(this,"setAzimuthalAngle",void 0),St(this,"getDistance",void 0),St(this,"listenToKeyEvents",void 0),St(this,"saveState",void 0),St(this,"reset",void 0),St(this,"update",void 0),St(this,"connect",void 0),St(this,"dispose",void 0),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object instanceof sn?this.object.zoom:1,this.getPolarAngle=()=>f.phi,this.getAzimuthalAngle=()=>f.theta,this.setPolarAngle=W=>{let oe=cC(W,2*Math.PI),Ie=f.phi;Ie<0&&(Ie+=2*Math.PI),oe<0&&(oe+=2*Math.PI);let ze=Math.abs(oe-Ie);2*Math.PI-ze<ze&&(oe<Ie?oe+=2*Math.PI:Ie+=2*Math.PI),h.phi=oe-Ie,i.update()},this.setAzimuthalAngle=W=>{let oe=cC(W,2*Math.PI),Ie=f.theta;Ie<0&&(Ie+=2*Math.PI),oe<0&&(oe+=2*Math.PI);let ze=Math.abs(oe-Ie);2*Math.PI-ze<ze&&(oe<Ie?oe+=2*Math.PI:Ie+=2*Math.PI),h.theta=oe-Ie,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=W=>{W.addEventListener("keydown",ie),this._domElementKeyEvents=W},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object instanceof sn?i.object.zoom:1},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object instanceof sn&&(i.object.zoom=i.zoom0,i.object.updateProjectionMatrix()),i.dispatchEvent(r),i.update(),u=a.NONE},this.update=(()=>{const W=new k,oe=new gi().setFromUnitVectors(e.up,new k(0,1,0)),Ie=oe.clone().invert(),ze=new k,ot=new gi,Ke=2*Math.PI;return function(){const ve=i.object.position;W.copy(ve).sub(i.target),W.applyQuaternion(oe),f.setFromVector3(W),i.autoRotate&&u===a.NONE&&G(A()),i.enableDamping?(f.theta+=h.theta*i.dampingFactor,f.phi+=h.phi*i.dampingFactor):(f.theta+=h.theta,f.phi+=h.phi);let ce=i.minAzimuthAngle,Le=i.maxAzimuthAngle;return isFinite(ce)&&isFinite(Le)&&(ce<-Math.PI?ce+=Ke:ce>Math.PI&&(ce-=Ke),Le<-Math.PI?Le+=Ke:Le>Math.PI&&(Le-=Ke),ce<=Le?f.theta=Math.max(ce,Math.min(Le,f.theta)):f.theta=f.theta>(ce+Le)/2?Math.max(ce,f.theta):Math.min(Le,f.theta)),f.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,f.phi)),f.makeSafe(),f.radius*=p,f.radius=Math.max(i.minDistance,Math.min(i.maxDistance,f.radius)),i.enableDamping===!0?i.target.addScaledVector(g,i.dampingFactor):i.target.add(g),W.setFromSpherical(f),W.applyQuaternion(Ie),ve.copy(i.target).add(W),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,g.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),g.set(0,0,0)),p=1,y||ze.distanceToSquared(i.object.position)>d||8*(1-ot.dot(i.object.quaternion))>d?(i.dispatchEvent(r),ze.copy(i.object.position),ot.copy(i.object.quaternion),y=!1,!0):!1}})(),this.connect=W=>{W===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.domElement=W,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",Pe),i.domElement.addEventListener("pointerdown",He),i.domElement.addEventListener("pointercancel",R),i.domElement.addEventListener("wheel",$)},this.dispose=()=>{var W,oe,Ie,ze,ot,Ke;(W=i.domElement)===null||W===void 0||W.removeEventListener("contextmenu",Pe),(oe=i.domElement)===null||oe===void 0||oe.removeEventListener("pointerdown",He),(Ie=i.domElement)===null||Ie===void 0||Ie.removeEventListener("pointercancel",R),(ze=i.domElement)===null||ze===void 0||ze.removeEventListener("wheel",$),(ot=i.domElement)===null||ot===void 0||ot.ownerDocument.removeEventListener("pointermove",V),(Ke=i.domElement)===null||Ke===void 0||Ke.ownerDocument.removeEventListener("pointerup",L),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",ie)};const i=this,r={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=a.NONE;const d=1e-6,f=new HS,h=new HS;let p=1;const g=new k;let y=!1;const w=new Ee,x=new Ee,v=new Ee,_=new Ee,M=new Ee,b=new Ee,N=new Ee,C=new Ee,P=new Ee,D=[],I={};function A(){return 2*Math.PI/60/60*i.autoRotateSpeed}function U(){return Math.pow(.95,i.zoomSpeed)}function G(W){i.reverseOrbit?h.theta+=W:h.theta-=W}function z(W){i.reverseOrbit?h.phi+=W:h.phi-=W}const Z=(()=>{const W=new k;return function(Ie,ze){W.setFromMatrixColumn(ze,0),W.multiplyScalar(-Ie),g.add(W)}})(),J=(()=>{const W=new k;return function(Ie,ze){i.screenSpacePanning===!0?W.setFromMatrixColumn(ze,1):(W.setFromMatrixColumn(ze,0),W.crossVectors(i.object.up,W)),W.multiplyScalar(Ie),g.add(W)}})(),ne=(()=>{const W=new k;return function(Ie,ze){const ot=i.domElement;if(ot&&i.object instanceof sn&&i.object.isPerspectiveCamera){const Ke=i.object.position;W.copy(Ke).sub(i.target);let j=W.length();j*=Math.tan(i.object.fov/2*Math.PI/180),Z(2*Ie*j/ot.clientHeight,i.object.matrix),J(2*ze*j/ot.clientHeight,i.object.matrix)}else ot&&i.object instanceof na&&i.object.isOrthographicCamera?(Z(Ie*(i.object.right-i.object.left)/i.object.zoom/ot.clientWidth,i.object.matrix),J(ze*(i.object.top-i.object.bottom)/i.object.zoom/ot.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function le(W){i.object instanceof sn&&i.object.isPerspectiveCamera?p/=W:i.object instanceof na&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*W)),i.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function O(W){i.object instanceof sn&&i.object.isPerspectiveCamera?p*=W:i.object instanceof na&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/W)),i.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Y(W){w.set(W.clientX,W.clientY)}function K(W){N.set(W.clientX,W.clientY)}function ae(W){_.set(W.clientX,W.clientY)}function ge(W){x.set(W.clientX,W.clientY),v.subVectors(x,w).multiplyScalar(i.rotateSpeed);const oe=i.domElement;oe&&(G(2*Math.PI*v.x/oe.clientHeight),z(2*Math.PI*v.y/oe.clientHeight)),w.copy(x),i.update()}function Ue(W){C.set(W.clientX,W.clientY),P.subVectors(C,N),P.y>0?le(U()):P.y<0&&O(U()),N.copy(C),i.update()}function se(W){M.set(W.clientX,W.clientY),b.subVectors(M,_).multiplyScalar(i.panSpeed),ne(b.x,b.y),_.copy(M),i.update()}function xe(W){W.deltaY<0?O(U()):W.deltaY>0&&le(U()),i.update()}function Ae(W){let oe=!1;switch(W.code){case i.keys.UP:ne(0,i.keyPanSpeed),oe=!0;break;case i.keys.BOTTOM:ne(0,-i.keyPanSpeed),oe=!0;break;case i.keys.LEFT:ne(i.keyPanSpeed,0),oe=!0;break;case i.keys.RIGHT:ne(-i.keyPanSpeed,0),oe=!0;break}oe&&(W.preventDefault(),i.update())}function Ce(){if(D.length==1)w.set(D[0].pageX,D[0].pageY);else{const W=.5*(D[0].pageX+D[1].pageX),oe=.5*(D[0].pageY+D[1].pageY);w.set(W,oe)}}function tt(){if(D.length==1)_.set(D[0].pageX,D[0].pageY);else{const W=.5*(D[0].pageX+D[1].pageX),oe=.5*(D[0].pageY+D[1].pageY);_.set(W,oe)}}function Qe(){const W=D[0].pageX-D[1].pageX,oe=D[0].pageY-D[1].pageY,Ie=Math.sqrt(W*W+oe*oe);N.set(0,Ie)}function Q(){i.enableZoom&&Qe(),i.enablePan&&tt()}function nt(){i.enableZoom&&Qe(),i.enableRotate&&Ce()}function pe(W){if(D.length==1)x.set(W.pageX,W.pageY);else{const Ie=ct(W),ze=.5*(W.pageX+Ie.x),ot=.5*(W.pageY+Ie.y);x.set(ze,ot)}v.subVectors(x,w).multiplyScalar(i.rotateSpeed);const oe=i.domElement;oe&&(G(2*Math.PI*v.x/oe.clientHeight),z(2*Math.PI*v.y/oe.clientHeight)),w.copy(x)}function be(W){if(D.length==1)M.set(W.pageX,W.pageY);else{const oe=ct(W),Ie=.5*(W.pageX+oe.x),ze=.5*(W.pageY+oe.y);M.set(Ie,ze)}b.subVectors(M,_).multiplyScalar(i.panSpeed),ne(b.x,b.y),_.copy(M)}function Se(W){const oe=ct(W),Ie=W.pageX-oe.x,ze=W.pageY-oe.y,ot=Math.sqrt(Ie*Ie+ze*ze);C.set(0,ot),P.set(0,Math.pow(C.y/N.y,i.zoomSpeed)),le(P.y),N.copy(C)}function Fe(W){i.enableZoom&&Se(W),i.enablePan&&be(W)}function Te(W){i.enableZoom&&Se(W),i.enableRotate&&pe(W)}function He(W){if(i.enabled!==!1){if(D.length===0){var oe,Ie;(oe=i.domElement)===null||oe===void 0||oe.ownerDocument.addEventListener("pointermove",V),(Ie=i.domElement)===null||Ie===void 0||Ie.ownerDocument.addEventListener("pointerup",L)}st(W),W.pointerType==="touch"?Ne(W):X(W)}}function V(W){i.enabled!==!1&&(W.pointerType==="touch"?Re(W):q(W))}function L(W){if(De(W),D.length===0){var oe,Ie,ze;(oe=i.domElement)===null||oe===void 0||oe.releasePointerCapture(W.pointerId),(Ie=i.domElement)===null||Ie===void 0||Ie.ownerDocument.removeEventListener("pointermove",V),(ze=i.domElement)===null||ze===void 0||ze.ownerDocument.removeEventListener("pointerup",L)}i.dispatchEvent(o),u=a.NONE}function R(W){De(W)}function X(W){let oe;switch(W.button){case 0:oe=i.mouseButtons.LEFT;break;case 1:oe=i.mouseButtons.MIDDLE;break;case 2:oe=i.mouseButtons.RIGHT;break;default:oe=-1}switch(oe){case ka.DOLLY:if(i.enableZoom===!1)return;K(W),u=a.DOLLY;break;case ka.ROTATE:if(W.ctrlKey||W.metaKey||W.shiftKey){if(i.enablePan===!1)return;ae(W),u=a.PAN}else{if(i.enableRotate===!1)return;Y(W),u=a.ROTATE}break;case ka.PAN:if(W.ctrlKey||W.metaKey||W.shiftKey){if(i.enableRotate===!1)return;Y(W),u=a.ROTATE}else{if(i.enablePan===!1)return;ae(W),u=a.PAN}break;default:u=a.NONE}u!==a.NONE&&i.dispatchEvent(s)}function q(W){if(i.enabled!==!1)switch(u){case a.ROTATE:if(i.enableRotate===!1)return;ge(W);break;case a.DOLLY:if(i.enableZoom===!1)return;Ue(W);break;case a.PAN:if(i.enablePan===!1)return;se(W);break}}function $(W){i.enabled===!1||i.enableZoom===!1||u!==a.NONE&&u!==a.ROTATE||(W.preventDefault(),i.dispatchEvent(s),xe(W),i.dispatchEvent(o))}function ie(W){i.enabled===!1||i.enablePan===!1||Ae(W)}function Ne(W){switch(qe(W),D.length){case 1:switch(i.touches.ONE){case za.ROTATE:if(i.enableRotate===!1)return;Ce(),u=a.TOUCH_ROTATE;break;case za.PAN:if(i.enablePan===!1)return;tt(),u=a.TOUCH_PAN;break;default:u=a.NONE}break;case 2:switch(i.touches.TWO){case za.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Q(),u=a.TOUCH_DOLLY_PAN;break;case za.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;nt(),u=a.TOUCH_DOLLY_ROTATE;break;default:u=a.NONE}break;default:u=a.NONE}u!==a.NONE&&i.dispatchEvent(s)}function Re(W){switch(qe(W),u){case a.TOUCH_ROTATE:if(i.enableRotate===!1)return;pe(W),i.update();break;case a.TOUCH_PAN:if(i.enablePan===!1)return;be(W),i.update();break;case a.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Fe(W),i.update();break;case a.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Te(W),i.update();break;default:u=a.NONE}}function Pe(W){i.enabled!==!1&&W.preventDefault()}function st(W){D.push(W)}function De(W){delete I[W.pointerId];for(let oe=0;oe<D.length;oe++)if(D[oe].pointerId==W.pointerId){D.splice(oe,1);return}}function qe(W){let oe=I[W.pointerId];oe===void 0&&(oe=new Ee,I[W.pointerId]=oe),oe.set(W.pageX,W.pageY)}function ct(W){const oe=W.pointerId===D[0].pointerId?D[1]:D[0];return I[oe.pointerId]}t!==void 0&&this.connect(t),this.update()}};var c6=function(n){var e,t=Vd(function(a){return a.camera}),i=we.useMemo(function(){return new l6(t)},[t]),r=Vd(function(a){return a.gl}),s=Vd(function(a){return a.events}),o=(e=s.connected)!==null&&e!==void 0?e:r.domElement;return we.useEffect(function(){return i.connect(o),function(){return i.dispose()}}),Y1(function(){i.update()},-1),we.createElement("primitive",Cr({object:i},n))},u6=Math.PI/8,d6=-Math.PI/8,f6=3,h6=350,p6=.4,m6=new Xe("white"),g6=function(n){var e=n.url,t=n.extraHeaders,i=n.shadows,r=i===void 0?!1:i,s=n.showAxes,o=s===void 0?!1:s,a=n.orbitControls,u=a===void 0?!1:a,d=n.onFinishLoading,f=d===void 0?function(){}:d,h=n.cameraInitialPosition,p=h===void 0?{}:h,g=p.latitude,y=p.longitude,w=p.distance,x=n.cameraProps,v=x===void 0?{}:x,_=v.ref,M=v.initialPosition,b=M===void 0?{}:M,N=b.latitude,C=N===void 0?u6:N,P=b.longitude,D=P===void 0?d6:P,I=b.distance,A=I===void 0?void 0:I,U=n.modelProps,G=U===void 0?{}:U,z=G.ref,Z=G.scale,J=Z===void 0?1:Z,ne=G.positionX,le=G.positionY,O=G.rotationX,Y=O===void 0?0:O,K=G.rotationY,ae=K===void 0?0:K,ge=G.rotationZ,Ue=ge===void 0?0:ge,se=G.color,xe=se===void 0?"grey":se,Ae=G.geometryProcessor,Ce=n.floorProps,tt=Ce===void 0?{}:Ce,Qe=tt.gridWidth,Q=tt.gridLength,nt=Vd().camera,pe=we.useState(),be=pe[0],Se=pe[1],Fe=we.useState({width:0,height:0,length:0,boundingRadius:0}),Te=Fe[0],He=Fe[1],V=we.useState(),L=V[0],R=V[1],X=we.useState([0,0,0]),q=X[0],$=X[1],ie=we.useState(!1),Ne=ie[0],Re=ie[1];we.useEffect(function(){Re(!1)},[e]);var Pe=$1(e6,e,function(W){return W.setRequestHeader(t??{})}),st=we.useMemo(function(){var W;return(W=Ae==null?void 0:Ae(Pe))!==null&&W!==void 0?W:Pe},[Pe,Ae]);function De(W,oe){var Ie=Math.max(Qe??0,Q??0);return Ie>0?Ie*(oe??1):W*(oe??f6)}function qe(W,oe){Se(oe);var Ie=W.width,ze=W.length,ot=W.height,Ke=W.boundingRadius;He(W),$([ne??Ie/2,le??ze/2,ot/2]),R({latitude:g??C,longitude:y??D,distance:De(Ke,w??A)}),f(W),setTimeout(function(){return Re(!0)},100)}we.useEffect(function(){_!=null&&(_.current={setCameraPosition:function(W){var oe=W.latitude,Ie=W.longitude,ze=W.distance,ot=De(Te.boundingRadius,ze),Ke=sL({latitude:oe,longitude:Ie,distance:ot}),j=Ke[0],ve=Ke[1],ce=Ke[2],Le=q[0],Be=q[1],wt=q[2];nt.position.set(j+Le,ve+Be,ce+wt),nt.lookAt(Le,Be,wt)}})},[nt,_,q,Te]),we.useEffect(function(){z==null||be==null||(z.current={save:function(){return new Blob([new t6().parse(be,{binary:!0})],{type:"application/octet-stream"})},model:be})},[be,z]),Y1(function(W){var oe=W.scene,Ie=oe.getObjectByName("mesh"),ze=oe.getObjectByName("group"),ot=new ei().setFromObject(Ie),Ke=ot.max.z-ot.min.z;ze.position.z=Ke/2});var ct=[ne??Te.width*J/2,le??Te.length*J/2,0];return Me.createElement(Me.Fragment,null,Me.createElement("scene",{background:m6}),Ne&&o&&Me.createElement("axesHelper",{scale:[50,50,50]}),L!=null&&Me.createElement(s6,{initialPosition:L,center:q}),Me.createElement(n6,{name:"group",meshProps:{name:"mesh"},scale:J,geometry:st,position:ct,rotation:[Y,ae,Ue],visible:Ne,materialProps:{color:xe},onLoaded:qe}),Me.createElement(i6,{width:Qe??Q,length:Q??Qe,visible:Ne,noShadow:!r,offset:p6}),Me.createElement(r6,{distance:h6,offsetX:ct[0],offsetY:ct[1]}),Ne&&u&&Me.createElement(c6,{target:q}))},v6=function(n){n8(e,n);function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.state={message:""},t}return e.prototype.shouldComponentUpdate=function(t,i,r){return this.state.message===""&&i.message!==""&&t.onError!=null&&t.onError(new Error(i.message)),!0},e.getDerivedStateFromError=function(t){return{message:t.message}},e.prototype.componentDidCatch=function(){},e.prototype.render=function(){return this.state.message!==""?null:this.props.children},e}(Me.Component),y6=function(n){var e=n.url,t=n.cameraProps,i=n.modelProps,r=n.floorProps,s=n.children,o=n.onError,a=n.extraHeaders,u=n.onFinishLoading,d=n.canvasId,f=n.shadows,h=n.showAxes,p=n.orbitControls,g=n.cameraInitialPosition,y=Nf(n,["url","cameraProps","modelProps","floorProps","children","onError","extraHeaders","onFinishLoading","canvasId","shadows","showAxes","orbitControls","cameraInitialPosition"]),w={url:e,cameraProps:t,modelProps:i,floorProps:r,extraHeaders:a,onFinishLoading:u,shadows:f,showAxes:h,orbitControls:p,cameraInitialPosition:g};return Me.createElement("div",Cr({},y),Me.createElement(v6,{onError:o},Me.createElement(Me.Suspense,{fallback:null},Me.createElement(Q8,{shadows:!0,gl:{preserveDrawingBuffer:!0,shadowMapType:qc,antialias:!0},id:d,style:{width:"100%",height:"100%"}},Me.createElement(g6,Cr({},w)),s))))};class _6 extends _i{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new ls(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(u){r?r(u):console.error(u),s.manager.itemError(e)}},i,r)}parse(e){function t(d){const f=new DataView(d),h=32/8*3+32/8*3*3+16/8,p=f.getUint32(80,!0);if(80+32/8+p*h===f.byteLength)return!0;const y=[115,111,108,105,100];for(let w=0;w<5;w++)if(i(y,f,w))return!1;return!0}function i(d,f,h){for(let p=0,g=d.length;p<g;p++)if(d[p]!==f.getUint8(h+p))return!1;return!0}function r(d){const f=new DataView(d),h=f.getUint32(80,!0);let p,g,y,w=!1,x,v,_,M,b;for(let U=0;U<70;U++)f.getUint32(U,!1)==1129270351&&f.getUint8(U+4)==82&&f.getUint8(U+5)==61&&(w=!0,x=new Float32Array(h*3*3),v=f.getUint8(U+6)/255,_=f.getUint8(U+7)/255,M=f.getUint8(U+8)/255,b=f.getUint8(U+9)/255);const N=84,C=12*4+2,P=new mt,D=new Float32Array(h*3*3),I=new Float32Array(h*3*3),A=new Xe;for(let U=0;U<h;U++){const G=N+U*C,z=f.getFloat32(G,!0),Z=f.getFloat32(G+4,!0),J=f.getFloat32(G+8,!0);if(w){const ne=f.getUint16(G+48,!0);ne&32768?(p=v,g=_,y=M):(p=(ne&31)/31,g=(ne>>5&31)/31,y=(ne>>10&31)/31)}for(let ne=1;ne<=3;ne++){const le=G+ne*12,O=U*3*3+(ne-1)*3;D[O]=f.getFloat32(le,!0),D[O+1]=f.getFloat32(le+4,!0),D[O+2]=f.getFloat32(le+8,!0),I[O]=z,I[O+1]=Z,I[O+2]=J,w&&(A.set(p,g,y).convertSRGBToLinear(),x[O]=A.r,x[O+1]=A.g,x[O+2]=A.b)}}return P.setAttribute("position",new Lt(D,3)),P.setAttribute("normal",new Lt(I,3)),w&&(P.setAttribute("color",new Lt(x,3)),P.hasColors=!0,P.alpha=b),P}function s(d){const f=new mt,h=/solid([\s\S]*?)endsolid/g,p=/facet([\s\S]*?)endfacet/g,g=/solid\s(.+)/;let y=0;const w=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,x=new RegExp("vertex"+w+w+w,"g"),v=new RegExp("normal"+w+w+w,"g"),_=[],M=[],b=[],N=new k;let C,P=0,D=0,I=0;for(;(C=h.exec(d))!==null;){D=I;const A=C[0],U=(C=g.exec(A))!==null?C[1]:"";for(b.push(U);(C=p.exec(A))!==null;){let Z=0,J=0;const ne=C[0];for(;(C=v.exec(ne))!==null;)N.x=parseFloat(C[1]),N.y=parseFloat(C[2]),N.z=parseFloat(C[3]),J++;for(;(C=x.exec(ne))!==null;)_.push(parseFloat(C[1]),parseFloat(C[2]),parseFloat(C[3])),M.push(N.x,N.y,N.z),Z++,I++;J!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+y),Z!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+y),y++}const G=D,z=I-D;f.userData.groupNames=b,f.addGroup(G,z,P),P++}return f.setAttribute("position",new Ze(_,3)),f.setAttribute("normal",new Ze(M,3)),f}function o(d){return typeof d!="string"?new TextDecoder().decode(d):d}function a(d){if(typeof d=="string"){const f=new Uint8Array(d.length);for(let h=0;h<d.length;h++)f[h]=d.charCodeAt(h)&255;return f.buffer||f}else return d}const u=a(e);return t(u)?r(u):s(o(e))}}function oL(n,e){return function(){return n.apply(e,arguments)}}const{toString:x6}=Object.prototype,{getPrototypeOf:K1}=Object,rv=(n=>e=>{const t=x6.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),fs=n=>(n=n.toLowerCase(),e=>rv(e)===n),sv=n=>e=>typeof e===n,{isArray:vu}=Array,Of=sv("undefined");function S6(n){return n!==null&&!Of(n)&&n.constructor!==null&&!Of(n.constructor)&&Nr(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const aL=fs("ArrayBuffer");function w6(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&aL(n.buffer),e}const M6=sv("string"),Nr=sv("function"),lL=sv("number"),ov=n=>n!==null&&typeof n=="object",E6=n=>n===!0||n===!1,Zm=n=>{if(rv(n)!=="object")return!1;const e=K1(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},b6=fs("Date"),A6=fs("File"),T6=fs("Blob"),C6=fs("FileList"),R6=n=>ov(n)&&Nr(n.pipe),P6=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Nr(n.append)&&((e=rv(n))==="formdata"||e==="object"&&Nr(n.toString)&&n.toString()==="[object FormData]"))},I6=fs("URLSearchParams"),[L6,N6,D6,O6]=["ReadableStream","Request","Response","Headers"].map(fs),U6=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Qf(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),vu(n))for(i=0,r=n.length;i<r;i++)e.call(null,n[i],i,n);else{const s=t?Object.getOwnPropertyNames(n):Object.keys(n),o=s.length;let a;for(i=0;i<o;i++)a=s[i],e.call(null,n[a],a,n)}}function cL(n,e){e=e.toLowerCase();const t=Object.keys(n);let i=t.length,r;for(;i-- >0;)if(r=t[i],e===r.toLowerCase())return r;return null}const uL=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,dL=n=>!Of(n)&&n!==uL;function qS(){const{caseless:n}=dL(this)&&this||{},e={},t=(i,r)=>{const s=n&&cL(e,r)||r;Zm(e[s])&&Zm(i)?e[s]=qS(e[s],i):Zm(i)?e[s]=qS({},i):vu(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i<r;i++)arguments[i]&&Qf(arguments[i],t);return e}const F6=(n,e,t,{allOwnKeys:i}={})=>(Qf(e,(r,s)=>{t&&Nr(r)?n[s]=oL(r,t):n[s]=r},{allOwnKeys:i}),n),k6=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),z6=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},B6=(n,e,t,i)=>{let r,s,o;const a={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)o=r[s],(!i||i(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&K1(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},V6=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},H6=n=>{if(!n)return null;if(vu(n))return n;let e=n.length;if(!lL(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},G6=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&K1(Uint8Array)),W6=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},j6=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},X6=fs("HTMLFormElement"),q6=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),uC=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Y6=fs("RegExp"),fL=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};Qf(t,(r,s)=>{let o;(o=e(r,s,n))!==!1&&(i[s]=o||r)}),Object.defineProperties(n,i)},$6=n=>{fL(n,(e,t)=>{if(Nr(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if(Nr(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Z6=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return vu(n)?i(n):i(String(n).split(e)),t},J6=()=>{},K6=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,G_="abcdefghijklmnopqrstuvwxyz",dC="0123456789",hL={DIGIT:dC,ALPHA:G_,ALPHA_DIGIT:G_+G_.toUpperCase()+dC},Q6=(n=16,e=hL.ALPHA_DIGIT)=>{let t="";const{length:i}=e;for(;n--;)t+=e[Math.random()*i|0];return t};function eG(n){return!!(n&&Nr(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const tG=n=>{const e=new Array(10),t=(i,r)=>{if(ov(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=vu(i)?[]:{};return Qf(i,(o,a)=>{const u=t(o,r+1);!Of(u)&&(s[a]=u)}),e[r]=void 0,s}}return i};return t(n,0)},nG=fs("AsyncFunction"),iG=n=>n&&(ov(n)||Nr(n))&&Nr(n.then)&&Nr(n.catch),ye={isArray:vu,isArrayBuffer:aL,isBuffer:S6,isFormData:P6,isArrayBufferView:w6,isString:M6,isNumber:lL,isBoolean:E6,isObject:ov,isPlainObject:Zm,isReadableStream:L6,isRequest:N6,isResponse:D6,isHeaders:O6,isUndefined:Of,isDate:b6,isFile:A6,isBlob:T6,isRegExp:Y6,isFunction:Nr,isStream:R6,isURLSearchParams:I6,isTypedArray:G6,isFileList:C6,forEach:Qf,merge:qS,extend:F6,trim:U6,stripBOM:k6,inherits:z6,toFlatObject:B6,kindOf:rv,kindOfTest:fs,endsWith:V6,toArray:H6,forEachEntry:W6,matchAll:j6,isHTMLForm:X6,hasOwnProperty:uC,hasOwnProp:uC,reduceDescriptors:fL,freezeMethods:$6,toObjectSet:Z6,toCamelCase:q6,noop:J6,toFiniteNumber:K6,findKey:cL,global:uL,isContextDefined:dL,ALPHABET:hL,generateString:Q6,isSpecCompliantForm:eG,toJSONObject:tG,isAsyncFn:nG,isThenable:iG};function bt(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r)}ye.inherits(bt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ye.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const pL=bt.prototype,mL={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{mL[n]={value:n}});Object.defineProperties(bt,mL);Object.defineProperty(pL,"isAxiosError",{value:!0});bt.from=(n,e,t,i,r,s)=>{const o=Object.create(pL);return ye.toFlatObject(n,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),bt.call(o,n.message,e,t,i,r),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const rG=null;function YS(n){return ye.isPlainObject(n)||ye.isArray(n)}function gL(n){return ye.endsWith(n,"[]")?n.slice(0,-2):n}function fC(n,e,t){return n?n.concat(e).map(function(r,s){return r=gL(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function sG(n){return ye.isArray(n)&&!n.some(YS)}const oG=ye.toFlatObject(ye,{},null,function(e){return/^is[A-Z]/.test(e)});function av(n,e,t){if(!ye.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=ye.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,x){return!ye.isUndefined(x[w])});const i=t.metaTokens,r=t.visitor||f,s=t.dots,o=t.indexes,u=(t.Blob||typeof Blob<"u"&&Blob)&&ye.isSpecCompliantForm(e);if(!ye.isFunction(r))throw new TypeError("visitor must be a function");function d(y){if(y===null)return"";if(ye.isDate(y))return y.toISOString();if(!u&&ye.isBlob(y))throw new bt("Blob is not supported. Use a Buffer instead.");return ye.isArrayBuffer(y)||ye.isTypedArray(y)?u&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,w,x){let v=y;if(y&&!x&&typeof y=="object"){if(ye.endsWith(w,"{}"))w=i?w:w.slice(0,-2),y=JSON.stringify(y);else if(ye.isArray(y)&&sG(y)||(ye.isFileList(y)||ye.endsWith(w,"[]"))&&(v=ye.toArray(y)))return w=gL(w),v.forEach(function(M,b){!(ye.isUndefined(M)||M===null)&&e.append(o===!0?fC([w],b,s):o===null?w:w+"[]",d(M))}),!1}return YS(y)?!0:(e.append(fC(x,w,s),d(y)),!1)}const h=[],p=Object.assign(oG,{defaultVisitor:f,convertValue:d,isVisitable:YS});function g(y,w){if(!ye.isUndefined(y)){if(h.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));h.push(y),ye.forEach(y,function(v,_){(!(ye.isUndefined(v)||v===null)&&r.call(e,v,ye.isString(_)?_.trim():_,w,p))===!0&&g(v,w?w.concat(_):[_])}),h.pop()}}if(!ye.isObject(n))throw new TypeError("data must be an object");return g(n),e}function hC(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Q1(n,e){this._pairs=[],n&&av(n,this,e)}const vL=Q1.prototype;vL.append=function(e,t){this._pairs.push([e,t])};vL.toString=function(e){const t=e?function(i){return e.call(this,i,hC)}:hC;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function aG(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function yL(n,e,t){if(!e)return n;const i=t&&t.encode||aG,r=t&&t.serialize;let s;if(r?s=r(e,t):s=ye.isURLSearchParams(e)?e.toString():new Q1(e,t).toString(i),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class pC{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ye.forEach(this.handlers,function(i){i!==null&&e(i)})}}const _L={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},lG=typeof URLSearchParams<"u"?URLSearchParams:Q1,cG=typeof FormData<"u"?FormData:null,uG=typeof Blob<"u"?Blob:null,dG={isBrowser:!0,classes:{URLSearchParams:lG,FormData:cG,Blob:uG},protocols:["http","https","file","blob","url","data"]},eM=typeof window<"u"&&typeof document<"u",fG=(n=>eM&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),hG=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pG=eM&&window.location.href||"http://localhost",mG=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:eM,hasStandardBrowserEnv:fG,hasStandardBrowserWebWorkerEnv:hG,origin:pG},Symbol.toStringTag,{value:"Module"})),rs={...mG,...dG};function gG(n,e){return av(n,new rs.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return rs.isNode&&ye.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function vG(n){return ye.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function yG(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i<r;i++)s=t[i],e[s]=n[s];return e}function xL(n){function e(t,i,r,s){let o=t[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),u=s>=t.length;return o=!o&&ye.isArray(r)?r.length:o,u?(ye.hasOwnProp(r,o)?r[o]=[r[o],i]:r[o]=i,!a):((!r[o]||!ye.isObject(r[o]))&&(r[o]=[]),e(t,i,r[o],s)&&ye.isArray(r[o])&&(r[o]=yG(r[o])),!a)}if(ye.isFormData(n)&&ye.isFunction(n.entries)){const t={};return ye.forEachEntry(n,(i,r)=>{e(vG(i),r,t,0)}),t}return null}function _G(n,e,t){if(ye.isString(n))try{return(e||JSON.parse)(n),ye.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(n)}const eh={transitional:_L,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=ye.isObject(e);if(s&&ye.isHTMLForm(e)&&(e=new FormData(e)),ye.isFormData(e))return r?JSON.stringify(xL(e)):e;if(ye.isArrayBuffer(e)||ye.isBuffer(e)||ye.isStream(e)||ye.isFile(e)||ye.isBlob(e)||ye.isReadableStream(e))return e;if(ye.isArrayBufferView(e))return e.buffer;if(ye.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return gG(e,this.formSerializer).toString();if((a=ye.isFileList(e))||i.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return av(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),_G(e)):e}],transformResponse:[function(e){const t=this.transitional||eh.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(ye.isResponse(e)||ye.isReadableStream(e))return e;if(e&&ye.isString(e)&&(i&&!this.responseType||r)){const o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?bt.from(a,bt.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:rs.classes.FormData,Blob:rs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ye.forEach(["delete","get","head","post","put","patch"],n=>{eh.headers[n]={}});const xG=ye.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),SG=n=>{const e={};let t,i,r;return n&&n.split(`
`).forEach(function(o){r=o.indexOf(":"),t=o.substring(0,r).trim().toLowerCase(),i=o.substring(r+1).trim(),!(!t||e[t]&&xG[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},mC=Symbol("internals");function ld(n){return n&&String(n).trim().toLowerCase()}function Jm(n){return n===!1||n==null?n:ye.isArray(n)?n.map(Jm):String(n)}function wG(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const MG=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function W_(n,e,t,i,r){if(ye.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!ye.isString(e)){if(ye.isString(i))return e.indexOf(i)!==-1;if(ye.isRegExp(i))return i.test(e)}}function EG(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function bG(n,e){const t=ye.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(n,i+t,{value:function(r,s,o){return this[i].call(this,e,r,s,o)},configurable:!0})})}class Wi{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(a,u,d){const f=ld(u);if(!f)throw new Error("header name must be a non-empty string");const h=ye.findKey(r,f);(!h||r[h]===void 0||d===!0||d===void 0&&r[h]!==!1)&&(r[h||u]=Jm(a))}const o=(a,u)=>ye.forEach(a,(d,f)=>s(d,f,u));if(ye.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ye.isString(e)&&(e=e.trim())&&!MG(e))o(SG(e),t);else if(ye.isHeaders(e))for(const[a,u]of e.entries())s(u,a,i);else e!=null&&s(t,e,i);return this}get(e,t){if(e=ld(e),e){const i=ye.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return wG(r);if(ye.isFunction(t))return t.call(this,r,i);if(ye.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ld(e),e){const i=ye.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||W_(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function s(o){if(o=ld(o),o){const a=ye.findKey(i,o);a&&(!t||W_(i,i[a],a,t))&&(delete i[a],r=!0)}}return ye.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];(!e||W_(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return ye.forEach(this,(r,s)=>{const o=ye.findKey(i,s);if(o){t[o]=Jm(r),delete t[s];return}const a=e?EG(s):String(s).trim();a!==s&&delete t[s],t[a]=Jm(r),i[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ye.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&ye.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[mC]=this[mC]={accessors:{}}).accessors,r=this.prototype;function s(o){const a=ld(o);i[a]||(bG(r,o),i[a]=!0)}return ye.isArray(e)?e.forEach(s):s(e),this}}Wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ye.reduceDescriptors(Wi.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(i){this[t]=i}}});ye.freezeMethods(Wi);function j_(n,e){const t=this||eh,i=e||t,r=Wi.from(i.headers);let s=i.data;return ye.forEach(n,function(a){s=a.call(t,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function SL(n){return!!(n&&n.__CANCEL__)}function yu(n,e,t){bt.call(this,n??"canceled",bt.ERR_CANCELED,e,t),this.name="CanceledError"}ye.inherits(yu,bt,{__CANCEL__:!0});function wL(n,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?n(t):e(new bt("Request failed with status code "+t.status,[bt.ERR_BAD_REQUEST,bt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function AG(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function TG(n,e){n=n||10;const t=new Array(n),i=new Array(n);let r=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const d=Date.now(),f=i[s];o||(o=d),t[r]=u,i[r]=d;let h=s,p=0;for(;h!==r;)p+=t[h++],h=h%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),d-o<e)return;const g=f&&d-f;return g?Math.round(p*1e3/g):void 0}}function CG(n,e){let t=0;const i=1e3/e;let r=null;return function(){const o=this===!0,a=Date.now();if(o||a-t>i)return r&&(clearTimeout(r),r=null),t=a,n.apply(null,arguments);r||(r=setTimeout(()=>(r=null,t=Date.now(),n.apply(null,arguments)),i-(a-t)))}}const o0=(n,e,t=3)=>{let i=0;const r=TG(50,250);return CG(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-i,d=r(u),f=o<=a;i=o;const h={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:d||void 0,estimated:d&&a&&f?(a-o)/d:void 0,event:s,lengthComputable:a!=null};h[e?"download":"upload"]=!0,n(h)},t)},RG=rs.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function r(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return i=r(window.location.href),function(o){const a=ye.isString(o)?r(o):o;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}(),PG=rs.hasStandardBrowserEnv?{write(n,e,t,i,r,s){const o=[n+"="+encodeURIComponent(e)];ye.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),ye.isString(i)&&o.push("path="+i),ye.isString(r)&&o.push("domain="+r),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function IG(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function LG(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function ML(n,e){return n&&!IG(e)?LG(n,e):e}const gC=n=>n instanceof Wi?{...n}:n;function yl(n,e){e=e||{};const t={};function i(d,f,h){return ye.isPlainObject(d)&&ye.isPlainObject(f)?ye.merge.call({caseless:h},d,f):ye.isPlainObject(f)?ye.merge({},f):ye.isArray(f)?f.slice():f}function r(d,f,h){if(ye.isUndefined(f)){if(!ye.isUndefined(d))return i(void 0,d,h)}else return i(d,f,h)}function s(d,f){if(!ye.isUndefined(f))return i(void 0,f)}function o(d,f){if(ye.isUndefined(f)){if(!ye.isUndefined(d))return i(void 0,d)}else return i(void 0,f)}function a(d,f,h){if(h in e)return i(d,f);if(h in n)return i(void 0,d)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(d,f)=>r(gC(d),gC(f),!0)};return ye.forEach(Object.keys(Object.assign({},n,e)),function(f){const h=u[f]||r,p=h(n[f],e[f],f);ye.isUndefined(p)&&h!==a||(t[f]=p)}),t}const EL=n=>{const e=yl({},n);let{data:t,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=Wi.from(o),e.url=yL(ML(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(ye.isFormData(t)){if(rs.hasStandardBrowserEnv||rs.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[d,...f]=u?u.split(";").map(h=>h.trim()).filter(Boolean):[];o.setContentType([d||"multipart/form-data",...f].join("; "))}}if(rs.hasStandardBrowserEnv&&(i&&ye.isFunction(i)&&(i=i(e)),i||i!==!1&&RG(e.url))){const d=r&&s&&PG.read(s);d&&o.set(r,d)}return e},NG=typeof XMLHttpRequest<"u",DG=NG&&function(n){return new Promise(function(t,i){const r=EL(n);let s=r.data;const o=Wi.from(r.headers).normalize();let{responseType:a}=r,u;function d(){r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let f=new XMLHttpRequest;f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout;function h(){if(!f)return;const g=Wi.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),w={data:!a||a==="text"||a==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:g,config:n,request:f};wL(function(v){t(v),d()},function(v){i(v),d()},w),f=null}"onloadend"in f?f.onloadend=h:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(h)},f.onabort=function(){f&&(i(new bt("Request aborted",bt.ECONNABORTED,r,f)),f=null)},f.onerror=function(){i(new bt("Network Error",bt.ERR_NETWORK,r,f)),f=null},f.ontimeout=function(){let y=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const w=r.transitional||_L;r.timeoutErrorMessage&&(y=r.timeoutErrorMessage),i(new bt(y,w.clarifyTimeoutError?bt.ETIMEDOUT:bt.ECONNABORTED,r,f)),f=null},s===void 0&&o.setContentType(null),"setRequestHeader"in f&&ye.forEach(o.toJSON(),function(y,w){f.setRequestHeader(w,y)}),ye.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),a&&a!=="json"&&(f.responseType=r.responseType),typeof r.onDownloadProgress=="function"&&f.addEventListener("progress",o0(r.onDownloadProgress,!0)),typeof r.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",o0(r.onUploadProgress)),(r.cancelToken||r.signal)&&(u=g=>{f&&(i(!g||g.type?new yu(null,n,f):g),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const p=AG(r.url);if(p&&rs.protocols.indexOf(p)===-1){i(new bt("Unsupported protocol "+p+":",bt.ERR_BAD_REQUEST,n));return}f.send(s||null)})},OG=(n,e)=>{let t=new AbortController,i;const r=function(u){if(!i){i=!0,o();const d=u instanceof Error?u:this.reason;t.abort(d instanceof bt?d:new yu(d instanceof Error?d.message:d))}};let s=e&&setTimeout(()=>{r(new bt(`timeout ${e} of ms exceeded`,bt.ETIMEDOUT))},e);const o=()=>{n&&(s&&clearTimeout(s),s=null,n.forEach(u=>{u&&(u.removeEventListener?u.removeEventListener("abort",r):u.unsubscribe(r))}),n=null)};n.forEach(u=>u&&u.addEventListener&&u.addEventListener("abort",r));const{signal:a}=t;return a.unsubscribe=o,[a,()=>{s&&clearTimeout(s),s=null}]},UG=function*(n,e){let t=n.byteLength;if(!e||t<e){yield n;return}let i=0,r;for(;i<t;)r=i+e,yield n.slice(i,r),i=r},FG=async function*(n,e,t){for await(const i of n)yield*UG(ArrayBuffer.isView(i)?i:await t(String(i)),e)},vC=(n,e,t,i,r)=>{const s=FG(n,e,r);let o=0;return new ReadableStream({type:"bytes",async pull(a){const{done:u,value:d}=await s.next();if(u){a.close(),i();return}let f=d.byteLength;t&&t(o+=f),a.enqueue(new Uint8Array(d))},cancel(a){return i(a),s.return()}},{highWaterMark:2})},yC=(n,e)=>{const t=n!=null;return i=>setTimeout(()=>e({lengthComputable:t,total:n,loaded:i}))},lv=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",bL=lv&&typeof ReadableStream=="function",$S=lv&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),kG=bL&&(()=>{let n=!1;const e=new Request(rs.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e})(),_C=64*1024,ZS=bL&&!!(()=>{try{return ye.isReadableStream(new Response("").body)}catch{}})(),a0={stream:ZS&&(n=>n.body)};lv&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!a0[e]&&(a0[e]=ye.isFunction(n[e])?t=>t[e]():(t,i)=>{throw new bt(`Response type '${e}' is not supported`,bt.ERR_NOT_SUPPORT,i)})})})(new Response);const zG=async n=>{if(n==null)return 0;if(ye.isBlob(n))return n.size;if(ye.isSpecCompliantForm(n))return(await new Request(n).arrayBuffer()).byteLength;if(ye.isArrayBufferView(n))return n.byteLength;if(ye.isURLSearchParams(n)&&(n=n+""),ye.isString(n))return(await $S(n)).byteLength},BG=async(n,e)=>{const t=ye.toFiniteNumber(n.getContentLength());return t??zG(e)},VG=lv&&(async n=>{let{url:e,method:t,data:i,signal:r,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:d,headers:f,withCredentials:h="same-origin",fetchOptions:p}=EL(n);d=d?(d+"").toLowerCase():"text";let[g,y]=r||s||o?OG([r,s],o):[],w,x;const v=()=>{!w&&setTimeout(()=>{g&&g.unsubscribe()}),w=!0};let _;try{if(u&&kG&&t!=="get"&&t!=="head"&&(_=await BG(f,i))!==0){let C=new Request(e,{method:"POST",body:i,duplex:"half"}),P;ye.isFormData(i)&&(P=C.headers.get("content-type"))&&f.setContentType(P),C.body&&(i=vC(C.body,_C,yC(_,o0(u)),null,$S))}ye.isString(h)||(h=h?"cors":"omit"),x=new Request(e,{...p,signal:g,method:t.toUpperCase(),headers:f.normalize().toJSON(),body:i,duplex:"half",withCredentials:h});let M=await fetch(x);const b=ZS&&(d==="stream"||d==="response");if(ZS&&(a||b)){const C={};["status","statusText","headers"].forEach(D=>{C[D]=M[D]});const P=ye.toFiniteNumber(M.headers.get("content-length"));M=new Response(vC(M.body,_C,a&&yC(P,o0(a,!0)),b&&v,$S),C)}d=d||"text";let N=await a0[ye.findKey(a0,d)||"text"](M,n);return!b&&v(),y&&y(),await new Promise((C,P)=>{wL(C,P,{data:N,headers:Wi.from(M.headers),status:M.status,statusText:M.statusText,config:n,request:x})})}catch(M){throw v(),M&&M.name==="TypeError"&&/fetch/i.test(M.message)?Object.assign(new bt("Network Error",bt.ERR_NETWORK,n,x),{cause:M.cause||M}):bt.from(M,M&&M.code,n,x)}}),JS={http:rG,xhr:DG,fetch:VG};ye.forEach(JS,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const xC=n=>`- ${n}`,HG=n=>ye.isFunction(n)||n===null||n===!1,AL={getAdapter:n=>{n=ye.isArray(n)?n:[n];const{length:e}=n;let t,i;const r={};for(let s=0;s<e;s++){t=n[s];let o;if(i=t,!HG(t)&&(i=JS[(o=String(t)).toLowerCase()],i===void 0))throw new bt(`Unknown adapter '${o}'`);if(i)break;r[o||"#"+s]=i}if(!i){const s=Object.entries(r).map(([a,u])=>`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since :
`+s.map(xC).join(`
`):" "+xC(s[0]):"as no adapter specified";throw new bt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i},adapters:JS};function X_(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new yu(null,n)}function SC(n){return X_(n),n.headers=Wi.from(n.headers),n.data=j_.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),AL.getAdapter(n.adapter||eh.adapter)(n).then(function(i){return X_(n),i.data=j_.call(n,n.transformResponse,i),i.headers=Wi.from(i.headers),i},function(i){return SL(i)||(X_(n),i&&i.response&&(i.response.data=j_.call(n,n.transformResponse,i.response),i.response.headers=Wi.from(i.response.headers))),Promise.reject(i)})}const TL="1.7.2",tM={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{tM[n]=function(i){return typeof i===n||"a"+(e<1?"n ":" ")+n}});const wC={};tM.transitional=function(e,t,i){function r(s,o){return"[Axios v"+TL+"] Transitional option '"+s+"'"+o+(i?". "+i:"")}return(s,o,a)=>{if(e===!1)throw new bt(r(o," has been removed"+(t?" in "+t:"")),bt.ERR_DEPRECATED);return t&&!wC[o]&&(wC[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function GG(n,e,t){if(typeof n!="object")throw new bt("options must be an object",bt.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let r=i.length;for(;r-- >0;){const s=i[r],o=e[s];if(o){const a=n[s],u=a===void 0||o(a,s,n);if(u!==!0)throw new bt("option "+s+" must be "+u,bt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new bt("Unknown option "+s,bt.ERR_BAD_OPTION)}}const KS={assertOptions:GG,validators:tM},Fo=KS.validators;class ll{constructor(e){this.defaults=e,this.interceptors={request:new pC,response:new pC}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let r;Error.captureStackTrace?Error.captureStackTrace(r={}):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?s&&!String(i.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(i.stack+=`
`+s):i.stack=s}catch{}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=yl(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;i!==void 0&&KS.assertOptions(i,{silentJSONParsing:Fo.transitional(Fo.boolean),forcedJSONParsing:Fo.transitional(Fo.boolean),clarifyTimeoutError:Fo.transitional(Fo.boolean)},!1),r!=null&&(ye.isFunction(r)?t.paramsSerializer={serialize:r}:KS.assertOptions(r,{encode:Fo.function,serialize:Fo.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&ye.merge(s.common,s[t.method]);s&&ye.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),t.headers=Wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(t)===!1||(u=u&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let f,h=0,p;if(!u){const y=[SC.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,d),p=y.length,f=Promise.resolve(t);h<p;)f=f.then(y[h++],y[h++]);return f}p=a.length;let g=t;for(h=0;h<p;){const y=a[h++],w=a[h++];try{g=y(g)}catch(x){w.call(this,x);break}}try{f=SC.call(this,g)}catch(y){return Promise.reject(y)}for(h=0,p=d.length;h<p;)f=f.then(d[h++],d[h++]);return f}getUri(e){e=yl(this.defaults,e);const t=ML(e.baseURL,e.url);return yL(t,e.params,e.paramsSerializer)}}ye.forEach(["delete","get","head","options"],function(e){ll.prototype[e]=function(t,i){return this.request(yl(i||{},{method:e,url:t,data:(i||{}).data}))}});ye.forEach(["post","put","patch"],function(e){function t(i){return function(s,o,a){return this.request(yl(a||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ll.prototype[e]=t(),ll.prototype[e+"Form"]=t(!0)});class nM{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const i=this;this.promise.then(r=>{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const o=new Promise(a=>{i.subscribe(a),s=a}).then(r);return o.cancel=function(){i.unsubscribe(s)},o},e(function(s,o,a){i.reason||(i.reason=new yu(s,o,a),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new nM(function(r){e=r}),cancel:e}}}function WG(n){return function(t){return n.apply(null,t)}}function jG(n){return ye.isObject(n)&&n.isAxiosError===!0}const QS={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(QS).forEach(([n,e])=>{QS[e]=n});function CL(n){const e=new ll(n),t=oL(ll.prototype.request,e);return ye.extend(t,ll.prototype,e,{allOwnKeys:!0}),ye.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return CL(yl(n,r))},t}const En=CL(eh);En.Axios=ll;En.CanceledError=yu;En.CancelToken=nM;En.isCancel=SL;En.VERSION=TL;En.toFormData=av;En.AxiosError=bt;En.Cancel=En.CanceledError;En.all=function(e){return Promise.all(e)};En.spread=WG;En.isAxiosError=jG;En.mergeConfig=yl;En.AxiosHeaders=Wi;En.formToJSON=n=>xL(ye.isHTMLForm(n)?new FormData(n):n);En.getAdapter=AL.getAdapter;En.HttpStatusCode=QS;En.default=En;async function XG(n){const e=new FormData;return e.append("file",n),(await En.post("https://manfacter.onrender.com/api/stl",e,{headers:{"Content-Type":"multipart/form-data"}})).data}function qG({setVolume:n}){const[e,t]=we.useState(!1),[i,r]=we.useState(null),[s,o]=we.useState("https://storage.googleapis.com/ucloud-v3/ccab50f18fb14c91ccca300a.stl"),a=we.useRef(new Ef),[u,d]=we.useState(null),f=y=>{console.log(y.target.files[0].name),d(y.target.files[0].name)},h={height:"46vh"},p=async y=>{if(y.target.files&&y.target.files.length>0){nr.loading("Cargando modelo...",{id:"uploading"});const w=await XG(y.target.files[0]);nr.dismiss("uploading"),r(y.target.files[0]),o(URL.createObjectURL(y.target.files[0])),g(y.target.files[0]),t(!0),localStorage.setItem("modelMetrics",JSON.stringify(w)),console.log(w),f(y),console.log(w.volume),n(w.volume)}},g=y=>{new _6().load(URL.createObjectURL(y),function(x){const v=new mo({color:65280}),_=new Mn(x,v);a.current.add(_)})};return B.jsxs("div",{className:"w-full",children:[B.jsxs("div",{className:"flex flex-row justify-between w-full",children:[B.jsx("img",{className:"w-[30%] mt-10 h-full object-cover rounded-md max-md:w-full",src:"https://res.cloudinary.com/dgtamgaup/image/upload/v1716811620/left-model.png",alt:""}),B.jsxs("div",{className:"flex flex-col w-[70%] ml-[3%]",children:[B.jsx("div",{className:" w-full bg-slate-100 border-solid h-[46vh] border-blue-700 border-[1px] rounded-md mt-4",children:e&&B.jsx(y6,{style:h,orbitControls:!0,shadows:!0,url:s||"https://storage.googleapis.com/ucloud-v3/ccab50f18fb14c91ccca300a.stl"})}),B.jsx("div",{className:"flex items-center justify-center gap-5 max-w-full w-[82%] mt-[2%] max-md:flex-wrap",children:B.jsxs("div",{className:" mt-0 text-[16px] mr-24 font-light leading-4 text-black",children:[B.jsx("br",{}),B.jsx("span",{className:"font-semibold",children:"Volume:"})," ",localStorage.getItem("modelMetrics")?JSON.parse(localStorage.getItem("modelMetrics")).volume+"cm 3":"0 cm 3"]})})]})]}),B.jsx("div",{className:"flex gap-5 max-md:flex-col h-18 max-md:gap-0",children:B.jsx("aside",{className:"flex flex-col w-full h-[100%] max-md:ml-0 max-md:w-full",children:B.jsxs("div",{className:"flex flex-col grow pt-6 pb-12 mt-[2%]  h-[100%] w-full rounded-3xl bg-slate-100",children:[B.jsx("article",{className:"flex gap-5 self-start ml-6 max-w-full text-xl leading-6 text-center whitespace-nowrap w-[30%]",children:B.jsx("div",{className:"flex gap-5 font-semibold text-black",children:B.jsx("p",{className:"flex-auto my-auto ml-0",children:"Your models"})})}),B.jsx("div",{className:"shrink-0 mt-5 h-px border border-solid bg-black bg-opacity-30 border-black border-opacity-30"}),B.jsxs("div",{className:"flex flex-col items-start px-4 mt-4",children:[B.jsx("div",{className:"flex gap-5 justify-between py-3.5 mt-5 w-full text-xl font-semibold leading-6 text-center text-black whitespace-nowrap ",children:B.jsxs("div",{className:"flex gap-5",children:[B.jsx("div",{className:"shrink-0 self-stretch my-auto border border-solid bg-zinc-400 border-zinc-400 w-[35px]"}),B.jsx("img",{loading:"lazy",src:"https://cdn.builder.io/api/v1/image/assets/TEMP/1dc1ed6d4528c8b0d27d3269a239995dd3f10a49a23c01a1c42dedf851298707?apiKey=1342f5df53a1444ebb376cd081066232&",alt:"",className:"shrink-0 self-stretch rounded-md border border-solid aspect-[0.95] border-black border-opacity-20 w-[42px]"}),B.jsx("div",{className:"flex-auto self-stretch my-auto",children:u||"No model selected"})]})}),B.jsxs("div",{className:"flex gap-5 justify-between self-center mt-[5%] max-w-full w-[516px]",children:[B.jsxs("label",{className:"custom-file-upload hover:bg-transparent hover:border-none hover:text-[#49474C] font-poppins",children:["Browse files",B.jsx("input",{type:"file",onChange:p})]}),B.jsx("div",{className:"flex gap-4 my-auto text-xl font-semibold leading-6 text-center text-blue-500",children:B.jsx("img",{loading:"lazy",src:"https://cdn.builder.io/api/v1/image/assets/TEMP/bb188edfbc889c3080fab258673af2b4e66e0415c7230f7438c551b306588f2b?apiKey=1342f5df53a1444ebb376cd081066232&",alt:"",className:"shrink-0 aspect-[1.25] w-[51px]"})})]})]})]})})})]})}var th=n=>n.type==="checkbox",Uc=n=>n instanceof Date,Ti=n=>n==null;const RL=n=>typeof n=="object";var Bn=n=>!Ti(n)&&!Array.isArray(n)&&RL(n)&&!Uc(n),YG=n=>Bn(n)&&n.target?th(n.target)?n.target.checked:n.target.value:n,$G=n=>n.substring(0,n.search(/\.\d+(\.|$)/))||n,ZG=(n,e)=>n.has($G(e)),JG=n=>{const e=n.constructor&&n.constructor.prototype;return Bn(e)&&e.hasOwnProperty("isPrototypeOf")},iM=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Er(n){let e;const t=Array.isArray(n);if(n instanceof Date)e=new Date(n);else if(n instanceof Set)e=new Set(n);else if(!(iM&&(n instanceof Blob||n instanceof FileList))&&(t||Bn(n)))if(e=t?[]:{},!t&&!JG(n))e=n;else for(const i in n)n.hasOwnProperty(i)&&(e[i]=Er(n[i]));else return n;return e}var nh=n=>Array.isArray(n)?n.filter(Boolean):[],Sn=n=>n===void 0,Je=(n,e,t)=>{if(!e||!Bn(n))return t;const i=nh(e.split(/[,[\].]+?/)).reduce((r,s)=>Ti(r)?r:r[s],n);return Sn(i)||i===n?Sn(n[e])?t:n[e]:i},Wo=n=>typeof n=="boolean",rM=n=>/^\w*$/.test(n),PL=n=>nh(n.replace(/["|']|\]/g,"").split(/\.|\[/)),Kt=(n,e,t)=>{let i=-1;const r=rM(e)?[e]:PL(e),s=r.length,o=s-1;for(;++i<s;){const a=r[i];let u=t;if(i!==o){const d=n[a];u=Bn(d)||Array.isArray(d)?d:isNaN(+r[i+1])?{}:[]}if(a==="__proto__")return;n[a]=u,n=n[a]}return n};const MC={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},es={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ys={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};Me.createContext(null);var KG=(n,e,t,i=!0)=>{const r={defaultValues:e._defaultValues};for(const s in n)Object.defineProperty(r,s,{get:()=>{const o=s;return e._proxyFormState[o]!==es.all&&(e._proxyFormState[o]=!i||es.all),n[o]}});return r},ir=n=>Bn(n)&&!Object.keys(n).length,QG=(n,e,t,i)=>{t(n);const{name:r,...s}=n;return ir(s)||Object.keys(s).length>=Object.keys(e).length||Object.keys(s).find(o=>e[o]===es.all)},q_=n=>Array.isArray(n)?n:[n];function eW(n){const e=Me.useRef(n);e.current=n,Me.useEffect(()=>{const t=!n.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{t&&t.unsubscribe()}},[n.disabled])}var Cs=n=>typeof n=="string",tW=(n,e,t,i,r)=>Cs(n)?(i&&e.watch.add(n),Je(t,n,r)):Array.isArray(n)?n.map(s=>(i&&e.watch.add(s),Je(t,s))):(i&&(e.watchAll=!0),t),nW=(n,e,t,i,r)=>e?{...t[n],types:{...t[n]&&t[n].types?t[n].types:{},[i]:r||!0}}:{},EC=n=>({isOnSubmit:!n||n===es.onSubmit,isOnBlur:n===es.onBlur,isOnChange:n===es.onChange,isOnAll:n===es.all,isOnTouch:n===es.onTouched}),bC=(n,e,t)=>!t&&(e.watchAll||e.watch.has(n)||[...e.watch].some(i=>n.startsWith(i)&&/^\.\w+/.test(n.slice(i.length))));const Hd=(n,e,t,i)=>{for(const r of t||Object.keys(n)){const s=Je(n,r);if(s){const{_f:o,...a}=s;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],r)&&!i)break;if(o.ref&&e(o.ref,o.name)&&!i)break;Hd(a,e)}else Bn(a)&&Hd(a,e)}}};var iW=(n,e,t)=>{const i=nh(Je(n,t));return Kt(i,"root",e[t]),Kt(n,t,i),n},sM=n=>n.type==="file",qo=n=>typeof n=="function",l0=n=>{if(!iM)return!1;const e=n?n.ownerDocument:0;return n instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Km=n=>Cs(n),oM=n=>n.type==="radio",c0=n=>n instanceof RegExp;const AC={value:!1,isValid:!1},TC={value:!0,isValid:!0};var IL=n=>{if(Array.isArray(n)){if(n.length>1){const e=n.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:e,isValid:!!e.length}}return n[0].checked&&!n[0].disabled?n[0].attributes&&!Sn(n[0].attributes.value)?Sn(n[0].value)||n[0].value===""?TC:{value:n[0].value,isValid:!0}:TC:AC}return AC};const CC={isValid:!1,value:null};var LL=n=>Array.isArray(n)?n.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,CC):CC;function RC(n,e,t="validate"){if(Km(n)||Array.isArray(n)&&n.every(Km)||Wo(n)&&!n)return{type:t,message:Km(n)?n:"",ref:e}}var dc=n=>Bn(n)&&!c0(n)?n:{value:n,message:""},PC=async(n,e,t,i,r)=>{const{ref:s,refs:o,required:a,maxLength:u,minLength:d,min:f,max:h,pattern:p,validate:g,name:y,valueAsNumber:w,mount:x,disabled:v}=n._f,_=Je(e,y);if(!x||v)return{};const M=o?o[0]:s,b=G=>{i&&M.reportValidity&&(M.setCustomValidity(Wo(G)?"":G||""),M.reportValidity())},N={},C=oM(s),P=th(s),D=C||P,I=(w||sM(s))&&Sn(s.value)&&Sn(_)||l0(s)&&s.value===""||_===""||Array.isArray(_)&&!_.length,A=nW.bind(null,y,t,N),U=(G,z,Z,J=Ys.maxLength,ne=Ys.minLength)=>{const le=G?z:Z;N[y]={type:G?J:ne,message:le,ref:s,...A(G?J:ne,le)}};if(r?!Array.isArray(_)||!_.length:a&&(!D&&(I||Ti(_))||Wo(_)&&!_||P&&!IL(o).isValid||C&&!LL(o).isValid)){const{value:G,message:z}=Km(a)?{value:!!a,message:a}:dc(a);if(G&&(N[y]={type:Ys.required,message:z,ref:M,...A(Ys.required,z)},!t))return b(z),N}if(!I&&(!Ti(f)||!Ti(h))){let G,z;const Z=dc(h),J=dc(f);if(!Ti(_)&&!isNaN(_)){const ne=s.valueAsNumber||_&&+_;Ti(Z.value)||(G=ne>Z.value),Ti(J.value)||(z=ne<J.value)}else{const ne=s.valueAsDate||new Date(_),le=K=>new Date(new Date().toDateString()+" "+K),O=s.type=="time",Y=s.type=="week";Cs(Z.value)&&_&&(G=O?le(_)>le(Z.value):Y?_>Z.value:ne>new Date(Z.value)),Cs(J.value)&&_&&(z=O?le(_)<le(J.value):Y?_<J.value:ne<new Date(J.value))}if((G||z)&&(U(!!G,Z.message,J.message,Ys.max,Ys.min),!t))return b(N[y].message),N}if((u||d)&&!I&&(Cs(_)||r&&Array.isArray(_))){const G=dc(u),z=dc(d),Z=!Ti(G.value)&&_.length>+G.value,J=!Ti(z.value)&&_.length<+z.value;if((Z||J)&&(U(Z,G.message,z.message),!t))return b(N[y].message),N}if(p&&!I&&Cs(_)){const{value:G,message:z}=dc(p);if(c0(G)&&!_.match(G)&&(N[y]={type:Ys.pattern,message:z,ref:s,...A(Ys.pattern,z)},!t))return b(z),N}if(g){if(qo(g)){const G=await g(_,e),z=RC(G,M);if(z&&(N[y]={...z,...A(Ys.validate,z.message)},!t))return b(z.message),N}else if(Bn(g)){let G={};for(const z in g){if(!ir(G)&&!t)break;const Z=RC(await g[z](_,e),M,z);Z&&(G={...Z,...A(z,Z.message)},b(Z.message),t&&(N[y]=G))}if(!ir(G)&&(N[y]={ref:M,...G},!t))return N}}return b(!0),N};function rW(n,e){const t=e.slice(0,-1).length;let i=0;for(;i<t;)n=Sn(n)?i++:n[e[i++]];return n}function sW(n){for(const e in n)if(n.hasOwnProperty(e)&&!Sn(n[e]))return!1;return!0}function On(n,e){const t=Array.isArray(e)?e:rM(e)?[e]:PL(e),i=t.length===1?n:rW(n,t),r=t.length-1,s=t[r];return i&&delete i[s],r!==0&&(Bn(i)&&ir(i)||Array.isArray(i)&&sW(i))&&On(n,t.slice(0,-1)),n}var Y_=()=>{let n=[];return{get observers(){return n},next:r=>{for(const s of n)s.next&&s.next(r)},subscribe:r=>(n.push(r),{unsubscribe:()=>{n=n.filter(s=>s!==r)}}),unsubscribe:()=>{n=[]}}},u0=n=>Ti(n)||!RL(n);function el(n,e){if(u0(n)||u0(e))return n===e;if(Uc(n)&&Uc(e))return n.getTime()===e.getTime();const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const r of t){const s=n[r];if(!i.includes(r))return!1;if(r!=="ref"){const o=e[r];if(Uc(s)&&Uc(o)||Bn(s)&&Bn(o)||Array.isArray(s)&&Array.isArray(o)?!el(s,o):s!==o)return!1}}return!0}var NL=n=>n.type==="select-multiple",oW=n=>oM(n)||th(n),$_=n=>l0(n)&&n.isConnected,DL=n=>{for(const e in n)if(qo(n[e]))return!0;return!1};function d0(n,e={}){const t=Array.isArray(n);if(Bn(n)||t)for(const i in n)Array.isArray(n[i])||Bn(n[i])&&!DL(n[i])?(e[i]=Array.isArray(n[i])?[]:{},d0(n[i],e[i])):Ti(n[i])||(e[i]=!0);return e}function OL(n,e,t){const i=Array.isArray(n);if(Bn(n)||i)for(const r in n)Array.isArray(n[r])||Bn(n[r])&&!DL(n[r])?Sn(e)||u0(t[r])?t[r]=Array.isArray(n[r])?d0(n[r],[]):{...d0(n[r])}:OL(n[r],Ti(e)?{}:e[r],t[r]):t[r]=!el(n[r],e[r]);return t}var vm=(n,e)=>OL(n,e,d0(e)),UL=(n,{valueAsNumber:e,valueAsDate:t,setValueAs:i})=>Sn(n)?n:e?n===""?NaN:n&&+n:t&&Cs(n)?new Date(n):i?i(n):n;function Z_(n){const e=n.ref;if(!(n.refs?n.refs.every(t=>t.disabled):e.disabled))return sM(e)?e.files:oM(e)?LL(n.refs).value:NL(e)?[...e.selectedOptions].map(({value:t})=>t):th(e)?IL(n.refs).value:UL(Sn(e.value)?n.ref.value:e.value,n)}var aW=(n,e,t,i)=>{const r={};for(const s of n){const o=Je(e,s);o&&Kt(r,s,o._f)}return{criteriaMode:t,names:[...n],fields:r,shouldUseNativeValidation:i}},cd=n=>Sn(n)?n:c0(n)?n.source:Bn(n)?c0(n.value)?n.value.source:n.value:n,lW=n=>n.mount&&(n.required||n.min||n.max||n.maxLength||n.minLength||n.pattern||n.validate);function IC(n,e,t){const i=Je(n,t);if(i||rM(t))return{error:i,name:t};const r=t.split(".");for(;r.length;){const s=r.join("."),o=Je(e,s),a=Je(n,s);if(o&&!Array.isArray(o)&&t!==s)return{name:t};if(a&&a.type)return{name:s,error:a};r.pop()}return{name:t}}var cW=(n,e,t,i,r)=>r.isOnAll?!1:!t&&r.isOnTouch?!(e||n):(t?i.isOnBlur:r.isOnBlur)?!n:(t?i.isOnChange:r.isOnChange)?n:!0,uW=(n,e)=>!nh(Je(n,e)).length&&On(n,e);const dW={mode:es.onSubmit,reValidateMode:es.onChange,shouldFocusError:!0};function fW(n={}){let e={...dW,...n},t={submitCount:0,isDirty:!1,isLoading:qo(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},i={},r=Bn(e.defaultValues)||Bn(e.values)?Er(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Er(r),o={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,d=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={values:Y_(),array:Y_(),state:Y_()},p=EC(e.mode),g=EC(e.reValidateMode),y=e.criteriaMode===es.all,w=V=>L=>{clearTimeout(d),d=setTimeout(V,L)},x=async V=>{if(f.isValid||V){const L=e.resolver?ir((await D()).errors):await A(i,!0);L!==t.isValid&&h.state.next({isValid:L})}},v=(V,L)=>{(f.isValidating||f.validatingFields)&&((V||Array.from(a.mount)).forEach(R=>{R&&(L?Kt(t.validatingFields,R,L):On(t.validatingFields,R))}),h.state.next({validatingFields:t.validatingFields,isValidating:!ir(t.validatingFields)}))},_=(V,L=[],R,X,q=!0,$=!0)=>{if(X&&R){if(o.action=!0,$&&Array.isArray(Je(i,V))){const ie=R(Je(i,V),X.argA,X.argB);q&&Kt(i,V,ie)}if($&&Array.isArray(Je(t.errors,V))){const ie=R(Je(t.errors,V),X.argA,X.argB);q&&Kt(t.errors,V,ie),uW(t.errors,V)}if(f.touchedFields&&$&&Array.isArray(Je(t.touchedFields,V))){const ie=R(Je(t.touchedFields,V),X.argA,X.argB);q&&Kt(t.touchedFields,V,ie)}f.dirtyFields&&(t.dirtyFields=vm(r,s)),h.state.next({name:V,isDirty:G(V,L),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else Kt(s,V,L)},M=(V,L)=>{Kt(t.errors,V,L),h.state.next({errors:t.errors})},b=V=>{t.errors=V,h.state.next({errors:t.errors,isValid:!1})},N=(V,L,R,X)=>{const q=Je(i,V);if(q){const $=Je(s,V,Sn(R)?Je(r,V):R);Sn($)||X&&X.defaultChecked||L?Kt(s,V,L?$:Z_(q._f)):J(V,$),o.mount&&x()}},C=(V,L,R,X,q)=>{let $=!1,ie=!1;const Ne={name:V},Re=!!(Je(i,V)&&Je(i,V)._f&&Je(i,V)._f.disabled);if(!R||X){f.isDirty&&(ie=t.isDirty,t.isDirty=Ne.isDirty=G(),$=ie!==Ne.isDirty);const Pe=Re||el(Je(r,V),L);ie=!!(!Re&&Je(t.dirtyFields,V)),Pe||Re?On(t.dirtyFields,V):Kt(t.dirtyFields,V,!0),Ne.dirtyFields=t.dirtyFields,$=$||f.dirtyFields&&ie!==!Pe}if(R){const Pe=Je(t.touchedFields,V);Pe||(Kt(t.touchedFields,V,R),Ne.touchedFields=t.touchedFields,$=$||f.touchedFields&&Pe!==R)}return $&&q&&h.state.next(Ne),$?Ne:{}},P=(V,L,R,X)=>{const q=Je(t.errors,V),$=f.isValid&&Wo(L)&&t.isValid!==L;if(n.delayError&&R?(u=w(()=>M(V,R)),u(n.delayError)):(clearTimeout(d),u=null,R?Kt(t.errors,V,R):On(t.errors,V)),(R?!el(q,R):q)||!ir(X)||$){const ie={...X,...$&&Wo(L)?{isValid:L}:{},errors:t.errors,name:V};t={...t,...ie},h.state.next(ie)}},D=async V=>{v(V,!0);const L=await e.resolver(s,e.context,aW(V||a.mount,i,e.criteriaMode,e.shouldUseNativeValidation));return v(V),L},I=async V=>{const{errors:L}=await D(V);if(V)for(const R of V){const X=Je(L,R);X?Kt(t.errors,R,X):On(t.errors,R)}else t.errors=L;return L},A=async(V,L,R={valid:!0})=>{for(const X in V){const q=V[X];if(q){const{_f:$,...ie}=q;if($){const Ne=a.array.has($.name);v([X],!0);const Re=await PC(q,s,y,e.shouldUseNativeValidation&&!L,Ne);if(v([X]),Re[$.name]&&(R.valid=!1,L))break;!L&&(Je(Re,$.name)?Ne?iW(t.errors,Re,$.name):Kt(t.errors,$.name,Re[$.name]):On(t.errors,$.name))}ie&&await A(ie,L,R)}}return R.valid},U=()=>{for(const V of a.unMount){const L=Je(i,V);L&&(L._f.refs?L._f.refs.every(R=>!$_(R)):!$_(L._f.ref))&&Ae(V)}a.unMount=new Set},G=(V,L)=>(V&&L&&Kt(s,V,L),!el(ae(),r)),z=(V,L,R)=>tW(V,a,{...o.mount?s:Sn(L)?r:Cs(V)?{[V]:L}:L},R,L),Z=V=>nh(Je(o.mount?s:r,V,n.shouldUnregister?Je(r,V,[]):[])),J=(V,L,R={})=>{const X=Je(i,V);let q=L;if(X){const $=X._f;$&&(!$.disabled&&Kt(s,V,UL(L,$)),q=l0($.ref)&&Ti(L)?"":L,NL($.ref)?[...$.ref.options].forEach(ie=>ie.selected=q.includes(ie.value)):$.refs?th($.ref)?$.refs.length>1?$.refs.forEach(ie=>(!ie.defaultChecked||!ie.disabled)&&(ie.checked=Array.isArray(q)?!!q.find(Ne=>Ne===ie.value):q===ie.value)):$.refs[0]&&($.refs[0].checked=!!q):$.refs.forEach(ie=>ie.checked=ie.value===q):sM($.ref)?$.ref.value="":($.ref.value=q,$.ref.type||h.values.next({name:V,values:{...s}})))}(R.shouldDirty||R.shouldTouch)&&C(V,q,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&K(V)},ne=(V,L,R)=>{for(const X in L){const q=L[X],$=`${V}.${X}`,ie=Je(i,$);(a.array.has(V)||!u0(q)||ie&&!ie._f)&&!Uc(q)?ne($,q,R):J($,q,R)}},le=(V,L,R={})=>{const X=Je(i,V),q=a.array.has(V),$=Er(L);Kt(s,V,$),q?(h.array.next({name:V,values:{...s}}),(f.isDirty||f.dirtyFields)&&R.shouldDirty&&h.state.next({name:V,dirtyFields:vm(r,s),isDirty:G(V,$)})):X&&!X._f&&!Ti($)?ne(V,$,R):J(V,$,R),bC(V,a)&&h.state.next({...t}),h.values.next({name:o.mount?V:void 0,values:{...s}})},O=async V=>{o.mount=!0;const L=V.target;let R=L.name,X=!0;const q=Je(i,R),$=()=>L.type?Z_(q._f):YG(V),ie=Ne=>{X=Number.isNaN(Ne)||Ne===Je(s,R,Ne)};if(q){let Ne,Re;const Pe=$(),st=V.type===MC.BLUR||V.type===MC.FOCUS_OUT,De=!lW(q._f)&&!e.resolver&&!Je(t.errors,R)&&!q._f.deps||cW(st,Je(t.touchedFields,R),t.isSubmitted,g,p),qe=bC(R,a,st);Kt(s,R,Pe),st?(q._f.onBlur&&q._f.onBlur(V),u&&u(0)):q._f.onChange&&q._f.onChange(V);const ct=C(R,Pe,st,!1),W=!ir(ct)||qe;if(!st&&h.values.next({name:R,type:V.type,values:{...s}}),De)return f.isValid&&x(),W&&h.state.next({name:R,...qe?{}:ct});if(!st&&qe&&h.state.next({...t}),e.resolver){const{errors:oe}=await D([R]);if(ie(Pe),X){const Ie=IC(t.errors,i,R),ze=IC(oe,i,Ie.name||R);Ne=ze.error,R=ze.name,Re=ir(oe)}}else v([R],!0),Ne=(await PC(q,s,y,e.shouldUseNativeValidation))[R],v([R]),ie(Pe),X&&(Ne?Re=!1:f.isValid&&(Re=await A(i,!0)));X&&(q._f.deps&&K(q._f.deps),P(R,Re,Ne,ct))}},Y=(V,L)=>{if(Je(t.errors,L)&&V.focus)return V.focus(),1},K=async(V,L={})=>{let R,X;const q=q_(V);if(e.resolver){const $=await I(Sn(V)?V:q);R=ir($),X=V?!q.some(ie=>Je($,ie)):R}else V?(X=(await Promise.all(q.map(async $=>{const ie=Je(i,$);return await A(ie&&ie._f?{[$]:ie}:ie)}))).every(Boolean),!(!X&&!t.isValid)&&x()):X=R=await A(i);return h.state.next({...!Cs(V)||f.isValid&&R!==t.isValid?{}:{name:V},...e.resolver||!V?{isValid:R}:{},errors:t.errors}),L.shouldFocus&&!X&&Hd(i,Y,V?q:a.mount),X},ae=V=>{const L={...o.mount?s:r};return Sn(V)?L:Cs(V)?Je(L,V):V.map(R=>Je(L,R))},ge=(V,L)=>({invalid:!!Je((L||t).errors,V),isDirty:!!Je((L||t).dirtyFields,V),error:Je((L||t).errors,V),isValidating:!!Je(t.validatingFields,V),isTouched:!!Je((L||t).touchedFields,V)}),Ue=V=>{V&&q_(V).forEach(L=>On(t.errors,L)),h.state.next({errors:V?t.errors:{}})},se=(V,L,R)=>{const X=(Je(i,V,{_f:{}})._f||{}).ref,q=Je(t.errors,V)||{},{ref:$,message:ie,type:Ne,...Re}=q;Kt(t.errors,V,{...Re,...L,ref:X}),h.state.next({name:V,errors:t.errors,isValid:!1}),R&&R.shouldFocus&&X&&X.focus&&X.focus()},xe=(V,L)=>qo(V)?h.values.subscribe({next:R=>V(z(void 0,L),R)}):z(V,L,!0),Ae=(V,L={})=>{for(const R of V?q_(V):a.mount)a.mount.delete(R),a.array.delete(R),L.keepValue||(On(i,R),On(s,R)),!L.keepError&&On(t.errors,R),!L.keepDirty&&On(t.dirtyFields,R),!L.keepTouched&&On(t.touchedFields,R),!L.keepIsValidating&&On(t.validatingFields,R),!e.shouldUnregister&&!L.keepDefaultValue&&On(r,R);h.values.next({values:{...s}}),h.state.next({...t,...L.keepDirty?{isDirty:G()}:{}}),!L.keepIsValid&&x()},Ce=({disabled:V,name:L,field:R,fields:X,value:q})=>{if(Wo(V)&&o.mount||V){const $=V?void 0:Sn(q)?Z_(R?R._f:Je(X,L)._f):q;Kt(s,L,$),C(L,$,!1,!1,!0)}},tt=(V,L={})=>{let R=Je(i,V);const X=Wo(L.disabled);return Kt(i,V,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:V}},name:V,mount:!0,...L}}),a.mount.add(V),R?Ce({field:R,disabled:L.disabled,name:V,value:L.value}):N(V,!0,L.value),{...X?{disabled:L.disabled}:{},...e.progressive?{required:!!L.required,min:cd(L.min),max:cd(L.max),minLength:cd(L.minLength),maxLength:cd(L.maxLength),pattern:cd(L.pattern)}:{},name:V,onChange:O,onBlur:O,ref:q=>{if(q){tt(V,L),R=Je(i,V);const $=Sn(q.value)&&q.querySelectorAll&&q.querySelectorAll("input,select,textarea")[0]||q,ie=oW($),Ne=R._f.refs||[];if(ie?Ne.find(Re=>Re===$):$===R._f.ref)return;Kt(i,V,{_f:{...R._f,...ie?{refs:[...Ne.filter($_),$,...Array.isArray(Je(r,V))?[{}]:[]],ref:{type:$.type,name:V}}:{ref:$}}}),N(V,!1,void 0,$)}else R=Je(i,V,{}),R._f&&(R._f.mount=!1),(e.shouldUnregister||L.shouldUnregister)&&!(ZG(a.array,V)&&o.action)&&a.unMount.add(V)}}},Qe=()=>e.shouldFocusError&&Hd(i,Y,a.mount),Q=V=>{Wo(V)&&(h.state.next({disabled:V}),Hd(i,(L,R)=>{const X=Je(i,R);X&&(L.disabled=X._f.disabled||V,Array.isArray(X._f.refs)&&X._f.refs.forEach(q=>{q.disabled=X._f.disabled||V}))},0,!1))},nt=(V,L)=>async R=>{let X;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let q=Er(s);if(h.state.next({isSubmitting:!0}),e.resolver){const{errors:$,values:ie}=await D();t.errors=$,q=ie}else await A(i);if(On(t.errors,"root"),ir(t.errors)){h.state.next({errors:{}});try{await V(q,R)}catch($){X=$}}else L&&await L({...t.errors},R),Qe(),setTimeout(Qe);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ir(t.errors)&&!X,submitCount:t.submitCount+1,errors:t.errors}),X)throw X},pe=(V,L={})=>{Je(i,V)&&(Sn(L.defaultValue)?le(V,Er(Je(r,V))):(le(V,L.defaultValue),Kt(r,V,Er(L.defaultValue))),L.keepTouched||On(t.touchedFields,V),L.keepDirty||(On(t.dirtyFields,V),t.isDirty=L.defaultValue?G(V,Er(Je(r,V))):G()),L.keepError||(On(t.errors,V),f.isValid&&x()),h.state.next({...t}))},be=(V,L={})=>{const R=V?Er(V):r,X=Er(R),q=ir(V),$=q?r:X;if(L.keepDefaultValues||(r=R),!L.keepValues){if(L.keepDirtyValues)for(const ie of a.mount)Je(t.dirtyFields,ie)?Kt($,ie,Je(s,ie)):le(ie,Je($,ie));else{if(iM&&Sn(V))for(const ie of a.mount){const Ne=Je(i,ie);if(Ne&&Ne._f){const Re=Array.isArray(Ne._f.refs)?Ne._f.refs[0]:Ne._f.ref;if(l0(Re)){const Pe=Re.closest("form");if(Pe){Pe.reset();break}}}}i={}}s=n.shouldUnregister?L.keepDefaultValues?Er(r):{}:Er($),h.array.next({values:{...$}}),h.values.next({values:{...$}})}a={mount:L.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!L.keepIsValid||!!L.keepDirtyValues,o.watch=!!n.shouldUnregister,h.state.next({submitCount:L.keepSubmitCount?t.submitCount:0,isDirty:q?!1:L.keepDirty?t.isDirty:!!(L.keepDefaultValues&&!el(V,r)),isSubmitted:L.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:q?[]:L.keepDirtyValues?L.keepDefaultValues&&s?vm(r,s):t.dirtyFields:L.keepDefaultValues&&V?vm(r,V):L.keepDirty?t.dirtyFields:{},touchedFields:L.keepTouched?t.touchedFields:{},errors:L.keepErrors?t.errors:{},isSubmitSuccessful:L.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},Se=(V,L)=>be(qo(V)?V(s):V,L);return{control:{register:tt,unregister:Ae,getFieldState:ge,handleSubmit:nt,setError:se,_executeSchema:D,_getWatch:z,_getDirty:G,_updateValid:x,_removeUnmounted:U,_updateFieldArray:_,_updateDisabledField:Ce,_getFieldArray:Z,_reset:be,_resetDefaultValues:()=>qo(e.defaultValues)&&e.defaultValues().then(V=>{Se(V,e.resetOptions),h.state.next({isLoading:!1})}),_updateFormState:V=>{t={...t,...V}},_disableForm:Q,_subjects:h,_proxyFormState:f,_setErrors:b,get _fields(){return i},get _formValues(){return s},get _state(){return o},set _state(V){o=V},get _defaultValues(){return r},get _names(){return a},set _names(V){a=V},get _formState(){return t},set _formState(V){t=V},get _options(){return e},set _options(V){e={...e,...V}}},trigger:K,register:tt,handleSubmit:nt,watch:xe,setValue:le,getValues:ae,reset:Se,resetField:pe,clearErrors:Ue,unregister:Ae,setError:se,setFocus:(V,L={})=>{const R=Je(i,V),X=R&&R._f;if(X){const q=X.refs?X.refs[0]:X.ref;q.focus&&(q.focus(),L.shouldSelect&&q.select())}},getFieldState:ge}}function hW(n={}){const e=Me.useRef(),t=Me.useRef(),[i,r]=Me.useState({isDirty:!1,isValidating:!1,isLoading:qo(n.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1,defaultValues:qo(n.defaultValues)?void 0:n.defaultValues});e.current||(e.current={...fW(n),formState:i});const s=e.current.control;return s._options=n,eW({subject:s._subjects.state,next:o=>{QG(o,s._proxyFormState,s._updateFormState)&&r({...s._formState})}}),Me.useEffect(()=>s._disableForm(n.disabled),[s,n.disabled]),Me.useEffect(()=>{if(s._proxyFormState.isDirty){const o=s._getDirty();o!==i.isDirty&&s._subjects.state.next({isDirty:o})}},[s,i.isDirty]),Me.useEffect(()=>{n.values&&!el(n.values,t.current)?(s._reset(n.values,s._options.resetOptions),t.current=n.values,r(o=>({...o}))):s._resetDefaultValues()},[n.values,s]),Me.useEffect(()=>{n.errors&&s._setErrors(n.errors)},[n.errors,s]),Me.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),Me.useEffect(()=>{n.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[n.shouldUnregister,s]),e.current.formState=KG(i,s),e.current}const pW=({setLoggedIn:n})=>{const[e,t]=we.useState(["","","",""]),i=[we.useRef(),we.useRef(),we.useRef(),we.useRef()];we.useEffect(()=>{i[0].current.focus()},[]);const r=u=>{u.preventDefault(),t(["","","",""]),i[0].current.focus()},s=u=>{u.preventDefault(),e.join("")==="8945"?(n(!0),nr.success("Login Successful")):nr.error("Invalid PIN")},o=(u,d)=>{const f=[...e];f[u]=d,t(f),d&&u<3&&i[u+1].current.focus()},a=(u,d)=>{if(u.key==="Backspace"&&u.target.value===""&&d>0){const f=[...e];f[f.length-1]="",t(f),f.length>0&&i[d-1].current.focus(),u.preventDefault()}};return B.jsx("div",{className:"w-screen flex justify-center mt-20 h-screen",children:B.jsxs("form",{className:"form",children:[B.jsx("p",{className:"heading",children:"Verify"}),B.jsxs("svg",{className:"check",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"60px",height:"60px",viewBox:"0 0 60 60",xmlSpace:"preserve",children:["  ",B.jsx("image",{id:"image0",width:"60",height:"60",x:"0",y:"0",href:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAQAAACQ9RH5AAAABGdBTUEAALGPC/xhBQAAACBjSFJN
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZ
cwAACxMAAAsTAQCanBgAAAAHdElNRQfnAg0NDzN/r+StAAACR0lEQVRYw+3Yy2sTURTH8W+bNgVf
aGhFaxNiAoJou3FVEUQE1yL031BEROjCnf4PLlxILZSGYncuiiC48AEKxghaNGiliAojiBWZNnNd
xDza3pl77jyCyPzO8ubcT85wmUkG0qT539In+MwgoxQoUqDAKDn2kSNLlp3AGi4uDt9xWOUTK3xg
hVU2wsIZSkxwnHHGKZOxHKfBe6rUqFGlTkPaVmKGn6iYao1ZyhK2zJfY0FZ9ldBzsbMKxZwZjn/e
5szGw6UsD5I0W6T+hBhjUjiF7bNInjz37Ruj3igGABjbtpIo3GIh30u4ww5wr3fwfJvNcFeznhBs
YgXw70TYX2bY/ulkZhWfzfBbTdtrzjPFsvFI+T/L35jhp5q2owDs51VIVvHYDM9sa/LY8XdtKy1l
FXfM8FVN2/X2ajctZxVXzPA5TZvHpfb6CFXxkerUWTOcY11LX9w0tc20inX2mmF4qG3upnNWrOKB
hIXLPu3dF1x+kRWq6ysHpkjDl+7eQjatYoOCDIZF3006U0unVSxIWTgTsI3HNP3soSJkFaflMDwL
3OoHrph9YsPCJJ5466DyOGUHY3Epg2rWloUxnMjsNw7aw3AhMjwVhgW4HYm9FZaFQZ/bp6QeMRQe
hhHehWKXGY7CAuSpW7MfKUZlAUqWdJ3DcbAAB3guZl9yKC4WYLfmT4muFtgVJwvQx7T2t0mnXK6J
XlGGyAQvfNkaJ5JBmxnipubJ5HKDbJJsM0eY38QucSx5tJWTVHBwqDDZOzRNmn87fwDoyM4J2hRz
NgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMy0wMi0xM1QxMzoxNTo1MCswMDowMKC8JaoAAAAldEVY
dGRhdGU6bW9kaWZ5ADIwMjMtMDItMTNUMTM6MTU6NTArMDA6MDDR4Z0WAAAAKHRFWHRkYXRlOnRp
bWVzdGFtcAAyMDIzLTAyLTEzVDEzOjE1OjUxKzAwOjAwIIO3fQAAAABJRU5ErkJggg==`})]}),B.jsx("div",{className:"box",children:e.map((u,d)=>B.jsx("input",{className:"input",value:u,onChange:f=>o(d,f.target.value),ref:i[d],onKeyDown:f=>a(f,d),type:"password",maxLength:"1"},d))}),B.jsx("button",{className:"btn1",onClick:u=>s(u),children:"Submit"}),B.jsx("button",{className:"btn2 ",onClick:u=>r(u),children:"Back"})]})})};async function mW(n){try{return await En.post("https://manfacter.onrender.com/api/register",n)}catch(e){return e.response.data.message}}const gW=({setLoggedIn:n})=>{const[e,t]=we.useState(!1),[i,r]=we.useState(""),[s,o]=we.useState(""),[a,u]=we.useState(!1),[d,f]=we.useState(!1),[h,p]=we.useState(""),[g,y]=we.useState(!1),[w,x]=we.useState(!1),[v,_]=we.useState(!1),{handleSubmit:M,register:b,formState:{errors:N}}=hW();let C=0;const P=async()=>{if(i==="siemprearroz"){t(!0);return}if(console.log(i,s,d,a,h),!a&&!d){nr.error("Por favor seleccione un tipo de usuario"),y(!0);return}if(!i){nr.error("Por favor introduzca un nombre"),x(!0);return}if(!s){nr.error("Por favor introduzca un email"),_(!0);return}nr.loading("Registrando usuario...",{id:"registering"});const D=await mW({email:s,productionPartner:a,client:d,message:h,name:i});if(console.log(D),D==="Email already exists"){nr.dismiss("registering"),nr.error("El email ya existe");return}D==="Internal server error"&&(C===0&&(C++,P()),nr.error("Error interno del servidor, inténtelo de nuevo")),nr.dismiss("registering"),nr.success("Registro exitoso")};return B.jsx(B.Fragment,{children:e?B.jsx(pW,{setLoggedIn:n}):B.jsxs("div",{className:" w-screen h-screen flex flex-col justify-start mt-14 items-center ",children:[B.jsxs("div",{children:[B.jsx("img",{src:"https://res.cloudinary.com/dgtamgaup/image/upload/v1718525202/manfacter-logo_lhoyxe.png",alt:""}),B.jsx("p",{className:"mt-4 text-center font-semibold",children:"On Demand Manufacturing Network"})]}),B.jsx("span",{className:"mt-2 font-bold text-[32px]",children:"Ya casi estamos"}),B.jsx("div",{className:"mt-4",children:B.jsx("div",{className:"popup",children:B.jsxs("form",{className:"form2",children:[B.jsx("label",{htmlFor:"",className:"title",children:"¿Qué te interesa de manfacter?"}),B.jsx("span",{className:"subtitle",children:"Selecciona qué tipo de usuario quieres ser"}),B.jsxs("div",{className:"space-y-2 w-full flex flex-col items-center",children:[B.jsxs("label",{onClick:()=>{setTimeout(()=>{f(!d)},100)},className:`${d?"bg-white/30 text-indigo-900 ring-indigo-200 ring-2":""} cursor-pointer text-[14px] ring-gray-100 ring-2 bg-white/40 hover:bg-white/20 w-[100%] p-4 rounded-md flex justify-between items-center shadow`,children:["Utilizar la plataforma como cliente",B.jsx("label",{value:d,type:"checkbox",onChange:()=>f(!d),className:"checked:border-indigo-500 h-5 w-5 rounded-full border-[1px] border-gray-600",style:{background:d?"linear-gradient(180deg, #4480FF 0%, #3b79ff 50%, #2565f0 100%)":"white",borderColor:"rgb(75 85 99)"}})]}),B.jsxs("label",{onClick:()=>{setTimeout(()=>{u(!a)},100)},className:`${a?"bg-white/30 text-indigo-900 ring-indigo-200 ring-2":""} cursor-pointer text-[14px] ring-gray-100 ring-2 bg-white/40 hover:bg-white/20 w-[100%] p-4 rounded-md flex justify-between items-center shadow`,children:["Utilizar la plataforma como fabricante",B.jsx("label",{value:a,type:"checkbox",...b("productionPartner",{required:!0}),onChange:()=>u(!a),className:" checked:border-indigo-500 h-5 w-5 rounded-full border-[1px] border-gray-600",style:{background:a?"linear-gradient(180deg, #4480FF 0%, #115DFC 50%, #0550ED 100%)":"white",borderColor:"rgb(75 85 99)"}})]}),g&&!d&&!a&&B.jsx("p",{className:"error-message text-[14px] left-[-38%] relative",children:"Requerido"})]}),B.jsxs("div",{className:"relative note mt-2",children:[B.jsx("label",{className:"title",children:"¿Quieres saber más?"}),B.jsx("span",{className:"subtitle",children:"Déjanos tu contacto y te avisaremos"})]}),B.jsx("input",{...b("name",{required:"Requerido",pattern:{value:/^[A-Za-z]+$/i,message:"Nombre no valido"}}),placeholder:"Introduce tu nombre",title:"Introduce tu nombre",name:"name",type:"text",value:i,onChange:D=>r(D.target.value),className:"input_field text-[14px]"}),w&&B.jsx("p",{className:"error-message text-[14px] left-[-38%] relative",children:"Requerido"}),B.jsx("input",{...b("email",{required:"Requerido",pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Email no valido"}}),placeholder:"Introduce tu e-mail",title:"Enter your e-mail",name:"email",type:"email",value:s,onChange:D=>o(D.target.value),className:"input_field text-[14px]"}),v&&B.jsx("p",{className:"error-message text-[14px] left-[-38%] relative",children:"Requerido"}),B.jsx("textarea",{value:h,onChange:D=>p(D.target.value),className:"text_field text-[14px]",placeholder:"Haznos saber cómo podemos ayudarte"}),B.jsx("button",{onClick:D=>{D.preventDefault(),i==="siemprearroz"&&t(!0),P()},className:"submit",children:"Enviar"})]})})})]})})},vW=(n,e,t,i)=>(console.log(n,e,t,i),(n*e*t*i).toFixed(2)),yW=(n,e)=>{console.log(n,e);try{return(n*.44*e).toFixed(2)}catch(t){return console.log(t),0}},_W=(n,e)=>(console.log(n,e),(n*e).toFixed(2)),xW=({setSelectedTech:n})=>{const[e,t]=we.useState(!1),[i,r]=we.useState(!1),s=a=>{fc.map(u=>u.selected=!1),fc[a].selected=!fc[a].selected,console.log(fc[0]),t(!e),console.log(n),n(fc[a].label)},o=a=>{r(a)};return B.jsxs("div",{className:"w-[100%] gap-2 flex flex-wrap",children:[fc.map((a,u)=>B.jsx("div",{className:"flex flex-row w-[31%] h-40 mb-[-7%] relative",children:B.jsxs("div",{onClick:()=>s(u),className:`flex flex-col grow items-center text-base text-center text-black
                                border border-solid cursor-pointer
                                rounded-xl mt-8 
                                ${a.selected?"border-blue-500 border-[1.5px]":"border-stone-300"}
                                `,children:[a.label&&B.jsx("div",{className:"leading-[147%]",children:a.label}),a.image&&B.jsx("img",{loading:"lazy",src:a.image,alt:a.alt,className:` h-8 ${a.imageClass||a.imageClass===""?a.imageClass:"aspect-[0.84] w-[23px]"}`}),B.jsx("div",{className:"flex flex-col w-[90%] mt-1 text-[12px] leading-4",children:B.jsx("div",{children:a.description})}),B.jsx("div",{className:"w-[95%] z-20 px-2 py-0 text-[10px] font-semibold leading-2 hover:bg-transparent hover:border-none hover:text-[#49474C] bg-blue-500 text-white rounded-xl absolute bottom-1.5 left-1/2 transform -translate-x-1/2 ",onClick:()=>o(a.label),children:B.jsx("p",{className:"cursor-pointer font-medium hover:bg-transparent hover:border-none hover:text-[#49474C] font-poppins",onClick:()=>o(a.label),children:"More information"})})]})},u)),i==="FDM"&&B.jsxs("div",{className:"z-40 absolute left-1/2 transform -translate-x-1/2 mt-2 w-4/12",children:[B.jsx("span",{className:"cursor-pointer right-0 w-10 h-10 absolute z-50",onClick:()=>r(!1)}),B.jsx("img",{className:"",src:"https://res.cloudinary.com/dgtamgaup/image/upload/v1716885839/popup-fdm.png",alt:"FDM pop up"})]}),i==="SLA"&&B.jsxs("div",{className:"z-40 absolute left-1/2 transform -translate-x-1/2 mt-2 w-4/12",children:[B.jsx("span",{className:"cursor-pointer right-0 w-10 h-10 absolute z-50",onClick:()=>r(!1)}),B.jsx("img",{className:"",src:"https://res.cloudinary.com/dgtamgaup/image/upload/v1716885864/popup-sla.png",alt:"FDM pop up"})]}),i==="SLS"&&B.jsxs("div",{className:"z-40 absolute left-1/2 transform -translate-x-1/2 mt-2 w-4/12",children:[B.jsx("span",{className:"cursor-pointer right-0 w-10 h-10 absolute z-50",onClick:()=>r(!1)}),B.jsx("img",{className:"",src:"https://res.cloudinary.com/dgtamgaup/image/upload/v1716885896/popup-sls.png",alt:"FDM pop up"})]}),i&&B.jsx("div",{className:"z-30 fixed left-0 top-0 right-0 bottom-0 bg-black bg-opacity-50",onClick:()=>r(!1)})]})},fc=[{label:"FDM",image:"https://cdn.builder.io/api/v1/image/assets/TEMP/28ef7456e5fed657d6d9102dc4f00d3195ad11b1c9577e1dcd27f94cb53e534d?apiKey=1342f5df53a1444ebb376cd081066232&",alt:"Image of FDM",description:"Fused Deposition Modeling",selected:!0,imageClass:""},{image:"https://res.cloudinary.com/dgtamgaup/image/upload/v1716807713/sla.png",alt:"Image of Stereolithography",description:"Stereolithography",selected:!1,imageClass:"w-[36px] h-[36px]",label:"SLA"},{image:"https://res.cloudinary.com/dgtamgaup/image/upload/v1716807928/sls.png",alt:"Image of Selective Laser Sintering",description:"Selective Laser Sintering",selected:!1,imageClass:"w-[40px] h-[36px]",label:"SLS"},{label:"DMLS",image:"https://cdn.builder.io/api/v1/image/assets/TEMP/14ea8988641898afa501ca4e1e13f08cdb31d1b3ba0f5d6227c4d7cd28a1a7ba?apiKey=1342f5df53a1444ebb376cd081066232&",alt:"Image of Direct Metal Laser Sintering",description:"Direct Metal Laser Sintering",selected:!1,imageClass:""},{label:"CNC",image:"https://cdn.builder.io/api/v1/image/assets/TEMP/d01e8845f79bd0ba00130740e6c6ffe29d5455472dacfb145e80130cd4a5a07b?apiKey=1342f5df53a1444ebb376cd081066232&",alt:"Image of Machining",description:"Machining",selected:!1,imageClass:"aspect-[0.51] w-[49px]"},{label:"MJF",image:"https://res.cloudinary.com/dgtamgaup/image/upload/v1716807420/mjf_yksszy.png",alt:"Image of MJF",description:"MJF",selected:!1,imageClass:"aspect-[1.40] w-[36px] h-[36px]"}];function SW({setPrice:n,setQuantity:e,volume:t}){const[i,r]=we.useState(1),[s,o]=we.useState("FDM"),[a,u]=we.useState("0.035"),[d,f]=we.useState(1),[h,p]=we.useState(1.15),[g,y]=we.useState(1);if(setTimeout(()=>{const x=document.getElementById("postProduction").value;y(x)},1),setTimeout(()=>{const x=document.getElementById("material").value;u(x);const v=document.getElementById("infill").value;f(v);const _=document.getElementById("layerHeight").value;p(_),handlePriceChange()},2),console.log(s),s==="FDM"){const x=vW(t,a,d,h);n(x)}else if(s==="SLS"){const x=yW(t,g);n(x)}else if(s==="SLA"||s==="DMLS"){const x=_W(t,a);n(x)}const w=x=>{r(x.target.value),e(x.target.value),(i<1||x.target.value<1)&&(r(1),e(1))};return B.jsx(B.Fragment,{children:B.jsx("div",{className:"w-[100%]",children:B.jsx("div",{className:"flex w-[100%]",children:B.jsx("section",{className:"flex flex-col w-full",children:B.jsxs("div",{className:"flex flex-col w-full self-stretch my-0 max-md:mt-0 max-md:max-w-full",children:[B.jsx("div",{className:"z-10 relative top-3 mt-0 py-0 text-2xl mb-0 ml-2 font-medium leading-4 text-blue-700 max-md:max-w-full",children:"Select Production Technology"}),B.jsx("div",{className:"px-px mt-0 py-0 w-[100%] mb-14",children:B.jsx("div",{className:"flex items-center justify-center",children:B.jsx(xW,{setSelectedTech:o})})}),B.jsxs("div",{className:"flex gap-5 items-start px-4 pt-2 pb-2 mb-4 rounded-md border-2 border-solid bg-blue-500 bg-opacity-10 border-black border-opacity-20 max-md:flex-wrap",children:[B.jsx("div",{className:"flex z-10 flex-col px-4 pb-2.5 rounded-full border-indigo-800 border-solid border-[3px] stroke-[3px]",children:B.jsx("div",{className:"z-10 mt-0",children:"¡"})}),B.jsx("div",{className:"flex flex-col mb-0 grow shrink-0 text-sm leading-0 basis-0 text-zinc-600 w-fit",children:B.jsx("div",{className:"font-medium text-[12px] max-md:max-w-full",children:"Functional and durable parts. 10-100% solid parts, Medium-high precision. Rapid prototyping or mass production."})})]}),B.jsxs("div",{className:"mb-0",children:[B.jsx("h2",{className:"text-[16px] font-semibold text-blue-700 ",children:"Select Material"}),B.jsxs("select",{id:"material",onChange:x=>{u(x.target.value)},className:"w-full p-1 border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white h-8 text-[12px]  text-zinc-600 dark:text-zinc-400",children:[s==="FDM"&&B.jsxs(B.Fragment,{children:[B.jsx("option",{value:.035,children:"PLA"}),B.jsx("option",{value:.045,children:"ABS"}),B.jsx("option",{value:.045,children:"ASA"}),B.jsx("option",{value:.039,children:"PETG"})]}),s==="SLS"&&B.jsx(B.Fragment,{children:B.jsx("option",{value:.44,children:"NYLON PA12"})}),s==="SLA"&&B.jsxs(B.Fragment,{children:[B.jsx("option",{value:.25,children:"STANDARD"}),B.jsx("option",{value:.5,children:"ABS-LIKE"}),B.jsx("option",{value:.6,children:"NYLON-LIKE"})]}),s==="DMLS"&&B.jsxs(B.Fragment,{children:[B.jsx("option",{value:10,children:"316L Stainless Steel"}),B.jsx("option",{value:9,children:"ALUMINUM"}),B.jsx("option",{value:12,children:"COPPER"}),B.jsx("option",{value:15,children:"INCONEL 718"})]})]})]}),s==="FDM"&&B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"mb-0",children:[B.jsx("h2",{className:"text-[16px] font-semibold text-blue-700 ",children:"Layer Height"}),B.jsxs("select",{id:"layerHeight",onChange:x=>{p(x.target.value)},className:"w-full p-1 border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white h-8 text-[12px]  text-zinc-600 dark:text-zinc-400",children:[B.jsx("option",{value:1.15,children:"0.1mm"}),B.jsx("option",{value:1,children:"0.2mm"}),B.jsx("option",{value:1,children:"0.3mm"})]})]}),B.jsxs("div",{className:"mb-0",children:[B.jsx("h2",{className:"text-[16px] font-semibold text-blue-700 ",children:"Infill"}),B.jsxs("select",{id:"infill",onChange:x=>{f(x.target.value)},className:"w-full p-1 border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white h-8 text-[12px]  text-zinc-600 dark:text-zinc-400",children:[B.jsx("option",{value:1,children:"Light"}),B.jsx("option",{value:1.4,children:"Solid"})]})]})]}),s==="SLS"&&B.jsxs("div",{className:"mb-0",children:[B.jsx("h2",{className:"text-[16px] font-semibold text-blue-700 ",children:"Post Production"}),B.jsxs("select",{id:"postProduction",onChange:x=>{y(x.target.value)},className:"w-full p-1 border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white h-8 text-[12px]  text-zinc-600 dark:text-zinc-400",children:[B.jsx("option",{value:1,children:"None"}),B.jsx("option",{value:1.5,children:"Vapor polishing"}),B.jsx("option",{value:1.05,children:"Sandblasting"})]})]}),B.jsxs("div",{className:"mb-0",children:[B.jsx("h2",{className:"text-[16px] font-semibold text-blue-700 ",children:"Quantity"}),B.jsx("input",{type:"number",value:i,onChange:w,className:"w-full p-2 border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white h-8 text-[12px]  text-zinc-600 dark:text-zinc-400"})]})]})})})})})}function wW(){const[n,e]=we.useState(25),[t,i]=we.useState(1),[r,s]=we.useState(429,62),[o,a]=we.useState(!1),[u,d]=we.useState(!1),[f,h]=we.useState(!1);return console.log(o),we.useEffect(()=>{localStorage.removeItem("modelMetrics")},[]),B.jsxs(B.Fragment,{children:[B.jsx(MU,{position:"top-center",duration:2800,richColors:!0}),u?B.jsxs("div",{className:"absolute w-screen top-0 h-screen ",children:[B.jsx("div",{className:"flex flex-col items-center",children:B.jsx(lF,{})}),B.jsx("div",{className:"flex w-[100%] justify-center h-full  flex-row items-center",children:B.jsxs("div",{className:"h-[100%] w-[89%] relative flex flex-row justify-between",children:[B.jsx("div",{className:"w-[35%] h-[40%]",children:B.jsx(qG,{setVolume:s})}),B.jsx("div",{className:"w-[33%]",children:B.jsx(SW,{setPrice:e,setQuantity:i,volume:r})}),B.jsx("div",{className:"w-[24%] ",children:B.jsx(aF,{price:n,quantity:t,chatClicked:o,setChatClicked:a})}),o&&B.jsx("div",{className:"absolute z-40 right-[-1%] mt-[5%]  h-[72%] w-[35%] max-md:w-[25%]",children:B.jsx(sF,{setChatClicked:a})})]})})]}):B.jsx(gW,{setLoggedIn:d,setAdmin:h})]})}J_.createRoot(document.getElementById("root")).render(B.jsx(Me.StrictMode,{children:B.jsx(wW,{})}));
