diff --git "a/static/assets/index-0cb9f31c.js" "b/static/assets/index-0cb9f31c.js" new file mode 100644--- /dev/null +++ "b/static/assets/index-0cb9f31c.js" @@ -0,0 +1,3698 @@ +function IU(n,e){for(var t=0;tr[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function TA(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jd={},BU={get exports(){return Jd},set exports(n){Jd=n}},oy={},D={},LU={get exports(){return D},set exports(n){D=n}},Gt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Hp=Symbol.for("react.element"),DU=Symbol.for("react.portal"),OU=Symbol.for("react.fragment"),FU=Symbol.for("react.strict_mode"),NU=Symbol.for("react.profiler"),kU=Symbol.for("react.provider"),UU=Symbol.for("react.context"),zU=Symbol.for("react.forward_ref"),HU=Symbol.for("react.suspense"),GU=Symbol.for("react.memo"),VU=Symbol.for("react.lazy"),Zb=Symbol.iterator;function WU(n){return n===null||typeof n!="object"?null:(n=Zb&&n[Zb]||n["@@iterator"],typeof n=="function"?n:null)}var nB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},rB=Object.assign,iB={};function qf(n,e,t){this.props=n,this.context=e,this.refs=iB,this.updater=t||nB}qf.prototype.isReactComponent={};qf.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")};qf.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function sB(){}sB.prototype=qf.prototype;function bA(n,e,t){this.props=n,this.context=e,this.refs=iB,this.updater=t||nB}var CA=bA.prototype=new sB;CA.constructor=bA;rB(CA,qf.prototype);CA.isPureReactComponent=!0;var Qb=Array.isArray,oB=Object.prototype.hasOwnProperty,RA={current:null},aB={key:!0,ref:!0,__self:!0,__source:!0};function lB(n,e,t){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)oB.call(e,r)&&!aB.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1>>1,K=G[ue];if(0>>1;uei(Le,q))wei(Fe,Le)?(G[ue]=Fe,G[we]=q,ue=we):(G[ue]=Le,G[pe]=q,ue=pe);else if(wei(Fe,q))G[ue]=Fe,G[we]=q,ue=we;else break e}}return te}function i(G,te){var q=G.sortIndex-te.sortIndex;return q!==0?q:G.id-te.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 l=[],c=[],u=1,h=null,p=3,m=!1,g=!1,_=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(G){for(var te=t(c);te!==null;){if(te.callback===null)r(c);else if(te.startTime<=G)r(c),te.sortIndex=te.expirationTime,e(l,te);else break;te=t(c)}}function w(G){if(_=!1,S(G),!g)if(t(l)!==null)g=!0,ne(C);else{var te=t(c);te!==null&&ie(w,te.startTime-G)}}function C(G,te){g=!1,_&&(_=!1,v(I),I=-1),m=!0;var q=p;try{for(S(te),h=t(l);h!==null&&(!(h.expirationTime>te)||G&&!k());){var ue=h.callback;if(typeof ue=="function"){h.callback=null,p=h.priorityLevel;var K=ue(h.expirationTime<=te);te=n.unstable_now(),typeof K=="function"?h.callback=K:h===t(l)&&r(l),S(te)}else r(l);h=t(l)}if(h!==null)var ve=!0;else{var pe=t(c);pe!==null&&ie(w,pe.startTime-te),ve=!1}return ve}finally{h=null,p=q,m=!1}}var b=!1,B=null,I=-1,R=5,L=-1;function k(){return!(n.unstable_now()-LG||125ue?(G.sortIndex=q,e(c,G),t(l)===null&&G===t(c)&&(_?(v(I),I=-1):_=!0,ie(w,q-ue))):(G.sortIndex=K,e(l,G),g||m||(g=!0,ne(C))),G},n.unstable_shouldYield=k,n.unstable_wrapCallback=function(G){var te=p;return function(){var q=p;p=te;try{return G.apply(this,arguments)}finally{p=q}}}})(uB);(function(n){n.exports=uB})(iz);/** + * @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 fB=D,ji=eS;function Oe(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tS=Object.prototype.hasOwnProperty,sz=/^[: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]*$/,tC={},nC={};function oz(n){return tS.call(nC,n)?!0:tS.call(tC,n)?!1:sz.test(n)?nC[n]=!0:(tC[n]=!0,!1)}function az(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function lz(n,e,t,r){if(e===null||typeof e>"u"||az(n,e,t,r))return!0;if(r)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 fi(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Cr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Cr[n]=new fi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Cr[e]=new fi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Cr[n]=new fi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Cr[n]=new fi(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){Cr[n]=new fi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Cr[n]=new fi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Cr[n]=new fi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Cr[n]=new fi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Cr[n]=new fi(n,5,!1,n.toLowerCase(),null,!1,!1)});var IA=/[\-:]([a-z])/g;function BA(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(IA,BA);Cr[e]=new fi(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(IA,BA);Cr[e]=new fi(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(IA,BA);Cr[e]=new fi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Cr[n]=new fi(n,1,!1,n.toLowerCase(),null,!1,!1)});Cr.xlinkHref=new fi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Cr[n]=new fi(n,1,!1,n.toLowerCase(),null,!0,!0)});function LA(n,e,t,r){var i=Cr.hasOwnProperty(e)?Cr[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` +`+i[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{h1=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?gd(n):""}function cz(n){switch(n.tag){case 5:return gd(n.type);case 16:return gd("Lazy");case 13:return gd("Suspense");case 19:return gd("SuspenseList");case 0:case 2:case 15:return n=d1(n.type,!1),n;case 11:return n=d1(n.type.render,!1),n;case 1:return n=d1(n.type,!0),n;default:return""}}function sS(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 Ju:return"Fragment";case Xu:return"Portal";case nS:return"Profiler";case DA:return"StrictMode";case rS:return"Suspense";case iS:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case pB:return(n.displayName||"Context")+".Consumer";case dB:return(n._context.displayName||"Context")+".Provider";case OA:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case FA:return e=n.displayName||null,e!==null?e:sS(n.type)||"Memo";case Wa:e=n._payload,n=n._init;try{return sS(n(e))}catch{}}return null}function uz(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 sS(e);case 8:return e===DA?"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 ml(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function gB(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function fz(n){var e=gB(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Eg(n){n._valueTracker||(n._valueTracker=fz(n))}function vB(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=gB(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function f0(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 oS(n,e){var t=e.checked;return zn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function iC(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=ml(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function yB(n,e){e=e.checked,e!=null&&LA(n,"checked",e,!1)}function aS(n,e){yB(n,e);var t=ml(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?lS(n,e.type,t):e.hasOwnProperty("defaultValue")&&lS(n,e.type,ml(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function sC(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+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 lS(n,e,t){(e!=="number"||f0(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var vd=Array.isArray;function uf(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Ag.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function Yd(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var bd={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},hz=["Webkit","ms","Moz","O"];Object.keys(bd).forEach(function(n){hz.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),bd[e]=bd[n]})});function EB(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||bd.hasOwnProperty(n)&&bd[n]?(""+e).trim():e+"px"}function AB(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=EB(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var dz=zn({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 fS(n,e){if(e){if(dz[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 hS(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 dS=null;function NA(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var pS=null,ff=null,hf=null;function lC(n){if(n=Wp(n)){if(typeof pS!="function")throw Error(Oe(280));var e=n.stateNode;e&&(e=fy(e),pS(n.stateNode,n.type,e))}}function wB(n){ff?hf?hf.push(n):hf=[n]:ff=n}function MB(){if(ff){var n=ff,e=hf;if(hf=ff=null,lC(n),e)for(n=0;n>>=0,n===0?32:31-(wz(n)/Mz|0)|0}var wg=64,Mg=4194304;function yd(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 m0(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=yd(a):(s&=o,s!==0&&(r=yd(s)))}else o=t&~i,o!==0?r=yd(o):s!==0&&(r=yd(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function Gp(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Gs(e),n[e]=t}function Rz(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 r=n.eventTimes;for(n=n.expirationTimes;0=Rd),vC=String.fromCharCode(32),yC=!1;function $B(n,e){switch(n){case"keyup":return rH.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jB(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ku=!1;function sH(n,e){switch(n){case"compositionend":return jB(e);case"keypress":return e.which!==32?null:(yC=!0,vC);case"textInput":return n=e.data,n===vC&&yC?null:n;default:return null}}function oH(n,e){if(Ku)return n==="compositionend"||!$A&&$B(n,e)?(n=VB(),Wv=GA=qa=null,Ku=!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)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=EC(t)}}function YB(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?YB(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function qB(){for(var n=window,e=f0();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=f0(n.document)}return e}function jA(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 mH(n){var e=qB(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&YB(t.ownerDocument.documentElement,t)){if(r!==null&&jA(t)){if(e=r.start,n=r.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 i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=AC(t,s);var o=AC(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(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=document.documentMode,Yu=null,xS=null,Id=null,SS=!1;function wC(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;SS||Yu==null||Yu!==f0(r)||(r=Yu,"selectionStart"in r&&jA(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Id&&np(Id,r)||(Id=r,r=y0(xS,"onSelect"),0Qu||(n.current=bS[Qu],bS[Qu]=null,Qu--)}function gn(n,e){Qu++,bS[Qu]=n.current,n.current=e}var gl={},Vr=Ml(gl),Ai=Ml(!1),Tc=gl;function Tf(n,e){var t=n.type.contextTypes;if(!t)return gl;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function wi(n){return n=n.childContextTypes,n!=null}function x0(){An(Ai),An(Vr)}function IC(n,e,t){if(Vr.current!==gl)throw Error(Oe(168));gn(Vr,e),gn(Ai,t)}function oL(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Oe(108,uz(n)||"Unknown",i));return zn({},t,r)}function S0(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||gl,Tc=Vr.current,gn(Vr,n),gn(Ai,Ai.current),!0}function BC(n,e,t){var r=n.stateNode;if(!r)throw Error(Oe(169));t?(n=oL(n,e,Tc),r.__reactInternalMemoizedMergedChildContext=n,An(Ai),An(Vr),gn(Vr,n)):An(Ai),gn(Ai,t)}var ta=null,hy=!1,b1=!1;function aL(n){ta===null?ta=[n]:ta.push(n)}function bH(n){hy=!0,aL(n)}function Tl(){if(!b1&&ta!==null){b1=!0;var n=0,e=sn;try{var t=ta;for(sn=1;n>=o,i-=o,sa=1<<32-Gs(e)+i|t<I?(R=B,B=null):R=B.sibling;var L=p(v,B,S[I],w);if(L===null){B===null&&(B=R);break}n&&B&&L.alternate===null&&e(v,B),E=s(L,E,I),b===null?C=L:b.sibling=L,b=L,B=R}if(I===S.length)return t(v,B),Cn&&Zl(v,I),C;if(B===null){for(;II?(R=B,B=null):R=B.sibling;var k=p(v,B,L.value,w);if(k===null){B===null&&(B=R);break}n&&B&&k.alternate===null&&e(v,B),E=s(k,E,I),b===null?C=k:b.sibling=k,b=k,B=R}if(L.done)return t(v,B),Cn&&Zl(v,I),C;if(B===null){for(;!L.done;I++,L=S.next())L=h(v,L.value,w),L!==null&&(E=s(L,E,I),b===null?C=L:b.sibling=L,b=L);return Cn&&Zl(v,I),C}for(B=r(v,B);!L.done;I++,L=S.next())L=m(B,v,I,L.value,w),L!==null&&(n&&L.alternate!==null&&B.delete(L.key===null?I:L.key),E=s(L,E,I),b===null?C=L:b.sibling=L,b=L);return n&&B.forEach(function(X){return e(v,X)}),Cn&&Zl(v,I),C}function x(v,E,S,w){if(typeof S=="object"&&S!==null&&S.type===Ju&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Sg:e:{for(var C=S.key,b=E;b!==null;){if(b.key===C){if(C=S.type,C===Ju){if(b.tag===7){t(v,b.sibling),E=i(b,S.props.children),E.return=v,v=E;break e}}else if(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Wa&&UC(C)===b.type){t(v,b.sibling),E=i(b,S.props),E.ref=Kh(v,b,S),E.return=v,v=E;break e}t(v,b);break}else e(v,b);b=b.sibling}S.type===Ju?(E=yc(S.props.children,v.mode,w,S.key),E.return=v,v=E):(w=Zv(S.type,S.key,S.props,null,v.mode,w),w.ref=Kh(v,E,S),w.return=v,v=w)}return o(v);case Xu:e:{for(b=S.key;E!==null;){if(E.key===b)if(E.tag===4&&E.stateNode.containerInfo===S.containerInfo&&E.stateNode.implementation===S.implementation){t(v,E.sibling),E=i(E,S.children||[]),E.return=v,v=E;break e}else{t(v,E);break}else e(v,E);E=E.sibling}E=O1(S,v.mode,w),E.return=v,v=E}return o(v);case Wa:return b=S._init,x(v,E,b(S._payload),w)}if(vd(S))return g(v,E,S,w);if(Wh(S))return _(v,E,S,w);Bg(v,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,E!==null&&E.tag===6?(t(v,E.sibling),E=i(E,S),E.return=v,v=E):(t(v,E),E=D1(S,v.mode,w),E.return=v,v=E),o(v)):t(v,E)}return x}var Cf=mL(!0),gL=mL(!1),$p={},wo=Ml($p),op=Ml($p),ap=Ml($p);function cc(n){if(n===$p)throw Error(Oe(174));return n}function tw(n,e){switch(gn(ap,e),gn(op,n),gn(wo,$p),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:uS(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=uS(e,n)}An(wo),gn(wo,e)}function Rf(){An(wo),An(op),An(ap)}function vL(n){cc(ap.current);var e=cc(wo.current),t=uS(e,n.type);e!==t&&(gn(op,n),gn(wo,t))}function nw(n){op.current===n&&(An(wo),An(op))}var On=Ml(0);function b0(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 C1=[];function rw(){for(var n=0;nt?t:4,n(!0);var r=R1.transition;R1.transition={};try{n(!1),e()}finally{sn=t,R1.transition=r}}function LL(){return Es().memoizedState}function IH(n,e,t){var r=al(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},DL(n))OL(e,t);else if(t=fL(n,e,t,r),t!==null){var i=oi();Vs(t,n,r,i),FL(t,e,r)}}function BH(n,e,t){var r=al(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(DL(n))OL(e,i);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(i.hasEagerState=!0,i.eagerState=a,Xs(a,o)){var l=e.interleaved;l===null?(i.next=i,QA(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=fL(n,e,i,r),t!==null&&(i=oi(),Vs(t,n,r,i),FL(t,e,r))}}function DL(n){var e=n.alternate;return n===Un||e!==null&&e===Un}function OL(n,e){Bd=C0=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function FL(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,UA(n,t)}}var R0={readContext:Ss,useCallback:Or,useContext:Or,useEffect:Or,useImperativeHandle:Or,useInsertionEffect:Or,useLayoutEffect:Or,useMemo:Or,useReducer:Or,useRef:Or,useState:Or,useDebugValue:Or,useDeferredValue:Or,useTransition:Or,useMutableSource:Or,useSyncExternalStore:Or,useId:Or,unstable_isNewReconciler:!1},LH={readContext:Ss,useCallback:function(n,e){return yo().memoizedState=[n,e===void 0?null:e],n},useContext:Ss,useEffect:HC,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Jv(4194308,4,CL.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Jv(4194308,4,n,e)},useInsertionEffect:function(n,e){return Jv(4,2,n,e)},useMemo:function(n,e){var t=yo();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=yo();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=IH.bind(null,Un,n),[r.memoizedState,n]},useRef:function(n){var e=yo();return n={current:n},e.memoizedState=n},useState:zC,useDebugValue:lw,useDeferredValue:function(n){return yo().memoizedState=n},useTransition:function(){var n=zC(!1),e=n[0];return n=PH.bind(null,n[1]),yo().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Un,i=yo();if(Cn){if(t===void 0)throw Error(Oe(407));t=t()}else{if(t=e(),Er===null)throw Error(Oe(349));Cc&30||xL(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,HC(EL.bind(null,r,s,n),[n]),r.flags|=2048,up(9,SL.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=yo(),e=Er.identifierPrefix;if(Cn){var t=oa,r=sa;t=(r&~(1<<32-Gs(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=lp++,0<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[_o]=e,n[sp]=r,$L(n,e,!1,!1),e.stateNode=n;e:{switch(o=hS(t,r),t){case"dialog":yn("cancel",n),yn("close",n),i=r;break;case"iframe":case"object":case"embed":yn("load",n),i=r;break;case"video":case"audio":for(i=0;i<_d.length;i++)yn(_d[i],n);i=r;break;case"source":yn("error",n),i=r;break;case"img":case"image":case"link":yn("error",n),yn("load",n),i=r;break;case"details":yn("toggle",n),i=r;break;case"input":iC(n,r),i=oS(n,r),yn("invalid",n);break;case"option":i=r;break;case"select":n._wrapperState={wasMultiple:!!r.multiple},i=zn({},r,{value:void 0}),yn("invalid",n);break;case"textarea":oC(n,r),i=cS(n,r),yn("invalid",n);break;default:i=r}fS(t,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?AB(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&SB(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&Yd(n,l):typeof l=="number"&&Yd(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Kd.hasOwnProperty(s)?l!=null&&s==="onScroll"&&yn("scroll",n):l!=null&&LA(n,s,l,o))}switch(t){case"input":Eg(n),sC(n,r,!1);break;case"textarea":Eg(n),aC(n);break;case"option":r.value!=null&&n.setAttribute("value",""+ml(r.value));break;case"select":n.multiple=!!r.multiple,s=r.value,s!=null?uf(n,!!r.multiple,s,!1):r.defaultValue!=null&&uf(n,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(n.onclick=_0)}switch(t){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Fr(e),null;case 6:if(n&&e.stateNode!=null)XL(n,e,n.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(Oe(166));if(t=cc(ap.current),cc(wo.current),Ig(e)){if(r=e.stateNode,t=e.memoizedProps,r[_o]=e,(s=r.nodeValue!==t)&&(n=Vi,n!==null))switch(n.tag){case 3:Pg(r.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Pg(r.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else r=(t.nodeType===9?t:t.ownerDocument).createTextNode(r),r[_o]=e,e.stateNode=r}return Fr(e),null;case 13:if(An(On),r=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Cn&&ki!==null&&e.mode&1&&!(e.flags&128))uL(),bf(),e.flags|=98560,s=!1;else if(s=Ig(e),r!==null&&r.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[_o]=e}else bf(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Fr(e),s=!1}else ks!==null&&(jS(ks),ks=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(r=r!==null,r!==(n!==null&&n.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(n===null||On.current&1?hr===0&&(hr=3):mw())),e.updateQueue!==null&&(e.flags|=4),Fr(e),null);case 4:return Rf(),kS(n,e),n===null&&rp(e.stateNode.containerInfo),Fr(e),null;case 10:return ZA(e.type._context),Fr(e),null;case 17:return wi(e.type)&&x0(),Fr(e),null;case 19:if(An(On),s=e.memoizedState,s===null)return Fr(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)Yh(s,!1);else{if(hr!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=b0(n),o!==null){for(e.flags|=128,Yh(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=t,t=e.child;t!==null;)s=t,n=r,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 gn(On,On.current&1|2),e.child}n=n.sibling}s.tail!==null&&Qn()>If&&(e.flags|=128,r=!0,Yh(s,!1),e.lanes=4194304)}else{if(!r)if(n=b0(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Yh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Cn)return Fr(e),null}else 2*Qn()-s.renderingStartTime>If&&t!==1073741824&&(e.flags|=128,r=!0,Yh(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=Qn(),e.sibling=null,t=On.current,gn(On,r?t&1|2:t&1),e):(Fr(e),null);case 22:case 23:return pw(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Oi&1073741824&&(Fr(e),e.subtreeFlags&6&&(e.flags|=8192)):Fr(e),null;case 24:return null;case 25:return null}throw Error(Oe(156,e.tag))}function HH(n,e){switch(JA(e),e.tag){case 1:return wi(e.type)&&x0(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Rf(),An(Ai),An(Vr),rw(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return nw(e),null;case 13:if(An(On),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Oe(340));bf()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return An(On),null;case 4:return Rf(),null;case 10:return ZA(e.type._context),null;case 22:case 23:return pw(),null;case 24:return null;default:return null}}var Dg=!1,Ur=!1,GH=typeof WeakSet=="function"?WeakSet:Set,ot=null;function rf(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Wn(n,e,r)}else t.current=null}function US(n,e,t){try{t()}catch(r){Wn(n,e,r)}}var YC=!1;function VH(n,e){if(ES=g0,n=qB(),jA(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,h=n,p=null;t:for(;;){for(var m;h!==t||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)p=h,h=m;for(;;){if(h===n)break t;if(p===t&&++c===i&&(a=o),p===s&&++u===r&&(l=o),(m=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(AS={focusedElem:n,selectionRange:t},g0=!1,ot=e;ot!==null;)if(e=ot,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ot=n;else for(;ot!==null;){e=ot;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var _=g.memoizedProps,x=g.memoizedState,v=e.stateNode,E=v.getSnapshotBeforeUpdate(e.elementType===e.type?_:Os(e.type,_),x);v.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(w){Wn(e,e.return,w)}if(n=e.sibling,n!==null){n.return=e.return,ot=n;break}ot=e.return}return g=YC,YC=!1,g}function Ld(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&US(e,t,s)}i=i.next}while(i!==r)}}function my(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 r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function zS(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 JL(n){var e=n.alternate;e!==null&&(n.alternate=null,JL(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[_o],delete e[sp],delete e[TS],delete e[MH],delete e[TH])),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 KL(n){return n.tag===5||n.tag===3||n.tag===4}function qC(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||KL(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 HS(n,e,t){var r=n.tag;if(r===5||r===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=_0));else if(r!==4&&(n=n.child,n!==null))for(HS(n,e,t),n=n.sibling;n!==null;)HS(n,e,t),n=n.sibling}function GS(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(GS(n,e,t),n=n.sibling;n!==null;)GS(n,e,t),n=n.sibling}var Mr=null,Ns=!1;function Oa(n,e,t){for(t=t.child;t!==null;)YL(n,e,t),t=t.sibling}function YL(n,e,t){if(Ao&&typeof Ao.onCommitFiberUnmount=="function")try{Ao.onCommitFiberUnmount(ay,t)}catch{}switch(t.tag){case 5:Ur||rf(t,e);case 6:var r=Mr,i=Ns;Mr=null,Oa(n,e,t),Mr=r,Ns=i,Mr!==null&&(Ns?(n=Mr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Mr.removeChild(t.stateNode));break;case 18:Mr!==null&&(Ns?(n=Mr,t=t.stateNode,n.nodeType===8?T1(n.parentNode,t):n.nodeType===1&&T1(n,t),ep(n)):T1(Mr,t.stateNode));break;case 4:r=Mr,i=Ns,Mr=t.stateNode.containerInfo,Ns=!0,Oa(n,e,t),Mr=r,Ns=i;break;case 0:case 11:case 14:case 15:if(!Ur&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&US(t,e,o),i=i.next}while(i!==r)}Oa(n,e,t);break;case 1:if(!Ur&&(rf(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Wn(t,e,a)}Oa(n,e,t);break;case 21:Oa(n,e,t);break;case 22:t.mode&1?(Ur=(r=Ur)||t.memoizedState!==null,Oa(n,e,t),Ur=r):Oa(n,e,t);break;default:Oa(n,e,t)}}function ZC(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new GH),e.forEach(function(r){var i=ZH.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Ps(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Qn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*$H(r/1960))-r,10n?16:n,Za===null)var r=!1;else{if(n=Za,Za=null,B0=0,Xt&6)throw Error(Oe(331));var i=Xt;for(Xt|=4,ot=n.current;ot!==null;){var s=ot,o=s.child;if(ot.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lQn()-hw?vc(n,0):fw|=t),Mi(n,e)}function iD(n,e){e===0&&(n.mode&1?(e=Mg,Mg<<=1,!(Mg&130023424)&&(Mg=4194304)):e=1);var t=oi();n=ga(n,e),n!==null&&(Gp(n,e,t),Mi(n,t))}function qH(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),iD(n,t)}function ZH(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(Oe(314))}r!==null&&r.delete(e),iD(n,t)}var sD;sD=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ai.current)Si=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Si=!1,UH(n,e,t);Si=!!(n.flags&131072)}else Si=!1,Cn&&e.flags&1048576&&lL(e,A0,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Kv(n,e),n=e.pendingProps;var i=Tf(e,Vr.current);pf(e,t),i=sw(null,e,r,n,i,t);var s=ow();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,wi(r)?(s=!0,S0(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ew(e),i.updater=dy,e.stateNode=i,i._reactInternals=e,BS(e,r,n,t),e=OS(null,e,r,!0,s,t)):(e.tag=0,Cn&&s&&XA(e),ei(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Kv(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=e4(r),n=Os(r,n),i){case 0:e=DS(null,e,r,n,t);break e;case 1:e=XC(null,e,r,n,t);break e;case 11:e=$C(null,e,r,n,t);break e;case 14:e=jC(null,e,r,Os(r.type,n),t);break e}throw Error(Oe(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Os(r,i),DS(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Os(r,i),XC(n,e,r,i,t);case 3:e:{if(GL(e),n===null)throw Error(Oe(387));r=e.pendingProps,s=e.memoizedState,i=s.element,hL(n,e),T0(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Pf(Error(Oe(423)),e),e=JC(n,e,r,t,i);break e}else if(r!==i){i=Pf(Error(Oe(424)),e),e=JC(n,e,r,t,i);break e}else for(ki=il(e.stateNode.containerInfo.firstChild),Vi=e,Cn=!0,ks=null,t=gL(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(bf(),r===i){e=va(n,e,t);break e}ei(n,e,r,t)}e=e.child}return e;case 5:return vL(e),n===null&&RS(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,wS(r,i)?o=null:s!==null&&wS(r,s)&&(e.flags|=32),HL(n,e),ei(n,e,o,t),e.child;case 6:return n===null&&RS(e),null;case 13:return VL(n,e,t);case 4:return tw(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Cf(e,null,r,t):ei(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Os(r,i),$C(n,e,r,i,t);case 7:return ei(n,e,e.pendingProps,t),e.child;case 8:return ei(n,e,e.pendingProps.children,t),e.child;case 12:return ei(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,gn(w0,r._currentValue),r._currentValue=o,s!==null)if(Xs(s.value,o)){if(s.children===i.children&&!Ai.current){e=va(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 l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=la(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),PS(s.return,t,e),a.lanes|=t;break}l=l.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),PS(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}ei(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,pf(e,t),i=Ss(i),r=r(i),e.flags|=1,ei(n,e,r,t),e.child;case 14:return r=e.type,i=Os(r,e.pendingProps),i=Os(r.type,i),jC(n,e,r,i,t);case 15:return UL(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Os(r,i),Kv(n,e),e.tag=1,wi(r)?(n=!0,S0(e)):n=!1,pf(e,t),pL(e,r,i),BS(e,r,i,t),OS(null,e,r,!0,n,t);case 19:return WL(n,e,t);case 22:return zL(n,e,t)}throw Error(Oe(156,e.tag))};function oD(n,e){return BB(n,e)}function QH(n,e,t,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gs(n,e,t,r){return new QH(n,e,t,r)}function gw(n){return n=n.prototype,!(!n||!n.isReactComponent)}function e4(n){if(typeof n=="function")return gw(n)?1:0;if(n!=null){if(n=n.$$typeof,n===OA)return 11;if(n===FA)return 14}return 2}function ll(n,e){var t=n.alternate;return t===null?(t=gs(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 Zv(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")gw(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Ju:return yc(t.children,i,s,e);case DA:o=8,i|=8;break;case nS:return n=gs(12,t,e,i|2),n.elementType=nS,n.lanes=s,n;case rS:return n=gs(13,t,e,i),n.elementType=rS,n.lanes=s,n;case iS:return n=gs(19,t,e,i),n.elementType=iS,n.lanes=s,n;case mB:return vy(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case dB:o=10;break e;case pB:o=9;break e;case OA:o=11;break e;case FA:o=14;break e;case Wa:o=16,r=null;break e}throw Error(Oe(130,n==null?n:typeof n,""))}return e=gs(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function yc(n,e,t,r){return n=gs(7,n,r,e),n.lanes=t,n}function vy(n,e,t,r){return n=gs(22,n,r,e),n.elementType=mB,n.lanes=t,n.stateNode={isHidden:!1},n}function D1(n,e,t){return n=gs(6,n,null,e),n.lanes=t,n}function O1(n,e,t){return e=gs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function t4(n,e,t,r,i){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=m1(0),this.expirationTimes=m1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=m1(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vw(n,e,t,r,i,s,o,a,l){return n=new t4(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=gs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},ew(s),n}function n4(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}e(),n.exports=Ki})(rz);const uD=TA(Mc);var oR=Mc;Qx.createRoot=oR.createRoot,Qx.hydrateRoot=oR.hydrateRoot;/** + * @license + * Copyright 2010-2023 Three.js Authors + * SPDX-License-Identifier: MIT + */const jp="153",ec={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},tc={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},fD=0,XS=1,hD=2,a4=3,dD=0,Ey=1,Fd=2,Fs=3,Co=0,ai=1,ps=2,l4=2,ca=0,_c=1,JS=2,KS=3,YS=4,pD=5,ic=100,mD=101,gD=102,qS=103,ZS=104,vD=200,yD=201,_D=202,xD=203,Sw=204,Ew=205,SD=206,ED=207,AD=208,wD=209,MD=210,TD=0,bD=1,CD=2,O0=3,RD=4,PD=5,ID=6,BD=7,Xp=0,LD=1,DD=2,Ws=0,OD=1,FD=2,ND=3,Aw=4,kD=5,Ay=300,ya=301,vl=302,Ic=303,hp=304,eh=306,Ro=1e3,fr=1001,Bf=1002,$n=1003,dp=1004,c4=1004,gf=1005,u4=1005,pn=1006,wy=1007,f4=1007,Po=1008,h4=1008,Mo=1009,UD=1010,zD=1011,My=1012,ww=1013,aa=1014,Hr=1015,ri=1016,Mw=1017,Tw=1018,cl=1020,HD=1021,ni=1023,GD=1024,VD=1025,ul=1026,Bc=1027,bw=1028,Cw=1029,WD=1030,Rw=1031,Pw=1033,Qv=33776,e0=33777,t0=33778,n0=33779,QS=35840,eE=35841,tE=35842,nE=35843,$D=36196,rE=37492,iE=37496,sE=37808,oE=37809,aE=37810,lE=37811,cE=37812,uE=37813,fE=37814,hE=37815,dE=37816,pE=37817,mE=37818,gE=37819,vE=37820,yE=37821,r0=36492,jD=36283,_E=36284,xE=36285,SE=36286,XD=2200,JD=2201,KD=2202,Lf=2300,Lc=2301,i0=2302,uc=2400,fc=2401,pp=2402,Ty=2500,Iw=2501,YD=0,Bw=1,F0=2,Lw=3e3,fl=3001,qD=3200,ZD=3201,bl=0,QD=1,hl="",It="srgb",Js="srgb-linear",Dw="display-p3",d4=0,s0=7680,p4=7681,m4=7682,g4=7683,v4=34055,y4=34056,_4=5386,x4=512,S4=513,E4=514,A4=515,w4=516,M4=517,T4=518,eO=519,tO=512,nO=513,rO=514,iO=515,sO=516,oO=517,aO=518,lO=519,mp=35044,b4=35048,C4=35040,R4=35045,P4=35049,I4=35041,B4=35046,L4=35050,D4=35042,O4="100",EE="300 es",N0=1035,So=2e3,gp=2001;class Do{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+Nr[n>>16&255]+Nr[n>>24&255]+"-"+Nr[e&255]+Nr[e>>8&255]+"-"+Nr[e>>16&15|64]+Nr[e>>24&255]+"-"+Nr[t&63|128]+Nr[t>>8&255]+"-"+Nr[t>>16&255]+Nr[t>>24&255]+Nr[r&255]+Nr[r>>8&255]+Nr[r>>16&255]+Nr[r>>24&255]).toLowerCase()}function jn(n,e,t){return Math.max(e,Math.min(t,n))}function Ow(n,e){return(n%e+e)%e}function F4(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function N4(n,e,t){return n!==e?(t-n)/(e-n):0}function Nd(n,e,t){return(1-t)*n+t*e}function k4(n,e,t,r){return Nd(n,e,1-Math.exp(-t*r))}function U4(n,e=1){return e-Math.abs(Ow(n,e*2)-e)}function z4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function H4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function G4(n,e){return n+Math.floor(Math.random()*(e-n+1))}function V4(n,e){return n+Math.random()*(e-n)}function W4(n){return n*(.5-Math.random())}function $4(n){n!==void 0&&(aR=n);let e=aR+=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 j4(n){return n*xc}function X4(n){return n*Df}function AE(n){return(n&n-1)===0&&n!==0}function cO(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function k0(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function J4(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),u=o((e+r)/2),h=s((e-r)/2),p=o((e-r)/2),m=s((r-e)/2),g=o((r-e)/2);switch(i){case"XYX":n.set(a*u,l*h,l*p,a*c);break;case"YZY":n.set(l*p,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*p,a*u,a*c);break;case"XZX":n.set(a*u,l*g,l*m,a*c);break;case"YXY":n.set(l*m,a*u,l*g,a*c);break;case"ZYZ":n.set(l*g,l*m,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ui(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 Ft(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 zr={DEG2RAD:xc,RAD2DEG:Df,generateUUID:Wi,clamp:jn,euclideanModulo:Ow,mapLinear:F4,inverseLerp:N4,lerp:Nd,damp:k4,pingpong:U4,smoothstep:z4,smootherstep:H4,randInt:G4,randFloat:V4,randFloatSpread:W4,seededRandom:$4,degToRad:j4,radToDeg:X4,isPowerOfTwo:AE,ceilPowerOfTwo:cO,floorPowerOfTwo:k0,setQuaternionFromProperEuler:J4,normalize:Ft,denormalize:Ui};class Me{constructor(e=0,t=0){Me.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,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(jn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,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 r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bt{constructor(e,t,r,i,s,o,a,l,c){Bt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=r,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.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 r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],u=r[4],h=r[7],p=r[2],m=r[5],g=r[8],_=i[0],x=i[3],v=i[6],E=i[1],S=i[4],w=i[7],C=i[2],b=i[5],B=i[8];return s[0]=o*_+a*E+l*C,s[3]=o*x+a*S+l*b,s[6]=o*v+a*w+l*B,s[1]=c*_+u*E+h*C,s[4]=c*x+u*S+h*b,s[7]=c*v+u*w+h*B,s[2]=p*_+m*E+g*C,s[5]=p*x+m*S+g*b,s[8]=p*v+m*w+g*B,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],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-r*s*u+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,p=a*l-u*s,m=c*s-o*l,g=t*h+r*p+i*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(i*c-u*r)*_,e[2]=(a*r-i*o)*_,e[3]=p*_,e[4]=(u*t-i*l)*_,e[5]=(i*s-a*t)*_,e[6]=m*_,e[7]=(r*l-c*t)*_,e[8]=(o*t-r*s)*_,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,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(F1.makeScale(e,t)),this}rotate(e){return this.premultiply(F1.makeRotation(-e)),this}translate(e,t){return this.premultiply(F1.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),r=Math.sin(e);return this.set(t,-r,0,r,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,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const F1=new Bt;function uO(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const K4={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function of(n,e){return new K4[n](e)}function vp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const lR={};function kd(n){n in lR||(lR[n]=!0,console.warn(n))}function vf(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function N1(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const Y4=new Bt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),q4=new Bt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Z4(n){return n.convertSRGBToLinear().applyMatrix3(q4)}function Q4(n){return n.applyMatrix3(Y4).convertLinearToSRGB()}const eG={[Js]:n=>n,[It]:n=>n.convertSRGBToLinear(),[Dw]:Z4},tG={[Js]:n=>n,[It]:n=>n.convertLinearToSRGB(),[Dw]:Q4},ls={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return Js},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const r=eG[e],i=tG[t];if(r===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let vu;class Fw{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{vu===void 0&&(vu=vp("canvas")),vu.width=e.width,vu.height=e.height;const r=vu.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=vu}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=vp("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ay)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ro:e.x=e.x-Math.floor(e.x);break;case fr:e.x=e.x<0?0:1;break;case Bf: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 Ro:e.y=e.y-Math.floor(e.y);break;case fr:e.y=e.y<0?0:1;break;case Bf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return kd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===It?fl:Lw}set encoding(e){kd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===fl?It:hl}}mn.DEFAULT_IMAGE=null;mn.DEFAULT_MAPPING=Ay;mn.DEFAULT_ANISOTROPY=1;class jt{constructor(e=0,t=0,r=0,i=1){jt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,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,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+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,r,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],p=l[1],m=l[5],g=l[9],_=l[2],x=l[6],v=l[10];if(Math.abs(u-p)<.01&&Math.abs(h-_)<.01&&Math.abs(g-x)<.01){if(Math.abs(u+p)<.1&&Math.abs(h+_)<.1&&Math.abs(g+x)<.1&&Math.abs(c+m+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(c+1)/2,w=(m+1)/2,C=(v+1)/2,b=(u+p)/4,B=(h+_)/4,I=(g+x)/4;return S>w&&S>C?S<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(S),i=b/r,s=B/r):w>C?w<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(w),r=b/i,s=I/i):C<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(C),r=B/s,i=I/s),this.set(r,i,s,t),this}let E=Math.sqrt((x-g)*(x-g)+(h-_)*(h-_)+(p-u)*(p-u));return Math.abs(E)<.001&&(E=1),this.x=(x-g)/E,this.y=(h-_)/E,this.z=(p-u)/E,this.w=Math.acos((c+m+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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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 Ks extends Do{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new jt(0,0,e,t),this.scissorTest=!1,this.viewport=new jt(0,0,e,t);const i={width:e,height:t,depth:1};r.encoding!==void 0&&(kd("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=r.encoding===fl?It:hl),this.texture=new mn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:pn,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,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.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new hc(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class by extends mn{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=$n,this.minFilter=$n,this.wrapR=fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class iG extends Ks{constructor(e=1,t=1,r=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new by(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class Nw extends mn{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=$n,this.minFilter=$n,this.wrapR=fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class sG extends Ks{constructor(e=1,t=1,r=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new Nw(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class oG extends Ks{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,S=1-v*v;if(S>Number.EPSILON){const C=Math.sqrt(S),b=Math.atan2(C,v*E);x=Math.sin(x*b)/C,a=Math.sin(a*b)/C}const w=a*E;if(l=l*x+p*w,c=c*x+m*w,u=u*x+g*w,h=h*x+_*w,x===1-a){const C=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=C,c*=C,u*=C,h*=C}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],u=r[i+3],h=s[o],p=s[o+1],m=s[o+2],g=s[o+3];return e[t]=a*g+u*h+l*m-c*p,e[t+1]=l*g+u*p+c*h-a*m,e[t+2]=c*g+u*m+a*p-l*h,e[t+3]=u*g-a*h-l*p-c*m,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,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),u=a(i/2),h=a(s/2),p=l(r/2),m=l(i/2),g=l(s/2);switch(o){case"XYZ":this._x=p*u*h+c*m*g,this._y=c*m*h-p*u*g,this._z=c*u*g+p*m*h,this._w=c*u*h-p*m*g;break;case"YXZ":this._x=p*u*h+c*m*g,this._y=c*m*h-p*u*g,this._z=c*u*g-p*m*h,this._w=c*u*h+p*m*g;break;case"ZXY":this._x=p*u*h-c*m*g,this._y=c*m*h+p*u*g,this._z=c*u*g+p*m*h,this._w=c*u*h-p*m*g;break;case"ZYX":this._x=p*u*h-c*m*g,this._y=c*m*h+p*u*g,this._z=c*u*g-p*m*h,this._w=c*u*h+p*m*g;break;case"YZX":this._x=p*u*h+c*m*g,this._y=c*m*h+p*u*g,this._z=c*u*g-p*m*h,this._w=c*u*h-p*m*g;break;case"XZY":this._x=p*u*h-c*m*g,this._y=c*m*h-p*u*g,this._z=c*u*g+p*m*h,this._w=c*u*h+p*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],p=r+a+h;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-i)*m}else if(r>a&&r>h){const m=2*Math.sqrt(1+r-a-h);this._w=(u-l)/m,this._x=.25*m,this._y=(i+o)/m,this._z=(s+c)/m}else if(a>h){const m=2*Math.sqrt(1+a-r-h);this._w=(s-c)/m,this._x=(i+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+h-r-a);this._w=(o-i)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(jn(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=r*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-r*c,this._z=s*u+o*c+r*l-i*a,this._w=o*u-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*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=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*r+t*this._x,this._y=m*i+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,p=Math.sin(t*u)/c;return this._w=o*h+this._w*p,this._x=r*h+this._x*p,this._y=i*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(s),r*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class z{constructor(e=0,t=0,r=0){z.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,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(cR.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cR.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*r,u=l*r+a*t-s*i,h=l*i+s*r-o*t,p=-s*t-o*r-a*i;return this.x=c*l+p*-s+u*-a-h*-o,this.y=u*l+p*-o+h*-s-c*-a,this.z=h*l+p*-a+c*-o-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return U1.copy(this).projectOnVector(e),this.sub(U1)}reflect(e){return this.sub(U1.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 r=this.dot(e)/t;return Math.acos(jn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const U1=new z,cR=new Xn;class eo{constructor(e=new z(1/0,1/0,1/0),t=new z(-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,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Xo),Xo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Zh),Ng.subVectors(this.max,Zh),_u.subVectors(e.a,Zh),xu.subVectors(e.b,Zh),Su.subVectors(e.c,Zh),Fa.subVectors(xu,_u),Na.subVectors(Su,xu),Hl.subVectors(_u,Su);let t=[0,-Fa.z,Fa.y,0,-Na.z,Na.y,0,-Hl.z,Hl.y,Fa.z,0,-Fa.x,Na.z,0,-Na.x,Hl.z,0,-Hl.x,-Fa.y,Fa.x,0,-Na.y,Na.x,0,-Hl.y,Hl.x,0];return!z1(t,_u,xu,Su,Ng)||(t=[1,0,0,0,1,0,0,0,1],!z1(t,_u,xu,Su,Ng))?!1:(kg.crossVectors(Fa,Na),t=[kg.x,kg.y,kg.z],z1(t,_u,xu,Su,Ng))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xo).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:(jo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),jo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),jo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),jo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),jo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),jo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),jo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),jo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(jo),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 jo=[new z,new z,new z,new z,new z,new z,new z,new z],Xo=new z,yu=new eo,_u=new z,xu=new z,Su=new z,Fa=new z,Na=new z,Hl=new z,Zh=new z,Ng=new z,kg=new z,Gl=new z;function z1(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Gl.fromArray(n,s);const a=i.x*Math.abs(Gl.x)+i.y*Math.abs(Gl.y)+i.z*Math.abs(Gl.z),l=e.dot(Gl),c=t.dot(Gl),u=r.dot(Gl);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const aG=new eo,Qh=new z,H1=new z;class ws{constructor(e=new z,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):aG.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.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;Qh.subVectors(e,this.center);const t=Qh.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Qh,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(H1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qh.copy(e.center).add(H1)),this.expandByPoint(Qh.copy(e.center).sub(H1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Jo=new z,G1=new z,Ug=new z,ka=new z,V1=new z,zg=new z,W1=new z;class th{constructor(e=new z,t=new z(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,Jo)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Jo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Jo.copy(this.origin).addScaledVector(this.direction,t),Jo.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){G1.copy(e).add(t).multiplyScalar(.5),Ug.copy(t).sub(e).normalize(),ka.copy(this.origin).sub(G1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Ug),a=ka.dot(this.direction),l=-ka.dot(Ug),c=ka.lengthSq(),u=Math.abs(1-o*o);let h,p,m,g;if(u>0)if(h=o*l-a,p=o*a-l,g=s*u,h>=0)if(p>=-g)if(p<=g){const _=1/u;h*=_,p*=_,m=h*(h+o*p+2*a)+p*(o*h+p+2*l)+c}else p=s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;else p=-s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;else p<=-g?(h=Math.max(0,-(-o*s+a)),p=h>0?-s:Math.min(Math.max(-s,-l),s),m=-h*h+p*(p+2*l)+c):p<=g?(h=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(h=Math.max(0,-(o*s+a)),p=h>0?s:Math.min(Math.max(-s,-l),s),m=-h*h+p*(p+2*l)+c);else p=o>0?-s:s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(G1).addScaledVector(Ug,p),m}intersectSphere(e,t){Jo.subVectors(e.center,this.origin);const r=Jo.dot(this.direction),i=Jo.dot(Jo)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,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 r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,p=this.origin;return c>=0?(r=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(r=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-p.z)*h,l=(e.max.z-p.z)*h):(a=(e.max.z-p.z)*h,l=(e.min.z-p.z)*h),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Jo)!==null}intersectTriangle(e,t,r,i,s){V1.subVectors(t,e),zg.subVectors(r,e),W1.crossVectors(V1,zg);let o=this.direction.dot(W1),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ka.subVectors(this.origin,e);const l=a*this.direction.dot(zg.crossVectors(ka,zg));if(l<0)return null;const c=a*this.direction.dot(V1.cross(ka));if(c<0||l+c>o)return null;const u=-a*ka.dot(W1);return u<0?null:this.at(u/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 tt{constructor(e,t,r,i,s,o,a,l,c,u,h,p,m,g,_,x){tt.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,r,i,s,o,a,l,c,u,h,p,m,g,_,x)}set(e,t,r,i,s,o,a,l,c,u,h,p,m,g,_,x){const v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=i,v[1]=s,v[5]=o,v[9]=a,v[13]=l,v[2]=c,v[6]=u,v[10]=h,v[14]=p,v[3]=m,v[7]=g,v[11]=_,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 tt().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[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,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/Eu.setFromMatrixColumn(e,0).length(),s=1/Eu.setFromMatrixColumn(e,1).length(),o=1/Eu.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*u,m=o*h,g=a*u,_=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=m+g*c,t[5]=p-_*c,t[9]=-a*l,t[2]=_-p*c,t[6]=g+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*u,m=l*h,g=c*u,_=c*h;t[0]=p+_*a,t[4]=g*a-m,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=m*a-g,t[6]=_+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*u,m=l*h,g=c*u,_=c*h;t[0]=p-_*a,t[4]=-o*h,t[8]=g+m*a,t[1]=m+g*a,t[5]=o*u,t[9]=_-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*u,m=o*h,g=a*u,_=a*h;t[0]=l*u,t[4]=g*c-m,t[8]=p*c+_,t[1]=l*h,t[5]=_*c+p,t[9]=m*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=_-p*h,t[8]=g*h+m,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*h+g,t[10]=p-_*h}else if(e.order==="XZY"){const p=o*l,m=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=p*h+_,t[5]=o*u,t[9]=m*h-g,t[2]=g*h-m,t[6]=a*u,t[10]=_*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(lG,e,cG)}lookAt(e,t,r){const i=this.elements;return Li.subVectors(e,t),Li.lengthSq()===0&&(Li.z=1),Li.normalize(),Ua.crossVectors(r,Li),Ua.lengthSq()===0&&(Math.abs(r.z)===1?Li.x+=1e-4:Li.z+=1e-4,Li.normalize(),Ua.crossVectors(r,Li)),Ua.normalize(),Hg.crossVectors(Li,Ua),i[0]=Ua.x,i[4]=Hg.x,i[8]=Li.x,i[1]=Ua.y,i[5]=Hg.y,i[9]=Li.y,i[2]=Ua.z,i[6]=Hg.z,i[10]=Li.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],u=r[1],h=r[5],p=r[9],m=r[13],g=r[2],_=r[6],x=r[10],v=r[14],E=r[3],S=r[7],w=r[11],C=r[15],b=i[0],B=i[4],I=i[8],R=i[12],L=i[1],k=i[5],X=i[9],$=i[13],Y=i[2],Z=i[6],ne=i[10],ie=i[14],G=i[3],te=i[7],q=i[11],ue=i[15];return s[0]=o*b+a*L+l*Y+c*G,s[4]=o*B+a*k+l*Z+c*te,s[8]=o*I+a*X+l*ne+c*q,s[12]=o*R+a*$+l*ie+c*ue,s[1]=u*b+h*L+p*Y+m*G,s[5]=u*B+h*k+p*Z+m*te,s[9]=u*I+h*X+p*ne+m*q,s[13]=u*R+h*$+p*ie+m*ue,s[2]=g*b+_*L+x*Y+v*G,s[6]=g*B+_*k+x*Z+v*te,s[10]=g*I+_*X+x*ne+v*q,s[14]=g*R+_*$+x*ie+v*ue,s[3]=E*b+S*L+w*Y+C*G,s[7]=E*B+S*k+w*Z+C*te,s[11]=E*I+S*X+w*ne+C*q,s[15]=E*R+S*$+w*ie+C*ue,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],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],p=e[10],m=e[14],g=e[3],_=e[7],x=e[11],v=e[15];return g*(+s*l*h-i*c*h-s*a*p+r*c*p+i*a*m-r*l*m)+_*(+t*l*m-t*c*p+s*o*p-i*o*m+i*c*u-s*l*u)+x*(+t*c*h-t*a*m-s*o*h+r*o*m+s*a*u-r*c*u)+v*(-i*a*u-t*l*h+t*a*p+i*o*h-r*o*p+r*l*u)}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,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],m=e[11],g=e[12],_=e[13],x=e[14],v=e[15],E=h*x*c-_*p*c+_*l*m-a*x*m-h*l*v+a*p*v,S=g*p*c-u*x*c-g*l*m+o*x*m+u*l*v-o*p*v,w=u*_*c-g*h*c+g*a*m-o*_*m-u*a*v+o*h*v,C=g*h*l-u*_*l-g*a*p+o*_*p+u*a*x-o*h*x,b=t*E+r*S+i*w+s*C;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/b;return e[0]=E*B,e[1]=(_*p*s-h*x*s-_*i*m+r*x*m+h*i*v-r*p*v)*B,e[2]=(a*x*s-_*l*s+_*i*c-r*x*c-a*i*v+r*l*v)*B,e[3]=(h*l*s-a*p*s-h*i*c+r*p*c+a*i*m-r*l*m)*B,e[4]=S*B,e[5]=(u*x*s-g*p*s+g*i*m-t*x*m-u*i*v+t*p*v)*B,e[6]=(g*l*s-o*x*s-g*i*c+t*x*c+o*i*v-t*l*v)*B,e[7]=(o*p*s-u*l*s+u*i*c-t*p*c-o*i*m+t*l*m)*B,e[8]=w*B,e[9]=(g*h*s-u*_*s-g*r*m+t*_*m+u*r*v-t*h*v)*B,e[10]=(o*_*s-g*a*s+g*r*c-t*_*c-o*r*v+t*a*v)*B,e[11]=(u*a*s-o*h*s-u*r*c+t*h*c+o*r*m-t*a*m)*B,e[12]=C*B,e[13]=(u*_*i-g*h*i+g*r*p-t*_*p-u*r*x+t*h*x)*B,e[14]=(g*a*i-o*_*i-g*r*l+t*_*l+o*r*x-t*a*x)*B,e[15]=(o*h*i-u*a*i+u*r*l-t*h*l-o*r*p+t*a*p)*B,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+r,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,p=s*c,m=s*u,g=s*h,_=o*u,x=o*h,v=a*h,E=l*c,S=l*u,w=l*h,C=r.x,b=r.y,B=r.z;return i[0]=(1-(_+v))*C,i[1]=(m+w)*C,i[2]=(g-S)*C,i[3]=0,i[4]=(m-w)*b,i[5]=(1-(p+v))*b,i[6]=(x+E)*b,i[7]=0,i[8]=(g+S)*B,i[9]=(x-E)*B,i[10]=(1-(p+_))*B,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=Eu.set(i[0],i[1],i[2]).length();const o=Eu.set(i[4],i[5],i[6]).length(),a=Eu.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Is.copy(this);const c=1/s,u=1/o,h=1/a;return Is.elements[0]*=c,Is.elements[1]*=c,Is.elements[2]*=c,Is.elements[4]*=u,Is.elements[5]*=u,Is.elements[6]*=u,Is.elements[8]*=h,Is.elements[9]*=h,Is.elements[10]*=h,t.setFromRotationMatrix(Is),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=So){const l=this.elements,c=2*s/(t-e),u=2*s/(r-i),h=(t+e)/(t-e),p=(r+i)/(r-i);let m,g;if(a===So)m=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===gp)m=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=So){const l=this.elements,c=1/(t-e),u=1/(r-i),h=1/(o-s),p=(t+e)*c,m=(r+i)*u;let g,_;if(a===So)g=(o+s)*h,_=-2*h;else if(a===gp)g=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const Eu=new z,Is=new tt,lG=new z(0,0,0),cG=new z(1,1,1),Ua=new z,Hg=new z,Li=new z,uR=new tt,fR=new Xn;class Eo{constructor(e=0,t=0,r=0,i=Eo.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],p=i[6],m=i[10];switch(t){case"XYZ":this._y=Math.asin(jn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-jn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(jn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-jn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(jn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-jn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return uR.makeRotationFromQuaternion(e),this.setFromRotationMatrix(uR,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fR.setFromEuler(this),this.setFromQuaternion(fR,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}}Eo.DEFAULT_ORDER="XYZ";class Sc{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(r=r.concat(o))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ed,e,fG),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ed,hG,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 r=0,i=t.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),u.length>0&&(r.images=u),h.length>0&&(r.shapes=h),p.length>0&&(r.skeletons=p),m.length>0&&(r.animations=m),g.length>0&&(r.nodes=g)}return r.object=i,r;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){Bs.subVectors(i,t),Yo.subVectors(r,t),$1.subVectors(e,t);const o=Bs.dot(Bs),a=Bs.dot(Yo),l=Bs.dot($1),c=Yo.dot(Yo),u=Yo.dot($1),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const p=1/h,m=(c*l-a*u)*p,g=(o*u-a*l)*p;return s.set(1-m-g,g,m)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,qo),qo.x>=0&&qo.y>=0&&qo.x+qo.y<=1}static getUV(e,t,r,i,s,o,a,l){return Vg===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Vg=!0),this.getInterpolation(e,t,r,i,s,o,a,l)}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,qo),l.setScalar(0),l.addScaledVector(s,qo.x),l.addScaledVector(o,qo.y),l.addScaledVector(a,qo.z),l}static isFrontFacing(e,t,r,i){return Bs.subVectors(r,t),Yo.subVectors(e,t),Bs.cross(Yo).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Bs.subVectors(this.c,this.b),Yo.subVectors(this.a,this.b),Bs.cross(Yo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return xi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return xi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return Vg===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Vg=!0),xi.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}getInterpolation(e,t,r,i,s){return xi.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return xi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return xi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;wu.subVectors(i,r),Mu.subVectors(s,r),j1.subVectors(e,r);const l=wu.dot(j1),c=Mu.dot(j1);if(l<=0&&c<=0)return t.copy(r);X1.subVectors(e,i);const u=wu.dot(X1),h=Mu.dot(X1);if(u>=0&&h<=u)return t.copy(i);const p=l*h-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(r).addScaledVector(wu,o);J1.subVectors(e,s);const m=wu.dot(J1),g=Mu.dot(J1);if(g>=0&&m<=g)return t.copy(s);const _=m*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(r).addScaledVector(Mu,a);const x=u*g-m*h;if(x<=0&&h-u>=0&&m-g>=0)return vR.subVectors(s,i),a=(h-u)/(h-u+(m-g)),t.copy(i).addScaledVector(vR,a);const v=1/(x+_+p);return o=_*v,a=p*v,t.copy(r).addScaledVector(wu,o).addScaledVector(Mu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let pG=0;class or extends Do{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pG++}),this.uuid=Wi(),this.name="",this.type="Material",this.blending=_c,this.side=Co,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Sw,this.blendDst=Ew,this.blendEquation=ic,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=O0,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=eO,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=s0,this.stencilZFail=s0,this.stencilZPass=s0,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 r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==_c&&(r.blending=this.blending),this.side!==Co&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(r.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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 r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const fO={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},Ls={h:0,s:0,l:0},Wg={h:0,s:0,l:0};function K1(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}let Ge=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=It){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ls.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=ls.workingColorSpace){return this.r=e,this.g=t,this.b=r,ls.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=ls.workingColorSpace){if(e=Ow(e,1),t=jn(t,0,1),r=jn(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=K1(o,s,e+1/3),this.g=K1(o,s,e),this.b=K1(o,s,e-1/3)}return ls.toWorkingColorSpace(this,i),this}setStyle(e,t=It){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[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 r(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 r(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 r(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(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[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=It){const r=fO[e.toLowerCase()];return r!==void 0?this.setHex(r,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=vf(e.r),this.g=vf(e.g),this.b=vf(e.b),this}copyLinearToSRGB(e){return this.r=N1(e.r),this.g=N1(e.g),this.b=N1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=It){return ls.fromWorkingColorSpace(kr.copy(this),e),Math.round(jn(kr.r*255,0,255))*65536+Math.round(jn(kr.g*255,0,255))*256+Math.round(jn(kr.b*255,0,255))}getHexString(e=It){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ls.workingColorSpace){ls.fromWorkingColorSpace(kr.copy(this),t);const r=kr.r,i=kr.g,s=kr.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case r:l=(i-s)/h+(i>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function mi(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=jn(n,-65504,65504),ra.floatView[0]=n;const e=ra.uint32View[0],t=e>>23&511;return ra.baseTable[t]+((e&8388607)>>ra.shiftTable[t])}function xd(n){const e=n>>10;return ra.uint32View[0]=ra.mantissaTable[ra.offsetTable[e]+(n&1023)]+ra.exponentTable[e],ra.floatView[0]}const dc={toHalfFloat:mi,fromHalfFloat:xd},rr=new z,$g=new Me;class Zt{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=mp,this.updateRange={offset:0,count:-1},this.gpuType=Hr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,p=c.length;h0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,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 r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let p=0,m=h.length;p0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(yR.copy(s).invert(),Vl.copy(e.ray).applyMatrix4(yR),!(r.boundingBox!==null&&Vl.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,Vl)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=p.length;g<_;g++){const x=p[g],v=o[x.materialIndex],E=Math.max(x.start,m.start),S=Math.min(a.count,Math.min(x.start+x.count,m.start+m.count));for(let w=E,C=S;wt.far?null:{distance:c,point:Zg.clone(),object:n}}function Qg(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,bu),n.getVertexPosition(l,Cu),n.getVertexPosition(c,Ru);const u=wG(n,e,t,r,bu,Cu,Ru,qg);if(u){i&&(Jg.fromBufferAttribute(i,a),Kg.fromBufferAttribute(i,l),Yg.fromBufferAttribute(i,c),u.uv=xi.getInterpolation(qg,bu,Cu,Ru,Jg,Kg,Yg,new Me)),s&&(Jg.fromBufferAttribute(s,a),Kg.fromBufferAttribute(s,l),Yg.fromBufferAttribute(s,c),u.uv1=xi.getInterpolation(qg,bu,Cu,Ru,Jg,Kg,Yg,new Me),u.uv2=u.uv1),o&&(xR.fromBufferAttribute(o,a),SR.fromBufferAttribute(o,l),ER.fromBufferAttribute(o,c),u.normal=xi.getInterpolation(qg,bu,Cu,Ru,xR,SR,ER,new z),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new z,materialIndex:0};xi.getNormal(bu,Cu,Ru,h.normal),u.face=h}return u}class Cl extends At{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let p=0,m=0;g("z","y","x",-1,-1,r,t,e,o,s,0),g("z","y","x",1,-1,r,t,-e,o,s,1),g("x","z","y",1,1,e,r,t,i,o,2),g("x","z","y",1,-1,e,r,-t,i,o,3),g("x","y","z",1,-1,e,t,r,i,s,4),g("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new it(c,3)),this.setAttribute("normal",new it(u,3)),this.setAttribute("uv",new it(h,2));function g(_,x,v,E,S,w,C,b,B,I,R){const L=w/B,k=C/I,X=w/2,$=C/2,Y=b/2,Z=B+1,ne=I+1;let ie=0,G=0;const te=new z;for(let q=0;q0?1:-1,u.push(te.x,te.y,te.z),h.push(K/B),h.push(1-q/I),ie+=1}}for(let q=0;q0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class Jp extends Ut{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tt,this.projectionMatrix=new tt,this.projectionMatrixInverse=new tt,this.coordinateSystem=So}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){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Fn extends Jp{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=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=Df*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(xc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Df*2*Math.atan(Math.tan(xc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,i,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=r,this.view.offsetY=i,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(xc*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,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 Pu=-90,Iu=1;class pO extends Ut{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null;const i=new Fn(Pu,Iu,e,t);i.layers=this.layers,this.add(i);const s=new Fn(Pu,Iu,e,t);s.layers=this.layers,this.add(s);const o=new Fn(Pu,Iu,e,t);o.layers=this.layers,this.add(o);const a=new Fn(Pu,Iu,e,t);a.layers=this.layers,this.add(a);const l=new Fn(Pu,Iu,e,t);l.layers=this.layers,this.add(l);const c=new Fn(Pu,Iu,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===So)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.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),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===gp)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.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),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,s,o,a,l,c]=this.children,u=e.getRenderTarget(),h=e.toneMapping,p=e.xr.enabled;e.toneMapping=Ws,e.xr.enabled=!1;const m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,s),e.setRenderTarget(r,2),e.render(t,o),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=m,e.setRenderTarget(r,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=p,r.texture.needsPMREMUpdate=!0}}class Kp extends mn{constructor(e,t,r,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:ya,super(e,t,r,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Uw extends Ks{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];t.encoding!==void 0&&(kd("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===fl?It:hl),this.texture=new Kp(i,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:pn}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 r={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Cl(5,5,5),s=new Ys({name:"CubemapFromEquirect",uniforms:Of(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:ai,blending:ca});s.uniforms.tEquirect.value=t;const o=new sr(i,s),a=t.minFilter;return t.minFilter===Po&&(t.minFilter=pn),new pO(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}const Z1=new z,CG=new z,RG=new Bt;class ja{constructor(e=new z(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,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=Z1.subVectors(r,t).cross(CG.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(Z1),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<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 r=t||RG.getNormalMatrix(e),i=this.coplanarPoint(Z1).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.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 Wl=new ws,ev=new z;class Ry{constructor(e=new ja,t=new ja,r=new ja,i=new ja,s=new ja,o=new ja){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=So){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],h=i[6],p=i[7],m=i[8],g=i[9],_=i[10],x=i[11],v=i[12],E=i[13],S=i[14],w=i[15];if(r[0].setComponents(l-s,p-c,x-m,w-v).normalize(),r[1].setComponents(l+s,p+c,x+m,w+v).normalize(),r[2].setComponents(l+o,p+u,x+g,w+E).normalize(),r[3].setComponents(l-o,p-u,x-g,w-E).normalize(),r[4].setComponents(l-a,p-h,x-_,w-S).normalize(),t===So)r[5].setComponents(l+a,p+h,x+_,w+S).normalize();else if(t===gp)r[5].setComponents(a,h,_,S).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(),Wl.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Wl.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Wl)}intersectsSprite(e){return Wl.center.set(0,0,0),Wl.radius=.7071067811865476,Wl.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wl)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)0?e.max.x:e.min.x,ev.y=i.normal.y>0?e.max.y:e.min.y,ev.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ev)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function mO(){let n=null,e=!1,t=null,r=null;function i(s,o){t(s,o),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function PG(n,e){const t=e.isWebGL2,r=new WeakMap;function i(c,u){const h=c.array,p=c.usage,m=n.createBuffer();n.bindBuffer(u,m),n.bufferData(u,h,p),c.onUploadCallback();let g;if(h instanceof Float32Array)g=n.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)g=n.SHORT;else if(h instanceof Uint32Array)g=n.UNSIGNED_INT;else if(h instanceof Int32Array)g=n.INT;else if(h instanceof Int8Array)g=n.BYTE;else if(h instanceof Uint8Array)g=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){const p=u.array,m=u.updateRange;n.bindBuffer(h,c),m.count===-1?n.bufferSubData(h,0,p):(t?n.bufferSubData(h,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):n.bufferSubData(h,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.count=-1),u.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),r.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=r.get(c);u&&(n.deleteBuffer(u.buffer),r.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const p=r.get(c);(!p||p.version 0 + vec4 plane; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif +#endif`,VG=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,WG=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,$G=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,jG=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,XG=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,JG=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + varying vec3 vColor; +#endif`,KG=`#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`,YG=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +struct GeometricContext { + vec3 position; + vec3 normal; + vec3 viewDir; +#ifdef USE_CLEARCOAT + vec3 clearcoatNormal; +#endif +}; +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); + return dot( weights, rgb ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,qG=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_v0 0.339 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_v1 0.276 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_v4 0.046 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_v5 0.016 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_v6 0.0038 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZG=`vec3 transformedNormal = objectNormal; +#ifdef USE_INSTANCING + mat3 m = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); + transformedNormal = m * transformedNormal; +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,QG=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,e5=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,t5=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,n5=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,r5="gl_FragColor = linearToOutputTexel( gl_FragColor );",i5=`vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 LinearTosRGB( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,s5=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,o5=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,a5=`#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`,l5=`#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`,c5=`#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`,u5=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,f5=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,h5=`#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`,d5=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,p5=`#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 +}`,m5=`#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + reflectedLight.indirectDiffuse += lightMapIrradiance; +#endif`,g5=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,v5=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,y5=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,_5=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +uniform vec3 lightProbe[ 9 ]; +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + #if defined ( LEGACY_LIGHTS ) + if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { + return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); + } + return 1.0; + #else + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; + #endif +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometry.position; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometry.position; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,x5=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,S5=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,E5=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,A5=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,w5=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,M5=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y; +#endif`,T5=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecular = vec3( 0.0 ); +vec3 sheenSpecular = vec3( 0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometry.normal; + vec3 viewDir = geometry.viewDir; + vec3 position = geometry.position; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,b5=` +GeometricContext geometry; +geometry.position = - vViewPosition; +geometry.normal = normal; +geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +#ifdef USE_CLEARCOAT + geometry.clearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometry.viewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometry, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometry, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, geometry, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,C5=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometry.normal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,R5=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); +#endif`,P5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,I5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,B5=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + varying float vFragDepth; + varying float vIsPerspective; + #else + uniform float logDepthBufFC; + #endif +#endif`,L5=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + #else + if ( isPerspectiveMatrix( projectionMatrix ) ) { + gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; + gl_Position.z *= gl_Position.w; + } + #endif +#endif`,D5=`#ifdef USE_MAP + diffuseColor *= texture2D( map, vMapUv ); +#endif`,O5=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,F5=`#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`,N5=`#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`,k5=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,U5=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,z5=`#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`,H5=`#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`,G5=`#ifdef USE_MORPHTARGETS + uniform float morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } + #else + #ifndef USE_MORPHNORMALS + uniform float morphTargetInfluences[ 8 ]; + #else + uniform float morphTargetInfluences[ 4 ]; + #endif + #endif +#endif`,V5=`#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`,W5=`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, vNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 geometryNormal = normal;`,$5=`#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`,j5=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,X5=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,J5=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,K5=`#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`,Y5=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = geometryNormal; +#endif`,q5=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,Z5=`#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`,Q5=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,e8=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,t8=`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 ); +}`,n8=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,r8=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,i8=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,s8=`#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`,o8=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,a8=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,l8=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return shadow; + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + vec3 lightToPosition = shadowCoord.xyz; + float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + return ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } +#endif`,c8=`#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`,u8=`#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`,f8=`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; +}`,h8=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,d8=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + uniform int boneTextureSize; + mat4 getBoneMatrix( const in float i ) { + float j = i * 4.0; + float x = mod( j, float( boneTextureSize ) ); + float y = floor( j / float( boneTextureSize ) ); + float dx = 1.0 / float( boneTextureSize ); + float dy = 1.0 / float( boneTextureSize ); + y = dy * ( y + 0.5 ); + vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); + vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); + vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); + vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); + mat4 bone = mat4( v1, v2, v3, v4 ); + return bone; + } +#endif`,p8=`#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`,m8=`#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`,g8=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,v8=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,y8=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,_8=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 OptimizedCineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,x8=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,S8=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,E8=`#ifdef USE_UV + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_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`,A8=`#ifdef USE_UV + 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`,w8=`#ifdef USE_UV + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_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`,M8=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const T8=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,b8=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,C8=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,R8=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,P8=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,I8=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,B8=`#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,L8=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + vec4 diffuseColor = vec4( 1.0 ); + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + 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 +}`,D8=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,O8=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + #include + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,F8=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,N8=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,k8=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,U8=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,z8=`#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,H8=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,G8=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,V8=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,W8=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,$8=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,j8=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,X8=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,J8=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,K8=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,Y8=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,q8=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,Z8=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,Q8=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,e9=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,t9=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,n9=`#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,r9=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,i9=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,s9=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Ot={alphamap_fragment:IG,alphamap_pars_fragment:BG,alphatest_fragment:LG,alphatest_pars_fragment:DG,aomap_fragment:OG,aomap_pars_fragment:FG,begin_vertex:NG,beginnormal_vertex:kG,bsdfs:UG,iridescence_fragment:zG,bumpmap_pars_fragment:HG,clipping_planes_fragment:GG,clipping_planes_pars_fragment:VG,clipping_planes_pars_vertex:WG,clipping_planes_vertex:$G,color_fragment:jG,color_pars_fragment:XG,color_pars_vertex:JG,color_vertex:KG,common:YG,cube_uv_reflection_fragment:qG,defaultnormal_vertex:ZG,displacementmap_pars_vertex:QG,displacementmap_vertex:e5,emissivemap_fragment:t5,emissivemap_pars_fragment:n5,encodings_fragment:r5,encodings_pars_fragment:i5,envmap_fragment:s5,envmap_common_pars_fragment:o5,envmap_pars_fragment:a5,envmap_pars_vertex:l5,envmap_physical_pars_fragment:x5,envmap_vertex:c5,fog_vertex:u5,fog_pars_vertex:f5,fog_fragment:h5,fog_pars_fragment:d5,gradientmap_pars_fragment:p5,lightmap_fragment:m5,lightmap_pars_fragment:g5,lights_lambert_fragment:v5,lights_lambert_pars_fragment:y5,lights_pars_begin:_5,lights_toon_fragment:S5,lights_toon_pars_fragment:E5,lights_phong_fragment:A5,lights_phong_pars_fragment:w5,lights_physical_fragment:M5,lights_physical_pars_fragment:T5,lights_fragment_begin:b5,lights_fragment_maps:C5,lights_fragment_end:R5,logdepthbuf_fragment:P5,logdepthbuf_pars_fragment:I5,logdepthbuf_pars_vertex:B5,logdepthbuf_vertex:L5,map_fragment:D5,map_pars_fragment:O5,map_particle_fragment:F5,map_particle_pars_fragment:N5,metalnessmap_fragment:k5,metalnessmap_pars_fragment:U5,morphcolor_vertex:z5,morphnormal_vertex:H5,morphtarget_pars_vertex:G5,morphtarget_vertex:V5,normal_fragment_begin:W5,normal_fragment_maps:$5,normal_pars_fragment:j5,normal_pars_vertex:X5,normal_vertex:J5,normalmap_pars_fragment:K5,clearcoat_normal_fragment_begin:Y5,clearcoat_normal_fragment_maps:q5,clearcoat_pars_fragment:Z5,iridescence_pars_fragment:Q5,output_fragment:e8,packing:t8,premultiplied_alpha_fragment:n8,project_vertex:r8,dithering_fragment:i8,dithering_pars_fragment:s8,roughnessmap_fragment:o8,roughnessmap_pars_fragment:a8,shadowmap_pars_fragment:l8,shadowmap_pars_vertex:c8,shadowmap_vertex:u8,shadowmask_pars_fragment:f8,skinbase_vertex:h8,skinning_pars_vertex:d8,skinning_vertex:p8,skinnormal_vertex:m8,specularmap_fragment:g8,specularmap_pars_fragment:v8,tonemapping_fragment:y8,tonemapping_pars_fragment:_8,transmission_fragment:x8,transmission_pars_fragment:S8,uv_pars_fragment:E8,uv_pars_vertex:A8,uv_vertex:w8,worldpos_vertex:M8,background_vert:T8,background_frag:b8,backgroundCube_vert:C8,backgroundCube_frag:R8,cube_vert:P8,cube_frag:I8,depth_vert:B8,depth_frag:L8,distanceRGBA_vert:D8,distanceRGBA_frag:O8,equirect_vert:F8,equirect_frag:N8,linedashed_vert:k8,linedashed_frag:U8,meshbasic_vert:z8,meshbasic_frag:H8,meshlambert_vert:G8,meshlambert_frag:V8,meshmatcap_vert:W8,meshmatcap_frag:$8,meshnormal_vert:j8,meshnormal_frag:X8,meshphong_vert:J8,meshphong_frag:K8,meshphysical_vert:Y8,meshphysical_frag:q8,meshtoon_vert:Z8,meshtoon_frag:Q8,points_vert:e9,points_frag:t9,shadow_vert:n9,shadow_frag:r9,sprite_vert:i9,sprite_frag:s9},je={common:{diffuse:{value:new Ge(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Bt},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Bt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Bt},normalScale:{value:new Me(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ge(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 Ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0},uvTransform:{value:new Bt}},sprite:{diffuse:{value:new Ge(16777215)},opacity:{value:1},center:{value:new Me(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Bt},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0}}},Us={basic:{uniforms:Qr([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.fog]),vertexShader:Ot.meshbasic_vert,fragmentShader:Ot.meshbasic_frag},lambert:{uniforms:Qr([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new Ge(0)}}]),vertexShader:Ot.meshlambert_vert,fragmentShader:Ot.meshlambert_frag},phong:{uniforms:Qr([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new Ge(0)},specular:{value:new Ge(1118481)},shininess:{value:30}}]),vertexShader:Ot.meshphong_vert,fragmentShader:Ot.meshphong_frag},standard:{uniforms:Qr([je.common,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.roughnessmap,je.metalnessmap,je.fog,je.lights,{emissive:{value:new Ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ot.meshphysical_vert,fragmentShader:Ot.meshphysical_frag},toon:{uniforms:Qr([je.common,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.gradientmap,je.fog,je.lights,{emissive:{value:new Ge(0)}}]),vertexShader:Ot.meshtoon_vert,fragmentShader:Ot.meshtoon_frag},matcap:{uniforms:Qr([je.common,je.bumpmap,je.normalmap,je.displacementmap,je.fog,{matcap:{value:null}}]),vertexShader:Ot.meshmatcap_vert,fragmentShader:Ot.meshmatcap_frag},points:{uniforms:Qr([je.points,je.fog]),vertexShader:Ot.points_vert,fragmentShader:Ot.points_frag},dashed:{uniforms:Qr([je.common,je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ot.linedashed_vert,fragmentShader:Ot.linedashed_frag},depth:{uniforms:Qr([je.common,je.displacementmap]),vertexShader:Ot.depth_vert,fragmentShader:Ot.depth_frag},normal:{uniforms:Qr([je.common,je.bumpmap,je.normalmap,je.displacementmap,{opacity:{value:1}}]),vertexShader:Ot.meshnormal_vert,fragmentShader:Ot.meshnormal_frag},sprite:{uniforms:Qr([je.sprite,je.fog]),vertexShader:Ot.sprite_vert,fragmentShader:Ot.sprite_frag},background:{uniforms:{uvTransform:{value:new Bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ot.background_vert,fragmentShader:Ot.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ot.backgroundCube_vert,fragmentShader:Ot.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ot.cube_vert,fragmentShader:Ot.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ot.equirect_vert,fragmentShader:Ot.equirect_frag},distanceRGBA:{uniforms:Qr([je.common,je.displacementmap,{referencePosition:{value:new z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ot.distanceRGBA_vert,fragmentShader:Ot.distanceRGBA_frag},shadow:{uniforms:Qr([je.lights,je.fog,{color:{value:new Ge(0)},opacity:{value:1}}]),vertexShader:Ot.shadow_vert,fragmentShader:Ot.shadow_frag}};Us.physical={uniforms:Qr([Us.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Bt},clearcoatNormalScale:{value:new Me(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Bt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Bt},sheen:{value:0},sheenColor:{value:new Ge(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Bt},transmissionSamplerSize:{value:new Me},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Bt},attenuationDistance:{value:0},attenuationColor:{value:new Ge(0)},specularColor:{value:new Ge(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Bt},anisotropyVector:{value:new Me},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Bt}}]),vertexShader:Ot.meshphysical_vert,fragmentShader:Ot.meshphysical_frag};const tv={r:0,b:0,g:0};function o9(n,e,t,r,i,s,o){const a=new Ge(0);let l=s===!0?0:1,c,u,h=null,p=0,m=null;function g(x,v){let E=!1,S=v.isScene===!0?v.background:null;switch(S&&S.isTexture&&(S=(v.backgroundBlurriness>0?t:e).get(S)),S===null?_(a,l):S&&S.isColor&&(_(S,1),E=!0),n.xr.getEnvironmentBlendMode()){case"opaque":E=!0;break;case"additive":r.buffers.color.setClear(0,0,0,1,o),E=!0;break;case"alpha-blend":r.buffers.color.setClear(0,0,0,0,o),E=!0;break}(n.autoClear||E)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===eh)?(u===void 0&&(u=new sr(new Cl(1,1,1),new Ys({name:"BackgroundCubeMaterial",uniforms:Of(Us.backgroundCube.uniforms),vertexShader:Us.backgroundCube.vertexShader,fragmentShader:Us.backgroundCube.fragmentShader,side:ai,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,B,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=S,u.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=S.colorSpace!==It,(h!==S||p!==S.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,h=S,p=S.version,m=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new sr(new nh(2,2),new Ys({name:"BackgroundMaterial",uniforms:Of(Us.background.uniforms),vertexShader:Us.background.vertexShader,fragmentShader:Us.background.fragmentShader,side:Co,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=S.colorSpace!==It,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||p!==S.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,h=S,p=S.version,m=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function _(x,v){x.getRGB(tv,hO(n)),r.buffers.color.setClear(tv.r,tv.g,tv.b,v,o)}return{getClearColor:function(){return a},setClearColor:function(x,v=1){a.set(x),l=v,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,_(a,l)},render:g}}function a9(n,e,t,r){const i=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=x(null);let c=l,u=!1;function h(Y,Z,ne,ie,G){let te=!1;if(o){const q=_(ie,ne,Z);c!==q&&(c=q,m(c.object)),te=v(Y,ie,ne,G),te&&E(Y,ie,ne,G)}else{const q=Z.wireframe===!0;(c.geometry!==ie.id||c.program!==ne.id||c.wireframe!==q)&&(c.geometry=ie.id,c.program=ne.id,c.wireframe=q,te=!0)}G!==null&&t.update(G,n.ELEMENT_ARRAY_BUFFER),(te||u)&&(u=!1,I(Y,Z,ne,ie),G!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(G).buffer))}function p(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(Y){return r.isWebGL2?n.bindVertexArray(Y):s.bindVertexArrayOES(Y)}function g(Y){return r.isWebGL2?n.deleteVertexArray(Y):s.deleteVertexArrayOES(Y)}function _(Y,Z,ne){const ie=ne.wireframe===!0;let G=a[Y.id];G===void 0&&(G={},a[Y.id]=G);let te=G[Z.id];te===void 0&&(te={},G[Z.id]=te);let q=te[ie];return q===void 0&&(q=x(p()),te[ie]=q),q}function x(Y){const Z=[],ne=[],ie=[];for(let G=0;G=0){const pe=G[K];let Le=te[K];if(Le===void 0&&(K==="instanceMatrix"&&Y.instanceMatrix&&(Le=Y.instanceMatrix),K==="instanceColor"&&Y.instanceColor&&(Le=Y.instanceColor)),pe===void 0||pe.attribute!==Le||Le&&pe.data!==Le.data)return!0;q++}return c.attributesNum!==q||c.index!==ie}function E(Y,Z,ne,ie){const G={},te=Z.attributes;let q=0;const ue=ne.getAttributes();for(const K in ue)if(ue[K].location>=0){let pe=te[K];pe===void 0&&(K==="instanceMatrix"&&Y.instanceMatrix&&(pe=Y.instanceMatrix),K==="instanceColor"&&Y.instanceColor&&(pe=Y.instanceColor));const Le={};Le.attribute=pe,pe&&pe.data&&(Le.data=pe.data),G[K]=Le,q++}c.attributes=G,c.attributesNum=q,c.index=ie}function S(){const Y=c.newAttributes;for(let Z=0,ne=Y.length;Z=0){let ve=G[ue];if(ve===void 0&&(ue==="instanceMatrix"&&Y.instanceMatrix&&(ve=Y.instanceMatrix),ue==="instanceColor"&&Y.instanceColor&&(ve=Y.instanceColor)),ve!==void 0){const pe=ve.normalized,Le=ve.itemSize,we=t.get(ve);if(we===void 0)continue;const Fe=we.buffer,et=we.type,ft=we.bytesPerElement,Pt=r.isWebGL2===!0&&(et===n.INT||et===n.UNSIGNED_INT||ve.gpuType===ww);if(ve.isInterleavedBufferAttribute){const st=ve.data,J=st.stride,Re=ve.offset;if(st.isInstancedInterleavedBuffer){for(let Ae=0;Ae0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),_=n.getParameter(n.MAX_VERTEX_ATTRIBS),x=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),v=n.getParameter(n.MAX_VARYING_VECTORS),E=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,w=o||e.has("OES_texture_float"),C=S&&w,b=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:E,vertexTextures:S,floatFragmentTextures:w,floatVertexTextures:C,maxSamples:b}}function u9(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new ja,a=new Bt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const m=h.length!==0||p||r!==0||i;return i=p,r=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,p){t=u(h,p,0)},this.setState=function(h,p,m){const g=h.clippingPlanes,_=h.clipIntersection,x=h.clipShadows,v=n.get(h);if(!i||g===null||g.length===0||s&&!x)s?u(null):c();else{const E=s?0:r,S=E*4;let w=v.clippingState||null;l.value=w,w=u(g,p,S,m);for(let C=0;C!==S;++C)w[C]=t[C];v.clippingState=w,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(h,p,m,g){const _=h!==null?h.length:0;let x=null;if(_!==0){if(x=l.value,g!==!0||x===null){const v=m+_*4,E=p.matrixWorldInverse;a.getNormalMatrix(E),(x===null||x.length0){const c=new Uw(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class To extends Jp{constructor(e=-1,t=1,r=1,i=-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=r,this.bottom=i,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,r,i,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=r,this.view.offsetY=i,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),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,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 af=4,AR=[.125,.215,.35,.446,.526,.582],sc=20,Q1=new To,wR=new Ge;let ex=null;const nc=(1+Math.sqrt(5))/2,Bu=1/nc,MR=[new z(1,1,1),new z(-1,1,1),new z(1,1,-1),new z(-1,1,-1),new z(0,nc,Bu),new z(0,nc,-Bu),new z(Bu,0,nc),new z(-Bu,0,nc),new z(nc,Bu,0),new z(-nc,Bu,0)];class wE{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,r=.1,i=100){ex=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,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=CR(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=bR(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),u.setRenderTarget(i),_&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=p,u.autoClear=h,e.background=x}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===ya||e.mapping===vl;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=CR()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=bR());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new sr(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;nv(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,Q1)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;isc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${sc}`);const v=[];let E=0;for(let B=0;BS-af?i-S+af:0),b=4*(this._cubeSize-w);nv(t,C,b,3*w,2*w),l.setRenderTarget(t),l.render(h,Q1)}}function h9(n){const e=[],t=[],r=[];let i=n;const s=n-af+1+AR.length;for(let o=0;on-af?l=AR[o-n+af-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),u=-c,h=1+c,p=[u,u,h,u,h,h,u,u,h,h,u,h],m=6,g=6,_=3,x=2,v=1,E=new Float32Array(_*g*m),S=new Float32Array(x*g*m),w=new Float32Array(v*g*m);for(let b=0;b2?0:-1,R=[B,I,0,B+2/3,I,0,B+2/3,I+1,0,B,I,0,B+2/3,I+1,0,B,I+1,0];E.set(R,_*g*b),S.set(p,x*g*b);const L=[b,b,b,b,b,b];w.set(L,v*g*b)}const C=new At;C.setAttribute("position",new Zt(E,_)),C.setAttribute("uv",new Zt(S,x)),C.setAttribute("faceIndex",new Zt(w,v)),e.push(C),i>af&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function TR(n,e,t){const r=new Ks(n,e,t);return r.texture.mapping=eh,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function nv(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function d9(n,e,t){const r=new Float32Array(sc),i=new z(0,1,0);return new Ys({name:"SphericalGaussianBlur",defines:{n:sc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:zw(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:ca,depthTest:!1,depthWrite:!1})}function bR(){return new Ys({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:zw(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:ca,depthTest:!1,depthWrite:!1})}function CR(){return new Ys({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:zw(),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:ca,depthTest:!1,depthWrite:!1})}function zw(){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 p9(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===Ic||l===hp,u=l===ya||l===vl;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new wE(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new wE(n));const p=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",s),p.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(k=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const X=new Float32Array(L*k*4*_),$=new by(X,L,k,_);$.type=Hr,$.needsUpdate=!0;const Y=R*4;for(let ne=0;ne<_;ne++){const ie=b[ne],G=B[ne],te=I[ne],q=L*k*4*ne;for(let ue=0;ue0)return n;const i=e*t;let s=RR[i];if(s===void 0&&(s=new Float32Array(i),RR[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function pr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` +`)}function m6(n){switch(n){case Js:return["Linear","( value )"];case It:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function FR(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` + +`+i+` + +`+p6(n.getShaderSource(e),o)}else return i}function g6(n,e){const t=m6(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function v6(n,e){let t;switch(e){case OD:t="Linear";break;case FD:t="Reinhard";break;case ND:t="OptimizedCineon";break;case Aw:t="ACESFilmic";break;case kD:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function y6(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Sd).join(` +`)}function _6(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` +`)}function x6(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function ME(n){return n.replace(S6,E6)}function E6(n,e){const t=Ot[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return ME(t)}const A6=/#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 UR(n){return n.replace(A6,w6)}function w6(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(x+=` +`),v=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Sd).join(` +`),v.length>0&&(v+=` +`)):(x=[zR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",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.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.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?"#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&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_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(Sd).join(` +`),v=[m,zR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",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.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents?"#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 "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ws?"#define TONE_MAPPING":"",t.toneMapping!==Ws?Ot.tonemapping_pars_fragment:"",t.toneMapping!==Ws?v6("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ot.encodings_pars_fragment,g6("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Sd).join(` +`)),o=ME(o),o=NR(o,t),o=kR(o,t),a=ME(a),a=NR(a,t),a=kR(a,t),o=UR(o),a=UR(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(E=`#version 300 es +`,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+x,v=["#define varying in",t.glslVersion===EE?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===EE?"":"#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 S=E+x+o,w=E+v+a,C=OR(i,i.VERTEX_SHADER,S),b=OR(i,i.FRAGMENT_SHADER,w);if(i.attachShader(_,C),i.attachShader(_,b),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_),n.debug.checkShaderErrors){const R=i.getProgramInfoLog(_).trim(),L=i.getShaderInfoLog(C).trim(),k=i.getShaderInfoLog(b).trim();let X=!0,$=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(X=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,_,C,b);else{const Y=FR(i,C,"vertex"),Z=FR(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+` + +Program Info Log: `+R+` +`+Y+` +`+Z)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(L===""||k==="")&&($=!1);$&&(this.diagnostics={runnable:X,programLog:R,vertexShader:{log:L,prefix:x},fragmentShader:{log:k,prefix:v}})}i.deleteShader(C),i.deleteShader(b);let B;this.getUniforms=function(){return B===void 0&&(B=new o0(i,_)),B};let I;return this.getAttributes=function(){return I===void 0&&(I=x6(i,_)),I},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=d6++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=C,this.fragmentShader=b,this}let I6=0;class B6{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new L6(e),t.set(e,r)),r}}class L6{constructor(e){this.id=I6++,this.code=e,this.usedTimes=0}}function D6(n,e,t,r,i,s,o){const a=new Sc,l=new B6,c=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,p=i.vertexTextures;let m=i.precision;const g={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 _(R){return R===0?"uv":`uv${R}`}function x(R,L,k,X,$){const Y=X.fog,Z=$.geometry,ne=R.isMeshStandardMaterial?X.environment:null,ie=(R.isMeshStandardMaterial?t:e).get(R.envMap||ne),G=ie&&ie.mapping===eh?ie.image.height:null,te=g[R.type];R.precision!==null&&(m=i.getMaxPrecision(R.precision),m!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",m,"instead."));const q=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,ue=q!==void 0?q.length:0;let K=0;Z.morphAttributes.position!==void 0&&(K=1),Z.morphAttributes.normal!==void 0&&(K=2),Z.morphAttributes.color!==void 0&&(K=3);let ve,pe,Le,we;if(te){const Mn=Us[te];ve=Mn.vertexShader,pe=Mn.fragmentShader}else ve=R.vertexShader,pe=R.fragmentShader,l.update(R),Le=l.getVertexShaderID(R),we=l.getFragmentShaderID(R);const Fe=n.getRenderTarget(),et=$.isInstancedMesh===!0,ft=!!R.map,Pt=!!R.matcap,st=!!ie,J=!!R.aoMap,Re=!!R.lightMap,Ae=!!R.bumpMap,De=!!R.normalMap,be=!!R.displacementMap,nt=!!R.emissiveMap,$e=!!R.metalnessMap,Xe=!!R.roughnessMap,ct=R.anisotropy>0,wt=R.clearcoat>0,tn=R.iridescence>0,U=R.sheen>0,N=R.transmission>0,he=ct&&!!R.anisotropyMap,Pe=wt&&!!R.clearcoatMap,Ie=wt&&!!R.clearcoatNormalMap,Ue=wt&&!!R.clearcoatRoughnessMap,Ye=tn&&!!R.iridescenceMap,He=tn&&!!R.iridescenceThicknessMap,ye=U&&!!R.sheenColorMap,ee=U&&!!R.sheenRoughnessMap,me=!!R.specularMap,Ce=!!R.specularColorMap,Be=!!R.specularIntensityMap,Ne=N&&!!R.transmissionMap,rt=N&&!!R.thicknessMap,gt=!!R.gradientMap,re=!!R.alphaMap,ce=R.alphaTest>0,ae=!!R.extensions,Ve=!!Z.attributes.uv1,Je=!!Z.attributes.uv2,zt=!!Z.attributes.uv3;return{isWebGL2:u,shaderID:te,shaderType:R.type,shaderName:R.name,vertexShader:ve,fragmentShader:pe,defines:R.defines,customVertexShaderID:Le,customFragmentShaderID:we,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:m,instancing:et,instancingColor:et&&$.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:Fe===null?n.outputColorSpace:Fe.isXRRenderTarget===!0?Fe.texture.colorSpace:Js,map:ft,matcap:Pt,envMap:st,envMapMode:st&&ie.mapping,envMapCubeUVHeight:G,aoMap:J,lightMap:Re,bumpMap:Ae,normalMap:De,displacementMap:p&&be,emissiveMap:nt,normalMapObjectSpace:De&&R.normalMapType===QD,normalMapTangentSpace:De&&R.normalMapType===bl,metalnessMap:$e,roughnessMap:Xe,anisotropy:ct,anisotropyMap:he,clearcoat:wt,clearcoatMap:Pe,clearcoatNormalMap:Ie,clearcoatRoughnessMap:Ue,iridescence:tn,iridescenceMap:Ye,iridescenceThicknessMap:He,sheen:U,sheenColorMap:ye,sheenRoughnessMap:ee,specularMap:me,specularColorMap:Ce,specularIntensityMap:Be,transmission:N,transmissionMap:Ne,thicknessMap:rt,gradientMap:gt,opaque:R.transparent===!1&&R.blending===_c,alphaMap:re,alphaTest:ce,combine:R.combine,mapUv:ft&&_(R.map.channel),aoMapUv:J&&_(R.aoMap.channel),lightMapUv:Re&&_(R.lightMap.channel),bumpMapUv:Ae&&_(R.bumpMap.channel),normalMapUv:De&&_(R.normalMap.channel),displacementMapUv:be&&_(R.displacementMap.channel),emissiveMapUv:nt&&_(R.emissiveMap.channel),metalnessMapUv:$e&&_(R.metalnessMap.channel),roughnessMapUv:Xe&&_(R.roughnessMap.channel),anisotropyMapUv:he&&_(R.anisotropyMap.channel),clearcoatMapUv:Pe&&_(R.clearcoatMap.channel),clearcoatNormalMapUv:Ie&&_(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ue&&_(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Ye&&_(R.iridescenceMap.channel),iridescenceThicknessMapUv:He&&_(R.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&_(R.sheenColorMap.channel),sheenRoughnessMapUv:ee&&_(R.sheenRoughnessMap.channel),specularMapUv:me&&_(R.specularMap.channel),specularColorMapUv:Ce&&_(R.specularColorMap.channel),specularIntensityMapUv:Be&&_(R.specularIntensityMap.channel),transmissionMapUv:Ne&&_(R.transmissionMap.channel),thicknessMapUv:rt&&_(R.thicknessMap.channel),alphaMapUv:re&&_(R.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(De||ct),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,vertexUv1s:Ve,vertexUv2s:Je,vertexUv3s:zt,pointsUvs:$.isPoints===!0&&!!Z.attributes.uv&&(ft||re),fog:!!Y,useFog:R.fog===!0,fogExp2:Y&&Y.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:$.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:ue,morphTextureStride:K,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:R.dithering,shadowMapEnabled:n.shadowMap.enabled&&k.length>0,shadowMapType:n.shadowMap.type,toneMapping:R.toneMapped?n.toneMapping:Ws,useLegacyLights:n.useLegacyLights,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===ps,flipSided:R.side===ai,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:ae&&R.extensions.derivatives===!0,extensionFragDepth:ae&&R.extensions.fragDepth===!0,extensionDrawBuffers:ae&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:ae&&R.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.has("EXT_shader_texture_lod"),customProgramCacheKey:R.customProgramCacheKey()}}function v(R){const L=[];if(R.shaderID?L.push(R.shaderID):(L.push(R.customVertexShaderID),L.push(R.customFragmentShaderID)),R.defines!==void 0)for(const k in R.defines)L.push(k),L.push(R.defines[k]);return R.isRawShaderMaterial===!1&&(E(L,R),S(L,R),L.push(n.outputColorSpace)),L.push(R.customProgramCacheKey),L.join()}function E(R,L){R.push(L.precision),R.push(L.outputColorSpace),R.push(L.envMapMode),R.push(L.envMapCubeUVHeight),R.push(L.mapUv),R.push(L.alphaMapUv),R.push(L.lightMapUv),R.push(L.aoMapUv),R.push(L.bumpMapUv),R.push(L.normalMapUv),R.push(L.displacementMapUv),R.push(L.emissiveMapUv),R.push(L.metalnessMapUv),R.push(L.roughnessMapUv),R.push(L.anisotropyMapUv),R.push(L.clearcoatMapUv),R.push(L.clearcoatNormalMapUv),R.push(L.clearcoatRoughnessMapUv),R.push(L.iridescenceMapUv),R.push(L.iridescenceThicknessMapUv),R.push(L.sheenColorMapUv),R.push(L.sheenRoughnessMapUv),R.push(L.specularMapUv),R.push(L.specularColorMapUv),R.push(L.specularIntensityMapUv),R.push(L.transmissionMapUv),R.push(L.thicknessMapUv),R.push(L.combine),R.push(L.fogExp2),R.push(L.sizeAttenuation),R.push(L.morphTargetsCount),R.push(L.morphAttributeCount),R.push(L.numDirLights),R.push(L.numPointLights),R.push(L.numSpotLights),R.push(L.numSpotLightMaps),R.push(L.numHemiLights),R.push(L.numRectAreaLights),R.push(L.numDirLightShadows),R.push(L.numPointLightShadows),R.push(L.numSpotLightShadows),R.push(L.numSpotLightShadowsWithMaps),R.push(L.shadowMapType),R.push(L.toneMapping),R.push(L.numClippingPlanes),R.push(L.numClipIntersection),R.push(L.depthPacking)}function S(R,L){a.disableAll(),L.isWebGL2&&a.enable(0),L.supportsVertexTextures&&a.enable(1),L.instancing&&a.enable(2),L.instancingColor&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),R.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.skinning&&a.enable(4),L.morphTargets&&a.enable(5),L.morphNormals&&a.enable(6),L.morphColors&&a.enable(7),L.premultipliedAlpha&&a.enable(8),L.shadowMapEnabled&&a.enable(9),L.useLegacyLights&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),R.push(a.mask)}function w(R){const L=g[R.type];let k;if(L){const X=Us[L];k=dO.clone(X.uniforms)}else k=R.uniforms;return k}function C(R,L){let k;for(let X=0,$=c.length;X<$;X++){const Y=c[X];if(Y.cacheKey===L){k=Y,++k.usedTimes;break}}return k===void 0&&(k=new P6(n,L,R,s),c.push(k)),k}function b(R){if(--R.usedTimes===0){const L=c.indexOf(R);c[L]=c[c.length-1],c.pop(),R.destroy()}}function B(R){l.remove(R)}function I(){l.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:w,acquireProgram:C,releaseProgram:b,releaseShaderCache:B,programs:c,dispose:I}}function O6(){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 r(s,o,a){n.get(s)[o]=a}function i(){n=new WeakMap}return{get:e,remove:t,update:r,dispose:i}}function F6(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 HR(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 GR(){const n=[];let e=0;const t=[],r=[],i=[];function s(){e=0,t.length=0,r.length=0,i.length=0}function o(h,p,m,g,_,x){let v=n[e];return v===void 0?(v={id:h.id,object:h,geometry:p,material:m,groupOrder:g,renderOrder:h.renderOrder,z:_,group:x},n[e]=v):(v.id=h.id,v.object=h,v.geometry=p,v.material=m,v.groupOrder=g,v.renderOrder=h.renderOrder,v.z=_,v.group=x),e++,v}function a(h,p,m,g,_,x){const v=o(h,p,m,g,_,x);m.transmission>0?r.push(v):m.transparent===!0?i.push(v):t.push(v)}function l(h,p,m,g,_,x){const v=o(h,p,m,g,_,x);m.transmission>0?r.unshift(v):m.transparent===!0?i.unshift(v):t.unshift(v)}function c(h,p){t.length>1&&t.sort(h||F6),r.length>1&&r.sort(p||HR),i.length>1&&i.sort(p||HR)}function u(){for(let h=e,p=n.length;h=s.length?(o=new GR,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function k6(){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 z,color:new Ge};break;case"SpotLight":t={position:new z,direction:new z,color:new Ge,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new z,color:new Ge,distance:0,decay:0};break;case"HemisphereLight":t={direction:new z,skyColor:new Ge,groundColor:new Ge};break;case"RectAreaLight":t={color:new Ge,position:new z,halfWidth:new z,halfHeight:new z};break}return n[e.id]=t,t}}}function U6(){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 Me};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Me};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Me,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let z6=0;function H6(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function G6(n,e){const t=new k6,r=U6(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let u=0;u<9;u++)i.probe.push(new z);const s=new z,o=new tt,a=new tt;function l(u,h){let p=0,m=0,g=0;for(let k=0;k<9;k++)i.probe[k].set(0,0,0);let _=0,x=0,v=0,E=0,S=0,w=0,C=0,b=0,B=0,I=0;u.sort(H6);const R=h===!0?Math.PI:1;for(let k=0,X=u.length;k0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=je.LTC_FLOAT_1,i.rectAreaLTC2=je.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=je.LTC_HALF_1,i.rectAreaLTC2=je.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=p,i.ambient[1]=m,i.ambient[2]=g;const L=i.hash;(L.directionalLength!==_||L.pointLength!==x||L.spotLength!==v||L.rectAreaLength!==E||L.hemiLength!==S||L.numDirectionalShadows!==w||L.numPointShadows!==C||L.numSpotShadows!==b||L.numSpotMaps!==B)&&(i.directional.length=_,i.spot.length=v,i.rectArea.length=E,i.point.length=x,i.hemi.length=S,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.pointShadow.length=C,i.pointShadowMap.length=C,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=w,i.pointShadowMatrix.length=C,i.spotLightMatrix.length=b+B-I,i.spotLightMap.length=B,i.numSpotLightShadowsWithMaps=I,L.directionalLength=_,L.pointLength=x,L.spotLength=v,L.rectAreaLength=E,L.hemiLength=S,L.numDirectionalShadows=w,L.numPointShadows=C,L.numSpotShadows=b,L.numSpotMaps=B,i.version=z6++)}function c(u,h){let p=0,m=0,g=0,_=0,x=0;const v=h.matrixWorldInverse;for(let E=0,S=u.length;E=a.length?(l=new VR(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class Hw extends or{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=qD,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 Gw extends or{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 W6=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,$6=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function j6(n,e,t){let r=new Ry;const i=new Me,s=new Me,o=new jt,a=new Hw({depthPacking:ZD}),l=new Gw,c={},u=t.maxTextureSize,h={[Co]:ai,[ai]:Co,[ps]:ps},p=new Ys({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Me},radius:{value:4}},vertexShader:W6,fragmentShader:$6}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const g=new At;g.setAttribute("position",new Zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new sr(g,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ey;let v=this.type;this.render=function(C,b,B){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||C.length===0)return;const I=n.getRenderTarget(),R=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),k=n.state;k.setBlending(ca),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const X=v!==Fs&&this.type===Fs,$=v===Fs&&this.type!==Fs;for(let Y=0,Z=C.length;Yu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/G.x),i.x=s.x*G.x,ie.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/G.y),i.y=s.y*G.y,ie.mapSize.y=s.y)),ie.map===null||X===!0||$===!0){const q=this.type!==Fs?{minFilter:$n,magFilter:$n}:{};ie.map!==null&&ie.map.dispose(),ie.map=new Ks(i.x,i.y,q),ie.map.texture.name=ne.name+".shadowMap",ie.camera.updateProjectionMatrix()}n.setRenderTarget(ie.map),n.clear();const te=ie.getViewportCount();for(let q=0;q0||b.map&&b.alphaTest>0){const k=R.uuid,X=b.uuid;let $=c[k];$===void 0&&($={},c[k]=$);let Y=$[X];Y===void 0&&(Y=R.clone(),$[X]=Y),R=Y}if(R.visible=b.visible,R.wireframe=b.wireframe,I===Fs?R.side=b.shadowSide!==null?b.shadowSide:b.side:R.side=b.shadowSide!==null?b.shadowSide:h[b.side],R.alphaMap=b.alphaMap,R.alphaTest=b.alphaTest,R.map=b.map,R.clipShadows=b.clipShadows,R.clippingPlanes=b.clippingPlanes,R.clipIntersection=b.clipIntersection,R.displacementMap=b.displacementMap,R.displacementScale=b.displacementScale,R.displacementBias=b.displacementBias,R.wireframeLinewidth=b.wireframeLinewidth,R.linewidth=b.linewidth,B.isPointLight===!0&&R.isMeshDistanceMaterial===!0){const k=n.properties.get(R);k.light=B}return R}function w(C,b,B,I,R){if(C.visible===!1)return;if(C.layers.test(b.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&R===Fs)&&(!C.frustumCulled||r.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,C.matrixWorld);const X=e.update(C),$=C.material;if(Array.isArray($)){const Y=X.groups;for(let Z=0,ne=Y.length;Z=1):G.indexOf("OpenGL ES")!==-1&&(ie=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),ne=ie>=2);let te=null,q={};const ue=n.getParameter(n.SCISSOR_BOX),K=n.getParameter(n.VIEWPORT),ve=new jt().fromArray(ue),pe=new jt().fromArray(K);function Le(re,ce,ae,Ve){const Je=new Uint8Array(4),zt=n.createTexture();n.bindTexture(re,zt),n.texParameteri(re,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(re,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let un=0;un"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let _;const x=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function E(U,N){return v?new OffscreenCanvas(U,N):vp("canvas")}function S(U,N,he,Pe){let Ie=1;if((U.width>Pe||U.height>Pe)&&(Ie=Pe/Math.max(U.width,U.height)),Ie<1||N===!0)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap){const Ue=N?k0:Math.floor,Ye=Ue(Ie*U.width),He=Ue(Ie*U.height);_===void 0&&(_=E(Ye,He));const ye=he?E(Ye,He):_;return ye.width=Ye,ye.height=He,ye.getContext("2d").drawImage(U,0,0,Ye,He),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+U.width+"x"+U.height+") to ("+Ye+"x"+He+")."),ye}else return"data"in U&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+U.width+"x"+U.height+")."),U;return U}function w(U){return AE(U.width)&&AE(U.height)}function C(U){return a?!1:U.wrapS!==fr||U.wrapT!==fr||U.minFilter!==$n&&U.minFilter!==pn}function b(U,N){return U.generateMipmaps&&N&&U.minFilter!==$n&&U.minFilter!==pn}function B(U){n.generateMipmap(U)}function I(U,N,he,Pe,Ie=!1){if(a===!1)return N;if(U!==null){if(n[U]!==void 0)return n[U];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let Ue=N;return N===n.RED&&(he===n.FLOAT&&(Ue=n.R32F),he===n.HALF_FLOAT&&(Ue=n.R16F),he===n.UNSIGNED_BYTE&&(Ue=n.R8)),N===n.RG&&(he===n.FLOAT&&(Ue=n.RG32F),he===n.HALF_FLOAT&&(Ue=n.RG16F),he===n.UNSIGNED_BYTE&&(Ue=n.RG8)),N===n.RGBA&&(he===n.FLOAT&&(Ue=n.RGBA32F),he===n.HALF_FLOAT&&(Ue=n.RGBA16F),he===n.UNSIGNED_BYTE&&(Ue=Pe===It&&Ie===!1?n.SRGB8_ALPHA8:n.RGBA8),he===n.UNSIGNED_SHORT_4_4_4_4&&(Ue=n.RGBA4),he===n.UNSIGNED_SHORT_5_5_5_1&&(Ue=n.RGB5_A1)),(Ue===n.R16F||Ue===n.R32F||Ue===n.RG16F||Ue===n.RG32F||Ue===n.RGBA16F||Ue===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Ue}function R(U,N,he){return b(U,he)===!0||U.isFramebufferTexture&&U.minFilter!==$n&&U.minFilter!==pn?Math.log2(Math.max(N.width,N.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?N.mipmaps.length:1}function L(U){return U===$n||U===dp||U===gf?n.NEAREST:n.LINEAR}function k(U){const N=U.target;N.removeEventListener("dispose",k),$(N),N.isVideoTexture&&g.delete(N)}function X(U){const N=U.target;N.removeEventListener("dispose",X),Z(N)}function $(U){const N=r.get(U);if(N.__webglInit===void 0)return;const he=U.source,Pe=x.get(he);if(Pe){const Ie=Pe[N.__cacheKey];Ie.usedTimes--,Ie.usedTimes===0&&Y(U),Object.keys(Pe).length===0&&x.delete(he)}r.remove(U)}function Y(U){const N=r.get(U);n.deleteTexture(N.__webglTexture);const he=U.source,Pe=x.get(he);delete Pe[N.__cacheKey],o.memory.textures--}function Z(U){const N=U.texture,he=r.get(U),Pe=r.get(N);if(Pe.__webglTexture!==void 0&&(n.deleteTexture(Pe.__webglTexture),o.memory.textures--),U.depthTexture&&U.depthTexture.dispose(),U.isWebGLCubeRenderTarget)for(let Ie=0;Ie<6;Ie++)n.deleteFramebuffer(he.__webglFramebuffer[Ie]),he.__webglDepthbuffer&&n.deleteRenderbuffer(he.__webglDepthbuffer[Ie]);else{if(n.deleteFramebuffer(he.__webglFramebuffer),he.__webglDepthbuffer&&n.deleteRenderbuffer(he.__webglDepthbuffer),he.__webglMultisampledFramebuffer&&n.deleteFramebuffer(he.__webglMultisampledFramebuffer),he.__webglColorRenderbuffer)for(let Ie=0;Ie=l&&console.warn("THREE.WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+l),ne+=1,U}function te(U){const N=[];return N.push(U.wrapS),N.push(U.wrapT),N.push(U.wrapR||0),N.push(U.magFilter),N.push(U.minFilter),N.push(U.anisotropy),N.push(U.internalFormat),N.push(U.format),N.push(U.type),N.push(U.generateMipmaps),N.push(U.premultiplyAlpha),N.push(U.flipY),N.push(U.unpackAlignment),N.push(U.colorSpace),N.join()}function q(U,N){const he=r.get(U);if(U.isVideoTexture&&wt(U),U.isRenderTargetTexture===!1&&U.version>0&&he.__version!==U.version){const Pe=U.image;if(Pe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ft(he,U,N);return}}t.bindTexture(n.TEXTURE_2D,he.__webglTexture,n.TEXTURE0+N)}function ue(U,N){const he=r.get(U);if(U.version>0&&he.__version!==U.version){ft(he,U,N);return}t.bindTexture(n.TEXTURE_2D_ARRAY,he.__webglTexture,n.TEXTURE0+N)}function K(U,N){const he=r.get(U);if(U.version>0&&he.__version!==U.version){ft(he,U,N);return}t.bindTexture(n.TEXTURE_3D,he.__webglTexture,n.TEXTURE0+N)}function ve(U,N){const he=r.get(U);if(U.version>0&&he.__version!==U.version){Pt(he,U,N);return}t.bindTexture(n.TEXTURE_CUBE_MAP,he.__webglTexture,n.TEXTURE0+N)}const pe={[Ro]:n.REPEAT,[fr]:n.CLAMP_TO_EDGE,[Bf]:n.MIRRORED_REPEAT},Le={[$n]:n.NEAREST,[dp]:n.NEAREST_MIPMAP_NEAREST,[gf]:n.NEAREST_MIPMAP_LINEAR,[pn]:n.LINEAR,[wy]:n.LINEAR_MIPMAP_NEAREST,[Po]:n.LINEAR_MIPMAP_LINEAR},we={[tO]:n.NEVER,[lO]:n.ALWAYS,[nO]:n.LESS,[iO]:n.LEQUAL,[rO]:n.EQUAL,[aO]:n.GEQUAL,[sO]:n.GREATER,[oO]:n.NOTEQUAL};function Fe(U,N,he){if(he?(n.texParameteri(U,n.TEXTURE_WRAP_S,pe[N.wrapS]),n.texParameteri(U,n.TEXTURE_WRAP_T,pe[N.wrapT]),(U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY)&&n.texParameteri(U,n.TEXTURE_WRAP_R,pe[N.wrapR]),n.texParameteri(U,n.TEXTURE_MAG_FILTER,Le[N.magFilter]),n.texParameteri(U,n.TEXTURE_MIN_FILTER,Le[N.minFilter])):(n.texParameteri(U,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(U,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY)&&n.texParameteri(U,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==fr||N.wrapT!==fr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(U,n.TEXTURE_MAG_FILTER,L(N.magFilter)),n.texParameteri(U,n.TEXTURE_MIN_FILTER,L(N.minFilter)),N.minFilter!==$n&&N.minFilter!==pn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(n.texParameteri(U,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(U,n.TEXTURE_COMPARE_FUNC,we[N.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Pe=e.get("EXT_texture_filter_anisotropic");if(N.magFilter===$n||N.minFilter!==gf&&N.minFilter!==Po||N.type===Hr&&e.has("OES_texture_float_linear")===!1||a===!1&&N.type===ri&&e.has("OES_texture_half_float_linear")===!1)return;(N.anisotropy>1||r.get(N).__currentAnisotropy)&&(n.texParameterf(U,Pe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,i.getMaxAnisotropy())),r.get(N).__currentAnisotropy=N.anisotropy)}}function et(U,N){let he=!1;U.__webglInit===void 0&&(U.__webglInit=!0,N.addEventListener("dispose",k));const Pe=N.source;let Ie=x.get(Pe);Ie===void 0&&(Ie={},x.set(Pe,Ie));const Ue=te(N);if(Ue!==U.__cacheKey){Ie[Ue]===void 0&&(Ie[Ue]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,he=!0),Ie[Ue].usedTimes++;const Ye=Ie[U.__cacheKey];Ye!==void 0&&(Ie[U.__cacheKey].usedTimes--,Ye.usedTimes===0&&Y(N)),U.__cacheKey=Ue,U.__webglTexture=Ie[Ue].texture}return he}function ft(U,N,he){let Pe=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(Pe=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(Pe=n.TEXTURE_3D);const Ie=et(U,N),Ue=N.source;t.bindTexture(Pe,U.__webglTexture,n.TEXTURE0+he);const Ye=r.get(Ue);if(Ue.version!==Ye.__version||Ie===!0){t.activeTexture(n.TEXTURE0+he),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const He=C(N)&&w(N.image)===!1;let ye=S(N.image,He,!1,u);ye=tn(N,ye);const ee=w(ye)||a,me=s.convert(N.format,N.colorSpace);let Ce=s.convert(N.type),Be=I(N.internalFormat,me,Ce,N.colorSpace);Fe(Pe,N,ee);let Ne;const rt=N.mipmaps,gt=a&&N.isVideoTexture!==!0,re=Ye.__version===void 0||Ie===!0,ce=R(N,ye,ee);if(N.isDepthTexture)Be=n.DEPTH_COMPONENT,a?N.type===Hr?Be=n.DEPTH_COMPONENT32F:N.type===aa?Be=n.DEPTH_COMPONENT24:N.type===cl?Be=n.DEPTH24_STENCIL8:Be=n.DEPTH_COMPONENT16:N.type===Hr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===ul&&Be===n.DEPTH_COMPONENT&&N.type!==My&&N.type!==aa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=aa,Ce=s.convert(N.type)),N.format===Bc&&Be===n.DEPTH_COMPONENT&&(Be=n.DEPTH_STENCIL,N.type!==cl&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=cl,Ce=s.convert(N.type))),re&&(gt?t.texStorage2D(n.TEXTURE_2D,1,Be,ye.width,ye.height):t.texImage2D(n.TEXTURE_2D,0,Be,ye.width,ye.height,0,me,Ce,null));else if(N.isDataTexture)if(rt.length>0&&ee){gt&&re&&t.texStorage2D(n.TEXTURE_2D,ce,Be,rt[0].width,rt[0].height);for(let ae=0,Ve=rt.length;ae>=1,Ve>>=1}}else if(rt.length>0&&ee){gt&&re&&t.texStorage2D(n.TEXTURE_2D,ce,Be,rt[0].width,rt[0].height);for(let ae=0,Ve=rt.length;ae0&&re++,t.texStorage2D(n.TEXTURE_CUBE_MAP,re,Ne,ye[0].width,ye[0].height));for(let ae=0;ae<6;ae++)if(He){rt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,0,0,ye[ae].width,ye[ae].height,Ce,Be,ye[ae].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,Ne,ye[ae].width,ye[ae].height,0,Ce,Be,ye[ae].data);for(let Ve=0;Ve=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ie<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Pe,Ie,r.get(he).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function J(U,N,he){if(n.bindRenderbuffer(n.RENDERBUFFER,U),N.depthBuffer&&!N.stencilBuffer){let Pe=n.DEPTH_COMPONENT16;if(he||ct(N)){const Ie=N.depthTexture;Ie&&Ie.isDepthTexture&&(Ie.type===Hr?Pe=n.DEPTH_COMPONENT32F:Ie.type===aa&&(Pe=n.DEPTH_COMPONENT24));const Ue=Xe(N);ct(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ue,Pe,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Ue,Pe,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,Pe,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,U)}else if(N.depthBuffer&&N.stencilBuffer){const Pe=Xe(N);he&&ct(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Pe,n.DEPTH24_STENCIL8,N.width,N.height):ct(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Pe,n.DEPTH24_STENCIL8,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,U)}else{const Pe=N.isWebGLMultipleRenderTargets===!0?N.texture:[N.texture];for(let Ie=0;Ie0&&ct(U)===!1){const He=Ue?N:[N];he.__webglMultisampledFramebuffer=n.createFramebuffer(),he.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,he.__webglMultisampledFramebuffer);for(let ye=0;ye0&&ct(U)===!1){const N=U.isWebGLMultipleRenderTargets?U.texture:[U.texture],he=U.width,Pe=U.height;let Ie=n.COLOR_BUFFER_BIT;const Ue=[],Ye=U.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,He=r.get(U),ye=U.isWebGLMultipleRenderTargets===!0;if(ye)for(let ee=0;ee0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function wt(U){const N=o.render.frame;g.get(U)!==N&&(g.set(U,N),U.update())}function tn(U,N){const he=U.colorSpace,Pe=U.format,Ie=U.type;return U.isCompressedTexture===!0||U.format===N0||he!==Js&&he!==hl&&(he===It?a===!1?e.has("EXT_sRGB")===!0&&Pe===ni?(U.format=N0,U.minFilter=pn,U.generateMipmaps=!1):N=Fw.sRGBToLinear(N):(Pe!==ni||Ie!==Mo)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",he)),N}this.allocateTextureUnit=G,this.resetTextureUnits=ie,this.setTexture2D=q,this.setTexture2DArray=ue,this.setTexture3D=K,this.setTextureCube=ve,this.rebindTextures=De,this.setupRenderTarget=be,this.updateRenderTargetMipmap=nt,this.updateMultisampleRenderTarget=$e,this.setupDepthRenderbuffer=Ae,this.setupFrameBufferTexture=st,this.useMultisampledRTT=ct}function xO(n,e,t){const r=t.isWebGL2;function i(s,o=hl){let a;if(s===Mo)return n.UNSIGNED_BYTE;if(s===Mw)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Tw)return n.UNSIGNED_SHORT_5_5_5_1;if(s===UD)return n.BYTE;if(s===zD)return n.SHORT;if(s===My)return n.UNSIGNED_SHORT;if(s===ww)return n.INT;if(s===aa)return n.UNSIGNED_INT;if(s===Hr)return n.FLOAT;if(s===ri)return r?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===HD)return n.ALPHA;if(s===ni)return n.RGBA;if(s===GD)return n.LUMINANCE;if(s===VD)return n.LUMINANCE_ALPHA;if(s===ul)return n.DEPTH_COMPONENT;if(s===Bc)return n.DEPTH_STENCIL;if(s===N0)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===bw)return n.RED;if(s===Cw)return n.RED_INTEGER;if(s===WD)return n.RG;if(s===Rw)return n.RG_INTEGER;if(s===Pw)return n.RGBA_INTEGER;if(s===Qv||s===e0||s===t0||s===n0)if(o===It)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Qv)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===e0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===t0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===n0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Qv)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===e0)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===t0)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===n0)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===QS||s===eE||s===tE||s===nE)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===QS)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===eE)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===tE)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===nE)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===$D)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===rE||s===iE)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===rE)return o===It?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===iE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===sE||s===oE||s===aE||s===lE||s===cE||s===uE||s===fE||s===hE||s===dE||s===pE||s===mE||s===gE||s===vE||s===yE)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===sE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===oE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===aE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===lE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===cE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===uE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===fE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===hE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===dE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===pE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===mE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===gE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===vE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===yE)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===r0)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===r0)return o===It?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===jD||s===_E||s===xE||s===SE)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===r0)return a.COMPRESSED_RED_RGTC1_EXT;if(s===_E)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===xE)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===SE)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===cl?r?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:i}}class SO extends Fn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Hs extends Ut{constructor(){super(),this.isGroup=!0,this.type="Group"}}const K6={type:"move"};class nx{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Hs,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 Hs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Hs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new z),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 r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const x=t.getJointPose(_,r),v=this._getHandJoint(c,_);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 u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],p=u.position.distanceTo(h.position),m=.02,g=.005;c.inputState.pinching&&p>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(K6)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Hs;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class EO extends mn{constructor(e,t,r,i,s,o,a,l,c,u){if(u=u!==void 0?u:ul,u!==ul&&u!==Bc)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===ul&&(r=aa),r===void 0&&u===Bc&&(r=cl),super(null,i,s,o,a,l,u,r,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:$n,this.minFilter=l!==void 0?l:$n,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}}class Y6 extends Do{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,p=null,m=null,g=null;const _=t.getContextAttributes();let x=null,v=null;const E=[],S=[];let w=null;const C=new Fn;C.layers.enable(1),C.viewport=new jt;const b=new Fn;b.layers.enable(2),b.viewport=new jt;const B=[C,b],I=new SO;I.layers.enable(1),I.layers.enable(2);let R=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getCamera=function(){},this.setUserCamera=function(K){w=K},this.getController=function(K){let ve=E[K];return ve===void 0&&(ve=new nx,E[K]=ve),ve.getTargetRaySpace()},this.getControllerGrip=function(K){let ve=E[K];return ve===void 0&&(ve=new nx,E[K]=ve),ve.getGripSpace()},this.getHand=function(K){let ve=E[K];return ve===void 0&&(ve=new nx,E[K]=ve),ve.getHandSpace()};function k(K){const ve=S.indexOf(K.inputSource);if(ve===-1)return;const pe=E[ve];pe!==void 0&&(pe.update(K.inputSource,K.frame,c||o),pe.dispatchEvent({type:K.type,data:K.inputSource}))}function X(){i.removeEventListener("select",k),i.removeEventListener("selectstart",k),i.removeEventListener("selectend",k),i.removeEventListener("squeeze",k),i.removeEventListener("squeezestart",k),i.removeEventListener("squeezeend",k),i.removeEventListener("end",X),i.removeEventListener("inputsourceschange",$);for(let K=0;K=0&&(S[Le]=null,E[Le].disconnect(pe))}for(let ve=0;ve=S.length){S.push(pe),Le=Fe;break}else if(S[Fe]===null){S[Fe]=pe,Le=Fe;break}if(Le===-1)break}const we=E[Le];we&&we.connect(pe)}}const Y=new z,Z=new z;function ne(K,ve,pe){Y.setFromMatrixPosition(ve.matrixWorld),Z.setFromMatrixPosition(pe.matrixWorld);const Le=Y.distanceTo(Z),we=ve.projectionMatrix.elements,Fe=pe.projectionMatrix.elements,et=we[14]/(we[10]-1),ft=we[14]/(we[10]+1),Pt=(we[9]+1)/we[5],st=(we[9]-1)/we[5],J=(we[8]-1)/we[0],Re=(Fe[8]+1)/Fe[0],Ae=et*J,De=et*Re,be=Le/(-J+Re),nt=be*-J;ve.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(nt),K.translateZ(be),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();const $e=et+be,Xe=ft+be,ct=Ae-nt,wt=De+(Le-nt),tn=Pt*ft/Xe*$e,U=st*ft/Xe*$e;K.projectionMatrix.makePerspective(ct,wt,tn,U,$e,Xe),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function ie(K,ve){ve===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(ve.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCameraXR=function(K){if(i===null)return K;w&&(K=w),I.near=b.near=C.near=K.near,I.far=b.far=C.far=K.far,(R!==I.near||L!==I.far)&&(i.updateRenderState({depthNear:I.near,depthFar:I.far}),R=I.near,L=I.far);const ve=K.parent,pe=I.cameras;ie(I,ve);for(let Le=0;Le0&&(x.alphaTest.value=v.alphaTest);const E=e.get(v).envMap;if(E&&(x.envMap.value=E,x.flipEnvMap.value=E.isCubeTexture&&E.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 S=n.useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*S,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 l(x,v,E,S){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*E,x.scale.value=S*.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 c(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 u(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)),e.get(v).envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function m(x,v,E){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===ai&&x.clearcoatNormalScale.value.negate())),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=E.texture,x.transmissionSamplerSize.value.set(E.width,E.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 g(x,v){v.matcap&&(x.matcap.value=v.matcap)}function _(x,v){const E=e.get(v).light;x.referencePosition.value.setFromMatrixPosition(E.matrixWorld),x.nearDistance.value=E.shadow.camera.near,x.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Z6(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(E,S){const w=S.program;r.uniformBlockBinding(E,w)}function c(E,S){let w=i[E.id];w===void 0&&(g(E),w=u(E),i[E.id]=w,E.addEventListener("dispose",x));const C=S.program;r.updateUBOMapping(E,C);const b=e.render.frame;s[E.id]!==b&&(p(E),s[E.id]=b)}function u(E){const S=h();E.__bindingPointIndex=S;const w=n.createBuffer(),C=E.__size,b=E.usage;return n.bindBuffer(n.UNIFORM_BUFFER,w),n.bufferData(n.UNIFORM_BUFFER,C,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,w),w}function h(){for(let E=0;E0){b=w%C;const X=C-b;b!==0&&X-L.boundary<0&&(w+=C-b,R.__offset=w)}w+=L.storage}return b=w%C,b>0&&(w+=C-b),E.__size=w,E.__cache={},this}function _(E){const S={boundary:0,storage:0};return typeof E=="number"?(S.boundary=4,S.storage=4):E.isVector2?(S.boundary=8,S.storage=8):E.isVector3||E.isColor?(S.boundary=16,S.storage=12):E.isVector4?(S.boundary=16,S.storage=16):E.isMatrix3?(S.boundary=48,S.storage=48):E.isMatrix4?(S.boundary=64,S.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),S}function x(E){const S=E.target;S.removeEventListener("dispose",x);const w=o.indexOf(S.__bindingPointIndex);o.splice(w,1),n.deleteBuffer(i[S.id]),delete i[S.id],delete s[S.id]}function v(){for(const E in i)n.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:v}}function Q6(){const n=vp("canvas");return n.style.display="block",n}class Vw{constructor(e={}){const{canvas:t=Q6(),context:r=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;r!==null?p=r.getContextAttributes().alpha:p=o;const m=new Uint32Array(4),g=new Int32Array(4);let _=null,x=null;const v=[],E=[];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=It,this.useLegacyLights=!0,this.toneMapping=Ws,this.toneMappingExposure=1;const S=this;let w=!1,C=0,b=0,B=null,I=-1,R=null;const L=new jt,k=new jt;let X=null;const $=new Ge(0);let Y=0,Z=t.width,ne=t.height,ie=1,G=null,te=null;const q=new jt(0,0,Z,ne),ue=new jt(0,0,Z,ne);let K=!1;const ve=new Ry;let pe=!1,Le=!1,we=null;const Fe=new tt,et=new Me,ft=new z,Pt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function st(){return B===null?ie:1}let J=r;function Re(T,F){for(let V=0;V0?x=E[E.length-1]:x=null,v.pop(),v.length>0?_=v[v.length-1]:_=null};function tu(T,F,V,H){if(T.visible===!1)return;if(T.layers.test(F.layers)){if(T.isGroup)V=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(F);else if(T.isLight)x.pushLight(T),T.castShadow&&x.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||ve.intersectsSprite(T)){H&&ft.setFromMatrixPosition(T.matrixWorld).applyMatrix4(Fe);const de=N.update(T),Se=T.material;Se.visible&&_.push(T,de,Se,V,ft.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||ve.intersectsObject(T))){T.isSkinnedMesh&&T.skeleton.frame!==nt.render.frame&&(T.skeleton.update(),T.skeleton.frame=nt.render.frame);const de=N.update(T),Se=T.material;if(H&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),ft.copy(T.boundingSphere.center)):(de.boundingSphere===null&&de.computeBoundingSphere(),ft.copy(de.boundingSphere.center)),ft.applyMatrix4(T.matrixWorld).applyMatrix4(Fe)),Array.isArray(Se)){const Ee=de.groups;for(let Te=0,_e=Ee.length;Te<_e;Te++){const Ze=Ee[Te],ze=Se[Ze.materialIndex];ze&&ze.visible&&_.push(T,de,ze,V,ft.z,Ze)}}else Se.visible&&_.push(T,de,Se,V,ft.z,null)}}const le=T.children;for(let de=0,Se=le.length;de0&&ko(j,le,F,V),H&&be.viewport(L.copy(H)),j.length>0&&so(j,F,V),le.length>0&&so(le,F,V),de.length>0&&so(de,F,V),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),be.setPolygonOffset(!1)}function ko(T,F,V,H){const j=De.isWebGL2;we===null&&(we=new Ks(1,1,{generateMipmaps:!0,type:Ae.has("EXT_color_buffer_half_float")?ri:Mo,minFilter:Po,samples:j&&a===!0?4:0})),S.getDrawingBufferSize(et),j?we.setSize(et.x,et.y):we.setSize(k0(et.x),k0(et.y));const le=S.getRenderTarget();S.setRenderTarget(we),S.getClearColor($),Y=S.getClearAlpha(),Y<1&&S.setClearColor(16777215,.5),S.clear();const de=S.toneMapping;S.toneMapping=Ws,so(T,V,H),Xe.updateMultisampleRenderTarget(we),Xe.updateRenderTargetMipmap(we);let Se=!1;for(let Ee=0,Te=F.length;Ee0),Ze=!!V.morphAttributes.position,ze=!!V.morphAttributes.normal,We=!!V.morphAttributes.color,pt=H.toneMapped?S.toneMapping:Ws,vt=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,mt=vt!==void 0?vt.length:0,Qe=$e.get(H),xt=x.state.lights;if(pe===!0&&(Le===!0||T!==R)){const Mt=T===R&&H.id===I;Ye.setState(H,T,Mt)}let ut=!1;H.version===Qe.__version?(Qe.needsLights&&Qe.lightsStateVersion!==xt.state.version||Qe.outputColorSpace!==Se||j.isInstancedMesh&&Qe.instancing===!1||!j.isInstancedMesh&&Qe.instancing===!0||j.isSkinnedMesh&&Qe.skinning===!1||!j.isSkinnedMesh&&Qe.skinning===!0||Qe.envMap!==Ee||H.fog===!0&&Qe.fog!==le||Qe.numClippingPlanes!==void 0&&(Qe.numClippingPlanes!==Ye.numPlanes||Qe.numIntersection!==Ye.numIntersection)||Qe.vertexAlphas!==Te||Qe.vertexTangents!==_e||Qe.morphTargets!==Ze||Qe.morphNormals!==ze||Qe.morphColors!==We||Qe.toneMapping!==pt||De.isWebGL2===!0&&Qe.morphTargetsCount!==mt)&&(ut=!0):(ut=!0,Qe.__version=H.version);let Tt=Qe.currentProgram;ut===!0&&(Tt=Pr(H,F,j));let nn=!1,Et=!1,rn=!1;const Jt=Tt.getUniforms(),on=Qe.uniforms;if(be.useProgram(Tt.program)&&(nn=!0,Et=!0,rn=!0),H.id!==I&&(I=H.id,Et=!0),nn||R!==T){if(Jt.setValue(J,"projectionMatrix",T.projectionMatrix),De.logarithmicDepthBuffer&&Jt.setValue(J,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),R!==T&&(R=T,Et=!0,rn=!0),H.isShaderMaterial||H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshStandardMaterial||H.envMap){const Mt=Jt.map.cameraPosition;Mt!==void 0&&Mt.setValue(J,ft.setFromMatrixPosition(T.matrixWorld))}(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&Jt.setValue(J,"isOrthographic",T.isOrthographicCamera===!0),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial||H.isShadowMaterial||j.isSkinnedMesh)&&Jt.setValue(J,"viewMatrix",T.matrixWorldInverse)}if(j.isSkinnedMesh){Jt.setOptional(J,j,"bindMatrix"),Jt.setOptional(J,j,"bindMatrixInverse");const Mt=j.skeleton;Mt&&(De.floatVertexTextures?(Mt.boneTexture===null&&Mt.computeBoneTexture(),Jt.setValue(J,"boneTexture",Mt.boneTexture,Xe),Jt.setValue(J,"boneTextureSize",Mt.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Kn=V.morphAttributes;if((Kn.position!==void 0||Kn.normal!==void 0||Kn.color!==void 0&&De.isWebGL2===!0)&&ee.update(j,V,Tt),(Et||Qe.receiveShadow!==j.receiveShadow)&&(Qe.receiveShadow=j.receiveShadow,Jt.setValue(J,"receiveShadow",j.receiveShadow)),H.isMeshGouraudMaterial&&H.envMap!==null&&(on.envMap.value=Ee,on.flipEnvMap.value=Ee.isCubeTexture&&Ee.isRenderTargetTexture===!1?-1:1),Et&&(Jt.setValue(J,"toneMappingExposure",S.toneMappingExposure),Qe.needsLights&&wh(on,rn),le&&H.fog===!0&&Pe.refreshFogUniforms(on,le),Pe.refreshMaterialUniforms(on,H,ie,ne,we),o0.upload(J,Qe.uniformsList,on,Xe)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(o0.upload(J,Qe.uniformsList,on,Xe),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&Jt.setValue(J,"center",j.center),Jt.setValue(J,"modelViewMatrix",j.modelViewMatrix),Jt.setValue(J,"normalMatrix",j.normalMatrix),Jt.setValue(J,"modelMatrix",j.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const Mt=H.uniformsGroups;for(let In=0,Qt=Mt.length;In0&&Xe.useMultisampledRTT(T)===!1?j=$e.get(T).__webglMultisampledFramebuffer:j=_e,L.copy(T.viewport),k.copy(T.scissor),X=T.scissorTest}else L.copy(q).multiplyScalar(ie).floor(),k.copy(ue).multiplyScalar(ie).floor(),X=K;if(be.bindFramebuffer(J.FRAMEBUFFER,j)&&De.drawBuffers&&H&&be.drawBuffers(T,j),be.viewport(L),be.scissor(k),be.setScissorTest(X),le){const Ee=$e.get(T.texture);J.framebufferTexture2D(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+F,Ee.__webglTexture,V)}else if(de){const Ee=$e.get(T.texture),Te=F||0;J.framebufferTextureLayer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,Ee.__webglTexture,V||0,Te)}I=-1},this.readRenderTargetPixels=function(T,F,V,H,j,le,de){if(!(T&&T.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=$e.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&de!==void 0&&(Se=Se[de]),Se){be.bindFramebuffer(J.FRAMEBUFFER,Se);try{const Ee=T.texture,Te=Ee.format,_e=Ee.type;if(Te!==ni&&Be.convert(Te)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=_e===ri&&(Ae.has("EXT_color_buffer_half_float")||De.isWebGL2&&Ae.has("EXT_color_buffer_float"));if(_e!==Mo&&Be.convert(_e)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&!(_e===Hr&&(De.isWebGL2||Ae.has("OES_texture_float")||Ae.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=T.width-H&&V>=0&&V<=T.height-j&&J.readPixels(F,V,H,j,Be.convert(Te),Be.convert(_e),le)}finally{const Ee=B!==null?$e.get(B).__webglFramebuffer:null;be.bindFramebuffer(J.FRAMEBUFFER,Ee)}}},this.copyFramebufferToTexture=function(T,F,V=0){const H=Math.pow(2,-V),j=Math.floor(F.image.width*H),le=Math.floor(F.image.height*H);Xe.setTexture2D(F,0),J.copyTexSubImage2D(J.TEXTURE_2D,V,0,0,T.x,T.y,j,le),be.unbindTexture()},this.copyTextureToTexture=function(T,F,V,H=0){const j=F.image.width,le=F.image.height,de=Be.convert(V.format),Se=Be.convert(V.type);Xe.setTexture2D(V,0),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,V.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,V.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,V.unpackAlignment),F.isDataTexture?J.texSubImage2D(J.TEXTURE_2D,H,T.x,T.y,j,le,de,Se,F.image.data):F.isCompressedTexture?J.compressedTexSubImage2D(J.TEXTURE_2D,H,T.x,T.y,F.mipmaps[0].width,F.mipmaps[0].height,de,F.mipmaps[0].data):J.texSubImage2D(J.TEXTURE_2D,H,T.x,T.y,de,Se,F.image),H===0&&V.generateMipmaps&&J.generateMipmap(J.TEXTURE_2D),be.unbindTexture()},this.copyTextureToTexture3D=function(T,F,V,H,j=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const le=T.max.x-T.min.x+1,de=T.max.y-T.min.y+1,Se=T.max.z-T.min.z+1,Ee=Be.convert(H.format),Te=Be.convert(H.type);let _e;if(H.isData3DTexture)Xe.setTexture3D(H,0),_e=J.TEXTURE_3D;else if(H.isDataArrayTexture)Xe.setTexture2DArray(H,0),_e=J.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,H.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,H.unpackAlignment);const Ze=J.getParameter(J.UNPACK_ROW_LENGTH),ze=J.getParameter(J.UNPACK_IMAGE_HEIGHT),We=J.getParameter(J.UNPACK_SKIP_PIXELS),pt=J.getParameter(J.UNPACK_SKIP_ROWS),vt=J.getParameter(J.UNPACK_SKIP_IMAGES),mt=V.isCompressedTexture?V.mipmaps[0]:V.image;J.pixelStorei(J.UNPACK_ROW_LENGTH,mt.width),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,mt.height),J.pixelStorei(J.UNPACK_SKIP_PIXELS,T.min.x),J.pixelStorei(J.UNPACK_SKIP_ROWS,T.min.y),J.pixelStorei(J.UNPACK_SKIP_IMAGES,T.min.z),V.isDataTexture||V.isData3DTexture?J.texSubImage3D(_e,j,F.x,F.y,F.z,le,de,Se,Ee,Te,mt.data):V.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),J.compressedTexSubImage3D(_e,j,F.x,F.y,F.z,le,de,Se,Ee,mt.data)):J.texSubImage3D(_e,j,F.x,F.y,F.z,le,de,Se,Ee,Te,mt),J.pixelStorei(J.UNPACK_ROW_LENGTH,Ze),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,ze),J.pixelStorei(J.UNPACK_SKIP_PIXELS,We),J.pixelStorei(J.UNPACK_SKIP_ROWS,pt),J.pixelStorei(J.UNPACK_SKIP_IMAGES,vt),j===0&&H.generateMipmaps&&J.generateMipmap(_e),be.unbindTexture()},this.initTexture=function(T){T.isCubeTexture?Xe.setTextureCube(T,0):T.isData3DTexture?Xe.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?Xe.setTexture2DArray(T,0):Xe.setTexture2D(T,0),be.unbindTexture()},this.resetState=function(){C=0,b=0,B=null,be.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return So}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===It?fl:Lw}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===fl?It:Js}}class AO extends Vw{}AO.prototype.isWebGL1Renderer=!0;class Iy{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ge(e),this.density=t}clone(){return new Iy(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class By{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Ge(e),this.near=t,this.far=r}clone(){return new By(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class yp extends Ut{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Yp{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=mp,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Wi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;ie.far||t.push({distance:l,point:nd.clone(),uv:xi.getInterpolation(nd,rv,id,iv,WR,rx,$R,new Me),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 sv(n,e,t,r,i,s){Fu.subVectors(n,t).addScalar(.5).multiply(r),i!==void 0?(rd.x=s*Fu.x-i*Fu.y,rd.y=i*Fu.x+s*Fu.y):rd.copy(Fu),n.copy(e),n.x+=rd.x,n.y+=rd.y,n.applyMatrix4(wO)}const ov=new z,jR=new z;class TO extends Ut{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 r=0,i=t.length;r0){let r,i;for(r=1,i=t.length;r0){ov.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(ov);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ov.setFromMatrixPosition(e.matrixWorld),jR.setFromMatrixPosition(this.matrixWorld);const r=ov.distanceTo(jR)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;il)continue;p.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(p);Ie.far||t.push({distance:I,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const v=Math.max(0,o.start),E=Math.min(x.count,o.start+o.count);for(let S=v,w=E-1;Sl)continue;p.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(p);be.far||t.push({distance:b,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class rV extends mn{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:pn,this.magFilter=s!==void 0?s:pn,this.generateMipmaps=!1;const u=this;function h(){u.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 iV extends mn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=$n,this.minFilter=$n,this.generateMipmaps=!1,this.needsUpdate=!0}}class Jw extends mn{constructor(e,t,r,i,s,o,a,l,c,u,h,p){super(null,o,a,l,c,u,i,s,h,p),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class sV extends Jw{constructor(e,t,r,i,s,o){super(e,t,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=fr}}class oV extends mn{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ms{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/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 r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const u=r[i],p=r[i+1]-u,m=(o-u)/p;return(i+m)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new Me:new z);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new z,i=[],s=[],o=[],a=new z,l=new tt;for(let m=0;m<=e;m++){const g=m/e;i[m]=this.getTangentAt(g,new z)}s[0]=new z,o[0]=new z;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),p=Math.abs(i[0].z);u<=c&&(c=u,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),p<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(i[m-1],i[m]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(jn(i[m-1].dot(i[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,g))}o[m].crossVectors(i[m],s[m])}if(t===!0){let m=Math.acos(jn(s[0].dot(s[e]),-1,1));m/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(i[g],m*g)),o[g].crossVectors(i[g],s[g])}return{tangents:i,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 Oy extends Ms{constructor(e=0,t=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const r=t||new Me,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(fv.subVectors(i[0],i[1]).add(i[0]),c=fv);const h=i[a%s],p=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return r.set(lP(a,l.x,c.x,u.x,h.x),lP(a,l.y,c.y,u.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,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 r=0,i=this.curves.length;r1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),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 sh extends At{constructor(e=[new Me(0,-.5),new Me(.5,0),new Me(0,.5)],t=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=jn(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new z,p=new Me,m=new z,g=new z,_=new z;let x=0,v=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:x=e[E+1].x-e[E].x,v=e[E+1].y-e[E].y,m.x=v*1,m.y=-x,m.z=v*0,_.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:x=e[E+1].x-e[E].x,v=e[E+1].y-e[E].y,m.x=v*1,m.y=-x,m.z=v*0,g.copy(m),m.x+=_.x,m.y+=_.y,m.z+=_.z,m.normalize(),l.push(m.x,m.y,m.z),_.copy(g)}for(let E=0;E<=t;E++){const S=r+E*u*i,w=Math.sin(S),C=Math.cos(S);for(let b=0;b<=e.length-1;b++){h.x=e[b].x*w,h.y=e[b].y,h.z=e[b].x*C,o.push(h.x,h.y,h.z),p.x=E/t,p.y=b/(e.length-1),a.push(p.x,p.y);const B=l[3*b+0]*w,I=l[3*b+1],R=l[3*b+0]*C;c.push(B,I,R)}}for(let E=0;E0&&S(!0),t>0&&S(!1)),this.setIndex(u),this.setAttribute("position",new it(h,3)),this.setAttribute("normal",new it(p,3)),this.setAttribute("uv",new it(m,2));function E(){const w=new z,C=new z;let b=0;const B=(t-e)/r;for(let I=0;I<=s;I++){const R=[],L=I/s,k=L*(t-e)+e;for(let X=0;X<=i;X++){const $=X/i,Y=$*l+a,Z=Math.sin(Y),ne=Math.cos(Y);C.x=k*Z,C.y=-L*r+x,C.z=k*ne,h.push(C.x,C.y,C.z),w.set(Z,B,ne).normalize(),p.push(w.x,w.y,w.z),m.push($,1-L),R.push(g++)}_.push(R)}for(let I=0;I.9&&B<.1&&(S<.2&&(o[E+0]+=1),w<.2&&(o[E+2]+=1),C<.2&&(o[E+4]+=1))}}function p(E){s.push(E.x,E.y,E.z)}function m(E,S){const w=E*3;S.x=e[w+0],S.y=e[w+1],S.z=e[w+2]}function g(){const E=new z,S=new z,w=new z,C=new z,b=new Me,B=new Me,I=new Me;for(let R=0,L=0;R80*t){a=c=n[0],l=u=n[1];for(let g=t;gc&&(c=h),p>u&&(u=p);m=Math.max(c-a,u-l),m=m!==0?32767/m:0}return xp(s,o,t,a,l,m,0),o}};function LO(n,e,t,r,i){let s,o;if(i===PV(n,e,t,r)>0)for(s=e;s=e;s-=r)o=cP(s,n[s],n[s+1],o);return o&&Ny(o,o.next)&&(Ep(o),o=o.next),o}function Dc(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(Ny(t,t.next)||Nn(t.prev,t,t.next)===0)){if(Ep(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function xp(n,e,t,r,i,s,o){if(!n)return;!o&&s&&wV(n,r,i,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?gV(n,r,i,s):mV(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Ep(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=vV(Dc(n),e,t),xp(n,e,t,r,i,s,2)):o===2&&yV(n,e,t,r,i,s):xp(Dc(n),e,t,r,i,s,1);break}}}function mV(n){const e=n.prev,t=n,r=n.next;if(Nn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,u=is?i>o?i:o:s>o?s:o,m=a>l?a>c?a:c:l>c?l:c;let g=r.next;for(;g!==e;){if(g.x>=u&&g.x<=p&&g.y>=h&&g.y<=m&&lf(i,a,s,l,o,c,g.x,g.y)&&Nn(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function gV(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Nn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,u=i.y,h=s.y,p=o.y,m=al?a>c?a:c:l>c?l:c,x=u>h?u>p?u:p:h>p?h:p,v=bE(m,g,e,t,r),E=bE(_,x,e,t,r);let S=n.prevZ,w=n.nextZ;for(;S&&S.z>=v&&w&&w.z<=E;){if(S.x>=m&&S.x<=_&&S.y>=g&&S.y<=x&&S!==i&&S!==o&&lf(a,u,l,h,c,p,S.x,S.y)&&Nn(S.prev,S,S.next)>=0||(S=S.prevZ,w.x>=m&&w.x<=_&&w.y>=g&&w.y<=x&&w!==i&&w!==o&&lf(a,u,l,h,c,p,w.x,w.y)&&Nn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;S&&S.z>=v;){if(S.x>=m&&S.x<=_&&S.y>=g&&S.y<=x&&S!==i&&S!==o&&lf(a,u,l,h,c,p,S.x,S.y)&&Nn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;w&&w.z<=E;){if(w.x>=m&&w.x<=_&&w.y>=g&&w.y<=x&&w!==i&&w!==o&&lf(a,u,l,h,c,p,w.x,w.y)&&Nn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function vV(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!Ny(i,s)&&DO(i,r,r.next,s)&&Sp(i,s)&&Sp(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),Ep(r),Ep(r.next),r=n=s),r=r.next}while(r!==n);return Dc(r)}function yV(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&bV(o,a)){let l=OO(o,a);o=Dc(o,o.next),l=Dc(l,l.next),xp(o,e,t,r,i,s,0),xp(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function _V(n,e,t,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=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>r&&(r=p,i=t.x=t.x&&t.x>=l&&s!==t.x&&lf(oi.x||t.x===i.x&&AV(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function AV(n,e){return Nn(n.prev,n,e.prev)<0&&Nn(e.next,n,n.next)<0}function wV(n,e,t,r){let i=n;do i.z===0&&(i.z=bE(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,MV(i)}function MV(n){let e,t,r,i,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(i=t,t=t.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;t=r}s.nextZ=null,c*=2}while(o>1);return n}function bE(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|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 TV(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function bV(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!CV(n,e)&&(Sp(n,e)&&Sp(e,n)&&RV(n,e)&&(Nn(n.prev,n,e.prev)||Nn(n,e.prev,e))||Ny(n,e)&&Nn(n.prev,n,n.next)>0&&Nn(e.prev,e,e.next)>0)}function Nn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Ny(n,e){return n.x===e.x&&n.y===e.y}function DO(n,e,t,r){const i=gv(Nn(n,e,t)),s=gv(Nn(n,e,r)),o=gv(Nn(t,r,n)),a=gv(Nn(t,r,e));return!!(i!==s&&o!==a||i===0&&mv(n,t,e)||s===0&&mv(n,r,e)||o===0&&mv(t,n,r)||a===0&&mv(t,e,r))}function mv(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 gv(n){return n>0?1:n<0?-1:0}function CV(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&&DO(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Sp(n,e){return Nn(n.prev,n,n.next)<0?Nn(n,e,n.next)>=0&&Nn(n,n.prev,e)>=0:Nn(n,e,n.prev)<0||Nn(n,n.next,e)<0}function RV(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function OO(n,e){const t=new CE(n.i,n.x,n.y),r=new CE(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function cP(n,e,t,r){const i=new CE(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ep(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 CE(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 PV(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function fP(n,e){for(let t=0;tNumber.EPSILON){const N=Math.sqrt(tn),he=Math.sqrt(ct*ct+wt*wt),Pe=Re.x-Xe/N,Ie=Re.y+$e/N,Ue=Ae.x-wt/he,Ye=Ae.y+ct/he,He=((Ue-Pe)*wt-(Ye-Ie)*ct)/($e*wt-Xe*ct);De=Pe+$e*He-J.x,be=Ie+Xe*He-J.y;const ye=De*De+be*be;if(ye<=2)return new Me(De,be);nt=Math.sqrt(ye/2)}else{let N=!1;$e>Number.EPSILON?ct>Number.EPSILON&&(N=!0):$e<-Number.EPSILON?ct<-Number.EPSILON&&(N=!0):Math.sign(Xe)===Math.sign(wt)&&(N=!0),N?(De=-Xe,be=$e,nt=Math.sqrt(tn)):(De=$e,be=Xe,nt=Math.sqrt(tn/2))}return new Me(De/nt,be/nt)}const te=[];for(let J=0,Re=Y.length,Ae=Re-1,De=J+1;J=0;J--){const Re=J/x,Ae=m*Math.cos(Re*Math.PI/2),De=g*Math.sin(Re*Math.PI/2)+_;for(let be=0,nt=Y.length;be=0;){const De=Ae;let be=Ae-1;be<0&&(be=J.length-1);for(let nt=0,$e=u+x*2;nt<$e;nt++){const Xe=ne*nt,ct=ne*(nt+1),wt=Re+De+Xe,tn=Re+be+Xe,U=Re+be+ct,N=Re+De+ct;ft(wt,tn,U,N)}}}function Fe(J,Re,Ae){l.push(J),l.push(Re),l.push(Ae)}function et(J,Re,Ae){Pt(J),Pt(Re),Pt(Ae);const De=i.length/3,be=E.generateTopUV(r,i,De-3,De-2,De-1);st(be[0]),st(be[1]),st(be[2])}function ft(J,Re,Ae,De){Pt(J),Pt(Re),Pt(De),Pt(Re),Pt(Ae),Pt(De);const be=i.length/3,nt=E.generateSideWallUV(r,i,be-6,be-3,be-2,be-1);st(nt[0]),st(nt[1]),st(nt[3]),st(nt[1]),st(nt[2]),st(nt[3])}function Pt(J){i.push(l[J*3+0]),i.push(l[J*3+1]),i.push(l[J*3+2])}function st(J){s.push(J.x),s.push(J.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return BV(t,r,e)}static fromJSON(e,t){const r=[];for(let s=0,o=e.shapes.length;s0)&&m.push(S,w,b),(v!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Hd extends or{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ge(16777215),this.specular=new Ge(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Xp,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class UO extends or{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ge(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,this.normalScale=new Me(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 zO extends or{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,this.normalScale=new Me(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 tM extends or{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Xp,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class HO extends or{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ge(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,this.normalScale=new Me(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 GO extends Rr{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 us(n,e,t){return nM(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function pc(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 nM(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function VO(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function RE(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function rM(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}function DV(n,e,t,r,i=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=r)){h.push(c.times[m]);for(let _=0;_s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[g]){const v=g*h+u,E=v+h-u;_=us(a.values,v,E)}else{const v=a.createInterpolant(),E=u,S=h-u;v.evaluate(s),_=us(v.resultBuffer,E,S)}l==="quaternion"&&new Xn().fromArray(_).normalize().conjugate().toArray(_);const x=c.times.length;for(let v=0;v=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=us(r,s,o),this.values=us(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&nM(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=us(this.times),t=us(this.values),r=this.getValueSize(),i=this.getInterpolation()===i0,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=us(e,0,o),this.values=us(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=us(this.times,0),t=us(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}no.prototype.TimeBufferType=Float32Array;no.prototype.ValueBufferType=Float32Array;no.prototype.DefaultInterpolation=Lc;class $c extends no{}$c.prototype.ValueTypeName="bool";$c.prototype.ValueBufferType=Array;$c.prototype.DefaultInterpolation=Lf;$c.prototype.InterpolantFactoryMethodLinear=void 0;$c.prototype.InterpolantFactoryMethodSmooth=void 0;class sM extends no{}sM.prototype.ValueTypeName="color";class Oc extends no{}Oc.prototype.ValueTypeName="number";class jO extends ch{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Xn.slerpFlat(s,0,o,c-a,o,c,l);return s}}class _a extends no{InterpolantFactoryMethodLinear(e){return new jO(this.times,this.values,this.getValueSize(),e)}}_a.prototype.ValueTypeName="quaternion";_a.prototype.DefaultInterpolation=Lc;_a.prototype.InterpolantFactoryMethodSmooth=void 0;class jc extends no{}jc.prototype.ValueTypeName="string";jc.prototype.ValueBufferType=Array;jc.prototype.DefaultInterpolation=Lf;jc.prototype.InterpolantFactoryMethodLinear=void 0;jc.prototype.InterpolantFactoryMethodSmooth=void 0;class Fc extends no{}Fc.prototype.ValueTypeName="vector";class Nc{constructor(e,t=-1,r,i=Ty){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Wi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(kV(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(no.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const h=u[1];let p=i[h];p||(i[h]=p=[]),p.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(h,p,m,g,_){if(m.length!==0){const x=[],v=[];rM(m,x,v,g),x.length!==0&&_.push(new h(p,x,v))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(Zo[e]!==void 0){Zo[e].push({onLoad:t,onProgress:r,onError:i});return}Zo[e]=[],Zo[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Zo[e],h=c.body.getReader(),p=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=p?parseInt(p):0,g=m!==0;let _=0;const x=new ReadableStream({start(v){E();function E(){h.read().then(({done:S,value:w})=>{if(S)v.close();else{_+=w.byteLength;const C=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:m});for(let b=0,B=u.length;b{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),p=h&&h[1]?h[1].toLowerCase():void 0,m=new TextDecoder(p);return c.arrayBuffer().then(g=>m.decode(g))}}}).then(c=>{kc.add(e,c);const u=Zo[e];delete Zo[e];for(let h=0,p=u.length;h{const u=Zo[e];if(u===void 0)throw this.manager.itemError(e),c;delete Zo[e];for(let h=0,p=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class zV extends $r{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new li(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(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const t=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new Ge().setHex(o.value);break;case"v2":i.uniforms[s].value=new Me().fromArray(o.value);break;case"v3":i.uniforms[s].value=new z().fromArray(o.value);break;case"v4":i.uniforms[s].value=new jt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Bt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new tt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Me().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Me().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:NO,SpriteMaterial:Ww,RawShaderMaterial:kO,ShaderMaterial:Ys,PointsMaterial:Dy,MeshPhysicalMaterial:Oo,MeshStandardMaterial:lm,MeshPhongMaterial:Hd,MeshToonMaterial:UO,MeshNormalMaterial:zO,MeshLambertMaterial:tM,MeshDepthMaterial:Hw,MeshDistanceMaterial:Gw,MeshBasicMaterial:zi,MeshMatcapMaterial:HO,LineDashedMaterial:GO,LineBasicMaterial:Rr,Material:or};return new t[e]}}class $i{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r0){const l=new oM(t);s=new Ap(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){i=new Ap(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"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,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=kc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){kc.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let vv,uM=class{static getContext(){return vv===void 0&&(vv=new(window.AudioContext||window.webkitAudioContext)),vv}static setContext(e){vv=e}};class XV extends $r{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new li(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);uM.getContext().decodeAudioData(c,function(h){t(h)},a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}class JV extends zy{constructor(e,t,r=1){super(void 0,r),this.isHemisphereLightProbe=!0;const i=new Ge().set(e),s=new Ge().set(t),o=new z(i.r,i.g,i.b),a=new z(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}class KV extends zy{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const r=new Ge().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const _P=new tt,xP=new tt,$l=new tt;class YV{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Fn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Fn,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,$l.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(xc*t.fov*.5)/t.zoom;let a,l;xP.elements[12]=-i,_P.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,$l.elements[0]=2*t.near/(l-a),$l.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy($l),a=-o*t.aspect-s,l=o*t.aspect-s,$l.elements[0]=2*t.near/(l-a),$l.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy($l)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(xP),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_P)}}class fM{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=SP(),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=SP();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function SP(){return(typeof performance>"u"?Date:performance).now()}const jl=new z,EP=new Xn,qV=new z,Xl=new z;class ZV extends Ut{constructor(){super(),this.type="AudioListener",this.context=uM.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new fM}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,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(jl,EP,qV),Xl.set(0,0,-1).applyQuaternion(EP),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(jl.x,i),t.positionY.linearRampToValueAtTime(jl.y,i),t.positionZ.linearRampToValueAtTime(jl.z,i),t.forwardX.linearRampToValueAtTime(Xl.x,i),t.forwardY.linearRampToValueAtTime(Xl.y,i),t.forwardZ.linearRampToValueAtTime(Xl.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(jl.x,jl.y,jl.z),t.setOrientation(Xl.x,Xl.y,Xl.z,r.x,r.y,r.z)}}let t3=class extends Ut{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;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){Xn.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;Xn.multiplyQuaternionsFlat(e,o,e,t,e,r),Xn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const hM="\\[\\]\\.:\\/",nW=new RegExp("["+hM+"]","g"),dM="[^"+hM+"]",rW="[^"+hM.replace("\\.","")+"]",iW=/((?:WC+[\/:])*)/.source.replace("WC",dM),sW=/(WCOD+)?/.source.replace("WCOD",rW),oW=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dM),aW=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dM),lW=new RegExp("^"+iW+sW+oW+aW+"$"),cW=["material","materials","bones","map"];class uW{constructor(e,t,r){const i=r||kt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class kt{constructor(e,t,r){this.path=t,this.parsedPath=r||kt.parseTrackName(t),this.node=kt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new kt.Composite(e,t,r):new kt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(nW,"")}static parseTrackName(e){const t=lW.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);cW.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const h=s++,p=e[h];t[p.uuid]=u,e[u]=p,t[c]=h,e[h]=l;for(let m=0,g=i;m!==g;++m){const _=r[m],x=_[h],v=_[u];_[u]=x,_[h]=v}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h0&&(t[m.uuid]=h),e[h]=m,e.pop();for(let g=0,_=i;g!==_;++g){const x=r[g];x[h]=x[p],x.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(t),s.push(h);for(let p=u,m=l.length;p!==m;++p){const g=l[p];h[p]=new kt(g,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class r3{constructor(e,t,r=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:uc,endingEnd:uc};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=JD,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,r){if(e.fadeOut(t),this.fadeIn(t),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[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,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?t=0:(this._startTime=null,t=r*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Iw:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Ty:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===KD;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===XD){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=fc,i.endingEnd=fc):(e?i.endingStart=this.zeroSlopeAtStart?fc:uc:i.endingStart=pp,t?i.endingEnd=this.zeroSlopeAtEnd?fc:uc:i.endingEnd=pp)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const hW=new Float32Array(1);class i3 extends Do{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const p=i[h],m=p.name;let g=u[m];if(g!==void 0)++g.referenceCount,o[h]=g;else{if(g=o[h],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,l,m));continue}const _=t&&t._propertyBindings[h].binding.parsedPath;g=new n3(kt.create(r,m,_),p.ValueTypeName,p.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,l,m),o[h]=g}a[h].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--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=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,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.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,MP).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 TP=new z,yv=new z;class _W{constructor(e=new z,t=new z){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){TP.subVectors(e,this.start),yv.subVectors(this.end,this.start);const r=yv.dot(yv);let s=yv.dot(TP)/r;return t&&(s=jn(s,0,1)),s}closestPointToPoint(e,t,r){const i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const bP=new z;class xW extends Ut{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new At,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{BP.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(BP,t)}}setLength(e,t=e*.2,r=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class LW extends to{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new At;i.setAttribute("position",new it(t,3)),i.setAttribute("color",new it(r,3));const s=new Rr({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,r){const i=new Ge,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class DW{constructor(){this.type="ShapePath",this.color=new Ge,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new _p,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,s,o){return this.currentPath.bezierCurveTo(e,t,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(v){const E=[];for(let S=0,w=v.length;SNumber.EPSILON){if(L<0&&(B=E[b],R=-R,I=E[C],L=-L),v.yI.y)continue;if(v.y===B.y){if(v.x===B.x)return!0}else{const k=L*(v.x-B.x)-R*(v.y-B.y);if(k===0)return!0;if(k<0)continue;w=!w}}else{if(v.y!==B.y)continue;if(I.x<=v.x&&v.x<=B.x||B.x<=v.x&&v.x<=I.x)return!0}}return w}const i=bo.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Ec,l.curves=a.curves,c.push(l),c;let u=!i(s[0].getPoints());u=e?!u:u;const h=[],p=[];let m=[],g=0,_;p[g]=void 0,m[g]=[];for(let v=0,E=s.length;v1){let v=!1,E=0;for(let S=0,w=p.length;S0&&v===!1&&(m=h)}let x;for(let v=0,E=p.length;v{const h=typeof c=="function"?c(e):c;if(h!==e){const p=e;e=u?h:Object.assign({},e,h),t.forEach(m=>m(e,p))}},i=()=>e,s=(c,u=i,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=u(e);function m(){const g=u(e);if(!h(p,g)){const _=p;c(p=g,_)}}return t.add(m),()=>t.delete(m)},l={setState:r,getState:i,subscribe:(c,u,h)=>u||h?s(c,u,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(r,i,l),l}const r$=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),LP=r$?D.useEffect:D.useLayoutEffect;function gM(n){const e=typeof n=="function"?n$(n):n,t=(r=e.getState,i=Object.is)=>{const[,s]=D.useReducer(x=>x+1,0),o=e.getState(),a=D.useRef(o),l=D.useRef(r),c=D.useRef(i),u=D.useRef(!1),h=D.useRef();h.current===void 0&&(h.current=r(o));let p,m=!1;(a.current!==o||l.current!==r||c.current!==i||u.current)&&(p=r(o),m=!i(h.current,p)),LP(()=>{m&&(h.current=p),a.current=o,l.current=r,c.current=i,u.current=!1});const g=D.useRef(o);LP(()=>{const x=()=>{try{const E=e.getState(),S=l.current(E);c.current(h.current,S)||(a.current=E,h.current=S,s())}catch{u.current=!0,s()}},v=e.subscribe(x);return e.getState()!==g.current&&x(),v},[]);const _=m?p:h.current;return D.useDebugValue(_),_};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[t,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},t}var BE={},i$={get exports(){return BE},set exports(n){BE=n}},Mp={},s$={get exports(){return Mp},set exports(n){Mp=n}},o3={};/** + * @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(G,te){var q=G.length;G.push(te);e:for(;0>>1,K=G[ue];if(0>>1;uei(Le,q))wei(Fe,Le)?(G[ue]=Fe,G[we]=q,ue=we):(G[ue]=Le,G[pe]=q,ue=pe);else if(wei(Fe,q))G[ue]=Fe,G[we]=q,ue=we;else break e}}return te}function i(G,te){var q=G.sortIndex-te.sortIndex;return q!==0?q:G.id-te.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 l=[],c=[],u=1,h=null,p=3,m=!1,g=!1,_=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(G){for(var te=t(c);te!==null;){if(te.callback===null)r(c);else if(te.startTime<=G)r(c),te.sortIndex=te.expirationTime,e(l,te);else break;te=t(c)}}function w(G){if(_=!1,S(G),!g)if(t(l)!==null)g=!0,ne(C);else{var te=t(c);te!==null&&ie(w,te.startTime-G)}}function C(G,te){g=!1,_&&(_=!1,v(I),I=-1),m=!0;var q=p;try{for(S(te),h=t(l);h!==null&&(!(h.expirationTime>te)||G&&!k());){var ue=h.callback;if(typeof ue=="function"){h.callback=null,p=h.priorityLevel;var K=ue(h.expirationTime<=te);te=n.unstable_now(),typeof K=="function"?h.callback=K:h===t(l)&&r(l),S(te)}else r(l);h=t(l)}if(h!==null)var ve=!0;else{var pe=t(c);pe!==null&&ie(w,pe.startTime-te),ve=!1}return ve}finally{h=null,p=q,m=!1}}var b=!1,B=null,I=-1,R=5,L=-1;function k(){return!(n.unstable_now()-LG||125ue?(G.sortIndex=q,e(c,G),t(l)===null&&G===t(c)&&(_?(v(I),I=-1):_=!0,ie(w,q-ue))):(G.sortIndex=K,e(l,G),g||m||(g=!0,ne(C))),G},n.unstable_shouldYield=k,n.unstable_wrapCallback=function(G){var te=p;return function(){var q=p;p=te;try{return G.apply(this,arguments)}finally{p=q}}}})(o3);(function(n){n.exports=o3})(s$);/** + * @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 o$=function(e){var t={},r=D,i=Mp,s=Object.assign;function o(f){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+f,y=1;yse||M[W]!==P[se]){var xe=` +`+M[W].replace(" at new "," at ");return f.displayName&&xe.includes("")&&(xe=xe.replace("",f.displayName)),xe}while(1<=W&&0<=se);break}}}finally{ze=!1,Error.prepareStackTrace=y}return(f=f?f.displayName||f.name:"")?Ze(f):""}var pt=Object.prototype.hasOwnProperty,vt=[],mt=-1;function Qe(f){return{current:f}}function xt(f){0>mt||(f.current=vt[mt],vt[mt]=null,mt--)}function ut(f,d){mt++,vt[mt]=f.current,f.current=d}var Tt={},nn=Qe(Tt),Et=Qe(!1),rn=Tt;function Jt(f,d){var y=f.type.contextTypes;if(!y)return Tt;var A=f.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===d)return A.__reactInternalMemoizedMaskedChildContext;var M={},P;for(P in y)M[P]=d[P];return A&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=d,f.__reactInternalMemoizedMaskedChildContext=M),M}function on(f){return f=f.childContextTypes,f!=null}function Kn(){xt(Et),xt(nn)}function Mt(f,d,y){if(nn.current!==Tt)throw Error(o(168));ut(nn,d),ut(Et,y)}function In(f,d,y){var A=f.stateNode;if(d=d.childContextTypes,typeof A.getChildContext!="function")return y;A=A.getChildContext();for(var M in A)if(!(M in d))throw Error(o(108,I(f)||"Unknown",M));return s({},y,A)}function Qt(f){return f=(f=f.stateNode)&&f.__reactInternalMemoizedMergedChildContext||Tt,rn=nn.current,ut(nn,f),ut(Et,Et.current),!0}function Vt(f,d,y){var A=f.stateNode;if(!A)throw Error(o(169));y?(f=In(f,d,rn),A.__reactInternalMemoizedMergedChildContext=f,xt(Et),xt(nn),ut(nn,f)):xt(Et),ut(Et,y)}var Tn=Math.clz32?Math.clz32:ao,Uo=Math.log,Jr=Math.LN2;function ao(f){return f>>>=0,f===0?32:31-(Uo(f)/Jr|0)|0}var Cm=64,Rm=4194304;function Mh(f){switch(f&-f){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 f&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return f&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return f}}function Pm(f,d){var y=f.pendingLanes;if(y===0)return 0;var A=0,M=f.suspendedLanes,P=f.pingedLanes,W=y&268435455;if(W!==0){var se=W&~M;se!==0?A=Mh(se):(P&=W,P!==0&&(A=Mh(P)))}else W=y&~M,W!==0?A=Mh(W):P!==0&&(A=Mh(P));if(A===0)return 0;if(d!==0&&d!==A&&!(d&M)&&(M=A&-A,P=d&-d,M>=P||M===16&&(P&4194240)!==0))return d;if(A&4&&(A|=y&16),d=f.entangledLanes,d!==0)for(f=f.entanglements,d&=A;0y;y++)d.push(f);return d}function Th(f,d,y){f.pendingLanes|=d,d!==536870912&&(f.suspendedLanes=0,f.pingedLanes=0),f=f.eventTimes,d=31-Tn(d),f[d]=y}function $k(f,d){var y=f.pendingLanes&~d;f.pendingLanes=d,f.suspendedLanes=0,f.pingedLanes=0,f.expiredLanes&=d,f.mutableReadLanes&=d,f.entangledLanes&=d,d=f.entanglements;var A=f.eventTimes;for(f=f.expirationTimes;0>=W,M-=W,Go=1<<32-Tn(d)+M|y<Yt?(yr=Ct,Ct=null):yr=Ct.sibling;var qt=yt(fe,Ct,ge[Yt],qe);if(qt===null){Ct===null&&(Ct=yr);break}f&&Ct&&qt.alternate===null&&d(fe,Ct),oe=P(qt,oe,Yt),Dt===null?ht=qt:Dt.sibling=qt,Dt=qt,Ct=yr}if(Yt===ge.length)return y(fe,Ct),bn&&Ll(fe,Yt),ht;if(Ct===null){for(;YtYt?(yr=Ct,Ct=null):yr=Ct.sibling;var Da=yt(fe,Ct,qt.value,qe);if(Da===null){Ct===null&&(Ct=yr);break}f&&Ct&&Da.alternate===null&&d(fe,Ct),oe=P(Da,oe,Yt),Dt===null?ht=Da:Dt.sibling=Da,Dt=Da,Ct=yr}if(qt.done)return y(fe,Ct),bn&&Ll(fe,Yt),ht;if(Ct===null){for(;!qt.done;Yt++,qt=ge.next())qt=bt(fe,qt.value,qe),qt!==null&&(oe=P(qt,oe,Yt),Dt===null?ht=qt:Dt.sibling=qt,Dt=qt);return bn&&Ll(fe,Yt),ht}for(Ct=A(fe,Ct);!qt.done;Yt++,qt=ge.next())qt=hn(Ct,fe,Yt,qt.value,qe),qt!==null&&(f&&qt.alternate!==null&&Ct.delete(qt.key===null?Yt:qt.key),oe=P(qt,oe,Yt),Dt===null?ht=qt:Dt.sibling=qt,Dt=qt);return f&&Ct.forEach(function(PU){return d(fe,PU)}),bn&&Ll(fe,Yt),ht}function os(fe,oe,ge,qe){if(typeof ge=="object"&&ge!==null&&ge.type===u&&ge.key===null&&(ge=ge.props.children),typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case l:e:{for(var ht=ge.key,Dt=oe;Dt!==null;){if(Dt.key===ht){if(ht=ge.type,ht===u){if(Dt.tag===7){y(fe,Dt.sibling),oe=M(Dt,ge.props.children),oe.return=fe,fe=oe;break e}}else if(Dt.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===S&&FT(ht)===Dt.type){y(fe,Dt.sibling),oe=M(Dt,ge.props),oe.ref=Rh(fe,Dt,ge),oe.return=fe,fe=oe;break e}y(fe,Dt);break}else d(fe,Dt);Dt=Dt.sibling}ge.type===u?(oe=zl(ge.props.children,fe.mode,qe,ge.key),oe.return=fe,fe=oe):(qe=yg(ge.type,ge.key,ge.props,null,fe.mode,qe),qe.ref=Rh(fe,oe,ge),qe.return=fe,fe=qe)}return W(fe);case c:e:{for(Dt=ge.key;oe!==null;){if(oe.key===Dt)if(oe.tag===4&&oe.stateNode.containerInfo===ge.containerInfo&&oe.stateNode.implementation===ge.implementation){y(fe,oe.sibling),oe=M(oe,ge.children||[]),oe.return=fe,fe=oe;break e}else{y(fe,oe);break}else d(fe,oe);oe=oe.sibling}oe=l1(ge,fe.mode,qe),oe.return=fe,fe=oe}return W(fe);case S:return Dt=ge._init,os(fe,oe,Dt(ge._payload),qe)}if(Z(ge))return dt(fe,oe,ge,qe);if(b(ge))return Dr(fe,oe,ge,qe);Hm(fe,ge)}return typeof ge=="string"&&ge!==""||typeof ge=="number"?(ge=""+ge,oe!==null&&oe.tag===6?(y(fe,oe.sibling),oe=M(oe,ge),oe.return=fe,fe=oe):(y(fe,oe),oe=a1(ge,fe.mode,qe),oe.return=fe,fe=oe),W(fe)):y(fe,oe)}return os}var cu=NT(!0),kT=NT(!1),Ph={},ns=Qe(Ph),Ih=Qe(Ph),uu=Qe(Ph);function ho(f){if(f===Ph)throw Error(o(174));return f}function M_(f,d){ut(uu,d),ut(Ih,f),ut(ns,Ph),f=ie(d),xt(ns),ut(ns,f)}function fu(){xt(ns),xt(Ih),xt(uu)}function UT(f){var d=ho(uu.current),y=ho(ns.current);d=G(y,f.type,d),y!==d&&(ut(Ih,f),ut(ns,d))}function T_(f){Ih.current===f&&(xt(ns),xt(Ih))}var Bn=Qe(0);function Gm(f){for(var d=f;d!==null;){if(d.tag===13){var y=d.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||ko(y)||so(y)))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if(d.flags&128)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var b_=[];function C_(){for(var f=0;fy?y:4,f(!0);var A=rs.transition;rs.transition={};try{f(!1),d()}finally{Kt=y,rs.transition=A}}function QT(){return po().memoizedState}function rU(f,d,y){var A=Ia(f);y={lane:A,action:y,hasEagerState:!1,eagerState:null,next:null},eb(f)?tb(d,y):(nb(f,d,y),y=Yr(),f=is(f,A,y),f!==null&&rb(f,d,A))}function iU(f,d,y){var A=Ia(f),M={lane:A,action:y,hasEagerState:!1,eagerState:null,next:null};if(eb(f))tb(d,M);else{nb(f,d,M);var P=f.alternate;if(f.lanes===0&&(P===null||P.lanes===0)&&(P=d.lastRenderedReducer,P!==null))try{var W=d.lastRenderedState,se=P(W,y);if(M.hasEagerState=!0,M.eagerState=se,co(se,W))return}catch{}finally{}y=Yr(),f=is(f,A,y),f!==null&&rb(f,d,A)}}function eb(f){var d=f.alternate;return f===Gn||d!==null&&d===Gn}function tb(f,d){Bh=Wm=!0;var y=f.pending;y===null?d.next=d:(d.next=y.next,y.next=d),f.pending=d}function nb(f,d,y){tr!==null&&f.mode&1&&!(Nt&2)?(f=d.interleaved,f===null?(y.next=y,fo===null?fo=[d]:fo.push(d)):(y.next=f.next,f.next=y),d.interleaved=y):(f=d.pending,f===null?y.next=y:(y.next=f.next,f.next=y),d.pending=y)}function rb(f,d,y){if(y&4194240){var A=d.lanes;A&=f.pendingLanes,y|=A,d.lanes=y,l_(f,y)}}var Km={readContext:Qi,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useInsertionEffect:Br,useLayoutEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useMutableSource:Br,useSyncExternalStore:Br,useId:Br,unstable_isNewReconciler:!1},sU={readContext:Qi,useCallback:function(f,d){return Wo().memoizedState=[f,d===void 0?null:d],f},useContext:Qi,useEffect:L_,useImperativeHandle:function(f,d,y){return y=y!=null?y.concat([f]):null,Xm(4194308,4,KT.bind(null,d,f),y)},useLayoutEffect:function(f,d){return Xm(4194308,4,f,d)},useInsertionEffect:function(f,d){return Xm(4,2,f,d)},useMemo:function(f,d){var y=Wo();return d=d===void 0?null:d,f=f(),y.memoizedState=[f,d],f},useReducer:function(f,d,y){var A=Wo();return d=y!==void 0?y(d):d,A.memoizedState=A.baseState=d,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:d},A.queue=f,f=f.dispatch=rU.bind(null,Gn,f),[A.memoizedState,f]},useRef:function(f){var d=Wo();return f={current:f},d.memoizedState=f},useState:B_,useDebugValue:D_,useDeferredValue:function(f){var d=B_(f),y=d[0],A=d[1];return L_(function(){var M=rs.transition;rs.transition={};try{A(f)}finally{rs.transition=M}},[f]),y},useTransition:function(){var f=B_(!1),d=f[0];return f=nU.bind(null,f[1]),Wo().memoizedState=f,[d,f]},useMutableSource:function(){},useSyncExternalStore:function(f,d,y){var A=Gn,M=Wo();if(bn){if(y===void 0)throw Error(o(407));y=y()}else{if(y=d(),tr===null)throw Error(o(349));hu&30||GT(A,d,y)}M.memoizedState=y;var P={value:y,getSnapshot:d};return M.queue=P,L_(WT.bind(null,A,P,f),[f]),A.flags|=2048,Dh(9,VT.bind(null,A,P,y,d),void 0,null),y},useId:function(){var f=Wo(),d=tr.identifierPrefix;if(bn){var y=Vo,A=Go;y=(A&~(1<<32-Tn(A)-1)).toString(32)+y,d=":"+d+"R"+y,y=Lh++,0Q_&&(d.flags|=128,A=!0,kh(M,!1),d.lanes=4194304)}else{if(!A)if(f=Gm(P),f!==null){if(d.flags|=128,A=!0,f=f.updateQueue,f!==null&&(d.updateQueue=f,d.flags|=4),kh(M,!0),M.tail===null&&M.tailMode==="hidden"&&!P.alternate&&!bn)return Lr(d),null}else 2*gr()-M.renderingStartTime>Q_&&y!==1073741824&&(d.flags|=128,A=!0,kh(M,!1),d.lanes=4194304);M.isBackwards?(P.sibling=d.child,d.child=P):(f=M.last,f!==null?f.sibling=P:d.child=P,M.last=P)}return M.tail!==null?(d=M.tail,M.rendering=d,M.tail=d.sibling,M.renderingStartTime=gr(),d.sibling=null,f=Bn.current,ut(Bn,A?f&1|2:f&1),d):(Lr(d),null);case 22:case 23:return i1(),A=d.memoizedState!==null,f!==null&&f.memoizedState!==null!==A&&(d.flags|=8192),A&&d.mode&1?Bi&1073741824&&(Lr(d),st&&d.subtreeFlags&6&&(d.flags|=8192)):Lr(d),null;case 24:return null;case 25:return null}throw Error(o(156,d.tag))}var uU=a.ReactCurrentOwner,Ii=!1;function Kr(f,d,y,A){d.child=f===null?kT(d,null,y,A):cu(d,f.child,y,A)}function fb(f,d,y,A,M){y=y.render;var P=d.ref;return su(d,M),A=P_(f,d,y,A,P,M),y=I_(),f!==null&&!Ii?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~M,$o(f,d,M)):(bn&&y&&x_(d),d.flags|=1,Kr(f,d,A,M),d.child)}function hb(f,d,y,A,M){if(f===null){var P=y.type;return typeof P=="function"&&!o1(P)&&P.defaultProps===void 0&&y.compare===null&&y.defaultProps===void 0?(d.tag=15,d.type=P,db(f,d,P,A,M)):(f=yg(y.type,null,A,d,d.mode,M),f.ref=d.ref,f.return=d,d.child=f)}if(P=f.child,!(f.lanes&M)){var W=P.memoizedProps;if(y=y.compare,y=y!==null?y:Lm,y(W,A)&&f.ref===d.ref)return $o(f,d,M)}return d.flags|=1,f=La(P,A),f.ref=d.ref,f.return=d,d.child=f}function db(f,d,y,A,M){if(f!==null&&Lm(f.memoizedProps,A)&&f.ref===d.ref)if(Ii=!1,(f.lanes&M)!==0)f.flags&131072&&(Ii=!0);else return d.lanes=f.lanes,$o(f,d,M);return N_(f,d,y,A,M)}function pb(f,d,y){var A=d.pendingProps,M=A.children,P=f!==null?f.memoizedState:null;if(A.mode==="hidden")if(!(d.mode&1))d.memoizedState={baseLanes:0,cachePool:null},ut(du,Bi),Bi|=y;else if(y&1073741824)d.memoizedState={baseLanes:0,cachePool:null},A=P!==null?P.baseLanes:y,ut(du,Bi),Bi|=A;else return f=P!==null?P.baseLanes|y:y,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:f,cachePool:null},d.updateQueue=null,ut(du,Bi),Bi|=f,null;else P!==null?(A=P.baseLanes|y,d.memoizedState=null):A=y,ut(du,Bi),Bi|=A;return Kr(f,d,M,y),d.child}function mb(f,d){var y=d.ref;(f===null&&y!==null||f!==null&&f.ref!==y)&&(d.flags|=512,d.flags|=2097152)}function N_(f,d,y,A,M){var P=on(y)?rn:nn.current;return P=Jt(d,P),su(d,M),y=P_(f,d,y,A,P,M),A=I_(),f!==null&&!Ii?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~M,$o(f,d,M)):(bn&&A&&x_(d),d.flags|=1,Kr(f,d,y,M),d.child)}function gb(f,d,y,A,M){if(on(y)){var P=!0;Qt(d)}else P=!1;if(su(d,M),d.stateNode===null)f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),PT(d,y,A),__(d,y,A,M),A=!0;else if(f===null){var W=d.stateNode,se=d.memoizedProps;W.props=se;var xe=W.context,ke=y.contextType;typeof ke=="object"&&ke!==null?ke=Qi(ke):(ke=on(y)?rn:nn.current,ke=Jt(d,ke));var at=y.getDerivedStateFromProps,bt=typeof at=="function"||typeof W.getSnapshotBeforeUpdate=="function";bt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(se!==A||xe!==ke)&&IT(d,W,A,ke),ba=!1;var yt=d.memoizedState;W.state=yt,Nm(d,A,W,M),xe=d.memoizedState,se!==A||yt!==xe||Et.current||ba?(typeof at=="function"&&(y_(d,y,at,A),xe=d.memoizedState),(se=ba||RT(d,y,se,A,yt,xe,ke))?(bt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(d.flags|=4194308)):(typeof W.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=A,d.memoizedState=xe),W.props=A,W.state=xe,W.context=ke,A=se):(typeof W.componentDidMount=="function"&&(d.flags|=4194308),A=!1)}else{W=d.stateNode,MT(f,d),se=d.memoizedProps,ke=d.type===d.elementType?se:Cs(d.type,se),W.props=ke,bt=d.pendingProps,yt=W.context,xe=y.contextType,typeof xe=="object"&&xe!==null?xe=Qi(xe):(xe=on(y)?rn:nn.current,xe=Jt(d,xe));var hn=y.getDerivedStateFromProps;(at=typeof hn=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(se!==bt||yt!==xe)&&IT(d,W,A,xe),ba=!1,yt=d.memoizedState,W.state=yt,Nm(d,A,W,M);var dt=d.memoizedState;se!==bt||yt!==dt||Et.current||ba?(typeof hn=="function"&&(y_(d,y,hn,A),dt=d.memoizedState),(ke=ba||RT(d,y,ke,A,yt,dt,xe)||!1)?(at||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(A,dt,xe),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(A,dt,xe)),typeof W.componentDidUpdate=="function"&&(d.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof W.componentDidUpdate!="function"||se===f.memoizedProps&&yt===f.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||se===f.memoizedProps&&yt===f.memoizedState||(d.flags|=1024),d.memoizedProps=A,d.memoizedState=dt),W.props=A,W.state=dt,W.context=xe,A=ke):(typeof W.componentDidUpdate!="function"||se===f.memoizedProps&&yt===f.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||se===f.memoizedProps&&yt===f.memoizedState||(d.flags|=1024),A=!1)}return k_(f,d,y,A,P,M)}function k_(f,d,y,A,M,P){mb(f,d);var W=(d.flags&128)!==0;if(!A&&!W)return M&&Vt(d,y,!1),$o(f,d,P);A=d.stateNode,uU.current=d;var se=W&&typeof y.getDerivedStateFromError!="function"?null:A.render();return d.flags|=1,f!==null&&W?(d.child=cu(d,f.child,null,P),d.child=cu(d,null,se,P)):Kr(f,d,se,P),d.memoizedState=A.state,M&&Vt(d,y,!0),d.child}function vb(f){var d=f.stateNode;d.pendingContext?Mt(f,d.pendingContext,d.pendingContext!==d.context):d.context&&Mt(f,d.context,!1),M_(f,d.containerInfo)}function yb(f,d,y,A,M){return lu(),w_(M),d.flags|=256,Kr(f,d,y,A),d.child}var Zm={dehydrated:null,treeContext:null,retryLane:0};function Qm(f){return{baseLanes:f,cachePool:null}}function _b(f,d,y){var A=d.pendingProps,M=Bn.current,P=!1,W=(d.flags&128)!==0,se;if((se=W)||(se=f!==null&&f.memoizedState===null?!1:(M&2)!==0),se?(P=!0,d.flags&=-129):(f===null||f.memoizedState!==null)&&(M|=1),ut(Bn,M&1),f===null)return A_(d),f=d.memoizedState,f!==null&&(f=f.dehydrated,f!==null)?(d.mode&1?so(f)?d.lanes=8:d.lanes=1073741824:d.lanes=1,null):(M=A.children,f=A.fallback,P?(A=d.mode,P=d.child,M={mode:"hidden",children:M},!(A&1)&&P!==null?(P.childLanes=0,P.pendingProps=M):P=_g(M,A,0,null),f=zl(f,A,y,null),P.return=d,f.return=d,P.sibling=f,d.child=P,d.child.memoizedState=Qm(y),d.memoizedState=Zm,f):U_(d,M));if(M=f.memoizedState,M!==null){if(se=M.dehydrated,se!==null){if(W)return d.flags&256?(d.flags&=-257,eg(f,d,y,Error(o(422)))):d.memoizedState!==null?(d.child=f.child,d.flags|=128,null):(P=A.fallback,M=d.mode,A=_g({mode:"visible",children:A.children},M,0,null),P=zl(P,M,y,null),P.flags|=2,A.return=d,P.return=d,A.sibling=P,d.child=A,d.mode&1&&cu(d,f.child,null,y),d.child.memoizedState=Qm(y),d.memoizedState=Zm,P);if(!(d.mode&1))d=eg(f,d,y,null);else if(so(se))d=eg(f,d,y,Error(o(419)));else if(A=(y&f.childLanes)!==0,Ii||A){if(A=tr,A!==null){switch(y&-y){case 4:P=2;break;case 16:P=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:P=32;break;case 536870912:P=268435456;break;default:P=0}A=P&(A.suspendedLanes|y)?0:P,A!==0&&A!==M.retryLane&&(M.retryLane=A,is(f,A,-1))}s1(),d=eg(f,d,y,Error(o(421)))}else ko(se)?(d.flags|=128,d.child=f.child,d=AU.bind(null,f),oo(se,d),d=null):(y=M.treeContext,Re&&(Pi=wh(se),Ri=d,bn=!0,Rs=null,bh=!1,y!==null&&(es[ts++]=Go,es[ts++]=Vo,es[ts++]=Bl,Go=y.id,Vo=y.overflow,Bl=d)),d=U_(d,d.pendingProps.children),d.flags|=4096);return d}return P?(A=Sb(f,d,A.children,A.fallback,y),P=d.child,M=f.child.memoizedState,P.memoizedState=M===null?Qm(y):{baseLanes:M.baseLanes|y,cachePool:null},P.childLanes=f.childLanes&~y,d.memoizedState=Zm,A):(y=xb(f,d,A.children,y),d.memoizedState=null,y)}return P?(A=Sb(f,d,A.children,A.fallback,y),P=d.child,M=f.child.memoizedState,P.memoizedState=M===null?Qm(y):{baseLanes:M.baseLanes|y,cachePool:null},P.childLanes=f.childLanes&~y,d.memoizedState=Zm,A):(y=xb(f,d,A.children,y),d.memoizedState=null,y)}function U_(f,d){return d=_g({mode:"visible",children:d},f.mode,0,null),d.return=f,f.child=d}function xb(f,d,y,A){var M=f.child;return f=M.sibling,y=La(M,{mode:"visible",children:y}),!(d.mode&1)&&(y.lanes=A),y.return=d,y.sibling=null,f!==null&&(A=d.deletions,A===null?(d.deletions=[f],d.flags|=16):A.push(f)),d.child=y}function Sb(f,d,y,A,M){var P=d.mode;f=f.child;var W=f.sibling,se={mode:"hidden",children:y};return!(P&1)&&d.child!==f?(y=d.child,y.childLanes=0,y.pendingProps=se,d.deletions=null):(y=La(f,se),y.subtreeFlags=f.subtreeFlags&14680064),W!==null?A=La(W,A):(A=zl(A,P,M,null),A.flags|=2),A.return=d,y.return=d,y.sibling=A,d.child=y,A}function eg(f,d,y,A){return A!==null&&w_(A),cu(d,f.child,null,y),f=U_(d,d.pendingProps.children),f.flags|=2,d.memoizedState=null,f}function Eb(f,d,y){f.lanes|=d;var A=f.alternate;A!==null&&(A.lanes|=d),g_(f.return,d,y)}function z_(f,d,y,A,M){var P=f.memoizedState;P===null?f.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:A,tail:y,tailMode:M}:(P.isBackwards=d,P.rendering=null,P.renderingStartTime=0,P.last=A,P.tail=y,P.tailMode=M)}function Ab(f,d,y){var A=d.pendingProps,M=A.revealOrder,P=A.tail;if(Kr(f,d,A.children,y),A=Bn.current,A&2)A=A&1|2,d.flags|=128;else{if(f!==null&&f.flags&128)e:for(f=d.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&Eb(f,y,d);else if(f.tag===19)Eb(f,y,d);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}A&=1}if(ut(Bn,A),!(d.mode&1))d.memoizedState=null;else switch(M){case"forwards":for(y=d.child,M=null;y!==null;)f=y.alternate,f!==null&&Gm(f)===null&&(M=y),y=y.sibling;y=M,y===null?(M=d.child,d.child=null):(M=y.sibling,y.sibling=null),z_(d,!1,M,y,P);break;case"backwards":for(y=null,M=d.child,d.child=null;M!==null;){if(f=M.alternate,f!==null&&Gm(f)===null){d.child=M;break}f=M.sibling,M.sibling=y,y=M,M=f}z_(d,!0,y,null,P);break;case"together":z_(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function $o(f,d,y){if(f!==null&&(d.dependencies=f.dependencies),pu|=d.lanes,!(y&d.childLanes))return null;if(f!==null&&d.child!==f.child)throw Error(o(153));if(d.child!==null){for(f=d.child,y=La(f,f.pendingProps),d.child=y,y.return=d;f.sibling!==null;)f=f.sibling,y=y.sibling=La(f,f.pendingProps),y.return=d;y.sibling=null}return d.child}function fU(f,d,y){switch(d.tag){case 3:vb(d),lu();break;case 5:UT(d);break;case 1:on(d.type)&&Qt(d);break;case 4:M_(d,d.stateNode.containerInfo);break;case 10:wT(d,d.type._context,d.memoizedProps.value);break;case 13:var A=d.memoizedState;if(A!==null)return A.dehydrated!==null?(ut(Bn,Bn.current&1),d.flags|=128,null):y&d.child.childLanes?_b(f,d,y):(ut(Bn,Bn.current&1),f=$o(f,d,y),f!==null?f.sibling:null);ut(Bn,Bn.current&1);break;case 19:if(A=(y&d.childLanes)!==0,f.flags&128){if(A)return Ab(f,d,y);d.flags|=128}var M=d.memoizedState;if(M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),ut(Bn,Bn.current),A)break;return null;case 22:case 23:return d.lanes=0,pb(f,d,y)}return $o(f,d,y)}function hU(f,d){switch(S_(d),d.tag){case 1:return on(d.type)&&Kn(),f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 3:return fu(),xt(Et),xt(nn),C_(),f=d.flags,f&65536&&!(f&128)?(d.flags=f&-65537|128,d):null;case 5:return T_(d),null;case 13:if(xt(Bn),f=d.memoizedState,f!==null&&f.dehydrated!==null){if(d.alternate===null)throw Error(o(340));lu()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 19:return xt(Bn),null;case 4:return fu(),null;case 10:return m_(d.type._context),null;case 22:case 23:return i1(),null;case 24:return null;default:return null}}var tg=!1,Ol=!1,dU=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function ng(f,d){var y=f.ref;if(y!==null)if(typeof y=="function")try{y(null)}catch(A){pi(f,d,A)}else y.current=null}function H_(f,d,y){try{y()}catch(A){pi(f,d,A)}}var wb=!1;function pU(f,d){for(te(f.containerInfo),Ke=d;Ke!==null;)if(f=Ke,d=f.child,(f.subtreeFlags&1028)!==0&&d!==null)d.return=f,Ke=d;else for(;Ke!==null;){f=Ke;try{var y=f.alternate;if(f.flags&1024)switch(f.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var A=y.memoizedProps,M=y.memoizedState,P=f.stateNode,W=P.getSnapshotBeforeUpdate(f.elementType===f.type?A:Cs(f.type,A),M);P.__reactInternalSnapshotBeforeUpdate=W}break;case 3:st&&Ve(f.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(se){pi(f,f.return,se)}if(d=f.sibling,d!==null){d.return=f.return,Ke=d;break}Ke=f.return}return y=wb,wb=!1,y}function Fl(f,d,y){var A=d.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var M=A=A.next;do{if((M.tag&f)===f){var P=M.destroy;M.destroy=void 0,P!==void 0&&H_(d,y,P)}M=M.next}while(M!==A)}}function Uh(f,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var y=d=d.next;do{if((y.tag&f)===f){var A=y.create;y.destroy=A()}y=y.next}while(y!==d)}}function G_(f){var d=f.ref;if(d!==null){var y=f.stateNode;switch(f.tag){case 5:f=ne(y);break;default:f=y}typeof d=="function"?d(f):d.current=f}}function Mb(f,d,y){if(lo&&typeof lo.onCommitFiberUnmount=="function")try{lo.onCommitFiberUnmount(Im,d)}catch{}switch(d.tag){case 0:case 11:case 14:case 15:if(f=d.updateQueue,f!==null&&(f=f.lastEffect,f!==null)){var A=f=f.next;do{var M=A,P=M.destroy;M=M.tag,P!==void 0&&(M&2||M&4)&&H_(d,y,P),A=A.next}while(A!==f)}break;case 1:if(ng(d,y),f=d.stateNode,typeof f.componentWillUnmount=="function")try{f.props=d.memoizedProps,f.state=d.memoizedState,f.componentWillUnmount()}catch(W){pi(d,y,W)}break;case 5:ng(d,y);break;case 4:st?Ib(f,d,y):J&&J&&(d=d.stateNode.containerInfo,y=zt(d),Zi(d,y))}}function Tb(f,d,y){for(var A=d;;)if(Mb(f,A,y),A.child===null||st&&A.tag===4){if(A===d)break;for(;A.sibling===null;){if(A.return===null||A.return===d)return;A=A.return}A.sibling.return=A.return,A=A.sibling}else A.child.return=A,A=A.child}function bb(f){var d=f.alternate;d!==null&&(f.alternate=null,bb(d)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(d=f.stateNode,d!==null&&nt(d)),f.stateNode=null,f.return=null,f.dependencies=null,f.memoizedProps=null,f.memoizedState=null,f.pendingProps=null,f.stateNode=null,f.updateQueue=null}function Cb(f){return f.tag===5||f.tag===3||f.tag===4}function Rb(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||Cb(f.return))return null;f=f.return}for(f.sibling.return=f.return,f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(f.flags&2||f.child===null||f.tag===4)continue e;f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function Pb(f){if(st){e:{for(var d=f.return;d!==null;){if(Cb(d))break e;d=d.return}throw Error(o(160))}var y=d;switch(y.tag){case 5:d=y.stateNode,y.flags&32&&(rt(d),y.flags&=-33),y=Rb(f),W_(f,y,d);break;case 3:case 4:d=y.stateNode.containerInfo,y=Rb(f),V_(f,y,d);break;default:throw Error(o(161))}}}function V_(f,d,y){var A=f.tag;if(A===5||A===6)f=f.stateNode,d?Ce(y,f,d):Ye(y,f);else if(A!==4&&(f=f.child,f!==null))for(V_(f,d,y),f=f.sibling;f!==null;)V_(f,d,y),f=f.sibling}function W_(f,d,y){var A=f.tag;if(A===5||A===6)f=f.stateNode,d?me(y,f,d):Ue(y,f);else if(A!==4&&(f=f.child,f!==null))for(W_(f,d,y),f=f.sibling;f!==null;)W_(f,d,y),f=f.sibling}function Ib(f,d,y){for(var A=d,M=!1,P,W;;){if(!M){M=A.return;e:for(;;){if(M===null)throw Error(o(160));switch(P=M.stateNode,M.tag){case 5:W=!1;break e;case 3:P=P.containerInfo,W=!0;break e;case 4:P=P.containerInfo,W=!0;break e}M=M.return}M=!0}if(A.tag===5||A.tag===6)Tb(f,A,y),W?Ne(P,A.stateNode):Be(P,A.stateNode);else if(A.tag===18)W?de(P,A.stateNode):le(P,A.stateNode);else if(A.tag===4){if(A.child!==null){P=A.stateNode.containerInfo,W=!0,A.child.return=A,A=A.child;continue}}else if(Mb(f,A,y),A.child!==null){A.child.return=A,A=A.child;continue}if(A===d)break;for(;A.sibling===null;){if(A.return===null||A.return===d)return;A=A.return,A.tag===4&&(M=!1)}A.sibling.return=A.return,A=A.sibling}}function $_(f,d){if(st){switch(d.tag){case 0:case 11:case 14:case 15:Fl(3,d,d.return),Uh(3,d),Fl(5,d,d.return);return;case 1:return;case 5:var y=d.stateNode;if(y!=null){var A=d.memoizedProps;f=f!==null?f.memoizedProps:A;var M=d.type,P=d.updateQueue;d.updateQueue=null,P!==null&&ee(y,P,M,f,A,d)}return;case 6:if(d.stateNode===null)throw Error(o(162));y=d.memoizedProps,He(d.stateNode,f!==null?f.memoizedProps:y,y);return;case 3:Re&&f!==null&&f.memoizedState.isDehydrated&&H(d.stateNode.containerInfo);return;case 12:return;case 13:rg(d);return;case 19:rg(d);return;case 17:return}throw Error(o(163))}switch(d.tag){case 0:case 11:case 14:case 15:Fl(3,d,d.return),Uh(3,d),Fl(5,d,d.return);return;case 12:return;case 13:rg(d);return;case 19:rg(d);return;case 3:Re&&f!==null&&f.memoizedState.isDehydrated&&H(d.stateNode.containerInfo);break;case 22:case 23:return}e:if(J){switch(d.tag){case 1:case 5:case 6:break e;case 3:case 4:d=d.stateNode,Zi(d.containerInfo,d.pendingChildren);break e}throw Error(o(163))}}function rg(f){var d=f.updateQueue;if(d!==null){f.updateQueue=null;var y=f.stateNode;y===null&&(y=f.stateNode=new dU),d.forEach(function(A){var M=wU.bind(null,f,A);y.has(A)||(y.add(A),A.then(M,M))})}}function mU(f,d){for(Ke=d;Ke!==null;){d=Ke;var y=d.deletions;if(y!==null)for(var A=0;A";case sg:return":has("+(J_(f)||"")+")";case og:return'[role="'+f.value+'"]';case lg:return'"'+f.value+'"';case ag:return'[data-testname="'+f.value+'"]';default:throw Error(o(365))}}function Fb(f,d){var y=[];f=[f,0];for(var A=0;AM&&(M=W),A&=~P}if(A=M,A=gr()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*vU(A/1960))-A,10f?16:f,Pa===null)var A=!1;else{if(f=Pa,Pa=null,dg=0,Nt&6)throw Error(o(331));var M=Nt;for(Nt|=4,Ke=f.current;Ke!==null;){var P=Ke,W=P.child;if(Ke.flags&16){var se=P.deletions;if(se!==null){for(var xe=0;xegr()-Z_?Nl(f,0):q_|=y),di(f,d)}function $b(f,d){d===0&&(f.mode&1?(d=Rm,Rm<<=1,!(Rm&130023424)&&(Rm=4194304)):d=1);var y=Yr();f=gg(f,d),f!==null&&(Th(f,d,y),di(f,y))}function AU(f){var d=f.memoizedState,y=0;d!==null&&(y=d.retryLane),$b(f,y)}function wU(f,d){var y=0;switch(f.tag){case 13:var A=f.stateNode,M=f.memoizedState;M!==null&&(y=M.retryLane);break;case 19:A=f.stateNode;break;default:throw Error(o(314))}A!==null&&A.delete(d),$b(f,y)}var jb;jb=function(f,d,y){if(f!==null)if(f.memoizedProps!==d.pendingProps||Et.current)Ii=!0;else{if(!(f.lanes&y)&&!(d.flags&128))return Ii=!1,fU(f,d,y);Ii=!!(f.flags&131072)}else Ii=!1,bn&&d.flags&1048576&&BT(d,zm,d.index);switch(d.lanes=0,d.tag){case 2:var A=d.type;f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),f=d.pendingProps;var M=Jt(d,nn.current);su(d,y),M=P_(null,d,A,f,M,y);var P=I_();return d.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,on(A)?(P=!0,Qt(d)):P=!1,d.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,v_(d),M.updater=km,d.stateNode=M,M._reactInternals=d,__(d,A,f,y),d=k_(null,d,A,!0,P,y)):(d.tag=0,bn&&P&&x_(d),Kr(null,d,M,y),d=d.child),d;case 16:A=d.elementType;e:{switch(f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),f=d.pendingProps,M=A._init,A=M(A._payload),d.type=A,M=d.tag=TU(A),f=Cs(A,f),M){case 0:d=N_(null,d,A,f,y);break e;case 1:d=gb(null,d,A,f,y);break e;case 11:d=fb(null,d,A,f,y);break e;case 14:d=hb(null,d,A,Cs(A.type,f),y);break e}throw Error(o(306,A,""))}return d;case 0:return A=d.type,M=d.pendingProps,M=d.elementType===A?M:Cs(A,M),N_(f,d,A,M,y);case 1:return A=d.type,M=d.pendingProps,M=d.elementType===A?M:Cs(A,M),gb(f,d,A,M,y);case 3:e:{if(vb(d),f===null)throw Error(o(387));A=d.pendingProps,P=d.memoizedState,M=P.element,MT(f,d),Nm(d,A,null,y);var W=d.memoizedState;if(A=W.element,Re&&P.isDehydrated)if(P={element:A,isDehydrated:!1,cache:W.cache,transitions:W.transitions},d.updateQueue.baseState=P,d.memoizedState=P,d.flags&256){M=Error(o(423)),d=yb(f,d,A,y,M);break e}else if(A!==M){M=Error(o(424)),d=yb(f,d,A,y,M);break e}else for(Re&&(Pi=ru(d.stateNode.containerInfo),Ri=d,bn=!0,Rs=null,bh=!1),y=kT(d,null,A,y),d.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling;else{if(lu(),A===M){d=$o(f,d,y);break e}Kr(f,d,A,y)}d=d.child}return d;case 5:return UT(d),f===null&&A_(d),A=d.type,M=d.pendingProps,P=f!==null?f.memoizedProps:null,W=M.children,Le(A,M)?W=null:P!==null&&Le(A,P)&&(d.flags|=32),mb(f,d),Kr(f,d,W,y),d.child;case 6:return f===null&&A_(d),null;case 13:return _b(f,d,y);case 4:return M_(d,d.stateNode.containerInfo),A=d.pendingProps,f===null?d.child=cu(d,null,A,y):Kr(f,d,A,y),d.child;case 11:return A=d.type,M=d.pendingProps,M=d.elementType===A?M:Cs(A,M),fb(f,d,A,M,y);case 7:return Kr(f,d,d.pendingProps,y),d.child;case 8:return Kr(f,d,d.pendingProps.children,y),d.child;case 12:return Kr(f,d,d.pendingProps.children,y),d.child;case 10:e:{if(A=d.type._context,M=d.pendingProps,P=d.memoizedProps,W=M.value,wT(d,A,W),P!==null)if(co(P.value,W)){if(P.children===M.children&&!Et.current){d=$o(f,d,y);break e}}else for(P=d.child,P!==null&&(P.return=d);P!==null;){var se=P.dependencies;if(se!==null){W=P.child;for(var xe=se.firstContext;xe!==null;){if(xe.context===A){if(P.tag===1){xe=Ho(-1,y&-y),xe.tag=2;var ke=P.updateQueue;if(ke!==null){ke=ke.shared;var at=ke.pending;at===null?xe.next=xe:(xe.next=at.next,at.next=xe),ke.pending=xe}}P.lanes|=y,xe=P.alternate,xe!==null&&(xe.lanes|=y),g_(P.return,y,d),se.lanes|=y;break}xe=xe.next}}else if(P.tag===10)W=P.type===d.type?null:P.child;else if(P.tag===18){if(W=P.return,W===null)throw Error(o(341));W.lanes|=y,se=W.alternate,se!==null&&(se.lanes|=y),g_(W,y,d),W=P.sibling}else W=P.child;if(W!==null)W.return=P;else for(W=P;W!==null;){if(W===d){W=null;break}if(P=W.sibling,P!==null){P.return=W.return,W=P;break}W=W.return}P=W}Kr(f,d,M.children,y),d=d.child}return d;case 9:return M=d.type,A=d.pendingProps.children,su(d,y),M=Qi(M),A=A(M),d.flags|=1,Kr(f,d,A,y),d.child;case 14:return A=d.type,M=Cs(A,d.pendingProps),M=Cs(A.type,M),hb(f,d,A,M,y);case 15:return db(f,d,d.type,d.pendingProps,y);case 17:return A=d.type,M=d.pendingProps,M=d.elementType===A?M:Cs(A,M),f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),d.tag=1,on(A)?(f=!0,Qt(d)):f=!1,su(d,y),PT(d,A,M),__(d,A,M,y),k_(null,d,A,!0,f,y);case 19:return Ab(f,d,y);case 22:return pb(f,d,y)}throw Error(o(156,d.tag))};function Xb(f,d){return c_(f,d)}function MU(f,d,y,A){this.tag=f,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ss(f,d,y,A){return new MU(f,d,y,A)}function o1(f){return f=f.prototype,!(!f||!f.isReactComponent)}function TU(f){if(typeof f=="function")return o1(f)?1:0;if(f!=null){if(f=f.$$typeof,f===_)return 11;if(f===E)return 14}return 2}function La(f,d){var y=f.alternate;return y===null?(y=ss(f.tag,d,f.key,f.mode),y.elementType=f.elementType,y.type=f.type,y.stateNode=f.stateNode,y.alternate=f,f.alternate=y):(y.pendingProps=d,y.type=f.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=f.flags&14680064,y.childLanes=f.childLanes,y.lanes=f.lanes,y.child=f.child,y.memoizedProps=f.memoizedProps,y.memoizedState=f.memoizedState,y.updateQueue=f.updateQueue,d=f.dependencies,y.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},y.sibling=f.sibling,y.index=f.index,y.ref=f.ref,y}function yg(f,d,y,A,M,P){var W=2;if(A=f,typeof f=="function")o1(f)&&(W=1);else if(typeof f=="string")W=5;else e:switch(f){case u:return zl(y.children,M,P,d);case h:W=8,M|=8;break;case p:return f=ss(12,y,d,M|2),f.elementType=p,f.lanes=P,f;case x:return f=ss(13,y,d,M),f.elementType=x,f.lanes=P,f;case v:return f=ss(19,y,d,M),f.elementType=v,f.lanes=P,f;case w:return _g(y,M,P,d);default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case m:W=10;break e;case g:W=9;break e;case _:W=11;break e;case E:W=14;break e;case S:W=16,A=null;break e}throw Error(o(130,f==null?f:typeof f,""))}return d=ss(W,y,d,M),d.elementType=f,d.type=A,d.lanes=P,d}function zl(f,d,y,A){return f=ss(7,f,A,d),f.lanes=y,f}function _g(f,d,y,A){return f=ss(22,f,A,d),f.elementType=w,f.lanes=y,f.stateNode={},f}function a1(f,d,y){return f=ss(6,f,null,d),f.lanes=y,f}function l1(f,d,y){return d=ss(4,f.children!==null?f.children:[],f.key,d),d.lanes=y,d.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},d}function bU(f,d,y,A,M){this.tag=d,this.containerInfo=f,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ft,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=a_(0),this.expirationTimes=a_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=a_(0),this.identifierPrefix=A,this.onRecoverableError=M,Re&&(this.mutableSourceEagerHydrationData=null)}function Jb(f,d,y,A,M,P,W,se,xe){return f=new bU(f,d,y,se,xe),d===1?(d=1,P===!0&&(d|=8)):d=0,P=ss(3,null,null,d),f.current=P,P.stateNode=f,P.memoizedState={element:A,isDehydrated:y,cache:null,transitions:null},v_(P),f}function Kb(f){if(!f)return Tt;f=f._reactInternals;e:{if(R(f)!==f||f.tag!==1)throw Error(o(170));var d=f;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(on(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(o(171))}if(f.tag===1){var y=f.type;if(on(y))return In(f,y,d)}return d}function Yb(f){var d=f._reactInternals;if(d===void 0)throw typeof f.render=="function"?Error(o(188)):(f=Object.keys(f).join(","),Error(o(268,f)));return f=X(d),f===null?null:f.stateNode}function qb(f,d){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var y=f.retryLane;f.retryLane=y!==0&&y=ke&&P>=bt&&M<=at&&W<=yt){f.splice(d,1);break}else if(A!==ke||y.width!==xe.width||ytW){if(!(P!==bt||y.height!==xe.height||atM)){ke>A&&(xe.width+=ke-A,xe.x=A),atP&&(xe.height+=bt-P,xe.y=P),yty&&(y=W)),W ")+` + +No matching component was found for: + `)+f.join(" > ")}return null},t.getPublicRootInstance=function(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 5:return ne(f.child.stateNode);default:return f.child.stateNode}},t.injectIntoDevTools=function(f){if(f={bundleType:f.bundleType,version:f.version,rendererPackageName:f.rendererPackageName,rendererConfig:f.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:CU,findFiberByHostInstance:f.findFiberByHostInstance||RU,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")f=!1;else{var d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(d.isDisabled||!d.supportsFiber)f=!0;else{try{Im=d.inject(f),lo=d}catch{}f=!!d.checkDCE}}return f},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(f,d,y,A){if(!ct)throw Error(o(363));f=K_(f,d);var M=Ie(f,y,A).disconnect;return{disconnect:function(){M()}}},t.registerMutableSourceForHydration=function(f,d){var y=d._getVersion;y=y(d._source),f.mutableSourceEagerHydrationData==null?f.mutableSourceEagerHydrationData=[d,y]:f.mutableSourceEagerHydrationData.push(d,y)},t.runWithPriority=function(f,d){var y=Kt;try{return Kt=f,d()}finally{Kt=y}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(f,d,y,A){var M=d.current,P=Yr(),W=Ia(M);return y=Kb(y),d.context===null?d.context=y:d.pendingContext=y,d=Ho(P,W),d.payload={element:f},A=A===void 0?null:A,A!==null&&(d.callback=A),Ca(M,d),f=is(M,W,P),f!==null&&Fm(f,M,W),W},t};(function(n){n.exports=o$})(i$);const a$=TA(BE),l$=n=>typeof n=="object"&&typeof n.then=="function",mc=[];function a3(n,e,t=(r,i)=>r===i){if(n===e)return!0;if(!n||!e)return!1;const r=n.length;if(e.length!==r)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,r.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:r.equal,remove:()=>{const s=mc.indexOf(i);s!==-1&&mc.splice(s,1)},promise:(l$(n)?n:n(...e)).then(s=>{i.response=s,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(s=>i.error=s)};if(mc.push(i),!t)throw i.promise}const c$=(n,e,t)=>l3(n,e,!1,t),u$=(n,e,t)=>void l3(n,e,!0,t),f$=n=>{if(n===void 0||n.length===0)mc.splice(0,mc.length);else{const e=mc.find(t=>a3(n,t.keys,t.equal));e&&e.remove()}},vM={},c3=n=>void Object.assign(vM,n);function h$(n,e){function t(u,{args:h=[],attach:p,...m},g){let _=`${u[0].toUpperCase()}${u.slice(1)}`,x;if(u==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const v=m.object;x=$u(v,{type:u,root:g,attach:p,primitive:!0})}else{const v=vM[_];if(!v)throw new Error(`R3F: ${_} 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=$u(new v(...h),{type:u,root:g,attach:p,memoizedProps:{args:h}})}return x.__r3f.attach===void 0&&(x instanceof At?x.__r3f.attach="geometry":x instanceof or&&(x.__r3f.attach="material")),_!=="inject"&&vx(x,m),x}function r(u,h){let p=!1;if(h){var m,g;(m=h.__r3f)!=null&&m.attach?gx(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),p=!0),p||(g=u.__r3f)==null||g.objects.push(h),h.__r3f||$u(h,{}),h.__r3f.parent=u,DE(h),ju(h)}}function i(u,h,p){let m=!1;if(h){var g,_;if((g=h.__r3f)!=null&&g.attach)gx(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"});const x=u.children.filter(E=>E!==h),v=x.indexOf(p);u.children=[...x.slice(0,v),h,...x.slice(v)],m=!0}m||(_=u.__r3f)==null||_.objects.push(h),h.__r3f||$u(h,{}),h.__r3f.parent=u,DE(h),ju(h)}}function s(u,h,p=!1){u&&[...u].forEach(m=>o(h,m,p))}function o(u,h,p){if(h){var m,g,_;if(h.__r3f&&(h.__r3f.parent=null),(m=u.__r3f)!=null&&m.objects&&(u.__r3f.objects=u.__r3f.objects.filter(w=>w!==h)),(g=h.__r3f)!=null&&g.attach)kP(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var x;u.remove(h),(x=h.__r3f)!=null&&x.root&&_$(h.__r3f.root,h)}const E=(_=h.__r3f)==null?void 0:_.primitive,S=p===void 0?h.dispose!==null&&!E:p;if(!E){var v;s((v=h.__r3f)==null?void 0:v.objects,h,S),s(h.children,h,S)}delete h.__r3f,S&&h.dispose&&h.type!=="Scene"&&Mp.unstable_scheduleCallback(Mp.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),ju(u)}}function a(u,h,p,m){var g;const _=(g=u.__r3f)==null?void 0:g.parent;if(!_)return;const x=t(h,p,u.__r3f.root);if(u.children){for(const v of u.children)v.__r3f&&r(x,v);u.children=u.children.filter(v=>!v.__r3f)}u.__r3f.objects.forEach(v=>r(x,v)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(_,u),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),r(_,x),x.raycast&&x.__r3f.eventCount&&x.__r3f.root.getState().internal.interaction.push(x),[m,m.alternate].forEach(v=>{v!==null&&(v.stateNode=x,v.ref&&(typeof v.ref=="function"?v.ref(x):v.ref.current=x))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:a$({createInstance:t,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const p=u.getState().scene;p.__r3f&&(p.__r3f.root=u,r(p,h))},removeChildFromContainer:(u,h)=>{h&&o(u.getState().scene,h)},insertInContainerBefore:(u,h,p)=>{if(!h||!p)return;const m=u.getState().scene;m.__r3f&&i(m,h,p)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;const p=(h=u==null?void 0:u.__r3f)!=null?h:{};return Boolean(p.handlers)},prepareUpdate(u,h,p,m){if(u.__r3f.primitive&&m.object&&m.object!==u)return[!0];{const{args:g=[],children:_,...x}=m,{args:v=[],children:E,...S}=p;if(!Array.isArray(g))throw new Error("R3F: the args prop must be an array!");if(g.some((C,b)=>C!==v[b]))return[!0];const w=g3(u,x,S,!0);return w.changes.length?[!1,w]:null}},commitUpdate(u,[h,p],m,g,_,x){h?a(u,m,_,x):vx(u,p)},commitMount(u,h,p,m){var g;const _=(g=u.__r3f)!=null?g:{};u.raycast&&_.handlers&&_.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>$u(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:p,parent:m}=(h=u.__r3f)!=null?h:{};p&&m&&kP(m,u,p),u.isObject3D&&(u.visible=!1),ju(u)},unhideInstance(u,h){var p;const{attach:m,parent:g}=(p=u.__r3f)!=null?p:{};m&&g&&gx(g,u,m),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),ju(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Qa.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&xn.fun(performance.now)?performance.now:xn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:xn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:xn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:vx}}var DP,OP;const mx=n=>"colorSpace"in n||"outputColorSpace"in n,u3=()=>{var n;return(n=vM.ColorManagement)!=null?n:null},f3=n=>n&&n.isOrthographicCamera,d$=n=>n&&n.hasOwnProperty("current"),cm=typeof window<"u"&&((DP=window.document)!=null&&DP.createElement||((OP=window.navigator)==null?void 0:OP.product)==="ReactNative")?D.useLayoutEffect:D.useEffect;function h3(n){const e=D.useRef(n);return cm(()=>void(e.current=n),[n]),e}function p$({set:n}){return cm(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class d3 extends D.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}d3.getDerivedStateFromError=()=>({error:!0});const p3="__default",FP=new Map,m$=n=>n&&!!n.memoized&&!!n.changes;function m3(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 ld=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},xn={obj:n=>n===Object(n)&&!xn.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:r="reference",strict:i=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(xn.str(n)||xn.num(n))return n===e;const s=xn.obj(n);if(s&&r==="reference")return n===e;const o=xn.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"&&r==="shallow"){for(a in i?e:n)if(!xn.equ(n[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:n)if(n[a]!==e[a])return!1;if(xn.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 g$(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 v$(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function $u(n,e){const t=n;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),n}function LE(n,e){let t=n;if(e.includes("-")){const r=e.split("-"),i=r.pop();return t=r.reduce((s,o)=>s[o],n),{target:t,key:i}}else return{target:t,key:e}}const NP=/-\d+$/;function gx(n,e,t){if(xn.str(t)){if(NP.test(t)){const s=t.replace(NP,""),{target:o,key:a}=LE(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=LE(n,t);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=t(n,e)}function kP(n,e,t){var r,i;if(xn.str(t)){const{target:s,key:o}=LE(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(n,e);(i=e.__r3f)==null||delete i.previousAttach}function g3(n,{children:e,key:t,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){var u;const h=(u=n==null?void 0:n.__r3f)!=null?u:{},p=Object.entries(i),m=[];if(c){const _=Object.keys(l);for(let x=0;x<_.length;x++)i.hasOwnProperty(_[x])||p.unshift([_[x],p3+"remove"])}p.forEach(([_,x])=>{var v;if((v=n.__r3f)!=null&&v.primitive&&_==="object"||xn.equ(x,l[_]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(_))return m.push([_,x,!0,[]]);let E=[];_.includes("-")&&(E=_.split("-")),m.push([_,x,!1,E]);for(const S in i){const w=i[S];S.startsWith(`${_}-`)&&m.push([S,w,!1,S.split("-")])}});const g={...i};return h.memoizedProps&&h.memoizedProps.args&&(g.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(g.attach=h.memoizedProps.attach),{memoized:g,changes:m}}function vx(n,e){var t,r,i;const s=(t=n.__r3f)!=null?t:{},o=s.root,a=(r=o==null||o.getState==null?void 0:o.getState())!=null?r:{},{memoized:l,changes:c}=m$(e)?e:g3(n,e),u=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let p=0;pS[w],n),!(E&&E.set))){const[S,...w]=x.reverse();v=w.reverse().reduce((C,b)=>C[b],n),m=S}if(g===p3+"remove")if(v.constructor){let S=FP.get(v.constructor);S||(S=new v.constructor,FP.set(v.constructor,S)),g=S[m]}else g=0;if(_)g?s.handlers[m]=g:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(E&&E.set&&(E.copy||E instanceof Sc)){if(Array.isArray(g))E.fromArray?E.fromArray(g):E.set(...g);else if(E.copy&&g&&g.constructor&&E.constructor===g.constructor)E.copy(g);else if(g!==void 0){const S=E instanceof Ge;!S&&E.setScalar?E.setScalar(g):E instanceof Sc&&g instanceof Sc?E.mask=g.mask:E.set(g),!u3()&&!a.linear&&S&&E.convertSRGBToLinear()}}else if(v[m]=g,v[m]instanceof mn&&v[m].format===ni&&v[m].type===Mo){const S=v[m];mx(S)&&mx(a.gl)?S.colorSpace=a.gl.outputColorSpace:S.encoding=a.gl.outputEncoding}ju(n)}if(s.parent&&a.internal&&n.raycast&&u!==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!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(i=n.__r3f)!=null&&i.parent&&DE(n),n}function ju(n){var e,t;const r=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();r&&r.internal.frames===0&&r.invalidate()}function DE(n){n.onUpdate==null||n.onUpdate(n)}function v3(n,e){n.manual||(f3(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 wv(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function y$(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Qa.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Qa.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Qa.ContinuousEventPriority;default:return Qa.DefaultEventPriority}}function y3(n,e,t,r){const i=t.get(e);i&&(t.delete(e),t.size===0&&(n.delete(r),i.target.releasePointerCapture(r)))}function _$(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(r=>r!==e),t.initialHits=t.initialHits.filter(r=>r!==e),t.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((r,i)=>{y3(t.capturedMap,e,r,i)})}function x$(n){function e(l){const{internal:c}=n.getState(),u=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function r(l,c){const u=n.getState(),h=new Set,p=[],m=c?c(u.internal.interaction):u.internal.interaction;for(let v=0;v{const S=ld(v.object),w=ld(E.object);return!S||!w?v.distance-E.distance:w.events.priority-S.events.priority||v.distance-E.distance}).filter(v=>{const E=wv(v);return h.has(E)?!1:(h.add(E),!0)});u.events.filter&&(_=u.events.filter(_,u));for(const v of _){let E=v.object;for(;E;){var x;(x=E.__r3f)!=null&&x.eventCount&&p.push({...v,eventObject:E}),E=E.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let v of u.internal.capturedMap.get(l.pointerId).values())h.has(wv(v.intersection))||p.push(v.intersection);return p}function i(l,c,u,h){const p=n.getState();if(l.length){const m={stopped:!1};for(const g of l){const _=ld(g.object)||p,{raycaster:x,pointer:v,camera:E,internal:S}=_,w=new z(v.x,v.y,0).unproject(E),C=L=>{var k,X;return(k=(X=S.capturedMap.get(L))==null?void 0:X.has(g.eventObject))!=null?k:!1},b=L=>{const k={intersection:g,target:c.target};S.capturedMap.has(L)?S.capturedMap.get(L).set(g.eventObject,k):S.capturedMap.set(L,new Map([[g.eventObject,k]])),c.target.setPointerCapture(L)},B=L=>{const k=S.capturedMap.get(L);k&&y3(S.capturedMap,g.eventObject,k,L)};let I={};for(let L in c){let k=c[L];typeof k!="function"&&(I[L]=k)}let R={...g,...I,pointer:v,intersections:l,stopped:m.stopped,delta:u,unprojectedPoint:w,ray:x.ray,camera:E,stopPropagation(){const L="pointerId"in c&&S.capturedMap.get(c.pointerId);if((!L||L.has(g.eventObject))&&(R.stopped=m.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(k=>k.eventObject===g.eventObject))){const k=l.slice(0,l.indexOf(g));s([...k,g])}},target:{hasPointerCapture:C,setPointerCapture:b,releasePointerCapture:B},currentTarget:{hasPointerCapture:C,setPointerCapture:b,releasePointerCapture:B},nativeEvent:c};if(h(R),m.stopped===!0)break}}return l}function s(l){const{internal:c}=n.getState();for(const u of c.hovered.values())if(!l.length||!l.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const p=u.eventObject.__r3f,m=p==null?void 0:p.handlers;if(c.hovered.delete(wv(u)),p!=null&&p.eventCount){const g={...u,intersections:l};m.onPointerOut==null||m.onPointerOut(g),m.onPointerLeave==null||m.onPointerLeave(g)}}}function o(l,c){for(let u=0;us([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),s([]))})}}return function(u){const{onPointerMissed:h,internal:p}=n.getState();p.lastEvent.current=u;const m=l==="onPointerMove",g=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",x=r(u,m?t:void 0),v=g?e(u):0;l==="onPointerDown"&&(p.initialClick=[u.offsetX,u.offsetY],p.initialHits=x.map(S=>S.eventObject)),g&&!x.length&&v<=2&&(o(u,p.interaction),h&&h(u)),m&&s(x);function E(S){const w=S.eventObject,C=w.__r3f,b=C==null?void 0:C.handlers;if(C!=null&&C.eventCount)if(m){if(b.onPointerOver||b.onPointerEnter||b.onPointerOut||b.onPointerLeave){const B=wv(S),I=p.hovered.get(B);I?I.stopped&&S.stopPropagation():(p.hovered.set(B,S),b.onPointerOver==null||b.onPointerOver(S),b.onPointerEnter==null||b.onPointerEnter(S))}b.onPointerMove==null||b.onPointerMove(S)}else{const B=b[l];B?(!g||p.initialHits.includes(w))&&(o(u,p.interaction.filter(I=>!p.initialHits.includes(I))),B(S)):g&&p.initialHits.includes(w)&&o(u,p.interaction.filter(I=>!p.initialHits.includes(I)))}}i(x,u,v,E)}}return{handlePointer:a}}const S$=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],_3=n=>!!(n!=null&&n.render),yM=D.createContext(null),E$=(n,e)=>{const t=gM((a,l)=>{const c=new z,u=new z,h=new z;function p(v=l().camera,E=u,S=l().size){const{width:w,height:C,top:b,left:B}=S,I=w/C;E instanceof z?h.copy(E):h.set(...E);const R=v.getWorldPosition(c).distanceTo(h);if(f3(v))return{width:w/v.zoom,height:C/v.zoom,top:b,left:B,factor:1,distance:R,aspect:I};{const L=v.fov*Math.PI/180,k=2*Math.tan(L/2)*R,X=k*(w/C);return{width:X,height:k,top:b,left:B,factor:w/X,distance:R,aspect:I}}}let m;const g=v=>a(E=>({performance:{...E.performance,current:v}})),_=new Me;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(v=1)=>n(l(),v),advance:(v,E)=>e(v,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new fM,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const v=l();m&&clearTimeout(m),v.performance.current!==v.performance.min&&g(v.performance.min),m=setTimeout(()=>g(l().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(E=>({...E,events:{...E.events,...v}})),setSize:(v,E,S,w,C)=>{const b=l().camera,B={width:v,height:E,top:w||0,left:C||0,updateStyle:S};a(I=>({size:B,viewport:{...I.viewport,...p(b,u,B)}}))},setDpr:v=>a(E=>{const S=m3(v);return{viewport:{...E.viewport,dpr:S,initialDpr:E.viewport.initialDpr||S}}}),setFrameloop:(v="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,v!=="never"&&(E.start(),E.elapsedTime=0),a(()=>({frameloop:v}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:D.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(v,E,S)=>{const w=l().internal;return w.priority=w.priority+(E>0?1:0),w.subscribers.push({ref:v,priority:E,store:S}),w.subscribers=w.subscribers.sort((C,b)=>C.priority-b.priority),()=>{const C=l().internal;C!=null&&C.subscribers&&(C.priority=C.priority-(E>0?1:0),C.subscribers=C.subscribers.filter(b=>b.ref!==v))}}}}}),r=t.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:u,set:h}=t.getState();if(l!==i||c.dpr!==s){var p;i=l,s=c.dpr,v3(a,l),u.setPixelRatio(c.dpr);const m=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,m)}a!==o&&(o=a,h(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let Mv,A$=new Set,w$=new Set,M$=new Set;function yx(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function cd(n,e){switch(n){case"before":return yx(A$,e);case"after":return yx(w$,e);case"tail":return yx(M$,e)}}let _x,xx;function Sx(n,e,t){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(r=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),_x=e.internal.subscribers,Mv=0;Mv<_x.length;Mv++)xx=_x[Mv],xx.ref.current(xx.store.getState(),r,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 T$(n){let e=!1,t,r,i;function s(l){r=requestAnimationFrame(s),e=!0,t=0,cd("before",l);for(const u of n.values()){var c;i=u.store.getState(),i.internal.active&&(i.frameloop==="always"||i.internal.frames>0)&&!((c=i.gl.xr)!=null&&c.isPresenting)&&(t+=Sx(l,i))}if(cd("after",l),t===0)return cd("tail",l),e=!1,cancelAnimationFrame(r)}function o(l,c=1){var u;if(!l)return n.forEach(h=>o(h.store.getState()),c);(u=l.gl.xr)!=null&&u.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+c),e||(e=!0,requestAnimationFrame(s)))}function a(l,c=!0,u,h){if(c&&cd("before",l),u)Sx(l,u,h);else for(const p of n.values())Sx(l,p.store.getState());c&&cd("after",l)}return{loop:s,invalidate:o,advance:a}}function _M(){const n=D.useContext(yM);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function yi(n=t=>t,e){return _M()(n,e)}function Tp(n,e=0){const t=_M(),r=t.getState().internal.subscribe,i=h3(n);return cm(()=>r(i,e,t),[e,r,t]),null}function x3(n,e){return function(t,...r){const i=new t;return n&&n(i),Promise.all(r.map(s=>new Promise((o,a)=>i.load(s,l=>{l.scene&&Object.assign(l,g$(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l.message})`))))))}}function qi(n,e,t,r){const i=Array.isArray(e)?e:[e],s=c$(x3(t,r),[n,...i],{equal:xn.equ});return Array.isArray(e)?s:s[0]}qi.preload=function(n,e,t){const r=Array.isArray(e)?e:[e];return u$(x3(t),[n,...r])};qi.clear=function(n,e){const t=Array.isArray(e)?e:[e];return f$([n,...t])};const kf=new Map,{invalidate:UP,advance:zP}=T$(kf),{reconciler:bp,applyProps:Uu}=h$(kf,y$),zu={objects:"shallow",strict:!1},b$=(n,e)=>{const t=typeof n=="function"?n(e):n;return _3(t)?t:new Vw({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function C$(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:r,top:i,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:r,top:i,left:s}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function R$(n){const e=kf.get(n),t=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||E$(UP,zP),o=t||bp.createContainer(s,Qa.ConcurrentRoot,null,!1,null,"",i,null);e||kf.set(n,{fiber:o,store:s});let a,l=!1,c;return{configure(u={}){let{gl:h,size:p,scene:m,events:g,onCreated:_,shadows:x=!1,linear:v=!1,flat:E=!1,legacy:S=!1,orthographic:w=!1,frameloop:C="always",dpr:b=[1,2],performance:B,raycaster:I,camera:R,onPointerMissed:L}=u,k=s.getState(),X=k.gl;k.gl||k.set({gl:X=b$(h,n)});let $=k.raycaster;$||k.set({raycaster:$=new mM});const{params:Y,...Z}=I||{};if(xn.equ(Z,$,zu)||Uu($,{...Z}),xn.equ(Y,$.params,zu)||Uu($,{params:{...$.params,...Y}}),!k.camera||k.camera===c&&!xn.equ(c,R,zu)){c=R;const ue=R instanceof Jp,K=ue?R:w?new To(0,0,0,0,.1,1e3):new Fn(75,0,.1,1e3);ue||(K.position.z=5,R&&Uu(K,R),!k.camera&&!(R!=null&&R.rotation)&&K.lookAt(0,0,0)),k.set({camera:K})}if(!k.scene){let ue;m instanceof yp?ue=m:(ue=new yp,m&&Uu(ue,m)),k.set({scene:$u(ue)})}if(!k.xr){const ue=(pe,Le)=>{const we=s.getState();we.frameloop!=="never"&&zP(pe,!0,we,Le)},K=()=>{const pe=s.getState();pe.gl.xr.enabled=pe.gl.xr.isPresenting,pe.gl.xr.setAnimationLoop(pe.gl.xr.isPresenting?ue:null),pe.gl.xr.isPresenting||UP(pe)},ve={connect(){const pe=s.getState().gl;pe.xr.addEventListener("sessionstart",K),pe.xr.addEventListener("sessionend",K)},disconnect(){const pe=s.getState().gl;pe.xr.removeEventListener("sessionstart",K),pe.xr.removeEventListener("sessionend",K)}};X.xr&&ve.connect(),k.set({xr:ve})}if(X.shadowMap){const ue=X.shadowMap.enabled,K=X.shadowMap.type;if(X.shadowMap.enabled=!!x,xn.boo(x))X.shadowMap.type=Fd;else if(xn.str(x)){var ne;const ve={basic:dD,percentage:Ey,soft:Fd,variance:Fs};X.shadowMap.type=(ne=ve[x])!=null?ne:Fd}else xn.obj(x)&&Object.assign(X.shadowMap,x);(ue!==X.shadowMap.enabled||K!==X.shadowMap.type)&&(X.shadowMap.needsUpdate=!0)}const ie=u3();ie&&("enabled"in ie?ie.enabled=!S:"legacyMode"in ie&&(ie.legacyMode=S)),Uu(X,{outputEncoding:v?3e3:3001,toneMapping:E?Ws:Aw}),k.legacy!==S&&k.set(()=>({legacy:S})),k.linear!==v&&k.set(()=>({linear:v})),k.flat!==E&&k.set(()=>({flat:E})),h&&!xn.fun(h)&&!_3(h)&&!xn.equ(h,X,zu)&&Uu(X,h),g&&!k.events.handlers&&k.set({events:g(s)});const q=C$(n,p);return xn.equ(q,k.size,zu)||k.setSize(q.width,q.height,q.updateStyle,q.top,q.left),b&&k.viewport.dpr!==m3(b)&&k.setDpr(b),k.frameloop!==C&&k.setFrameloop(C),k.onPointerMissed||k.set({onPointerMissed:L}),B&&!xn.equ(B,k.performance,zu)&&k.set(ue=>({performance:{...ue.performance,...B}})),a=_,l=!0,this},render(u){return l||this.configure(),bp.updateContainer(D.createElement(P$,{store:s,children:u,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){S3(n)}}}function P$({store:n,children:e,onCreated:t,rootElement:r}){return cm(()=>{const i=n.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),n.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),D.createElement(yM.Provider,{value:n},e)}function S3(n,e){const t=kf.get(n),r=t==null?void 0:t.fiber;if(r){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),bp.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),v$(i),kf.delete(n),e&&e(n)}catch{}},500)})}}function I$(n,e,t){return D.createElement(B$,{key:e.uuid,children:n,container:e,state:t})}function B$({state:n={},children:e,container:t}){const{events:r,size:i,...s}=n,o=_M(),[a]=D.useState(()=>new mM),[l]=D.useState(()=>new Me),c=D.useCallback((h,p)=>{const m={...h};Object.keys(h).forEach(_=>{(S$.includes(_)||h[_]!==p[_]&&p[_])&&delete m[_]});let g;if(p&&i){const _=p.camera;g=h.viewport.getCurrentViewport(_,new z,i),_!==h.camera&&v3(_,i)}return{...m,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...h.events,...p==null?void 0:p.events,...r},size:{...h.size,...i},viewport:{...h.viewport,...g},...s}},[n]),[u]=D.useState(()=>{const h=o.getState();return gM((m,g)=>({...h,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...h.events,...r},size:{...h.size,...i},...s,set:m,get:g,setEvents:_=>m(x=>({...x,events:{...x.events,..._}}))}))});return D.useEffect(()=>{const h=o.subscribe(p=>u.setState(m=>c(p,m)));return()=>{h(),u.destroy()}},[]),D.useEffect(()=>{u.setState(h=>c(o.getState(),h))},[c]),D.createElement(D.Fragment,null,bp.createPortal(D.createElement(yM.Provider,{value:u},e),u,null))}bp.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:D.version});function Hn(){return Hn=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?r=setTimeout(l,e-u):(r=null,t||(a=n.apply(s,i),s=i=null))}var c=function(){s=this,i=arguments,o=Date.now();var u=t&&!r;return r||(r=setTimeout(l,e)),u&&(a=n.apply(s,i),s=i=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=n.apply(s,i),s=i=null,clearTimeout(r),r=null)},c}OE.debounce=OE;var HP=OE;function L$(n){let{debounce:e,scroll:t,polyfill:r,offsetSize:i}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=r||(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]=D.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=D.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,h=D.useRef(!1);D.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[p,m,g]=D.useMemo(()=>{const E=()=>{if(!l.current.element)return;const{left:S,top:w,width:C,height:b,bottom:B,right:I,x:R,y:L}=l.current.element.getBoundingClientRect(),k={left:S,top:w,width:C,height:b,bottom:B,right:I,x:R,y:L};l.current.element instanceof HTMLElement&&i&&(k.height=l.current.element.offsetHeight,k.width=l.current.element.offsetWidth),Object.freeze(k),h.current&&!N$(l.current.lastBounds,k)&&a(l.current.lastBounds=k)};return[E,u?HP(E,u):E,c?HP(E,c):E]},[a,i,c,u]);function _(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(E=>E.removeEventListener("scroll",g,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function x(){l.current.element&&(l.current.resizeObserver=new s(g),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(E=>E.addEventListener("scroll",g,{capture:!0,passive:!0})))}const v=E=>{!E||E===l.current.element||(_(),l.current.element=E,l.current.scrollContainers=E3(E),x())};return O$(g,Boolean(t)),D$(m),D.useEffect(()=>{_(),x()},[t,g,m]),D.useEffect(()=>_,[]),[v,o,p]}function D$(n){D.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function O$(n,e){D.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function E3(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:r,overflowY:i}=window.getComputedStyle(n);return[t,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...E3(n.parentElement)]}const F$=["x","y","top","bottom","left","right","width","height"],N$=(n,e)=>F$.every(t=>n[t]===e[t]);var k$=Object.defineProperty,U$=Object.defineProperties,z$=Object.getOwnPropertyDescriptors,GP=Object.getOwnPropertySymbols,H$=Object.prototype.hasOwnProperty,G$=Object.prototype.propertyIsEnumerable,VP=(n,e,t)=>e in n?k$(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,WP=(n,e)=>{for(var t in e||(e={}))H$.call(e,t)&&VP(n,t,e[t]);if(GP)for(var t of GP(e))G$.call(e,t)&&VP(n,t,e[t]);return n},V$=(n,e)=>U$(n,z$(e));function A3(n,e,t){if(!n)return;if(t(n)===!0)return n;let r=e?n.return:n.child;for(;r;){const i=A3(r,e,t);if(i)return i;r=e?null:r.sibling}}function w3(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const xM=w3(D.createContext(null));class M3 extends D.Component{render(){return D.createElement(xM.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:$P,ReactCurrentDispatcher:jP}=D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function W$(){const n=D.useContext(xM);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=D.useId();return D.useMemo(()=>{for(const r of[$P==null?void 0:$P.current,n,n==null?void 0:n.alternate]){if(!r)continue;const i=A3(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[n,e])}function $$(){var n,e;const t=W$(),[r]=D.useState(()=>new Map);r.clear();let i=t;for(;i;){const s=(n=i.type)==null?void 0:n._context;s&&s!==xM&&!r.has(s)&&r.set(s,(e=jP==null?void 0:jP.current)==null?void 0:e.readContext(w3(s))),i=i.return}return r}function j$(){const n=$$();return D.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>r=>D.createElement(e,null,D.createElement(t.Provider,V$(WP({},r),{value:n.get(t)}))),e=>D.createElement(M3,WP({},e))),[n])}const Ex={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 X$(n){const{handlePointer:e}=x$(n);return{priority:1,enabled:!0,compute(t,r,i){r.pointer.set(t.offsetX/r.size.width*2-1,-(t.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(Ex).reduce((t,r)=>({...t,[r]:e(r)}),{}),update:()=>{var t;const{events:r,internal:i}=n.getState();(t=i.lastEvent)!=null&&t.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var r;const{set:i,events:s}=n.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=Ex[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:r}=n.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=Ex[s];r.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const J$=D.forwardRef(function({children:e,fallback:t,resize:r,style:i,gl:s,events:o=X$,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:p,orthographic:m,frameloop:g,dpr:_,performance:x,raycaster:v,camera:E,onPointerMissed:S,onCreated:w,...C},b){D.useMemo(()=>c3(e$),[]);const B=j$(),[I,R]=L$({scroll:!0,debounce:{scroll:50,resize:0},...r}),L=D.useRef(null),k=D.useRef(null);D.useImperativeHandle(b,()=>L.current);const X=h3(S),[$,Y]=D.useState(!1),[Z,ne]=D.useState(!1);if($)throw $;if(Z)throw Z;const ie=D.useRef(null);cm(()=>{const te=L.current;R.width>0&&R.height>0&&te&&(ie.current||(ie.current=R$(te)),ie.current.configure({gl:s,events:o,shadows:c,linear:u,flat:h,legacy:p,orthographic:m,frameloop:g,dpr:_,performance:x,raycaster:v,camera:E,size:R,onPointerMissed:(...q)=>X.current==null?void 0:X.current(...q),onCreated:q=>{q.events.connect==null||q.events.connect(a?d$(a)?a.current:a:k.current),l&&q.setEvents({compute:(ue,K)=>{const ve=ue[l+"X"],pe=ue[l+"Y"];K.pointer.set(ve/K.size.width*2-1,-(pe/K.size.height)*2+1),K.raycaster.setFromCamera(K.pointer,K.camera)}}),w==null||w(q)}}),ie.current.render(D.createElement(B,null,D.createElement(d3,{set:ne},D.createElement(D.Suspense,{fallback:D.createElement(p$,{set:Y})},e)))))}),D.useEffect(()=>{const te=L.current;if(te)return()=>S3(te)},[]);const G=a?"none":"auto";return D.createElement("div",Hn({ref:k,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:G,...i}},C),D.createElement("div",{ref:I,style:{width:"100%",height:"100%"}},D.createElement("canvas",{ref:L,style:{display:"block"}},t)))}),K$=D.forwardRef(function(e,t){return D.createElement(M3,null,D.createElement(J$,Hn({},e,{ref:t})))});function Y$(n,e,t){return Math.max(e,Math.min(n,t))}const Gr={toVector(n,e){return n===void 0&&(n=e),Array.isArray(n)?n:[n,n]},add(n,e){return[n[0]+e[0],n[1]+e[1]]},sub(n,e){return[n[0]-e[0],n[1]-e[1]]},addTo(n,e){n[0]+=e[0],n[1]+=e[1]},subTo(n,e){n[0]-=e[0],n[1]-=e[1]}};function XP(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function JP(n,e,t,r=.15){return r===0?Y$(n,e,t):nt?+XP(n-t,t-e,r)+t:n}function q$(n,[e,t],[r,i]){const[[s,o],[a,l]]=n;return[JP(e,s,o,r),JP(t,a,l,i)]}function Z$(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Q$(n){var e=Z$(n,"string");return typeof e=="symbol"?e:String(e)}function vi(n,e,t){return e=Q$(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function KP(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kn(n){for(var e=1;e{var t,r;return e.target===n.currentTarget||((t=n.currentTarget)===null||t===void 0||(r=t.contains)===null||r===void 0?void 0:r.call(t,e.target))})}function a7(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function C3(n){return Gy(n)?a7(n)[0]:n}function l7(n){return o7(n).map(e=>e.identifier)}function Ax(n){const e=C3(n);return Gy(n)?e.identifier:e.pointerId}function qP(n){const e=C3(n);return[e.clientX,e.clientY]}function c7(n){const e={};if("buttons"in n&&(e.buttons=n.buttons),"shiftKey"in n){const{shiftKey:t,altKey:r,metaKey:i,ctrlKey:s}=n;Object.assign(e,{shiftKey:t,altKey:r,metaKey:i,ctrlKey:s})}return e}function U0(n,...e){return typeof n=="function"?n(...e):n}function u7(){}function f7(...n){return n.length===0?u7:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function ZP(n,e){return Object.assign({},e,n||{})}const h7=32;class d7{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:i}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?U0(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,c7(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const b=t._delta.map(Math.abs);Gr.addTo(t._distance,b)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[l,c]=r.threshold,{_step:u,values:h}=t;if(r.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=l&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=c&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=l&&Math.sign(o)*l),u[1]===!1&&(u[1]=Math.abs(a)>=c&&Math.sign(a)*c)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const p=[0,0];if(r.hasCustomTransform){const[b,B]=h;p[0]=u[0]!==!1?b-u[0]:0,p[1]=u[1]!==!1?B-u[1]:0}else p[0]=u[0]!==!1?o-u[0]:0,p[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(p);const m=t.offset,g=t._active&&!t._blocked||t.active;g&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=U0(r.bounds,t)),this.setup&&this.setup()),t.movement=p,this.computeOffset()));const[_,x]=t.offset,[[v,E],[S,w]]=t._bounds;t.overflow=[_E?1:0,xw?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const C=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=q$(t._bounds,t.offset,C),t.delta=Gr.sub(t.offset,m),this.computeMovement(),g&&(!t.last||s>h7)){t.delta=Gr.sub(t.offset,m);const b=t.delta.map(Math.abs);Gr.addTo(t.distance,b),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[b[0]/s,b[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const i=this.handler(kn(kn(kn({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function p7([n,e],t){const r=Math.abs(n),i=Math.abs(e);if(r>i&&r>t)return"x";if(i>r&&i>t)return"y"}class m7 extends d7{constructor(...e){super(...e),vi(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Gr.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Gr.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const i=typeof r.axisThreshold=="object"?r.axisThreshold[b3(e)]:r.axisThreshold;t.axis=p7(t._movement,i)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const g7=n=>n,QP=.15,R3={enabled(n=!0){return n},eventOptions(n,e,t){return kn(kn({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[QP,QP];case!1:return[0,0];default:return Gr.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return Gr.toVector(n)},transform(n,e,t){const r=n||t.shared.transform;return this.hasCustomTransform=!!r,r||g7},threshold(n){return Gr.toVector(n,0)}},v7=0,um=kn(kn({},R3),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=v7){return n},bounds(n={}){if(typeof n=="function")return s=>um.bounds(n(s));if("current"in n)return()=>n.current;if(typeof HTMLElement=="function"&&n instanceof HTMLElement)return n;const{left:e=-1/0,right:t=1/0,top:r=-1/0,bottom:i=1/0}=n;return[[e,t],[r,i]]}}),eI={ArrowRight:(n,e=1)=>[n*e,0],ArrowLeft:(n,e=1)=>[-1*n*e,0],ArrowUp:(n,e=1)=>[0,-1*n*e],ArrowDown:(n,e=1)=>[0,n*e]};class y7 extends m7{constructor(...e){super(...e),vi(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),i={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=um.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=Ax(e),r._pointerActive=!0,this.computeValues(qP(e)),this.computeInitial(),t.preventScrollAxis&&b3(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const i=Ax(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=qP(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Gr.sub(s,t._values),this.computeValues(s)),Gr.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const i=Ax(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=r.tapsThreshold&&o<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[a,l]=t._delta,[c,u]=t._movement,[h,p]=r.swipe.velocity,[m,g]=r.swipe.distance,_=r.swipe.duration;if(t.elapsedTime<_){const x=Math.abs(a/t.timeDelta),v=Math.abs(l/t.timeDelta);x>h&&Math.abs(c)>m&&(t.swipe[0]=Math.sign(a)),v>p&&Math.abs(u)>g&&(t.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,_7(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=eI[e.key];if(t){const r=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,i),r._keyboardActive=!0,Gr.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in eI&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function _7(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const fm=typeof window<"u"&&window.document&&window.document.createElement;function x7(){return fm&&"ontouchstart"in window}function tI(){return x7()||fm&&window.navigator.maxTouchPoints>1}function S7(){return fm&&"onpointerdown"in window}function E7(){return fm&&"exitPointerLock"in window.document}function A7(){try{return"constructor"in GestureEvent}catch{return!1}}const ds={isBrowser:fm,gesture:A7(),touch:tI(),touchscreen:tI(),pointer:S7(),pointerLock:E7()},w7=250,M7=180,T7=.5,b7=50,C7=250,R7=10,nI={mouse:0,touch:0,pen:8},P7=kn(kn({},um),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&ds.pointerLock,ds.touch&&t?"touch":this.pointerLock?"mouse":ds.pointer&&!i?"pointer":ds.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?w7:void 0,!(!ds.touchscreen||t===!1))return n||(t!==void 0?"y":void 0)},pointerCapture(n,e,{pointer:{capture:t=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(n,e,{filterTaps:t=!1,tapsThreshold:r=3,axis:i=void 0}){const s=Gr.toVector(n,t?r:i?1:0);return this.filterTaps=t,this.tapsThreshold=r,s},swipe({velocity:n=T7,distance:e=b7,duration:t=C7}={}){return{velocity:this.transform(Gr.toVector(n)),distance:this.transform(Gr.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return M7;case!1:return 0;default:return n}},axisThreshold(n){return n?kn(kn({},nI),n):nI},keyboardDisplacement(n=R7){return n}});kn(kn({},R3),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!ds.touch&&ds.gesture)return"gesture";if(ds.touch&&r)return"touch";if(ds.touchscreen){if(ds.pointer)return"pointer";if(ds.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const i=o=>{const a=ZP(U0(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=ZP(U0(r,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof r!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(n,e,t){return this.lockDirection=t.axis==="lock",Gr.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});kn(kn({},um),{},{mouseOnly:(n=!0)=>n});kn(kn({},um),{},{mouseOnly:(n=!0)=>n});const P3=new Map,FE=new Map;function I7(n){P3.set(n.key,n.engine),FE.set(n.key,n.resolver)}const B7={key:"drag",engine:y7,resolver:P7};function L7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s=0)&&(t[i]=n[i]);return t}function D7(n,e){if(n==null)return{};var t=L7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}const O7={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=ds.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},F7=["target","eventOptions","window","enabled","transform"];function a0(n={},e){const t={};for(const[r,i]of Object.entries(e))switch(typeof i){case"function":t[r]=i.call(t,n[r],r,n);break;case"object":t[r]=a0(n[r],i);break;case"boolean":i&&(t[r]=n[r]);break}return t}function N7(n,e,t={}){const r=n,{target:i,eventOptions:s,window:o,enabled:a,transform:l}=r,c=D7(r,F7);if(t.shared=a0({target:i,eventOptions:s,window:o,enabled:a,transform:l},O7),e){const u=FE.get(e);t[e]=a0(kn({shared:t.shared},c),u)}else for(const u in c){const h=FE.get(u);h&&(t[u]=a0(kn({shared:t.shared},c[u]),h))}return t}class I3{constructor(e,t){vi(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,i,s){const o=this._listeners,a=s7(t,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},c=kn(kn({},l),s);e.addEventListener(a,i,c);const u=()=>{e.removeEventListener(a,i,c),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class k7{constructor(){vi(this,"_timeouts",new Map)}add(e,t,r=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class U7{constructor(e){vi(this,"gestures",new Set),vi(this,"_targetEventStore",new I3(this)),vi(this,"gestureEventStores",{}),vi(this,"gestureTimeoutStores",{}),vi(this,"handlers",{}),vi(this,"config",{}),vi(this,"pointerIds",new Set),vi(this,"touchIds",new Set),vi(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),z7(this,e)}setEventIds(e){if(Gy(e))return this.touchIds=new Set(l7(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=N7(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],l=rI(r,a.eventOptions,!!i);if(a.enabled){const c=P3.get(o);new c(this,e,o).bind(l)}}const s=rI(r,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](kn(kn({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in r)r[s]=f7(...r[s]);if(!i)return r;for(const s in r){const{device:o,capture:a,passive:l}=i7(s);this._targetEventStore.add(i,o,"",r[s],{capture:a,passive:l})}}}}function Hu(n,e){n.gestures.add(e),n.gestureEventStores[e]=new I3(n,e),n.gestureTimeoutStores[e]=new k7}function z7(n,e){e.drag&&Hu(n,"drag"),e.wheel&&Hu(n,"wheel"),e.scroll&&Hu(n,"scroll"),e.move&&Hu(n,"move"),e.pinch&&Hu(n,"pinch"),e.hover&&Hu(n,"hover")}const rI=(n,e,t)=>(r,i,s,o={},a=!1)=>{var l,c;const u=(l=o.capture)!==null&&l!==void 0?l:e.capture,h=(c=o.passive)!==null&&c!==void 0?c:e.passive;let p=a?r:n7(r,i,u);t&&h&&(p+="Passive"),n[p]=n[p]||[],n[p].push(s)};function H7(n,e={},t,r){const i=Q.useMemo(()=>new U7(n),[]);if(i.applyHandlers(n,r),i.applyConfig(e,t),Q.useEffect(i.effect.bind(i)),Q.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function G7(n,e){return I7(B7),H7({drag:n},e||{},"drag")}const V7=n=>(e,t,r)=>{const i=r.subscribe;return r.subscribe=(o,a,l)=>{let c=o;if(a){const u=(l==null?void 0:l.equalityFn)||Object.is;let h=o(r.getState());c=p=>{const m=o(p);if(!u(h,m)){const g=h;a(h=m,g)}},l!=null&&l.fireImmediately&&a(h,h)}return i(c)},n(e,t,r)};function iI(n,e){if(e===YD)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===F0||e===Bw){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l>>1|(En&21845)<<1;Ha=(Ha&52428)>>>2|(Ha&13107)<<2,Ha=(Ha&61680)>>>4|(Ha&3855)<<4,kE[En]=((Ha&65280)>>>8|(Ha&255)<<8)>>>1}var Gd=function(n,e,t){for(var r=n.length,i=0,s=new el(e);i>>l]=c}else for(a=new el(r),i=0;i>>15-n[i]);return a},hm=new ms(288);for(var En=0;En<144;++En)hm[En]=8;for(var En=144;En<256;++En)hm[En]=9;for(var En=256;En<280;++En)hm[En]=7;for(var En=280;En<288;++En)hm[En]=8;var N3=new ms(32);for(var En=0;En<32;++En)N3[En]=5;var J7=Gd(hm,9,1),K7=Gd(N3,5,1),wx=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Ds=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},Mx=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Y7=function(n){return(n/8|0)+(n&7&&1)},q7=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof el?el:n instanceof NE?NE:ms)(t-e);return r.set(n.subarray(e,t)),r},Z7=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new ms(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new ms(r*3));var o=function(we){var Fe=e.length;if(we>Fe){var et=new ms(Math.max(Fe*2,we));et.set(e),e=et}},a=t.f||0,l=t.p||0,c=t.b||0,u=t.l,h=t.d,p=t.m,m=t.n,g=r*8;do{if(!u){t.f=a=Ds(n,l,1);var _=Ds(n,l+1,3);if(l+=3,_)if(_==1)u=J7,h=K7,p=9,m=5;else if(_==2){var S=Ds(n,l,31)+257,w=Ds(n,l+10,15)+4,C=S+Ds(n,l+5,31)+1;l+=14;for(var b=new ms(C),B=new ms(19),I=0;I>>4;if(x<16)b[I++]=x;else{var $=0,Y=0;for(x==16?(Y=3+Ds(n,l,3),l+=2,$=b[I-1]):x==17?(Y=3+Ds(n,l,7),l+=3):x==18&&(Y=11+Ds(n,l,127),l+=7);Y--;)b[I++]=$}}var Z=b.subarray(0,S),ne=b.subarray(S);p=wx(Z),m=wx(ne),u=Gd(Z,p,1),h=Gd(ne,m,1)}else throw"invalid block type";else{var x=Y7(l)+4,v=n[x-4]|n[x-3]<<8,E=x+v;if(E>r){if(s)throw"unexpected EOF";break}i&&o(c+v),e.set(n.subarray(x,E),c),t.b=c+=v,t.p=l=E*8;continue}if(l>g){if(s)throw"unexpected EOF";break}}i&&o(c+131072);for(var ie=(1<>>4;if(l+=$&15,l>g){if(s)throw"unexpected EOF";break}if(!$)throw"invalid length/literal";if(q<256)e[c++]=q;else if(q==256){te=l,u=null;break}else{var ue=q-254;if(q>264){var I=q-257,K=B3[I];ue=Ds(n,l,(1<>>4;if(!ve)throw"invalid distance";l+=ve&15;var ne=X7[pe];if(pe>3){var K=L3[pe];ne+=Mx(n,l)&(1<g){if(s)throw"unexpected EOF";break}i&&o(c+131072);for(var Le=c+ue;c>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Ed(n,e){return Z7((ej(n),n.subarray(2,-4)),e)}var tj=typeof TextDecoder<"u"&&new TextDecoder,nj=0;try{tj.decode(Q7,{stream:!0}),nj=1}catch{}const rj=n=>n&&n.isCubeTexture;class ij extends sr{constructor(e,t){var r,i;const s=rj(e),a=((i=s?(r=e.image[0])==null?void 0:r.width:e.image.width)!=null?i:1024)/4,l=Math.floor(Math.log2(a)),c=Math.pow(2,l),u=3*Math.max(c,16*7),h=4*c,p=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/u}`,`#define CUBEUV_TEXEL_HEIGHT ${1/h}`,`#define CUBEUV_MAX_MIP ${l}.0`],m=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,g=p.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include + } + `,_={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},x=new oh(1,16),v=new Ys({uniforms:_,fragmentShader:g,vertexShader:m,side:ps});super(x,v)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}var sj=Object.defineProperty,oj=(n,e,t)=>e in n?sj(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Rt=(n,e,t)=>(oj(n,typeof e!="symbol"?e+"":e,t),t);const sI=(n,e)=>(n%e+e)%e;let aj=class extends Do{constructor(e,t){super(),Rt(this,"object"),Rt(this,"domElement"),Rt(this,"enabled",!0),Rt(this,"target",new z),Rt(this,"minDistance",0),Rt(this,"maxDistance",1/0),Rt(this,"minZoom",0),Rt(this,"maxZoom",1/0),Rt(this,"minPolarAngle",0),Rt(this,"maxPolarAngle",Math.PI),Rt(this,"minAzimuthAngle",-1/0),Rt(this,"maxAzimuthAngle",1/0),Rt(this,"enableDamping",!1),Rt(this,"dampingFactor",.05),Rt(this,"enableZoom",!0),Rt(this,"zoomSpeed",1),Rt(this,"enableRotate",!0),Rt(this,"rotateSpeed",1),Rt(this,"enablePan",!0),Rt(this,"panSpeed",1),Rt(this,"screenSpacePanning",!0),Rt(this,"keyPanSpeed",7),Rt(this,"autoRotate",!1),Rt(this,"autoRotateSpeed",2),Rt(this,"reverseOrbit",!1),Rt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Rt(this,"mouseButtons",{LEFT:ec.ROTATE,MIDDLE:ec.DOLLY,RIGHT:ec.PAN}),Rt(this,"touches",{ONE:tc.ROTATE,TWO:tc.DOLLY_PAN}),Rt(this,"target0"),Rt(this,"position0"),Rt(this,"zoom0"),Rt(this,"_domElementKeyEvents",null),Rt(this,"getPolarAngle"),Rt(this,"getAzimuthalAngle"),Rt(this,"setPolarAngle"),Rt(this,"setAzimuthalAngle"),Rt(this,"getDistance"),Rt(this,"listenToKeyEvents"),Rt(this,"saveState"),Rt(this,"reset"),Rt(this,"update"),Rt(this,"connect"),Rt(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>u.phi,this.getAzimuthalAngle=()=>u.theta,this.setPolarAngle=ee=>{let me=sI(ee,2*Math.PI),Ce=u.phi;Ce<0&&(Ce+=2*Math.PI),me<0&&(me+=2*Math.PI);let Be=Math.abs(me-Ce);2*Math.PI-Be{let me=sI(ee,2*Math.PI),Ce=u.theta;Ce<0&&(Ce+=2*Math.PI),me<0&&(me+=2*Math.PI);let Be=Math.abs(me-Ce);2*Math.PI-Ber.object.position.distanceTo(r.target),this.listenToKeyEvents=ee=>{ee.addEventListener("keydown",N),this._domElementKeyEvents=ee},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const ee=new z,me=new Xn().setFromUnitVectors(e.up,new z(0,1,0)),Ce=me.clone().invert(),Be=new z,Ne=new Xn,rt=2*Math.PI;return function(){const re=r.object.position;ee.copy(re).sub(r.target),ee.applyQuaternion(me),u.setFromVector3(ee),r.autoRotate&&l===a.NONE&&X(L()),r.enableDamping?(u.theta+=h.theta*r.dampingFactor,u.phi+=h.phi*r.dampingFactor):(u.theta+=h.theta,u.phi+=h.phi);let ce=r.minAzimuthAngle,ae=r.maxAzimuthAngle;return isFinite(ce)&&isFinite(ae)&&(ce<-Math.PI?ce+=rt:ce>Math.PI&&(ce-=rt),ae<-Math.PI?ae+=rt:ae>Math.PI&&(ae-=rt),ce<=ae?u.theta=Math.max(ce,Math.min(ae,u.theta)):u.theta=u.theta>(ce+ae)/2?Math.max(ce,u.theta):Math.min(ae,u.theta)),u.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=p,u.radius=Math.max(r.minDistance,Math.min(r.maxDistance,u.radius)),r.enableDamping===!0?r.target.addScaledVector(m,r.dampingFactor):r.target.add(m),ee.setFromSpherical(u),ee.applyQuaternion(Ce),re.copy(r.target).add(ee),r.object.lookAt(r.target),r.enableDamping===!0?(h.theta*=1-r.dampingFactor,h.phi*=1-r.dampingFactor,m.multiplyScalar(1-r.dampingFactor)):(h.set(0,0,0),m.set(0,0,0)),p=1,g||Be.distanceToSquared(r.object.position)>c||8*(1-Ne.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Be.copy(r.object.position),Ne.copy(r.object.quaternion),g=!1,!0):!1}})(),this.connect=ee=>{ee===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),r.domElement=ee,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",Ie),r.domElement.addEventListener("pointerdown",nt),r.domElement.addEventListener("pointercancel",ct),r.domElement.addEventListener("wheel",U)},this.dispose=()=>{var ee,me,Ce,Be,Ne,rt;(ee=r.domElement)==null||ee.removeEventListener("contextmenu",Ie),(me=r.domElement)==null||me.removeEventListener("pointerdown",nt),(Ce=r.domElement)==null||Ce.removeEventListener("pointercancel",ct),(Be=r.domElement)==null||Be.removeEventListener("wheel",U),(Ne=r.domElement)==null||Ne.ownerDocument.removeEventListener("pointermove",$e),(rt=r.domElement)==null||rt.ownerDocument.removeEventListener("pointerup",Xe),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",N)};const r=this,i={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 l=a.NONE;const c=1e-6,u=new IE,h=new IE;let p=1;const m=new z;let g=!1;const _=new Me,x=new Me,v=new Me,E=new Me,S=new Me,w=new Me,C=new Me,b=new Me,B=new Me,I=[],R={};function L(){return 2*Math.PI/60/60*r.autoRotateSpeed}function k(){return Math.pow(.95,r.zoomSpeed)}function X(ee){r.reverseOrbit?h.theta+=ee:h.theta-=ee}function $(ee){r.reverseOrbit?h.phi+=ee:h.phi-=ee}const Y=(()=>{const ee=new z;return function(Ce,Be){ee.setFromMatrixColumn(Be,0),ee.multiplyScalar(-Ce),m.add(ee)}})(),Z=(()=>{const ee=new z;return function(Ce,Be){r.screenSpacePanning===!0?ee.setFromMatrixColumn(Be,1):(ee.setFromMatrixColumn(Be,0),ee.crossVectors(r.object.up,ee)),ee.multiplyScalar(Ce),m.add(ee)}})(),ne=(()=>{const ee=new z;return function(Ce,Be){const Ne=r.domElement;if(Ne&&r.object instanceof Fn&&r.object.isPerspectiveCamera){const rt=r.object.position;ee.copy(rt).sub(r.target);let gt=ee.length();gt*=Math.tan(r.object.fov/2*Math.PI/180),Y(2*Ce*gt/Ne.clientHeight,r.object.matrix),Z(2*Be*gt/Ne.clientHeight,r.object.matrix)}else Ne&&r.object instanceof To&&r.object.isOrthographicCamera?(Y(Ce*(r.object.right-r.object.left)/r.object.zoom/Ne.clientWidth,r.object.matrix),Z(Be*(r.object.top-r.object.bottom)/r.object.zoom/Ne.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function ie(ee){r.object instanceof Fn&&r.object.isPerspectiveCamera?p/=ee:r.object instanceof To&&r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*ee)),r.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function G(ee){r.object instanceof Fn&&r.object.isPerspectiveCamera?p*=ee:r.object instanceof To&&r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/ee)),r.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function te(ee){_.set(ee.clientX,ee.clientY)}function q(ee){C.set(ee.clientX,ee.clientY)}function ue(ee){E.set(ee.clientX,ee.clientY)}function K(ee){x.set(ee.clientX,ee.clientY),v.subVectors(x,_).multiplyScalar(r.rotateSpeed);const me=r.domElement;me&&(X(2*Math.PI*v.x/me.clientHeight),$(2*Math.PI*v.y/me.clientHeight)),_.copy(x),r.update()}function ve(ee){b.set(ee.clientX,ee.clientY),B.subVectors(b,C),B.y>0?ie(k()):B.y<0&&G(k()),C.copy(b),r.update()}function pe(ee){S.set(ee.clientX,ee.clientY),w.subVectors(S,E).multiplyScalar(r.panSpeed),ne(w.x,w.y),E.copy(S),r.update()}function Le(ee){ee.deltaY<0?G(k()):ee.deltaY>0&&ie(k()),r.update()}function we(ee){let me=!1;switch(ee.code){case r.keys.UP:ne(0,r.keyPanSpeed),me=!0;break;case r.keys.BOTTOM:ne(0,-r.keyPanSpeed),me=!0;break;case r.keys.LEFT:ne(r.keyPanSpeed,0),me=!0;break;case r.keys.RIGHT:ne(-r.keyPanSpeed,0),me=!0;break}me&&(ee.preventDefault(),r.update())}function Fe(){if(I.length==1)_.set(I[0].pageX,I[0].pageY);else{const ee=.5*(I[0].pageX+I[1].pageX),me=.5*(I[0].pageY+I[1].pageY);_.set(ee,me)}}function et(){if(I.length==1)E.set(I[0].pageX,I[0].pageY);else{const ee=.5*(I[0].pageX+I[1].pageX),me=.5*(I[0].pageY+I[1].pageY);E.set(ee,me)}}function ft(){const ee=I[0].pageX-I[1].pageX,me=I[0].pageY-I[1].pageY,Ce=Math.sqrt(ee*ee+me*me);C.set(0,Ce)}function Pt(){r.enableZoom&&ft(),r.enablePan&&et()}function st(){r.enableZoom&&ft(),r.enableRotate&&Fe()}function J(ee){if(I.length==1)x.set(ee.pageX,ee.pageY);else{const Ce=ye(ee),Be=.5*(ee.pageX+Ce.x),Ne=.5*(ee.pageY+Ce.y);x.set(Be,Ne)}v.subVectors(x,_).multiplyScalar(r.rotateSpeed);const me=r.domElement;me&&(X(2*Math.PI*v.x/me.clientHeight),$(2*Math.PI*v.y/me.clientHeight)),_.copy(x)}function Re(ee){if(I.length==1)S.set(ee.pageX,ee.pageY);else{const me=ye(ee),Ce=.5*(ee.pageX+me.x),Be=.5*(ee.pageY+me.y);S.set(Ce,Be)}w.subVectors(S,E).multiplyScalar(r.panSpeed),ne(w.x,w.y),E.copy(S)}function Ae(ee){const me=ye(ee),Ce=ee.pageX-me.x,Be=ee.pageY-me.y,Ne=Math.sqrt(Ce*Ce+Be*Be);b.set(0,Ne),B.set(0,Math.pow(b.y/C.y,r.zoomSpeed)),ie(B.y),C.copy(b)}function De(ee){r.enableZoom&&Ae(ee),r.enablePan&&Re(ee)}function be(ee){r.enableZoom&&Ae(ee),r.enableRotate&&J(ee)}function nt(ee){var me,Ce;r.enabled!==!1&&(I.length===0&&((me=r.domElement)==null||me.ownerDocument.addEventListener("pointermove",$e),(Ce=r.domElement)==null||Ce.ownerDocument.addEventListener("pointerup",Xe)),Ue(ee),ee.pointerType==="touch"?he(ee):wt(ee))}function $e(ee){r.enabled!==!1&&(ee.pointerType==="touch"?Pe(ee):tn(ee))}function Xe(ee){var me,Ce,Be;Ye(ee),I.length===0&&((me=r.domElement)==null||me.releasePointerCapture(ee.pointerId),(Ce=r.domElement)==null||Ce.ownerDocument.removeEventListener("pointermove",$e),(Be=r.domElement)==null||Be.ownerDocument.removeEventListener("pointerup",Xe)),r.dispatchEvent(o),l=a.NONE}function ct(ee){Ye(ee)}function wt(ee){let me;switch(ee.button){case 0:me=r.mouseButtons.LEFT;break;case 1:me=r.mouseButtons.MIDDLE;break;case 2:me=r.mouseButtons.RIGHT;break;default:me=-1}switch(me){case ec.DOLLY:if(r.enableZoom===!1)return;q(ee),l=a.DOLLY;break;case ec.ROTATE:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(r.enablePan===!1)return;ue(ee),l=a.PAN}else{if(r.enableRotate===!1)return;te(ee),l=a.ROTATE}break;case ec.PAN:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(r.enableRotate===!1)return;te(ee),l=a.ROTATE}else{if(r.enablePan===!1)return;ue(ee),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function tn(ee){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;K(ee);break;case a.DOLLY:if(r.enableZoom===!1)return;ve(ee);break;case a.PAN:if(r.enablePan===!1)return;pe(ee);break}}function U(ee){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(ee.preventDefault(),r.dispatchEvent(s),Le(ee),r.dispatchEvent(o))}function N(ee){r.enabled===!1||r.enablePan===!1||we(ee)}function he(ee){switch(He(ee),I.length){case 1:switch(r.touches.ONE){case tc.ROTATE:if(r.enableRotate===!1)return;Fe(),l=a.TOUCH_ROTATE;break;case tc.PAN:if(r.enablePan===!1)return;et(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case tc.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Pt(),l=a.TOUCH_DOLLY_PAN;break;case tc.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;st(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Pe(ee){switch(He(ee),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;J(ee),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;Re(ee),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;De(ee),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;be(ee),r.update();break;default:l=a.NONE}}function Ie(ee){r.enabled!==!1&&ee.preventDefault()}function Ue(ee){I.push(ee)}function Ye(ee){delete R[ee.pointerId];for(let me=0;me=2.0 are supported."));return}const l=new kj(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function lj(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Wt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class cj{constructor(e){this.parser=e,this.name=Wt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class Sj{constructor(e){this.parser=e,this.name=Wt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Ej{constructor(e){this.parser=e,this.name=Wt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Aj{constructor(e){this.name=Wt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,u=i.count,h=i.byteStride,p=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,p,i.mode,i.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(u*h);return o.decodeGltfBuffer(new Uint8Array(m),u,h,p,i.mode,i.filter),m})})}else return null}}class wj{constructor(e){this.name=Wt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==cs.TRIANGLES&&c.mode!==cs.TRIANGLE_STRIP&&c.mode!==cs.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),h=u.isGroup?u.children:[u],p=c[0].count,m=[];for(const g of h){const _=new tt,x=new z,v=new Xn,E=new z(1,1,1),S=new $w(g.geometry,g.material,p);for(let w=0;w=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ga={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ij={CUBICSPLINE:void 0,LINEAR:Lc,STEP:Lf},bx={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Bj(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new lm({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Co})),n.DefaultMaterial}function Yl(n,e,t){for(const r in t.extensions)n[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function Xa(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Lj(n,e,t){let r=!1,i=!1,s=!1;for(let c=0,u=e.length;c0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Nj=new tt;class kj{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new lj,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||i&&s<98?this.textureLoader=new uh(this.options.manager):this.textureLoader=new e3(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new li(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};Yl(s,a,i),Xa(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&x.setY(R,b[B*l+1]),l>=3&&x.setZ(R,b[B*l+2]),l>=4&&x.setW(R,b[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,r).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const p=(s.samplers||{})[o.sampler]||{};return u.magFilter=aI[p.magFilter]||pn,u.minFilter=aI[p.minFilter]||Po,u.wrapS=lI[p.wrapS]||Ro,u.wrapT=lI[p.wrapT]||Ro,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(h){c=!0;const p=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(p),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(p,m){let g=p;t.isImageBitmapLoader===!0&&(g=function(_){const x=new mn(_);x.needsUpdate=!0,p(x)}),t.load($i.resolveURL(h,s.path),g,void 0,m)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||Fj(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[Wt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Wt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Wt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&("colorSpace"in o?o.colorSpace=i===3001?"srgb":"srgb-linear":o.encoding=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Dy,or.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Rr,or.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return lm}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Wt.KHR_MATERIALS_UNLIT]){const h=i[Wt.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new Ge(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const p=h.baseColorFactor;a.color.fromArray(p),a.opacity=p[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,3001)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ps);const u=s.alphaMode||bx.OPAQUE;if(u===bx.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===bx.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==zi&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Me(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}return s.occlusionTexture!==void 0&&o!==zi&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==zi&&(a.emissive=new Ge().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==zi&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,3001)),Promise.all(c).then(function(){const h=new o(a);return s.name&&(h.name=s.name),Xa(h,s),t.associations.set(h,{materials:e}),s.extensions&&Yl(i,h,s),h})}createUniqueName(e){const t=kt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[Wt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return cI(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Dj(v,s),v.name=t.createUniqueName(s.name||"mesh_"+e),Xa(v,s),x.extensions&&Yl(i,v,x),t.assignFinalMaterial(v),h.push(v)}for(let m=0,g=h.length;m1?u=new Hs:c.length===1?u=c[0]:u=new Ut,u!==c[0])for(let h=0,p=c.length;h{const h=new Map;for(const[p,m]of i.associations)(p instanceof or||p instanceof mn)&&h.set(p,m);return u.traverse(p=>{const m=i.associations.get(p);m!=null&&h.set(p,m)}),h};return i.associations=c(s),s})}}function Uj(n,e,t){const r=e.attributes,i=new eo;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new z(l[0],l[1],l[2]),new z(c[0],c[1],c[2])),a.normalized){const u=zE(_f[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new z,l=new z;for(let c=0,u=s.length;c=t[r])return r-1;if(e<=t[n])return n;let i=n,s=r,o=Math.floor((i+s)/2);for(;e=t[o+1];)e=_&&(g[m][0]=g[p][0]/a[E+1][v],x=g[m][0]*a[v][E]);const S=v>=-1?1:-v,w=h-1<=E?_-1:t-h;for(let b=S;b<=w;++b)g[m][b]=(g[p][b]-g[p][b-1])/a[E+1][v+b],x+=g[m][b]*a[v+b][E];h<=E&&(g[m][_]=-g[p][_-1]/a[E+1][h],x+=g[m][_]*a[h][E]),o[_][h]=x;const C=p;p=m,m=C}}let u=t;for(let h=1;h<=r;++h){for(let p=0;p<=t;++p)o[h][p]*=u;u*=t-h}return o}function Vj(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const c=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=c}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in Ht.Objects){const r=Ht.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(r.wrapS=o===0?Ro:fr,r.wrapT=a===0?Ro:fr,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}return r}loadTexture(e,t){let r;const i=this.textureLoader.path,s=Zn.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(r=t[s[0].ID],(r.indexOf("blob:")===0||r.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new mn):(l.setPath(this.textureLoader.path),o=l.load(r))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new mn):o=this.textureLoader.load(r);return this.textureLoader.setPath(i),o}parseMaterials(e){const t=new Map;if("Material"in Ht.Objects){const r=Ht.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Zn.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new Hd;break;case"lambert":a=new tM;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new Hd;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new Ge().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new Ge().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new Ge().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new Ge().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new Ge().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new Ge().fromArray(e.SpecularColor.value));const s=this;return Zn.get(r).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&("colorSpace"in i.map?i.map.colorSpace="srgb":i.map.encoding=3001);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&("colorSpace"in i.emissiveMap?i.emissiveMap.colorSpace="srgb":i.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=Ic,"colorSpace"in i.envMap?i.envMap.colorSpace="srgb":i.envMap.encoding=3001);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&("colorSpace"in i.specularMap?i.specularMap.colorSpace="srgb":i.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in Ht.Objects&&t in Ht.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Zn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Ht.Objects){const r=Ht.Objects.Deformer;for(const i in r){const s=r[i],o=Zn.get(parseInt(i));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,r);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(o,r),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new tt().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),r.push(o)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new Hd({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new Ly(s,o),i.normalizeSkinWeights()):i=new sr(s,o),i}createCurve(e,t){const r=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new Rr({color:3342591,linewidth:1});return new Io(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=V3(t.RotationOrder.value):r.eulerOrder="ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&Zn.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=Ht.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),gi.add(e.target)):e.lookAt(new z().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];Zn.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;Zn.get(c).parents.forEach(function(h){r.has(h.ID)&&r.get(h.ID).bind(new ih(o.bones),i[h.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Ht.Objects){const t=Ht.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new tt().fromArray(s.Matrix.a)}):e[i.Node]=new tt().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in Ht&&"AmbientColor"in Ht.GlobalSettings){const e=Ht.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new Ge(t,r,i);gi.add(new cM(s,1))}}}}class Jj{parse(e){const t=new Map;if("Geometry"in Ht.Objects){const r=Ht.Objects.Geometry;for(const i in r){const s=Zn.get(parseInt(i)),o=this.parseGeometry(s,r[i],e);t.set(parseInt(i),o)}}return t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,s=[],o=e.parents.map(function(h){return Ht.Objects.Model[h.ID]});if(o.length===0)return;const a=e.children.reduce(function(h,p){return i[p.ID]!==void 0&&(h=i[p.ID]),h},null);e.children.forEach(function(h){r.morphTargets[h.ID]!==void 0&&s.push(r.morphTargets[h.ID])});const l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=V3(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const u=G3(c);return this.genGeometry(t,a,s,u)}genGeometry(e,t,r,i){const s=new At;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new it(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new it(a.colors,3)),t&&(s.setAttribute("skinIndex",new Cy(a.weightsIndices,4)),s.setAttribute("skinWeight",new it(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const c=new Bt().getNormalMatrix(i),u=new it(a.normal,3);u.applyNormalMatrix(c),s.setAttribute("normal",u)}if(a.uvs.forEach(function(c,u){let h="uv"+(u+1).toString();u===0&&(h="uv"),s.setAttribute(h,new it(a.uvs[u],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=a.materialIndex[0],u=0;if(a.materialIndex.forEach(function(h,p){h!==c&&(s.addGroup(u,p-u,c),c=h,u=p)}),s.groups.length>0){const h=s.groups[s.groups.length-1],p=h.start+h.count;p!==a.materialIndex.length&&s.addGroup(p,a.materialIndex.length-p,c)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){r.weightTable[o]===void 0&&(r.weightTable[o]=[]),r.weightTable[o].push({id:s,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,o=[],a=[],l=[],c=[],u=[],h=[];const p=this;return e.vertexIndices.forEach(function(m,g){let _,x=!1;m<0&&(m=m^-1,x=!0);let v=[],E=[];if(o.push(m*3,m*3+1,m*3+2),e.color){const S=Tv(g,r,m,e.color);l.push(S[0],S[1],S[2])}if(e.skeleton){if(e.weightTable[m]!==void 0&&e.weightTable[m].forEach(function(S){E.push(S.weight),v.push(S.id)}),E.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const S=[0,0,0,0],w=[0,0,0,0];E.forEach(function(C,b){let B=C,I=v[b];w.forEach(function(R,L,k){if(B>R){k[L]=B,B=R;const X=S[L];S[L]=I,I=X}})}),v=S,E=w}for(;E.length<4;)E.push(0),v.push(0);for(let S=0;S<4;++S)u.push(E[S]),h.push(v[S])}if(e.normal){const S=Tv(g,r,m,e.normal);a.push(S[0],S[1],S[2])}e.material&&e.material.mappingType!=="AllSame"&&(_=Tv(g,r,m,e.material)[0]),e.uv&&e.uv.forEach(function(S,w){const C=Tv(g,r,m,S);c[w]===void 0&&(c[w]=[]),c[w].push(C[0]),c[w].push(C[1])}),i++,x&&(p.genFace(t,e,o,_,a,l,c,u,h,i),r++,i=0,o=[],a=[],l=[],c=[],u=[],h=[])}),t}genFace(e,t,r,i,s,o,a,l,c,u){for(let h=2;h1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);r[i]={name:t[i].attrName,layer:o}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new Nc(e.name,-1,t)}generateTracks(e){const t=[];let r=new z,i=new Xn,s=new z;if(e.transform&&e.transform.decompose(r,i,s),r=r.toArray(),i=new Eo().setFromQuaternion(i,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new Fc(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(zr.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(zr.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(zr.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,r);i!==void 0&&(i=i.map(zr.degToRad),i.push(o),i=new Eo().fromArray(i),i=new Xn().setFromEuler(i)),s!==void 0&&(s=s.map(zr.degToRad),s.push(o),s=new Eo().fromArray(s),s=new Xn().setFromEuler(s).invert());const c=new Xn,u=new Eo,h=[];for(let p=0;p1){let r=1,i=t[0];for(let s=1;s=180){const o=s/180,a=i/o;let l=r+a;const c=e.times[t-1],h=(e.times[t]-c)/o;let p=c+h;const m=[],g=[];for(;p1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),c=parseInt(l[0]),u=parseInt(l[1]);let h=s.split(",").slice(3);h=h.map(function(p){return p.trim().replace(/^"/,"")}),i="connections",s=[c,u],nX(s,h),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=Px(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Px(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let c=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=Px(c);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class qj{parse(e){const t=new fI(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new H3;for(;!this.endOfContent(t);){const s=this.parseNode(t,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(i===0)return null;const l=[];for(let p=0;p0?l[0]:"",u=l.length>1?l[1]:"",h=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const p=this.parseNode(e,t);p!==null&&this.parseSubNode(a,r,p)}return r.propertyList=l,typeof c=="number"&&(r.id=c),u!==""&&(r.attrName=u),h!==""&&(r.attrType=h),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){t[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const o=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:s,type2:o,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=Ed(new Uint8Array(e.getArrayBuffer(o))),l=new fI(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class fI{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(t=t.slice(0,r)),$i.decodeText(new Uint8Array(t))}}class H3{add(e,t){this[e]=t}}function Zj(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===W3(n,0,e.length)}function Qj(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const s=n[i-1];return n=n.slice(t+i),t++,s}for(let i=0;i(I=k.indexOf(h))&&R=S.byteLength||!(L=p(S)))return a(1,"no header found");if(!(k=L.match(w)))return a(3,"bad initial token");for(R.valid|=1,R.programtype=k[1],R.string+=L+` +`;L=p(S),L!==!1;){if(R.string+=L+` +`,L.charAt(0)==="#"){R.comments+=L+` +`;continue}if((k=L.match(C))&&(R.gamma=parseFloat(k[1])),(k=L.match(b))&&(R.exposure=parseFloat(k[1])),(k=L.match(B))&&(R.valid|=2,R.format=k[1]),(k=L.match(I))&&(R.valid|=4,R.height=parseInt(k[1],10),R.width=parseInt(k[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2?R.valid&4?R:a(3,"missing image size specifier"):a(3,"missing format specifier")},g=function(S,w,C){const b=w;if(b<8||b>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);if(b!==(S[2]<<8|S[3]))return a(3,"wrong scanline width");const B=new Uint8Array(4*w*C);if(!B.length)return a(4,"unable to allocate buffer space");let I=0,R=0;const L=4*b,k=new Uint8Array(4),X=new Uint8Array(L);let $=C;for(;$>0&&RS.byteLength)return a(1);if(k[0]=S[R++],k[1]=S[R++],k[2]=S[R++],k[3]=S[R++],k[0]!=2||k[1]!=2||(k[2]<<8|k[3])!=b)return a(3,"bad rgbe scanline format");let Y=0,Z;for(;Y128;if(ie&&(Z-=128),Z===0||Y+Z>L)return a(3,"bad scanline data");if(ie){const G=S[R++];for(let te=0;te>3]&1<<(V&7))&&(T[F++]=V);for(var H=F-1;F<65536;)T[F++]=0;return H}function k(O){for(var T=0;T<16384;T++)O[T]={},O[T].len=0,O[T].lit=0,O[T].p=null}const X={l:0,c:0,lc:0};function $(O,T,F,V,H){for(;F>F&(1<0;--T){var V=F+Y[T]>>1;Y[T]=F,F=V}for(var T=0;T<65537;++T){var H=O[T];H>0&&(O[T]=H|Y[H]++<<6)}}function ne(O,T,F,V,H,j,le){for(var de=F,Se=0,Ee=0;H<=j;H++){if(de.value-F.value>V)return!1;$(6,Se,Ee,O,de);var Te=X.l;if(Se=X.c,Ee=X.lc,le[H]=Te,Te==63){if(de.value-F.value>V)throw"Something wrong with hufUnpackEncTable";$(8,Se,Ee,O,de);var _e=X.l+6;if(Se=X.c,Ee=X.lc,H+_e>j+1)throw"Something wrong with hufUnpackEncTable";for(;_e--;)le[H++]=0;H--}else if(Te>=59){var _e=Te-59+2;if(H+_e>j+1)throw"Something wrong with hufUnpackEncTable";for(;_e--;)le[H++]=0;H--}}Z(le)}function ie(O){return O&63}function G(O){return O>>6}function te(O,T,F,V){for(;T<=F;T++){var H=G(O[T]),j=ie(O[T]);if(H>>j)throw"Invalid table entry";if(j>14){var le=V[H>>j-14];if(le.len)throw"Invalid table entry";if(le.lit++,le.p){var de=le.p;le.p=new Array(le.lit);for(var Se=0;Se0;Se--){var le=V[(H<<14-j)+Ee];if(le.len||le.p)throw"Invalid table entry";le.len=j,le.lit=T,Ee++}}return!0}const q={c:0,lc:0};function ue(O,T,F,V){O=O<<8|Be(F,V),T+=8,q.c=O,q.lc=T}const K={c:0,lc:0};function ve(O,T,F,V,H,j,le,de,Se,Ee){if(O==T){V<8&&(ue(F,V,H,le),F=q.c,V=q.lc),V-=8;var Te=F>>V,Te=new Uint8Array([Te])[0];if(Se.value+Te>Ee)return!1;for(var _e=de[Se.value-1];Te-- >0;)de[Se.value++]=_e}else if(Se.value32767?T-65536:T}const we={a:0,b:0};function Fe(O,T){var F=Le(O),V=Le(T),H=V,j=F+(H&1)+(H>>1),le=j,de=j-H;we.a=le,we.b=de}function et(O,T){var F=pe(O),V=pe(T),H=F-(V>>1)&65535,j=V+H-32768&65535;we.a=j,we.b=H}function ft(O,T,F,V,H,j,le){for(var de=le<16384,Se=F>H?H:F,Ee=1,Te;Ee<=Se;)Ee<<=1;for(Ee>>=1,Te=Ee,Ee>>=1;Ee>=1;){for(var _e=0,Ze=_e+j*(H-Te),ze=j*Ee,We=j*Te,pt=V*Ee,vt=V*Te,mt,Qe,xt,ut;_e<=Ze;_e+=We){for(var Tt=_e,nn=_e+V*(F-Te);Tt<=nn;Tt+=vt){var Et=Tt+pt,rn=Tt+ze,Jt=rn+pt;de?(Fe(O[Tt+T],O[rn+T]),mt=we.a,xt=we.b,Fe(O[Et+T],O[Jt+T]),Qe=we.a,ut=we.b,Fe(mt,Qe),O[Tt+T]=we.a,O[Et+T]=we.b,Fe(xt,ut),O[rn+T]=we.a,O[Jt+T]=we.b):(et(O[Tt+T],O[rn+T]),mt=we.a,xt=we.b,et(O[Et+T],O[Jt+T]),Qe=we.a,ut=we.b,et(mt,Qe),O[Tt+T]=we.a,O[Et+T]=we.b,et(xt,ut),O[rn+T]=we.a,O[Jt+T]=we.b)}if(F&Ee){var rn=Tt+ze;de?Fe(O[Tt+T],O[rn+T]):et(O[Tt+T],O[rn+T]),mt=we.a,O[rn+T]=we.b,O[Tt+T]=mt}}if(H&Ee)for(var Tt=_e,nn=_e+V*(F-Te);Tt<=nn;Tt+=vt){var Et=Tt+pt;de?Fe(O[Tt+T],O[Et+T]):et(O[Tt+T],O[Et+T]),mt=we.a,O[Et+T]=we.b,O[Tt+T]=mt}Te=Ee,Ee>>=1}return _e}function Pt(O,T,F,V,H,j,le,de,Se,Ee){for(var Te=0,_e=0,Ze=de,ze=Math.trunc(H.value+(j+7)/8);H.value=14;){var We=Te>>_e-14&16383,pt=T[We];if(pt.len)_e-=pt.len,ve(pt.lit,le,Te,_e,F,V,H,Se,Ee,Ze),Te=K.c,_e=K.lc;else{if(!pt.p)throw"hufDecode issues";var vt;for(vt=0;vt=mt&&G(O[pt.p[vt]])==(Te>>_e-mt&(1<>=Qe,_e-=Qe;_e>0;){var pt=T[Te<<14-_e&16383];if(pt.len)_e-=pt.len,ve(pt.lit,le,Te,_e,F,V,H,Se,Ee,Ze),Te=K.c,_e=K.lc;else throw"hufDecode issues"}return!0}function st(O,T,F,V,H,j){var le={value:0},de=F.value,Se=Ce(T,F),Ee=Ce(T,F);F.value+=4;var Te=Ce(T,F);if(F.value+=4,Se<0||Se>=65537||Ee<0||Ee>=65537)throw"Something wrong with HUF_ENCSIZE";var _e=new Array(65537),Ze=new Array(16384);k(Ze);var ze=V-(F.value-de);if(ne(O,T,F,ze,Se,Ee,_e),Te>8*(V-(F.value-de)))throw"Something wrong with hufUncompress";te(_e,Se,Ee,Ze),Pt(_e,Ze,O,T,F,Te,Ee,j,H,le)}function J(O,T,F){for(var V=0;Vj||(T[H++]=O[F++],H>j));)T[H++]=O[V++]}function De(O){for(var T=O.byteLength,F=new Array,V=0,H=new DataView(O);T>0;){var j=H.getInt8(V++);if(j<0){var le=-j;T-=le+1;for(var de=0;de>8==255?H+=V&255:(F[H]=V,H++),O.value++}function $e(O,T){T[0]=ce(O[0]),T[1]=ce(O[1]),T[2]=ce(O[5]),T[3]=ce(O[6]),T[4]=ce(O[14]),T[5]=ce(O[15]),T[6]=ce(O[27]),T[7]=ce(O[28]),T[8]=ce(O[2]),T[9]=ce(O[4]),T[10]=ce(O[7]),T[11]=ce(O[13]),T[12]=ce(O[16]),T[13]=ce(O[26]),T[14]=ce(O[29]),T[15]=ce(O[42]),T[16]=ce(O[3]),T[17]=ce(O[8]),T[18]=ce(O[12]),T[19]=ce(O[17]),T[20]=ce(O[25]),T[21]=ce(O[30]),T[22]=ce(O[41]),T[23]=ce(O[43]),T[24]=ce(O[9]),T[25]=ce(O[11]),T[26]=ce(O[18]),T[27]=ce(O[24]),T[28]=ce(O[31]),T[29]=ce(O[40]),T[30]=ce(O[44]),T[31]=ce(O[53]),T[32]=ce(O[10]),T[33]=ce(O[19]),T[34]=ce(O[23]),T[35]=ce(O[32]),T[36]=ce(O[39]),T[37]=ce(O[45]),T[38]=ce(O[52]),T[39]=ce(O[54]),T[40]=ce(O[20]),T[41]=ce(O[22]),T[42]=ce(O[33]),T[43]=ce(O[38]),T[44]=ce(O[46]),T[45]=ce(O[51]),T[46]=ce(O[55]),T[47]=ce(O[60]),T[48]=ce(O[21]),T[49]=ce(O[34]),T[50]=ce(O[37]),T[51]=ce(O[47]),T[52]=ce(O[50]),T[53]=ce(O[56]),T[54]=ce(O[59]),T[55]=ce(O[61]),T[56]=ce(O[35]),T[57]=ce(O[36]),T[58]=ce(O[48]),T[59]=ce(O[49]),T[60]=ce(O[57]),T[61]=ce(O[58]),T[62]=ce(O[62]),T[63]=ce(O[63])}function Xe(O){const T=.5*Math.cos(.7853975),F=.5*Math.cos(3.14159/16),V=.5*Math.cos(3.14159/8),H=.5*Math.cos(3*3.14159/16),j=.5*Math.cos(5*3.14159/16),le=.5*Math.cos(3*3.14159/8),de=.5*Math.cos(7*3.14159/16);for(var Se=new Array(4),Ee=new Array(4),Te=new Array(4),_e=new Array(4),Ze=0;Ze<8;++Ze){var ze=Ze*8;Se[0]=V*O[ze+2],Se[1]=le*O[ze+2],Se[2]=V*O[ze+6],Se[3]=le*O[ze+6],Ee[0]=F*O[ze+1]+H*O[ze+3]+j*O[ze+5]+de*O[ze+7],Ee[1]=H*O[ze+1]-de*O[ze+3]-F*O[ze+5]-j*O[ze+7],Ee[2]=j*O[ze+1]-F*O[ze+3]+de*O[ze+5]+H*O[ze+7],Ee[3]=de*O[ze+1]-j*O[ze+3]+H*O[ze+5]-F*O[ze+7],Te[0]=T*(O[ze+0]+O[ze+4]),Te[3]=T*(O[ze+0]-O[ze+4]),Te[1]=Se[0]+Se[3],Te[2]=Se[1]-Se[2],_e[0]=Te[0]+Te[1],_e[1]=Te[3]+Te[2],_e[2]=Te[3]-Te[2],_e[3]=Te[0]-Te[1],O[ze+0]=_e[0]+Ee[0],O[ze+1]=_e[1]+Ee[1],O[ze+2]=_e[2]+Ee[2],O[ze+3]=_e[3]+Ee[3],O[ze+4]=_e[3]-Ee[3],O[ze+5]=_e[2]-Ee[2],O[ze+6]=_e[1]-Ee[1],O[ze+7]=_e[0]-Ee[0]}for(var We=0;We<8;++We)Se[0]=V*O[16+We],Se[1]=le*O[16+We],Se[2]=V*O[48+We],Se[3]=le*O[48+We],Ee[0]=F*O[8+We]+H*O[24+We]+j*O[40+We]+de*O[56+We],Ee[1]=H*O[8+We]-de*O[24+We]-F*O[40+We]-j*O[56+We],Ee[2]=j*O[8+We]-F*O[24+We]+de*O[40+We]+H*O[56+We],Ee[3]=de*O[8+We]-j*O[24+We]+H*O[40+We]-F*O[56+We],Te[0]=T*(O[We]+O[32+We]),Te[3]=T*(O[We]-O[32+We]),Te[1]=Se[0]+Se[3],Te[2]=Se[1]-Se[2],_e[0]=Te[0]+Te[1],_e[1]=Te[3]+Te[2],_e[2]=Te[3]-Te[2],_e[3]=Te[0]-Te[1],O[0+We]=_e[0]+Ee[0],O[8+We]=_e[1]+Ee[1],O[16+We]=_e[2]+Ee[2],O[24+We]=_e[3]+Ee[3],O[32+We]=_e[3]-Ee[3],O[40+We]=_e[2]-Ee[2],O[48+We]=_e[1]-Ee[1],O[56+We]=_e[0]-Ee[0]}function ct(O){for(var T=0;T<64;++T){var F=O[0][T],V=O[1][T],H=O[2][T];O[0][T]=F+1.5747*H,O[1][T]=F-.1873*V-.4682*H,O[2][T]=F+1.8556*V}}function wt(O,T,F){for(var V=0;V<64;++V)T[F+V]=dc.toHalfFloat(tn(O[V]))}function tn(O){return O<=1?Math.sign(O)*Math.pow(Math.abs(O),2.2):Math.sign(O)*Math.pow(R,Math.abs(O)-1)}function U(O){return new DataView(O.array.buffer,O.offset.value,O.size)}function N(O){var T=O.viewer.buffer.slice(O.offset.value,O.offset.value+O.size),F=new Uint8Array(De(T)),V=new Uint8Array(F.length);return Re(F),Ae(F,V),new DataView(V.buffer)}function he(O){var T=O.array.slice(O.offset.value,O.offset.value+O.size),F=Ed(T),V=new Uint8Array(F.length);return Re(F),Ae(F,V),new DataView(V.buffer)}function Pe(O){for(var T=O.viewer,F={value:O.offset.value},V=new Uint16Array(O.width*O.scanlineBlockSize*(O.channels*O.type)),H=new Uint8Array(8192),j=0,le=new Array(O.channels),de=0;de=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(Se<=Ee)for(var de=0;de0;){var de=Ye(T.buffer,F),Se=Ne(T,F),Ee=Se>>2&3,Te=(Se>>4)-1,_e=new Int8Array([Te])[0],Ze=Ne(T,F);j.push({name:de,index:_e,type:Ze,compression:Ee}),le-=de.length+3}for(var ze=Pr.channels,We=new Array(O.channels),pt=0;pt=0&&(Qe.idx[ut.index]=xt),vt.offset=xt)}if(H.acCompressedSize>0)switch(H.acCompression){case 0:var Et=new Uint16Array(H.totalAcUncompressedCount);st(O.array,T,F,H.acCompressedSize,Et,H.totalAcUncompressedCount);break;case 1:var Tt=O.array.slice(F.value,F.value+H.totalAcUncompressedCount),nn=Ed(Tt),Et=new Uint16Array(nn.buffer);F.value+=H.totalAcUncompressedCount;break}if(H.dcCompressedSize>0){var rn={array:O.array,offset:F,size:H.dcCompressedSize},Jt=new Uint16Array(he(rn).buffer);F.value+=H.dcCompressedSize}if(H.rleRawSize>0){var Tt=O.array.slice(F.value,F.value+H.rleCompressedSize),nn=Ed(Tt),on=De(nn.buffer);F.value+=H.rleCompressedSize}for(var Kn=0,Mt=new Array(We.length),pt=0;pt>10,F=O&1023;return(O>>15?-1:1)*(T?T===31?F?NaN:1/0:Math.pow(2,T-15)*(1+F/1024):6103515625e-14*(F/1024))}function ae(O,T){var F=O.getUint16(T.value,!0);return T.value+=2,F}function Ve(O,T){return ce(ae(O,T))}function Je(O,T,F,V){for(var H=F.value,j=[];F.valueLt.height?Lt.height-T:Lt.scanlineBlockSize;const V=Lt.size=Lt.height)break;for(let le=0;le{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(i)},r,i)}decodeDracoFile(e,t,r,i){const s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}const r=JSON.stringify(t);if(Ix.has(e)){const l=Ix.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((c,u)=>{i._callbacks[s]={resolve:c,reject:u},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Ix.set(e,{key:r,promise:a}),a}_createGeometry(e){const t=new At;e.index&&t.setIndex(new Zt(e.index.array,1));for(let r=0;r{r.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{const i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const s=aX.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengths._taskLoad?-1:1});const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const h=u.draco,p=new h.Decoder,m=new h.DecoderBuffer;m.Init(new Int8Array(l),l.byteLength);try{const g=t(h,p,m,c),_=g.attributes.map(x=>x.array.buffer);g.index&&_.push(g.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:g},_)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}finally{h.destroy(m),h.destroy(p)}});break}};function t(o,a,l,c){const u=c.attributeIDs,h=c.attributeTypes;let p,m;const g=a.GetEncodedGeometryType(l);if(g===o.TRIANGULAR_MESH)p=new o.Mesh,m=a.DecodeBufferToMesh(l,p);else if(g===o.POINT_CLOUD)p=new o.PointCloud,m=a.DecodeBufferToPointCloud(l,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const _={index:null,attributes:[]};for(const x in u){const v=self[h[x]];let E,S;if(c.useUniqueIDs)S=u[x],E=a.GetAttributeByUniqueId(p,S);else{if(S=a.GetAttributeId(p,o[u[x]]),S===-1)continue;E=a.GetAttribute(p,S)}_.attributes.push(i(o,a,p,x,v,E))}return g===o.TRIANGULAR_MESH&&(_.index=r(o,a,p)),o.destroy(p),_}function r(o,a,l){const u=l.num_faces()*3,h=u*4,p=o._malloc(h);a.GetTrianglesUInt32Array(l,h,p);const m=new Uint32Array(o.HEAPF32.buffer,p,u).slice();return o._free(p),{array:m,itemSize:1}}function i(o,a,l,c,u,h){const p=h.num_components(),g=l.num_points()*p,_=g*u.BYTES_PER_ELEMENT,x=s(o,u),v=o._malloc(_);a.GetAttributeDataArrayForAllPoints(l,h,x,_,v);const E=new u(o.HEAPF32.buffer,v,g).slice();return o._free(v),{name:c,array:E,itemSize:p}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}let bv;const Bx=()=>{if(bv)return bv;const n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let i=n;WebAssembly.validate(t)&&(i=e);let s;const o=WebAssembly.instantiate(a(i),{}).then(h=>{s=h.instance,s.exports.__wasm_call_ctors()});function a(h){const p=new Uint8Array(h.length);for(let g=0;g96?_-71:_>64?_-65:_>47?_+4:_>46?63:62}let m=0;for(let g=0;gn===Object(n)&&!Array.isArray(n)&&typeof n!="function";function AM(n,e){const t=yi(i=>i.gl),r=qi(uh,pI(n)?Object.values(n):n);if(D.useLayoutEffect(()=>{e==null||e(r)},[e]),D.useEffect(()=>{(Array.isArray(r)?r:[r]).forEach(t.initTexture)},[t,r]),pI(n)){const i=Object.keys(n),s={};return i.forEach(o=>Object.assign(s,{[o]:r[i.indexOf(o)]})),s}else return r}AM.preload=n=>qi.preload(uh,n);AM.clear=n=>qi.clear(uh,n);let Cv=null;function $3(n,e,t){return r=>{t&&t(r),n&&(Cv||(Cv=new oX),Cv.setDecoderPath(typeof n=="string"?n:"https://www.gstatic.com/draco/versioned/decoders/1.5.5/"),r.setDRACOLoader(Cv)),e&&r.setMeshoptDecoder(typeof Bx=="function"?Bx():Bx)}}function Vy(n,e=!0,t=!0,r){return qi(SM,n,$3(e,t,r))}Vy.preload=(n,e=!0,t=!0,r)=>qi.preload(SM,n,$3(e,t,r));Vy.clear=n=>qi.clear(SM,n);const lX=D.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},u)=>{const h=yi(b=>b.invalidate),p=yi(b=>b.camera),m=yi(b=>b.gl),g=yi(b=>b.events),_=yi(b=>b.setEvents),x=yi(b=>b.set),v=yi(b=>b.get),E=yi(b=>b.performance),S=e||p,w=r||g.connected||m.domElement,C=D.useMemo(()=>new aj(S),[S]);return Tp(()=>{C.enabled&&C.update()},-1),D.useEffect(()=>(s&&C.connect(s===!0?w:s),C.connect(w),()=>void C.dispose()),[s,w,t,C,h]),D.useEffect(()=>{const b=R=>{h(),t&&E.regress(),o&&o(R)},B=R=>{a&&a(R)},I=R=>{l&&l(R)};return C.addEventListener("change",b),C.addEventListener("start",B),C.addEventListener("end",I),()=>{C.removeEventListener("start",B),C.removeEventListener("end",I),C.removeEventListener("change",b)}},[o,a,l,C,h,_]),D.useEffect(()=>{if(n){const b=v().controls;return x({controls:C}),()=>x({controls:b})}},[n,C]),D.createElement("primitive",Hn({ref:u,object:C,enableDamping:i},c))});function Vd(n){return qi(EM,n)}Vd.preload=n=>qi.preload(EM,n);Vd.clear=n=>qi.clear(EM,n);function cX(n,e){const t=D.useRef(),[r]=D.useState(()=>e?e instanceof Ut?{current:e}:e:t),[i]=D.useState(()=>new i3(void 0));D.useLayoutEffect(()=>void(i._root=r.current),[i,e]);const s=D.useRef({}),[o]=D.useState(()=>{const a={};return n.forEach(l=>Object.defineProperty(a,l.name,{enumerable:!0,get(){if(r.current)return s.current[l.name]||(s.current[l.name]=i.clipAction(l,r.current))},configurable:!0})),{ref:r,clips:n,actions:a,names:n.map(l=>l.name),mixer:i}});return Tp((a,l)=>i.update(l)),D.useEffect(()=>{const a=r.current;return()=>{s.current={},Object.values(o.actions).forEach(l=>{a&&i.uncacheAction(l,a)})}},[n]),D.useEffect(()=>()=>{i.stopAllAction()},[i]),o}const Lx={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},uX="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",mI=n=>Array.isArray(n);function j3({files:n=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],path:e="",preset:t=void 0,encoding:r=void 0,extensions:i}={}){var s;let o=null,a=!1,l;if(t){if(!(t in Lx))throw new Error("Preset must be one of: "+Object.keys(Lx).join(", "));n=Lx[t],e=uX}if(a=mI(n),l=mI(n)?"cube":n.startsWith("data:application/exr")?"exr":n.startsWith("data:application/hdr")?"hdr":(s=n.split(".").pop())==null?void 0:s.toLowerCase(),o=a?JO:l==="hdr"?iX:l==="exr"?sX:null,!o)throw new Error("useEnvironment: Unrecognized file extension: "+n);const c=qi(o,a?[n]:n,m=>{m.setPath==null||m.setPath(e),i&&i(m)}),u=a?c[0]:c;u.mapping=a?ya:Ic;const h=3001,p=3e3;return"colorSpace"in u?u.colorSpace=r??a?"srgb":"srgb-linear":u.encoding=r??a?h:p,u}const fX=n=>n.current&&n.current.isScene,hX=n=>fX(n)?n.current:n;function wM(n,e,t,r,i=0){const s=hX(e||t),o=s.background,a=s.environment,l=s.backgroundBlurriness||0;return n!=="only"&&(s.environment=r),n&&(s.background=r),n&&s.backgroundBlurriness!==void 0&&(s.backgroundBlurriness=i),()=>{n!=="only"&&(s.environment=a),n&&(s.background=o),n&&s.backgroundBlurriness!==void 0&&(s.backgroundBlurriness=l)}}function MM({scene:n,background:e=!1,blur:t,map:r}){const i=yi(s=>s.scene);return D.useLayoutEffect(()=>{if(r)return wM(e,n,i,r,t)},[i,n,r,e,t]),null}function X3({background:n=!1,scene:e,blur:t,...r}){const i=j3(r),s=yi(o=>o.scene);return D.useLayoutEffect(()=>wM(n,e,s,i,t),[i,n,e,s,t]),null}function dX({children:n,near:e=1,far:t=1e3,resolution:r=256,frames:i=1,map:s,background:o=!1,blur:a,scene:l,files:c,path:u,preset:h=void 0,extensions:p}){const m=yi(S=>S.gl),g=yi(S=>S.scene),_=D.useRef(null),[x]=D.useState(()=>new yp),v=D.useMemo(()=>{const S=new Uw(r);return S.texture.type=ri,S},[r]);D.useLayoutEffect(()=>(i===1&&_.current.update(m,x),wM(o,l,g,v.texture,a)),[n,x,v.texture,l,g,o,i,m]);let E=1;return Tp(()=>{(i===1/0||Ec3({GroundProjectedEnvImpl:ij}),[]);const a=D.useMemo(()=>[o],[o]),l=(e=n.ground)==null?void 0:e.height,c=(t=n.ground)==null?void 0:t.radius,u=(r=(i=n.ground)==null?void 0:i.scale)!==null&&r!==void 0?r:1e3;return D.createElement(D.Fragment,null,D.createElement(MM,Hn({},n,{map:o})),D.createElement("groundProjectedEnvImpl",{args:a,scale:u,height:l,radius:c}))}function mX(n){return n.ground?D.createElement(pX,n):n.map?D.createElement(MM,n):n.children?D.createElement(dX,n):D.createElement(X3,n)}var ln={},gX={get exports(){return ln},set exports(n){ln=n}},vX="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",yX=vX,_X=yX;function J3(){}function K3(){}K3.resetWarningCache=J3;var xX=function(){function n(r,i,s,o,a,l){if(l!==_X){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}n.isRequired=n;function e(){return n}var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:e,element:n,elementType:n,instanceOf:e,node:n,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:K3,resetWarningCache:J3};return t.PropTypes=t,t};gX.exports=xX();function SX(n,e){typeof n=="function"?n(e):n!=null&&(n.current=e)}function Y3(...n){return e=>n.forEach(t=>SX(t,e))}function fh(...n){return D.useCallback(Y3(...n),n)}const q3=D.forwardRef((n,e)=>{const{children:t,...r}=n,i=D.Children.toArray(t),s=i.find(EX);if(s){const o=s.props.children,a=i.map(l=>l===s?D.Children.count(o)>1?D.Children.only(null):D.isValidElement(o)?o.props.children:null:l);return D.createElement(HE,Hn({},r,{ref:e}),D.isValidElement(o)?D.cloneElement(o,void 0,a):null)}return D.createElement(HE,Hn({},r,{ref:e}),t)});q3.displayName="Slot";const HE=D.forwardRef((n,e)=>{const{children:t,...r}=n;return D.isValidElement(t)?D.cloneElement(t,{...AX(r,t.props),ref:e?Y3(e,t.ref):t.ref}):D.Children.count(t)>1?D.Children.only(null):null});HE.displayName="SlotClone";const Z3=({children:n})=>D.createElement(D.Fragment,null,n);function EX(n){return D.isValidElement(n)&&n.type===Z3}function AX(n,e){const t={...e};for(const r in e){const i=n[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?t[r]=(...a)=>{s(...a),i(...a)}:i&&(t[r]=i):r==="style"?t[r]={...i,...s}:r==="className"&&(t[r]=[i,s].filter(Boolean).join(" "))}return{...n,...t}}const wX=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Jc=wX.reduce((n,e)=>{const t=D.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?q3:e;return D.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),D.createElement(a,Hn({},o,{ref:i}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function MX(n,e){n&&Mc.flushSync(()=>n.dispatchEvent(e))}const TX=D.forwardRef((n,e)=>{var t;const{container:r=globalThis==null||(t=globalThis.document)===null||t===void 0?void 0:t.body,...i}=n;return r?uD.createPortal(D.createElement(Jc.div,Hn({},i,{ref:e})),r):null}),bX=TX;var gI=Object.prototype.hasOwnProperty;function Cp(n,e){var t,r;if(n===e)return!0;if(n&&e&&(t=n.constructor)===e.constructor){if(t===Date)return n.getTime()===e.getTime();if(t===RegExp)return n.toString()===e.toString();if(t===Array){if((r=n.length)===e.length)for(;r--&&Cp(n[r],e[r]););return r===-1}if(!t||typeof n=="object"){r=0;for(t in n)if(gI.call(n,t)&&++r&&!gI.call(e,t)||!(t in e)||!Cp(n[t],e[t]))return!1;return Object.keys(e).length===r}}return n!==n&&e!==e}var Wy=function(e,t,r,i){this.name=e,this.fn=t,this.args=r,this.modifiers=i};Wy.prototype._test=function(e){var t=this.fn;try{xf(this.modifiers.slice(),t,this)(e)}catch{t=function(){return!1}}try{return xf(this.modifiers.slice(),t,this)(e)}catch{return!1}};Wy.prototype._check=function(e){try{xf(this.modifiers.slice(),this.fn,this)(e)}catch{if(xf(this.modifiers.slice(),function(r){return r},this)(!1))return}if(!xf(this.modifiers.slice(),this.fn,this)(e))throw null};Wy.prototype._testAsync=function(e){var t=this;return new Promise(function(r,i){eF(t.modifiers.slice(),t.fn,t)(e).then(function(s){s?r(e):i(null)}).catch(function(s){return i(s)})})};function Q3(n,e){return e===void 0&&(e="simple"),typeof n=="object"?n[e]:n}function xf(n,e,t){if(n.length){var r=n.shift(),i=xf(n,e,t);return r.perform(i,t)}else return Q3(e)}function eF(n,e,t){if(n.length){var r=n.shift(),i=eF(n,e,t);return r.performAsync(i,t)}else return function(s){return Promise.resolve(Q3(e,"async")(s))}}var CX=function(e,t,r){this.name=e,this.perform=t,this.performAsync=r},TM=function(n){function e(t,r,i,s){for(var o=[],a=arguments.length-4;a-- >0;)o[a]=arguments[a+4];n.call(this,o),n.captureStackTrace&&n.captureStackTrace(this,e),this.rule=t,this.value=r,this.cause=i,this.target=s}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(Error),Bo=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=[]),this.chain=e,this.nextRuleModifiers=t};Bo.prototype._applyRule=function(e,t){var r=this;return function(){for(var i=[],s=arguments.length;s--;)i[s]=arguments[s];return r.chain.push(new Wy(t,e.apply(r,i),i,r.nextRuleModifiers)),r.nextRuleModifiers=[],r}};Bo.prototype._applyModifier=function(e,t){return this.nextRuleModifiers.push(new CX(t,e.simple,e.async)),this};Bo.prototype._clone=function(){return new Bo(this.chain.slice(),this.nextRuleModifiers.slice())};Bo.prototype.test=function(e){return this.chain.every(function(t){return t._test(e)})};Bo.prototype.testAll=function(e){var t=[];return this.chain.forEach(function(r){try{r._check(e)}catch(i){t.push(new TM(r,e,i))}}),t};Bo.prototype.check=function(e){this.chain.forEach(function(t){try{t._check(e)}catch(r){throw new TM(t,e,r)}})};Bo.prototype.testAsync=function(e){var t=this;return new Promise(function(r,i){tF(e,t.chain.slice(),r,i)})};function tF(n,e,t,r){if(e.length){var i=e.shift();i._testAsync(n).then(function(){tF(n,e,t,r)},function(s){r(new TM(i,n,s))})}else t(n)}var vI=function(n,e){return e&&typeof n=="string"&&n.trim().length===0?!0:n==null};function RX(n,e){return e===void 0&&(e=!1),{simple:function(t){return vI(t,e)||n.check(t)===void 0},async:function(t){return vI(t,e)||n.testAsync(t)}}}function Ei(){return typeof Proxy<"u"?nF(new Bo):GE(new Bo)}var Rp={};Ei.extend=function(n){Object.assign(Rp,n)};Ei.clearCustomRules=function(){Rp={}};function nF(n){return new Proxy(n,{get:function(t,r){if(r in t)return t[r];var i=nF(n._clone());if(r in z0)return i._applyModifier(z0[r],r);if(r in Rp)return i._applyRule(Rp[r],r);if(r in VE)return i._applyRule(VE[r],r)}})}function GE(n){var e=function(i,s){return Object.keys(i).forEach(function(o){s[o]=function(){for(var a=[],l=arguments.length;l--;)a[l]=arguments[l];var c=GE(s._clone()),u=c._applyRule(i[o],o).apply(void 0,a);return u}}),s},t=e(VE,n),r=e(Rp,t);return Object.keys(z0).forEach(function(i){Object.defineProperty(r,i,{get:function(){var s=GE(r._clone());return s._applyModifier(z0[i],i)}})}),r}var z0={not:{simple:function(n){return function(e){return!n(e)}},async:function(n){return function(e){return Promise.resolve(n(e)).then(function(t){return!t}).catch(function(){return!0})}}},some:{simple:function(n){return function(e){return Rv(e).some(function(t){try{return n(t)}catch{return!1}})}},async:function(n){return function(e){return Promise.all(Rv(e).map(function(t){try{return n(t).catch(function(){return!1})}catch{return!1}})).then(function(t){return t.some(Boolean)})}}},every:{simple:function(n){return function(e){return e!==!1&&Rv(e).every(n)}},async:function(n){return function(e){return Promise.all(Rv(e).map(n)).then(function(t){return t.every(Boolean)})}}},strict:{simple:function(n,e){return function(t){return yI(e)&&t&&typeof t=="object"?Object.keys(e.args[0]).length===Object.keys(t).length&&n(t):n(t)}},async:function(n,e){return function(t){return Promise.resolve(n(t)).then(function(r){return yI(e)&&t&&typeof t=="object"?Object.keys(e.args[0]).length===Object.keys(t).length&&r:r}).catch(function(){return!1})}}}};function yI(n){return n&&n.name==="schema"&&n.args.length>0&&typeof n.args[0]=="object"}function Rv(n){return typeof n=="string"?n.split(""):n}var VE={equal:function(n){return function(e){return e==n}},exact:function(n){return function(e){return e===n}},number:function(n){return n===void 0&&(n=!0),function(e){return typeof e=="number"&&(n||isFinite(e))}},integer:function(){return function(n){var e=Number.isInteger||PX;return e(n)}},numeric:function(){return function(n){return!isNaN(parseFloat(n))&&isFinite(n)}},string:function(){return Vu("string")},boolean:function(){return Vu("boolean")},undefined:function(){return Vu("undefined")},null:function(){return Vu("null")},array:function(){return Vu("array")},object:function(){return Vu("object")},instanceOf:function(n){return function(e){return e instanceof n}},pattern:function(n){return function(e){return n.test(e)}},lowercase:function(){return function(n){return typeof n=="boolean"||n===n.toLowerCase()&&n.trim()!==""}},uppercase:function(){return function(n){return n===n.toUpperCase()&&n.trim()!==""}},vowel:function(){return function(n){return/^[aeiou]+$/i.test(n)}},consonant:function(){return function(n){return/^(?=[^aeiou])([a-z]+)$/i.test(n)}},first:function(n){return function(e){return e[0]==n}},last:function(n){return function(e){return e[e.length-1]==n}},empty:function(){return function(n){return n.length===0}},length:function(n,e){return function(t){return t.length>=n&&t.length<=(e||n)}},minLength:function(n){return function(e){return e.length>=n}},maxLength:function(n){return function(e){return e.length<=n}},negative:function(){return function(n){return n<0}},positive:function(){return function(n){return n>=0}},between:function(n,e){return function(t){return t>=n&&t<=e}},range:function(n,e){return function(t){return t>=n&&t<=e}},lessThan:function(n){return function(e){return en}},greaterThanOrEqual:function(n){return function(e){return e>=n}},even:function(){return function(n){return n%2===0}},odd:function(){return function(n){return n%2!==0}},includes:function(n){return function(e){return~e.indexOf(n)}},schema:function(n){return IX(n)},passesAnyOf:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return function(t){return n.some(function(r){return r.test(t)})}},optional:RX};function Vu(n){return function(e){return Array.isArray(e)&&n==="array"||e===null&&n==="null"||typeof e===n}}function PX(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n}function IX(n){return{simple:function(e){var t=[];if(Object.keys(n).forEach(function(r){var i=n[r];try{i.check((e||{})[r])}catch(s){s.target=r,t.push(s)}}),t.length>0)throw t;return!0},async:function(e){var t=[],r=Object.keys(n).map(function(i){var s=n[i];return s.testAsync((e||{})[i]).catch(function(o){o.target=i,t.push(o)})});return Promise.all(r).then(function(){if(t.length>0)throw t;return!0})}}}var an="colors",Zr="sizes",lt="space",BX={gap:lt,gridGap:lt,columnGap:lt,gridColumnGap:lt,rowGap:lt,gridRowGap:lt,inset:lt,insetBlock:lt,insetBlockEnd:lt,insetBlockStart:lt,insetInline:lt,insetInlineEnd:lt,insetInlineStart:lt,margin:lt,marginTop:lt,marginRight:lt,marginBottom:lt,marginLeft:lt,marginBlock:lt,marginBlockEnd:lt,marginBlockStart:lt,marginInline:lt,marginInlineEnd:lt,marginInlineStart:lt,padding:lt,paddingTop:lt,paddingRight:lt,paddingBottom:lt,paddingLeft:lt,paddingBlock:lt,paddingBlockEnd:lt,paddingBlockStart:lt,paddingInline:lt,paddingInlineEnd:lt,paddingInlineStart:lt,top:lt,right:lt,bottom:lt,left:lt,scrollMargin:lt,scrollMarginTop:lt,scrollMarginRight:lt,scrollMarginBottom:lt,scrollMarginLeft:lt,scrollMarginX:lt,scrollMarginY:lt,scrollMarginBlock:lt,scrollMarginBlockEnd:lt,scrollMarginBlockStart:lt,scrollMarginInline:lt,scrollMarginInlineEnd:lt,scrollMarginInlineStart:lt,scrollPadding:lt,scrollPaddingTop:lt,scrollPaddingRight:lt,scrollPaddingBottom:lt,scrollPaddingLeft:lt,scrollPaddingX:lt,scrollPaddingY:lt,scrollPaddingBlock:lt,scrollPaddingBlockEnd:lt,scrollPaddingBlockStart:lt,scrollPaddingInline:lt,scrollPaddingInlineEnd:lt,scrollPaddingInlineStart:lt,fontSize:"fontSizes",background:an,backgroundColor:an,backgroundImage:an,borderImage:an,border:an,borderBlock:an,borderBlockEnd:an,borderBlockStart:an,borderBottom:an,borderBottomColor:an,borderColor:an,borderInline:an,borderInlineEnd:an,borderInlineStart:an,borderLeft:an,borderLeftColor:an,borderRight:an,borderRightColor:an,borderTop:an,borderTopColor:an,caretColor:an,color:an,columnRuleColor:an,fill:an,outline:an,outlineColor:an,stroke:an,textDecorationColor:an,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:Zr,minBlockSize:Zr,maxBlockSize:Zr,inlineSize:Zr,minInlineSize:Zr,maxInlineSize:Zr,width:Zr,minWidth:Zr,maxWidth:Zr,height:Zr,minHeight:Zr,maxHeight:Zr,flexBasis:Zr,gridTemplateColumns:Zr,gridTemplateRows:Zr,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},LX=(n,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,hh=()=>{const n=Object.create(null);return(e,t,...r)=>{const i=(s=>JSON.stringify(s,LX))(e);return i in n?n[i]:n[i]=t(e,...r)}},Ac=Symbol.for("sxs.internal"),bM=(n,e)=>Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),_I=n=>{for(const e in n)return!0;return!1},{hasOwnProperty:DX}=Object.prototype,WE=n=>n.includes("-")?n:n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),OX=/\s+(?![^()]*\))/,Wu=n=>e=>n(...typeof e=="string"?String(e).split(OX):[e]),xI={appearance:n=>({WebkitAppearance:n,appearance:n}),backfaceVisibility:n=>({WebkitBackfaceVisibility:n,backfaceVisibility:n}),backdropFilter:n=>({WebkitBackdropFilter:n,backdropFilter:n}),backgroundClip:n=>({WebkitBackgroundClip:n,backgroundClip:n}),boxDecorationBreak:n=>({WebkitBoxDecorationBreak:n,boxDecorationBreak:n}),clipPath:n=>({WebkitClipPath:n,clipPath:n}),content:n=>({content:n.includes('"')||n.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(n)?n:`"${n}"`}),hyphens:n=>({WebkitHyphens:n,hyphens:n}),maskImage:n=>({WebkitMaskImage:n,maskImage:n}),maskSize:n=>({WebkitMaskSize:n,maskSize:n}),tabSize:n=>({MozTabSize:n,tabSize:n}),textSizeAdjust:n=>({WebkitTextSizeAdjust:n,textSizeAdjust:n}),userSelect:n=>({WebkitUserSelect:n,userSelect:n}),marginBlock:Wu((n,e)=>({marginBlockStart:n,marginBlockEnd:e||n})),marginInline:Wu((n,e)=>({marginInlineStart:n,marginInlineEnd:e||n})),maxSize:Wu((n,e)=>({maxBlockSize:n,maxInlineSize:e||n})),minSize:Wu((n,e)=>({minBlockSize:n,minInlineSize:e||n})),paddingBlock:Wu((n,e)=>({paddingBlockStart:n,paddingBlockEnd:e||n})),paddingInline:Wu((n,e)=>({paddingInlineStart:n,paddingInlineEnd:e||n}))},Dx=/([\d.]+)([^]*)/,FX=(n,e)=>n.length?n.reduce((t,r)=>(t.push(...e.map(i=>i.includes("&")?i.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(i)?`:is(${r})`:r):r+" "+i)),t),[]):e,NX=(n,e)=>n in kX&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,(t,r,i,s)=>r+(i==="stretch"?`-moz-available${s};${WE(n)}:${r}-webkit-fill-available`:`-moz-fit-content${s};${WE(n)}:${r}fit-content`)+s):String(e),kX={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},xa=n=>n?n+"-":"",rF=(n,e,t)=>n.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,(r,i,s,o,a)=>o=="$"==!!s?r:(i||o=="--"?"calc(":"")+"var(--"+(o==="$"?xa(e)+(a.includes("$")?"":xa(t))+a.replace(/\$/g,"-"):a)+")"+(i||o=="--"?"*"+(i||"")+(s||"1")+")":"")),UX=/\s*,\s*(?![^()]*\))/,zX=Object.prototype.toString,cf=(n,e,t,r,i)=>{let s,o,a;const l=(c,u,h)=>{let p,m;const g=_=>{for(p in _){const E=p.charCodeAt(0)===64,S=E&&Array.isArray(_[p])?_[p]:[_[p]];for(m of S){const w=/[A-Z]/.test(v=p)?v:v.replace(/-[^]/g,b=>b[1].toUpperCase()),C=typeof m=="object"&&m&&m.toString===zX&&(!r.utils[w]||!u.length);if(w in r.utils&&!C){const b=r.utils[w];if(b!==o){o=b,g(b(m)),o=null;continue}}else if(w in xI){const b=xI[w];if(b!==a){a=b,g(b(m)),a=null;continue}}if(E&&(x=p.slice(1)in r.media?"@media "+r.media[p.slice(1)]:p,p=x.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,(b,B,I,R,L,k)=>{const X=Dx.test(B),$=.0625*(X?-1:1),[Y,Z]=X?[R,B]:[B,R];return"("+(I[0]==="="?"":I[0]===">"===X?"max-":"min-")+Y+":"+(I[0]!=="="&&I.length===1?Z.replace(Dx,(ne,ie,G)=>Number(ie)+$*(I===">"?1:-1)+G):Z)+(L?") and ("+(L[0]===">"?"min-":"max-")+Y+":"+(L.length===1?k.replace(Dx,(ne,ie,G)=>Number(ie)+$*(L===">"?-1:1)+G):k):"")+")"})),C){const b=E?h.concat(p):[...h],B=E?[...u]:FX(u,p.split(UX));s!==void 0&&i(SI(...s)),s=void 0,l(m,B,b)}else s===void 0&&(s=[[],u,h]),p=E||p.charCodeAt(0)!==36?p:`--${xa(r.prefix)}${p.slice(1).replace(/\$/g,"-")}`,m=C?m:typeof m=="number"?m&&w in HX?String(m)+"px":String(m):rF(NX(w,m??""),r.prefix,r.themeMap[w]),s[0].push(`${E?`${p} `:`${WE(p)}:`}${m}`)}}var x,v};g(c),s!==void 0&&i(SI(...s)),s=void 0};l(n,e,t)},SI=(n,e,t)=>`${t.map(r=>`${r}{`).join("")}${e.length?`${e.join(",")}{`:""}${n.join(";")}${e.length?"}":""}${Array(t.length?t.length+1:0).join("}")}`,HX={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},EI=n=>String.fromCharCode(n+(n>25?39:97)),wc=n=>(e=>{let t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=EI(t%52)+r;return EI(t%52)+r})(((e,t)=>{let r=t.length;for(;r;)e=33*e^t.charCodeAt(--r);return e})(5381,JSON.stringify(n))>>>0),Ad=["themed","global","styled","onevar","resonevar","allvar","inline"],GX=n=>{if(n.href&&!n.href.startsWith(location.origin))return!1;try{return!!n.cssRules}catch{return!1}},VX=n=>{let e;const t=()=>{const{cssRules:i}=e.sheet;return[].map.call(i,(s,o)=>{const{cssText:a}=s;let l="";if(a.startsWith("--sxs"))return"";if(i[o-1]&&(l=i[o-1].cssText).startsWith("--sxs")){if(!s.cssRules.length)return"";for(const c in e.rules)if(e.rules[c].group===s)return`--sxs{--sxs:${[...e.rules[c].cache].join(" ")}}${a}`;return s.cssRules.length?`${l}${a}`:""}return a}).join("")},r=()=>{if(e){const{rules:a,sheet:l}=e;if(!l.deleteRule){for(;Object(Object(l.cssRules)[0]).type===3;)l.cssRules.splice(0,1);l.cssRules=[]}for(const c in a)delete a[c]}const i=Object(n).styleSheets||[];for(const a of i)if(GX(a)){for(let l=0,c=a.cssRules;c[l];++l){const u=Object(c[l]);if(u.type!==1)continue;const h=Object(c[l+1]);if(h.type!==4)continue;++l;const{cssText:p}=u;if(!p.startsWith("--sxs"))continue;const m=p.slice(14,-3).trim().split(/\s+/),g=Ad[m[0]];g&&(e||(e={sheet:a,reset:r,rules:{},toString:t}),e.rules[g]={group:h,index:l,cache:new Set(m)})}if(e)break}if(!e){const a=(l,c)=>({type:c,cssRules:[],insertRule(u,h){this.cssRules.splice(h,0,a(u,{import:3,undefined:1}[(u.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,u=>u.cssText).join("")}}`:l}});e={sheet:n?(n.head||n).appendChild(document.createElement("style")).sheet:a("","text/css"),rules:{},reset:r,toString:t}}const{sheet:s,rules:o}=e;for(let a=Ad.length-1;a>=0;--a){const l=Ad[a];if(!o[l]){const c=Ad[a+1],u=o[c]?o[c].index:s.cssRules.length;s.insertRule("@media{}",u),s.insertRule(`--sxs{--sxs:${a}}`,u),o[l]={group:s.cssRules[u+1],index:u,cache:new Set([a])}}WX(o[l])}};return r(),e},WX=n=>{const e=n.group;let t=e.cssRules.length;n.apply=r=>{try{e.insertRule(r,t),++t}catch{}}},hd=Symbol(),$X=hh(),AI=(n,e)=>$X(n,()=>(...t)=>{let r={type:null,composers:new Set};for(const i of t)if(i!=null)if(i[Ac]){r.type==null&&(r.type=i[Ac].type);for(const s of i[Ac].composers)r.composers.add(s)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(jX(i,n));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),XX(n,r,e)}),jX=({variants:n,compoundVariants:e,defaultVariants:t,...r},i)=>{const s=`${xa(i.prefix)}c-${wc(r)}`,o=[],a=[],l=Object.create(null),c=[];for(const p in t)l[p]=String(t[p]);if(typeof n=="object"&&n)for(const p in n){u=l,h=p,DX.call(u,h)||(l[p]="undefined");const m=n[p];for(const g in m){const _={[p]:String(g)};String(g)==="undefined"&&c.push(p);const x=m[g],v=[_,x,!_I(x)];o.push(v)}}var u,h;if(typeof e=="object"&&e)for(const p of e){let{css:m,...g}=p;m=typeof m=="object"&&m||{};for(const x in g)g[x]=String(g[x]);const _=[g,m,!_I(m)];a.push(_)}return[s,r,o,a,l,c]},XX=(n,e,t)=>{const[r,i,s,o]=JX(e.composers),a=typeof e.type=="function"||e.type.$$typeof?(h=>{function p(){for(let m=0;mp.rules[m]={apply:g=>p[hd].push([m,g])}),p})(t):null,l=(a||t).rules,c=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,u=h=>{h=typeof h=="object"&&h||KX;const{css:p,...m}=h,g={};for(const v in s)if(delete m[v],v in h){let E=h[v];typeof E=="object"&&E?g[v]={"@initial":s[v],...E}:(E=String(E),g[v]=E!=="undefined"||o.has(v)?E:s[v])}else g[v]=s[v];const _=new Set([...i]);for(const[v,E,S,w]of e.composers){t.rules.styled.cache.has(v)||(t.rules.styled.cache.add(v),cf(E,[`.${v}`],[],n,B=>{l.styled.apply(B)}));const C=wI(S,g,n.media),b=wI(w,g,n.media,!0);for(const B of C)if(B!==void 0)for(const[I,R,L]of B){const k=`${v}-${wc(R)}-${I}`;_.add(k);const X=(L?t.rules.resonevar:t.rules.onevar).cache,$=L?l.resonevar:l.onevar;X.has(k)||(X.add(k),cf(R,[`.${k}`],[],n,Y=>{$.apply(Y)}))}for(const B of b)if(B!==void 0)for(const[I,R]of B){const L=`${v}-${wc(R)}-${I}`;_.add(L),t.rules.allvar.cache.has(L)||(t.rules.allvar.cache.add(L),cf(R,[`.${L}`],[],n,k=>{l.allvar.apply(k)}))}}if(typeof p=="object"&&p){const v=`${r}-i${wc(p)}-css`;_.add(v),t.rules.inline.cache.has(v)||(t.rules.inline.cache.add(v),cf(p,[`.${v}`],[],n,E=>{l.inline.apply(E)}))}for(const v of String(h.className||"").trim().split(/\s+/))v&&_.add(v);const x=m.className=[..._].join(" ");return{type:e.type,className:x,selector:c,props:m,toString:()=>x,deferredInjector:a}};return bM(u,{className:r,selector:c,[Ac]:e,toString:()=>(t.rules.styled.cache.has(r)||u(),r)})},JX=n=>{let e="";const t=[],r={},i=[];for(const[s,,,,o,a]of n){e===""&&(e=s),t.push(s),i.push(...a);for(const l in o){const c=o[l];(r[l]===void 0||c!=="undefined"||a.includes(c))&&(r[l]=c)}}return[e,t,r,new Set(i)]},wI=(n,e,t,r)=>{const i=[];e:for(let[s,o,a]of n){if(a)continue;let l,c=0,u=!1;for(l in s){const h=s[l];let p=e[l];if(p!==h){if(typeof p!="object"||!p)continue e;{let m,g,_=0;for(const x in p){if(h===String(p[x])){if(x!=="@initial"){const v=x.slice(1);(g=g||[]).push(v in t?t[v]:x.replace(/^@media ?/,"")),u=!0}c+=_,m=!0}++_}if(g&&g.length&&(o={["@media "+g.join(", ")]:o}),!m)continue e}}}(i[c]=i[c]||[]).push([r?"cv":`${l}-${s[l]}`,o,u])}return i},KX={},YX=hh(),qX=(n,e)=>YX(n,()=>(...t)=>{const r=()=>{for(let i of t){i=typeof i=="object"&&i||{};let s=wc(i);if(!e.rules.global.cache.has(s)){if(e.rules.global.cache.add(s),"@import"in i){let o=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let a of[].concat(i["@import"]))a=a.includes('"')||a.includes("'")?a:`"${a}"`,e.sheet.insertRule(`@import ${a};`,o++);delete i["@import"]}cf(i,[],[],n,o=>{e.rules.global.apply(o)})}}return""};return bM(r,{toString:r})}),ZX=hh(),QX=(n,e)=>ZX(n,()=>t=>{const r=`${xa(n.prefix)}k-${wc(t)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const s=[];cf(t,[],[],n,a=>s.push(a));const o=`@keyframes ${r}{${s.join("")}}`;e.rules.global.apply(o)}return r};return bM(i,{get name(){return i()},toString:i})}),eJ=class{constructor(n,e,t,r){this.token=n==null?"":String(n),this.value=e==null?"":String(e),this.scale=t==null?"":String(t),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+xa(this.prefix)+xa(this.scale)+this.token}toString(){return this.computedValue}},tJ=hh(),nJ=(n,e)=>tJ(n,()=>(t,r)=>{r=typeof t=="object"&&t||Object(r);const i=`.${t=(t=typeof t=="string"?t:"")||`${xa(n.prefix)}t-${wc(r)}`}`,s={},o=[];for(const l in r){s[l]={};for(const c in r[l]){const u=`--${xa(n.prefix)}${l}-${c}`,h=rF(String(r[l][c]),n.prefix,l);s[l][c]=new eJ(c,h,l,n.prefix),o.push(`${u}:${h}`)}}const a=()=>{if(o.length&&!e.rules.themed.cache.has(t)){e.rules.themed.cache.add(t);const l=`${r===n.theme?":root,":""}.${t}{${o.join(";")}}`;e.rules.themed.apply(l)}return t};return{...s,get className(){return a()},selector:i,toString:a}}),rJ=hh(),iJ=hh(),sJ=n=>{const e=(t=>{let r=!1;const i=rJ(t,s=>{r=!0;const o="prefix"in(s=typeof s=="object"&&s||{})?String(s.prefix):"",a=typeof s.media=="object"&&s.media||{},l=typeof s.root=="object"?s.root||null:globalThis.document||null,c=typeof s.theme=="object"&&s.theme||{},u={prefix:o,media:a,theme:c,themeMap:typeof s.themeMap=="object"&&s.themeMap||{...BX},utils:typeof s.utils=="object"&&s.utils||{}},h=VX(l),p={css:AI(u,h),globalCss:qX(u,h),keyframes:QX(u,h),createTheme:nJ(u,h),reset(){h.reset(),p.theme.toString()},theme:{},sheet:h,config:u,prefix:o,getCssText:h.toString,toString:h.toString};return String(p.theme=p.createTheme(c)),p});return r||i.reset(),i})(n);return e.styled=(({config:t,sheet:r})=>iJ(t,()=>{const i=AI(t,r);return(...s)=>{const o=i(...s),a=o[Ac].type,l=Q.forwardRef((c,u)=>{const h=c&&c.as||a,{props:p,deferredInjector:m}=o(c);return delete p.as,p.ref=u,m?Q.createElement(Q.Fragment,null,Q.createElement(h,p),Q.createElement(m,null)):Q.createElement(h,p)});return l.className=o.className,l.displayName=`Styled.${a.displayName||a.name||a}`,l.selector=o.selector,l.toString=()=>o.selector,l[Ac]=o[Ac],l}}))(e),e};function na(n,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(n==null||n(i),t===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function iF(n,e=[]){let t=[];function r(s,o){const a=D.createContext(o),l=t.length;t=[...t,o];function c(h){const{scope:p,children:m,...g}=h,_=(p==null?void 0:p[n][l])||a,x=D.useMemo(()=>g,Object.values(g));return D.createElement(_.Provider,{value:x},m)}function u(h,p){const m=(p==null?void 0:p[n][l])||a,g=D.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const i=()=>{const s=t.map(o=>D.createContext(o));return function(a){const l=(a==null?void 0:a[n])||s;return D.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return i.scopeName=n,[r,oJ(i,...e)]}function oJ(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return D.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function dh(n){const e=D.useRef(n);return D.useEffect(()=>{e.current=n}),D.useMemo(()=>(...t)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...t)},[])}function aJ(n,e=globalThis==null?void 0:globalThis.document){const t=dh(n);D.useEffect(()=>{const r=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[t,e])}const $E="dismissableLayer.update",lJ="dismissableLayer.pointerDownOutside",cJ="dismissableLayer.focusOutside";let MI;const uJ=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fJ=D.forwardRef((n,e)=>{var t;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=n,u=D.useContext(uJ),[h,p]=D.useState(null),m=(t=h==null?void 0:h.ownerDocument)!==null&&t!==void 0?t:globalThis==null?void 0:globalThis.document,[,g]=D.useState({}),_=fh(e,I=>p(I)),x=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),E=x.indexOf(v),S=h?x.indexOf(h):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,C=S>=E,b=hJ(I=>{const R=I.target,L=[...u.branches].some(k=>k.contains(R));!C||L||(s==null||s(I),a==null||a(I),I.defaultPrevented||l==null||l())},m),B=dJ(I=>{const R=I.target;[...u.branches].some(k=>k.contains(R))||(o==null||o(I),a==null||a(I),I.defaultPrevented||l==null||l())},m);return aJ(I=>{S===u.layers.size-1&&(i==null||i(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))},m),D.useEffect(()=>{if(h)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(MI=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(h)),u.layers.add(h),TI(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=MI)}},[h,m,r,u]),D.useEffect(()=>()=>{h&&(u.layers.delete(h),u.layersWithOutsidePointerEventsDisabled.delete(h),TI())},[h,u]),D.useEffect(()=>{const I=()=>g({});return document.addEventListener($E,I),()=>document.removeEventListener($E,I)},[]),D.createElement(Jc.div,Hn({},c,{ref:_,style:{pointerEvents:w?C?"auto":"none":void 0,...n.style},onFocusCapture:na(n.onFocusCapture,B.onFocusCapture),onBlurCapture:na(n.onBlurCapture,B.onBlurCapture),onPointerDownCapture:na(n.onPointerDownCapture,b.onPointerDownCapture)}))});function hJ(n,e=globalThis==null?void 0:globalThis.document){const t=dh(n),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){sF(lJ,t,c,{discrete:!0})};var l=u;const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,t]),{onPointerDownCapture:()=>r.current=!0}}function dJ(n,e=globalThis==null?void 0:globalThis.document){const t=dh(n),r=D.useRef(!1);return D.useEffect(()=>{const i=s=>{s.target&&!r.current&&sF(cJ,t,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function TI(){const n=new CustomEvent($E);document.dispatchEvent(n)}function sF(n,e,t,{discrete:r}){const i=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&i.addEventListener(n,e,{once:!0}),r?MX(i,s):i.dispatchEvent(s)}const Uf=Boolean(globalThis==null?void 0:globalThis.document)?D.useLayoutEffect:()=>{},pJ=KU["useId".toString()]||(()=>{});let mJ=0;function gJ(n){const[e,t]=D.useState(pJ());return Uf(()=>{n||t(r=>r??String(mJ++))},[n]),n||(e?`radix-${e}`:"")}function ph(n){return n.split("-")[1]}function CM(n){return n==="y"?"height":"width"}function ua(n){return n.split("-")[0]}function Kc(n){return["top","bottom"].includes(ua(n))?"x":"y"}function bI(n,e,t){let{reference:r,floating:i}=n;const s=r.x+r.width/2-i.width/2,o=r.y+r.height/2-i.height/2,a=Kc(e),l=CM(a),c=r[l]/2-i[l]/2,u=a==="x";let h;switch(ua(e)){case"top":h={x:s,y:r.y-i.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:o};break;case"left":h={x:r.x-i.width,y:o};break;default:h={x:r.x,y:r.y}}switch(ph(e)){case"start":h[a]-=c*(t&&u?-1:1);break;case"end":h[a]+=c*(t&&u?-1:1)}return h}const vJ=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:u,y:h}=bI(c,r,l),p=r,m={},g=0;for(let _=0;_({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:a}=e,{element:l,padding:c=0}=Sa(n,e)||{};if(l==null)return{};const u=oF(c),h={x:t,y:r},p=Kc(i),m=CM(p),g=await o.getDimensions(l),_=p==="y",x=_?"top":"left",v=_?"bottom":"right",E=_?"clientHeight":"clientWidth",S=s.reference[m]+s.reference[p]-h[p]-s.floating[m],w=h[p]-s.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let b=C?C[E]:0;b&&await(o.isElement==null?void 0:o.isElement(C))||(b=a.floating[E]||s.floating[m]);const B=S/2-w/2,I=b/2-g[m]/2-1,R=Ip(u[x],I),L=Ip(u[v],I),k=R,X=b-g[m]-L,$=b/2-g[m]/2+B,Y=jE(k,$,X),Z=ph(i)!=null&&$!=Y&&s.reference[m]/2-($n.concat(e,e+"-start",e+"-end"),[]);const yJ={left:"right",right:"left",bottom:"top",top:"bottom"};function G0(n){return n.replace(/left|right|bottom|top/g,e=>yJ[e])}function _J(n,e,t){t===void 0&&(t=!1);const r=ph(n),i=Kc(n),s=CM(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=G0(o)),{main:o,cross:G0(o)}}const xJ={start:"end",end:"start"};function Ox(n){return n.replace(/start|end/g,e=>xJ[e])}const SJ=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t;const{placement:r,middlewareData:i,rects:s,initialPlacement:o,platform:a,elements:l}=e,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,..._}=Sa(n,e),x=ua(r),v=ua(o)===o,E=await(a.isRTL==null?void 0:a.isRTL(l.floating)),S=h||(v||!g?[G0(o)]:function(k){const X=G0(k);return[Ox(k),X,Ox(X)]}(o));h||m==="none"||S.push(...function(k,X,$,Y){const Z=ph(k);let ne=function(ie,G,te){const q=["left","right"],ue=["right","left"],K=["top","bottom"],ve=["bottom","top"];switch(ie){case"top":case"bottom":return te?G?ue:q:G?q:ue;case"left":case"right":return G?K:ve;default:return[]}}(ua(k),$==="start",Y);return Z&&(ne=ne.map(ie=>ie+"-"+Z),X&&(ne=ne.concat(ne.map(Ox)))),ne}(o,g,m,E));const w=[o,...S],C=await Pp(e,_),b=[];let B=((t=i.flip)==null?void 0:t.overflows)||[];if(c&&b.push(C[x]),u){const{main:k,cross:X}=_J(r,s,E);b.push(C[k],C[X])}if(B=[...B,{placement:r,overflows:b}],!b.every(k=>k<=0)){var I,R;const k=(((I=i.flip)==null?void 0:I.index)||0)+1,X=w[k];if(X)return{data:{index:k,overflows:B},reset:{placement:X}};let $=(R=B.filter(Y=>Y.overflows[0]<=0).sort((Y,Z)=>Y.overflows[1]-Z.overflows[1])[0])==null?void 0:R.placement;if(!$)switch(p){case"bestFit":{var L;const Y=(L=B.map(Z=>[Z.placement,Z.overflows.filter(ne=>ne>0).reduce((ne,ie)=>ne+ie,0)]).sort((Z,ne)=>Z[1]-ne[1])[0])==null?void 0:L[0];Y&&($=Y);break}case"initialPlacement":$=o}if(r!==$)return{reset:{placement:$}}}return{}}}};function RI(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function PI(n){return aF.some(e=>n[e]>=0)}const EJ=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=Sa(n,e);switch(r){case"referenceHidden":{const s=RI(await Pp(e,{...i,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:PI(s)}}}case"escaped":{const s=RI(await Pp(e,{...i,altBoundary:!0}),t.floating);return{data:{escapedOffsets:s,escaped:PI(s)}}}default:return{}}}}},AJ=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){const{x:t,y:r}=e,i=await async function(s,o){const{placement:a,platform:l,elements:c}=s,u=await(l.isRTL==null?void 0:l.isRTL(c.floating)),h=ua(a),p=ph(a),m=Kc(a)==="x",g=["left","top"].includes(h)?-1:1,_=u&&m?-1:1,x=Sa(o,s);let{mainAxis:v,crossAxis:E,alignmentAxis:S}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...x};return p&&typeof S=="number"&&(E=p==="end"?-1*S:S),m?{x:E*_,y:v*g}:{x:v*g,y:E*_}}(e,n);return{x:t+i.x,y:r+i.y,data:i}}}};function lF(n){return n==="x"?"y":"x"}const wJ=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:x=>{let{x:v,y:E}=x;return{x:v,y:E}}},...l}=Sa(n,e),c={x:t,y:r},u=await Pp(e,l),h=Kc(ua(i)),p=lF(h);let m=c[h],g=c[p];if(s){const x=h==="y"?"bottom":"right";m=jE(m+u[h==="y"?"top":"left"],m,m-u[x])}if(o){const x=p==="y"?"bottom":"right";g=jE(g+u[p==="y"?"top":"left"],g,g-u[x])}const _=a.fn({...e,[h]:m,[p]:g});return{..._,data:{x:_.x-t,y:_.y-r}}}}},MJ=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Sa(n,e),u={x:t,y:r},h=Kc(i),p=lF(h);let m=u[h],g=u[p];const _=Sa(a,e),x=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const S=h==="y"?"height":"width",w=s.reference[h]-s.floating[S]+x.mainAxis,C=s.reference[h]+s.reference[S]-x.mainAxis;mC&&(m=C)}if(c){var v,E;const S=h==="y"?"width":"height",w=["top","left"].includes(ua(i)),C=s.reference[p]-s.floating[S]+(w&&((v=o.offset)==null?void 0:v[p])||0)+(w?0:x.crossAxis),b=s.reference[p]+s.reference[S]+(w?0:((E=o.offset)==null?void 0:E[p])||0)-(w?x.crossAxis:0);gb&&(g=b)}return{[h]:m,[p]:g}}}},TJ=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:i,elements:s}=e,{apply:o=()=>{},...a}=Sa(n,e),l=await Pp(e,a),c=ua(t),u=ph(t),h=Kc(t)==="x",{width:p,height:m}=r.floating;let g,_;c==="top"||c==="bottom"?(g=c,_=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(_=c,g=u==="end"?"top":"bottom");const x=m-l[g],v=p-l[_],E=!e.middlewareData.shift;let S=x,w=v;if(h){const b=p-l.left-l.right;w=u||E?Ip(v,b):b}else{const b=m-l.top-l.bottom;S=u||E?Ip(x,b):b}if(E&&!u){const b=rc(l.left,0),B=rc(l.right,0),I=rc(l.top,0),R=rc(l.bottom,0);h?w=p-2*(b!==0||B!==0?b+B:rc(l.left,l.right)):S=m-2*(I!==0||R!==0?I+R:rc(l.top,l.bottom))}await o({...e,availableWidth:w,availableHeight:S});const C=await i.getDimensions(s.floating);return p!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}};function Hi(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Lo(n){return Hi(n).getComputedStyle(n)}function cF(n){return n instanceof Hi(n).Node}function _l(n){return cF(n)?(n.nodeName||"").toLowerCase():"#document"}function qs(n){return n instanceof HTMLElement||n instanceof Hi(n).HTMLElement}function II(n){return typeof ShadowRoot<"u"&&(n instanceof Hi(n).ShadowRoot||n instanceof ShadowRoot)}function Bp(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Lo(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(i)}function bJ(n){return["table","td","th"].includes(_l(n))}function XE(n){const e=RM(),t=Lo(n);return t.transform!=="none"||t.perspective!=="none"||!!t.containerType&&t.containerType!=="normal"||!e&&!!t.backdropFilter&&t.backdropFilter!=="none"||!e&&!!t.filter&&t.filter!=="none"||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function RM(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function $y(n){return["html","body","#document"].includes(_l(n))}const JE=Math.min,Sf=Math.max,V0=Math.round,Pv=Math.floor,xl=n=>({x:n,y:n});function uF(n){const e=Lo(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=qs(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=V0(t)!==s||V0(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function fa(n){return n instanceof Element||n instanceof Hi(n).Element}function PM(n){return fa(n)?n:n.contextElement}function Ef(n){const e=PM(n);if(!qs(e))return xl(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=uF(e);let o=(s?V0(t.width):t.width)/r,a=(s?V0(t.height):t.height)/i;return o&&Number.isFinite(o)||(o=1),a&&Number.isFinite(a)||(a=1),{x:o,y:a}}const CJ=xl(0);function fF(n){const e=Hi(n);return RM()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:CJ}function Uc(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=PM(n);let o=xl(1);e&&(r?fa(r)&&(o=Ef(r)):o=Ef(n));const a=function(p,m,g){return m===void 0&&(m=!1),!(!g||m&&g!==Hi(p))&&m}(s,t,r)?fF(s):xl(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s){const p=Hi(s),m=r&&fa(r)?Hi(r):r;let g=p.frameElement;for(;g&&r&&m!==p;){const _=Ef(g),x=g.getBoundingClientRect(),v=getComputedStyle(g),E=x.left+(g.clientLeft+parseFloat(v.paddingLeft))*_.x,S=x.top+(g.clientTop+parseFloat(v.paddingTop))*_.y;l*=_.x,c*=_.y,u*=_.x,h*=_.y,l+=E,c+=S,g=Hi(g).frameElement}}return H0({width:u,height:h,x:l,y:c})}function jy(n){return fa(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function ha(n){var e;return(e=(cF(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function hF(n){return Uc(ha(n)).left+jy(n).scrollLeft}function zf(n){if(_l(n)==="html")return n;const e=n.assignedSlot||n.parentNode||II(n)&&n.host||ha(n);return II(e)?e.host:e}function dF(n){const e=zf(n);return $y(e)?n.ownerDocument?n.ownerDocument.body:n.body:qs(e)&&Bp(e)?e:dF(e)}function W0(n,e){var t;e===void 0&&(e=[]);const r=dF(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=Hi(r);return i?e.concat(s,s.visualViewport||[],Bp(r)?r:[]):e.concat(r,W0(r))}function BI(n,e,t){let r;if(e==="viewport")r=function(i,s){const o=Hi(i),a=ha(i),l=o.visualViewport;let c=a.clientWidth,u=a.clientHeight,h=0,p=0;if(l){c=l.width,u=l.height;const m=RM();(!m||m&&s==="fixed")&&(h=l.offsetLeft,p=l.offsetTop)}return{width:c,height:u,x:h,y:p}}(n,t);else if(e==="document")r=function(i){const s=ha(i),o=jy(i),a=i.ownerDocument.body,l=Sf(s.scrollWidth,s.clientWidth,a.scrollWidth,a.clientWidth),c=Sf(s.scrollHeight,s.clientHeight,a.scrollHeight,a.clientHeight);let u=-o.scrollLeft+hF(i);const h=-o.scrollTop;return Lo(a).direction==="rtl"&&(u+=Sf(s.clientWidth,a.clientWidth)-l),{width:l,height:c,x:u,y:h}}(ha(n));else if(fa(e))r=function(i,s){const o=Uc(i,!0,s==="fixed"),a=o.top+i.clientTop,l=o.left+i.clientLeft,c=qs(i)?Ef(i):xl(1);return{width:i.clientWidth*c.x,height:i.clientHeight*c.y,x:l*c.x,y:a*c.y}}(e,t);else{const i=fF(n);r={...e,x:e.x-i.x,y:e.y-i.y}}return H0(r)}function pF(n,e){const t=zf(n);return!(t===e||!fa(t)||$y(t))&&(Lo(t).position==="fixed"||pF(t,e))}function RJ(n,e,t){const r=qs(e),i=ha(e),s=t==="fixed",o=Uc(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=xl(0);if(r||!r&&!s)if((_l(e)!=="body"||Bp(i))&&(a=jy(e)),qs(e)){const c=Uc(e,!0,s,e);l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}else i&&(l.x=hF(i));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function LI(n,e){return qs(n)&&Lo(n).position!=="fixed"?e?e(n):n.offsetParent:null}function DI(n,e){const t=Hi(n);if(!qs(n))return t;let r=LI(n,e);for(;r&&bJ(r)&&Lo(r).position==="static";)r=LI(r,e);return r&&(_l(r)==="html"||_l(r)==="body"&&Lo(r).position==="static"&&!XE(r))?t:r||function(i){let s=zf(i);for(;qs(s)&&!$y(s);){if(XE(s))return s;s=zf(s)}return null}(n)||t}const PJ={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{rect:e,offsetParent:t,strategy:r}=n;const i=qs(t),s=ha(t);if(t===s)return e;let o={scrollLeft:0,scrollTop:0},a=xl(1);const l=xl(0);if((i||!i&&r!=="fixed")&&((_l(t)!=="body"||Bp(s))&&(o=jy(t)),qs(t))){const c=Uc(t);a=Ef(t),l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}return{width:e.width*a.x,height:e.height*a.y,x:e.x*a.x-o.scrollLeft*a.x+l.x,y:e.y*a.y-o.scrollTop*a.y+l.y}},getDocumentElement:ha,getClippingRect:function(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const s=[...t==="clippingAncestors"?function(l,c){const u=c.get(l);if(u)return u;let h=W0(l).filter(_=>fa(_)&&_l(_)!=="body"),p=null;const m=Lo(l).position==="fixed";let g=m?zf(l):l;for(;fa(g)&&!$y(g);){const _=Lo(g),x=XE(g);x||_.position!=="fixed"||(p=null),(m?!x&&!p:!x&&_.position==="static"&&p&&["absolute","fixed"].includes(p.position)||Bp(g)&&!x&&pF(l,g))?h=h.filter(v=>v!==g):p=_,g=zf(g)}return c.set(l,h),h}(e,this._c):[].concat(t),r],o=s[0],a=s.reduce((l,c)=>{const u=BI(e,c,i);return l.top=Sf(u.top,l.top),l.right=JE(u.right,l.right),l.bottom=JE(u.bottom,l.bottom),l.left=Sf(u.left,l.left),l},BI(e,o,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:DI,getElementRects:async function(n){let{reference:e,floating:t,strategy:r}=n;const i=this.getOffsetParent||DI,s=this.getDimensions;return{reference:RJ(e,await i(t),r),floating:{x:0,y:0,...await s(t)}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){return uF(n)},getScale:Ef,isElement:fa,isRTL:function(n){return getComputedStyle(n).direction==="rtl"}};function IJ(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=PM(n),u=i||s?[...c?W0(c):[],...W0(e)]:[];u.forEach(x=>{i&&x.addEventListener("scroll",t,{passive:!0}),s&&x.addEventListener("resize",t)});const h=c&&a?function(x,v){let E,S=null;const w=ha(x);function C(){clearTimeout(E),S&&S.disconnect(),S=null}return function b(B,I){B===void 0&&(B=!1),I===void 0&&(I=1),C();const{left:R,top:L,width:k,height:X}=x.getBoundingClientRect();if(B||v(),!k||!X)return;const $={rootMargin:-Pv(L)+"px "+-Pv(w.clientWidth-(R+k))+"px "+-Pv(w.clientHeight-(L+X))+"px "+-Pv(R)+"px",threshold:Sf(0,JE(1,I))||1};let Y=!0;function Z(ne){const ie=ne[0].intersectionRatio;if(ie!==I){if(!Y)return b();ie?b(!1,ie):E=setTimeout(()=>{b(!1,1e-7)},100)}Y=!1}try{S=new IntersectionObserver(Z,{...$,root:w.ownerDocument})}catch{S=new IntersectionObserver(Z,$)}S.observe(x)}(!0),C}(c,t):null;let p,m=-1,g=null;o&&(g=new ResizeObserver(x=>{let[v]=x;v&&v.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{g&&g.observe(e)})),t()}),c&&!l&&g.observe(c),g.observe(e));let _=l?Uc(n):null;return l&&function x(){const v=Uc(n);!_||v.x===_.x&&v.y===_.y&&v.width===_.width&&v.height===_.height||t(),_=v,p=requestAnimationFrame(x)}(),t(),()=>{u.forEach(x=>{i&&x.removeEventListener("scroll",t),s&&x.removeEventListener("resize",t)}),h&&h(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(p)}}const BJ=(n,e,t)=>{const r=new Map,i={platform:PJ,...t},s={...i.platform,_c:r};return vJ(n,e,{...i,platform:s})},LJ=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:i}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?CI({element:r.current,padding:i}).fn(t):{}:r?CI({element:r,padding:i}).fn(t):{}}}};var l0=typeof document<"u"?D.useLayoutEffect:D.useEffect;function $0(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(!$0(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const s=i[r];if(!(s==="_owner"&&n.$$typeof)&&!$0(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function mF(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function OI(n,e){const t=mF(n);return Math.round(e*t)/t}function FI(n){const e=D.useRef(n);return l0(()=>{e.current=n}),e}function DJ(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,h]=D.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[p,m]=D.useState(r);$0(p,r)||m(r);const[g,_]=D.useState(null),[x,v]=D.useState(null),E=D.useCallback(ne=>{ne!=b.current&&(b.current=ne,_(ne))},[_]),S=D.useCallback(ne=>{ne!==B.current&&(B.current=ne,v(ne))},[v]),w=s||g,C=o||x,b=D.useRef(null),B=D.useRef(null),I=D.useRef(u),R=FI(l),L=FI(i),k=D.useCallback(()=>{if(!b.current||!B.current)return;const ne={placement:e,strategy:t,middleware:p};L.current&&(ne.platform=L.current),BJ(b.current,B.current,ne).then(ie=>{const G={...ie,isPositioned:!0};X.current&&!$0(I.current,G)&&(I.current=G,Mc.flushSync(()=>{h(G)}))})},[p,e,t,L]);l0(()=>{c===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(ne=>({...ne,isPositioned:!1})))},[c]);const X=D.useRef(!1);l0(()=>(X.current=!0,()=>{X.current=!1}),[]),l0(()=>{if(w&&(b.current=w),C&&(B.current=C),w&&C){if(R.current)return R.current(w,C,k);k()}},[w,C,k,R]);const $=D.useMemo(()=>({reference:b,floating:B,setReference:E,setFloating:S}),[E,S]),Y=D.useMemo(()=>({reference:w,floating:C}),[w,C]),Z=D.useMemo(()=>{const ne={position:t,left:0,top:0};if(!Y.floating)return ne;const ie=OI(Y.floating,u.x),G=OI(Y.floating,u.y);return a?{...ne,transform:"translate("+ie+"px, "+G+"px)",...mF(Y.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ie,top:G}},[t,a,Y.floating,u.x,u.y]);return D.useMemo(()=>({...u,update:k,refs:$,elements:Y,floatingStyles:Z}),[u,k,$,Y,Z])}const OJ=D.forwardRef((n,e)=>{const{children:t,width:r=10,height:i=5,...s}=n;return D.createElement(Jc.svg,Hn({},s,{ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),n.asChild?t:D.createElement("polygon",{points:"0,0 30,0 15,10"}))}),FJ=OJ;function NJ(n){const[e,t]=D.useState(void 0);return Uf(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}const gF="Popper",[vF,yF]=iF(gF),[kJ,_F]=vF(gF),UJ=n=>{const{__scopePopper:e,children:t}=n,[r,i]=D.useState(null);return D.createElement(kJ,{scope:e,anchor:r,onAnchorChange:i},t)},zJ="PopperAnchor",HJ=D.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...i}=n,s=_F(zJ,t),o=D.useRef(null),a=fh(e,o);return D.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:D.createElement(Jc.div,Hn({},i,{ref:a}))}),xF="PopperContent",[GJ,VJ]=vF(xF),WJ=D.forwardRef((n,e)=>{var t,r,i,s,o,a,l,c;const{__scopePopper:u,side:h="bottom",sideOffset:p=0,align:m="center",alignOffset:g=0,arrowPadding:_=0,collisionBoundary:x=[],collisionPadding:v=0,sticky:E="partial",hideWhenDetached:S=!1,avoidCollisions:w=!0,onPlaced:C,...b}=n,B=_F(xF,u),[I,R]=D.useState(null),L=fh(e,Ae=>R(Ae)),[k,X]=D.useState(null),$=NJ(k),Y=(t=$==null?void 0:$.width)!==null&&t!==void 0?t:0,Z=(r=$==null?void 0:$.height)!==null&&r!==void 0?r:0,ne=h+(m!=="center"?"-"+m:""),ie=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},G=Array.isArray(x)?x:[x],te=G.length>0,q={padding:ie,boundary:G.filter(JJ),altBoundary:te},{refs:ue,floatingStyles:K,placement:ve,isPositioned:pe,middlewareData:Le}=DJ({strategy:"fixed",placement:ne,whileElementsMounted:IJ,elements:{reference:B.anchor},middleware:[AJ({mainAxis:p+Z,alignmentAxis:g}),w&&wJ({mainAxis:!0,crossAxis:!1,limiter:E==="partial"?MJ():void 0,...q}),w&&SJ({...q}),TJ({...q,apply:({elements:Ae,rects:De,availableWidth:be,availableHeight:nt})=>{const{width:$e,height:Xe}=De.reference,ct=Ae.floating.style;ct.setProperty("--radix-popper-available-width",`${be}px`),ct.setProperty("--radix-popper-available-height",`${nt}px`),ct.setProperty("--radix-popper-anchor-width",`${$e}px`),ct.setProperty("--radix-popper-anchor-height",`${Xe}px`)}}),k&&LJ({element:k,padding:_}),KJ({arrowWidth:Y,arrowHeight:Z}),S&&EJ({strategy:"referenceHidden"})]}),[we,Fe]=SF(ve),et=dh(C);Uf(()=>{pe&&(et==null||et())},[pe,et]);const ft=(i=Le.arrow)===null||i===void 0?void 0:i.x,Pt=(s=Le.arrow)===null||s===void 0?void 0:s.y,st=((o=Le.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[J,Re]=D.useState();return Uf(()=>{I&&Re(window.getComputedStyle(I).zIndex)},[I]),D.createElement("div",{ref:ue.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:pe?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,["--radix-popper-transform-origin"]:[(a=Le.transformOrigin)===null||a===void 0?void 0:a.x,(l=Le.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:n.dir},D.createElement(GJ,{scope:u,placedSide:we,onArrowChange:X,arrowX:ft,arrowY:Pt,shouldHideArrow:st},D.createElement(Jc.div,Hn({"data-side":we,"data-align":Fe},b,{ref:L,style:{...b.style,animation:pe?void 0:"none",opacity:(c=Le.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))}),$J="PopperArrow",jJ={top:"bottom",right:"left",bottom:"top",left:"right"},XJ=D.forwardRef(function(e,t){const{__scopePopper:r,...i}=e,s=VJ($J,r),o=jJ[s.placedSide];return D.createElement("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0}},D.createElement(FJ,Hn({},i,{ref:t,style:{...i.style,display:"block"}})))});function JJ(n){return n!==null}const KJ=n=>({name:"transformOrigin",options:n,fn(e){var t,r,i,s,o;const{placement:a,rects:l,middlewareData:c}=e,h=((t=c.arrow)===null||t===void 0?void 0:t.centerOffset)!==0,p=h?0:n.arrowWidth,m=h?0:n.arrowHeight,[g,_]=SF(a),x={start:"0%",center:"50%",end:"100%"}[_],v=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+p/2,E=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+m/2;let S="",w="";return g==="bottom"?(S=h?x:`${v}px`,w=`${-m}px`):g==="top"?(S=h?x:`${v}px`,w=`${l.floating.height+m}px`):g==="right"?(S=`${-m}px`,w=h?x:`${E}px`):g==="left"&&(S=`${l.floating.width+m}px`,w=h?x:`${E}px`),{data:{x:S,y:w}}}});function SF(n){const[e,t="center"]=n.split("-");return[e,t]}const YJ=UJ,qJ=HJ,ZJ=WJ,QJ=XJ;function eK(n,e){return D.useReducer((t,r)=>{const i=e[t][r];return i??t},n)}const EF=n=>{const{present:e,children:t}=n,r=tK(e),i=typeof t=="function"?t({present:r.isPresent}):D.Children.only(t),s=fh(r.ref,i.ref);return typeof t=="function"||r.isPresent?D.cloneElement(i,{ref:s}):null};EF.displayName="Presence";function tK(n){const[e,t]=D.useState(),r=D.useRef({}),i=D.useRef(n),s=D.useRef("none"),o=n?"mounted":"unmounted",[a,l]=eK(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return D.useEffect(()=>{const c=Iv(r.current);s.current=a==="mounted"?c:"none"},[a]),Uf(()=>{const c=r.current,u=i.current;if(u!==n){const p=s.current,m=Iv(c);n?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=n}},[n,l]),Uf(()=>{if(e){const c=h=>{const m=Iv(r.current).includes(h.animationName);h.target===e&&m&&Mc.flushSync(()=>l("ANIMATION_END"))},u=h=>{h.target===e&&(s.current=Iv(r.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:D.useCallback(c=>{c&&(r.current=getComputedStyle(c)),t(c)},[])}}function Iv(n){return(n==null?void 0:n.animationName)||"none"}function nK({prop:n,defaultProp:e,onChange:t=()=>{}}){const[r,i]=rK({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:r,a=dh(t),l=D.useCallback(c=>{if(s){const h=typeof c=="function"?c(n):c;h!==n&&a(h)}else i(c)},[s,n,i,a]);return[o,l]}function rK({defaultProp:n,onChange:e}){const t=D.useState(n),[r]=t,i=D.useRef(r),s=dh(e);return D.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),t}const iK=D.forwardRef((n,e)=>D.createElement(Jc.span,Hn({},n,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...n.style}}))),sK=iK,[Xy,Tne]=iF("Tooltip",[yF]),Jy=yF(),oK="TooltipProvider",KE="tooltip.open",[bne,IM]=Xy(oK),BM="Tooltip",[aK,Ky]=Xy(BM),lK=n=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:i=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=n,l=IM(BM,n.__scopeTooltip),c=Jy(e),[u,h]=D.useState(null),p=gJ(),m=D.useRef(0),g=o??l.disableHoverableContent,_=a??l.delayDuration,x=D.useRef(!1),[v=!1,E]=nK({prop:r,defaultProp:i,onChange:B=>{B?(l.onOpen(),document.dispatchEvent(new CustomEvent(KE))):l.onClose(),s==null||s(B)}}),S=D.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),w=D.useCallback(()=>{window.clearTimeout(m.current),x.current=!1,E(!0)},[E]),C=D.useCallback(()=>{window.clearTimeout(m.current),E(!1)},[E]),b=D.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,E(!0)},_)},[_,E]);return D.useEffect(()=>()=>window.clearTimeout(m.current),[]),D.createElement(YJ,c,D.createElement(aK,{scope:e,contentId:p,open:v,stateAttribute:S,trigger:u,onTriggerChange:h,onTriggerEnter:D.useCallback(()=>{l.isOpenDelayed?b():w()},[l.isOpenDelayed,b,w]),onTriggerLeave:D.useCallback(()=>{g?C():window.clearTimeout(m.current)},[C,g]),onOpen:w,onClose:C,disableHoverableContent:g},t))},NI="TooltipTrigger",cK=D.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,i=Ky(NI,t),s=IM(NI,t),o=Jy(t),a=D.useRef(null),l=fh(e,a,i.onTriggerChange),c=D.useRef(!1),u=D.useRef(!1),h=D.useCallback(()=>c.current=!1,[]);return D.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),D.createElement(qJ,Hn({asChild:!0},o),D.createElement(Jc.button,Hn({"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute},r,{ref:l,onPointerMove:na(n.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:na(n.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:na(n.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:na(n.onFocus,()=>{c.current||i.onOpen()}),onBlur:na(n.onBlur,i.onClose),onClick:na(n.onClick,i.onClose)})))}),uK="TooltipPortal",[Cne,fK]=Xy(uK,{forceMount:void 0}),Lp="TooltipContent",hK=D.forwardRef((n,e)=>{const t=fK(Lp,n.__scopeTooltip),{forceMount:r=t.forceMount,side:i="top",...s}=n,o=Ky(Lp,n.__scopeTooltip);return D.createElement(EF,{present:r||o.open},o.disableHoverableContent?D.createElement(AF,Hn({side:i},s,{ref:e})):D.createElement(dK,Hn({side:i},s,{ref:e})))}),dK=D.forwardRef((n,e)=>{const t=Ky(Lp,n.__scopeTooltip),r=IM(Lp,n.__scopeTooltip),i=D.useRef(null),s=fh(e,i),[o,a]=D.useState(null),{trigger:l,onClose:c}=t,u=i.current,{onPointerInTransitChange:h}=r,p=D.useCallback(()=>{a(null),h(!1)},[h]),m=D.useCallback((g,_)=>{const x=g.currentTarget,v={x:g.clientX,y:g.clientY},E=yK(v,x.getBoundingClientRect()),S=_K(v,E),w=xK(_.getBoundingClientRect()),C=EK([...S,...w]);a(C),h(!0)},[h]);return D.useEffect(()=>()=>p(),[p]),D.useEffect(()=>{if(l&&u){const g=x=>m(x,u),_=x=>m(x,l);return l.addEventListener("pointerleave",g),u.addEventListener("pointerleave",_),()=>{l.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",_)}}},[l,u,m,p]),D.useEffect(()=>{if(o){const g=_=>{const x=_.target,v={x:_.clientX,y:_.clientY},E=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!SK(v,o);E?p():S&&(p(),c())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,u,o,c,p]),D.createElement(AF,Hn({},n,{ref:s}))}),[pK,mK]=Xy(BM,{isInside:!1}),AF=D.forwardRef((n,e)=>{const{__scopeTooltip:t,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=n,l=Ky(Lp,t),c=Jy(t),{onClose:u}=l;return D.useEffect(()=>(document.addEventListener(KE,u),()=>document.removeEventListener(KE,u)),[u]),D.useEffect(()=>{if(l.trigger){const h=p=>{const m=p.target;m!=null&&m.contains(l.trigger)&&u()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,u]),D.createElement(fJ,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:u},D.createElement(ZJ,Hn({"data-state":l.stateAttribute},c,a,{ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),D.createElement(Z3,null,r),D.createElement(pK,{scope:t,isInside:!0},D.createElement(sK,{id:l.contentId,role:"tooltip"},i||r))))}),gK="TooltipArrow",vK=D.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,i=Jy(t);return mK(gK,t).isInside?null:D.createElement(QJ,Hn({},i,r,{ref:e}))});function yK(n,e){const t=Math.abs(e.top-n.y),r=Math.abs(e.bottom-n.y),i=Math.abs(e.right-n.x),s=Math.abs(e.left-n.x);switch(Math.min(t,r,i,s)){case s:return"left";case i:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function _K(n,e,t=5){const r=[];switch(e){case"top":r.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":r.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":r.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":r.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return r}function xK(n){const{top:e,right:t,bottom:r,left:i}=n;return[{x:i,y:e},{x:t,y:e},{x:t,y:r},{x:i,y:r}]}function SK(n,e){const{x:t,y:r}=n;let i=!1;for(let s=0,o=e.length-1;sr!=u>r&&t<(c-a)*(r-l)/(u-l)+a&&(i=!i)}return i}function EK(n){const e=n.slice();return e.sort((t,r)=>t.xr.x?1:t.yr.y?1:0),AK(e)}function AK(n){if(n.length<=1)return n.slice();const e=[];for(let r=0;r=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const t=[];for(let r=n.length-1;r>=0;r--){const i=n[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}const wK=lK,MK=cK,TK=hK,bK=vK;function CK(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s=0)&&(t[i]=n[i]);return t}function cn(n,e){if(n==null)return{};var t=CK(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}let Dn;(function(n){n[n.UNSUPPORTED_INPUT=0]="UNSUPPORTED_INPUT",n[n.NO_COMPONENT_FOR_TYPE=1]="NO_COMPONENT_FOR_TYPE",n[n.UNKNOWN_INPUT=2]="UNKNOWN_INPUT",n[n.DUPLICATE_KEYS=3]="DUPLICATE_KEYS",n[n.ALREADY_REGISTERED_TYPE=4]="ALREADY_REGISTERED_TYPE",n[n.CLIPBOARD_ERROR=5]="CLIPBOARD_ERROR",n[n.THEME_ERROR=6]="THEME_ERROR",n[n.PATH_DOESNT_EXIST=7]="PATH_DOESNT_EXIST",n[n.INPUT_TYPE_OVERRIDE=8]="INPUT_TYPE_OVERRIDE",n[n.EMPTY_KEY=9]="EMPTY_KEY"})(Dn||(Dn={}));const RK={[Dn.UNSUPPORTED_INPUT]:(n,e)=>[`An input with type \`${n}\` input was found at path \`${e}\` but it's not supported yet.`],[Dn.NO_COMPONENT_FOR_TYPE]:(n,e)=>[`Type \`${n}\` found at path \`${e}\` can't be displayed in panel because no component supports it yet.`],[Dn.UNKNOWN_INPUT]:(n,e)=>[`input at path \`${n}\` is not recognized.`,e],[Dn.DUPLICATE_KEYS]:(n,e,t)=>[`Key \`${n}\` of path \`${e}\` already exists at path \`${t}\`. Even nested keys need to be unique. Rename one of the keys.`],[Dn.ALREADY_REGISTERED_TYPE]:n=>[`Type ${n} has already been registered. You can't register a component with the same type.`],[Dn.CLIPBOARD_ERROR]:n=>["Error copying the value",n],[Dn.THEME_ERROR]:(n,e)=>[`Error accessing the theme \`${n}.${e}\` value.`],[Dn.PATH_DOESNT_EXIST]:n=>[`Error getting the value at path \`${n}\`. There is probably an error in your \`render\` function.`],[Dn.PATH_DOESNT_EXIST]:n=>[`Error accessing the value at path \`${n}\``],[Dn.INPUT_TYPE_OVERRIDE]:(n,e,t)=>[`Input at path \`${n}\` already exists with type: \`${e}\`. Its type cannot be overridden with type \`${t}\`.`],[Dn.EMPTY_KEY]:()=>["Keys can not be empty, if you want to hide a label use whitespace."]};function wF(n,e,...t){const[r,...i]=RK[e](...t);console[n]("LEVA: "+r,...i)}const ia=wF.bind(null,"warn"),PK=wF.bind(null,"log"),IK=["value"],BK=["schema"],LK=["value"],MF=[],zc={};function kI(n){let{value:e}=n,t=cn(n,IK);for(let r of MF){const i=r(e,t);if(i)return i}}function Ta(n,e){let{schema:t}=e,r=cn(e,BK);if(n in zc){ia(Dn.ALREADY_REGISTERED_TYPE,n);return}MF.push((i,s)=>t(i,s)&&n),zc[n]=r}function Fx(n,e,t,r){const{normalize:i}=zc[n];if(i)return i(e,t,r);if(typeof e!="object"||!("value"in e))return{value:e};const{value:s}=e,o=cn(e,LK);return{value:s,settings:o}}function DK(n,e,t,r,i,s){const{sanitize:o}=zc[n];return o?o(e,t,r,i,s):e}function UI(n,e,t){const{format:r}=zc[n];return r?r(e,t):e}function OK(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zI(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function St(n){for(var e=1;en>t?t:n{if(n===""||typeof n=="number")return n;try{const e=Va(n);if(!isNaN(e))return e}catch{}return parseFloat(n)},NK=Math.log(10);function HI(n){let e=Math.abs(+String(n).replace(".",""));if(e===0)return .01;for(;e!==0&&e%10===0;)e/=10;const t=Math.floor(Math.log(e)/NK)+1,r=Math.floor(Math.log10(Math.abs(n))),i=Math.pow(10,r-t);return Math.max(i,.001)}const j0=(n,e,t)=>t===e?0:(Sl(n,e,t)-e)/(t-e),X0=(n,e,t)=>n*(t-e)+e,kK=()=>"_"+Math.random().toString(36).substr(2,9),GI=/\(([0-9+\-*/^ .]+)\)/,VI=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,WI=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,$I=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,jI=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,XI=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function Va(n){if(isNaN(Number(n)))if(GI.test(n)){const e=n.replace(GI,(t,r)=>String(Va(r)));return Va(e)}else if(VI.test(n)){const e=n.replace(VI,(t,r,i)=>String(Math.pow(Number(r),Number(i))));return Va(e)}else if(WI.test(n)){const e=n.replace(WI,(t,r,i)=>String(Number(r)*Number(i)));return Va(e)}else if($I.test(n)){const e=n.replace($I,(t,r,i)=>{if(i!=0)return String(Number(r)/Number(i));throw new Error("Division by zero")});return Va(e)}else if(jI.test(n)){const e=n.replace(jI,(t,r,i)=>String(Number(r)+Number(i)));return Va(e)}else if(XI.test(n)){const e=n.replace(XI,(t,r,i)=>String(Number(r)-Number(i)));return Va(e)}else return Number(n);return Number(n)}function UK(n,e){return e.reduce((t,r)=>(n&&n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}function zK(n,e){const t=St({},n);return e.forEach(r=>r in n&&delete t[r]),t}function HK(n,e){return n.reduce((t,r,i)=>Object.assign(t,{[e[i]]:r}),{})}function TF(n){return Object.prototype.toString.call(n)==="[object Object]"}const GK=n=>TF(n)&&Object.keys(n).length===0;let $s;(function(n){n.BUTTON="BUTTON",n.BUTTON_GROUP="BUTTON_GROUP",n.MONITOR="MONITOR",n.FOLDER="FOLDER"})($s||($s={}));let Zs;(function(n){n.SELECT="SELECT",n.IMAGE="IMAGE",n.NUMBER="NUMBER",n.COLOR="COLOR",n.STRING="STRING",n.BOOLEAN="BOOLEAN",n.INTERVAL="INTERVAL",n.VECTOR3D="VECTOR3D",n.VECTOR2D="VECTOR2D"})(Zs||(Zs={}));const VK=["type","__customInput"],WK=["render","label","optional","order","disabled","hint","onChange","onEditStart","onEditEnd","transient"],$K=["type"];function bF(n,e,t={},r){var i,s;if(typeof n!="object"||Array.isArray(n))return{type:r,input:n,options:St({key:e,label:e,optional:!1,disabled:!1,order:0},t)};if("__customInput"in n){const{type:C,__customInput:b}=n,B=cn(n,VK);return bF(b,e,B,C)}const{render:o,label:a,optional:l,order:c=0,disabled:u,hint:h,onChange:p,onEditStart:m,onEditEnd:g,transient:_}=n,x=cn(n,WK),v=St({render:o,key:e,label:a??e,hint:h,transient:_??!!p,onEditStart:m,onEditEnd:g,disabled:u,optional:l,order:c},t);let{type:E}=x,S=cn(x,$K);if(E=r??E,E in $s)return{type:E,input:S,options:v};let w;return r&&TF(S)&&"value"in S?w=S.value:w=GK(S)?void 0:S,{type:E,input:w,options:St(St({},v),{},{onChange:p,optional:(i=v.optional)!==null&&i!==void 0?i:!1,disabled:(s=v.disabled)!==null&&s!==void 0?s:!1})}}function jK(n,e,t,r){const i=bF(n,e),{type:s,input:o,options:a}=i;if(s)return s in $s?i:{type:s,input:Fx(s,o,t,r),options:a};let l=kI(o);return l?{type:l,input:Fx(l,o,t,r),options:a}:(l=kI({value:o}),l?{type:l,input:Fx(l,{value:o},t,r),options:a}:!1)}function JI(n,e,t,r,i){const{value:s,type:o,settings:a}=n;n.value=CF({type:o,value:s,settings:a},e,t,r),n.fromPanel=i}const XK=function(e,t,r){this.type="LEVA_ERROR",this.message="LEVA: "+e,this.previousValue=t,this.error=r};function CF({type:n,value:e,settings:t},r,i,s){const o=n!=="SELECT"&&typeof r=="function"?r(e):r;let a;try{a=DK(n,o,t,e,i,s)}catch(l){throw new XK(`The value \`${r}\` did not result in a correct value.`,e,l)}return Cp(a,e)?e:a}const RF=(n,e,t=!1)=>{let r=0;return function(){const i=arguments,s=t&&!r,o=()=>n.apply(this,i);window.clearTimeout(r),r=window.setTimeout(o,e),s&&o()}},PF=n=>n.shiftKey?5:n.altKey?1/5:1;function JK(n,e){const t=console.error;console.error=()=>{},uD.render(n,e),console.error=t}const KK=["value"],YK=["min","max"],qK=n=>{if(typeof n=="number")return!0;if(typeof n=="string"){const e=parseFloat(n);return isNaN(e)?!1:n.substring((""+e).length).trim().length<4}return!1},IF=(n,{min:e=-1/0,max:t=1/0,suffix:r})=>{const i=parseFloat(n);if(n===""||isNaN(i))throw Error("Invalid number");const s=Sl(i,e,t);return r?s+r:s},ZK=(n,{pad:e=0,suffix:t})=>{const r=parseFloat(n).toFixed(e);return t?r+t:r},BF=n=>{let{value:e}=n,t=cn(n,KK);const{min:r=-1/0,max:i=1/0}=t,s=cn(t,YK);let o=parseFloat(e);const a=typeof e=="string"?e.substring((""+o).length):void 0;o=Sl(o,r,i);let l=t.step;l||(Number.isFinite(r)?Number.isFinite(i)?l=+(Math.abs(i-r)/100).toPrecision(1):l=+(Math.abs(o-r)/100).toPrecision(1):Number.isFinite(i)&&(l=+(Math.abs(i-o)/100).toPrecision(1)));const c=l?HI(l)*10:HI(o);l=l||c/10;const u=Math.round(Sl(Math.log10(1/c),0,2));return{value:a?o+a:o,settings:St({initialValue:o,step:l,pad:u,min:r,max:i,suffix:a},s)}},LF=(n,{step:e,initialValue:t})=>{const r=Math.round((n-t)/e);return t+r*e};var DF=Object.freeze({__proto__:null,schema:qK,sanitize:IF,format:ZK,normalize:BF,sanitizeStep:LF});function Jn(){return Jn=Object.assign?Object.assign.bind():function(n){for(var e=1;e({colors:{elevation1:"#292d39",elevation2:"#181c20",elevation3:"#373c4b",accent1:"#0066dc",accent2:"#007bff",accent3:"#3c93ff",highlight1:"#535760",highlight2:"#8c92a4",highlight3:"#fefefe",vivid1:"#ffcc00",folderWidgetColor:"$highlight2",folderTextColor:"$highlight3",toolTipBackground:"$highlight3",toolTipText:"$elevation2"},radii:{xs:"2px",sm:"3px",lg:"10px"},space:{xs:"3px",sm:"6px",md:"10px",rowGap:"7px",colGap:"7px"},fonts:{mono:"ui-monospace, SFMono-Regular, Menlo, 'Roboto Mono', monospace",sans:"system-ui, sans-serif"},fontSizes:{root:"11px",toolTip:"$root"},sizes:{rootWidth:"280px",controlWidth:"160px",numberInputMinWidth:"38px",scrubberWidth:"8px",scrubberHeight:"16px",rowHeight:"24px",folderTitleHeight:"20px",checkboxSize:"16px",joystickWidth:"100px",joystickHeight:"100px",colorPickerWidth:"$controlWidth",colorPickerHeight:"100px",imagePreviewWidth:"$controlWidth",imagePreviewHeight:"100px",monitorHeight:"60px",titleBarHeight:"39px"},shadows:{level1:"0 0 9px 0 #00000088",level2:"0 4px 14px #00000033"},borderWidths:{root:"0px",input:"1px",focus:"1px",hover:"1px",active:"1px",folder:"1px"},fontWeights:{label:"normal",folder:"normal",button:"normal"}});function Bv(n,e){const[t,r]=n.split(" "),i={};return t!=="none"&&(i.boxShadow=`${e.inset?"inset ":""}0 0 0 $borderWidths${[e.key]} $colors${t!=="default"&&t||e.borderColor}`),r&&(i.backgroundColor=r),i}const dd={$inputStyle:()=>n=>Bv(n,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>n=>Bv(n,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>n=>Bv(n,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>n=>Bv(n,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:_t,css:Rne,createTheme:eY,globalCss:tY,keyframes:Pne}=sJ({prefix:"leva",theme:kF(),utils:St(St({},dd),{},{$flex:()=>({display:"flex",alignItems:"center"}),$flexCenter:()=>({display:"flex",alignItems:"center",justifyContent:"center"}),$reset:()=>({outline:"none",fontSize:"inherit",fontWeight:"inherit",color:"inherit",fontFamily:"inherit",border:"none",backgroundColor:"transparent",appearance:"none"}),$draggable:()=>({touchAction:"none",WebkitUserDrag:"none",userSelect:"none"}),$focus:n=>({"&:focus":dd.$focusStyle()(n)}),$focusWithin:n=>({"&:focus-within":dd.$focusStyle()(n)}),$hover:n=>({"&:hover":dd.$hoverStyle()(n)}),$active:n=>({"&:active":dd.$activeStyle()(n)})})}),nY=tY({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});function rY(n){const e=kF();if(!n)return{theme:e,className:""};Object.keys(n).forEach(r=>{Object.assign(e[r],n[r])});const t=eY(e);return{theme:e,className:t.className}}function da(n,e){const{theme:t}=D.useContext(LM);if(!(n in t)||!(e in t[n]))return ia(Dn.THEME_ERROR,n,e),"";let r=e;for(;;){let i=t[n][r];if(typeof i=="string"&&i.charAt(0)==="$")r=i.substr(1);else return i}}const UF=_t("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),zF=_t("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${UF}`]:{paddingLeft:0}}),iY=_t(zF,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),sY=_t("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),oY=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],aY=["onUpdate"];function DM(n){let{innerLabel:e,value:t,onUpdate:r,onChange:i,onKeyDown:s,type:o,id:a,inputType:l="text",rows:c=0}=n,u=cn(n,oY);const{id:h,emitOnEditStart:p,emitOnEditEnd:m,disabled:g}=jr(),_=a||h,x=D.useRef(null),v=c>0,E=v?"textarea":"input",S=D.useCallback(b=>B=>{const I=B.currentTarget.value;b(I)},[]);Q.useEffect(()=>{const b=x.current,B=S(I=>{r(I),m()});return b==null||b.addEventListener("blur",B),()=>b==null?void 0:b.removeEventListener("blur",B)},[S,r,m]);const w=D.useCallback(b=>{b.key==="Enter"&&S(r)(b)},[S,r]),C=Object.assign({as:E},v?{rows:c}:{},u);return Q.createElement(sY,{textArea:v},e&&typeof e=="string"?Q.createElement(zF,null,e):e,Q.createElement(UF,Jn({levaType:o,ref:x,id:_,type:l,autoComplete:"off",spellCheck:"false",value:t,onChange:S(i),onFocus:()=>p(),onKeyPress:w,onKeyDown:s,disabled:g},C)))}function lY(n){let{onUpdate:e}=n,t=cn(n,aY);const r=D.useCallback(s=>e(FK(s)),[e]),i=D.useCallback(s=>{const o=s.key==="ArrowUp"?1:s.key==="ArrowDown"?-1:0;if(o){s.preventDefault();const a=s.altKey?.1:s.shiftKey?10:1;e(l=>parseFloat(l)+o*a)}},[e]);return Q.createElement(DM,Jn({},t,{onUpdate:r,onKeyDown:i,type:"number"}))}const J0=_t("div",{}),YE=_t("div",{position:"relative",background:"$elevation2",transition:"height 300ms ease",variants:{fill:{true:{},false:{}},flat:{false:{},true:{}},isRoot:{true:{},false:{paddingLeft:"$md","&::after":{content:'""',position:"absolute",left:0,top:0,width:"$borderWidths$folder",height:"100%",backgroundColor:"$folderWidgetColor",opacity:.4,transform:"translateX(-50%)"}}}},compoundVariants:[{isRoot:!0,fill:!1,css:{overflowY:"auto",maxHeight:"calc(100vh - 20px - $$titleBarHeight)"}},{isRoot:!0,flat:!1,css:{borderRadius:"$lg"}}]}),cY=_t("div",{$flex:"",color:"$folderTextColor",userSelect:"none",cursor:"pointer",height:"$folderTitleHeight",fontWeight:"$folder","> svg":{marginLeft:-4,marginRight:4,cursor:"pointer",fill:"$folderWidgetColor",opacity:.6},"&:hover > svg":{fill:"$folderWidgetColor"},[`&:hover + ${YE}::after`]:{opacity:.6},[`${J0}:hover > & + ${YE}::after`]:{opacity:.6},[`${J0}:hover > & > svg`]:{opacity:1}}),HF=_t("div",{position:"relative",display:"grid",gridTemplateColumns:"100%",rowGap:"$rowGap",transition:"opacity 250ms ease",variants:{toggled:{true:{opacity:1,transitionDelay:"250ms"},false:{opacity:0,transitionDelay:"0ms",pointerEvents:"none"}},isRoot:{true:{"& > div":{paddingLeft:"$md",paddingRight:"$md"},"& > div:first-of-type":{paddingTop:"$sm"},"& > div:last-of-type":{paddingBottom:"$sm"},[`> ${J0}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),GF=_t("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${HF} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),VF=_t(GF,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),uY=_t("div",{$flex:"",height:"100%",position:"relative",overflow:"hidden","& > div":{marginLeft:"$colGap",padding:"0 $xs",opacity:.4},"& > div:hover":{opacity:.8},"& > div > svg":{display:"none",cursor:"pointer",width:13,minWidth:13,height:13,backgroundColor:"$elevation2"},"&:hover > div > svg":{display:"block"},variants:{align:{top:{height:"100%",alignItems:"flex-start",paddingTop:"$sm"}}}}),fY=_t("input",{$reset:"",height:0,width:0,opacity:0,margin:0,"& + label":{position:"relative",$flexCenter:"",height:"100%",userSelect:"none",cursor:"pointer",paddingLeft:2,paddingRight:"$sm",pointerEvents:"auto"},"& + label:after":{content:'""',width:6,height:6,backgroundColor:"$elevation3",borderRadius:"50%",$activeStyle:""},"&:focus + label:after":{$focusStyle:""},"& + label:active:after":{backgroundColor:"$accent1",$focusStyle:""},"&:checked + label:after":{backgroundColor:"$accent1"}}),qE=_t("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}}),hY=_t("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${qE}`]:{pointerEvents:"auto"}}}}}),WF=_t("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"}),dY=_t("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),pY=_t(bK,{fill:"$toolTipBackground"});function OM({children:n}){const{className:e}=D.useContext(LM);return Q.createElement(bX,{className:e},n)}const mY=["align"];function gY(){const{id:n,disable:e,disabled:t}=jr();return Q.createElement(Q.Fragment,null,Q.createElement(fY,{id:n+"__disable",type:"checkbox",checked:!t,onChange:()=>e(!t)}),Q.createElement("label",{htmlFor:n+"__disable"}))}function vY(n){const{id:e,optional:t,hint:r}=jr(),i=n.htmlFor||(e?{htmlFor:e}:null),s=!r&&typeof n.children=="string"?{title:n.children}:null;return Q.createElement(Q.Fragment,null,t&&Q.createElement(gY,null),r!==void 0?Q.createElement(wK,null,Q.createElement(MK,{asChild:!0},Q.createElement(qE,Jn({},i,n))),Q.createElement(TK,{side:"top",sideOffset:2},Q.createElement(dY,null,r,Q.createElement(pY,null)))):Q.createElement(qE,Jn({},i,s,n)))}function ro(n){let{align:e}=n,t=cn(n,mY);const{value:r,label:i,key:s,disabled:o}=jr(),{hideCopyButton:a}=QK(),l=!a&&s!==void 0,[c,u]=D.useState(!1),h=async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[s]:r??""})),u(!0)}catch{ia(Dn.CLIPBOARD_ERROR,{[s]:r})}};return Q.createElement(uY,{align:e,onPointerLeave:()=>u(!1)},Q.createElement(vY,t),l&&!o&&Q.createElement("div",{title:`Click to copy ${typeof i=="string"?i:s} value`},c?Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Q.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),Q.createElement("path",{fillRule:"evenodd",d:"M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})):Q.createElement("svg",{onClick:h,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Q.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),Q.createElement("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"}))))}const yY=["toggled"],_Y=_t("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function FM(n){let{toggled:e}=n,t=cn(n,yY);return Q.createElement(_Y,Jn({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e?0:-90}deg)`}},t),Q.createElement("path",{d:"M3.8 4.4c.4.3 1 .3 1.4 0L8 1.7A1 1 0 007.4 0H1.6a1 1 0 00-.7 1.7l3 2.7z"}))}const xY=["input"];function Ts(n){let{input:e}=n,t=cn(n,xY);return e?Q.createElement(VF,t):Q.createElement(GF,t)}function $F({value:n,type:e,settings:t,setValue:r}){const[i,s]=D.useState(UI(e,n,t)),o=D.useRef(n),a=D.useRef(t);a.current=t;const l=D.useCallback(u=>s(UI(e,u,a.current)),[e]),c=D.useCallback(u=>{try{r(u)}catch(h){const{type:p,previousValue:m}=h;if(p!=="LEVA_ERROR")throw h;l(m)}},[l,r]);return D.useEffect(()=>{Cp(n,o.current)||l(n),o.current=n},[n,l]),{displayValue:i,onChange:s,onUpdate:c}}function mm(n,e){const{emitOnEditStart:t,emitOnEditEnd:r}=jr();return G7(i=>{i.first&&(document.body.classList.add("leva__panel__dragged"),t==null||t());const s=n(i);return i.last&&(document.body.classList.remove("leva__panel__dragged"),r==null||r()),s},e)}function SY(n){const e=D.useRef(null),t=D.useRef(null),r=D.useRef(!1);return D.useEffect(()=>{const i=RF(()=>{e.current.width=e.current.offsetWidth*window.devicePixelRatio,e.current.height=e.current.offsetHeight*window.devicePixelRatio,n(e.current,t.current)},250);return window.addEventListener("resize",i),r.current||(i(),r.current=!0),()=>window.removeEventListener("resize",i)},[n]),D.useEffect(()=>{t.current=e.current.getContext("2d")},[]),[e,t]}function jF(){const n=D.useRef(null),e=D.useRef({x:0,y:0}),t=D.useCallback(r=>{Object.assign(e.current,r),n.current&&(n.current.style.transform=`translate3d(${e.current.x}px, ${e.current.y}px, 0)`)},[]);return[n,t]}const EY=["__refCount"],Nx=(n,e)=>{if(!n[e])return null;const t=n[e];return cn(t,EY)};function AY(n){const e=pm(),[t,r]=D.useState(Nx(e.getData(),n)),i=D.useCallback(c=>e.setValueAtPath(n,c,!0),[n,e]),s=D.useCallback(c=>e.setSettingsAtPath(n,c),[n,e]),o=D.useCallback(c=>e.disableInputAtPath(n,c),[n,e]),a=D.useCallback(()=>e.emitOnEditStart(n),[n,e]),l=D.useCallback(()=>e.emitOnEditEnd(n),[n,e]);return D.useEffect(()=>{r(Nx(e.getData(),n));const c=e.useStore.subscribe(u=>Nx(u.data,n),r,{equalityFn:dm});return()=>c()},[e,n]),[t,{set:i,setSettings:s,disable:o,storeId:e.storeId,emitOnEditStart:a,emitOnEditEnd:l}]}const wY=_t("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),XF=_t("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),ZE=_t("div",{position:"absolute",width:"$scrubberWidth",height:"$scrubberHeight",borderRadius:"$xs",boxShadow:"0 0 0 2px $colors$elevation2",backgroundColor:"$accent2",cursor:"pointer",$active:"none $accent1",$hover:"none $accent3",variants:{position:{left:{borderTopRightRadius:0,borderBottomRightRadius:0,transform:"translateX(calc(-0.5 * ($sizes$scrubberWidth + 4px)))"},right:{borderTopLeftRadius:0,borderBottomLeftRadius:0,transform:"translateX(calc(0.5 * ($sizes$scrubberWidth + 4px)))"}}}}),JF=_t("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),KF=_t("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function MY({value:n,min:e,max:t,onDrag:r,step:i,initialValue:s}){const o=D.useRef(null),a=D.useRef(null),l=D.useRef(0),c=da("sizes","scrubberWidth"),u=mm(({event:p,first:m,xy:[g],movement:[_],memo:x})=>{if(m){const{width:E,left:S}=o.current.getBoundingClientRect();l.current=E-parseFloat(c),x=(p==null?void 0:p.target)===a.current?n:X0((g-S)/E,e,t)}const v=x+X0(_/l.current,0,t-e);return r(LF(v,{step:i,initialValue:s})),x}),h=j0(n,e,t);return Q.createElement(JF,Jn({ref:o},u()),Q.createElement(XF,null,Q.createElement(KF,{style:{left:0,right:`${(1-h)*100}%`}})),Q.createElement(ZE,{ref:a,style:{left:`calc(${h} * (100% - ${c}))`}}))}const TY=Q.memo(({label:n,onUpdate:e,step:t,innerLabelTrim:r})=>{const[i,s]=D.useState(!1),o=mm(({active:a,delta:[l],event:c,memo:u=0})=>(s(a),u+=l/2,Math.abs(u)>=1&&(e(h=>parseFloat(h)+Math.floor(u)*t*PF(c)),u=0),u));return Q.createElement(iY,Jn({dragging:i,title:n.length>1?n:""},o()),n.slice(0,r))});function YF({label:n,id:e,displayValue:t,onUpdate:r,onChange:i,settings:s,innerLabelTrim:o=1}){const a=o>0&&Q.createElement(TY,{label:n,step:s.step,onUpdate:r,innerLabelTrim:o});return Q.createElement(lY,{id:e,value:String(t),onUpdate:r,onChange:i,innerLabel:a})}function bY(){const n=jr(),{label:e,value:t,onUpdate:r,settings:i,id:s}=n,{min:o,max:a}=i,l=a!==1/0&&o!==-1/0;return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,e),Q.createElement(wY,{hasRange:l},l&&Q.createElement(MY,Jn({value:parseFloat(t),onDrag:r},i)),Q.createElement(YF,Jn({},n,{id:s,label:"value",innerLabelTrim:l?0:1}))))}const{sanitizeStep:CY}=DF,RY=cn(DF,["sanitizeStep"]);var PY=St({component:bY},RY);const IY=(n,e)=>Ei().schema({options:Ei().passesAnyOf(Ei().object(),Ei().array())}).test(e),BY=(n,{values:e})=>{if(e.indexOf(n)<0)throw Error("Selected value doesn't match Select options");return n},LY=(n,{values:e})=>e.indexOf(n),DY=n=>{let{value:e,options:t}=n,r,i;return Array.isArray(t)?(i=t,r=t.map(s=>String(s))):(i=Object.values(t),r=Object.keys(t)),"value"in n?i.includes(e)||(r.unshift(String(e)),i.unshift(e)):e=i[0],Object.values(t).includes(e)||(t[String(e)]=e),{value:e,settings:{keys:r,values:i}}};var OY=Object.freeze({__proto__:null,schema:IY,sanitize:BY,format:LY,normalize:DY});const FY=_t("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),QE=_t("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),NY=_t("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${QE}:focus + &`]:{$focusStyle:""},[`${QE}:hover + &`]:{$hoverStyle:""}});function kY({displayValue:n,value:e,onUpdate:t,id:r,settings:i,disabled:s}){const{keys:o,values:a}=i,l=D.useRef();return e===a[n]&&(l.current=o[n]),Q.createElement(FY,null,Q.createElement(QE,{id:r,value:n,onChange:c=>t(a[Number(c.currentTarget.value)]),disabled:s},o.map((c,u)=>Q.createElement("option",{key:c,value:u},c))),Q.createElement(NY,null,l.current),Q.createElement(FM,{toggled:!0}))}function UY(){const{label:n,value:e,displayValue:t,onUpdate:r,id:i,disabled:s,settings:o}=jr();return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,n),Q.createElement(kY,{id:i,value:e,displayValue:t,onUpdate:r,settings:o,disabled:s}))}var zY=St({component:UY},OY);const HY=n=>Ei().string().test(n),GY=n=>{if(typeof n!="string")throw Error("Invalid string");return n},VY=({value:n,editable:e=!0,rows:t=!1})=>({value:n,settings:{editable:e,rows:typeof t=="number"?t:t?5:0}});var WY=Object.freeze({__proto__:null,schema:HY,sanitize:GY,normalize:VY});const $Y=["displayValue","onUpdate","onChange","editable"],jY=_t("div",{whiteSpace:"pre-wrap"});function XY(n){let{displayValue:e,onUpdate:t,onChange:r,editable:i=!0}=n,s=cn(n,$Y);return i?Q.createElement(DM,Jn({value:e,onUpdate:t,onChange:r},s)):Q.createElement(jY,null,e)}function JY(){const{label:n,settings:e,displayValue:t,onUpdate:r,onChange:i}=jr();return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,n),Q.createElement(XY,Jn({displayValue:t,onUpdate:r,onChange:i},e)))}var KY=St({component:JY},WY);const YY=n=>Ei().boolean().test(n),qY=n=>{if(typeof n!="boolean")throw Error("Invalid boolean");return n};var ZY=Object.freeze({__proto__:null,schema:YY,sanitize:qY});const QY=_t("div",{position:"relative",$flex:"",height:"$rowHeight",input:{$reset:"",height:0,width:0,opacity:0,margin:0},label:{position:"relative",$flexCenter:"",userSelect:"none",cursor:"pointer",height:"$checkboxSize",width:"$checkboxSize",backgroundColor:"$elevation3",borderRadius:"$sm",$hover:""},"input:focus + label":{$focusStyle:""},"input:focus:checked + label, input:checked + label:hover":{$hoverStyle:"$accent3"},"input + label:active":{backgroundColor:"$accent1"},"input:checked + label:active":{backgroundColor:"$accent1"},"label > svg":{display:"none",width:"90%",height:"90%",stroke:"$highlight3"},"input:checked + label":{backgroundColor:"$accent2"},"input:checked + label > svg":{display:"block"}});function eq({value:n,onUpdate:e,id:t,disabled:r}){return Q.createElement(QY,null,Q.createElement("input",{id:t,type:"checkbox",checked:n,onChange:i=>e(i.currentTarget.checked),disabled:r}),Q.createElement("label",{htmlFor:t},Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Q.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}function tq(){const{label:n,value:e,onUpdate:t,disabled:r,id:i}=jr();return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,n),Q.createElement(eq,{value:e,onUpdate:t,id:i,disabled:r}))}var nq=St({component:tq},ZY);const rq=["locked"];function iq({value:n,id:e,valueKey:t,settings:r,onUpdate:i,innerLabelTrim:s}){const o=D.useRef(n[t]);o.current=n[t];const a=D.useCallback(c=>i({[t]:CF({type:"NUMBER",value:o.current,settings:r},c)}),[i,r,t]),l=$F({type:"NUMBER",value:n[t],settings:r,setValue:a});return Q.createElement(YF,{id:e,label:t,value:n[t],displayValue:l.displayValue,onUpdate:l.onUpdate,onChange:l.onChange,settings:r,innerLabelTrim:s})}const sq=_t("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});function oq(n){let{locked:e}=n,t=cn(n,rq);return Q.createElement("svg",Jn({width:"10",height:"10",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),e?Q.createElement("path",{d:"M5 4.63601C5 3.76031 5.24219 3.1054 5.64323 2.67357C6.03934 2.24705 6.64582 1.9783 7.5014 1.9783C8.35745 1.9783 8.96306 2.24652 9.35823 2.67208C9.75838 3.10299 10 3.75708 10 4.63325V5.99999H5V4.63601ZM4 5.99999V4.63601C4 3.58148 4.29339 2.65754 4.91049 1.99307C5.53252 1.32329 6.42675 0.978302 7.5014 0.978302C8.57583 0.978302 9.46952 1.32233 10.091 1.99162C10.7076 2.65557 11 3.57896 11 4.63325V5.99999H12C12.5523 5.99999 13 6.44771 13 6.99999V13C13 13.5523 12.5523 14 12 14H3C2.44772 14 2 13.5523 2 13V6.99999C2 6.44771 2.44772 5.99999 3 5.99999H4ZM3 6.99999H12V13H3V6.99999Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}):Q.createElement("path",{d:"M9 3.63601C9 2.76044 9.24207 2.11211 9.64154 1.68623C10.0366 1.26502 10.6432 1 11.5014 1C12.4485 1 13.0839 1.30552 13.4722 1.80636C13.8031 2.23312 14 2.84313 14 3.63325H15C15 2.68242 14.7626 1.83856 14.2625 1.19361C13.6389 0.38943 12.6743 0 11.5014 0C10.4294 0 9.53523 0.337871 8.91218 1.0021C8.29351 1.66167 8 2.58135 8 3.63601V6H1C0.447715 6 0 6.44772 0 7V13C0 13.5523 0.447715 14 1 14H10C10.5523 14 11 13.5523 11 13V7C11 6.44772 10.5523 6 10 6H9V3.63601ZM1 7H10V13H1V7Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function NM({value:n,onUpdate:e,settings:t,innerLabelTrim:r}){const{id:i,setSettings:s}=jr(),{lock:o,locked:a}=t;return Q.createElement(sq,{withLock:o},o&&Q.createElement(oq,{locked:a,onClick:()=>s({locked:!a})}),Object.keys(n).map((l,c)=>Q.createElement(iq,{id:c===0?i:`${i}.${l}`,key:l,valueKey:l,value:n,settings:t[l],onUpdate:e,innerLabelTrim:r})))}const qF=(n,e)=>{const t={};let r=0,i=1/0;Object.entries(n).forEach(([s,o])=>{t[s]=BF(St({value:o},e[s])).settings,r=Math.max(r,t[s].step),i=Math.min(i,t[s].pad)});for(let s in t){const{step:o,min:a,max:l}=e[s]||{};!isFinite(o)&&(!isFinite(a)||!isFinite(l))&&(t[s].step=r,t[s].pad=i)}return t},aq=["lock"],lq=["value"];function cq(n){const e=Ei().array().length(n).every.number(),t=r=>{if(!r||typeof r!="object")return!1;const i=Object.values(r);return i.length===n&&i.every(s=>isFinite(s))};return r=>e.test(r)||t(r)}function uq(n){return Array.isArray(n)?"array":"object"}function Wd(n,e,t){return uq(n)===e?n:e==="array"?Object.values(n):HK(n,t)}const fq=(n,e,t)=>{const r=Wd(n,"object",e.keys);for(let o in r)r[o]=IF(r[o],e[o]);const i=Object.keys(r);let s={};if(i.length===e.keys.length)s=r;else{const o=Wd(t,"object",e.keys);if(i.length===1&&e.locked){const a=i[0],l=r[a],c=o[a],u=c!==0?l/c:1;for(let h in o)h===a?s[a]=l:s[h]=o[h]*u}else s=St(St({},o),r)}return Wd(s,e.format,e.keys)},hq=(n,e)=>Wd(n,"object",e.keys),dq=n=>!!n&&("step"in n||"min"in n||"max"in n);function pq(n,e,t=[]){const{lock:r=!1}=e,i=cn(e,aq),s=Array.isArray(n)?"array":"object",o=s==="object"?Object.keys(n):t,a=Wd(n,"object",o),l=dq(i)?o.reduce((u,h)=>Object.assign(u,{[h]:i}),{}):i,c=qF(a,l);return{value:s==="array"?n:a,settings:St(St({},c),{},{format:s,keys:o,lock:r,locked:!1})}}function ZF(n){return{schema:cq(n.length),normalize:e=>{let{value:t}=e,r=cn(e,lq);return pq(t,r,n)},format:(e,t)=>hq(e,t),sanitize:(e,t,r)=>fq(e,t,r)}}var mq={grad:.9,turn:360,rad:360/(2*Math.PI)},Qo=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},Sr=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},vs=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n>e?n:e},QF=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},KI=function(n){return{r:vs(n.r,0,255),g:vs(n.g,0,255),b:vs(n.b,0,255),a:vs(n.a)}},kx=function(n){return{r:Sr(n.r),g:Sr(n.g),b:Sr(n.b),a:Sr(n.a,3)}},gq=/^#([0-9a-f]{3,8})$/i,Lv=function(n){var e=n.toString(16);return e.length<2?"0"+e:e},eN=function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=Math.max(e,t,r),o=s-Math.min(e,t,r),a=o?s===e?(t-r)/o:s===t?2+(r-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:i}},tN=function(n){var e=n.h,t=n.s,r=n.v,i=n.a;e=e/360*6,t/=100,r/=100;var s=Math.floor(e),o=r*(1-t),a=r*(1-(e-s)*t),l=r*(1-(1-e+s)*t),c=s%6;return{r:255*[r,a,o,o,l,r][c],g:255*[l,r,r,a,o,o][c],b:255*[o,o,l,r,r,a][c],a:i}},YI=function(n){return{h:QF(n.h),s:vs(n.s,0,100),l:vs(n.l,0,100),a:vs(n.a)}},qI=function(n){return{h:Sr(n.h),s:Sr(n.s),l:Sr(n.l),a:Sr(n.a,3)}},ZI=function(n){return tN((t=(e=n).s,{h:e.h,s:(t*=((r=e.l)<50?r:100-r)/100)>0?2*t/(r+t)*100:0,v:r+t,a:e.a}));var e,t,r},$d=function(n){return{h:(e=eN(n)).h,s:(i=(200-(t=e.s))*(r=e.v)/100)>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,t,r,i},vq=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yq=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_q=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xq=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,eA={string:[[function(n){var e=gq.exec(n);return e?(n=e[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?Sr(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?Sr(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var e=_q.exec(n)||xq.exec(n);return e?e[2]!==e[4]||e[4]!==e[6]?null:KI({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(n){var e=vq.exec(n)||yq.exec(n);if(!e)return null;var t,r,i=YI({h:(t=e[1],r=e[2],r===void 0&&(r="deg"),Number(t)*(mq[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ZI(i)},"hsl"]],object:[[function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=i===void 0?1:i;return Qo(e)&&Qo(t)&&Qo(r)?KI({r:Number(e),g:Number(t),b:Number(r),a:Number(s)}):null},"rgb"],[function(n){var e=n.h,t=n.s,r=n.l,i=n.a,s=i===void 0?1:i;if(!Qo(e)||!Qo(t)||!Qo(r))return null;var o=YI({h:Number(e),s:Number(t),l:Number(r),a:Number(s)});return ZI(o)},"hsl"],[function(n){var e=n.h,t=n.s,r=n.v,i=n.a,s=i===void 0?1:i;if(!Qo(e)||!Qo(t)||!Qo(r))return null;var o=function(a){return{h:QF(a.h),s:vs(a.s,0,100),v:vs(a.v,0,100),a:vs(a.a)}}({h:Number(e),s:Number(t),v:Number(r),a:Number(s)});return tN(o)},"hsv"]]},QI=function(n,e){for(var t=0;t=.5},n.prototype.toHex=function(){return e=kx(this.rgba),t=e.r,r=e.g,i=e.b,o=(s=e.a)<1?Lv(Sr(255*s)):"","#"+Lv(t)+Lv(r)+Lv(i)+o;var e,t,r,i,s,o},n.prototype.toRgb=function(){return kx(this.rgba)},n.prototype.toRgbString=function(){return e=kx(this.rgba),t=e.r,r=e.g,i=e.b,(s=e.a)<1?"rgba("+t+", "+r+", "+i+", "+s+")":"rgb("+t+", "+r+", "+i+")";var e,t,r,i,s},n.prototype.toHsl=function(){return qI($d(this.rgba))},n.prototype.toHslString=function(){return e=qI($d(this.rgba)),t=e.h,r=e.s,i=e.l,(s=e.a)<1?"hsla("+t+", "+r+"%, "+i+"%, "+s+")":"hsl("+t+", "+r+"%, "+i+"%)";var e,t,r,i,s},n.prototype.toHsv=function(){return e=eN(this.rgba),{h:Sr(e.h),s:Sr(e.s),v:Sr(e.v),a:Sr(e.a,3)};var e},n.prototype.invert=function(){return ti({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},n.prototype.saturate=function(e){return e===void 0&&(e=.1),ti(Ux(this.rgba,e))},n.prototype.desaturate=function(e){return e===void 0&&(e=.1),ti(Ux(this.rgba,-e))},n.prototype.grayscale=function(){return ti(Ux(this.rgba,-1))},n.prototype.lighten=function(e){return e===void 0&&(e=.1),ti(e2(this.rgba,e))},n.prototype.darken=function(e){return e===void 0&&(e=.1),ti(e2(this.rgba,-e))},n.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},n.prototype.alpha=function(e){return typeof e=="number"?ti({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Sr(this.rgba.a,3);var t},n.prototype.hue=function(e){var t=$d(this.rgba);return typeof e=="number"?ti({h:e,s:t.s,l:t.l,a:t.a}):Sr(t.h)},n.prototype.isEqual=function(e){return this.toHex()===ti(e).toHex()},n}(),ti=function(n){return n instanceof tA?n:new tA(n)},t2=[],Eq=function(n){n.forEach(function(e){t2.indexOf(e)<0&&(e(tA,eA),t2.push(e))})};function Aq(n,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in t)r[t[i]]=i;var s={};n.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o!=null&&o.closest){var u=this.toRgb(),h=1/0,p="black";if(!s.length)for(var m in t)s[m]=new n(t[m]).toRgb();for(var g in t){var _=(a=u,l=s[g],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));_=0||(i[t]=n[t]);return i}function nA(n){var e=D.useRef(n),t=D.useRef(function(r){e.current&&e.current(r)});return e.current=n,t.current}var Hf=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n0:x.buttons>0)&&i.current?s(n2(i.current,x,a.current)):_(!1)},g=function(){return _(!1)};function _(x){var v=l.current,E=rA(i.current),S=x?E.addEventListener:E.removeEventListener;S(v?"touchmove":"mousemove",m),S(v?"touchend":"mouseup",g)}return[function(x){var v=x.nativeEvent,E=i.current;if(E&&(r2(v),!function(w,C){return C&&!jd(w)}(v,l.current)&&E)){if(jd(v)){l.current=!0;var S=v.changedTouches||[];S.length&&(a.current=S[0].identifier)}E.focus(),s(n2(E,v,a.current)),_(!0)}},function(x){var v=x.which||x.keyCode;v<37||v>40||(x.preventDefault(),o({left:v===39?.05:v===37?-.05:0,top:v===40?.05:v===38?-.05:0}))},_]},[o,s]),u=c[0],h=c[1],p=c[2];return D.useEffect(function(){return p},[p]),Q.createElement("div",mh({},r,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:i,onKeyDown:h,tabIndex:0,role:"slider"}))}),gm=function(n){return n.filter(Boolean).join(" ")},zM=function(n){var e=n.color,t=n.left,r=n.top,i=r===void 0?.5:r,s=gm(["react-colorful__pointer",n.className]);return Q.createElement("div",{className:s,style:{top:100*i+"%",left:100*t+"%"}},Q.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},ii=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t},rN=function(n){var e=n.s,t=n.v,r=n.a,i=(200-e)*t/100;return{h:ii(n.h),s:ii(i>0&&i<200?e*t/100/(i<=100?i:200-i)*100:0),l:ii(i/2),a:ii(r,2)}},iA=function(n){var e=rN(n);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Hx=function(n){var e=rN(n);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},iN=function(n){var e=n.h,t=n.s,r=n.v,i=n.a;e=e/360*6,t/=100,r/=100;var s=Math.floor(e),o=r*(1-t),a=r*(1-(e-s)*t),l=r*(1-(1-e+s)*t),c=s%6;return{r:ii(255*[r,a,o,o,l,r][c]),g:ii(255*[l,r,r,a,o,o][c]),b:ii(255*[o,o,l,r,r,a][c]),a:ii(i,2)}},sN=function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=Math.max(e,t,r),o=s-Math.min(e,t,r),a=o?s===e?(t-r)/o:s===t?2+(r-e)/o:4+(e-t)/o:0;return{h:ii(60*(a<0?a+6:a)),s:ii(s?o/s*100:0),v:ii(s/255*100),a:i}},oN=Q.memo(function(n){var e=n.hue,t=n.onChange,r=gm(["react-colorful__hue",n.className]);return Q.createElement("div",{className:r},Q.createElement(UM,{onMove:function(i){t({h:360*i.left})},onKey:function(i){t({h:Hf(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":ii(e),"aria-valuemax":"360","aria-valuemin":"0"},Q.createElement(zM,{className:"react-colorful__hue-pointer",left:e/360,color:iA({h:e,s:100,v:100,a:1})})))}),aN=Q.memo(function(n){var e=n.hsva,t=n.onChange,r={backgroundColor:iA({h:e.h,s:100,v:100,a:1})};return Q.createElement("div",{className:"react-colorful__saturation",style:r},Q.createElement(UM,{onMove:function(i){t({s:100*i.left,v:100-100*i.top})},onKey:function(i){t({s:Hf(e.s+100*i.left,0,100),v:Hf(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+ii(e.s)+"%, Brightness "+ii(e.v)+"%"},Q.createElement(zM,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:iA(e)})))}),HM=function(n,e){if(n===e)return!0;for(var t in n)if(n[t]!==e[t])return!1;return!0};function lN(n,e,t){var r=nA(t),i=D.useState(function(){return n.toHsva(e)}),s=i[0],o=i[1],a=D.useRef({color:e,hsva:s});D.useEffect(function(){if(!n.equal(e,a.current.color)){var c=n.toHsva(e);a.current={hsva:c,color:e},o(c)}},[e,n]),D.useEffect(function(){var c;HM(s,a.current.hsva)||n.equal(c=n.fromHsva(s),a.current.color)||(a.current={hsva:s,color:c},r(c))},[s,n,r]);var l=D.useCallback(function(c){o(function(u){return Object.assign({},u,c)})},[]);return[s,l]}var wq=typeof window<"u"?D.useLayoutEffect:D.useEffect,Mq=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},i2=new Map,cN=function(n){wq(function(){var e=n.current?n.current.ownerDocument:document;if(e!==void 0&&!i2.has(e)){var t=e.createElement("style");t.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,i2.set(e,t);var r=Mq();r&&t.setAttribute("nonce",r),e.head.appendChild(t)}},[])},Tq=function(n){var e=n.className,t=n.colorModel,r=n.color,i=r===void 0?t.defaultColor:r,s=n.onChange,o=kM(n,["className","colorModel","color","onChange"]),a=D.useRef(null);cN(a);var l=lN(t,i,s),c=l[0],u=l[1],h=gm(["react-colorful",e]);return Q.createElement("div",mh({},o,{ref:a,className:h}),Q.createElement(aN,{hsva:c,onChange:u}),Q.createElement(oN,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},bq=function(n){var e=n.className,t=n.hsva,r=n.onChange,i={backgroundImage:"linear-gradient(90deg, "+Hx(Object.assign({},t,{a:0}))+", "+Hx(Object.assign({},t,{a:1}))+")"},s=gm(["react-colorful__alpha",e]),o=ii(100*t.a);return Q.createElement("div",{className:s},Q.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),Q.createElement(UM,{onMove:function(a){r({a:a.left})},onKey:function(a){r({a:Hf(t.a+a.left)})},"aria-label":"Alpha","aria-valuetext":o+"%","aria-valuenow":o,"aria-valuemin":"0","aria-valuemax":"100"},Q.createElement(zM,{className:"react-colorful__alpha-pointer",left:t.a,color:Hx(t)})))},Cq=function(n){var e=n.className,t=n.colorModel,r=n.color,i=r===void 0?t.defaultColor:r,s=n.onChange,o=kM(n,["className","colorModel","color","onChange"]),a=D.useRef(null);cN(a);var l=lN(t,i,s),c=l[0],u=l[1],h=gm(["react-colorful",e]);return Q.createElement("div",mh({},o,{ref:a,className:h}),Q.createElement(aN,{hsva:c,onChange:u}),Q.createElement(oN,{hue:c.h,onChange:u}),Q.createElement(bq,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},Rq={defaultColor:{r:0,g:0,b:0,a:1},toHsva:sN,fromHsva:iN,equal:HM},Pq=function(n){return Q.createElement(Cq,mh({},n,{colorModel:Rq}))},Iq={defaultColor:{r:0,g:0,b:0},toHsva:function(n){return sN({r:n.r,g:n.g,b:n.b,a:1})},fromHsva:function(n){return{r:(e=iN(n)).r,g:e.g,b:e.b};var e},equal:HM},Bq=function(n){return Q.createElement(Tq,mh({},n,{colorModel:Iq}))},sA=function(n,e){return sA=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},sA(n,e)};function Yc(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");sA(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var oA=function(){return oA=Object.assign||function(e){for(var t,r=1,i=arguments.length;r0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Dp(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function Lq(){for(var n=[],e=0;e1||a(p,m)})})}function a(p,m){try{l(r[p](m))}catch(g){h(s[0][3],g)}}function l(p){p.value instanceof Af?Promise.resolve(p.value.v).then(c,u):h(s[0][2],p)}function c(p){a("next",p)}function u(p){a("throw",p)}function h(p,m){p(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Oq(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof Gf=="function"?Gf(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(o){return new Promise(function(a,l){o=n[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}var Fq=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function vm(n,e){var t=Nq(n);if(typeof t.path!="string"){var r=n.webkitRelativePath;Object.defineProperty(t,"path",{value:typeof e=="string"?e:typeof r=="string"&&r.length>0?r:n.name,writable:!1,configurable:!1,enumerable:!0})}return t}function Nq(n){var e=n.name,t=e&&e.lastIndexOf(".")!==-1;if(t&&!n.type){var r=e.split(".").pop().toLowerCase(),i=Fq.get(r);i&&Object.defineProperty(n,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return n}var kq=[".DS_Store","Thumbs.db"];function Uq(n){return qc(this,void 0,void 0,function(){return Pl(this,function(e){return Y0(n)&&zq(n)?[2,Wq(n.dataTransfer,n.type)]:Hq(n)?[2,Gq(n)]:Array.isArray(n)&&n.every(function(t){return"getFile"in t&&typeof t.getFile=="function"})?[2,Vq(n)]:[2,[]]})})}function zq(n){return Y0(n.dataTransfer)}function Hq(n){return Y0(n)&&Y0(n.target)}function Y0(n){return typeof n=="object"&&n!==null}function Gq(n){return aA(n.target.files).map(function(e){return vm(e)})}function Vq(n){return qc(this,void 0,void 0,function(){var e;return Pl(this,function(t){switch(t.label){case 0:return[4,Promise.all(n.map(function(r){return r.getFile()}))];case 1:return e=t.sent(),[2,e.map(function(r){return vm(r)})]}})})}function Wq(n,e){return qc(this,void 0,void 0,function(){var t,r;return Pl(this,function(i){switch(i.label){case 0:return n===null?[2,[]]:n.items?(t=aA(n.items).filter(function(s){return s.kind==="file"}),e!=="drop"?[2,t]:[4,Promise.all(t.map($q))]):[3,2];case 1:return r=i.sent(),[2,s2(uN(r))];case 2:return[2,s2(aA(n.files).map(function(s){return vm(s)}))]}})})}function s2(n){return n.filter(function(e){return kq.indexOf(e.name)===-1})}function aA(n){if(n===null)return[];for(var e=[],t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);tt)return[!1,f2(t)];if(n.sizet)return[!1,f2(t)]}return[!0,null]}function pd(n){return n!=null}function sZ(n){var e=n.files,t=n.accept,r=n.minSize,i=n.maxSize,s=n.multiple,o=n.maxFiles;return!s&&e.length>1||s&&o>=1&&e.length>o?!1:e.every(function(a){var l=dN(a,t),c=c2(l,1),u=c[0],h=pN(a,r,i),p=c2(h,1),m=p[0];return u&&m})}function q0(n){return typeof n.isPropagationStopped=="function"?n.isPropagationStopped():typeof n.cancelBubble<"u"?n.cancelBubble:!1}function Dv(n){return n.dataTransfer?Array.prototype.some.call(n.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!n.target&&!!n.target.files}function d2(n){n.preventDefault()}function oZ(n){return n.indexOf("MSIE")!==-1||n.indexOf("Trident/")!==-1}function aZ(n){return n.indexOf("Edge/")!==-1}function lZ(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return oZ(n)||aZ(n)}function vo(){for(var n=arguments.length,e=new Array(n),t=0;t1?i-1:0),o=1;on.length)&&(e=n.length);for(var t=0,r=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function wZ(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s=0)&&(t[i]=n[i]);return t}var GM=D.forwardRef(function(n,e){var t=n.children,r=Z0(n,dZ),i=vN(r),s=i.open,o=Z0(i,pZ);return D.useImperativeHandle(e,function(){return{open:s}},[s]),Q.createElement(D.Fragment,null,t(Ln(Ln({},o),{},{open:s})))});GM.displayName="Dropzone";var gN={disabled:!1,getFilesFromEvent:Uq,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};GM.defaultProps=gN;GM.propTypes={children:ln.func,accept:ln.oneOfType([ln.string,ln.arrayOf(ln.string)]),multiple:ln.bool,preventDropOnDocument:ln.bool,noClick:ln.bool,noKeyboard:ln.bool,noDrag:ln.bool,noDragEventsBubbling:ln.bool,minSize:ln.number,maxSize:ln.number,maxFiles:ln.number,disabled:ln.bool,getFilesFromEvent:ln.func,onFileDialogCancel:ln.func,onFileDialogOpen:ln.func,useFsAccessApi:ln.bool,onDragEnter:ln.func,onDragLeave:ln.func,onDragOver:ln.func,onDrop:ln.func,onDropAccepted:ln.func,onDropRejected:ln.func,validator:ln.func};var uA={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function vN(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Ln(Ln({},gN),n),t=e.accept,r=e.disabled,i=e.getFilesFromEvent,s=e.maxSize,o=e.minSize,a=e.multiple,l=e.maxFiles,c=e.onDragEnter,u=e.onDragLeave,h=e.onDragOver,p=e.onDrop,m=e.onDropAccepted,g=e.onDropRejected,_=e.onFileDialogCancel,x=e.onFileDialogOpen,v=e.useFsAccessApi,E=e.preventDropOnDocument,S=e.noClick,w=e.noKeyboard,C=e.noDrag,b=e.noDragEventsBubbling,B=e.validator,I=D.useMemo(function(){return typeof x=="function"?x:m2},[x]),R=D.useMemo(function(){return typeof _=="function"?_:m2},[_]),L=D.useRef(null),k=D.useRef(null),X=D.useReducer(MZ,uA),$=Gx(X,2),Y=$[0],Z=$[1],ne=Y.isFocused,ie=Y.isFileDialogActive,G=Y.draggedFiles,te=D.useRef(typeof window<"u"&&window.isSecureContext&&v&&cZ()),q=function(){!te.current&&ie&&setTimeout(function(){if(k.current){var N=k.current.files;N.length||(Z({type:"closeDialog"}),R())}},300)};D.useEffect(function(){return window.addEventListener("focus",q,!1),function(){window.removeEventListener("focus",q,!1)}},[k,ie,R,te]);var ue=D.useRef([]),K=function(N){L.current&&L.current.contains(N.target)||(N.preventDefault(),ue.current=[])};D.useEffect(function(){return E&&(document.addEventListener("dragover",d2,!1),document.addEventListener("drop",K,!1)),function(){E&&(document.removeEventListener("dragover",d2),document.removeEventListener("drop",K))}},[L,E]);var ve=D.useCallback(function(U){U.preventDefault(),U.persist(),be(U),ue.current=[].concat(vZ(ue.current),[U.target]),Dv(U)&&Promise.resolve(i(U)).then(function(N){q0(U)&&!b||(Z({draggedFiles:N,isDragActive:!0,type:"setDraggedFiles"}),c&&c(U))})},[i,c,b]),pe=D.useCallback(function(U){U.preventDefault(),U.persist(),be(U);var N=Dv(U);if(N&&U.dataTransfer)try{U.dataTransfer.dropEffect="copy"}catch{}return N&&h&&h(U),!1},[h,b]),Le=D.useCallback(function(U){U.preventDefault(),U.persist(),be(U);var N=ue.current.filter(function(Pe){return L.current&&L.current.contains(Pe)}),he=N.indexOf(U.target);he!==-1&&N.splice(he,1),ue.current=N,!(N.length>0)&&(Z({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),Dv(U)&&u&&u(U))},[L,u,b]),we=D.useCallback(function(U,N){var he=[],Pe=[];U.forEach(function(Ie){var Ue=dN(Ie,t),Ye=Gx(Ue,2),He=Ye[0],ye=Ye[1],ee=pN(Ie,o,s),me=Gx(ee,2),Ce=me[0],Be=me[1],Ne=B?B(Ie):null;if(He&&Ce&&!Ne)he.push(Ie);else{var rt=[ye,Be];Ne&&(rt=rt.concat(Ne)),Pe.push({file:Ie,errors:rt.filter(function(gt){return gt})})}}),(!a&&he.length>1||a&&l>=1&&he.length>l)&&(he.forEach(function(Ie){Pe.push({file:Ie,errors:[iZ]})}),he.splice(0)),Z({acceptedFiles:he,fileRejections:Pe,type:"setFiles"}),p&&p(he,Pe,N),Pe.length>0&&g&&g(Pe,N),he.length>0&&m&&m(he,N)},[Z,a,t,o,s,l,p,m,g,B]),Fe=D.useCallback(function(U){U.preventDefault(),U.persist(),be(U),ue.current=[],Dv(U)&&Promise.resolve(i(U)).then(function(N){q0(U)&&!b||we(N,U)}),Z({type:"reset"})},[i,we,b]),et=D.useCallback(function(){if(te.current){Z({type:"openDialog"}),I();var U={multiple:a,types:uZ(t)};window.showOpenFilePicker(U).then(function(N){return i(N)}).then(function(N){we(N,null),Z({type:"closeDialog"})}).catch(function(N){fZ(N)?(R(N),Z({type:"closeDialog"})):hZ(N)&&(te.current=!1,k.current&&(k.current.value=null,k.current.click()))});return}k.current&&(Z({type:"openDialog"}),I(),k.current.value=null,k.current.click())},[Z,I,R,v,we,t,a]),ft=D.useCallback(function(U){!L.current||!L.current.isEqualNode(U.target)||(U.key===" "||U.key==="Enter"||U.keyCode===32||U.keyCode===13)&&(U.preventDefault(),et())},[L,et]),Pt=D.useCallback(function(){Z({type:"focus"})},[]),st=D.useCallback(function(){Z({type:"blur"})},[]),J=D.useCallback(function(){S||(lZ()?setTimeout(et,0):et())},[S,et]),Re=function(N){return r?null:N},Ae=function(N){return w?null:Re(N)},De=function(N){return C?null:Re(N)},be=function(N){b&&N.stopPropagation()},nt=D.useMemo(function(){return function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=U.refKey,he=N===void 0?"ref":N,Pe=U.role,Ie=U.onKeyDown,Ue=U.onFocus,Ye=U.onBlur,He=U.onClick,ye=U.onDragEnter,ee=U.onDragOver,me=U.onDragLeave,Ce=U.onDrop,Be=Z0(U,mZ);return Ln(Ln(cA({onKeyDown:Ae(vo(Ie,ft)),onFocus:Ae(vo(Ue,Pt)),onBlur:Ae(vo(Ye,st)),onClick:Re(vo(He,J)),onDragEnter:De(vo(ye,ve)),onDragOver:De(vo(ee,pe)),onDragLeave:De(vo(me,Le)),onDrop:De(vo(Ce,Fe)),role:typeof Pe=="string"&&Pe!==""?Pe:"button"},he,L),!r&&!w?{tabIndex:0}:{}),Be)}},[L,ft,Pt,st,J,ve,pe,Le,Fe,w,C,r]),$e=D.useCallback(function(U){U.stopPropagation()},[]),Xe=D.useMemo(function(){return function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=U.refKey,he=N===void 0?"ref":N,Pe=U.onChange,Ie=U.onClick,Ue=Z0(U,gZ),Ye=cA({accept:t,multiple:a,type:"file",style:{display:"none"},onChange:Re(vo(Pe,Fe)),onClick:Re(vo(Ie,$e)),tabIndex:-1},he,k);return Ln(Ln({},Ye),Ue)}},[k,t,a,Fe,r]),ct=G.length,wt=ct>0&&sZ({files:G,accept:t,minSize:o,maxSize:s,multiple:a,maxFiles:l}),tn=ct>0&&!wt;return Ln(Ln({},Y),{},{isDragAccept:wt,isDragReject:tn,isFocused:ne&&!r,getRootProps:nt,getInputProps:Xe,rootRef:L,inputRef:k,open:Re(et)})}function MZ(n,e){switch(e.type){case"focus":return Ln(Ln({},n),{},{isFocused:!0});case"blur":return Ln(Ln({},n),{},{isFocused:!1});case"openDialog":return Ln(Ln({},uA),{},{isFileDialogActive:!0});case"closeDialog":return Ln(Ln({},n),{},{isFileDialogActive:!1});case"setDraggedFiles":var t=e.isDragActive,r=e.draggedFiles;return Ln(Ln({},n),{},{draggedFiles:r,isDragActive:t});case"setFiles":return Ln(Ln({},n),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections});case"reset":return Ln({},uA);default:return n}}function m2(){}/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */var TZ=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1};/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */var bZ=TZ;function g2(n){return bZ(n)===!0&&Object.prototype.toString.call(n)==="[object Object]"}var yN=function(e){var t,r;return!(g2(e)===!1||(t=e.constructor,typeof t!="function")||(r=t.prototype,g2(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */var CZ=yN,VM=function(e){return CZ(e)||typeof e=="function"||Array.isArray(e)};/*! + * for-in + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */var RZ=function(e,t,r){for(var i in e)if(t.call(r,e[i],i,e)===!1)break},PZ=VM,IZ=RZ;function _N(n,e){for(var t=arguments.length,r=0;++r + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */var OZ=function(n,e,t,r,i){if(!FZ(n)||!e)return n;if(e=Ov(e),t&&(e+="."+Ov(t)),r&&(e+="."+Ov(r)),i&&(e+="."+Ov(i)),e in n)return n[e];for(var s=e.split("."),o=s.length,a=-1;n&&++a + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */var NZ=function(n,e){if(n===null||typeof n>"u")throw new TypeError("expected first argument to be an object.");if(typeof e>"u"||typeof Symbol>"u"||typeof Object.getOwnPropertySymbols!="function")return n;for(var t=Object.prototype.propertyIsEnumerable,r=Object(n),i=arguments.length,s=0;++s"u")throw new TypeError("Cannot convert undefined or null to object");v2(n)||(n={});for(var e=1;e + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */var $Z=zZ,jZ=function(n,e,t){if(typeof n!="string")throw new TypeError("expected a string");typeof e=="function"&&(t=e,e=null),typeof e=="string"&&(e={sep:e});var r=$Z({sep:"."},e),i=r.quotes||['"',"'","`"],s;r.brackets===!0?s={"<":">","(":")","[":"]","{":"}"}:r.brackets&&(s=r.brackets);var o=[],a=[],l=[""],c=r.sep,u=n.length,h=-1,p;function m(){if(s&&a.length)return s[a[a.length-1]]}for(;++h + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */var KZ=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")},y2=KZ,YZ=function(e){y2(e)||(e={});for(var t=arguments.length,r=1;r + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */var QZ=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")};/*! + * set-value + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */var eQ=jZ,tQ=YZ,_2=yN,x2=QZ,nQ=function(n,e,t){if(!x2(n)||(Array.isArray(e)&&(e=[].concat.apply([],e).join(".")),typeof e!="string"))return n;for(var r=eQ(e,{sep:".",brackets:!0}).filter(rQ),i=r.length,s=-1,o=n;++sn.filter(Boolean).join(".");function oQ(n){const e=n.split(".");return[e.pop(),e.join(".")||void 0]}function aQ(n,e){return Object.entries(UK(n,e)).reduce((t,[,{value:r,disabled:i,key:s}])=>(t[s]=i?void 0:r,t),{})}function lQ(n,e){const t=D.useRef();return(e?Cp:dm)(n,t.current)||(t.current=n),t.current}function xN(n,e){return D.useMemo(n,lQ(e,!0))}function cQ(n){const e=D.useRef(null),t=D.useRef(null),r=D.useRef(!0);return D.useLayoutEffect(()=>{n||(e.current.style.height="0px",e.current.style.overflow="hidden")},[]),D.useEffect(()=>{if(r.current){r.current=!1;return}let i;const s=e.current,o=()=>{n&&(s.style.removeProperty("height"),s.style.removeProperty("overflow"),t.current.scrollIntoView({behavior:"smooth",block:"nearest"}))};s.addEventListener("transitionend",o,{once:!0});const{height:a}=t.current.getBoundingClientRect();return s.style.height=a+"px",n||(s.style.overflow="hidden",i=window.setTimeout(()=>s.style.height="0px",50)),()=>{s.removeEventListener("transitionend",o),clearTimeout(i)}},[n]),{wrapperRef:e,contentRef:t}}const uQ=n=>{const[e,t]=D.useState(n.getVisiblePaths());return D.useEffect(()=>{t(n.getVisiblePaths());const r=n.useStore.subscribe(n.getVisiblePaths,t,{equalityFn:dm});return()=>r()},[n]),e};function fQ(n,e,t){return n.useStore(i=>{const s=St(St({},t),i.data);return aQ(s,e)},dm)}function SN(n=3){const e=D.useRef(null),t=D.useRef(null),[r,i]=D.useState(!1),s=D.useCallback(()=>i(!0),[]),o=D.useCallback(()=>i(!1),[]);return D.useLayoutEffect(()=>{if(r){const{bottom:a,top:l,left:c}=e.current.getBoundingClientRect(),{height:u}=t.current.getBoundingClientRect(),h=a+u>window.innerHeight-40?"up":"down";t.current.style.position="fixed",t.current.style.zIndex="10000",t.current.style.left=c+"px",h==="down"?t.current.style.top=a+n+"px":t.current.style.bottom=window.innerHeight-l+n+"px"}},[n,r]),{popinRef:e,wrapperRef:t,shown:r,show:s,hide:o}}Eq([Aq]);const hQ={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};Ei.extend({color:()=>n=>ti(n).isValid()});const dQ=n=>Ei().color().test(n);function EN(n,{format:e,hasAlpha:t,isString:r}){const i=hQ[e]+(r&&e!=="hex"?"String":""),s=n[i]();return typeof s=="object"&&!t?zK(s,["a"]):s}const AN=(n,e)=>{const t=ti(n);if(!t.isValid())throw Error("Invalid color");return EN(t,e)},pQ=(n,e)=>EN(ti(n),St(St({},e),{},{isString:!0,format:"hex"})),mQ=({value:n})=>{const e=Sq(n),t=e==="name"?"hex":e,r=typeof n=="object"?"a"in n:e==="hex"&&n.length===8||/^(rgba)|(hsla)|(hsva)/.test(n),i={format:t,hasAlpha:r,isString:typeof n=="string"};return{value:AN(n,i),settings:i}};var gQ=Object.freeze({__proto__:null,schema:dQ,sanitize:AN,format:pQ,normalize:mQ});const vQ=_t("div",{position:"relative",boxSizing:"border-box",borderRadius:"$sm",overflow:"hidden",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",backgroundColor:"#fff",backgroundImage:`url('data:image/svg+xml;charset=utf-8,')`,$inputStyle:"",$hover:"",zIndex:1,variants:{active:{true:{$inputStyle:"$accent1"}}},"&::before":{content:'""',position:"absolute",top:0,bottom:0,right:0,left:0,backgroundColor:"currentColor",zIndex:1}}),yQ=_t("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),_Q=_t("div",{width:"$colorPickerWidth",height:"$colorPickerHeight",".react-colorful":{width:"100%",height:"100%",boxShadow:"$level2",cursor:"crosshair"},".react-colorful__saturation":{borderRadius:"$sm $sm 0 0"},".react-colorful__alpha, .react-colorful__hue":{height:10},".react-colorful__last-control":{borderRadius:"0 0 $sm $sm"},".react-colorful__pointer":{height:12,width:12}});function A2(n,e){return e!=="rgb"?ti(n).toRgb():n}function xQ({value:n,displayValue:e,settings:t,onUpdate:r}){const{emitOnEditStart:i,emitOnEditEnd:s}=jr(),{format:o,hasAlpha:a}=t,{popinRef:l,wrapperRef:c,shown:u,show:h,hide:p}=SN(),m=D.useRef(0),[g,_]=D.useState(()=>A2(n,o)),x=a?Pq:Bq,v=()=>{_(A2(n,o)),h(),i()},E=()=>{p(),s(),window.clearTimeout(m.current)},S=()=>{m.current=window.setTimeout(E,500)};return D.useEffect(()=>()=>window.clearTimeout(m.current),[]),Q.createElement(Q.Fragment,null,Q.createElement(vQ,{ref:l,active:u,onClick:()=>v(),style:{color:e}}),u&&Q.createElement(OM,null,Q.createElement(WF,{onPointerUp:E}),Q.createElement(_Q,{ref:c,onMouseEnter:()=>window.clearTimeout(m.current),onMouseLeave:w=>w.buttons===0&&S()},Q.createElement(x,{color:g,onChange:r}))))}function SQ(){const{value:n,displayValue:e,label:t,onChange:r,onUpdate:i,settings:s}=jr();return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,t),Q.createElement(yQ,null,Q.createElement(xQ,{value:n,displayValue:e,onChange:r,onUpdate:i,settings:s}),Q.createElement(DM,{value:e,onChange:r,onUpdate:i})))}var EQ=St({component:SQ},gQ);function AQ(){const{label:n,displayValue:e,onUpdate:t,settings:r}=jr();return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,n),Q.createElement(NM,{value:e,settings:r,onUpdate:t}))}var wQ=St({component:AQ},ZF(["x","y","z"]));const MQ=_t("div",{$flexCenter:"",position:"relative",backgroundColor:"$elevation3",borderRadius:"$sm",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",touchAction:"none",$draggable:"",$hover:"","&:active":{cursor:"none"},"&::after":{content:'""',backgroundColor:"$accent2",height:4,width:4,borderRadius:2}}),TQ=_t("div",{$flexCenter:"",width:"$joystickWidth",height:"$joystickHeight",borderRadius:"$sm",boxShadow:"$level2",position:"fixed",zIndex:1e4,overflow:"hidden",$draggable:"",transform:"translate(-50%, -50%)",variants:{isOutOfBounds:{true:{backgroundColor:"$elevation1"},false:{backgroundColor:"$elevation3"}}},"> div":{position:"absolute",$flexCenter:"",borderStyle:"solid",borderWidth:1,borderColor:"$highlight1",backgroundColor:"$elevation3",width:"80%",height:"80%","&::after,&::before":{content:'""',position:"absolute",zindex:10,backgroundColor:"$highlight1"},"&::before":{width:"100%",height:1},"&::after":{height:"100%",width:1}},"> span":{position:"relative",zindex:100,width:10,height:10,backgroundColor:"$accent2",borderRadius:"50%"}});function bQ({value:n,settings:e,onUpdate:t}){const r=D.useRef(),i=D.useRef(0),s=D.useRef(0),o=D.useRef(1),[a,l]=D.useState(!1),[c,u]=D.useState(!1),[h,p]=jF(),m=D.useRef(null),g=D.useRef(null);D.useLayoutEffect(()=>{if(a){const{top:X,left:$,width:Y,height:Z}=m.current.getBoundingClientRect();g.current.style.left=$+Y/2+"px",g.current.style.top=X+Z/2+"px"}},[a]);const{keys:[_,x],joystick:v}=e,E=v==="invertY"?1:-1,{[_]:{step:S},[x]:{step:w}}=e,C=da("sizes","joystickWidth"),b=da("sizes","joystickHeight"),B=parseFloat(C)*.8/2,I=parseFloat(b)*.8/2,R=D.useCallback(()=>{r.current||(u(!0),i.current&&p({x:i.current*B}),s.current&&p({y:s.current*-I}),r.current=window.setInterval(()=>{t(X=>{const $=S*i.current*o.current,Y=E*w*s.current*o.current;return Array.isArray(X)?{[_]:X[0]+$,[x]:X[1]+Y}:{[_]:X[_]+$,[x]:X[x]+Y}})},16))},[B,I,t,p,S,w,_,x,E]),L=D.useCallback(()=>{window.clearTimeout(r.current),r.current=void 0,u(!1)},[]);D.useEffect(()=>{function X($){o.current=PF($)}return window.addEventListener("keydown",X),window.addEventListener("keyup",X),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",X),window.removeEventListener("keyup",X)}},[]);const k=mm(({first:X,active:$,delta:[Y,Z],movement:[ne,ie]})=>{X&&l(!0);const G=Sl(ne,-B,B),te=Sl(ie,-I,I);i.current=Math.abs(ne)>Math.abs(G)?Math.sign(ne-G):0,s.current=Math.abs(ie)>Math.abs(te)?Math.sign(te-ie):0;let q=n[_],ue=n[x];$?(i.current||(q+=Y*S*o.current,p({x:G})),s.current||(ue-=E*Z*w*o.current,p({y:te})),i.current||s.current?R():L(),t({[_]:q,[x]:ue})):(l(!1),i.current=0,s.current=0,p({x:0,y:0}),L())});return Q.createElement(MQ,Jn({ref:m},k()),a&&Q.createElement(OM,null,Q.createElement(TQ,{ref:g,isOutOfBounds:c},Q.createElement("div",null),Q.createElement("span",{ref:h}))))}const CQ=_t("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function RQ(){const{label:n,displayValue:e,onUpdate:t,settings:r}=jr();return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,n),Q.createElement(CQ,{withJoystick:!!r.joystick},r.joystick&&Q.createElement(bQ,{value:e,settings:r,onUpdate:t}),Q.createElement(NM,{value:e,settings:r,onUpdate:t})))}const PQ=["joystick"],wN=ZF(["x","y"]),IQ=n=>{let{joystick:e=!0}=n,t=cn(n,PQ);const{value:r,settings:i}=wN.normalize(t);return{value:r,settings:St(St({},i),{},{joystick:e})}};var BQ=St(St({component:RQ},wN),{},{normalize:IQ});const LQ=n=>{if(n!==void 0){if(n instanceof File)try{return URL.createObjectURL(n)}catch{return}if(typeof n=="string"&&n.indexOf("blob:")===0)return n;throw Error("Invalid image format [undefined | blob | File].")}},DQ=(n,e)=>typeof e=="object"&&"image"in e,OQ=({image:n})=>({value:n});var FQ=Object.freeze({__proto__:null,sanitize:LQ,schema:DQ,normalize:OQ});const NQ=_t("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),kQ=_t("div",{$flexCenter:"",overflow:"hidden",height:"$rowHeight",background:"$elevation3",textAlign:"center",color:"inherit",borderRadius:"$sm",outline:"none",userSelect:"none",cursor:"pointer",$inputStyle:"",$hover:"",$focusWithin:"",$active:"$accent1 $elevation1",variants:{isDragAccept:{true:{$inputStyle:"$accent1",backgroundColor:"$elevation1"}}}}),UQ=_t("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),zQ=_t("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),HQ=_t("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),GQ=_t("div",{$flexCenter:"",top:"0",right:"0",marginRight:"$sm",height:"100%",cursor:"pointer",variants:{disabled:{true:{color:"$elevation3",cursor:"default"}}},"&::after,&::before":{content:'""',position:"absolute",height:2,width:10,borderRadius:1,backgroundColor:"currentColor"},"&::after":{transform:"rotate(45deg)"},"&::before":{transform:"rotate(-45deg)"}});function VQ(){const{label:n,value:e,onUpdate:t,disabled:r}=jr(),{popinRef:i,wrapperRef:s,shown:o,show:a,hide:l}=SN(),c=D.useCallback(g=>{g.length&&t(g[0])},[t]),u=D.useCallback(g=>{g.stopPropagation(),t(void 0)},[t]),{getRootProps:h,getInputProps:p,isDragAccept:m}=vN({maxFiles:1,accept:"image/*",onDrop:c,disabled:r});return Q.createElement(Ts,{input:!0},Q.createElement(ro,null,n),Q.createElement(NQ,null,Q.createElement(UQ,{ref:i,hasImage:!!e,onPointerDown:()=>!!e&&a(),onPointerUp:l,style:{backgroundImage:e?`url(${e})`:"none"}}),o&&!!e&&Q.createElement(OM,null,Q.createElement(WF,{onPointerUp:l,style:{cursor:"pointer"}}),Q.createElement(zQ,{ref:s,style:{backgroundImage:`url(${e})`}})),Q.createElement(kQ,h({isDragAccept:m}),Q.createElement("input",p()),Q.createElement(HQ,null,m?"drop image":"click or drop")),Q.createElement(GQ,{onClick:u,disabled:!e})))}var WQ=St({component:VQ},FQ);const w2=Ei().number(),$Q=(n,e)=>Ei().array().length(2).every.number().test(n)&&Ei().schema({min:w2,max:w2}).test(e),Q0=n=>({min:n[0],max:n[1]}),MN=(n,{bounds:[e,t]},r)=>{const i=Array.isArray(n)?Q0(n):n,s={min:r[0],max:r[1]},{min:o,max:a}=St(St({},s),i);return[Sl(Number(o),e,Math.max(e,a)),Sl(Number(a),Math.min(t,o),t)]},jQ=({value:n,min:e,max:t})=>{const r={min:e,max:t},i=qF(Q0(n),{min:r,max:r}),s=[e,t],o=St(St({},i),{},{bounds:s});return{value:MN(Q0(n),o,n),settings:o}};var XQ=Object.freeze({__proto__:null,schema:$Q,format:Q0,sanitize:MN,normalize:jQ});const JQ=["value","bounds","onDrag"],KQ=["bounds"],YQ=_t("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function qQ(n){let{value:e,bounds:[t,r],onDrag:i}=n,s=cn(n,JQ);const o=D.useRef(null),a=D.useRef(null),l=D.useRef(null),c=D.useRef(0),u=da("sizes","scrubberWidth"),h=mm(({event:g,first:_,xy:[x],movement:[v],memo:E={}})=>{if(_){const{width:w,left:C}=o.current.getBoundingClientRect();c.current=w-parseFloat(u);const b=(g==null?void 0:g.target)===a.current||(g==null?void 0:g.target)===l.current;E.pos=X0((x-C)/w,t,r);const B=Math.abs(E.pos-e.min)-Math.abs(E.pos-e.max);E.key=B<0||B===0&&E.pos<=e.min?"min":"max",b&&(E.pos=e[E.key])}const S=E.pos+X0(v/c.current,0,r-t);return i({[E.key]:CY(S,s[E.key])}),E}),p=`calc(${j0(e.min,t,r)} * (100% - ${u} - 8px) + 4px)`,m=`calc(${1-j0(e.max,t,r)} * (100% - ${u} - 8px) + 4px)`;return Q.createElement(JF,Jn({ref:o},h()),Q.createElement(XF,null,Q.createElement(KF,{style:{left:p,right:m}})),Q.createElement(ZE,{position:"left",ref:a,style:{left:p}}),Q.createElement(ZE,{position:"right",ref:l,style:{right:m}}))}function ZQ(){const{label:n,displayValue:e,onUpdate:t,settings:r}=jr(),i=cn(r,KQ);return Q.createElement(Q.Fragment,null,Q.createElement(Ts,{input:!0},Q.createElement(ro,null,n),Q.createElement(YQ,null,Q.createElement(qQ,Jn({value:e},r,{onDrag:t})),Q.createElement(NM,{value:e,settings:i,onUpdate:t,innerLabelTrim:0}))))}var QQ=St({component:ZQ},XQ);const eee=()=>{const n=new Map;return{on:(e,t)=>{let r=n.get(e);r===void 0&&(r=new Set,n.set(e,r)),r.add(t)},off:(e,t)=>{const r=n.get(e);r!==void 0&&(r.delete(t),r.size===0&&n.delete(e))},emit:(e,...t)=>{const r=n.get(e);if(r!==void 0)for(const i of r)i(...t)}}},tee=["type","value"],nee=["onChange","transient","onEditStart","onEditEnd"],ree=function(){const e=gM(V7(()=>({data:{}}))),t=eee();this.storeId=kK(),this.useStore=e;const r={},i=new Set;this.getVisiblePaths=()=>{const o=this.getData(),a=Object.keys(o),l=[];Object.entries(r).forEach(([u,h])=>{h.render&&a.some(p=>p.indexOf(u)===0)&&!h.render(this.get)&&l.push(u+".")});const c=[];return i.forEach(u=>{u in o&&o[u].__refCount>0&&l.every(h=>u.indexOf(h)===-1)&&(!o[u].render||o[u].render(this.get))&&c.push(u)}),c},this.setOrderedPaths=o=>{o.forEach(a=>i.add(a))},this.orderPaths=o=>(this.setOrderedPaths(o),o),this.disposePaths=o=>{e.setState(a=>{const l=a.data;return o.forEach(c=>{if(c in l){const u=l[c];u.__refCount--,u.__refCount===0&&u.type in $s&&delete l[c]}}),{data:l}})},this.dispose=()=>{e.setState(()=>({data:{}}))},this.getFolderSettings=o=>r[o]||{},this.getData=()=>e.getState().data,this.addData=(o,a)=>{e.setState(l=>{const c=l.data;return Object.entries(o).forEach(([u,h])=>{let p=c[u];if(p){const{type:m,value:g}=h,_=cn(h,tee);m!==p.type?ia(Dn.INPUT_TYPE_OVERRIDE,m):((p.__refCount===0||a)&&Object.assign(p,_),p.__refCount++)}else c[u]=St(St({},h),{},{__refCount:1})}),{data:c}})},this.setValueAtPath=(o,a,l)=>{e.setState(c=>{const u=c.data;return JI(u[o],a,o,this,l),{data:u}})},this.setSettingsAtPath=(o,a)=>{e.setState(l=>{const c=l.data;return c[o].settings=St(St({},c[o].settings),a),{data:c}})},this.disableInputAtPath=(o,a)=>{e.setState(l=>{const c=l.data;return c[o].disabled=a,{data:c}})},this.set=(o,a)=>{e.setState(l=>{const c=l.data;return Object.entries(o).forEach(([u,h])=>{try{JI(c[u],h,void 0,void 0,a)}catch{}}),{data:c}})},this.getInput=o=>{try{return this.getData()[o]}catch{ia(Dn.PATH_DOESNT_EXIST,o)}},this.get=o=>{var a;return(a=this.getInput(o))===null||a===void 0?void 0:a.value},this.emitOnEditStart=o=>{t.emit(`onEditStart:${o}`,this.get(o),o,St(St({},this.getInput(o)),{},{get:this.get}))},this.emitOnEditEnd=o=>{t.emit(`onEditEnd:${o}`,this.get(o),o,St(St({},this.getInput(o)),{},{get:this.get}))},this.subscribeToEditStart=(o,a)=>{const l=`onEditStart:${o}`;return t.on(l,a),()=>t.off(l,a)},this.subscribeToEditEnd=(o,a)=>{const l=`onEditEnd:${o}`;return t.on(l,a),()=>t.off(l,a)};const s=(o,a,l)=>{const c={};return Object.entries(o).forEach(([u,h])=>{if(u==="")return ia(Dn.EMPTY_KEY);let p=WM(a,u);if(h.type===$s.FOLDER){const m=s(h.schema,p,l);Object.assign(c,m),p in r||(r[p]=h.settings)}else if(u in l)ia(Dn.DUPLICATE_KEYS,u,p,l[u].path);else{const m=jK(h,u,p,c);if(m){const{type:g,options:_,input:x}=m,{onChange:v,transient:E,onEditStart:S,onEditEnd:w}=_,C=cn(_,nee);c[p]=St(St(St({type:g},C),x),{},{fromPanel:!0}),l[u]={path:p,onChange:v,transient:E,onEditStart:S,onEditEnd:w}}else ia(Dn.UNKNOWN_INPUT,p,h)}}),c};this.getDataFromSchema=o=>{const a={};return[s(o,"",a),a]}},TN=new ree,iee={collapsed:!1};function see(n,e){return{type:$s.FOLDER,schema:n,settings:St(St({},iee),e)}}const M2=n=>"__levaInput"in n,oee=(n,e)=>{const t={},r=e?e.toLowerCase():null;return n.forEach(i=>{const[s,o]=oQ(i);(!r||s.toLowerCase().indexOf(r)>-1)&&sQ(t,o,{[s]:{__levaInput:!0,path:i}})}),t},aee=["type","label","path","valueKey","value","settings","setValue","disabled"];function lee(n){let{type:e,label:t,path:r,valueKey:i,value:s,settings:o,setValue:a,disabled:l}=n,c=cn(n,aee);const{displayValue:u,onChange:h,onUpdate:p}=$F({type:e,value:s,settings:o,setValue:a}),m=zc[e].component;return m?Q.createElement(OF.Provider,{value:St({key:i,path:r,id:""+r,label:t,displayValue:u,value:s,onChange:h,onUpdate:p,settings:o,setValue:a,disabled:l},c)},Q.createElement(hY,{disabled:l},Q.createElement(m,null))):(ia(Dn.NO_COMPONENT_FOR_TYPE,e,r),null)}const cee=_t("button",{display:"block",$reset:"",fontWeight:"$button",height:"$rowHeight",borderStyle:"none",borderRadius:"$sm",backgroundColor:"$elevation1",color:"$highlight1","&:not(:disabled)":{color:"$highlight3",backgroundColor:"$accent2",cursor:"pointer",$hover:"$accent3",$active:"$accent3 $accent1",$focus:""}});function uee({onClick:n,settings:e,label:t}){const r=pm();return Q.createElement(Ts,null,Q.createElement(cee,{disabled:e.disabled,onClick:()=>n(r.get)},t))}const fee=_t("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),hee=_t("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),dee=({label:n,opts:e})=>{let t=typeof n=="string"&&n.trim()===""?null:n,r=e;return typeof e.opts=="object"&&(r.label!==void 0&&(t=e.label),r=e.opts),{label:t,opts:r}};function pee(n){const{label:e,opts:t}=dee(n),r=pm();return Q.createElement(Ts,{input:!!e},e&&Q.createElement(ro,null,e),Q.createElement(fee,null,Object.entries(t).map(([i,s])=>Q.createElement(hee,{key:i,onClick:()=>s(r.get)},i))))}const mee=_t("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),bN=100;function gee(n,e){n.push(e),n.length>bN&&n.shift()}const vee=D.forwardRef(function({initialValue:n},e){const t=da("colors","highlight3"),r=da("colors","elevation2"),i=da("colors","highlight1"),[s,o]=D.useMemo(()=>[ti(i).alpha(.4).toRgbString(),ti(i).alpha(.1).toRgbString()],[i]),a=D.useRef([n]),l=D.useRef(n),c=D.useRef(n),u=D.useRef(),h=D.useCallback((g,_)=>{if(!g)return;const{width:x,height:v}=g,E=new Path2D,S=x/bN,w=v*.05;for(let B=0;B({frame:g=>{(l.current===void 0||gc.current)&&(c.current=g),gee(a.current,g),u.current=requestAnimationFrame(()=>h(p.current,m.current))}}),[p,m,h]),D.useEffect(()=>()=>cancelAnimationFrame(u.current),[]),Q.createElement(mee,{ref:p})}),T2=n=>Number.isFinite(n)?n.toPrecision(2):n.toString(),yee=D.forwardRef(function({initialValue:n},e){const[t,r]=D.useState(T2(n));return D.useImperativeHandle(e,()=>({frame:i=>r(T2(i))}),[]),Q.createElement("div",null,t)});function b2(n){return typeof n=="function"?n():n.current}function _ee({label:n,objectOrFn:e,settings:t}){const r=D.useRef(),i=D.useRef(b2(e));return D.useEffect(()=>{const s=window.setInterval(()=>{var o;document.hidden||(o=r.current)===null||o===void 0||o.frame(b2(e))},t.interval);return()=>window.clearInterval(s)},[e,t.interval]),Q.createElement(Ts,{input:!0},Q.createElement(ro,{align:"top"},n),t.graph?Q.createElement(vee,{ref:r,initialValue:i.current}):Q.createElement(yee,{ref:r,initialValue:i.current}))}const xee=["type","label","key"],See={[$s.BUTTON]:uee,[$s.BUTTON_GROUP]:pee,[$s.MONITOR]:_ee},Eee=Q.memo(({path:n})=>{const[e,{set:t,setSettings:r,disable:i,storeId:s,emitOnEditStart:o,emitOnEditEnd:a}]=AY(n);if(!e)return null;const{type:l,label:c,key:u}=e,h=cn(e,xee);if(l in $s){const p=See[l];return Q.createElement(p,Jn({label:c,path:n},h))}return l in zc?Q.createElement(lee,Jn({key:s+n,type:l,label:c,storeId:s,path:n,valueKey:u,setValue:t,setSettings:r,disable:i,emitOnEditStart:o,emitOnEditEnd:a},h)):(PK(Dn.UNSUPPORTED_INPUT,l,n),null)});function Aee({toggle:n,toggled:e,name:t}){return Q.createElement(cY,{onClick:()=>n()},Q.createElement(FM,{toggled:e}),Q.createElement("div",null,t))}const wee=({name:n,path:e,tree:t})=>{const r=pm(),i=WM(e,n),{collapsed:s,color:o}=r.getFolderSettings(i),[a,l]=D.useState(!s),c=D.useRef(null),u=da("colors","folderWidgetColor"),h=da("colors","folderTextColor");return D.useLayoutEffect(()=>{c.current.style.setProperty("--leva-colors-folderWidgetColor",o||u),c.current.style.setProperty("--leva-colors-folderTextColor",o||h)},[o,u,h]),Q.createElement(J0,{ref:c},Q.createElement(Aee,{name:n,toggled:a,toggle:()=>l(p=>!p)}),Q.createElement(CN,{parent:i,tree:t,toggled:a}))},CN=Q.memo(({isRoot:n=!1,fill:e=!1,flat:t=!1,parent:r,tree:i,toggled:s})=>{const{wrapperRef:o,contentRef:a}=cQ(s),l=pm(),c=([h,p])=>{var m;return(M2(p)?(m=l.getInput(p.path))===null||m===void 0?void 0:m.order:l.getFolderSettings(WM(r,h)).order)||0},u=Object.entries(i).sort((h,p)=>c(h)-c(p));return Q.createElement(YE,{ref:o,isRoot:n,fill:e,flat:t},Q.createElement(HF,{ref:a,isRoot:n,toggled:s},u.map(([h,p])=>M2(p)?Q.createElement(Eee,{key:p.path,valueKey:p.valueKey,path:p.path}):Q.createElement(wee,{key:h,name:h,path:r,tree:p}))))}),Mee=_t("div",{position:"relative",fontFamily:"$mono",fontSize:"$root",color:"$rootText",backgroundColor:"$elevation1",variants:{fill:{false:{position:"fixed",top:"10px",right:"10px",zIndex:1e3,width:"$rootWidth"},true:{position:"relative",width:"100%"}},flat:{false:{borderRadius:"$lg",boxShadow:"$level1"}},oneLineLabels:{true:{[`${VF}`]:{gridTemplateColumns:"auto",gridAutoColumns:"minmax(max-content, 1fr)",gridAutoRows:"minmax($sizes$rowHeight), auto)",rowGap:0,columnGap:0,marginTop:"$rowGap"}}},hideTitleBar:{true:{$$titleBarHeight:"0px"},false:{$$titleBarHeight:"$sizes$titleBarHeight"}}},"&,*,*:after,*:before":{boxSizing:"border-box"},"*::selection":{backgroundColor:"$accent2"}}),RN=40,ey=_t("i",{$flexCenter:"",width:RN,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),Tee=_t("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),bee=_t("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${ey}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),Cee=_t("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),Ree=_t("div",{touchAction:"none",$flexCenter:"",flex:1,"> svg":{fill:"$highlight1"},color:"$highlight1",variants:{drag:{true:{$draggable:"","> svg":{transition:"fill 250ms ease"},"&:hover":{color:"$highlight3"},"&:hover > svg":{fill:"$highlight3"}}},filterEnabled:{false:{paddingRight:RN}}}}),Pee=Q.forwardRef(({setFilter:n,toggle:e},t)=>{const[r,i]=D.useState(""),s=D.useMemo(()=>RF(n,250),[n]),o=()=>{n(""),i("")},a=l=>{const c=l.currentTarget.value;e(!0),i(c)};return D.useEffect(()=>{s(r)},[r,s]),Q.createElement(Q.Fragment,null,Q.createElement(Cee,{ref:t,value:r,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:l=>l.stopPropagation(),onChange:a}),Q.createElement(ey,{onClick:()=>o(),style:{visibility:r?"visible":"hidden"}},Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},Q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))))});function Iee({setFilter:n,onDrag:e,onDragStart:t,onDragEnd:r,toggle:i,toggled:s,title:o,drag:a,filterEnabled:l,from:c}){const[u,h]=D.useState(!1),p=D.useRef(null);D.useEffect(()=>{var g,_;u?(g=p.current)===null||g===void 0||g.focus():(_=p.current)===null||_===void 0||_.blur()},[u]);const m=mm(({offset:[g,_],first:x,last:v})=>{e({x:g,y:_}),x&&t({x:g,y:_}),v&&r({x:g,y:_})},{filterTaps:!0,from:({offset:[g,_]})=>[(c==null?void 0:c.x)||g,(c==null?void 0:c.y)||_]});return D.useEffect(()=>{const g=_=>{_.key==="L"&&_.shiftKey&&_.metaKey&&h(x=>!x)};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),Q.createElement(Q.Fragment,null,Q.createElement(Tee,{mode:a?"drag":void 0},Q.createElement(ey,{active:!s,onClick:()=>i()},Q.createElement(FM,{toggled:s,width:12,height:8})),Q.createElement(Ree,Jn({},a?m():{},{drag:a,filterEnabled:l}),o===void 0&&a?Q.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},Q.createElement("circle",{cx:"2",cy:"2",r:"2"}),Q.createElement("circle",{cx:"14",cy:"2",r:"2"}),Q.createElement("circle",{cx:"26",cy:"2",r:"2"}),Q.createElement("circle",{cx:"2",cy:"12",r:"2"}),Q.createElement("circle",{cx:"14",cy:"12",r:"2"}),Q.createElement("circle",{cx:"26",cy:"12",r:"2"})):o),l&&Q.createElement(ey,{active:u,onClick:()=>h(g=>!g)},Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},Q.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),Q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-13a4 4 0 00-3.446 6.032l-2.261 2.26a1 1 0 101.414 1.415l2.261-2.261A4 4 0 1011 5z",clipRule:"evenodd"})))),Q.createElement(bee,{toggled:u},Q.createElement(Pee,{ref:p,setFilter:n,toggle:i})))}const Bee=["store","hidden","theme","collapsed"];function Lee(n){let{store:e,hidden:t=!1,theme:r,collapsed:i=!1}=n,s=cn(n,Bee);const o=xN(()=>rY(r),[r]),[a,l]=D.useState(!i),c=typeof i=="object"?!i.collapsed:a,u=D.useMemo(()=>typeof i=="object"?h=>{typeof h=="function"?i.onChange(!h(!i.collapsed)):i.onChange(!h)}:l,[i]);return!e||t?null:Q.createElement(LM.Provider,{value:o},Q.createElement(Dee,Jn({store:e},s,{toggled:c,setToggle:u,rootClass:o.className})))}const Dee=Q.memo(({store:n,rootClass:e,fill:t=!1,flat:r=!1,neverHide:i=!1,oneLineLabels:s=!1,titleBar:o={title:void 0,drag:!0,filter:!0,position:void 0,onDrag:void 0,onDragStart:void 0,onDragEnd:void 0},hideCopyButton:a=!1,toggled:l,setToggle:c})=>{var u,h;const p=uQ(n),[m,g]=D.useState(""),_=D.useMemo(()=>oee(p,m),[p,m]),[x,v]=jF(),E=i||p.length>0,S=typeof o=="object"&&o.title||void 0,w=typeof o=="object"&&(u=o.drag)!==null&&u!==void 0?u:!0,C=typeof o=="object"&&(h=o.filter)!==null&&h!==void 0?h:!0,b=typeof o=="object"&&o.position||void 0,B=typeof o=="object"&&o.onDrag||void 0,I=typeof o=="object"&&o.onDragStart||void 0,R=typeof o=="object"&&o.onDragEnd||void 0;return Q.useEffect(()=>{v({x:b==null?void 0:b.x,y:b==null?void 0:b.y})},[b,v]),nY(),Q.createElement(NF.Provider,{value:{hideCopyButton:a}},Q.createElement(Mee,{ref:x,className:e,fill:t,flat:r,oneLineLabels:s,hideTitleBar:!o,style:{display:E?"block":"none"}},o&&Q.createElement(Iee,{onDrag:L=>{v(L),B==null||B(L)},onDragStart:L=>I==null?void 0:I(L),onDragEnd:L=>R==null?void 0:R(L),setFilter:g,toggle:L=>c(k=>L??!k),toggled:l,title:S,drag:w,filterEnabled:C,from:b}),E&&Q.createElement(FF.Provider,{value:n},Q.createElement(CN,{isRoot:!0,fill:t,flat:r,tree:_,toggled:l}))))}),Oee=["isRoot"];let ty=!1,gc=null;function Fee(n){let{isRoot:e=!1}=n,t=cn(n,Oee);return D.useEffect(()=>(ty=!0,!e&&gc&&(gc.remove(),gc=null),()=>{e||(ty=!1)}),[e]),Q.createElement(Lee,Jn({store:TN},t))}function Nee(n){D.useEffect(()=>{n&&!ty&&(gc||(gc=document.getElementById("leva__root")||Object.assign(document.createElement("div"),{id:"leva__root"}),document.body&&(document.body.appendChild(gc),JK(Q.createElement(Fee,{isRoot:!0}),gc))),ty=!0)},[n])}function kee(n,e,t,r,i){let s,o,a,l,c;return typeof n=="string"?(o=n,s=e,Array.isArray(t)?c=t:t&&("store"in t?(l=t,c=r):(a=t,Array.isArray(r)?c=r:(l=r,c=i)))):(s=n,Array.isArray(e)?c=e:(l=e,c=t)),{schema:s,folderName:o,folderSettings:a,hookSettings:l,deps:c||[]}}function Uee(n,e,t,r,i){const{folderName:s,schema:o,folderSettings:a,hookSettings:l,deps:c}=kee(n,e,t,r,i),u=typeof o=="function",h=D.useRef(!1),p=D.useRef(!0),m=xN(()=>{h.current=!0;const k=typeof o=="function"?o():o;return s?{[s]:see(k,a)}:k},c),g=!(l!=null&&l.store);Nee(g);const[_]=D.useState(()=>(l==null?void 0:l.store)||TN),[x,v]=D.useMemo(()=>_.getDataFromSchema(m),[_,m]),[E,S,w,C,b]=D.useMemo(()=>{const k=[],X=[],$={},Y={},Z={};return Object.values(v).forEach(({path:ne,onChange:ie,onEditStart:G,onEditEnd:te,transient:q})=>{k.push(ne),ie?($[ne]=ie,q||X.push(ne)):X.push(ne),G&&(Y[ne]=G),te&&(Z[ne]=te)}),[k,X,$,Y,Z]},[v]),B=D.useMemo(()=>_.orderPaths(E),[E,_]),I=fQ(_,S,x),R=D.useCallback(k=>{const X=Object.entries(k).reduce(($,[Y,Z])=>Object.assign($,{[v[Y].path]:Z}),{});_.set(X,!1)},[_,v]),L=D.useCallback(k=>_.get(v[k].path),[_,v]);return D.useEffect(()=>{const k=!p.current&&h.current;return _.addData(x,k),p.current=!1,h.current=!1,()=>_.disposePaths(B)},[_,B,x]),D.useEffect(()=>{const k=[];return Object.entries(w).forEach(([X,$])=>{$(_.get(X),X,St({initial:!0,get:_.get},_.getInput(X)));const Y=_.useStore.subscribe(Z=>{const ne=Z.data[X];return[ne.disabled?void 0:ne.value,ne]},([Z,ne])=>$(Z,X,St({initial:!1,get:_.get},ne)),{equalityFn:dm});k.push(Y)}),()=>k.forEach(X=>X())},[_,w]),D.useEffect(()=>{const k=[];return Object.entries(C).forEach(([X,$])=>k.push(_.subscribeToEditStart(X,$))),Object.entries(b).forEach(([X,$])=>k.push(_.subscribeToEditEnd(X,$))),()=>k.forEach(X=>X())},[C,b,_]),u?[I,R,L]:I}Ta(Zs.SELECT,zY);Ta(Zs.IMAGE,WQ);Ta(Zs.NUMBER,PY);Ta(Zs.COLOR,EQ);Ta(Zs.STRING,KY);Ta(Zs.BOOLEAN,nq);Ta(Zs.INTERVAL,QQ);Ta(Zs.VECTOR3D,wQ);Ta(Zs.VECTOR2D,BQ);function dr(n){return typeof n=="function"}function PN(n){var e=function(r){Error.call(r),r.stack=new Error().stack},t=n(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Wx=PN(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription: +`+t.map(function(r,i){return i+1+") "+r.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=t}});function dA(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}var ym=function(){function n(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var e,t,r,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Gf(o),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(_){e={error:_}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else o.remove(this);var u=this.initialTeardown;if(dr(u))try{u()}catch(_){s=_ instanceof Wx?_.errors:[_]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var p=Gf(h),m=p.next();!m.done;m=p.next()){var g=m.value;try{C2(g)}catch(_){s=s??[],_ instanceof Wx?s=K0(K0([],Dp(s)),Dp(_.errors)):s.push(_)}}}catch(_){r={error:_}}finally{try{m&&!m.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(s)throw new Wx(s)}},n.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)C2(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},n.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},n.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},n.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&dA(t,e)},n.prototype.remove=function(e){var t=this._finalizers;t&&dA(t,e),e instanceof n&&e._removeParent(this)},n.EMPTY=function(){var e=new n;return e.closed=!0,e}(),n}(),IN=ym.EMPTY;function BN(n){return n instanceof ym||n&&"closed"in n&&dr(n.remove)&&dr(n.add)&&dr(n.unsubscribe)}function C2(n){dr(n)?n():n.unsubscribe()}var LN={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},pA={setTimeout:function(n,e){for(var t=[],r=2;r0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),n.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var r=this,i=this,s=i.hasError,o=i.isStopped,a=i.observers;return s||o?IN:(this.currentObservers=null,a.push(t),new ym(function(){r.currentObservers=null,dA(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var r=this,i=r.hasError,s=r.thrownError,o=r.isStopped;i?t.error(s):o&&t.complete()},e.prototype.asObservable=function(){var t=new Xi;return t.source=this,t},e.create=function(t,r){return new gA(t,r)},e}(Xi),gA=function(n){Yc(e,n);function e(t,r){var i=n.call(this)||this;return i.destination=t,i.source=r,i}return e.prototype.next=function(t){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,t)},e.prototype.error=function(t){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,t)},e.prototype.complete=function(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)},e.prototype._subscribe=function(t){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&i!==void 0?i:IN},e}(Vf),ON={now:function(){return(ON.delegate||Date).now()},delegate:void 0},jx=function(n){Yc(e,n);function e(t,r,i){t===void 0&&(t=1/0),r===void 0&&(r=1/0),i===void 0&&(i=ON);var s=n.call(this)||this;return s._bufferSize=t,s._windowTime=r,s._timestampProvider=i,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,r),s}return e.prototype.next=function(t){var r=this,i=r.isStopped,s=r._buffer,o=r._infiniteTimeWindow,a=r._timestampProvider,l=r._windowTime;i||(s.push(t),!o&&s.push(a.now()+l)),this._trimBuffer(),n.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),i=this,s=i._infiniteTimeWindow,o=i._buffer,a=o.slice(),l=0;l{console.log("audio slice ended")}}const r=new Vf;return r.pipe(dte(t)).subscribe(i=>console.log("played audio")),r}var mte={url:"",deserializer:function(n){return JSON.parse(n.data)},serializer:function(n){return JSON.stringify(n)}},gte="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",vte=function(n){Yc(e,n);function e(t,r){var i=n.call(this)||this;if(i._socket=null,t instanceof Xi)i.destination=r,i.source=t;else{var s=i._config=oA({},mte);if(i._output=new Vf,typeof t=="string")s.url=t;else for(var o in t)t.hasOwnProperty(o)&&(s[o]=t[o]);if(!s.WebSocketCtor&&WebSocket)s.WebSocketCtor=WebSocket;else if(!s.WebSocketCtor)throw new Error("no WebSocket constructor can be found");i.destination=new jx}return i}return e.prototype.lift=function(t){var r=new e(this._config,this.destination);return r.operator=t,r.source=this,r},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new jx),this._output=new Vf},e.prototype.multiplex=function(t,r,i){var s=this;return new Xi(function(o){try{s.next(t())}catch(l){o.error(l)}var a=s.subscribe({next:function(l){try{i(l)&&o.next(l)}catch(c){o.error(c)}},error:function(l){return o.error(l)},complete:function(){return o.complete()}});return function(){try{s.next(r())}catch(l){o.error(l)}a.unsubscribe()}})},e.prototype._connectSocket=function(){var t=this,r=this._config,i=r.WebSocketCtor,s=r.protocol,o=r.url,a=r.binaryType,l=this._output,c=null;try{c=s?new i(o,s):new i(o),this._socket=c,a&&(this._socket.binaryType=a)}catch(h){l.error(h);return}var u=new ym(function(){t._socket=null,c&&c.readyState===1&&c.close()});c.onopen=function(h){var p=t._socket;if(!p){c.close(),t._resetState();return}var m=t._config.openObserver;m&&m.next(h);var g=t.destination;t.destination=Yy.create(function(_){if(c.readyState===1)try{var x=t._config.serializer;c.send(x(_))}catch(v){t.destination.error(v)}},function(_){var x=t._config.closingObserver;x&&x.next(void 0),_&&_.code?c.close(_.code,_.reason):l.error(new TypeError(gte)),t._resetState()},function(){var _=t._config.closingObserver;_&&_.next(void 0),c.close(),t._resetState()}),g&&g instanceof jx&&u.add(g.subscribe(t.destination))},c.onerror=function(h){t._resetState(),l.error(h)},c.onclose=function(h){c===t._socket&&t._resetState();var p=t._config.closeObserver;p&&p.next(h),h.wasClean?l.complete():l.error(h)},c.onmessage=function(h){try{var p=t._config.deserializer;l.next(p(h))}catch(m){l.error(m)}}},e.prototype._subscribe=function(t){var r=this,i=this.source;return i?i.subscribe(t):(this._socket||this._connectSocket(),this._output.subscribe(t),t.add(function(){var s=r._socket;r._output.observers.length===0&&(s&&(s.readyState===1||s.readyState===0)&&s.close(),r._resetState())}),t)},e.prototype.unsubscribe=function(){var t=this._socket;t&&(t.readyState===1||t.readyState===0)&&t.close(),this._resetState(),n.prototype.unsubscribe.call(this)},e}(gA);function yte(n){return new vte(n)}function KN(n,e){const t=location.protocol==="https:"?"wss:":"ws:",r=new URL(`${t}//${location.host}/${n}`);return Object.entries(e).forEach(([i,s])=>{r.searchParams.append(i,s)}),new yte({url:r.toString(),serializer:i=>i,deserializer:i=>i})}function _te(){return KN("ws/student"+location.search,{})}const ql={"@":"viseme_sil",sil:"viseme_sil",p:"viseme_PP",b:"viseme_PP",m:"viseme_PP",f:"viseme_FF",v:"viseme_FF",T:"viseme_TH",dh:"viseme_TH",t:"viseme_DD",d:"viseme_DD",k:"viseme_kk",g:"viseme_kk",ng:"viseme_kk",ch:"viseme_CH",j:"viseme_CH",s:"viseme_SS",z:"viseme_SS",sh:"viseme_SS",zh:"viseme_SS",n:"viseme_nn",r:"viseme_RR",er:"viseme_RR",a:"viseme_aa",aa:"viseme_aa",ax:"viseme_aa",ah:"viseme_aa",ae:"viseme_E",ey:"viseme_E",eh:"viseme_E",ih:"viseme_I",ix:"viseme_I",aw:"viseme_O",ow:"viseme_O",ao:"viseme_O",oy:"viseme_O",uw:"viseme_U",uh:"viseme_U",w:"viseme_U",y:"viseme_U",o:"viseme_O",e:"viseme_E",S:"viseme_SS",u:"viseme_U",E:"viseme_E",i:"viseme_I"};function xte(n){const{startRecording:e,startListening:t,playAudio:r,script:i,headFollow:s,smoothMorphTarget:o,morphTargetSmoothing:a}=Uee({startRecording:!1,startListening:!1,playAudio:!1,headFollow:!0,smoothMorphTarget:!0,morphTargetSmoothing:.5,script:{value:"welcome",options:["welcome","pizzas","example"]}}),l=D.useMemo(()=>new Audio(`/audios/${i}.mp3`),[i]),[c,u]=D.useState([]),[h,p]=D.useState(Date.now());D.useEffect(()=>{if(t){const B=pte(),I=_te();return I.subscribe({next(R){if(R.data instanceof Blob)B.next(R.data);else{const L=JSON.parse(R.data);L.type==="Translation"?console.log("translation:",L.content):L.type==="original"?console.log("transcription:",L.content):(u(L.visemes),p(Date.now()))}}}),()=>{I.unsubscribe(),B.unsubscribe()}}},[t]);const m=qi(li,`audios/${i}.json`);JSON.parse(m),Tp(()=>{const B=Date.now()-h,I={visemes:c};Object.values(ql).forEach(R=>{o?(g.Wolf3D_Head.morphTargetInfluences[g.Wolf3D_Head.morphTargetDictionary[R]]=zr.lerp(g.Wolf3D_Head.morphTargetInfluences[g.Wolf3D_Head.morphTargetDictionary[R]],0,a),g.Wolf3D_Teeth.morphTargetInfluences[g.Wolf3D_Teeth.morphTargetDictionary[R]]=zr.lerp(g.Wolf3D_Teeth.morphTargetInfluences[g.Wolf3D_Teeth.morphTargetDictionary[R]],0,a)):(g.Wolf3D_Head.morphTargetInfluences[g.Wolf3D_Head.morphTargetDictionary[R]]=0,g.Wolf3D_Teeth.morphTargetInfluences[g.Wolf3D_Teeth.morphTargetDictionary[R]]=0)});for(let R=0;R=L.time&&B<=L.time+100){o?(g.Wolf3D_Head.morphTargetInfluences[g.Wolf3D_Head.morphTargetDictionary[ql[L.value]]]=zr.lerp(g.Wolf3D_Head.morphTargetInfluences[g.Wolf3D_Head.morphTargetDictionary[ql[L.value]]],1,a),g.Wolf3D_Teeth.morphTargetInfluences[g.Wolf3D_Teeth.morphTargetDictionary[ql[L.value]]]=zr.lerp(g.Wolf3D_Teeth.morphTargetInfluences[g.Wolf3D_Teeth.morphTargetDictionary[ql[L.value]]],1,a)):(g.Wolf3D_Head.morphTargetInfluences[g.Wolf3D_Head.morphTargetDictionary[ql[L.value]]]=1,g.Wolf3D_Teeth.morphTargetInfluences[g.Wolf3D_Teeth.morphTargetDictionary[ql[L.value]]]=1);break}}}),D.useEffect(()=>{g.Wolf3D_Head.morphTargetInfluences[g.Wolf3D_Head.morphTargetDictionary.viseme_I]=1,g.Wolf3D_Teeth.morphTargetInfluences[g.Wolf3D_Teeth.morphTargetDictionary.viseme_I]=1,r?(l.play(),w(i==="welcome"?"Greeting":"Angry")):(w("Idle"),l.pause())},[r,i]);const{nodes:g,materials:_}=Vy("/models/646d9dcdc8a5f5bddbfac913.glb"),{animations:x}=Vd("/animations/Idle.fbx"),{animations:v}=Vd("/animations/Angry Gesture.fbx"),{animations:E}=Vd("/animations/Standing Greeting.fbx");x[0].name="Idle",v[0].name="Angry",E[0].name="Greeting";const[S,w]=D.useState("Idle"),C=D.useRef(),{actions:b}=cX([x[0],v[0],E[0]],C);return D.useEffect(()=>(b[S].reset().fadeIn(.5).play(),()=>b[S].fadeOut(.5)),[S]),Tp(B=>{s&&C.current.getObjectByName("Head").lookAt(B.camera.position)}),wf("group",{...n,dispose:null,ref:C,children:[_n("primitive",{object:g.Hips}),_n("skinnedMesh",{geometry:g.Wolf3D_Body.geometry,material:_.Wolf3D_Body,skeleton:g.Wolf3D_Body.skeleton}),_n("skinnedMesh",{geometry:g.Wolf3D_Outfit_Bottom.geometry,material:_.Wolf3D_Outfit_Bottom,skeleton:g.Wolf3D_Outfit_Bottom.skeleton}),_n("skinnedMesh",{geometry:g.Wolf3D_Outfit_Footwear.geometry,material:_.Wolf3D_Outfit_Footwear,skeleton:g.Wolf3D_Outfit_Footwear.skeleton}),_n("skinnedMesh",{geometry:g.Wolf3D_Outfit_Top.geometry,material:_.Wolf3D_Outfit_Top,skeleton:g.Wolf3D_Outfit_Top.skeleton}),_n("skinnedMesh",{geometry:g.Wolf3D_Hair.geometry,material:_.Wolf3D_Hair,skeleton:g.Wolf3D_Hair.skeleton}),_n("skinnedMesh",{name:"EyeLeft",geometry:g.EyeLeft.geometry,material:_.Wolf3D_Eye,skeleton:g.EyeLeft.skeleton,morphTargetDictionary:g.EyeLeft.morphTargetDictionary,morphTargetInfluences:g.EyeLeft.morphTargetInfluences}),_n("skinnedMesh",{name:"EyeRight",geometry:g.EyeRight.geometry,material:_.Wolf3D_Eye,skeleton:g.EyeRight.skeleton,morphTargetDictionary:g.EyeRight.morphTargetDictionary,morphTargetInfluences:g.EyeRight.morphTargetInfluences}),_n("skinnedMesh",{name:"Wolf3D_Head",geometry:g.Wolf3D_Head.geometry,material:_.Wolf3D_Skin,skeleton:g.Wolf3D_Head.skeleton,morphTargetDictionary:g.Wolf3D_Head.morphTargetDictionary,morphTargetInfluences:g.Wolf3D_Head.morphTargetInfluences}),_n("skinnedMesh",{name:"Wolf3D_Teeth",geometry:g.Wolf3D_Teeth.geometry,material:_.Wolf3D_Teeth,skeleton:g.Wolf3D_Teeth.skeleton,morphTargetDictionary:g.Wolf3D_Teeth.morphTargetDictionary,morphTargetInfluences:g.Wolf3D_Teeth.morphTargetInfluences})]})}Vy.preload("/models/646d9dcdc8a5f5bddbfac913.glb");const Ste=()=>{const n=AM("textures/youtubeBackground.jpg"),e=yi(t=>t.viewport);return wf(nz,{children:[_n(lX,{}),_n(xte,{position:[0,-3,5],scale:2}),_n(mX,{preset:"sunset"}),wf("mesh",{children:[_n("planeGeometry",{args:[e.width,e.height]}),_n("meshBasicMaterial",{map:n})]})]})};function Ete(){return KN("ws/teacher"+location.search,{})}const Ate={audio:!0,video:!1};async function wte(){const n=new Vf;let e=new AudioContext({latencyHint:"interactive"});await e.audioWorklet.addModule("recorderWorkletProcessor.js"),e.resume();const t=await navigator.mediaDevices.getUserMedia(Ate);let r=e.createMediaStreamSource(t),i=new window.AudioWorkletNode(e,"recorder.worklet");return i.connect(e.destination),e.resume(),r.connect(i),i.port.onmessage=s=>{const o=s.data;n.next(o)},n.subscribe({complete(){t.getTracks()[0].stop(),r.disconnect(i),i.disconnect(e.destination),e.close().then(function(){r=null,i=null,e=null}),console.log("Recording completed")}}),n}var xm="delete",Sn=5,ys=1<>>0;if(""+t!==e||t===4294967295)return NaN;e=t}return e<0?Wf(n)+e:e}function YN(){return!0}function Zy(n,e,t){return(n===0&&!ZN(n)||t!==void 0&&n<=-t)&&(e===void 0||t!==void 0&&e>=t)}function Sm(n,e){return qN(n,e,0)}function Qy(n,e){return qN(n,e,e)}function qN(n,e,t){return n===void 0?t:ZN(n)?e===1/0?e:Math.max(0,e+n)|0:e===void 0||e===n?n:Math.min(e,n)|0}function ZN(n){return n<0||n===0&&1/n===-1/0}var QN="@@__IMMUTABLE_ITERABLE__@@";function bi(n){return Boolean(n&&n[QN])}var ek="@@__IMMUTABLE_KEYED__@@";function Rn(n){return Boolean(n&&n[ek])}var tk="@@__IMMUTABLE_INDEXED__@@";function Ti(n){return Boolean(n&&n[tk])}function e_(n){return Rn(n)||Ti(n)}var er=function(e){return bi(e)?e:Ji(e)},bs=function(n){function e(t){return Rn(t)?t:Il(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(er),Zc=function(n){function e(t){return Ti(t)?t:io(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(er),gh=function(n){function e(t){return bi(t)&&!e_(t)?t:xh(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(er);er.Keyed=bs;er.Indexed=Zc;er.Set=gh;var nk="@@__IMMUTABLE_SEQ__@@";function XM(n){return Boolean(n&&n[nk])}var rk="@@__IMMUTABLE_RECORD__@@";function vh(n){return Boolean(n&&n[rk])}function Fo(n){return bi(n)||vh(n)}var yh="@@__IMMUTABLE_ORDERED__@@";function js(n){return Boolean(n&&n[yh])}var Em=0,Qs=1,As=2,yA=typeof Symbol=="function"&&Symbol.iterator,ik="@@iterator",t_=yA||ik,en=function(e){this.next=e};en.prototype.toString=function(){return"[Iterator]"};en.KEYS=Em;en.VALUES=Qs;en.ENTRIES=As;en.prototype.inspect=en.prototype.toSource=function(){return this.toString()};en.prototype[t_]=function(){return this};function Pn(n,e,t,r){var i=n===0?e:n===1?t:[e,t];return r?r.value=i:r={value:i,done:!1},r}function Ci(){return{value:void 0,done:!0}}function sk(n){return Array.isArray(n)?!0:!!n_(n)}function I2(n){return n&&typeof n.next=="function"}function _A(n){var e=n_(n);return e&&e.call(n)}function n_(n){var e=n&&(yA&&n[yA]||n[ik]);if(typeof e=="function")return e}function Mte(n){var e=n_(n);return e&&e===n.entries}function Tte(n){var e=n_(n);return e&&e===n.keys}var _h=Object.prototype.hasOwnProperty;function ok(n){return Array.isArray(n)||typeof n=="string"?!0:n&&typeof n=="object"&&Number.isInteger(n.length)&&n.length>=0&&(n.length===0?Object.keys(n).length===1:n.hasOwnProperty(n.length-1))}var Ji=function(n){function e(t){return t==null?KM():Fo(t)?t.toSeq():Cte(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(r,i){var s=this._cache;if(s){for(var o=s.length,a=0;a!==o;){var l=s[i?o-++a:a++];if(r(l[1],l[0],this)===!1)break}return a}return this.__iterateUncached(r,i)},e.prototype.__iterator=function(r,i){var s=this._cache;if(s){var o=s.length,a=0;return new en(function(){if(a===o)return Ci();var l=s[i?o-++a:a++];return Pn(r,l[0],l[1])})}return this.__iteratorUncached(r,i)},e}(er),Il=function(n){function e(t){return t==null?KM().toKeyedSeq():bi(t)?Rn(t)?t.toSeq():t.fromEntrySeq():vh(t)?t.toSeq():YM(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e}(Ji),io=function(n){function e(t){return t==null?KM():bi(t)?Rn(t)?t.entrySeq():t.toIndexedSeq():vh(t)?t.toSeq().entrySeq():ak(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e}(Ji),xh=function(n){function e(t){return(bi(t)&&!e_(t)?t:io(t)).toSetSeq()}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e}(Ji);Ji.isSeq=XM;Ji.Keyed=Il;Ji.Set=xh;Ji.Indexed=io;Ji.prototype[nk]=!0;var Hc=function(n){function e(t){this._array=t,this.size=t.length}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return this.has(r)?this._array[El(this,r)]:i},e.prototype.__iterate=function(r,i){for(var s=this._array,o=s.length,a=0;a!==o;){var l=i?o-++a:a++;if(r(s[l],l,this)===!1)break}return a},e.prototype.__iterator=function(r,i){var s=this._array,o=s.length,a=0;return new en(function(){if(a===o)return Ci();var l=i?o-++a:a++;return Pn(r,l,s[l])})},e}(io),JM=function(n){function e(t){var r=Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]);this._object=t,this._keys=r,this.size=r.length}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return i!==void 0&&!this.has(r)?i:this._object[r]},e.prototype.has=function(r){return _h.call(this._object,r)},e.prototype.__iterate=function(r,i){for(var s=this._object,o=this._keys,a=o.length,l=0;l!==a;){var c=o[i?a-++l:l++];if(r(s[c],c,this)===!1)break}return l},e.prototype.__iterator=function(r,i){var s=this._object,o=this._keys,a=o.length,l=0;return new en(function(){if(l===a)return Ci();var c=o[i?a-++l:l++];return Pn(r,c,s[c])})},e}(Il);JM.prototype[yh]=!0;var bte=function(n){function e(t){this._collection=t,this.size=t.length||t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(r,i){if(i)return this.cacheResult().__iterate(r,i);var s=this._collection,o=_A(s),a=0;if(I2(o))for(var l;!(l=o.next()).done&&r(l.value,a++,this)!==!1;);return a},e.prototype.__iteratorUncached=function(r,i){if(i)return this.cacheResult().__iterator(r,i);var s=this._collection,o=_A(s);if(!I2(o))return new en(Ci);var a=0;return new en(function(){var l=o.next();return l.done?l:Pn(r,a++,l.value)})},e}(io),B2;function KM(){return B2||(B2=new Hc([]))}function YM(n){var e=qM(n);if(e)return e.fromEntrySeq();if(typeof n=="object")return new JM(n);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+n)}function ak(n){var e=qM(n);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+n)}function Cte(n){var e=qM(n);if(e)return Mte(n)?e.fromEntrySeq():Tte(n)?e.toSetSeq():e;if(typeof n=="object")return new JM(n);throw new TypeError("Expected Array or collection object of values, or keyed object: "+n)}function qM(n){return ok(n)?new Hc(n):sk(n)?new bte(n):void 0}var lk="@@__IMMUTABLE_MAP__@@";function ZM(n){return Boolean(n&&n[lk])}function ck(n){return ZM(n)&&js(n)}function L2(n){return Boolean(n&&typeof n.equals=="function"&&typeof n.hashCode=="function")}function Gi(n,e){if(n===e||n!==n&&e!==e)return!0;if(!n||!e)return!1;if(typeof n.valueOf=="function"&&typeof e.valueOf=="function"){if(n=n.valueOf(),e=e.valueOf(),n===e||n!==n&&e!==e)return!0;if(!n||!e)return!1}return!!(L2(n)&&L2(e)&&n.equals(e))}var md=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(e,t){e|=0,t|=0;var r=e&65535,i=t&65535;return r*i+((e>>>16)*i+r*(t>>>16)<<16>>>0)|0};function r_(n){return n>>>1&1073741824|n&3221225471}var Rte=Object.prototype.valueOf;function Fi(n){if(n==null)return D2(n);if(typeof n.hashCode=="function")return r_(n.hashCode(n));var e=Ote(n);if(e==null)return D2(e);switch(typeof e){case"boolean":return e?1108378657:1108378656;case"number":return Pte(e);case"string":return e.length>Fte?Ite(e):xA(e);case"object":case"function":return Lte(e);case"symbol":return Bte(e);default:if(typeof e.toString=="function")return xA(e.toString());throw new Error("Value type "+typeof e+" cannot be hashed.")}}function D2(n){return n===null?1108378658:1108378659}function Pte(n){if(n!==n||n===1/0)return 0;var e=n|0;for(e!==n&&(e^=n*4294967295);n>4294967295;)n/=4294967295,e^=n;return r_(e)}function Ite(n){var e=Kx[n];return e===void 0&&(e=xA(n),Jx===Nte&&(Jx=0,Kx={}),Jx++,Kx[n]=e),e}function xA(n){for(var e=0,t=0;t0)switch(n.nodeType){case 1:return n.uniqueID;case 9:return n.documentElement&&n.documentElement.uniqueID}}function Ote(n){return n.valueOf!==Rte&&typeof n.valueOf=="function"?n.valueOf(n):n}function uk(){var n=++Xx;return Xx&1073741824&&(Xx=0),n}var SA=typeof WeakMap=="function",EA;SA&&(EA=new WeakMap);var N2=Object.create(null),Xx=0,oc="__immutablehash__";typeof Symbol=="function"&&(oc=Symbol(oc));var Fte=16,Nte=255,Jx=0,Kx={},i_=function(n){function e(t,r){this._iter=t,this._useKeys=r,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return this._iter.get(r,i)},e.prototype.has=function(r){return this._iter.has(r)},e.prototype.valueSeq=function(){return this._iter.valueSeq()},e.prototype.reverse=function(){var r=this,i=QM(this,!0);return this._useKeys||(i.valueSeq=function(){return r._iter.toSeq().reverse()}),i},e.prototype.map=function(r,i){var s=this,o=mk(this,r,i);return this._useKeys||(o.valueSeq=function(){return s._iter.toSeq().map(r,i)}),o},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o,a){return r(o,a,s)},i)},e.prototype.__iterator=function(r,i){return this._iter.__iterator(r,i)},e}(Il);i_.prototype[yh]=!0;var fk=function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.includes=function(r){return this._iter.includes(r)},e.prototype.__iterate=function(r,i){var s=this,o=0;return i&&Wf(this),this._iter.__iterate(function(a){return r(a,i?s.size-++o:o++,s)},i)},e.prototype.__iterator=function(r,i){var s=this,o=this._iter.__iterator(Qs,i),a=0;return i&&Wf(this),new en(function(){var l=o.next();return l.done?l:Pn(r,i?s.size-++a:a++,l.value,l)})},e}(io),hk=function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.has=function(r){return this._iter.includes(r)},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){return r(o,o,s)},i)},e.prototype.__iterator=function(r,i){var s=this._iter.__iterator(Qs,i);return new en(function(){var o=s.next();return o.done?o:Pn(r,o.value,o.value,o)})},e}(xh),dk=function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.entrySeq=function(){return this._iter.toSeq()},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){if(o){U2(o);var a=bi(o);return r(a?o.get(1):o[1],a?o.get(0):o[0],s)}},i)},e.prototype.__iterator=function(r,i){var s=this._iter.__iterator(Qs,i);return new en(function(){for(;;){var o=s.next();if(o.done)return o;var a=o.value;if(a){U2(a);var l=bi(a);return Pn(r,l?a.get(0):a[0],l?a.get(1):a[1],o)}}})},e}(Il);fk.prototype.cacheResult=i_.prototype.cacheResult=hk.prototype.cacheResult=dk.prototype.cacheResult=nT;function pk(n){var e=No(n);return e._iter=n,e.size=n.size,e.flip=function(){return n},e.reverse=function(){var t=n.reverse.apply(this);return t.flip=function(){return n.reverse()},t},e.has=function(t){return n.includes(t)},e.includes=function(t){return n.has(t)},e.cacheResult=nT,e.__iterateUncached=function(t,r){var i=this;return n.__iterate(function(s,o){return t(o,s,i)!==!1},r)},e.__iteratorUncached=function(t,r){if(t===As){var i=n.__iterator(t,r);return new en(function(){var s=i.next();if(!s.done){var o=s.value[0];s.value[0]=s.value[1],s.value[1]=o}return s})}return n.__iterator(t===Qs?Em:Qs,r)},e}function mk(n,e,t){var r=No(n);return r.size=n.size,r.has=function(i){return n.has(i)},r.get=function(i,s){var o=n.get(i,$t);return o===$t?s:e.call(t,o,i,n)},r.__iterateUncached=function(i,s){var o=this;return n.__iterate(function(a,l,c){return i(e.call(t,a,l,c),l,o)!==!1},s)},r.__iteratorUncached=function(i,s){var o=n.__iterator(As,s);return new en(function(){var a=o.next();if(a.done)return a;var l=a.value,c=l[0];return Pn(i,c,e.call(t,l[1],c,n),a)})},r}function QM(n,e){var t=this,r=No(n);return r._iter=n,r.size=n.size,r.reverse=function(){return n},n.flip&&(r.flip=function(){var i=pk(n);return i.reverse=function(){return n.flip()},i}),r.get=function(i,s){return n.get(e?i:-1-i,s)},r.has=function(i){return n.has(e?i:-1-i)},r.includes=function(i){return n.includes(i)},r.cacheResult=nT,r.__iterate=function(i,s){var o=this,a=0;return s&&Wf(n),n.__iterate(function(l,c){return i(l,e?c:s?o.size-++a:a++,o)},!s)},r.__iterator=function(i,s){var o=0;s&&Wf(n);var a=n.__iterator(As,!s);return new en(function(){var l=a.next();if(l.done)return l;var c=l.value;return Pn(i,e?c[0]:s?t.size-++o:o++,c[1],l)})},r}function gk(n,e,t,r){var i=No(n);return r&&(i.has=function(s){var o=n.get(s,$t);return o!==$t&&!!e.call(t,o,s,n)},i.get=function(s,o){var a=n.get(s,$t);return a!==$t&&e.call(t,a,s,n)?a:o}),i.__iterateUncached=function(s,o){var a=this,l=0;return n.__iterate(function(c,u,h){if(e.call(t,c,u,h))return l++,s(c,r?u:l-1,a)},o),l},i.__iteratorUncached=function(s,o){var a=n.__iterator(As,o),l=0;return new en(function(){for(;;){var c=a.next();if(c.done)return c;var u=c.value,h=u[0],p=u[1];if(e.call(t,p,h,n))return Pn(s,r?h:l++,p,c)}})},i}function kte(n,e,t){var r=Eh().asMutable();return n.__iterate(function(i,s){r.update(e.call(t,i,s,n),0,function(o){return o+1})}),r.asImmutable()}function Ute(n,e,t){var r=Rn(n),i=(js(n)?Aa():Eh()).asMutable();n.__iterate(function(o,a){i.update(e.call(t,o,a,n),function(l){return l=l||[],l.push(r?[a,o]:o),l})});var s=tT(n);return i.map(function(o){return dn(n,s(o))}).asImmutable()}function zte(n,e,t){var r=Rn(n),i=[[],[]];n.__iterate(function(o,a){i[e.call(t,o,a,n)?1:0].push(r?[a,o]:o)});var s=tT(n);return i.map(function(o){return dn(n,s(o))})}function eT(n,e,t,r){var i=n.size;if(Zy(e,t,i))return n;var s=Sm(e,i),o=Qy(t,i);if(s!==s||o!==o)return eT(n.toSeq().cacheResult(),e,t,r);var a=o-s,l;a===a&&(l=a<0?0:a);var c=No(n);return c.size=l===0?l:n.size&&l||void 0,!r&&XM(n)&&l>=0&&(c.get=function(u,h){return u=El(this,u),u>=0&&ul)return Ci();var _=p.next();return r||u===Qs||_.done?_:u===Em?Pn(u,g-1,void 0,_):Pn(u,g-1,_.value[1],_)})},c}function Hte(n,e,t){var r=No(n);return r.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var a=0;return n.__iterate(function(l,c,u){return e.call(t,l,c,u)&&++a&&i(l,c,o)}),a},r.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var a=n.__iterator(As,s),l=!0;return new en(function(){if(!l)return Ci();var c=a.next();if(c.done)return c;var u=c.value,h=u[0],p=u[1];return e.call(t,p,h,o)?i===As?c:Pn(i,h,p,c):(l=!1,Ci())})},r}function vk(n,e,t,r){var i=No(n);return i.__iterateUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterate(s,o);var l=!0,c=0;return n.__iterate(function(u,h,p){if(!(l&&(l=e.call(t,u,h,p))))return c++,s(u,r?h:c-1,a)}),c},i.__iteratorUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterator(s,o);var l=n.__iterator(As,o),c=!0,u=0;return new en(function(){var h,p,m;do{if(h=l.next(),h.done)return r||s===Qs?h:s===Em?Pn(s,u++,void 0,h):Pn(s,u++,h.value[1],h);var g=h.value;p=g[0],m=g[1],c&&(c=e.call(t,m,p,a))}while(c);return s===As?h:Pn(s,p,m,h)})},i}function Gte(n,e){var t=Rn(n),r=[n].concat(e).map(function(o){return bi(o)?t&&(o=bs(o)):o=t?YM(o):ak(Array.isArray(o)?o:[o]),o}).filter(function(o){return o.size!==0});if(r.length===0)return n;if(r.length===1){var i=r[0];if(i===n||t&&Rn(i)||Ti(n)&&Ti(i))return i}var s=new Hc(r);return t?s=s.toKeyedSeq():Ti(n)||(s=s.toSetSeq()),s=s.flatten(!0),s.size=r.reduce(function(o,a){if(o!==void 0){var l=a.size;if(l!==void 0)return o+l}},0),s}function yk(n,e,t){var r=No(n);return r.__iterateUncached=function(i,s){if(s)return this.cacheResult().__iterate(i,s);var o=0,a=!1;function l(c,u){c.__iterate(function(h,p){return(!e||u0}function kv(n,e,t,r){var i=No(n),s=new Hc(t).map(function(o){return o.size});return i.size=r?s.max():s.min(),i.__iterate=function(o,a){for(var l=this.__iterator(Qs,a),c,u=0;!(c=l.next()).done&&o(c.value,u++,this)!==!1;);return u},i.__iteratorUncached=function(o,a){var l=t.map(function(h){return h=er(h),_A(a?h.reverse():h)}),c=0,u=!1;return new en(function(){var h;return u||(h=l.map(function(p){return p.next()}),u=r?h.every(function(p){return p.done}):h.some(function(p){return p.done})),u?Ci():Pn(o,c++,e.apply(null,h.map(function(p){return p.value})))})},i}function dn(n,e){return n===e?n:XM(n)?e:n.constructor(e)}function U2(n){if(n!==Object(n))throw new TypeError("Expected [K, V] tuple: "+n)}function tT(n){return Rn(n)?bs:Ti(n)?Zc:gh}function No(n){return Object.create((Rn(n)?Il:Ti(n)?io:xh).prototype)}function nT(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Ji.prototype.cacheResult.call(this)}function _k(n,e){return n===void 0&&e===void 0?0:n===void 0?1:e===void 0?-1:n>e?1:n0;)e[t]=arguments[t+1];if(typeof n!="function")throw new TypeError("Invalid merger function: "+n);return Tk(this,e,n)}function Tk(n,e,t){for(var r=[],i=0;i0;)e[t]=arguments[t+1];return lT(this,e,n)}function uT(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Sh(this,n,zs(),function(r){return cT(r,e)})}function fT(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Sh(this,n,zs(),function(r){return lT(r,e)})}function Am(n){var e=this.asMutable();return n(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}function wm(){return this.__ownerID?this:this.__ensureOwner(new jM)}function Mm(){return this.__ensureOwner()}function hT(){return this.__altered}var Eh=function(n){function e(t){return t==null?zs():ZM(t)&&!js(t)?t:zs().withMutations(function(r){var i=n(t);Ni(i.size),i.forEach(function(s,o){return r.set(o,s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return zs().withMutations(function(s){for(var o=0;o=r.length)throw new Error("Missing value for key: "+r[o]);s.set(r[o],r[o+1])}})},e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(r,i){return this._root?this._root.get(0,void 0,r,i):i},e.prototype.set=function(r,i){return G2(this,r,i)},e.prototype.remove=function(r){return G2(this,r,$t)},e.prototype.deleteAll=function(r){var i=er(r);return i.size===0?this:this.withMutations(function(s){i.forEach(function(o){return s.remove(o)})})},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):zs()},e.prototype.sort=function(r){return Aa($f(this,r))},e.prototype.sortBy=function(r,i){return Aa($f(this,i,r))},e.prototype.map=function(r,i){var s=this;return this.withMutations(function(o){o.forEach(function(a,l){o.set(l,r.call(i,a,l,s))})})},e.prototype.__iterator=function(r,i){return new ene(this,r,i)},e.prototype.__iterate=function(r,i){var s=this,o=0;return this._root&&this._root.iterate(function(a){return o++,r(a[1],a[0],s)},i),o},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?dT(this.size,this._root,r,this.__hash):this.size===0?zs():(this.__ownerID=r,this.__altered=!1,this)},e}(bs);Eh.isMap=ZM;var wn=Eh.prototype;wn[lk]=!0;wn[xm]=wn.remove;wn.removeAll=wn.deleteAll;wn.setIn=iT;wn.removeIn=wn.deleteIn=sT;wn.update=oT;wn.updateIn=aT;wn.merge=wn.concat=wk;wn.mergeWith=Mk;wn.mergeDeep=bk;wn.mergeDeepWith=Ck;wn.mergeIn=uT;wn.mergeDeepIn=fT;wn.withMutations=Am;wn.wasAltered=hT;wn.asImmutable=Mm;wn["@@transducer/init"]=wn.asMutable=wm;wn["@@transducer/step"]=function(n,e){return n.set(e[0],e[1])};wn["@@transducer/result"]=function(n){return n.asImmutable()};var Fp=function(e,t){this.ownerID=e,this.entries=t};Fp.prototype.get=function(e,t,r,i){for(var s=this.entries,o=0,a=s.length;o=one)return tne(e,c,i,s);var m=e&&e===this.ownerID,g=m?c:xo(c);return p?l?u===h-1?g.pop():g[u]=g.pop():g[u]=[i,s]:g.push([i,s]),m?(this.entries=g,this):new Fp(e,g)}};var jf=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};jf.prototype.get=function(e,t,r,i){t===void 0&&(t=Fi(r));var s=1<<((e===0?t:t>>>e)&si),o=this.bitmap;return o&s?this.nodes[Rk(o&s-1)].get(e+Sn,t,r,i):i};jf.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=Fi(i));var l=(t===0?r:r>>>t)&si,c=1<=ane)return rne(e,m,u,l,_);if(h&&!_&&m.length===2&&V2(m[p^1]))return m[p^1];if(h&&_&&m.length===1&&V2(_))return _;var x=e&&e===this.ownerID,v=h?_?u:u^c:u|c,E=h?_?Pk(m,p,_,x):sne(m,p,x):ine(m,p,_,x);return x?(this.bitmap=v,this.nodes=E,this):new jf(e,v,E)};var Np=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};Np.prototype.get=function(e,t,r,i){t===void 0&&(t=Fi(r));var s=(e===0?t:t>>>e)&si,o=this.nodes[s];return o?o.get(e+Sn,t,r,i):i};Np.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=Fi(i));var l=(t===0?r:r>>>t)&si,c=s===$t,u=this.nodes,h=u[l];if(c&&!h)return this;var p=pT(h,e,t+Sn,r,i,s,o,a);if(p===h)return this;var m=this.count;if(!h)m++;else if(!p&&(m--,m>>t)&si,o=(t===0?r:r>>>t)&si,a,l=s===o?[mT(n,e,t+Sn,r,i)]:(a=new Ea(e,r,i),s>>=1)o[a]=t&1?e[s++]:void 0;return o[r]=i,new Np(n,s+1,o)}function Rk(n){return n-=n>>1&1431655765,n=(n&858993459)+(n>>2&858993459),n=n+(n>>4)&252645135,n+=n>>8,n+=n>>16,n&127}function Pk(n,e,t,r){var i=r?n:xo(n);return i[e]=t,i}function ine(n,e,t,r){var i=n.length+1;if(r&&e+1===i)return n[e]=t,n;for(var s=new Array(i),o=0,a=0;a0&&s=0&&r>>t&si;if(i>=this.array.length)return new pl([],e);var s=i===0,o;if(t>0){var a=this.array[i];if(o=a&&a.removeBefore(e,t-Sn,r),o===a&&s)return this}if(s&&!o)return this;var l=Jf(this,e);if(!s)for(var c=0;c>>t&si;if(i>=this.array.length)return this;var s;if(t>0){var o=this.array[i];if(s=o&&o.removeAfter(e,t-Sn,r),s===o&&i===this.array.length-1)return this}var a=Jf(this,e);return a.array.splice(i+1),s&&(a.array[i]=s),a};var Xd={};function W2(n,e){var t=n._origin,r=n._capacity,i=Up(r),s=n._tail;return o(n._root,n._level,0);function o(c,u,h){return u===0?a(c,h):l(c,u,h)}function a(c,u){var h=u===i?s&&s.array:c&&c.array,p=u>t?0:t-u,m=r-u;return m>ys&&(m=ys),function(){if(p===m)return Xd;var g=e?--m:p++;return h&&h[g]}}function l(c,u,h){var p,m=c&&c.array,g=h>t?0:t-h>>u,_=(r-h>>u)+1;return _>ys&&(_=ys),function(){for(;;){if(p){var x=p();if(x!==Xd)return x;p=null}if(g===_)return Xd;var v=e?--_:g++;p=o(m&&m[v],u-Sn,h+(v<=n.size||e<0)return n.withMutations(function(o){e<0?Ja(o,e).set(0,t):Ja(o,0,e+1).set(e,t)});e+=n._origin;var r=n._tail,i=n._root,s=vA();return e>=Up(n._capacity)?r=AA(r,n.__ownerID,0,e,t,s):i=AA(i,n.__ownerID,n._level,e,t,s),s.value?n.__ownerID?(n._root=i,n._tail=r,n.__hash=void 0,n.__altered=!0,n):kp(n._origin,n._capacity,n._level,i,r):n}function AA(n,e,t,r,i,s){var o=r>>>t&si,a=n&&o0){var c=n&&n.array[o],u=AA(c,e,t-Sn,r,i,s);return u===c?n:(l=Jf(n,e),l.array[o]=u,l)}return a&&n.array[o]===i?n:(s&&_s(s),l=Jf(n,e),i===void 0&&o===l.array.length-1?l.array.pop():l.array[o]=i,l)}function Jf(n,e){return e&&n&&e===n.ownerID?n:new pl(n?n.array.slice():[],e)}function Lk(n,e){if(e>=Up(n._capacity))return n._tail;if(e<1<0;)t=t.array[e>>>r&si],r-=Sn;return t}}function Ja(n,e,t){e!==void 0&&(e|=0),t!==void 0&&(t|=0);var r=n.__ownerID||new jM,i=n._origin,s=n._capacity,o=i+e,a=t===void 0?s:t<0?s+t:i+t;if(o===i&&a===s)return n;if(o>=a)return n.clear();for(var l=n._level,c=n._root,u=0;o+u<0;)c=new pl(c&&c.array.length?[void 0,c]:[],r),l+=Sn,u+=1<=1<h?new pl([],r):m;if(m&&p>h&&oSn;x-=Sn){var v=h>>>x&si;_=_.array[v]=Jf(_.array[v],r)}_.array[h>>>Sn&si]=m}if(a=p)o-=p,a-=p,l=Sn,c=null,g=g&&g.removeBefore(r,0,o);else if(o>i||p>>l&si;if(E!==p>>>l&si)break;E&&(u+=(1<i&&(c=c.removeBefore(r,l,o-u)),c&&p>>Sn<=ys&&i.size>=r.size*2?(l=i.filter(function(c,u){return c!==void 0&&s!==u}),a=l.toKeyedSeq().map(function(c){return c[0]}).flip().toMap(),n.__ownerID&&(a.__ownerID=l.__ownerID=n.__ownerID)):(a=r.remove(e),l=s===i.size-1?i.pop():i.set(s,void 0))}else if(o){if(t===i.get(s)[1])return n;a=r,l=i.set(s,[e,t])}else a=r.set(e,i.size),l=i.set(i.size,[e,t]);return n.__ownerID?(n.size=a.size,n._map=a,n._list=l,n.__hash=void 0,n.__altered=!0,n):gT(a,l)}var Dk="@@__IMMUTABLE_STACK__@@";function wA(n){return Boolean(n&&n[Dk])}var vT=function(n){function e(t){return t==null?Uv():wA(t)?t:Uv().pushAll(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(r,i){var s=this._head;for(r=El(this,r);s&&r--;)s=s.next;return s?s.value:i},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var r=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,s=this._head,o=arguments.length-1;o>=0;o--)s={value:r[o],next:s};return this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):Md(i,s)},e.prototype.pushAll=function(r){if(r=n(r),r.size===0)return this;if(this.size===0&&wA(r))return r;Ni(r.size);var i=this.size,s=this._head;return r.__iterate(function(o){i++,s={value:o,next:s}},!0),this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):Md(i,s)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Uv()},e.prototype.slice=function(r,i){if(Zy(r,i,this.size))return this;var s=Sm(r,this.size),o=Qy(i,this.size);if(o!==this.size)return n.prototype.slice.call(this,r,i);for(var a=this.size-s,l=this._head;s--;)l=l.next;return this.__ownerID?(this.size=a,this._head=l,this.__hash=void 0,this.__altered=!0,this):Md(a,l)},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?Md(this.size,this._head,r,this.__hash):this.size===0?Uv():(this.__ownerID=r,this.__altered=!1,this)},e.prototype.__iterate=function(r,i){var s=this;if(i)return new Hc(this.toArray()).__iterate(function(l,c){return r(l,c,s)},i);for(var o=0,a=this._head;a&&r(a.value,o++,this)!==!1;)a=a.next;return o},e.prototype.__iterator=function(r,i){if(i)return new Hc(this.toArray()).__iterator(r,i);var s=0,o=this._head;return new en(function(){if(o){var a=o.value;return o=o.next,Pn(r,s++,a)}return Ci()})},e}(Zc);vT.isStack=wA;var ci=vT.prototype;ci[Dk]=!0;ci.shift=ci.pop;ci.unshift=ci.push;ci.unshiftAll=ci.pushAll;ci.withMutations=Am;ci.wasAltered=hT;ci.asImmutable=Mm;ci["@@transducer/init"]=ci.asMutable=wm;ci["@@transducer/step"]=function(n,e){return n.unshift(e)};ci["@@transducer/result"]=function(n){return n.asImmutable()};function Md(n,e,t,r){var i=Object.create(ci);return i.size=n,i._head=e,i.__ownerID=t,i.__hash=r,i.__altered=!1,i}var J2;function Uv(){return J2||(J2=Md(0))}var Ok="@@__IMMUTABLE_SET__@@";function yT(n){return Boolean(n&&n[Ok])}function Fk(n){return yT(n)&&js(n)}function Nk(n,e){if(n===e)return!0;if(!bi(e)||n.size!==void 0&&e.size!==void 0&&n.size!==e.size||n.__hash!==void 0&&e.__hash!==void 0&&n.__hash!==e.__hash||Rn(n)!==Rn(e)||Ti(n)!==Ti(e)||js(n)!==js(e))return!1;if(n.size===0&&e.size===0)return!0;var t=!e_(n);if(js(n)){var r=n.entries();return e.every(function(l,c){var u=r.next().value;return u&&Gi(u[1],l)&&(t||Gi(u[0],c))})&&r.next().done}var i=!1;if(n.size===void 0)if(e.size===void 0)typeof n.cacheResult=="function"&&n.cacheResult();else{i=!0;var s=n;n=e,e=s}var o=!0,a=e.__iterate(function(l,c){if(t?!n.has(l):i?!Gi(l,n.get(c,$t)):!Gi(n.get(c,$t),l))return o=!1,!1});return o&&n.size===a}function Qc(n,e){var t=function(r){n.prototype[r]=e[r]};return Object.keys(e).forEach(t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(t),n}function sy(n){if(!n||typeof n!="object")return n;if(!bi(n)){if(!Al(n))return n;n=Ji(n)}if(Rn(n)){var e={};return n.__iterate(function(r,i){e[i]=sy(r)}),e}var t=[];return n.__iterate(function(r){t.push(sy(r))}),t}var s_=function(n){function e(t){return t==null?Td():yT(t)&&!js(t)?t:Td().withMutations(function(r){var i=n(t);Ni(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(r){return this(bs(r).keySeq())},e.intersect=function(r){return r=er(r).toArray(),r.length?br.intersect.apply(e(r.pop()),r):Td()},e.union=function(r){return r=er(r).toArray(),r.length?br.union.apply(e(r.pop()),r):Td()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(r){return this._map.has(r)},e.prototype.add=function(r){return zv(this,this._map.set(r,r))},e.prototype.remove=function(r){return zv(this,this._map.remove(r))},e.prototype.clear=function(){return zv(this,this._map.clear())},e.prototype.map=function(r,i){var s=this,o=!1,a=zv(this,this._map.mapEntries(function(l){var c=l[1],u=r.call(i,c,c,s);return u!==c&&(o=!0),[u,u]},i));return o?a:this},e.prototype.union=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return r=r.filter(function(s){return s.size!==0}),r.length===0?this:this.size===0&&!this.__ownerID&&r.length===1?this.constructor(r[0]):this.withMutations(function(s){for(var o=0;o=0&&i=0&&sthis.size?t:this.find(function(r,i){return i===e},void 0,t)},has:function(e){return e=El(this,e),e>=0&&(this.size!==void 0?this.size===1/0||ee?-1:0}function mne(n){if(n.size===1/0)return 0;var e=js(n),t=Rn(n),r=e?1:0,i=n.__iterate(t?e?function(s,o){r=31*r+eB(Fi(s),Fi(o))|0}:function(s,o){r=r+eB(Fi(s),Fi(o))|0}:e?function(s){r=31*r+Fi(s)|0}:function(s){r=r+Fi(s)|0});return gne(i,r)}function gne(n,e){return e=md(e,3432918353),e=md(e<<15|e>>>-15,461845907),e=md(e<<13|e>>>-13,5),e=(e+3864292196|0)^n,e=md(e^e>>>16,2246822507),e=md(e^e>>>13,3266489909),e=r_(e^e>>>16),e}function eB(n,e){return n^e+2654435769+(n<<6)+(n>>2)|0}var zp=function(n){function e(t){return t==null?MA():Fk(t)?t:MA().withMutations(function(r){var i=gh(t);Ni(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(r){return this(bs(r).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e}(s_);zp.isOrderedSet=Fk;var eu=zp.prototype;eu[yh]=!0;eu.zip=Ah.zip;eu.zipWith=Ah.zipWith;eu.zipAll=Ah.zipAll;eu.__empty=MA;eu.__make=Gk;function Gk(n,e){var t=Object.create(eu);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var tB;function MA(){return tB||(tB=Gk(wd()))}function vne(n){if(vh(n))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(Fo(n))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(n===null||typeof n!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var Ar=function(e,t){var r;vne(e);var i=function(a){var l=this;if(a instanceof i)return a;if(!(this instanceof i))return new i(a);if(!r){r=!0;var c=Object.keys(e),u=s._indices={};s._name=t,s._keys=c,s._defaultValues=e;for(var h=0;h{if(r){const c=Ete();return c.subscribe({next(h){const p=JSON.parse(h.data);p.type==="original"&&(p.isFinal?(o(m=>m.push(p.content)),l("")):l(p.content))}}),ute(wte()).pipe(ry(h=>h)).subscribe(h=>c.next(new Blob([h]))),()=>{recorder$.complete(),recorder$.unsubscribe(),c.unsubscribe()}}},[r]),wf("div",{children:[wf("button",{onClick:()=>i(!r),children:[r?"Stop":"Start"," Recording"]}),_n("h2",{children:"History"}),_n("div",{id:"history",style:{overflowY:"scroll",maxHeight:"300px"},children:s.map((c,u)=>_n("p",{children:c},u))}),_n("h2",{children:"Latest"}),_n("div",{id:"partial",children:a})]})}Qx.createRoot(document.getElementById("root")).render(_n(Q.StrictMode,{children:_n(_ne,{})}));