function BH(n,e){for(var t=0;ti[r]})}}}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 r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function md(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var AD={exports:{}},Fy={},ED={exports:{}},Dt={};/** * @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 om=Symbol.for("react.element"),DH=Symbol.for("react.portal"),LH=Symbol.for("react.fragment"),OH=Symbol.for("react.strict_mode"),FH=Symbol.for("react.profiler"),NH=Symbol.for("react.provider"),UH=Symbol.for("react.context"),kH=Symbol.for("react.forward_ref"),zH=Symbol.for("react.suspense"),HH=Symbol.for("react.memo"),GH=Symbol.for("react.lazy"),rR=Symbol.iterator;function VH(n){return n===null||typeof n!="object"?null:(n=rR&&n[rR]||n["@@iterator"],typeof n=="function"?n:null)}var MD={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},wD=Object.assign,TD={};function gd(n,e,t){this.props=n,this.context=e,this.refs=TD,this.updater=t||MD}gd.prototype.isReactComponent={};gd.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")};gd.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function bD(){}bD.prototype=gd.prototype;function IM(n,e,t){this.props=n,this.context=e,this.refs=TD,this.updater=t||MD}var BM=IM.prototype=new bD;BM.constructor=IM;wD(BM,gd.prototype);BM.isPureReactComponent=!0;var sR=Array.isArray,CD=Object.prototype.hasOwnProperty,DM={current:null},RD={key:!0,ref:!0,__self:!0,__source:!0};function PD(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)CD.call(e,i)&&!RD.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1>>1,Y=z[V];if(0>>1;Vr(ve,K))Cer(Ue,ve)?(z[V]=Ue,z[Ce]=K,V=Ce):(z[V]=ve,z[ge]=K,V=ge);else if(Cer(Ue,K))z[V]=Ue,z[Ce]=K,V=Ce;else break e}}return j}function r(z,j){var K=z.sortIndex-j.sortIndex;return K!==0?K:z.id-j.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,v=!1,y=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(z){for(var j=t(c);j!==null;){if(j.callback===null)i(c);else if(j.startTime<=z)i(c),j.sortIndex=j.expirationTime,e(l,j);else break;j=t(c)}}function M(z){if(y=!1,A(z),!v)if(t(l)!==null)v=!0,q(w);else{var j=t(c);j!==null&&Q(M,j.startTime-z)}}function w(z,j){v=!1,y&&(y=!1,g(D),D=-1),m=!0;var K=p;try{for(A(j),h=t(l);h!==null&&(!(h.expirationTime>j)||z&&!O());){var V=h.callback;if(typeof V=="function"){h.callback=null,p=h.priorityLevel;var Y=V(h.expirationTime<=j);j=n.unstable_now(),typeof Y=="function"?h.callback=Y:h===t(l)&&i(l),A(j)}else i(l);h=t(l)}if(h!==null)var de=!0;else{var ge=t(c);ge!==null&&Q(M,ge.startTime-j),de=!1}return de}finally{h=null,p=K,m=!1}}var b=!1,R=null,D=-1,C=5,I=-1;function O(){return!(n.unstable_now()-Iz||125V?(z.sortIndex=K,e(c,z),t(l)===null&&z===t(c)&&(y?(g(D),D=-1):y=!0,Q(M,K-V))):(z.sortIndex=Y,e(l,z),v||m||(v=!0,q(w))),z},n.unstable_shouldYield=O,n.unstable_wrapCallback=function(z){var j=p;return function(){var K=p;p=j;try{return z.apply(this,arguments)}finally{p=K}}}})(LD);DD.exports=LD;var t4=DD.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var OD=B,jr=t4;function Ae(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"),XS=Object.prototype.hasOwnProperty,n4=/^[: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]*$/,aR={},lR={};function i4(n){return XS.call(lR,n)?!0:XS.call(aR,n)?!1:n4.test(n)?lR[n]=!0:(aR[n]=!0,!1)}function r4(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function s4(n,e,t,i){if(e===null||typeof e>"u"||r4(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function lr(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Ri={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Ri[n]=new lr(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Ri[e]=new lr(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Ri[n]=new lr(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Ri[n]=new lr(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){Ri[n]=new lr(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Ri[n]=new lr(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Ri[n]=new lr(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Ri[n]=new lr(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Ri[n]=new lr(n,5,!1,n.toLowerCase(),null,!1,!1)});var OM=/[\-:]([a-z])/g;function FM(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(OM,FM);Ri[e]=new lr(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(OM,FM);Ri[e]=new lr(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(OM,FM);Ri[e]=new lr(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Ri[n]=new lr(n,1,!1,n.toLowerCase(),null,!1,!1)});Ri.xlinkHref=new lr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Ri[n]=new lr(n,1,!1,n.toLowerCase(),null,!0,!0)});function NM(n,e,t,i){var r=Ri.hasOwnProperty(e)?Ri[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` `+r[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{t1=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Ih(n):""}function o4(n){switch(n.tag){case 5:return Ih(n.type);case 16:return Ih("Lazy");case 13:return Ih("Suspense");case 19:return Ih("SuspenseList");case 0:case 2:case 15:return n=n1(n.type,!1),n;case 11:return n=n1(n.type.render,!1),n;case 1:return n=n1(n.type,!0),n;default:return""}}function YS(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 of:return"Fragment";case sf:return"Portal";case jS:return"Profiler";case UM:return"StrictMode";case JS:return"Suspense";case KS:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case UD:return(n.displayName||"Context")+".Consumer";case ND:return(n._context.displayName||"Context")+".Provider";case kM:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case zM:return e=n.displayName||null,e!==null?e:YS(n.type)||"Memo";case Ka:e=n._payload,n=n._init;try{return YS(n(e))}catch{}}return null}function a4(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 YS(e);case 8:return e===UM?"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 El(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function zD(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function l4(n){var e=zD(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Og(n){n._valueTracker||(n._valueTracker=l4(n))}function HD(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=zD(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Rv(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 QS(n,e){var t=e.checked;return Bn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function uR(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=El(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function GD(n,e){e=e.checked,e!=null&&NM(n,"checked",e,!1)}function qS(n,e){GD(n,e);var t=El(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?ZS(n,e.type,t):e.hasOwnProperty("defaultValue")&&ZS(n,e.type,El(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function fR(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function ZS(n,e,t){(e!=="number"||Rv(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Bh=Array.isArray;function wf(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=Fg.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function fp(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Hh={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},c4=["Webkit","ms","Moz","O"];Object.keys(Hh).forEach(function(n){c4.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Hh[e]=Hh[n]})});function XD(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Hh.hasOwnProperty(n)&&Hh[n]?(""+e).trim():e+"px"}function jD(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=XD(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var u4=Bn({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 nA(n,e){if(e){if(u4[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ae(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ae(62))}}function iA(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 rA=null;function HM(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var sA=null,Tf=null,bf=null;function pR(n){if(n=cm(n)){if(typeof sA!="function")throw Error(Ae(280));var e=n.stateNode;e&&(e=Hy(e),sA(n.stateNode,n.type,e))}}function JD(n){Tf?bf?bf.push(n):bf=[n]:Tf=n}function KD(){if(Tf){var n=Tf,e=bf;if(bf=Tf=null,pR(n),e)for(n=0;n>>=0,n===0?32:31-(S4(n)/A4|0)|0}var Ng=64,Ug=4194304;function Dh(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 Dv(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=Dh(a):(s&=o,s!==0&&(i=Dh(s)))}else o=t&~r,o!==0?i=Dh(o):s!==0&&(i=Dh(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function am(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-js(e),n[e]=t}function T4(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=Vh),ER=String.fromCharCode(32),MR=!1;function mL(n,e){switch(n){case"keyup":return eG.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gL(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var af=!1;function nG(n,e){switch(n){case"compositionend":return gL(e);case"keypress":return e.which!==32?null:(MR=!0,ER);case"textInput":return n=e.data,n===ER&&MR?null:n;default:return null}}function iG(n,e){if(af)return n==="compositionend"||!KM&&mL(n,e)?(n=hL(),ov=XM=il=null,af=!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=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=CR(t)}}function xL(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?xL(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function SL(){for(var n=window,e=Rv();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Rv(n.document)}return e}function YM(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 dG(n){var e=SL(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&xL(t.ownerDocument.documentElement,t)){if(i!==null&&YM(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=RR(t,s);var o=RR(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,lf=null,fA=null,$h=null,dA=!1;function PR(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;dA||lf==null||lf!==Rv(i)||(i=lf,"selectionStart"in i&&YM(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),$h&&vp($h,i)||($h=i,i=Fv(fA,"onSelect"),0ff||(n.current=yA[ff],yA[ff]=null,ff--)}function ln(n,e){ff++,yA[ff]=n.current,n.current=e}var Ml={},$i=Nl(Ml),Sr=Nl(!1),Gc=Ml;function Gf(n,e){var t=n.type.contextTypes;if(!t)return Ml;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Ar(n){return n=n.childContextTypes,n!=null}function Uv(){pn(Sr),pn($i)}function NR(n,e,t){if($i.current!==Ml)throw Error(Ae(168));ln($i,e),ln(Sr,t)}function PL(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Ae(108,a4(n)||"Unknown",r));return Bn({},t,i)}function kv(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Ml,Gc=$i.current,ln($i,n),ln(Sr,Sr.current),!0}function UR(n,e,t){var i=n.stateNode;if(!i)throw Error(Ae(169));t?(n=PL(n,e,Gc),i.__reactInternalMemoizedMergedChildContext=n,pn(Sr),pn($i),ln($i,n)):pn(Sr),ln(Sr,t)}var qo=null,Gy=!1,g1=!1;function IL(n){qo===null?qo=[n]:qo.push(n)}function MG(n){Gy=!0,IL(n)}function Ul(){if(!g1&&qo!==null){g1=!0;var n=0,e=qt;try{var t=qo;for(qt=1;n>=o,r-=o,ia=1<<32-js(e)+r|t<D?(C=R,R=null):C=R.sibling;var I=p(g,R,A[D],M);if(I===null){R===null&&(R=C);break}n&&R&&I.alternate===null&&e(g,R),x=s(I,x,D),b===null?w=I:b.sibling=I,b=I,R=C}if(D===A.length)return t(g,R),yn&&dc(g,D),w;if(R===null){for(;DD?(C=R,R=null):C=R.sibling;var O=p(g,R,I.value,M);if(O===null){R===null&&(R=C);break}n&&R&&O.alternate===null&&e(g,R),x=s(O,x,D),b===null?w=O:b.sibling=O,b=O,R=C}if(I.done)return t(g,R),yn&&dc(g,D),w;if(R===null){for(;!I.done;D++,I=A.next())I=h(g,I.value,M),I!==null&&(x=s(I,x,D),b===null?w=I:b.sibling=I,b=I);return yn&&dc(g,D),w}for(R=i(g,R);!I.done;D++,I=A.next())I=m(R,g,D,I.value,M),I!==null&&(n&&I.alternate!==null&&R.delete(I.key===null?D:I.key),x=s(I,x,D),b===null?w=I:b.sibling=I,b=I);return n&&R.forEach(function(H){return e(g,H)}),yn&&dc(g,D),w}function _(g,x,A,M){if(typeof A=="object"&&A!==null&&A.type===of&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case Lg:e:{for(var w=A.key,b=x;b!==null;){if(b.key===w){if(w=A.type,w===of){if(b.tag===7){t(g,b.sibling),x=r(b,A.props.children),x.return=g,g=x;break e}}else if(b.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Ka&&$R(w)===b.type){t(g,b.sibling),x=r(b,A.props),x.ref=oh(g,b,A),x.return=g,g=x;break e}t(g,b);break}else e(g,b);b=b.sibling}A.type===of?(x=Pc(A.props.children,g.mode,M,A.key),x.return=g,g=x):(M=pv(A.type,A.key,A.props,null,g.mode,M),M.ref=oh(g,x,A),M.return=g,g=M)}return o(g);case sf:e:{for(b=A.key;x!==null;){if(x.key===b)if(x.tag===4&&x.stateNode.containerInfo===A.containerInfo&&x.stateNode.implementation===A.implementation){t(g,x.sibling),x=r(x,A.children||[]),x.return=g,g=x;break e}else{t(g,x);break}else e(g,x);x=x.sibling}x=M1(A,g.mode,M),x.return=g,g=x}return o(g);case Ka:return b=A._init,_(g,x,b(A._payload),M)}if(Bh(A))return v(g,x,A,M);if(th(A))return y(g,x,A,M);$g(g,A)}return typeof A=="string"&&A!==""||typeof A=="number"?(A=""+A,x!==null&&x.tag===6?(t(g,x.sibling),x=r(x,A),x.return=g,g=x):(t(g,x),x=E1(A,g.mode,M),x.return=g,g=x),o(g)):t(g,x)}return _}var Wf=kL(!0),zL=kL(!1),um={},bo=Nl(um),Sp=Nl(um),Ap=Nl(um);function Ac(n){if(n===um)throw Error(Ae(174));return n}function sw(n,e){switch(ln(Ap,e),ln(Sp,n),ln(bo,um),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:tA(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=tA(e,n)}pn(bo),ln(bo,e)}function $f(){pn(bo),pn(Sp),pn(Ap)}function HL(n){Ac(Ap.current);var e=Ac(bo.current),t=tA(e,n.type);e!==t&&(ln(Sp,n),ln(bo,t))}function ow(n){Sp.current===n&&(pn(bo),pn(Sp))}var Tn=Nl(0);function $v(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 v1=[];function aw(){for(var n=0;nt?t:4,n(!0);var i=y1.transition;y1.transition={};try{n(!1),e()}finally{qt=t,y1.transition=i}}function iO(){return Ts().memoizedState}function CG(n,e,t){var i=gl(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},rO(n))sO(e,t);else if(t=OL(n,e,t,i),t!==null){var r=or();Js(t,n,i,r),oO(t,e,i)}}function RG(n,e,t){var i=gl(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(rO(n))sO(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,Ks(a,o)){var l=e.interleaved;l===null?(r.next=r,iw(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=OL(n,e,r,i),t!==null&&(r=or(),Js(t,n,i,r),oO(t,e,i))}}function rO(n){var e=n.alternate;return n===In||e!==null&&e===In}function sO(n,e){Xh=Xv=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function oO(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,VM(n,t)}}var jv={readContext:ws,useCallback:Li,useContext:Li,useEffect:Li,useImperativeHandle:Li,useInsertionEffect:Li,useLayoutEffect:Li,useMemo:Li,useReducer:Li,useRef:Li,useState:Li,useDebugValue:Li,useDeferredValue:Li,useTransition:Li,useMutableSource:Li,useSyncExternalStore:Li,useId:Li,unstable_isNewReconciler:!1},PG={readContext:ws,useCallback:function(n,e){return go().memoizedState=[n,e===void 0?null:e],n},useContext:ws,useEffect:jR,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,uv(4194308,4,qL.bind(null,e,n),t)},useLayoutEffect:function(n,e){return uv(4194308,4,n,e)},useInsertionEffect:function(n,e){return uv(4,2,n,e)},useMemo:function(n,e){var t=go();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=go();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=CG.bind(null,In,n),[i.memoizedState,n]},useRef:function(n){var e=go();return n={current:n},e.memoizedState=n},useState:XR,useDebugValue:dw,useDeferredValue:function(n){return go().memoizedState=n},useTransition:function(){var n=XR(!1),e=n[0];return n=bG.bind(null,n[1]),go().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=In,r=go();if(yn){if(t===void 0)throw Error(Ae(407));t=t()}else{if(t=e(),_i===null)throw Error(Ae(349));Wc&30||WL(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,jR(XL.bind(null,i,s,n),[n]),i.flags|=2048,wp(9,$L.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=go(),e=_i.identifierPrefix;if(yn){var t=ra,i=ia;t=(i&~(1<<32-js(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Ep++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[xo]=e,n[xp]=i,mO(n,e,!1,!1),e.stateNode=n;e:{switch(o=iA(t,i),t){case"dialog":dn("cancel",n),dn("close",n),r=i;break;case"iframe":case"object":case"embed":dn("load",n),r=i;break;case"video":case"audio":for(r=0;rjf&&(e.flags|=128,i=!0,ah(s,!1),e.lanes=4194304)}else{if(!i)if(n=$v(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),ah(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!yn)return Oi(e),null}else 2*Wn()-s.renderingStartTime>jf&&t!==1073741824&&(e.flags|=128,i=!0,ah(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Wn(),e.sibling=null,t=Tn.current,ln(Tn,i?t&1|2:t&1),e):(Oi(e),null);case 22:case 23:return yw(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Fr&1073741824&&(Oi(e),e.subtreeFlags&6&&(e.flags|=8192)):Oi(e),null;case 24:return null;case 25:return null}throw Error(Ae(156,e.tag))}function UG(n,e){switch(qM(e),e.tag){case 1:return Ar(e.type)&&Uv(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return $f(),pn(Sr),pn($i),aw(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return ow(e),null;case 13:if(pn(Tn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Ae(340));Vf()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return pn(Tn),null;case 4:return $f(),null;case 10:return nw(e.type._context),null;case 22:case 23:return yw(),null;case 24:return null;default:return null}}var jg=!1,Ui=!1,kG=typeof WeakSet=="function"?WeakSet:Set,$e=null;function mf(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Fn(n,e,i)}else t.current=null}function PA(n,e,t){try{t()}catch(i){Fn(n,e,i)}}var n2=!1;function zG(n,e){if(hA=Lv,n=SL(),YM(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,h=n,p=null;t:for(;;){for(var m;h!==t||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),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===r&&(a=o),p===s&&++u===i&&(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(pA={focusedElem:n,selectionRange:t},Lv=!1,$e=e;$e!==null;)if(e=$e,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,$e=n;else for(;$e!==null;){e=$e;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,_=v.memoizedState,g=e.stateNode,x=g.getSnapshotBeforeUpdate(e.elementType===e.type?y:zs(e.type,y),_);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var A=e.stateNode.containerInfo;A.nodeType===1?A.textContent="":A.nodeType===9&&A.documentElement&&A.removeChild(A.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ae(163))}}catch(M){Fn(e,e.return,M)}if(n=e.sibling,n!==null){n.return=e.return,$e=n;break}$e=e.return}return v=n2,n2=!1,v}function jh(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&PA(e,t,s)}r=r.next}while(r!==i)}}function $y(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function IA(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 yO(n){var e=n.alternate;e!==null&&(n.alternate=null,yO(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[xo],delete e[xp],delete e[vA],delete e[AG],delete e[EG])),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 _O(n){return n.tag===5||n.tag===3||n.tag===4}function i2(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||_O(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 BA(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Nv));else if(i!==4&&(n=n.child,n!==null))for(BA(n,e,t),n=n.sibling;n!==null;)BA(n,e,t),n=n.sibling}function DA(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(DA(n,e,t),n=n.sibling;n!==null;)DA(n,e,t),n=n.sibling}var Mi=null,Gs=!1;function Ua(n,e,t){for(t=t.child;t!==null;)xO(n,e,t),t=t.sibling}function xO(n,e,t){if(To&&typeof To.onCommitFiberUnmount=="function")try{To.onCommitFiberUnmount(Ny,t)}catch{}switch(t.tag){case 5:Ui||mf(t,e);case 6:var i=Mi,r=Gs;Mi=null,Ua(n,e,t),Mi=i,Gs=r,Mi!==null&&(Gs?(n=Mi,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Mi.removeChild(t.stateNode));break;case 18:Mi!==null&&(Gs?(n=Mi,t=t.stateNode,n.nodeType===8?m1(n.parentNode,t):n.nodeType===1&&m1(n,t),mp(n)):m1(Mi,t.stateNode));break;case 4:i=Mi,r=Gs,Mi=t.stateNode.containerInfo,Gs=!0,Ua(n,e,t),Mi=i,Gs=r;break;case 0:case 11:case 14:case 15:if(!Ui&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&PA(t,e,o),r=r.next}while(r!==i)}Ua(n,e,t);break;case 1:if(!Ui&&(mf(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Fn(t,e,a)}Ua(n,e,t);break;case 21:Ua(n,e,t);break;case 22:t.mode&1?(Ui=(i=Ui)||t.memoizedState!==null,Ua(n,e,t),Ui=i):Ua(n,e,t);break;default:Ua(n,e,t)}}function r2(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new kG),e.forEach(function(i){var r=KG.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Fs(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=Wn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*GG(i/1960))-i,10n?16:n,rl===null)var i=!1;else{if(n=rl,rl=null,Yv=0,Gt&6)throw Error(Ae(331));var r=Gt;for(Gt|=4,$e=n.current;$e!==null;){var s=$e,o=s.child;if($e.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lWn()-gw?Rc(n,0):mw|=t),Er(n,e)}function CO(n,e){e===0&&(n.mode&1?(e=Ug,Ug<<=1,!(Ug&130023424)&&(Ug=4194304)):e=1);var t=or();n=ha(n,e),n!==null&&(am(n,e,t),Er(n,t))}function JG(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),CO(n,t)}function KG(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Ae(314))}i!==null&&i.delete(e),CO(n,t)}var RO;RO=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Sr.current)_r=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return _r=!1,FG(n,e,t);_r=!!(n.flags&131072)}else _r=!1,yn&&e.flags&1048576&&BL(e,Hv,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;fv(n,e),n=e.pendingProps;var r=Gf(e,$i.current);Rf(e,t),r=cw(null,e,i,n,r,t);var s=uw();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ar(i)?(s=!0,kv(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,rw(e),r.updater=Vy,e.stateNode=r,r._reactInternals=e,EA(e,i,n,t),e=TA(null,e,i,!0,s,t)):(e.tag=0,yn&&s&&QM(e),tr(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(fv(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=QG(i),n=zs(i,n),r){case 0:e=wA(null,e,i,n,t);break e;case 1:e=ZR(null,e,i,n,t);break e;case 11:e=QR(null,e,i,n,t);break e;case 14:e=qR(null,e,i,zs(i.type,n),t);break e}throw Error(Ae(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:zs(i,r),wA(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:zs(i,r),ZR(n,e,i,r,t);case 3:e:{if(dO(e),n===null)throw Error(Ae(387));i=e.pendingProps,s=e.memoizedState,r=s.element,FL(n,e),Wv(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Xf(Error(Ae(423)),e),e=e2(n,e,i,t,r);break e}else if(i!==r){r=Xf(Error(Ae(424)),e),e=e2(n,e,i,t,r);break e}else for(zr=hl(e.stateNode.containerInfo.firstChild),Vr=e,yn=!0,Vs=null,t=zL(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Vf(),i===r){e=pa(n,e,t);break e}tr(n,e,i,t)}e=e.child}return e;case 5:return HL(e),n===null&&xA(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,mA(i,r)?o=null:s!==null&&mA(i,s)&&(e.flags|=32),fO(n,e),tr(n,e,o,t),e.child;case 6:return n===null&&xA(e),null;case 13:return hO(n,e,t);case 4:return sw(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Wf(e,null,i,t):tr(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:zs(i,r),QR(n,e,i,r,t);case 7:return tr(n,e,e.pendingProps,t),e.child;case 8:return tr(n,e,e.pendingProps.children,t),e.child;case 12:return tr(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,ln(Gv,i._currentValue),i._currentValue=o,s!==null)if(Ks(s.value,o)){if(s.children===r.children&&!Sr.current){e=pa(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===i){if(s.tag===1){l=oa(-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),SA(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(Ae(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),SA(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}tr(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Rf(e,t),r=ws(r),i=i(r),e.flags|=1,tr(n,e,i,t),e.child;case 14:return i=e.type,r=zs(i,e.pendingProps),r=zs(i.type,r),qR(n,e,i,r,t);case 15:return cO(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:zs(i,r),fv(n,e),e.tag=1,Ar(i)?(n=!0,kv(e)):n=!1,Rf(e,t),UL(e,i,r),EA(e,i,r,t),TA(null,e,i,!0,n,t);case 19:return pO(n,e,t);case 22:return uO(n,e,t)}throw Error(Ae(156,e.tag))};function PO(n,e){return nL(n,e)}function YG(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(n,e,t,i){return new YG(n,e,t,i)}function xw(n){return n=n.prototype,!(!n||!n.isReactComponent)}function QG(n){if(typeof n=="function")return xw(n)?1:0;if(n!=null){if(n=n.$$typeof,n===kM)return 11;if(n===zM)return 14}return 2}function vl(n,e){var t=n.alternate;return t===null?(t=vs(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 pv(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")xw(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case of:return Pc(t.children,r,s,e);case UM:o=8,r|=8;break;case jS:return n=vs(12,t,e,r|2),n.elementType=jS,n.lanes=s,n;case JS:return n=vs(13,t,e,r),n.elementType=JS,n.lanes=s,n;case KS:return n=vs(19,t,e,r),n.elementType=KS,n.lanes=s,n;case kD:return jy(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case ND:o=10;break e;case UD:o=9;break e;case kM:o=11;break e;case zM:o=14;break e;case Ka:o=16,i=null;break e}throw Error(Ae(130,n==null?n:typeof n,""))}return e=vs(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function Pc(n,e,t,i){return n=vs(7,n,i,e),n.lanes=t,n}function jy(n,e,t,i){return n=vs(22,n,i,e),n.elementType=kD,n.lanes=t,n.stateNode={isHidden:!1},n}function E1(n,e,t){return n=vs(6,n,null,e),n.lanes=t,n}function M1(n,e,t){return e=vs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function qG(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=r1(0),this.expirationTimes=r1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=r1(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Sw(n,e,t,i,r,s,o,a,l){return n=new qG(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=vs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},rw(s),n}function ZG(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(LO)}catch(n){console.error(n)}}LO(),BD.exports=Yr;var fm=BD.exports;const r5=md(fm);var OO,d2=fm;OO=$S.createRoot=d2.createRoot,$S.hydrateRoot=d2.hydrateRoot;/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT */const Ta="158",s5={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},o5={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},FO=0,UA=1,NO=2,a5=3,UO=0,qy=1,Yh=2,Hs=3,bs=0,qn=1,ki=2,l5=2,Ci=0,Ic=1,kA=2,zA=3,HA=4,kO=5,tl=100,zO=101,HO=102,GA=103,VA=104,GO=200,VO=201,WO=202,$O=203,Zv=204,ey=205,XO=206,jO=207,JO=208,KO=209,YO=210,QO=211,qO=212,ZO=213,e3=214,t3=0,n3=1,i3=2,bp=3,r3=4,s3=5,o3=6,a3=7,dm=0,l3=1,c3=2,Ms=0,u3=1,f3=2,d3=3,ww=4,h3=5,WA="attached",p3="detached",Zy=300,ma=301,wl=302,Cp=303,Rp=304,_d=306,ga=1e3,wi=1001,Jf=1002,Yt=1003,Pp=1004,c5=1004,If=1005,u5=1005,Qt=1006,e_=1007,f5=1007,Ys=1008,d5=1008,si=1009,m3=1010,g3=1011,t_=1012,Tw=1013,Ao=1014,ys=1015,Tl=1016,bw=1017,Cw=1018,aa=1020,v3=1021,Ti=1023,n_=1024,y3=1025,yl=1026,bl=1027,Rw=1028,Pw=1029,Iw=1030,Bw=1031,Dw=1033,mv=33776,gv=33777,vv=33778,yv=33779,$A=35840,XA=35841,jA=35842,JA=35843,_3=36196,KA=37492,YA=37496,QA=37808,qA=37809,ZA=37810,eE=37811,tE=37812,nE=37813,iE=37814,rE=37815,sE=37816,oE=37817,aE=37818,lE=37819,cE=37820,uE=37821,_v=36492,fE=36494,dE=36495,x3=36283,hE=36284,pE=36285,mE=36286,S3=2200,A3=2201,E3=2202,Kf=2300,jc=2301,xv=2302,Ec=2400,Mc=2401,Ip=2402,i_=2500,Lw=2501,M3=0,Ow=1,ty=2,Fw=3e3,_l=3001,kl=3200,w3=3201,zl=0,T3=1,ir="",Ot="srgb",Cs="srgb-linear",r_="display-p3",hm="display-p3-linear",Bp="linear",on="srgb",Dp="rec709",Lp="p3",h5=0,pc=7680,p5=7681,m5=7682,g5=7683,v5=34055,y5=34056,_5=5386,x5=512,S5=513,A5=514,E5=515,M5=516,w5=517,T5=518,gE=519,b3=512,C3=513,R3=514,P3=515,I3=516,B3=517,D3=518,L3=519,Op=35044,b5=35048,C5=35040,R5=35045,P5=35049,I5=35041,B5=35046,D5=35050,L5=35042,O5="100",vE="300 es",ny=1035,Eo=2e3,Fp=2001;class Is{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+Fi[n>>16&255]+Fi[n>>24&255]+"-"+Fi[e&255]+Fi[e>>8&255]+"-"+Fi[e>>16&15|64]+Fi[e>>24&255]+"-"+Fi[t&63|128]+Fi[t>>8&255]+"-"+Fi[t>>16&255]+Fi[t>>24&255]+Fi[i&255]+Fi[i>>8&255]+Fi[i>>16&255]+Fi[i>>24&255]).toLowerCase()}function Nn(n,e,t){return Math.max(e,Math.min(t,n))}function Nw(n,e){return(n%e+e)%e}function F5(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function N5(n,e,t){return n!==e?(t-n)/(e-n):0}function Qh(n,e,t){return(1-t)*n+t*e}function U5(n,e,t,i){return Qh(n,e,1-Math.exp(-t*i))}function k5(n,e=1){return e-Math.abs(Nw(n,e*2)-e)}function z5(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function H5(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function G5(n,e){return n+Math.floor(Math.random()*(e-n+1))}function V5(n,e){return n+Math.random()*(e-n)}function W5(n){return n*(.5-Math.random())}function $5(n){n!==void 0&&(h2=n);let e=h2+=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 X5(n){return n*Bc}function j5(n){return n*Yf}function yE(n){return(n&n-1)===0&&n!==0}function O3(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function iy(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function J5(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),h=s((e-i)/2),p=o((e-i)/2),m=s((i-e)/2),v=o((i-e)/2);switch(r){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*v,l*m,a*c);break;case"YXY":n.set(l*m,a*u,l*v,a*c);break;case"ZYZ":n.set(l*v,l*m,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function yr(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 wt(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 Mo={DEG2RAD:Bc,RAD2DEG:Yf,generateUUID:Wr,clamp:Nn,euclideanModulo:Nw,mapLinear:F5,inverseLerp:N5,lerp:Qh,damp:U5,pingpong:k5,smoothstep:z5,smootherstep:H5,randInt:G5,randFloat:V5,randFloatSpread:W5,seededRandom:$5,degToRad:X5,radToDeg:j5,isPowerOfTwo:yE,ceilPowerOfTwo:O3,floorPowerOfTwo:iy,setQuaternionFromProperEuler:J5,normalize:wt,denormalize:yr};class ce{constructor(e=0,t=0){ce.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Nn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class bt{constructor(e,t,i,r,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,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,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,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],p=i[2],m=i[5],v=i[8],y=r[0],_=r[3],g=r[6],x=r[1],A=r[4],M=r[7],w=r[2],b=r[5],R=r[8];return s[0]=o*y+a*x+l*w,s[3]=o*_+a*A+l*b,s[6]=o*g+a*M+l*R,s[1]=c*y+u*x+h*w,s[4]=c*_+u*A+h*b,s[7]=c*g+u*M+h*R,s[2]=p*y+m*x+v*w,s[5]=p*_+m*A+v*b,s[8]=p*g+m*M+v*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=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,v=t*h+i*p+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/v;return e[0]=h*y,e[1]=(r*c-u*i)*y,e[2]=(a*i-r*o)*y,e[3]=p*y,e[4]=(u*t-r*l)*y,e[5]=(r*s-a*t)*y,e[6]=m*y,e[7]=(i*l-c*t)*y,e[8]=(o*t-i*s)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(w1.makeScale(e,t)),this}rotate(e){return this.premultiply(w1.makeRotation(-e)),this}translate(e,t){return this.premultiply(w1.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const w1=new bt;function F3(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const K5={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function vf(n,e){return new K5[n](e)}function Np(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function N3(){const n=Np("canvas");return n.style.display="block",n}const p2={};function qh(n){n in p2||(p2[n]=!0,console.warn(n))}const m2=new bt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),g2=new bt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Yg={[Cs]:{transfer:Bp,primaries:Dp,toReference:n=>n,fromReference:n=>n},[Ot]:{transfer:on,primaries:Dp,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[hm]:{transfer:Bp,primaries:Lp,toReference:n=>n.applyMatrix3(g2),fromReference:n=>n.applyMatrix3(m2)},[r_]:{transfer:on,primaries:Lp,toReference:n=>n.convertSRGBToLinear().applyMatrix3(g2),fromReference:n=>n.applyMatrix3(m2).convertLinearToSRGB()}},Y5=new Set([Cs,hm]),Kt={enabled:!0,_workingColorSpace:Cs,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 this._workingColorSpace},set workingColorSpace(n){if(!Y5.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Yg[e].toReference,r=Yg[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Yg[n].primaries},getTransfer:function(n){return n===ir?Bp:Yg[n].transfer}};function Bf(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function T1(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Ru;class Uw{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ru===void 0&&(Ru=Np("canvas")),Ru.width=e.width,Ru.height=e.height;const i=Ru.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Ru}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=Np("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Zy)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ga:e.x=e.x-Math.floor(e.x);break;case wi:e.x=e.x<0?0:1;break;case Jf: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 ga:e.y=e.y-Math.floor(e.y);break;case wi:e.y=e.y<0?0:1;break;case Jf: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 qh("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Ot?_l:Fw}set encoding(e){qh("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===_l?Ot:ir}}cn.DEFAULT_IMAGE=null;cn.DEFAULT_MAPPING=Zy;cn.DEFAULT_ANISOTROPY=1;class jt{constructor(e=0,t=0,i=0,r=1){jt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],p=l[1],m=l[5],v=l[9],y=l[2],_=l[6],g=l[10];if(Math.abs(u-p)<.01&&Math.abs(h-y)<.01&&Math.abs(v-_)<.01){if(Math.abs(u+p)<.1&&Math.abs(h+y)<.1&&Math.abs(v+_)<.1&&Math.abs(c+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const A=(c+1)/2,M=(m+1)/2,w=(g+1)/2,b=(u+p)/4,R=(h+y)/4,D=(v+_)/4;return A>M&&A>w?A<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(A),r=b/i,s=R/i):M>w?M<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),i=b/r,s=D/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=R/s,r=D/s),this.set(i,r,s,t),this}let x=Math.sqrt((_-v)*(_-v)+(h-y)*(h-y)+(p-u)*(p-u));return Math.abs(x)<.001&&(x=1),this.x=(_-v)/x,this.y=(h-y)/x,this.z=(p-u)/x,this.w=Math.acos((c+m+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class U3 extends Is{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!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 r={width:e,height:t,depth:1};i.encoding!==void 0&&(qh("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===_l?Ot:ir),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new cn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.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 wc(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 xn extends U3{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class s_ extends cn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=wi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Z5 extends xn{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new s_(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class kw extends cn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=wi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class e9 extends xn{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new kw(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class t9 extends xn{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,A=1-g*g;if(A>Number.EPSILON){const w=Math.sqrt(A),b=Math.atan2(w,g*x);_=Math.sin(_*b)/w,a=Math.sin(a*b)/w}const M=a*x;if(l=l*_+p*M,c=c*_+m*M,u=u*_+v*M,h=h*_+y*M,_===1-a){const w=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=w,c*=w,u*=w,h*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],p=s[o+1],m=s[o+2],v=s[o+3];return e[t]=a*v+u*h+l*m-c*p,e[t+1]=l*v+u*p+c*h-a*m,e[t+2]=c*v+u*m+a*p-l*h,e[t+3]=u*v-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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),p=l(i/2),m=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*h+c*m*v,this._y=c*m*h-p*u*v,this._z=c*u*v+p*m*h,this._w=c*u*h-p*m*v;break;case"YXZ":this._x=p*u*h+c*m*v,this._y=c*m*h-p*u*v,this._z=c*u*v-p*m*h,this._w=c*u*h+p*m*v;break;case"ZXY":this._x=p*u*h-c*m*v,this._y=c*m*h+p*u*v,this._z=c*u*v+p*m*h,this._w=c*u*h-p*m*v;break;case"ZYX":this._x=p*u*h-c*m*v,this._y=c*m*h+p*u*v,this._z=c*u*v-p*m*h,this._w=c*u*h+p*m*v;break;case"YZX":this._x=p*u*h+c*m*v,this._y=c*m*h+p*u*v,this._z=c*u*v-p*m*h,this._w=c*u*h-p*m*v;break;case"XZY":this._x=p*u*h-c*m*v,this._y=c*m*h-p*u*v,this._z=c*u*v+p*m*h,this._w=c*u*h+p*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],p=i+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-r)*m}else if(i>a&&i>h){const m=2*Math.sqrt(1+i-a-h);this._w=(u-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>h){const m=2*Math.sqrt(1+a-i-h);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+h-i-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Nn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*r+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=i*h+this._x*p,this._y=r*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,t=0,i=0){U.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(v2.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(v2.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return C1.copy(this).projectOnVector(e),this.sub(C1)}reflect(e){return this.sub(C1.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Nn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const C1=new U,v2=new Gi;class qs{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;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,Ns),Ns.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ch),qg.subVectors(this.max,ch),Pu.subVectors(e.a,ch),Iu.subVectors(e.b,ch),Bu.subVectors(e.c,ch),ka.subVectors(Iu,Pu),za.subVectors(Bu,Iu),ec.subVectors(Pu,Bu);let t=[0,-ka.z,ka.y,0,-za.z,za.y,0,-ec.z,ec.y,ka.z,0,-ka.x,za.z,0,-za.x,ec.z,0,-ec.x,-ka.y,ka.x,0,-za.y,za.x,0,-ec.y,ec.x,0];return!R1(t,Pu,Iu,Bu,qg)||(t=[1,0,0,0,1,0,0,0,1],!R1(t,Pu,Iu,Bu,qg))?!1:(Zg.crossVectors(ka,za),t=[Zg.x,Zg.y,Zg.z],R1(t,Pu,Iu,Bu,qg))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ns).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ns).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:(Go[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Go[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Go[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Go[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Go[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Go[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Go[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Go[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Go),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 Go=[new U,new U,new U,new U,new U,new U,new U,new U],Ns=new U,Qg=new qs,Pu=new U,Iu=new U,Bu=new U,ka=new U,za=new U,ec=new U,ch=new U,qg=new U,Zg=new U,tc=new U;function R1(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){tc.fromArray(n,s);const a=r.x*Math.abs(tc.x)+r.y*Math.abs(tc.y)+r.z*Math.abs(tc.z),l=e.dot(tc),c=t.dot(tc),u=i.dot(tc);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const n9=new qs,uh=new U,P1=new U;class Bs{constructor(e=new U,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):n9.setFromPoints(e).getCenter(i);let r=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;uh.subVectors(e,this.center);const t=uh.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(uh,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(P1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(uh.copy(e.center).add(P1)),this.expandByPoint(uh.copy(e.center).sub(P1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Vo=new U,I1=new U,e0=new U,Ha=new U,B1=new U,t0=new U,D1=new U;class xd{constructor(e=new U,t=new U(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,Vo)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Vo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Vo.copy(this.origin).addScaledVector(this.direction,t),Vo.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){I1.copy(e).add(t).multiplyScalar(.5),e0.copy(t).sub(e).normalize(),Ha.copy(this.origin).sub(I1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(e0),a=Ha.dot(this.direction),l=-Ha.dot(e0),c=Ha.lengthSq(),u=Math.abs(1-o*o);let h,p,m,v;if(u>0)if(h=o*l-a,p=o*a-l,v=s*u,h>=0)if(p>=-v)if(p<=v){const y=1/u;h*=y,p*=y,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<=-v?(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<=v?(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 i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(I1).addScaledVector(e0,p),m}intersectSphere(e,t){Vo.subVectors(e.center,this.origin);const i=Vo.dot(this.direction),r=Vo.dot(Vo)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(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),i>o||s>r||((s>i||isNaN(i))&&(i=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),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Vo)!==null}intersectTriangle(e,t,i,r,s){B1.subVectors(t,e),t0.subVectors(i,e),D1.crossVectors(B1,t0);let o=this.direction.dot(D1),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ha.subVectors(this.origin,e);const l=a*this.direction.dot(t0.crossVectors(Ha,t0));if(l<0)return null;const c=a*this.direction.dot(B1.cross(Ha));if(c<0||l+c>o)return null;const u=-a*Ha.dot(D1);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 mt{constructor(e,t,i,r,s,o,a,l,c,u,h,p,m,v,y,_){mt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,h,p,m,v,y,_)}set(e,t,i,r,s,o,a,l,c,u,h,p,m,v,y,_){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=p,g[3]=m,g[7]=v,g[11]=y,g[15]=_,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 mt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Du.setFromMatrixColumn(e,0).length(),s=1/Du.setFromMatrixColumn(e,1).length(),o=1/Du.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*u,m=o*h,v=a*u,y=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=m+v*c,t[5]=p-y*c,t[9]=-a*l,t[2]=y-p*c,t[6]=v+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*u,m=l*h,v=c*u,y=c*h;t[0]=p+y*a,t[4]=v*a-m,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=m*a-v,t[6]=y+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*u,m=l*h,v=c*u,y=c*h;t[0]=p-y*a,t[4]=-o*h,t[8]=v+m*a,t[1]=m+v*a,t[5]=o*u,t[9]=y-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,v=a*u,y=a*h;t[0]=l*u,t[4]=v*c-m,t[8]=p*c+y,t[1]=l*h,t[5]=y*c+p,t[9]=m*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,v=a*l,y=a*c;t[0]=l*u,t[4]=y-p*h,t[8]=v*h+m,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*h+v,t[10]=p-y*h}else if(e.order==="XZY"){const p=o*l,m=o*c,v=a*l,y=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=p*h+y,t[5]=o*u,t[9]=m*h-v,t[2]=v*h-m,t[6]=a*u,t[10]=y*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(i9,e,r9)}lookAt(e,t,i){const r=this.elements;return Lr.subVectors(e,t),Lr.lengthSq()===0&&(Lr.z=1),Lr.normalize(),Ga.crossVectors(i,Lr),Ga.lengthSq()===0&&(Math.abs(i.z)===1?Lr.x+=1e-4:Lr.z+=1e-4,Lr.normalize(),Ga.crossVectors(i,Lr)),Ga.normalize(),n0.crossVectors(Lr,Ga),r[0]=Ga.x,r[4]=n0.x,r[8]=Lr.x,r[1]=Ga.y,r[5]=n0.y,r[9]=Lr.y,r[2]=Ga.z,r[6]=n0.z,r[10]=Lr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],p=i[9],m=i[13],v=i[2],y=i[6],_=i[10],g=i[14],x=i[3],A=i[7],M=i[11],w=i[15],b=r[0],R=r[4],D=r[8],C=r[12],I=r[1],O=r[5],H=r[9],J=r[13],k=r[2],W=r[6],q=r[10],Q=r[14],z=r[3],j=r[7],K=r[11],V=r[15];return s[0]=o*b+a*I+l*k+c*z,s[4]=o*R+a*O+l*W+c*j,s[8]=o*D+a*H+l*q+c*K,s[12]=o*C+a*J+l*Q+c*V,s[1]=u*b+h*I+p*k+m*z,s[5]=u*R+h*O+p*W+m*j,s[9]=u*D+h*H+p*q+m*K,s[13]=u*C+h*J+p*Q+m*V,s[2]=v*b+y*I+_*k+g*z,s[6]=v*R+y*O+_*W+g*j,s[10]=v*D+y*H+_*q+g*K,s[14]=v*C+y*J+_*Q+g*V,s[3]=x*b+A*I+M*k+w*z,s[7]=x*R+A*O+M*W+w*j,s[11]=x*D+A*H+M*q+w*K,s[15]=x*C+A*J+M*Q+w*V,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],p=e[10],m=e[14],v=e[3],y=e[7],_=e[11],g=e[15];return v*(+s*l*h-r*c*h-s*a*p+i*c*p+r*a*m-i*l*m)+y*(+t*l*m-t*c*p+s*o*p-r*o*m+r*c*u-s*l*u)+_*(+t*c*h-t*a*m-s*o*h+i*o*m+s*a*u-i*c*u)+g*(-r*a*u-t*l*h+t*a*p+r*o*h-i*o*p+i*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,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],m=e[11],v=e[12],y=e[13],_=e[14],g=e[15],x=h*_*c-y*p*c+y*l*m-a*_*m-h*l*g+a*p*g,A=v*p*c-u*_*c-v*l*m+o*_*m+u*l*g-o*p*g,M=u*y*c-v*h*c+v*a*m-o*y*m-u*a*g+o*h*g,w=v*h*l-u*y*l-v*a*p+o*y*p+u*a*_-o*h*_,b=t*x+i*A+r*M+s*w;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/b;return e[0]=x*R,e[1]=(y*p*s-h*_*s-y*r*m+i*_*m+h*r*g-i*p*g)*R,e[2]=(a*_*s-y*l*s+y*r*c-i*_*c-a*r*g+i*l*g)*R,e[3]=(h*l*s-a*p*s-h*r*c+i*p*c+a*r*m-i*l*m)*R,e[4]=A*R,e[5]=(u*_*s-v*p*s+v*r*m-t*_*m-u*r*g+t*p*g)*R,e[6]=(v*l*s-o*_*s-v*r*c+t*_*c+o*r*g-t*l*g)*R,e[7]=(o*p*s-u*l*s+u*r*c-t*p*c-o*r*m+t*l*m)*R,e[8]=M*R,e[9]=(v*h*s-u*y*s-v*i*m+t*y*m+u*i*g-t*h*g)*R,e[10]=(o*y*s-v*a*s+v*i*c-t*y*c-o*i*g+t*a*g)*R,e[11]=(u*a*s-o*h*s-u*i*c+t*h*c+o*i*m-t*a*m)*R,e[12]=w*R,e[13]=(u*y*r-v*h*r+v*i*p-t*y*p-u*i*_+t*h*_)*R,e[14]=(v*a*r-o*y*r-v*i*l+t*y*l+o*i*_-t*a*_)*R,e[15]=(o*h*r-u*a*r+u*i*l-t*h*l-o*i*p+t*a*p)*R,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,p=s*c,m=s*u,v=s*h,y=o*u,_=o*h,g=a*h,x=l*c,A=l*u,M=l*h,w=i.x,b=i.y,R=i.z;return r[0]=(1-(y+g))*w,r[1]=(m+M)*w,r[2]=(v-A)*w,r[3]=0,r[4]=(m-M)*b,r[5]=(1-(p+g))*b,r[6]=(_+x)*b,r[7]=0,r[8]=(v+A)*R,r[9]=(_-x)*R,r[10]=(1-(p+y))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Du.set(r[0],r[1],r[2]).length();const o=Du.set(r[4],r[5],r[6]).length(),a=Du.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Us.copy(this);const c=1/s,u=1/o,h=1/a;return Us.elements[0]*=c,Us.elements[1]*=c,Us.elements[2]*=c,Us.elements[4]*=u,Us.elements[5]*=u,Us.elements[6]*=u,Us.elements[8]*=h,Us.elements[9]*=h,Us.elements[10]*=h,t.setFromRotationMatrix(Us),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Eo){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),p=(i+r)/(i-r);let m,v;if(a===Eo)m=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===Fp)m=-o/(o-s),v=-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]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Eo){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(o-s),p=(t+e)*c,m=(i+r)*u;let v,y;if(a===Eo)v=(o+s)*h,y=-2*h;else if(a===Fp)v=s*h,y=-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]=y,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Du=new U,Us=new mt,i9=new U(0,0,0),r9=new U(1,1,1),Ga=new U,n0=new U,Lr=new U,y2=new mt,_2=new Gi;class pm{constructor(e=0,t=0,i=0,r=pm.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],h=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(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(-Nn(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(Nn(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(-Nn(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(Nn(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(-Nn(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,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return y2.makeRotationFromQuaternion(e),this.setFromRotationMatrix(y2,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _2.setFromEuler(this),this.setFromQuaternion(_2,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}}pm.DEFAULT_ORDER="XYZ";class Dc{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fh,e,o9),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fh,a9,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),v.length>0&&(i.nodes=v)}return i.object=r,i;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.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ks.subVectors(r,t),$o.subVectors(i,t),L1.subVectors(e,t);const o=ks.dot(ks),a=ks.dot($o),l=ks.dot(L1),c=$o.dot($o),u=$o.dot(L1),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const p=1/h,m=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Xo),Xo.x>=0&&Xo.y>=0&&Xo.x+Xo.y<=1}static getUV(e,t,i,r,s,o,a,l){return r0===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),r0=!0),this.getInterpolation(e,t,i,r,s,o,a,l)}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,Xo),l.setScalar(0),l.addScaledVector(s,Xo.x),l.addScaledVector(o,Xo.y),l.addScaledVector(a,Xo.z),l}static isFrontFacing(e,t,i,r){return ks.subVectors(i,t),$o.subVectors(e,t),ks.cross($o).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ks.subVectors(this.c,this.b),$o.subVectors(this.a,this.b),ks.cross($o).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return vr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return vr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return r0===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),r0=!0),vr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return vr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return vr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return vr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Ou.subVectors(r,i),Fu.subVectors(s,i),O1.subVectors(e,i);const l=Ou.dot(O1),c=Fu.dot(O1);if(l<=0&&c<=0)return t.copy(i);F1.subVectors(e,r);const u=Ou.dot(F1),h=Fu.dot(F1);if(u>=0&&h<=u)return t.copy(r);const p=l*h-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Ou,o);N1.subVectors(e,s);const m=Ou.dot(N1),v=Fu.dot(N1);if(v>=0&&m<=v)return t.copy(s);const y=m*c-l*v;if(y<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(i).addScaledVector(Fu,a);const _=u*v-m*h;if(_<=0&&h-u>=0&&m-v>=0)return M2.subVectors(s,r),a=(h-u)/(h-u+(m-v)),t.copy(r).addScaledVector(M2,a);const g=1/(_+y+p);return o=y*g,a=p*g,t.copy(i).addScaledVector(Ou,o).addScaledVector(Fu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const k3={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},Va={h:0,s:0,l:0},s0={h:0,s:0,l:0};function U1(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 Ie=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ot){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Kt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Kt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Kt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Kt.workingColorSpace){if(e=Nw(e,1),t=Nn(t,0,1),i=Nn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=U1(o,s,e+1/3),this.g=U1(o,s,e),this.b=U1(o,s,e-1/3)}return Kt.toWorkingColorSpace(this,r),this}setStyle(e,t=Ot){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ot){const i=k3[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Bf(e.r),this.g=Bf(e.g),this.b=Bf(e.b),this}copyLinearToSRGB(e){return this.r=T1(e.r),this.g=T1(e.g),this.b=T1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ot){return Kt.fromWorkingColorSpace(Ni.copy(this),e),Math.round(Nn(Ni.r*255,0,255))*65536+Math.round(Nn(Ni.g*255,0,255))*256+Math.round(Nn(Ni.b*255,0,255))}getHexString(e=Ot){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Kt.workingColorSpace){Kt.fromWorkingColorSpace(Ni.copy(this),t);const i=Ni.r,r=Ni.g,s=Ni.b,o=Math.max(i,r,s),a=Math.min(i,r,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 i:l=(r-s)/h+(r0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ic&&(i.blending=this.blending),this.side!==bs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Zv&&(i.blendSrc=this.blendSrc),this.blendDst!==ey&&(i.blendDst=this.blendDst),this.blendEquation!==tl&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==bp&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==gE&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==pc&&(i.stencilFail=this.stencilFail),this.stencilZFail!==pc&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==pc&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Hr extends zn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ie(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=dm,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ta=f9();function f9(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[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:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function pr(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Nn(n,-65504,65504),ta.floatView[0]=n;const e=ta.uint32View[0],t=e>>23&511;return ta.baseTable[t]+((e&8388607)>>ta.shiftTable[t])}function Oh(n){const e=n>>10;return ta.uint32View[0]=ta.mantissaTable[ta.offsetTable[e]+(n&1023)]+ta.exponentTable[e],ta.floatView[0]}const d9={toHalfFloat:pr,fromHalfFloat:Oh},Jn=new U,o0=new ce;class Ht{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Op,this.updateRange={offset:0,count:-1},this.gpuType=ys,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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(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 i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,p=c.length;h0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[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 r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(w2.copy(s).invert(),nc.copy(e.ray).applyMatrix4(w2),!(i.boundingBox!==null&&nc.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,nc)))}_computeIntersections(e,t,i){let r;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 v=0,y=p.length;vt.far?null:{distance:c,point:h0.clone(),object:n}}function p0(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Uu),n.getVertexPosition(l,ku),n.getVertexPosition(c,zu);const u=S9(n,e,t,i,Uu,ku,zu,d0);if(u){r&&(c0.fromBufferAttribute(r,a),u0.fromBufferAttribute(r,l),f0.fromBufferAttribute(r,c),u.uv=vr.getInterpolation(d0,Uu,ku,zu,c0,u0,f0,new ce)),s&&(c0.fromBufferAttribute(s,a),u0.fromBufferAttribute(s,l),f0.fromBufferAttribute(s,c),u.uv1=vr.getInterpolation(d0,Uu,ku,zu,c0,u0,f0,new ce),u.uv2=u.uv1),o&&(b2.fromBufferAttribute(o,a),C2.fromBufferAttribute(o,l),R2.fromBufferAttribute(o,c),u.normal=vr.getInterpolation(d0,Uu,ku,zu,b2,C2,R2,new U),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new U,materialIndex:0};vr.getNormal(Uu,ku,zu,h.normal),u.face=h}return u}class ru extends Et{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let p=0,m=0;v("z","y","x",-1,-1,i,t,e,o,s,0),v("z","y","x",1,-1,i,t,-e,o,s,1),v("x","z","y",1,1,e,i,t,r,o,2),v("x","z","y",1,-1,e,i,-t,r,o,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Ke(c,3)),this.setAttribute("normal",new Ke(u,3)),this.setAttribute("uv",new Ke(h,2));function v(y,_,g,x,A,M,w,b,R,D,C){const I=M/R,O=w/D,H=M/2,J=w/2,k=b/2,W=R+1,q=D+1;let Q=0,z=0;const j=new U;for(let K=0;K0?1:-1,u.push(j.x,j.y,j.z),h.push(Y/R),h.push(1-K/D),Q+=1}}for(let K=0;K0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Sd extends zt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new mt,this.projectionMatrix=new mt,this.projectionMatrixInverse=new mt,this.coordinateSystem=Eo}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Un extends Sd{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Yf*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Bc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Yf*2*Math.atan(Math.tan(Bc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Bc*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Hu=-90,Gu=1;class H3 extends zt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Un(Hu,Gu,e,t);r.layers=this.layers,this.add(r);const s=new Un(Hu,Gu,e,t);s.layers=this.layers,this.add(s);const o=new Un(Hu,Gu,e,t);o.layers=this.layers,this.add(o);const a=new Un(Hu,Gu,e,t);a.layers=this.layers,this.add(a);const l=new Un(Hu,Gu,e,t);l.layers=this.layers,this.add(l);const c=new Un(Hu,Gu,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Eo)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Fp)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),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{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=y,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(h,p,m),e.xr.enabled=v,i.texture.needsPMREMUpdate=!0}}class mm extends cn{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:ma,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class G3 extends xn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(qh("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===_l?Ot:ir),this.texture=new mm(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Qt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},r=new ru(5,5,5),s=new Zn({name:"CubemapFromEquirect",uniforms:Qf(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:qn,blending:Ci});s.uniforms.tEquirect.value=t;const o=new ri(r,s),a=t.minFilter;return t.minFilter===Ys&&(t.minFilter=Qt),new H3(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const H1=new U,w9=new U,T9=new bt;class Qa{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=H1.subVectors(i,t).cross(w9.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(H1),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||T9.getNormalMatrix(e),r=this.coplanarPoint(H1).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ic=new Bs,m0=new U;class o_{constructor(e=new Qa,t=new Qa,i=new Qa,r=new Qa,s=new Qa,o=new Qa){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Eo){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=r[6],p=r[7],m=r[8],v=r[9],y=r[10],_=r[11],g=r[12],x=r[13],A=r[14],M=r[15];if(i[0].setComponents(l-s,p-c,_-m,M-g).normalize(),i[1].setComponents(l+s,p+c,_+m,M+g).normalize(),i[2].setComponents(l+o,p+u,_+v,M+x).normalize(),i[3].setComponents(l-o,p-u,_-v,M-x).normalize(),i[4].setComponents(l-a,p-h,_-y,M-A).normalize(),t===Eo)i[5].setComponents(l+a,p+h,_+y,M+A).normalize();else if(t===Fp)i[5].setComponents(a,h,y,A).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(),ic.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ic.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ic)}intersectsSprite(e){return ic.center.set(0,0,0),ic.radius=.7071067811865476,ic.applyMatrix4(e.matrixWorld),this.intersectsSphere(ic)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,m0.y=r.normal.y>0?e.max.y:e.min.y,m0.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(m0)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function V3(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function b9(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,u){const h=c.array,p=c.usage,m=n.createBuffer();n.bindBuffer(u,m),n.bufferData(u,h,p),c.onUploadCallback();let v;if(h instanceof Float32Array)v=n.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)v=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)v=n.SHORT;else if(h instanceof Uint32Array)v=n.UNSIGNED_INT;else if(h instanceof Int32Array)v=n.INT;else if(h instanceof Int8Array)v=n.BYTE;else if(h instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:v,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),i.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const p=i.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`,G9=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,V9=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,W9=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,$9=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,X9=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,j9=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,J9=`#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`,K9=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } float luminance( const in vec3 rgb ) { const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,Y9=`#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`,Q9=`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`,q9=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,Z9=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,eV=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,tV=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,nV="gl_FragColor = linearToOutputTexel( gl_FragColor );",iV=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), vec3( 0.0170827, 0.0723974, 0.9105199 ) ); const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( vec3( 1.2249401, - 0.2249404, 0.0 ), vec3( - 0.0420569, 1.0420571, 0.0 ), vec3( - 0.0196376, - 0.0786361, 1.0982735 ) ); vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); } vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); } vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); } vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); }`,rV=`#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`,sV=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,oV=`#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`,aV=`#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`,lV=`#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`,cV=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,uV=`#ifdef USE_FOG varying float vFogDepth; #endif`,fV=`#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`,dV=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,hV=`#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 }`,pV=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,mV=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,gV=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,vV=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,yV=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { #if defined ( LEGACY_LIGHTS ) if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #else float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #endif } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,_V=`#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`,xV=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,SV=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,AV=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,EV=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,MV=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y; #endif`,wV=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,TV=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,bV=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,CV=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,RV=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,PV=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,IV=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,BV=`#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`,DV=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,LV=`#ifdef USE_MAP uniform sampler2D map; #endif`,OV=`#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`,FV=`#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`,NV=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,UV=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,kV=`#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`,zV=`#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`,HV=`#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`,GV=`#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`,VV=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,WV=`#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`,$V=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,XV=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,jV=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,JV=`#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`,KV=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,YV=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,QV=`#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`,qV=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,ZV=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,e8=`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 ); }`,t8=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,n8=`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`,r8=`#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`,s8=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,o8=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,a8=`#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`,l8=`#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`,c8=`#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`,u8=`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; }`,f8=`#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`,h8=`#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`,p8=`#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`,m8=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,g8=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,v8=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,y8=`#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; }`,_8=`#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`,x8=`#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`,S8=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,A8=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,E8=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,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 w8=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,T8=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,b8=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,C8=`#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 }`,R8=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,P8=`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 }`,I8=`#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; }`,B8=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif }`,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; }`,L8=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,O8=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,F8=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,N8=`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 }`,k8=`#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 }`,z8=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,H8=`#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 }`,G8=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,V8=`#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; }`,W8=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,$8=`#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 }`,J8=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,K8=`#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 }`,Y8=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,Q8=`#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 #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 }`,Z8=`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 }`,e6=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,t6=`#include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include }`,n6=`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 }`,i6=`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 }`,r6=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,Mt={alphahash_fragment:C9,alphahash_pars_fragment:R9,alphamap_fragment:P9,alphamap_pars_fragment:I9,alphatest_fragment:B9,alphatest_pars_fragment:D9,aomap_fragment:L9,aomap_pars_fragment:O9,begin_vertex:F9,beginnormal_vertex:N9,bsdfs:U9,iridescence_fragment:k9,bumpmap_pars_fragment:z9,clipping_planes_fragment:H9,clipping_planes_pars_fragment:G9,clipping_planes_pars_vertex:V9,clipping_planes_vertex:W9,color_fragment:$9,color_pars_fragment:X9,color_pars_vertex:j9,color_vertex:J9,common:K9,cube_uv_reflection_fragment:Y9,defaultnormal_vertex:Q9,displacementmap_pars_vertex:q9,displacementmap_vertex:Z9,emissivemap_fragment:eV,emissivemap_pars_fragment:tV,colorspace_fragment:nV,colorspace_pars_fragment:iV,envmap_fragment:rV,envmap_common_pars_fragment:sV,envmap_pars_fragment:oV,envmap_pars_vertex:aV,envmap_physical_pars_fragment:_V,envmap_vertex:lV,fog_vertex:cV,fog_pars_vertex:uV,fog_fragment:fV,fog_pars_fragment:dV,gradientmap_pars_fragment:hV,lightmap_fragment:pV,lightmap_pars_fragment:mV,lights_lambert_fragment:gV,lights_lambert_pars_fragment:vV,lights_pars_begin:yV,lights_toon_fragment:xV,lights_toon_pars_fragment:SV,lights_phong_fragment:AV,lights_phong_pars_fragment:EV,lights_physical_fragment:MV,lights_physical_pars_fragment:wV,lights_fragment_begin:TV,lights_fragment_maps:bV,lights_fragment_end:CV,logdepthbuf_fragment:RV,logdepthbuf_pars_fragment:PV,logdepthbuf_pars_vertex:IV,logdepthbuf_vertex:BV,map_fragment:DV,map_pars_fragment:LV,map_particle_fragment:OV,map_particle_pars_fragment:FV,metalnessmap_fragment:NV,metalnessmap_pars_fragment:UV,morphcolor_vertex:kV,morphnormal_vertex:zV,morphtarget_pars_vertex:HV,morphtarget_vertex:GV,normal_fragment_begin:VV,normal_fragment_maps:WV,normal_pars_fragment:$V,normal_pars_vertex:XV,normal_vertex:jV,normalmap_pars_fragment:JV,clearcoat_normal_fragment_begin:KV,clearcoat_normal_fragment_maps:YV,clearcoat_pars_fragment:QV,iridescence_pars_fragment:qV,opaque_fragment:ZV,packing:e8,premultiplied_alpha_fragment:t8,project_vertex:n8,dithering_fragment:i8,dithering_pars_fragment:r8,roughnessmap_fragment:s8,roughnessmap_pars_fragment:o8,shadowmap_pars_fragment:a8,shadowmap_pars_vertex:l8,shadowmap_vertex:c8,shadowmask_pars_fragment:u8,skinbase_vertex:f8,skinning_pars_vertex:d8,skinning_vertex:h8,skinnormal_vertex:p8,specularmap_fragment:m8,specularmap_pars_fragment:g8,tonemapping_fragment:v8,tonemapping_pars_fragment:y8,transmission_fragment:_8,transmission_pars_fragment:x8,uv_pars_fragment:S8,uv_pars_vertex:A8,uv_vertex:E8,worldpos_vertex:M8,background_vert:w8,background_frag:T8,backgroundCube_vert:b8,backgroundCube_frag:C8,cube_vert:R8,cube_frag:P8,depth_vert:I8,depth_frag:B8,distanceRGBA_vert:D8,distanceRGBA_frag:L8,equirect_vert:O8,equirect_frag:F8,linedashed_vert:N8,linedashed_frag:U8,meshbasic_vert:k8,meshbasic_frag:z8,meshlambert_vert:H8,meshlambert_frag:G8,meshmatcap_vert:V8,meshmatcap_frag:W8,meshnormal_vert:$8,meshnormal_frag:X8,meshphong_vert:j8,meshphong_frag:J8,meshphysical_vert:K8,meshphysical_frag:Y8,meshtoon_vert:Q8,meshtoon_frag:q8,points_vert:Z8,points_frag:e6,shadow_vert:t6,shadow_frag:n6,sprite_vert:i6,sprite_frag:r6},Be={common:{diffuse:{value:new Ie(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 ce(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 Ie(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 Ie(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 Ie(16777215)},opacity:{value:1},center:{value:new ce(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}}},Ws={basic:{uniforms:er([Be.common,Be.specularmap,Be.envmap,Be.aomap,Be.lightmap,Be.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:er([Be.common,Be.specularmap,Be.envmap,Be.aomap,Be.lightmap,Be.emissivemap,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.fog,Be.lights,{emissive:{value:new Ie(0)}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:er([Be.common,Be.specularmap,Be.envmap,Be.aomap,Be.lightmap,Be.emissivemap,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.fog,Be.lights,{emissive:{value:new Ie(0)},specular:{value:new Ie(1118481)},shininess:{value:30}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:er([Be.common,Be.envmap,Be.aomap,Be.lightmap,Be.emissivemap,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.roughnessmap,Be.metalnessmap,Be.fog,Be.lights,{emissive:{value:new Ie(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:er([Be.common,Be.aomap,Be.lightmap,Be.emissivemap,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.gradientmap,Be.fog,Be.lights,{emissive:{value:new Ie(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:er([Be.common,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:er([Be.points,Be.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:er([Be.common,Be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:er([Be.common,Be.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:er([Be.common,Be.bumpmap,Be.normalmap,Be.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:er([Be.sprite,Be.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distanceRGBA:{uniforms:er([Be.common,Be.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distanceRGBA_vert,fragmentShader:Mt.distanceRGBA_frag},shadow:{uniforms:er([Be.lights,Be.fog,{color:{value:new Ie(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};Ws.physical={uniforms:er([Ws.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new bt},clearcoatNormalScale:{value:new ce(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 Ie(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 ce},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new bt},attenuationDistance:{value:0},attenuationColor:{value:new Ie(0)},specularColor:{value:new Ie(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new bt},anisotropyVector:{value:new ce},anisotropyMap:{value:null},anisotropyMapTransform:{value:new bt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const g0={r:0,b:0,g:0};function s6(n,e,t,i,r,s,o){const a=new Ie(0);let l=s===!0?0:1,c,u,h=null,p=0,m=null;function v(_,g){let x=!1,A=g.isScene===!0?g.background:null;A&&A.isTexture&&(A=(g.backgroundBlurriness>0?t:e).get(A)),A===null?y(a,l):A&&A.isColor&&(y(A,1),x=!0);const M=n.xr.getEnvironmentBlendMode();M==="additive"?i.buffers.color.setClear(0,0,0,1,o):M==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||x)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),A&&(A.isCubeTexture||A.mapping===_d)?(u===void 0&&(u=new ri(new ru(1,1,1),new Zn({name:"BackgroundCubeMaterial",uniforms:Qf(Ws.backgroundCube.uniforms),vertexShader:Ws.backgroundCube.vertexShader,fragmentShader:Ws.backgroundCube.fragmentShader,side:qn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(w,b,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=A,u.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=Kt.getTransfer(A.colorSpace)!==on,(h!==A||p!==A.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,h=A,p=A.version,m=n.toneMapping),u.layers.enableAll(),_.unshift(u,u.geometry,u.material,0,0,null)):A&&A.isTexture&&(c===void 0&&(c=new ri(new gm(2,2),new Zn({name:"BackgroundMaterial",uniforms:Qf(Ws.background.uniforms),vertexShader:Ws.background.vertexShader,fragmentShader:Ws.background.fragmentShader,side:bs,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=A,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=Kt.getTransfer(A.colorSpace)!==on,A.matrixAutoUpdate===!0&&A.updateMatrix(),c.material.uniforms.uvTransform.value.copy(A.matrix),(h!==A||p!==A.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,h=A,p=A.version,m=n.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null))}function y(_,g){_.getRGB(g0,z3(n)),i.buffers.color.setClear(g0.r,g0.g,g0.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(_,g=1){a.set(_),l=g,y(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(_){l=_,y(a,l)},render:v}}function o6(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=_(null);let c=l,u=!1;function h(k,W,q,Q,z){let j=!1;if(o){const K=y(Q,q,W);c!==K&&(c=K,m(c.object)),j=g(k,Q,q,z),j&&x(k,Q,q,z)}else{const K=W.wireframe===!0;(c.geometry!==Q.id||c.program!==q.id||c.wireframe!==K)&&(c.geometry=Q.id,c.program=q.id,c.wireframe=K,j=!0)}z!==null&&t.update(z,n.ELEMENT_ARRAY_BUFFER),(j||u)&&(u=!1,D(k,W,q,Q),z!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function p(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(k){return i.isWebGL2?n.bindVertexArray(k):s.bindVertexArrayOES(k)}function v(k){return i.isWebGL2?n.deleteVertexArray(k):s.deleteVertexArrayOES(k)}function y(k,W,q){const Q=q.wireframe===!0;let z=a[k.id];z===void 0&&(z={},a[k.id]=z);let j=z[W.id];j===void 0&&(j={},z[W.id]=j);let K=j[Q];return K===void 0&&(K=_(p()),j[Q]=K),K}function _(k){const W=[],q=[],Q=[];for(let z=0;z=0){const ge=z[Y];let ve=j[Y];if(ve===void 0&&(Y==="instanceMatrix"&&k.instanceMatrix&&(ve=k.instanceMatrix),Y==="instanceColor"&&k.instanceColor&&(ve=k.instanceColor)),ge===void 0||ge.attribute!==ve||ve&&ge.data!==ve.data)return!0;K++}return c.attributesNum!==K||c.index!==Q}function x(k,W,q,Q){const z={},j=W.attributes;let K=0;const V=q.getAttributes();for(const Y in V)if(V[Y].location>=0){let ge=j[Y];ge===void 0&&(Y==="instanceMatrix"&&k.instanceMatrix&&(ge=k.instanceMatrix),Y==="instanceColor"&&k.instanceColor&&(ge=k.instanceColor));const ve={};ve.attribute=ge,ge&&ge.data&&(ve.data=ge.data),z[Y]=ve,K++}c.attributes=z,c.attributesNum=K,c.index=Q}function A(){const k=c.newAttributes;for(let W=0,q=k.length;W=0){let de=z[V];if(de===void 0&&(V==="instanceMatrix"&&k.instanceMatrix&&(de=k.instanceMatrix),V==="instanceColor"&&k.instanceColor&&(de=k.instanceColor)),de!==void 0){const ge=de.normalized,ve=de.itemSize,Ce=t.get(de);if(Ce===void 0)continue;const Ue=Ce.buffer,Ve=Ce.type,Qe=Ce.bytesPerElement,tt=i.isWebGL2===!0&&(Ve===n.INT||Ve===n.UNSIGNED_INT||de.gpuType===Tw);if(de.isInterleavedBufferAttribute){const Ee=de.data,$=Ee.stride,ye=de.offset;if(Ee.isInstancedInterleavedBuffer){for(let fe=0;fe0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="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),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),y=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),x=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),A=p>0,M=o||e.has("OES_texture_float"),w=A&&M,b=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:y,maxVertexUniforms:_,maxVaryings:g,maxFragmentUniforms:x,vertexTextures:A,floatFragmentTextures:M,floatVertexTextures:w,maxSamples:b}}function c6(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Qa,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||i!==0||r;return r=p,i=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 v=h.clippingPlanes,y=h.clipIntersection,_=h.clipShadows,g=n.get(h);if(!r||v===null||v.length===0||s&&!_)s?u(null):c();else{const x=s?0:i,A=x*4;let M=g.clippingState||null;l.value=M,M=u(v,p,A,m);for(let w=0;w!==A;++w)M[w]=t[w];g.clippingState=M,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,p,m,v){const y=h!==null?h.length:0;let _=null;if(y!==0){if(_=l.value,v!==!0||_===null){const g=m+y*4,x=p.matrixWorldInverse;a.getNormalMatrix(x),(_===null||_.length0){const c=new G3(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Hl extends Sd{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-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 yf=4,P2=[.125,.215,.35,.446,.526,.582],yc=20,G1=new Hl,I2=new Ie;let V1=null,W1=0,$1=0;const mc=(1+Math.sqrt(5))/2,Vu=1/mc,B2=[new U(1,1,1),new U(-1,1,1),new U(1,1,-1),new U(-1,1,-1),new U(0,mc,Vu),new U(0,mc,-Vu),new U(Vu,0,mc),new U(-Vu,0,mc),new U(mc,Vu,0),new U(-mc,Vu,0)];class _E{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){V1=this._renderer.getRenderTarget(),W1=this._renderer.getActiveCubeFace(),$1=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=O2(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=L2(),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?A:0,A,A),u.setRenderTarget(r),y&&u.render(v,a),u.render(e,a)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=p,u.autoClear=h,e.background=_}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===ma||e.mapping===wl;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=O2()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=L2());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new ri(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;v0(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,G1)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;ryc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${yc}`);const g=[];let x=0;for(let R=0;RA-yf?r-A+yf:0),b=4*(this._cubeSize-M);v0(t,w,b,3*M,2*M),l.setRenderTarget(t),l.render(h,G1)}}function f6(n){const e=[],t=[],i=[];let r=n;const s=n-yf+1+P2.length;for(let o=0;on-yf?l=P2[o-n+yf-1]:o===0&&(l=0),i.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,v=6,y=3,_=2,g=1,x=new Float32Array(y*v*m),A=new Float32Array(_*v*m),M=new Float32Array(g*v*m);for(let b=0;b2?0:-1,C=[R,D,0,R+2/3,D,0,R+2/3,D+1,0,R,D,0,R+2/3,D+1,0,R,D+1,0];x.set(C,y*v*b),A.set(p,_*v*b);const I=[b,b,b,b,b,b];M.set(I,g*v*b)}const w=new Et;w.setAttribute("position",new Ht(x,y)),w.setAttribute("uv",new Ht(A,_)),w.setAttribute("faceIndex",new Ht(M,g)),e.push(w),r>yf&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function D2(n,e,t){const i=new xn(n,e,t);return i.texture.mapping=_d,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function v0(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function d6(n,e,t){const i=new Float32Array(yc),r=new U(0,1,0);return new Zn({name:"SphericalGaussianBlur",defines:{n:yc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Vw(),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:Ci,depthTest:!1,depthWrite:!1})}function L2(){return new Zn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Vw(),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:Ci,depthTest:!1,depthWrite:!1})}function O2(){return new Zn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Vw(),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:Ci,depthTest:!1,depthWrite:!1})}function Vw(){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 h6(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===Cp||l===Rp,u=l===ma||l===wl;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new _E(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&&r(h)){t===null&&(t=new _E(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 r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(O=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const H=new Float32Array(I*O*4*y),J=new s_(H,I,O,y);J.type=ys,J.needsUpdate=!0;const k=C*4;for(let q=0;q0)return n;const r=e*t;let s=F2[r];if(s===void 0&&(s=new Float32Array(r),F2[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function oi(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` `)}function mW(n){const e=Kt.getPrimaries(Kt.workingColorSpace),t=Kt.getPrimaries(n);let i;switch(e===t?i="":e===Lp&&t===Dp?i="LinearDisplayP3ToLinearSRGB":e===Dp&&t===Lp&&(i="LinearSRGBToLinearDisplayP3"),n){case Cs:case hm:return[i,"LinearTransferOETF"];case Ot:case r_:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function V2(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` `+r+` `+pW(n.getShaderSource(e),o)}else return r}function gW(n,e){const t=mW(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function vW(n,e){let t;switch(e){case u3:t="Linear";break;case f3:t="Reinhard";break;case d3:t="OptimizedCineon";break;case ww:t="ACESFilmic";break;case h3:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function yW(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(Fh).join(` `)}function _W(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` `)}function xW(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function xE(n){return n.replace(SW,EW)}const AW=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function EW(n,e){let t=Mt[e];if(t===void 0){const i=AW.get(e);if(i!==void 0)t=Mt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return xE(t)}const MW=/#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 X2(n){return n.replace(MW,wW)}function wW(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(_+=` `),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Fh).join(` `),g.length>0&&(g+=` `)):(_=[j2(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,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.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",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(Fh).join(` `),g=[m,j2(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,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.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ms?"#define TONE_MAPPING":"",t.toneMapping!==Ms?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Ms?vW("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,gW("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Fh).join(` `)),o=xE(o),o=W2(o,t),o=$2(o,t),a=xE(a),a=W2(a,t),a=$2(a,t),o=X2(o),a=X2(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(x=`#version 300 es `,_=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+_,g=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===vE?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===vE?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` `+g);const A=x+_+o,M=x+g+a,w=G2(r,r.VERTEX_SHADER,A),b=G2(r,r.FRAGMENT_SHADER,M);r.attachShader(y,w),r.attachShader(y,b),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function R(O){if(n.debug.checkShaderErrors){const H=r.getProgramInfoLog(y).trim(),J=r.getShaderInfoLog(w).trim(),k=r.getShaderInfoLog(b).trim();let W=!0,q=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(W=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,y,w,b);else{const Q=V2(r,w,"vertex"),z=V2(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+` Program Info Log: `+H+` `+Q+` `+z)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(J===""||k==="")&&(q=!1);q&&(O.diagnostics={runnable:W,programLog:H,vertexShader:{log:J,prefix:_},fragmentShader:{log:k,prefix:g}})}r.deleteShader(w),r.deleteShader(b),D=new Sv(r,y),C=xW(r,y)}let D;this.getUniforms=function(){return D===void 0&&R(this),D};let C;this.getAttributes=function(){return C===void 0&&R(this),C};let I=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=r.getProgramParameter(y,dW)),I},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=hW++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=b,this}let BW=0;class DW{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new LW(e),t.set(e,i)),i}}class LW{constructor(e){this.id=BW++,this.code=e,this.usedTimes=0}}function OW(n,e,t,i,r,s,o){const a=new Dc,l=new DW,c=[],u=r.isWebGL2,h=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=r.precision;const v={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 y(C){return C===0?"uv":`uv${C}`}function _(C,I,O,H,J){const k=H.fog,W=J.geometry,q=C.isMeshStandardMaterial?H.environment:null,Q=(C.isMeshStandardMaterial?t:e).get(C.envMap||q),z=Q&&Q.mapping===_d?Q.image.height:null,j=v[C.type];C.precision!==null&&(m=r.getMaxPrecision(C.precision),m!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",m,"instead."));const K=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,V=K!==void 0?K.length:0;let Y=0;W.morphAttributes.position!==void 0&&(Y=1),W.morphAttributes.normal!==void 0&&(Y=2),W.morphAttributes.color!==void 0&&(Y=3);let de,ge,ve,Ce;if(j){const Sn=Ws[j];de=Sn.vertexShader,ge=Sn.fragmentShader}else de=C.vertexShader,ge=C.fragmentShader,l.update(C),ve=l.getVertexShaderID(C),Ce=l.getFragmentShaderID(C);const Ue=n.getRenderTarget(),Ve=J.isInstancedMesh===!0,Qe=!!C.map,tt=!!C.matcap,Ee=!!Q,$=!!C.aoMap,ye=!!C.lightMap,fe=!!C.bumpMap,_e=!!C.normalMap,me=!!C.displacementMap,He=!!C.emissiveMap,De=!!C.metalnessMap,ke=!!C.roughnessMap,qe=C.anisotropy>0,ft=C.clearcoat>0,Zt=C.iridescence>0,F=C.sheen>0,L=C.transmission>0,ne=qe&&!!C.anisotropyMap,xe=ft&&!!C.clearcoatMap,pe=ft&&!!C.clearcoatNormalMap,Se=ft&&!!C.clearcoatRoughnessMap,We=Zt&&!!C.iridescenceMap,we=Zt&&!!C.iridescenceThicknessMap,Le=F&&!!C.sheenColorMap,ot=F&&!!C.sheenRoughnessMap,Rt=!!C.specularMap,Me=!!C.specularColorMap,Nt=!!C.specularIntensityMap,dt=L&&!!C.transmissionMap,it=L&&!!C.thicknessMap,nt=!!C.gradientMap,Ge=!!C.alphaMap,Bt=C.alphaTest>0,Z=!!C.alphaHash,Fe=!!C.extensions,be=!!W.attributes.uv1,he=!!W.attributes.uv2,Re=!!W.attributes.uv3;let at=Ms;return C.toneMapped&&(Ue===null||Ue.isXRRenderTarget===!0)&&(at=n.toneMapping),{isWebGL2:u,shaderID:j,shaderType:C.type,shaderName:C.name,vertexShader:de,fragmentShader:ge,defines:C.defines,customVertexShaderID:ve,customFragmentShaderID:Ce,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:m,instancing:Ve,instancingColor:Ve&&J.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:Ue===null?n.outputColorSpace:Ue.isXRRenderTarget===!0?Ue.texture.colorSpace:Cs,map:Qe,matcap:tt,envMap:Ee,envMapMode:Ee&&Q.mapping,envMapCubeUVHeight:z,aoMap:$,lightMap:ye,bumpMap:fe,normalMap:_e,displacementMap:p&&me,emissiveMap:He,normalMapObjectSpace:_e&&C.normalMapType===T3,normalMapTangentSpace:_e&&C.normalMapType===zl,metalnessMap:De,roughnessMap:ke,anisotropy:qe,anisotropyMap:ne,clearcoat:ft,clearcoatMap:xe,clearcoatNormalMap:pe,clearcoatRoughnessMap:Se,iridescence:Zt,iridescenceMap:We,iridescenceThicknessMap:we,sheen:F,sheenColorMap:Le,sheenRoughnessMap:ot,specularMap:Rt,specularColorMap:Me,specularIntensityMap:Nt,transmission:L,transmissionMap:dt,thicknessMap:it,gradientMap:nt,opaque:C.transparent===!1&&C.blending===Ic,alphaMap:Ge,alphaTest:Bt,alphaHash:Z,combine:C.combine,mapUv:Qe&&y(C.map.channel),aoMapUv:$&&y(C.aoMap.channel),lightMapUv:ye&&y(C.lightMap.channel),bumpMapUv:fe&&y(C.bumpMap.channel),normalMapUv:_e&&y(C.normalMap.channel),displacementMapUv:me&&y(C.displacementMap.channel),emissiveMapUv:He&&y(C.emissiveMap.channel),metalnessMapUv:De&&y(C.metalnessMap.channel),roughnessMapUv:ke&&y(C.roughnessMap.channel),anisotropyMapUv:ne&&y(C.anisotropyMap.channel),clearcoatMapUv:xe&&y(C.clearcoatMap.channel),clearcoatNormalMapUv:pe&&y(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Se&&y(C.clearcoatRoughnessMap.channel),iridescenceMapUv:We&&y(C.iridescenceMap.channel),iridescenceThicknessMapUv:we&&y(C.iridescenceThicknessMap.channel),sheenColorMapUv:Le&&y(C.sheenColorMap.channel),sheenRoughnessMapUv:ot&&y(C.sheenRoughnessMap.channel),specularMapUv:Rt&&y(C.specularMap.channel),specularColorMapUv:Me&&y(C.specularColorMap.channel),specularIntensityMapUv:Nt&&y(C.specularIntensityMap.channel),transmissionMapUv:dt&&y(C.transmissionMap.channel),thicknessMapUv:it&&y(C.thicknessMap.channel),alphaMapUv:Ge&&y(C.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(_e||qe),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,vertexUv1s:be,vertexUv2s:he,vertexUv3s:Re,pointsUvs:J.isPoints===!0&&!!W.attributes.uv&&(Qe||Ge),fog:!!k,useFog:C.fog===!0,fogExp2:k&&k.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:J.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:V,morphTextureStride:Y,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:C.dithering,shadowMapEnabled:n.shadowMap.enabled&&O.length>0,shadowMapType:n.shadowMap.type,toneMapping:at,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Qe&&C.map.isVideoTexture===!0&&Kt.getTransfer(C.map.colorSpace)===on,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===ki,flipSided:C.side===qn,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionDerivatives:Fe&&C.extensions.derivatives===!0,extensionFragDepth:Fe&&C.extensions.fragDepth===!0,extensionDrawBuffers:Fe&&C.extensions.drawBuffers===!0,extensionShaderTextureLOD:Fe&&C.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()}}function g(C){const I=[];if(C.shaderID?I.push(C.shaderID):(I.push(C.customVertexShaderID),I.push(C.customFragmentShaderID)),C.defines!==void 0)for(const O in C.defines)I.push(O),I.push(C.defines[O]);return C.isRawShaderMaterial===!1&&(x(I,C),A(I,C),I.push(n.outputColorSpace)),I.push(C.customProgramCacheKey),I.join()}function x(C,I){C.push(I.precision),C.push(I.outputColorSpace),C.push(I.envMapMode),C.push(I.envMapCubeUVHeight),C.push(I.mapUv),C.push(I.alphaMapUv),C.push(I.lightMapUv),C.push(I.aoMapUv),C.push(I.bumpMapUv),C.push(I.normalMapUv),C.push(I.displacementMapUv),C.push(I.emissiveMapUv),C.push(I.metalnessMapUv),C.push(I.roughnessMapUv),C.push(I.anisotropyMapUv),C.push(I.clearcoatMapUv),C.push(I.clearcoatNormalMapUv),C.push(I.clearcoatRoughnessMapUv),C.push(I.iridescenceMapUv),C.push(I.iridescenceThicknessMapUv),C.push(I.sheenColorMapUv),C.push(I.sheenRoughnessMapUv),C.push(I.specularMapUv),C.push(I.specularColorMapUv),C.push(I.specularIntensityMapUv),C.push(I.transmissionMapUv),C.push(I.thicknessMapUv),C.push(I.combine),C.push(I.fogExp2),C.push(I.sizeAttenuation),C.push(I.morphTargetsCount),C.push(I.morphAttributeCount),C.push(I.numDirLights),C.push(I.numPointLights),C.push(I.numSpotLights),C.push(I.numSpotLightMaps),C.push(I.numHemiLights),C.push(I.numRectAreaLights),C.push(I.numDirLightShadows),C.push(I.numPointLightShadows),C.push(I.numSpotLightShadows),C.push(I.numSpotLightShadowsWithMaps),C.push(I.numLightProbes),C.push(I.shadowMapType),C.push(I.toneMapping),C.push(I.numClippingPlanes),C.push(I.numClipIntersection),C.push(I.depthPacking)}function A(C,I){a.disableAll(),I.isWebGL2&&a.enable(0),I.supportsVertexTextures&&a.enable(1),I.instancing&&a.enable(2),I.instancingColor&&a.enable(3),I.matcap&&a.enable(4),I.envMap&&a.enable(5),I.normalMapObjectSpace&&a.enable(6),I.normalMapTangentSpace&&a.enable(7),I.clearcoat&&a.enable(8),I.iridescence&&a.enable(9),I.alphaTest&&a.enable(10),I.vertexColors&&a.enable(11),I.vertexAlphas&&a.enable(12),I.vertexUv1s&&a.enable(13),I.vertexUv2s&&a.enable(14),I.vertexUv3s&&a.enable(15),I.vertexTangents&&a.enable(16),I.anisotropy&&a.enable(17),I.alphaHash&&a.enable(18),C.push(a.mask),a.disableAll(),I.fog&&a.enable(0),I.useFog&&a.enable(1),I.flatShading&&a.enable(2),I.logarithmicDepthBuffer&&a.enable(3),I.skinning&&a.enable(4),I.morphTargets&&a.enable(5),I.morphNormals&&a.enable(6),I.morphColors&&a.enable(7),I.premultipliedAlpha&&a.enable(8),I.shadowMapEnabled&&a.enable(9),I.useLegacyLights&&a.enable(10),I.doubleSided&&a.enable(11),I.flipSided&&a.enable(12),I.useDepthPacking&&a.enable(13),I.dithering&&a.enable(14),I.transmission&&a.enable(15),I.sheen&&a.enable(16),I.opaque&&a.enable(17),I.pointsUvs&&a.enable(18),I.decodeVideoTexture&&a.enable(19),C.push(a.mask)}function M(C){const I=v[C.type];let O;if(I){const H=Ws[I];O=Gw.clone(H.uniforms)}else O=C.uniforms;return O}function w(C,I){let O;for(let H=0,J=c.length;H0?i.push(g):m.transparent===!0?r.push(g):t.push(g)}function l(h,p,m,v,y,_){const g=o(h,p,m,v,y,_);m.transmission>0?i.unshift(g):m.transparent===!0?r.unshift(g):t.unshift(g)}function c(h,p){t.length>1&&t.sort(h||NW),i.length>1&&i.sort(p||J2),r.length>1&&r.sort(p||J2)}function u(){for(let h=e,p=n.length;h=s.length?(o=new K2,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function kW(){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 U,color:new Ie};break;case"SpotLight":t={position:new U,direction:new U,color:new Ie,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new Ie,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new Ie,groundColor:new Ie};break;case"RectAreaLight":t={color:new Ie,position:new U,halfWidth:new U,halfHeight:new U};break}return n[e.id]=t,t}}}function zW(){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 ce};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ce};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ce,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let HW=0;function GW(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function VW(n,e){const t=new kW,i=zW(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)r.probe.push(new U);const s=new U,o=new mt,a=new mt;function l(u,h){let p=0,m=0,v=0;for(let H=0;H<9;H++)r.probe[H].set(0,0,0);let y=0,_=0,g=0,x=0,A=0,M=0,w=0,b=0,R=0,D=0,C=0;u.sort(GW);const I=h===!0?Math.PI:1;for(let H=0,J=u.length;H0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Be.LTC_FLOAT_1,r.rectAreaLTC2=Be.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Be.LTC_HALF_1,r.rectAreaLTC2=Be.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=p,r.ambient[1]=m,r.ambient[2]=v;const O=r.hash;(O.directionalLength!==y||O.pointLength!==_||O.spotLength!==g||O.rectAreaLength!==x||O.hemiLength!==A||O.numDirectionalShadows!==M||O.numPointShadows!==w||O.numSpotShadows!==b||O.numSpotMaps!==R||O.numLightProbes!==C)&&(r.directional.length=y,r.spot.length=g,r.rectArea.length=x,r.point.length=_,r.hemi.length=A,r.directionalShadow.length=M,r.directionalShadowMap.length=M,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=M,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=b+R-D,r.spotLightMap.length=R,r.numSpotLightShadowsWithMaps=D,r.numLightProbes=C,O.directionalLength=y,O.pointLength=_,O.spotLength=g,O.rectAreaLength=x,O.hemiLength=A,O.numDirectionalShadows=M,O.numPointShadows=w,O.numSpotShadows=b,O.numSpotMaps=R,O.numLightProbes=C,r.version=HW++)}function c(u,h){let p=0,m=0,v=0,y=0,_=0;const g=h.matrixWorldInverse;for(let x=0,A=u.length;x=a.length?(l=new Y2(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class Ww extends zn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=kl,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 $w extends zn{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 $W=`void main() { gl_Position = vec4( position, 1.0 ); }`,XW=`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 jW(n,e,t){let i=new o_;const r=new ce,s=new ce,o=new jt,a=new Ww({depthPacking:w3}),l=new $w,c={},u=t.maxTextureSize,h={[bs]:qn,[qn]:bs,[ki]:ki},p=new Zn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ce},radius:{value:4}},vertexShader:$W,fragmentShader:XW}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const v=new Et;v.setAttribute("position",new Ht(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new ri(v,p),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=qy;let g=this.type;this.render=function(w,b,R){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||w.length===0)return;const D=n.getRenderTarget(),C=n.getActiveCubeFace(),I=n.getActiveMipmapLevel(),O=n.state;O.setBlending(Ci),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const H=g!==Hs&&this.type===Hs,J=g===Hs&&this.type!==Hs;for(let k=0,W=w.length;ku||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/z.x),r.x=s.x*z.x,Q.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/z.y),r.y=s.y*z.y,Q.mapSize.y=s.y)),Q.map===null||H===!0||J===!0){const K=this.type!==Hs?{minFilter:Yt,magFilter:Yt}:{};Q.map!==null&&Q.map.dispose(),Q.map=new xn(r.x,r.y,K),Q.map.texture.name=q.name+".shadowMap",Q.camera.updateProjectionMatrix()}n.setRenderTarget(Q.map),n.clear();const j=Q.getViewportCount();for(let K=0;K0||b.map&&b.alphaTest>0){const O=C.uuid,H=b.uuid;let J=c[O];J===void 0&&(J={},c[O]=J);let k=J[H];k===void 0&&(k=C.clone(),J[H]=k),C=k}if(C.visible=b.visible,C.wireframe=b.wireframe,D===Hs?C.side=b.shadowSide!==null?b.shadowSide:b.side:C.side=b.shadowSide!==null?b.shadowSide:h[b.side],C.alphaMap=b.alphaMap,C.alphaTest=b.alphaTest,C.map=b.map,C.clipShadows=b.clipShadows,C.clippingPlanes=b.clippingPlanes,C.clipIntersection=b.clipIntersection,C.displacementMap=b.displacementMap,C.displacementScale=b.displacementScale,C.displacementBias=b.displacementBias,C.wireframeLinewidth=b.wireframeLinewidth,C.linewidth=b.linewidth,R.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const O=n.properties.get(C);O.light=R}return C}function M(w,b,R,D,C){if(w.visible===!1)return;if(w.layers.test(b.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&C===Hs)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,w.matrixWorld);const H=e.update(w),J=w.material;if(Array.isArray(J)){const k=H.groups;for(let W=0,q=k.length;W=1):K.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),z=j>=2);let V=null,Y={};const de=n.getParameter(n.SCISSOR_BOX),ge=n.getParameter(n.VIEWPORT),ve=new jt().fromArray(de),Ce=new jt().fromArray(ge);function Ue(Z,Fe,be,he){const Re=new Uint8Array(4),at=n.createTexture();n.bindTexture(Z,at),n.texParameteri(Z,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(Z,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ut=0;Ut"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let y;const _=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(F,L){return g?new OffscreenCanvas(F,L):Np("canvas")}function A(F,L,ne,xe){let pe=1;if((F.width>xe||F.height>xe)&&(pe=xe/Math.max(F.width,F.height)),pe<1||L===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap){const Se=L?iy:Math.floor,We=Se(pe*F.width),we=Se(pe*F.height);y===void 0&&(y=x(We,we));const Le=ne?x(We,we):y;return Le.width=We,Le.height=we,Le.getContext("2d").drawImage(F,0,0,We,we),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+F.width+"x"+F.height+") to ("+We+"x"+we+")."),Le}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+F.width+"x"+F.height+")."),F;return F}function M(F){return yE(F.width)&&yE(F.height)}function w(F){return a?!1:F.wrapS!==wi||F.wrapT!==wi||F.minFilter!==Yt&&F.minFilter!==Qt}function b(F,L){return F.generateMipmaps&&L&&F.minFilter!==Yt&&F.minFilter!==Qt}function R(F){n.generateMipmap(F)}function D(F,L,ne,xe,pe=!1){if(a===!1)return L;if(F!==null){if(n[F]!==void 0)return n[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let Se=L;if(L===n.RED&&(ne===n.FLOAT&&(Se=n.R32F),ne===n.HALF_FLOAT&&(Se=n.R16F),ne===n.UNSIGNED_BYTE&&(Se=n.R8)),L===n.RED_INTEGER&&(ne===n.UNSIGNED_BYTE&&(Se=n.R8UI),ne===n.UNSIGNED_SHORT&&(Se=n.R16UI),ne===n.UNSIGNED_INT&&(Se=n.R32UI),ne===n.BYTE&&(Se=n.R8I),ne===n.SHORT&&(Se=n.R16I),ne===n.INT&&(Se=n.R32I)),L===n.RG&&(ne===n.FLOAT&&(Se=n.RG32F),ne===n.HALF_FLOAT&&(Se=n.RG16F),ne===n.UNSIGNED_BYTE&&(Se=n.RG8)),L===n.RGBA){const We=pe?Bp:Kt.getTransfer(xe);ne===n.FLOAT&&(Se=n.RGBA32F),ne===n.HALF_FLOAT&&(Se=n.RGBA16F),ne===n.UNSIGNED_BYTE&&(Se=We===on?n.SRGB8_ALPHA8:n.RGBA8),ne===n.UNSIGNED_SHORT_4_4_4_4&&(Se=n.RGBA4),ne===n.UNSIGNED_SHORT_5_5_5_1&&(Se=n.RGB5_A1)}return(Se===n.R16F||Se===n.R32F||Se===n.RG16F||Se===n.RG32F||Se===n.RGBA16F||Se===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Se}function C(F,L,ne){return b(F,ne)===!0||F.isFramebufferTexture&&F.minFilter!==Yt&&F.minFilter!==Qt?Math.log2(Math.max(L.width,L.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?L.mipmaps.length:1}function I(F){return F===Yt||F===Pp||F===If?n.NEAREST:n.LINEAR}function O(F){const L=F.target;L.removeEventListener("dispose",O),J(L),L.isVideoTexture&&v.delete(L)}function H(F){const L=F.target;L.removeEventListener("dispose",H),W(L)}function J(F){const L=i.get(F);if(L.__webglInit===void 0)return;const ne=F.source,xe=_.get(ne);if(xe){const pe=xe[L.__cacheKey];pe.usedTimes--,pe.usedTimes===0&&k(F),Object.keys(xe).length===0&&_.delete(ne)}i.remove(F)}function k(F){const L=i.get(F);n.deleteTexture(L.__webglTexture);const ne=F.source,xe=_.get(ne);delete xe[L.__cacheKey],o.memory.textures--}function W(F){const L=F.texture,ne=i.get(F),xe=i.get(L);if(xe.__webglTexture!==void 0&&(n.deleteTexture(xe.__webglTexture),o.memory.textures--),F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let pe=0;pe<6;pe++){if(Array.isArray(ne.__webglFramebuffer[pe]))for(let Se=0;Se=l&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+l),q+=1,F}function j(F){const L=[];return L.push(F.wrapS),L.push(F.wrapT),L.push(F.wrapR||0),L.push(F.magFilter),L.push(F.minFilter),L.push(F.anisotropy),L.push(F.internalFormat),L.push(F.format),L.push(F.type),L.push(F.generateMipmaps),L.push(F.premultiplyAlpha),L.push(F.flipY),L.push(F.unpackAlignment),L.push(F.colorSpace),L.join()}function K(F,L){const ne=i.get(F);if(F.isVideoTexture&&ft(F),F.isRenderTargetTexture===!1&&F.version>0&&ne.__version!==F.version){const xe=F.image;if(xe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(xe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Qe(ne,F,L);return}}t.bindTexture(n.TEXTURE_2D,ne.__webglTexture,n.TEXTURE0+L)}function V(F,L){const ne=i.get(F);if(F.version>0&&ne.__version!==F.version){Qe(ne,F,L);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ne.__webglTexture,n.TEXTURE0+L)}function Y(F,L){const ne=i.get(F);if(F.version>0&&ne.__version!==F.version){Qe(ne,F,L);return}t.bindTexture(n.TEXTURE_3D,ne.__webglTexture,n.TEXTURE0+L)}function de(F,L){const ne=i.get(F);if(F.version>0&&ne.__version!==F.version){tt(ne,F,L);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ne.__webglTexture,n.TEXTURE0+L)}const ge={[ga]:n.REPEAT,[wi]:n.CLAMP_TO_EDGE,[Jf]:n.MIRRORED_REPEAT},ve={[Yt]:n.NEAREST,[Pp]:n.NEAREST_MIPMAP_NEAREST,[If]:n.NEAREST_MIPMAP_LINEAR,[Qt]:n.LINEAR,[e_]:n.LINEAR_MIPMAP_NEAREST,[Ys]:n.LINEAR_MIPMAP_LINEAR},Ce={[b3]:n.NEVER,[L3]:n.ALWAYS,[C3]:n.LESS,[P3]:n.LEQUAL,[R3]:n.EQUAL,[D3]:n.GEQUAL,[I3]:n.GREATER,[B3]:n.NOTEQUAL};function Ue(F,L,ne){if(ne?(n.texParameteri(F,n.TEXTURE_WRAP_S,ge[L.wrapS]),n.texParameteri(F,n.TEXTURE_WRAP_T,ge[L.wrapT]),(F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY)&&n.texParameteri(F,n.TEXTURE_WRAP_R,ge[L.wrapR]),n.texParameteri(F,n.TEXTURE_MAG_FILTER,ve[L.magFilter]),n.texParameteri(F,n.TEXTURE_MIN_FILTER,ve[L.minFilter])):(n.texParameteri(F,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(F,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY)&&n.texParameteri(F,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(L.wrapS!==wi||L.wrapT!==wi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(F,n.TEXTURE_MAG_FILTER,I(L.magFilter)),n.texParameteri(F,n.TEXTURE_MIN_FILTER,I(L.minFilter)),L.minFilter!==Yt&&L.minFilter!==Qt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),L.compareFunction&&(n.texParameteri(F,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(F,n.TEXTURE_COMPARE_FUNC,Ce[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const xe=e.get("EXT_texture_filter_anisotropic");if(L.magFilter===Yt||L.minFilter!==If&&L.minFilter!==Ys||L.type===ys&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===Tl&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||i.get(L).__currentAnisotropy)&&(n.texParameterf(F,xe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,r.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy)}}function Ve(F,L){let ne=!1;F.__webglInit===void 0&&(F.__webglInit=!0,L.addEventListener("dispose",O));const xe=L.source;let pe=_.get(xe);pe===void 0&&(pe={},_.set(xe,pe));const Se=j(L);if(Se!==F.__cacheKey){pe[Se]===void 0&&(pe[Se]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),pe[Se].usedTimes++;const We=pe[F.__cacheKey];We!==void 0&&(pe[F.__cacheKey].usedTimes--,We.usedTimes===0&&k(L)),F.__cacheKey=Se,F.__webglTexture=pe[Se].texture}return ne}function Qe(F,L,ne){let xe=n.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(xe=n.TEXTURE_2D_ARRAY),L.isData3DTexture&&(xe=n.TEXTURE_3D);const pe=Ve(F,L),Se=L.source;t.bindTexture(xe,F.__webglTexture,n.TEXTURE0+ne);const We=i.get(Se);if(Se.version!==We.__version||pe===!0){t.activeTexture(n.TEXTURE0+ne);const we=Kt.getPrimaries(Kt.workingColorSpace),Le=L.colorSpace===ir?null:Kt.getPrimaries(L.colorSpace),ot=L.colorSpace===ir||we===Le?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,L.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,L.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ot);const Rt=w(L)&&M(L.image)===!1;let Me=A(L.image,Rt,!1,u);Me=Zt(L,Me);const Nt=M(Me)||a,dt=s.convert(L.format,L.colorSpace);let it=s.convert(L.type),nt=D(L.internalFormat,dt,it,L.colorSpace,L.isVideoTexture);Ue(xe,L,Nt);let Ge;const Bt=L.mipmaps,Z=a&&L.isVideoTexture!==!0,Fe=We.__version===void 0||pe===!0,be=C(L,Me,Nt);if(L.isDepthTexture)nt=n.DEPTH_COMPONENT,a?L.type===ys?nt=n.DEPTH_COMPONENT32F:L.type===Ao?nt=n.DEPTH_COMPONENT24:L.type===aa?nt=n.DEPTH24_STENCIL8:nt=n.DEPTH_COMPONENT16:L.type===ys&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===yl&&nt===n.DEPTH_COMPONENT&&L.type!==t_&&L.type!==Ao&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Ao,it=s.convert(L.type)),L.format===bl&&nt===n.DEPTH_COMPONENT&&(nt=n.DEPTH_STENCIL,L.type!==aa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=aa,it=s.convert(L.type))),Fe&&(Z?t.texStorage2D(n.TEXTURE_2D,1,nt,Me.width,Me.height):t.texImage2D(n.TEXTURE_2D,0,nt,Me.width,Me.height,0,dt,it,null));else if(L.isDataTexture)if(Bt.length>0&&Nt){Z&&Fe&&t.texStorage2D(n.TEXTURE_2D,be,nt,Bt[0].width,Bt[0].height);for(let he=0,Re=Bt.length;he>=1,Re>>=1}}else if(Bt.length>0&&Nt){Z&&Fe&&t.texStorage2D(n.TEXTURE_2D,be,nt,Bt[0].width,Bt[0].height);for(let he=0,Re=Bt.length;he0&&Fe++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Fe,Ge,Me[0].width,Me[0].height));for(let he=0;he<6;he++)if(Rt){Bt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,Me[he].width,Me[he].height,it,nt,Me[he].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,Ge,Me[he].width,Me[he].height,0,it,nt,Me[he].data);for(let Re=0;Re>Se),Me=Math.max(1,L.height>>Se);pe===n.TEXTURE_3D||pe===n.TEXTURE_2D_ARRAY?t.texImage3D(pe,Se,Le,Rt,Me,L.depth,0,We,we,null):t.texImage2D(pe,Se,Le,Rt,Me,0,We,we,null)}t.bindFramebuffer(n.FRAMEBUFFER,F),qe(L)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,xe,pe,i.get(ne).__webglTexture,0,ke(L)):(pe===n.TEXTURE_2D||pe>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&pe<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,xe,pe,i.get(ne).__webglTexture,Se),t.bindFramebuffer(n.FRAMEBUFFER,null)}function $(F,L,ne){if(n.bindRenderbuffer(n.RENDERBUFFER,F),L.depthBuffer&&!L.stencilBuffer){let xe=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(ne||qe(L)){const pe=L.depthTexture;pe&&pe.isDepthTexture&&(pe.type===ys?xe=n.DEPTH_COMPONENT32F:pe.type===Ao&&(xe=n.DEPTH_COMPONENT24));const Se=ke(L);qe(L)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Se,xe,L.width,L.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Se,xe,L.width,L.height)}else n.renderbufferStorage(n.RENDERBUFFER,xe,L.width,L.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,F)}else if(L.depthBuffer&&L.stencilBuffer){const xe=ke(L);ne&&qe(L)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,xe,n.DEPTH24_STENCIL8,L.width,L.height):qe(L)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,xe,n.DEPTH24_STENCIL8,L.width,L.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,L.width,L.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,F)}else{const xe=L.isWebGLMultipleRenderTargets===!0?L.texture:[L.texture];for(let pe=0;pe0){ne.__webglFramebuffer[we]=[];for(let Le=0;Le0){ne.__webglFramebuffer=[];for(let we=0;we0&&qe(F)===!1){const we=Se?L:[L];ne.__webglMultisampledFramebuffer=n.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Le=0;Le0)for(let Le=0;Le0)for(let Le=0;Le0&&qe(F)===!1){const L=F.isWebGLMultipleRenderTargets?F.texture:[F.texture],ne=F.width,xe=F.height;let pe=n.COLOR_BUFFER_BIT;const Se=[],We=F.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,we=i.get(F),Le=F.isWebGLMultipleRenderTargets===!0;if(Le)for(let ot=0;ot0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function ft(F){const L=o.render.frame;v.get(F)!==L&&(v.set(F,L),F.update())}function Zt(F,L){const ne=F.colorSpace,xe=F.format,pe=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===ny||ne!==Cs&&ne!==ir&&(Kt.getTransfer(ne)===on?a===!1?e.has("EXT_sRGB")===!0&&xe===Ti?(F.format=ny,F.minFilter=Qt,F.generateMipmaps=!1):L=Uw.sRGBToLinear(L):(xe!==Ti||pe!==si)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),L}this.allocateTextureUnit=z,this.resetTextureUnits=Q,this.setTexture2D=K,this.setTexture2DArray=V,this.setTexture3D=Y,this.setTextureCube=de,this.rebindTextures=_e,this.setupRenderTarget=me,this.updateRenderTargetMipmap=He,this.updateMultisampleRenderTarget=De,this.setupDepthRenderbuffer=fe,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=qe}function J3(n,e,t){const i=t.isWebGL2;function r(s,o=ir){let a;const l=Kt.getTransfer(o);if(s===si)return n.UNSIGNED_BYTE;if(s===bw)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Cw)return n.UNSIGNED_SHORT_5_5_5_1;if(s===m3)return n.BYTE;if(s===g3)return n.SHORT;if(s===t_)return n.UNSIGNED_SHORT;if(s===Tw)return n.INT;if(s===Ao)return n.UNSIGNED_INT;if(s===ys)return n.FLOAT;if(s===Tl)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===v3)return n.ALPHA;if(s===Ti)return n.RGBA;if(s===n_)return n.LUMINANCE;if(s===y3)return n.LUMINANCE_ALPHA;if(s===yl)return n.DEPTH_COMPONENT;if(s===bl)return n.DEPTH_STENCIL;if(s===ny)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Rw)return n.RED;if(s===Pw)return n.RED_INTEGER;if(s===Iw)return n.RG;if(s===Bw)return n.RG_INTEGER;if(s===Dw)return n.RGBA_INTEGER;if(s===mv||s===gv||s===vv||s===yv)if(l===on)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===mv)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===gv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===vv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===yv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===mv)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===gv)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===vv)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===yv)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===$A||s===XA||s===jA||s===JA)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===$A)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===XA)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===jA)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===JA)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===_3)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===KA||s===YA)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===KA)return l===on?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===YA)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===QA||s===qA||s===ZA||s===eE||s===tE||s===nE||s===iE||s===rE||s===sE||s===oE||s===aE||s===lE||s===cE||s===uE)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===QA)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===qA)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===ZA)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===eE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===tE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===nE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===iE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===rE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===sE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===oE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===aE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===lE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===cE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===uE)return l===on?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===_v||s===fE||s===dE)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===_v)return l===on?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===fE)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===dE)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===x3||s===hE||s===pE||s===mE)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===_v)return a.COMPRESSED_RED_RGTC1_EXT;if(s===hE)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===pE)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===mE)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===aa?i?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:r}}class K3 extends Un{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class sa extends zt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const YW={type:"move"};class j1{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new sa,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 sa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new sa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const y of e.hand.values()){const _=t.getJointPose(y,i),g=this._getHandJoint(c,y);_!==null&&(g.matrix.fromArray(_.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=_.radius),g.visible=_!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],p=u.position.distanceTo(h.position),m=.02,v=.005;c.inputState.pinching&&p>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),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&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(YW)))}return a!==null&&(a.visible=r!==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 i=new sa;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class l_ extends cn{constructor(e,t,i,r,s,o,a,l,c,u){if(u=u!==void 0?u:yl,u!==yl&&u!==bl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===yl&&(i=Ao),i===void 0&&u===bl&&(i=aa),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Yt,this.minFilter=l!==void 0?l:Yt,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 QW extends Is{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,p=null,m=null,v=null;const y=t.getContextAttributes();let _=null,g=null;const x=[],A=[],M=new Un;M.layers.enable(1),M.viewport=new jt;const w=new Un;w.layers.enable(2),w.viewport=new jt;const b=[M,w],R=new K3;R.layers.enable(1),R.layers.enable(2);let D=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let Y=x[V];return Y===void 0&&(Y=new j1,x[V]=Y),Y.getTargetRaySpace()},this.getControllerGrip=function(V){let Y=x[V];return Y===void 0&&(Y=new j1,x[V]=Y),Y.getGripSpace()},this.getHand=function(V){let Y=x[V];return Y===void 0&&(Y=new j1,x[V]=Y),Y.getHandSpace()};function I(V){const Y=A.indexOf(V.inputSource);if(Y===-1)return;const de=x[Y];de!==void 0&&(de.update(V.inputSource,V.frame,c||o),de.dispatchEvent({type:V.type,data:V.inputSource}))}function O(){r.removeEventListener("select",I),r.removeEventListener("selectstart",I),r.removeEventListener("selectend",I),r.removeEventListener("squeeze",I),r.removeEventListener("squeezestart",I),r.removeEventListener("squeezeend",I),r.removeEventListener("end",O),r.removeEventListener("inputsourceschange",H);for(let V=0;V=0&&(A[ge]=null,x[ge].disconnect(de))}for(let Y=0;Y=A.length){A.push(de),ge=Ce;break}else if(A[Ce]===null){A[Ce]=de,ge=Ce;break}if(ge===-1)break}const ve=x[ge];ve&&ve.connect(de)}}const J=new U,k=new U;function W(V,Y,de){J.setFromMatrixPosition(Y.matrixWorld),k.setFromMatrixPosition(de.matrixWorld);const ge=J.distanceTo(k),ve=Y.projectionMatrix.elements,Ce=de.projectionMatrix.elements,Ue=ve[14]/(ve[10]-1),Ve=ve[14]/(ve[10]+1),Qe=(ve[9]+1)/ve[5],tt=(ve[9]-1)/ve[5],Ee=(ve[8]-1)/ve[0],$=(Ce[8]+1)/Ce[0],ye=Ue*Ee,fe=Ue*$,_e=ge/(-Ee+$),me=_e*-Ee;Y.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(me),V.translateZ(_e),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const He=Ue+_e,De=Ve+_e,ke=ye-me,qe=fe+(ge-me),ft=Qe*Ve/De*He,Zt=tt*Ve/De*He;V.projectionMatrix.makePerspective(ke,qe,ft,Zt,He,De),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function q(V,Y){Y===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(Y.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(r===null)return;R.near=w.near=M.near=V.near,R.far=w.far=M.far=V.far,(D!==R.near||C!==R.far)&&(r.updateRenderState({depthNear:R.near,depthFar:R.far}),D=R.near,C=R.far);const Y=V.parent,de=R.cameras;q(R,Y);for(let ge=0;ge0&&(_.alphaTest.value=g.alphaTest);const x=e.get(g).envMap;if(x&&(_.envMap.value=x,_.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=g.reflectivity,_.ior.value=g.ior,_.refractionRatio.value=g.refractionRatio),g.lightMap){_.lightMap.value=g.lightMap;const A=n._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=g.lightMapIntensity*A,t(g.lightMap,_.lightMapTransform)}g.aoMap&&(_.aoMap.value=g.aoMap,_.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,_.aoMapTransform))}function o(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform))}function a(_,g){_.dashSize.value=g.dashSize,_.totalSize.value=g.dashSize+g.gapSize,_.scale.value=g.scale}function l(_,g,x,A){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.size.value=g.size*x,_.scale.value=A*.5,g.map&&(_.map.value=g.map,t(g.map,_.uvTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function c(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.rotation.value=g.rotation,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function u(_,g){_.specular.value.copy(g.specular),_.shininess.value=Math.max(g.shininess,1e-4)}function h(_,g){g.gradientMap&&(_.gradientMap.value=g.gradientMap)}function p(_,g){_.metalness.value=g.metalness,g.metalnessMap&&(_.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,_.metalnessMapTransform)),_.roughness.value=g.roughness,g.roughnessMap&&(_.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,_.roughnessMapTransform)),e.get(g).envMap&&(_.envMapIntensity.value=g.envMapIntensity)}function m(_,g,x){_.ior.value=g.ior,g.sheen>0&&(_.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),_.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(_.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,_.sheenColorMapTransform)),g.sheenRoughnessMap&&(_.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,_.sheenRoughnessMapTransform))),g.clearcoat>0&&(_.clearcoat.value=g.clearcoat,_.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(_.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,_.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(_.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===qn&&_.clearcoatNormalScale.value.negate())),g.iridescence>0&&(_.iridescence.value=g.iridescence,_.iridescenceIOR.value=g.iridescenceIOR,_.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(_.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,_.iridescenceMapTransform)),g.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),g.transmission>0&&(_.transmission.value=g.transmission,_.transmissionSamplerMap.value=x.texture,_.transmissionSamplerSize.value.set(x.width,x.height),g.transmissionMap&&(_.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,_.transmissionMapTransform)),_.thickness.value=g.thickness,g.thicknessMap&&(_.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=g.attenuationDistance,_.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(_.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(_.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=g.specularIntensity,_.specularColor.value.copy(g.specularColor),g.specularColorMap&&(_.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,_.specularColorMapTransform)),g.specularIntensityMap&&(_.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,_.specularIntensityMapTransform))}function v(_,g){g.matcap&&(_.matcap.value=g.matcap)}function y(_,g){const x=e.get(g).light;_.referencePosition.value.setFromMatrixPosition(x.matrixWorld),_.nearDistance.value=x.shadow.camera.near,_.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function ZW(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(x,A){const M=A.program;i.uniformBlockBinding(x,M)}function c(x,A){let M=r[x.id];M===void 0&&(v(x),M=u(x),r[x.id]=M,x.addEventListener("dispose",_));const w=A.program;i.updateUBOMapping(x,w);const b=e.render.frame;s[x.id]!==b&&(p(x),s[x.id]=b)}function u(x){const A=h();x.__bindingPointIndex=A;const M=n.createBuffer(),w=x.__size,b=x.usage;return n.bindBuffer(n.UNIFORM_BUFFER,M),n.bufferData(n.UNIFORM_BUFFER,w,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,A,M),M}function h(){for(let x=0;x0){b=M%w;const H=w-b;b!==0&&H-I.boundary<0&&(M+=w-b,C.__offset=M)}M+=I.storage}return b=M%w,b>0&&(M+=w-b),x.__size=M,x.__cache={},this}function y(x){const A={boundary:0,storage:0};return typeof x=="number"?(A.boundary=4,A.storage=4):x.isVector2?(A.boundary=8,A.storage=8):x.isVector3||x.isColor?(A.boundary=16,A.storage=12):x.isVector4?(A.boundary=16,A.storage=16):x.isMatrix3?(A.boundary=48,A.storage=48):x.isMatrix4?(A.boundary=64,A.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),A}function _(x){const A=x.target;A.removeEventListener("dispose",_);const M=o.indexOf(A.__bindingPointIndex);o.splice(M,1),n.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function g(){for(const x in r)n.deleteBuffer(r[x]);o=[],r={},s={}}return{bind:l,update:c,dispose:g}}class Xw{constructor(e={}){const{canvas:t=N3(),context:i=null,depth:r=!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;i!==null?p=i.getContextAttributes().alpha:p=o;const m=new Uint32Array(4),v=new Int32Array(4);let y=null,_=null;const g=[],x=[];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=Ot,this._useLegacyLights=!1,this.toneMapping=Ms,this.toneMappingExposure=1;const A=this;let M=!1,w=0,b=0,R=null,D=-1,C=null;const I=new jt,O=new jt;let H=null;const J=new Ie(0);let k=0,W=t.width,q=t.height,Q=1,z=null,j=null;const K=new jt(0,0,W,q),V=new jt(0,0,W,q);let Y=!1;const de=new o_;let ge=!1,ve=!1,Ce=null;const Ue=new mt,Ve=new ce,Qe=new U,tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ee(){return R===null?Q:1}let $=i;function ye(N,ie){for(let se=0;se{function ze(){if(ae.forEach(function(Ze){De.get(Ze).currentProgram.isReady()&&ae.delete(Ze)}),ae.size===0){le(N);return}setTimeout(ze,10)}fe.get("KHR_parallel_shader_compile")!==null?ze():setTimeout(ze,10)})};let Ut=null;function Sn(N){Ut&&Ut(N)}function Ki(){Si.stop()}function en(){Si.start()}const Si=new V3;Si.setAnimationLoop(Sn),typeof self<"u"&&Si.setContext(self),this.setAnimationLoop=function(N){Ut=N,Ge.setAnimationLoop(N),N===null?Si.stop():Si.start()},Ge.addEventListener("sessionstart",Ki),Ge.addEventListener("sessionend",en),this.render=function(N,ie){if(ie!==void 0&&ie.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),ie.parent===null&&ie.matrixWorldAutoUpdate===!0&&ie.updateMatrixWorld(),Ge.enabled===!0&&Ge.isPresenting===!0&&(Ge.cameraAutoUpdate===!0&&Ge.updateCamera(ie),ie=Ge.getCamera()),N.isScene===!0&&N.onBeforeRender(A,N,ie,R),_=Se.get(N,x.length),_.init(),x.push(_),Ue.multiplyMatrices(ie.projectionMatrix,ie.matrixWorldInverse),de.setFromProjectionMatrix(Ue),ve=this.localClippingEnabled,ge=We.init(this.clippingPlanes,ve),y=pe.get(N,g.length),y.init(),g.push(y),qr(N,ie,0,A.sortObjects),y.finish(),A.sortObjects===!0&&y.sort(z,j),this.info.render.frame++,ge===!0&&We.beginShadows();const se=_.state.shadowsArray;if(we.render(se,N,ie),ge===!0&&We.endShadows(),this.info.autoReset===!0&&this.info.reset(),Le.render(y,N),_.setupLights(A._useLegacyLights),ie.isArrayCamera){const ae=ie.cameras;for(let le=0,ze=ae.length;le0?_=x[x.length-1]:_=null,g.pop(),g.length>0?y=g[g.length-1]:y=null};function qr(N,ie,se,ae){if(N.visible===!1)return;if(N.layers.test(ie.layers)){if(N.isGroup)se=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(ie);else if(N.isLight)_.pushLight(N),N.castShadow&&_.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||de.intersectsSprite(N)){ae&&Qe.setFromMatrixPosition(N.matrixWorld).applyMatrix4(Ue);const Ze=L.update(N),lt=N.material;lt.visible&&y.push(N,Ze,lt,se,Qe.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||de.intersectsObject(N))){const Ze=L.update(N),lt=N.material;if(ae&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Qe.copy(N.boundingSphere.center)):(Ze.boundingSphere===null&&Ze.computeBoundingSphere(),Qe.copy(Ze.boundingSphere.center)),Qe.applyMatrix4(N.matrixWorld).applyMatrix4(Ue)),Array.isArray(lt)){const ct=Ze.groups;for(let vt=0,gt=ct.length;vt0&&Od(le,ze,ie,se),ae&&me.viewport(I.copy(ae)),le.length>0&&du(le,ie,se),ze.length>0&&du(ze,ie,se),Ze.length>0&&du(Ze,ie,se),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function Od(N,ie,se,ae){if((se.isScene===!0?se.overrideMaterial:null)!==null)return;const ze=_e.isWebGL2;Ce===null&&(Ce=new xn(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")?Tl:si,minFilter:Ys,samples:ze?4:0})),A.getDrawingBufferSize(Ve),ze?Ce.setSize(Ve.x,Ve.y):Ce.setSize(iy(Ve.x),iy(Ve.y));const Ze=A.getRenderTarget();A.setRenderTarget(Ce),A.getClearColor(J),k=A.getClearAlpha(),k<1&&A.setClearColor(16777215,.5),A.clear();const lt=A.toneMapping;A.toneMapping=Ms,du(N,se,ae),ke.updateMultisampleRenderTarget(Ce),ke.updateRenderTargetMipmap(Ce);let ct=!1;for(let vt=0,gt=ie.length;vt0),yt=!!se.morphAttributes.position,An=!!se.morphAttributes.normal,Ai=!!se.morphAttributes.color;let fn=Ms;ae.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(fn=A.toneMapping);const li=se.morphAttributes.position||se.morphAttributes.normal||se.morphAttributes.color,ht=li!==void 0?li.length:0,Je=De.get(ae),Zr=_.state.lights;if(ge===!0&&(ve===!0||N!==C)){const ui=N===C&&ae.id===D;We.setState(ae,N,ui)}let It=!1;ae.version===Je.__version?(Je.needsLights&&Je.lightsStateVersion!==Zr.state.version||Je.outputColorSpace!==lt||le.isInstancedMesh&&Je.instancing===!1||!le.isInstancedMesh&&Je.instancing===!0||le.isSkinnedMesh&&Je.skinning===!1||!le.isSkinnedMesh&&Je.skinning===!0||le.isInstancedMesh&&Je.instancingColor===!0&&le.instanceColor===null||le.isInstancedMesh&&Je.instancingColor===!1&&le.instanceColor!==null||Je.envMap!==ct||ae.fog===!0&&Je.fog!==ze||Je.numClippingPlanes!==void 0&&(Je.numClippingPlanes!==We.numPlanes||Je.numIntersection!==We.numIntersection)||Je.vertexAlphas!==vt||Je.vertexTangents!==gt||Je.morphTargets!==yt||Je.morphNormals!==An||Je.morphColors!==Ai||Je.toneMapping!==fn||_e.isWebGL2===!0&&Je.morphTargetsCount!==ht)&&(It=!0):(It=!0,Je.__version=ae.version);let Dn=Je.currentProgram;It===!0&&(Dn=hu(ae,ie,le));let ro=!1,es=!1,ci=!1;const $n=Dn.getUniforms(),so=Je.uniforms;if(me.useProgram(Dn.program)&&(ro=!0,es=!0,ci=!0),ae.id!==D&&(D=ae.id,es=!0),ro||C!==N){$n.setValue($,"projectionMatrix",N.projectionMatrix),$n.setValue($,"viewMatrix",N.matrixWorldInverse);const ui=$n.map.cameraPosition;ui!==void 0&&ui.setValue($,Qe.setFromMatrixPosition(N.matrixWorld)),_e.logarithmicDepthBuffer&&$n.setValue($,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(ae.isMeshPhongMaterial||ae.isMeshToonMaterial||ae.isMeshLambertMaterial||ae.isMeshBasicMaterial||ae.isMeshStandardMaterial||ae.isShaderMaterial)&&$n.setValue($,"isOrthographic",N.isOrthographicCamera===!0),C!==N&&(C=N,es=!0,ci=!0)}if(le.isSkinnedMesh){$n.setOptional($,le,"bindMatrix"),$n.setOptional($,le,"bindMatrixInverse");const ui=le.skeleton;ui&&(_e.floatVertexTextures?(ui.boneTexture===null&&ui.computeBoneTexture(),$n.setValue($,"boneTexture",ui.boneTexture,ke),$n.setValue($,"boneTextureSize",ui.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 pu=se.morphAttributes;if((pu.position!==void 0||pu.normal!==void 0||pu.color!==void 0&&_e.isWebGL2===!0)&&ot.update(le,se,Dn),(es||Je.receiveShadow!==le.receiveShadow)&&(Je.receiveShadow=le.receiveShadow,$n.setValue($,"receiveShadow",le.receiveShadow)),ae.isMeshGouraudMaterial&&ae.envMap!==null&&(so.envMap.value=ct,so.flipEnvMap.value=ct.isCubeTexture&&ct.isRenderTargetTexture===!1?-1:1),es&&($n.setValue($,"toneMappingExposure",A.toneMappingExposure),Je.needsLights&&j_(so,ci),ze&&ae.fog===!0&&xe.refreshFogUniforms(so,ze),xe.refreshMaterialUniforms(so,ae,Q,q,Ce),Sv.upload($,Um(Je),so,ke)),ae.isShaderMaterial&&ae.uniformsNeedUpdate===!0&&(Sv.upload($,Um(Je),so,ke),ae.uniformsNeedUpdate=!1),ae.isSpriteMaterial&&$n.setValue($,"center",le.center),$n.setValue($,"modelViewMatrix",le.modelViewMatrix),$n.setValue($,"normalMatrix",le.normalMatrix),$n.setValue($,"modelMatrix",le.matrixWorld),ae.isShaderMaterial||ae.isRawShaderMaterial){const ui=ae.uniformsGroups;for(let mu=0,Rr=ui.length;mu0&&ke.useMultisampledRTT(N)===!1?le=De.get(N).__webglMultisampledFramebuffer:Array.isArray(gt)?le=gt[se]:le=gt,I.copy(N.viewport),O.copy(N.scissor),H=N.scissorTest}else I.copy(K).multiplyScalar(Q).floor(),O.copy(V).multiplyScalar(Q).floor(),H=Y;if(me.bindFramebuffer($.FRAMEBUFFER,le)&&_e.drawBuffers&&ae&&me.drawBuffers(N,le),me.viewport(I),me.scissor(O),me.setScissorTest(H),ze){const ct=De.get(N.texture);$.framebufferTexture2D($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,$.TEXTURE_CUBE_MAP_POSITIVE_X+ie,ct.__webglTexture,se)}else if(Ze){const ct=De.get(N.texture),vt=ie||0;$.framebufferTextureLayer($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,ct.__webglTexture,se||0,vt)}D=-1},this.readRenderTargetPixels=function(N,ie,se,ae,le,ze,Ze){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let lt=De.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Ze!==void 0&&(lt=lt[Ze]),lt){me.bindFramebuffer($.FRAMEBUFFER,lt);try{const ct=N.texture,vt=ct.format,gt=ct.type;if(vt!==Ti&&Nt.convert(vt)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const yt=gt===Tl&&(fe.has("EXT_color_buffer_half_float")||_e.isWebGL2&&fe.has("EXT_color_buffer_float"));if(gt!==si&&Nt.convert(gt)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_TYPE)&&!(gt===ys&&(_e.isWebGL2||fe.has("OES_texture_float")||fe.has("WEBGL_color_buffer_float")))&&!yt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ie>=0&&ie<=N.width-ae&&se>=0&&se<=N.height-le&&$.readPixels(ie,se,ae,le,Nt.convert(vt),Nt.convert(gt),ze)}finally{const ct=R!==null?De.get(R).__webglFramebuffer:null;me.bindFramebuffer($.FRAMEBUFFER,ct)}}},this.copyFramebufferToTexture=function(N,ie,se=0){const ae=Math.pow(2,-se),le=Math.floor(ie.image.width*ae),ze=Math.floor(ie.image.height*ae);ke.setTexture2D(ie,0),$.copyTexSubImage2D($.TEXTURE_2D,se,0,0,N.x,N.y,le,ze),me.unbindTexture()},this.copyTextureToTexture=function(N,ie,se,ae=0){const le=ie.image.width,ze=ie.image.height,Ze=Nt.convert(se.format),lt=Nt.convert(se.type);ke.setTexture2D(se,0),$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,se.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,se.unpackAlignment),ie.isDataTexture?$.texSubImage2D($.TEXTURE_2D,ae,N.x,N.y,le,ze,Ze,lt,ie.image.data):ie.isCompressedTexture?$.compressedTexSubImage2D($.TEXTURE_2D,ae,N.x,N.y,ie.mipmaps[0].width,ie.mipmaps[0].height,Ze,ie.mipmaps[0].data):$.texSubImage2D($.TEXTURE_2D,ae,N.x,N.y,Ze,lt,ie.image),ae===0&&se.generateMipmaps&&$.generateMipmap($.TEXTURE_2D),me.unbindTexture()},this.copyTextureToTexture3D=function(N,ie,se,ae,le=0){if(A.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ze=N.max.x-N.min.x+1,Ze=N.max.y-N.min.y+1,lt=N.max.z-N.min.z+1,ct=Nt.convert(ae.format),vt=Nt.convert(ae.type);let gt;if(ae.isData3DTexture)ke.setTexture3D(ae,0),gt=$.TEXTURE_3D;else if(ae.isDataArrayTexture)ke.setTexture2DArray(ae,0),gt=$.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,ae.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ae.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,ae.unpackAlignment);const yt=$.getParameter($.UNPACK_ROW_LENGTH),An=$.getParameter($.UNPACK_IMAGE_HEIGHT),Ai=$.getParameter($.UNPACK_SKIP_PIXELS),fn=$.getParameter($.UNPACK_SKIP_ROWS),li=$.getParameter($.UNPACK_SKIP_IMAGES),ht=se.isCompressedTexture?se.mipmaps[0]:se.image;$.pixelStorei($.UNPACK_ROW_LENGTH,ht.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,ht.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,N.min.x),$.pixelStorei($.UNPACK_SKIP_ROWS,N.min.y),$.pixelStorei($.UNPACK_SKIP_IMAGES,N.min.z),se.isDataTexture||se.isData3DTexture?$.texSubImage3D(gt,le,ie.x,ie.y,ie.z,ze,Ze,lt,ct,vt,ht.data):se.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),$.compressedTexSubImage3D(gt,le,ie.x,ie.y,ie.z,ze,Ze,lt,ct,ht.data)):$.texSubImage3D(gt,le,ie.x,ie.y,ie.z,ze,Ze,lt,ct,vt,ht),$.pixelStorei($.UNPACK_ROW_LENGTH,yt),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,An),$.pixelStorei($.UNPACK_SKIP_PIXELS,Ai),$.pixelStorei($.UNPACK_SKIP_ROWS,fn),$.pixelStorei($.UNPACK_SKIP_IMAGES,li),le===0&&ae.generateMipmaps&&$.generateMipmap(gt),me.unbindTexture()},this.initTexture=function(N){N.isCubeTexture?ke.setTextureCube(N,0):N.isData3DTexture?ke.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?ke.setTexture2DArray(N,0):ke.setTexture2D(N,0),me.unbindTexture()},this.resetState=function(){w=0,b=0,R=null,me.reset(),dt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Eo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===r_?"display-p3":"srgb",t.unpackColorSpace=Kt.workingColorSpace===hm?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Ot?_l:Fw}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===_l?Ot:Cs}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Y3 extends Xw{}Y3.prototype.isWebGL1Renderer=!0;class c_{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ie(e),this.density=t}clone(){return new c_(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class u_{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Ie(e),this.near=t,this.far=i}clone(){return new u_(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class qf extends zt{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}}class vm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Op,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Wr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;re.far||t.push({distance:l,point:hh.clone(),uv:vr.getInterpolation(hh,y0,mh,_0,Q2,J1,q2,new ce),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 x0(n,e,t,i,r,s){ju.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(ph.x=s*ju.x-r*ju.y,ph.y=r*ju.x+s*ju.y):ph.copy(ju),n.copy(e),n.x+=ph.x,n.y+=ph.y,n.applyMatrix4(Q3)}const S0=new U,Z2=new U;class Z3 extends zt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i0){let i,r;for(i=1,r=t.length;i0){S0.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(S0);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){S0.setFromMatrixPosition(e.matrixWorld),Z2.setFromMatrixPosition(this.matrixWorld);const i=S0.distanceTo(Z2)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;rl)continue;p.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(p);De.far||t.push({distance:D,point:h.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),x=Math.min(_.count,o.start+o.count);for(let A=g,M=x-1;Al)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:A,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class i$ extends cn{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Qt,this.magFilter=s!==void 0?s:Qt,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 r$ extends cn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Yt,this.minFilter=Yt,this.generateMipmaps=!1,this.needsUpdate=!0}}class h_ extends cn{constructor(e,t,i,r,s,o,a,l,c,u,h,p){super(null,o,a,l,c,u,r,s,h,p),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class s$ extends h_{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=wi}}class o$ extends h_{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,ma),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class a$ extends cn{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class eo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],p=i[r+1]-u,m=(o-u)/p;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new ce:new U);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new U,r=[],s=[],o=[],a=new U,l=new mt;for(let m=0;m<=e;m++){const v=m/e;r[m]=this.getTangentAt(v,new U)}s[0]=new U,o[0]=new U;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),p=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),p<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(Nn(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,v))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(Nn(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],m*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class p_ extends eo{constructor(e=0,t=0,i=1,r=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=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new ce,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)r;)s-=r;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=r[(a-1)%s]:(b0.subVectors(r[0],r[1]).add(r[0]),c=b0);const h=r[a%s],p=r[(a+1)%s];if(this.closed||a+2r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(mP(a,l.x,c.x,u.x,h.x),mP(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=r[s]-i,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 i=0,r=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;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 _m extends Et{constructor(e=[new ce(0,-.5),new ce(.5,0),new ce(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=Nn(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new U,p=new ce,m=new U,v=new U,y=new U;let _=0,g=0;for(let x=0;x<=e.length-1;x++)switch(x){case 0:_=e[x+1].x-e[x].x,g=e[x+1].y-e[x].y,m.x=g*1,m.y=-_,m.z=g*0,y.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(y.x,y.y,y.z);break;default:_=e[x+1].x-e[x].x,g=e[x+1].y-e[x].y,m.x=g*1,m.y=-_,m.z=g*0,v.copy(m),m.x+=y.x,m.y+=y.y,m.z+=y.z,m.normalize(),l.push(m.x,m.y,m.z),y.copy(v)}for(let x=0;x<=t;x++){const A=i+x*u*r,M=Math.sin(A),w=Math.cos(A);for(let b=0;b<=e.length-1;b++){h.x=e[b].x*M,h.y=e[b].y,h.z=e[b].x*w,o.push(h.x,h.y,h.z),p.x=x/t,p.y=b/(e.length-1),a.push(p.x,p.y);const R=l[3*b+0]*M,D=l[3*b+1],C=l[3*b+0]*w;c.push(R,D,C)}}for(let x=0;x0&&A(!0),t>0&&A(!1)),this.setIndex(u),this.setAttribute("position",new Ke(h,3)),this.setAttribute("normal",new Ke(p,3)),this.setAttribute("uv",new Ke(m,2));function x(){const M=new U,w=new U;let b=0;const R=(t-e)/i;for(let D=0;D<=s;D++){const C=[],I=D/s,O=I*(t-e)+e;for(let H=0;H<=r;H++){const J=H/r,k=J*l+a,W=Math.sin(k),q=Math.cos(k);w.x=O*W,w.y=-I*i+_,w.z=O*q,h.push(w.x,w.y,w.z),M.set(W,R,q).normalize(),p.push(M.x,M.y,M.z),m.push(J,1-I),C.push(v++)}y.push(C)}for(let D=0;D.9&&R<.1&&(A<.2&&(o[x+0]+=1),M<.2&&(o[x+2]+=1),w<.2&&(o[x+4]+=1))}}function p(x){s.push(x.x,x.y,x.z)}function m(x,A){const M=x*3;A.x=e[M+0],A.y=e[M+1],A.z=e[M+2]}function v(){const x=new U,A=new U,M=new U,w=new U,b=new ce,R=new ce,D=new ce;for(let C=0,I=0;C80*t){a=c=n[0],l=u=n[1];for(let v=t;vc&&(c=h),p>u&&(u=p);m=Math.max(c-a,u-l),m=m!==0?32767/m:0}return kp(s,o,t,a,l,m,0),o}};function oF(n,e,t,i,r){let s,o;if(r===I$(n,e,t,i)>0)for(s=e;s=e;s-=i)o=gP(s,n[s],n[s+1],o);return o&&__(o,o.next)&&(Hp(o),o=o.next),o}function Jc(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(__(t,t.next)||Cn(t.prev,t,t.next)===0)){if(Hp(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function kp(n,e,t,i,r,s,o){if(!n)return;!o&&s&&w$(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?v$(n,i,r,s):g$(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Hp(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=y$(Jc(n),e,t),kp(n,e,t,i,r,s,2)):o===2&&_$(n,e,t,i,r,s):kp(Jc(n),e,t,i,r,s,1);break}}}function g$(n){const e=n.prev,t=n,i=n.next;if(Cn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=rs?r>o?r:o:s>o?s:o,m=a>l?a>c?a:c:l>c?l:c;let v=i.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=h&&v.y<=m&&_f(r,a,s,l,o,c,v.x,v.y)&&Cn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function v$(n,e,t,i){const r=n.prev,s=n,o=n.next;if(Cn(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,p=o.y,m=al?a>c?a:c:l>c?l:c,_=u>h?u>p?u:p:h>p?h:p,g=AE(m,v,e,t,i),x=AE(y,_,e,t,i);let A=n.prevZ,M=n.nextZ;for(;A&&A.z>=g&&M&&M.z<=x;){if(A.x>=m&&A.x<=y&&A.y>=v&&A.y<=_&&A!==r&&A!==o&&_f(a,u,l,h,c,p,A.x,A.y)&&Cn(A.prev,A,A.next)>=0||(A=A.prevZ,M.x>=m&&M.x<=y&&M.y>=v&&M.y<=_&&M!==r&&M!==o&&_f(a,u,l,h,c,p,M.x,M.y)&&Cn(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;A&&A.z>=g;){if(A.x>=m&&A.x<=y&&A.y>=v&&A.y<=_&&A!==r&&A!==o&&_f(a,u,l,h,c,p,A.x,A.y)&&Cn(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;M&&M.z<=x;){if(M.x>=m&&M.x<=y&&M.y>=v&&M.y<=_&&M!==r&&M!==o&&_f(a,u,l,h,c,p,M.x,M.y)&&Cn(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function y$(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!__(r,s)&&aF(r,i,i.next,s)&&zp(r,s)&&zp(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Hp(i),Hp(i.next),i=n=s),i=i.next}while(i!==n);return Jc(i)}function _$(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&C$(o,a)){let l=lF(o,a);o=Jc(o,o.next),l=Jc(l,l.next),kp(o,e,t,i,r,s,0),kp(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function x$(n,e,t,i){const r=[];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>i&&(i=p,r=t.x=t.x&&t.x>=l&&s!==t.x&&_f(or.x||t.x===r.x&&M$(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function M$(n,e){return Cn(n.prev,n,e.prev)<0&&Cn(e.next,n,n.next)<0}function w$(n,e,t,i){let r=n;do r.z===0&&(r.z=AE(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,T$(r)}function T$(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function AE(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function b$(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function C$(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!R$(n,e)&&(zp(n,e)&&zp(e,n)&&P$(n,e)&&(Cn(n.prev,n,e.prev)||Cn(n,e.prev,e))||__(n,e)&&Cn(n.prev,n,n.next)>0&&Cn(e.prev,e,e.next)>0)}function Cn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function __(n,e){return n.x===e.x&&n.y===e.y}function aF(n,e,t,i){const r=B0(Cn(n,e,t)),s=B0(Cn(n,e,i)),o=B0(Cn(t,i,n)),a=B0(Cn(t,i,e));return!!(r!==s&&o!==a||r===0&&I0(n,t,e)||s===0&&I0(n,i,e)||o===0&&I0(t,n,i)||a===0&&I0(t,e,i))}function I0(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 B0(n){return n>0?1:n<0?-1:0}function R$(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&&aF(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function zp(n,e){return Cn(n.prev,n,n.next)<0?Cn(n,e,n.next)>=0&&Cn(n,n.prev,e)>=0:Cn(n,e,n.prev)<0||Cn(n,n.next,e)<0}function P$(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function lF(n,e){const t=new EE(n.i,n.x,n.y),i=new EE(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function gP(n,e,t,i){const r=new EE(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Hp(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 EE(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 I$(n,e,t,i){let r=0;for(let s=e,o=t-i;s2&&n[e-1].equals(n[0])&&n.pop()}function yP(n,e){for(let t=0;tNumber.EPSILON){const L=Math.sqrt(Zt),ne=Math.sqrt(qe*qe+ft*ft),xe=ye.x-ke/L,pe=ye.y+De/L,Se=fe.x-ft/ne,We=fe.y+qe/ne,we=((Se-xe)*ft-(We-pe)*qe)/(De*ft-ke*qe);_e=xe+De*we-$.x,me=pe+ke*we-$.y;const Le=_e*_e+me*me;if(Le<=2)return new ce(_e,me);He=Math.sqrt(Le/2)}else{let L=!1;De>Number.EPSILON?qe>Number.EPSILON&&(L=!0):De<-Number.EPSILON?qe<-Number.EPSILON&&(L=!0):Math.sign(ke)===Math.sign(ft)&&(L=!0),L?(_e=-ke,me=De,He=Math.sqrt(Zt)):(_e=De,me=ke,He=Math.sqrt(Zt/2))}return new ce(_e/He,me/He)}const j=[];for(let $=0,ye=k.length,fe=ye-1,_e=$+1;$=0;$--){const ye=$/_,fe=m*Math.cos(ye*Math.PI/2),_e=v*Math.sin(ye*Math.PI/2)+y;for(let me=0,He=k.length;me=0;){const _e=fe;let me=fe-1;me<0&&(me=$.length-1);for(let He=0,De=u+_*2;He0)&&m.push(A,M,b),(g!==i-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 dF extends zn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ie(16777215),this.specular=new Ie(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ie(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zl,this.normalScale=new ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=dm,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 hF extends zn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ie(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ie(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zl,this.normalScale=new ce(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 rT extends zn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zl,this.normalScale=new ce(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 pF extends zn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ie(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ie(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zl,this.normalScale=new ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=dm,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 mF extends zn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ie(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zl,this.normalScale=new ce(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 gF extends Xi{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 Tc(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 vF(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function yF(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function ME(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function sT(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function O$(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=i)){h.push(c.times[m]);for(let y=0;ys.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const g=v*h+u,x=g+h-u;y=a.values.slice(g,x)}else{const g=a.createInterpolant(),x=u,A=h-u;g.evaluate(s),y=g.resultBuffer.slice(x,A)}l==="quaternion"&&new Gi().fromArray(y).normalize().conjugate().toArray(y);const _=c.times.length;for(let g=0;g<_;++g){const x=g*m+p;if(l==="quaternion")Gi.multiplyQuaternionsFlat(c.values,x,y,0,c.values,x);else{const A=m-p*2;for(let M=0;M=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[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(r!==void 0&&vF(r))for(let a=0,l=r.length;a!==l;++a){const c=r[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=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===xv,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}no.prototype.TimeBufferType=Float32Array;no.prototype.ValueBufferType=Float32Array;no.prototype.DefaultInterpolation=jc;class su extends no{}su.prototype.ValueTypeName="bool";su.prototype.ValueBufferType=Array;su.prototype.DefaultInterpolation=Kf;su.prototype.InterpolantFactoryMethodLinear=void 0;su.prototype.InterpolantFactoryMethodSmooth=void 0;class aT extends no{}aT.prototype.ValueTypeName="color";class ed extends no{}ed.prototype.ValueTypeName="number";class SF extends Md{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Gi.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Rl extends no{InterpolantFactoryMethodLinear(e){return new SF(this.times,this.values,this.getValueSize(),e)}}Rl.prototype.ValueTypeName="quaternion";Rl.prototype.DefaultInterpolation=jc;Rl.prototype.InterpolantFactoryMethodSmooth=void 0;class ou extends no{}ou.prototype.ValueTypeName="string";ou.prototype.ValueBufferType=Array;ou.prototype.DefaultInterpolation=Kf;ou.prototype.InterpolantFactoryMethodLinear=void 0;ou.prototype.InterpolantFactoryMethodSmooth=void 0;class td extends no{}td.prototype.ValueTypeName="vector";class nd{constructor(e,t=-1,i,r=i_){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Wr(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(k$(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(no.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const h=u[1];let p=r[h];p||(r[h]=p=[]),p.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,p,m,v,y){if(m.length!==0){const _=[],g=[];sT(m,_,g,v),_.length!==0&&y.push(new h(p,_,g))}},r=[],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(jo[e]!==void 0){jo[e].push({onLoad:t,onProgress:i,onError:r});return}jo[e]=[],jo[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,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=jo[e],h=c.body.getReader(),p=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=p?parseInt(p):0,v=m!==0;let y=0;const _=new ReadableStream({start(g){x();function x(){h.read().then(({done:A,value:M})=>{if(A)g.close();else{y+=M.byteLength;const w=new ProgressEvent("progress",{lengthComputable:v,loaded:y,total:m});for(let b=0,R=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(v=>m.decode(v))}}}).then(c=>{Kc.add(e,c);const u=jo[e];delete jo[e];for(let h=0,p=u.length;h{const u=jo[e];if(u===void 0)throw this.manager.itemError(e),c;delete jo[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 H$ extends ji{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Jr(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){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new Ie().setHex(o.value);break;case"v2":r.uniforms[s].value=new ce().fromArray(o.value);break;case"v3":r.uniforms[s].value=new U().fromArray(o.value);break;case"v4":r.uniforms[s].value=new jt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new bt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new mt().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new ce().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new ce().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:uF,SpriteMaterial:jw,RawShaderMaterial:fF,ShaderMaterial:Zn,PointsMaterial:d_,MeshPhysicalMaterial:to,MeshStandardMaterial:Am,MeshPhongMaterial:dF,MeshToonMaterial:hF,MeshNormalMaterial:rT,MeshLambertMaterial:pF,MeshDepthMaterial:Ww,MeshDistanceMaterial:$w,MeshBasicMaterial:Hr,MeshMatcapMaterial:mF,LineDashedMaterial:gF,LineBasicMaterial:Xi,Material:zn};return new t[e]}}class Ro{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i0){const l=new lT(t);s=new Gp(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){r=new Gp(this.manager),r.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,i,r){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){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let D0;class hT{static getContext(){return D0===void 0&&(D0=new(window.AudioContext||window.webkitAudioContext)),D0}static setContext(e){D0=e}}class Y$ extends ji{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Jr(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);hT.getContext().decodeAudioData(c,function(h){t(h)},a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const TP=new mt,bP=new mt,rc=new mt;class Q${constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Un,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Un,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,rc.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(Bc*t.fov*.5)/t.zoom;let a,l;bP.elements[12]=-r,TP.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,rc.elements[0]=2*t.near/(l-a),rc.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(rc),a=-o*t.aspect-s,l=o*t.aspect-s,rc.elements[0]=2*t.near/(l-a),rc.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(rc)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(bP),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(TP)}}class pT{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=CP(),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=CP();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function CP(){return(typeof performance>"u"?Date:performance).now()}const sc=new U,RP=new Gi,q$=new U,oc=new U;class Z$ extends zt{constructor(){super(),this.type="AudioListener",this.context=hT.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new pT}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(sc,RP,q$),oc.set(0,0,-1).applyQuaternion(RP),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(sc.x,r),t.positionY.linearRampToValueAtTime(sc.y,r),t.positionZ.linearRampToValueAtTime(sc.z,r),t.forwardX.linearRampToValueAtTime(oc.x,r),t.forwardY.linearRampToValueAtTime(oc.y,r),t.forwardZ.linearRampToValueAtTime(oc.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(sc.x,sc.y,sc.z),t.setOrientation(oc.x,oc.y,oc.z,i.x,i.y,i.z)}}class IF extends zt{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(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){Gi.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;Gi.multiplyQuaternionsFlat(e,o,e,t,e,i),Gi.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const mT="\\[\\]\\.:\\/",i7=new RegExp("["+mT+"]","g"),gT="[^"+mT+"]",r7="[^"+mT.replace("\\.","")+"]",s7=/((?:WC+[\/:])*)/.source.replace("WC",gT),o7=/(WCOD+)?/.source.replace("WCOD",r7),a7=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",gT),l7=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",gT),c7=new RegExp("^"+s7+o7+a7+l7+"$"),u7=["material","materials","bones","map"];class f7{constructor(e,t,i){const r=i||kt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class kt{constructor(e,t,i){this.path=t,this.parsedPath=i||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,i){return e&&e.isAnimationObjectGroup?new kt.Composite(e,t,i):new kt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(i7,"")}static parseTrackName(e){const t=c7.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);u7.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o=s){const h=s++,p=e[h];t[p.uuid]=u,e[u]=p,t[c]=h,e[h]=l;for(let m=0,v=r;m!==v;++m){const y=i[m],_=y[h],g=y[u];y[u]=_,y[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,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 v=0,y=r;v!==y;++v){const _=i[v];_[h]=_[p],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let p=u,m=l.length;p!==m;++p){const v=l[p];h[p]=new kt(v,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class DF{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Ec,endingEnd:Ec};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=A3,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,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,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*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 Lw:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case i_:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===E3;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===S3){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Mc,r.endingEnd=Mc):(e?r.endingStart=this.zeroSlopeAtStart?Mc:Ec:r.endingStart=Ip,t?r.endingEnd=this.zeroSlopeAtEnd?Mc:Ec:r.endingEnd=Ip)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const h7=new Float32Array(1);class p7 extends Is{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const p=r[h],m=p.name;let v=u[m];if(v!==void 0)++v.referenceCount,o[h]=v;else{if(v=o[h],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const y=t&&t._propertyBindings[h].binding.parsedPath;v=new BF(kt.create(i,m,y),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),o[h]=v}a[h].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,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,BP).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 DP=new U,L0=new U;class A7{constructor(e=new U,t=new U){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){DP.subVectors(e,this.start),L0.subVectors(this.end,this.start);const i=L0.dot(L0);let s=L0.dot(DP)/i;return t&&(s=Nn(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const LP=new U;class E7 extends zt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Et,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,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{kP.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(kP,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class F7 extends Zs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Et;r.setAttribute("position",new Ke(t,3)),r.setAttribute("color",new Ke(i,3));const s=new Xi({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Ie,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class N7{constructor(){this.type="ShapePath",this.color=new Ie,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Up,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const x=[];for(let A=0,M=g.length;ANumber.EPSILON){if(I<0&&(R=x[b],C=-C,D=x[w],I=-I),g.yD.y)continue;if(g.y===R.y){if(g.x===R.x)return!0}else{const O=I*(g.x-R.x)-C*(g.y-R.y);if(O===0)return!0;if(O<0)continue;M=!M}}else{if(g.y!==R.y)continue;if(D.x<=g.x&&g.x<=R.x||R.x<=g.x&&g.x<=D.x)return!0}}return M}const r=Co.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 Oc,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],p=[];let m=[],v=0,y;p[v]=void 0,m[v]=[];for(let g=0,x=s.length;g1){let g=!1,x=0;for(let A=0,M=p.length;A0&&g===!1&&(m=h)}let _;for(let g=0,x=p.length;g{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))}},r=()=>e,s=(c,u=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=u(e);function m(){const v=u(e);if(!h(p,v)){const y=p;c(p=v,y)}}return t.add(m),()=>t.delete(m)},l={setState:i,getState:r,subscribe:(c,u,h)=>u||h?s(c,u,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(i,r,l),l}const k7=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),zP=k7?B.useEffect:B.useLayoutEffect;function vT(n){const e=typeof n=="function"?U7(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=B.useReducer(_=>_+1,0),o=e.getState(),a=B.useRef(o),l=B.useRef(i),c=B.useRef(r),u=B.useRef(!1),h=B.useRef();h.current===void 0&&(h.current=i(o));let p,m=!1;(a.current!==o||l.current!==i||c.current!==r||u.current)&&(p=i(o),m=!r(h.current,p)),zP(()=>{m&&(h.current=p),a.current=o,l.current=i,c.current=r,u.current=!1});const v=B.useRef(o);zP(()=>{const _=()=>{try{const x=e.getState(),A=l.current(x);c.current(h.current,A)||(a.current=x,h.current=A,s())}catch{u.current=!0,s()}},g=e.subscribe(_);return e.getState()!==v.current&&_(),g},[]);const y=m?p:h.current;return B.useDebugValue(y),y};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}var UF={exports:{}},kF={exports:{}},zF={};/** * @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(z,j){var K=z.length;z.push(j);e:for(;0>>1,Y=z[V];if(0>>1;Vr(ve,K))Cer(Ue,ve)?(z[V]=Ue,z[Ce]=K,V=Ce):(z[V]=ve,z[ge]=K,V=ge);else if(Cer(Ue,K))z[V]=Ue,z[Ce]=K,V=Ce;else break e}}return j}function r(z,j){var K=z.sortIndex-j.sortIndex;return K!==0?K:z.id-j.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,v=!1,y=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(z){for(var j=t(c);j!==null;){if(j.callback===null)i(c);else if(j.startTime<=z)i(c),j.sortIndex=j.expirationTime,e(l,j);else break;j=t(c)}}function M(z){if(y=!1,A(z),!v)if(t(l)!==null)v=!0,q(w);else{var j=t(c);j!==null&&Q(M,j.startTime-z)}}function w(z,j){v=!1,y&&(y=!1,g(D),D=-1),m=!0;var K=p;try{for(A(j),h=t(l);h!==null&&(!(h.expirationTime>j)||z&&!O());){var V=h.callback;if(typeof V=="function"){h.callback=null,p=h.priorityLevel;var Y=V(h.expirationTime<=j);j=n.unstable_now(),typeof Y=="function"?h.callback=Y:h===t(l)&&i(l),A(j)}else i(l);h=t(l)}if(h!==null)var de=!0;else{var ge=t(c);ge!==null&&Q(M,ge.startTime-j),de=!1}return de}finally{h=null,p=K,m=!1}}var b=!1,R=null,D=-1,C=5,I=-1;function O(){return!(n.unstable_now()-Iz||125V?(z.sortIndex=K,e(c,z),t(l)===null&&z===t(c)&&(y?(g(D),D=-1):y=!0,Q(M,K-V))):(z.sortIndex=Y,e(l,z),v||m||(v=!0,q(w))),z},n.unstable_shouldYield=O,n.unstable_wrapCallback=function(z){var j=p;return function(){var K=p;p=j;try{return z.apply(this,arguments)}finally{p=K}}}})(zF);kF.exports=zF;var TE=kF.exports;/** * @license React * react-reconciler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var z7=function(e){var t={},i=B,r=TE,s=Object.assign;function o(f){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+f,S=1;See||T[G]!==P[ee]){var ue=` `+T[G].replace(" at new "," at ");return f.displayName&&ue.includes("")&&(ue=ue.replace("",f.displayName)),ue}while(1<=G&&0<=ee);break}}}finally{gt=!1,Error.prepareStackTrace=S}return(f=f?f.displayName||f.name:"")?vt(f):""}var An=Object.prototype.hasOwnProperty,Ai=[],fn=-1;function li(f){return{current:f}}function ht(f){0>fn||(f.current=Ai[fn],Ai[fn]=null,fn--)}function Je(f,d){fn++,Ai[fn]=f.current,f.current=d}var Zr={},It=li(Zr),Dn=li(!1),ro=Zr;function es(f,d){var S=f.type.contextTypes;if(!S)return Zr;var E=f.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===d)return E.__reactInternalMemoizedMaskedChildContext;var T={},P;for(P in S)T[P]=d[P];return E&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=d,f.__reactInternalMemoizedMaskedChildContext=T),T}function ci(f){return f=f.childContextTypes,f!=null}function $n(){ht(Dn),ht(It)}function so(f,d,S){if(It.current!==Zr)throw Error(o(168));Je(It,d),Je(Dn,S)}function pu(f,d,S){var E=f.stateNode;if(d=d.childContextTypes,typeof E.getChildContext!="function")return S;E=E.getChildContext();for(var T in E)if(!(T in d))throw Error(o(108,D(f)||"Unknown",T));return s({},S,E)}function ui(f){return f=(f=f.stateNode)&&f.__reactInternalMemoizedMergedChildContext||Zr,ro=It.current,Je(It,f),Je(Dn,Dn.current),!0}function mu(f,d,S){var E=f.stateNode;if(!E)throw Error(o(169));S?(f=pu(f,d,ro),E.__reactInternalMemoizedMergedChildContext=f,ht(Dn),ht(It),Je(It,f)):ht(Dn),Je(Dn,S)}var Rr=Math.clz32?Math.clz32:Vz,zm=Math.log,Gz=Math.LN2;function Vz(f){return f>>>=0,f===0?32:31-(zm(f)/Gz|0)|0}var Hm=64,Gm=4194304;function Fd(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 Vm(f,d){var S=f.pendingLanes;if(S===0)return 0;var E=0,T=f.suspendedLanes,P=f.pingedLanes,G=S&268435455;if(G!==0){var ee=G&~T;ee!==0?E=Fd(ee):(P&=G,P!==0&&(E=Fd(P)))}else G=S&~T,G!==0?E=Fd(G):P!==0&&(E=Fd(P));if(E===0)return 0;if(d!==0&&d!==E&&!(d&T)&&(T=E&-E,P=d&-d,T>=P||T===16&&(P&4194240)!==0))return d;if(E&4&&(E|=S&16),d=f.entangledLanes,d!==0)for(f=f.entanglements,d&=E;0S;S++)d.push(f);return d}function Nd(f,d,S){f.pendingLanes|=d,d!==536870912&&(f.suspendedLanes=0,f.pingedLanes=0),f=f.eventTimes,d=31-Rr(d),f[d]=S}function Xz(f,d){var S=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 E=f.eventTimes;for(f=f.expirationTimes;0>=G,T-=G,Uo=1<<32-Rr(d)+T|S<Wt?(hi=St,St=null):hi=St.sibling;var $t=rt(re,St,oe[Wt],Ne);if($t===null){St===null&&(St=hi);break}f&&St&&$t.alternate===null&&d(re,St),te=P($t,te,Wt),Tt===null?Ye=$t:Tt.sibling=$t,Tt=$t,St=hi}if(Wt===oe.length)return S(re,St),vn&&Xl(re,Wt),Ye;if(St===null){for(;WtWt?(hi=St,St=null):hi=St.sibling;var Na=rt(re,St,$t.value,Ne);if(Na===null){St===null&&(St=hi);break}f&&St&&Na.alternate===null&&d(re,St),te=P(Na,te,Wt),Tt===null?Ye=Na:Tt.sibling=Na,Tt=Na,St=hi}if($t.done)return S(re,St),vn&&Xl(re,Wt),Ye;if(St===null){for(;!$t.done;Wt++,$t=oe.next())$t=xt(re,$t.value,Ne),$t!==null&&(te=P($t,te,Wt),Tt===null?Ye=$t:Tt.sibling=$t,Tt=$t);return vn&&Xl(re,Wt),Ye}for(St=E(re,St);!$t.done;Wt++,$t=oe.next())$t=nn(St,re,Wt,$t.value,Ne),$t!==null&&(f&&$t.alternate!==null&&St.delete($t.key===null?Wt:$t.key),te=P($t,te,Wt),Tt===null?Ye=$t:Tt.sibling=$t,Tt=$t);return f&&St.forEach(function(IH){return d(re,IH)}),vn&&Xl(re,Wt),Ye}function ls(re,te,oe,Ne){if(typeof oe=="object"&&oe!==null&&oe.type===u&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case l:e:{for(var Ye=oe.key,Tt=te;Tt!==null;){if(Tt.key===Ye){if(Ye=oe.type,Ye===u){if(Tt.tag===7){S(re,Tt.sibling),te=T(Tt,oe.props.children),te.return=re,re=te;break e}}else if(Tt.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===A&&Gb(Ye)===Tt.type){S(re,Tt.sibling),te=T(Tt,oe.props),te.ref=zd(re,Tt,oe),te.return=re,re=te;break e}S(re,Tt);break}else d(re,Tt);Tt=Tt.sibling}oe.type===u?(te=Zl(oe.props.children,re.mode,Ne,oe.key),te.return=re,re=te):(Ne=Ig(oe.type,oe.key,oe.props,null,re.mode,Ne),Ne.ref=zd(re,te,oe),Ne.return=re,re=Ne)}return G(re);case c:e:{for(Tt=oe.key;te!==null;){if(te.key===Tt)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){S(re,te.sibling),te=T(te,oe.children||[]),te.return=re,re=te;break e}else{S(re,te);break}else d(re,te);te=te.sibling}te=Qx(oe,re.mode,Ne),te.return=re,re=te}return G(re);case A:return Tt=oe._init,ls(re,te,Tt(oe._payload),Ne)}if(W(oe))return et(re,te,oe,Ne);if(b(oe))return Di(re,te,oe,Ne);eg(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,te!==null&&te.tag===6?(S(re,te.sibling),te=T(te,oe),te.return=re,re=te):(S(re,te),te=Yx(oe,re.mode,Ne),te.return=re,re=te),G(re)):S(re,te)}return ls}var Su=Vb(!0),Wb=Vb(!1),Hd={},rs=li(Hd),Gd=li(Hd),Au=li(Hd);function uo(f){if(f===Hd)throw Error(o(174));return f}function px(f,d){Je(Au,d),Je(Gd,f),Je(rs,Hd),f=Q(d),ht(rs),Je(rs,f)}function Eu(){ht(rs),ht(Gd),ht(Au)}function $b(f){var d=uo(Au.current),S=uo(rs.current);d=z(S,f.type,d),S!==d&&(Je(Gd,f),Je(rs,d))}function mx(f){Gd.current===f&&(ht(rs),ht(Gd))}var En=li(0);function tg(f){for(var d=f;d!==null;){if(d.tag===13){var S=d.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||Ld(S)||Od(S)))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 gx=[];function vx(){for(var f=0;fS?S:4,f(!0);var E=ss.transition;ss.transition={};try{f(!1),d()}finally{Vt=S,ss.transition=E}}function sC(){return fo().memoizedState}function rH(f,d,S){var E=La(f);S={lane:E,action:S,hasEagerState:!1,eagerState:null,next:null},oC(f)?aC(d,S):(lC(f,d,S),S=Qi(),f=os(f,E,S),f!==null&&cC(f,d,E))}function sH(f,d,S){var E=La(f),T={lane:E,action:S,hasEagerState:!1,eagerState:null,next:null};if(oC(f))aC(d,T);else{lC(f,d,T);var P=f.alternate;if(f.lanes===0&&(P===null||P.lanes===0)&&(P=d.lastRenderedReducer,P!==null))try{var G=d.lastRenderedState,ee=P(G,S);if(T.hasEagerState=!0,T.eagerState=ee,ao(ee,G))return}catch{}finally{}S=Qi(),f=os(f,E,S),f!==null&&cC(f,d,E)}}function oC(f){var d=f.alternate;return f===Ln||d!==null&&d===Ln}function aC(f,d){Vd=ig=!0;var S=f.pending;S===null?d.next=d:(d.next=S.next,S.next=d),f.pending=d}function lC(f,d,S){Xn!==null&&f.mode&1&&!(Ct&2)?(f=d.interleaved,f===null?(S.next=S,co===null?co=[d]:co.push(d)):(S.next=f.next,f.next=S),d.interleaved=S):(f=d.pending,f===null?S.next=S:(S.next=f.next,f.next=S),d.pending=S)}function cC(f,d,S){if(S&4194240){var E=d.lanes;E&=f.pendingLanes,S|=E,d.lanes=S,Q_(f,S)}}var lg={readContext:ts,useCallback:Ii,useContext:Ii,useEffect:Ii,useImperativeHandle:Ii,useInsertionEffect:Ii,useLayoutEffect:Ii,useMemo:Ii,useReducer:Ii,useRef:Ii,useState:Ii,useDebugValue:Ii,useDeferredValue:Ii,useTransition:Ii,useMutableSource:Ii,useSyncExternalStore:Ii,useId:Ii,unstable_isNewReconciler:!1},oH={readContext:ts,useCallback:function(f,d){return zo().memoizedState=[f,d===void 0?null:d],f},useContext:ts,useEffect:Ax,useImperativeHandle:function(f,d,S){return S=S!=null?S.concat([f]):null,og(4194308,4,tC.bind(null,d,f),S)},useLayoutEffect:function(f,d){return og(4194308,4,f,d)},useInsertionEffect:function(f,d){return og(4,2,f,d)},useMemo:function(f,d){var S=zo();return d=d===void 0?null:d,f=f(),S.memoizedState=[f,d],f},useReducer:function(f,d,S){var E=zo();return d=S!==void 0?S(d):d,E.memoizedState=E.baseState=d,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:d},E.queue=f,f=f.dispatch=rH.bind(null,Ln,f),[E.memoizedState,f]},useRef:function(f){var d=zo();return f={current:f},d.memoizedState=f},useState:Sx,useDebugValue:Ex,useDeferredValue:function(f){var d=Sx(f),S=d[0],E=d[1];return Ax(function(){var T=ss.transition;ss.transition={};try{E(f)}finally{ss.transition=T}},[f]),S},useTransition:function(){var f=Sx(!1),d=f[0];return f=iH.bind(null,f[1]),zo().memoizedState=f,[d,f]},useMutableSource:function(){},useSyncExternalStore:function(f,d,S){var E=Ln,T=zo();if(vn){if(S===void 0)throw Error(o(407));S=S()}else{if(S=d(),Xn===null)throw Error(o(349));Mu&30||Jb(E,d,S)}T.memoizedState=S;var P={value:S,getSnapshot:d};return T.queue=P,Ax(Yb.bind(null,E,P,f),[f]),E.flags|=2048,$d(9,Kb.bind(null,E,P,S,d),void 0,null),S},useId:function(){var f=zo(),d=Xn.identifierPrefix;if(vn){var S=ko,E=Uo;S=(E&~(1<<32-Rr(E)-1)).toString(32)+S,d=":"+d+"R"+S,S=Wd++,0Gx&&(d.flags|=128,E=!0,Kd(T,!1),d.lanes=4194304)}else{if(!E)if(f=tg(P),f!==null){if(d.flags|=128,E=!0,f=f.updateQueue,f!==null&&(d.updateQueue=f,d.flags|=4),Kd(T,!0),T.tail===null&&T.tailMode==="hidden"&&!P.alternate&&!vn)return Bi(d),null}else 2*fi()-T.renderingStartTime>Gx&&S!==1073741824&&(d.flags|=128,E=!0,Kd(T,!1),d.lanes=4194304);T.isBackwards?(P.sibling=d.child,d.child=P):(f=T.last,f!==null?f.sibling=P:d.child=P,T.last=P)}return T.tail!==null?(d=T.tail,T.rendering=d,T.tail=d.sibling,T.renderingStartTime=fi(),d.sibling=null,f=En.current,Je(En,E?f&1|2:f&1),d):(Bi(d),null);case 22:case 23:return jx(),E=d.memoizedState!==null,f!==null&&f.memoizedState!==null!==E&&(d.flags|=8192),E&&d.mode&1?Dr&1073741824&&(Bi(d),Ee&&d.subtreeFlags&6&&(d.flags|=8192)):Bi(d),null;case 24:return null;case 25:return null}throw Error(o(156,d.tag))}var fH=a.ReactCurrentOwner,Br=!1;function Yi(f,d,S,E){d.child=f===null?Wb(d,null,S,E):Su(d,f.child,S,E)}function vC(f,d,S,E,T){S=S.render;var P=d.ref;return vu(d,T),E=_x(f,d,S,E,P,T),S=xx(),f!==null&&!Br?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~T,Ho(f,d,T)):(vn&&S&&cx(d),d.flags|=1,Yi(f,d,E,T),d.child)}function yC(f,d,S,E,T){if(f===null){var P=S.type;return typeof P=="function"&&!Kx(P)&&P.defaultProps===void 0&&S.compare===null&&S.defaultProps===void 0?(d.tag=15,d.type=P,_C(f,d,P,E,T)):(f=Ig(S.type,null,E,d,d.mode,T),f.ref=d.ref,f.return=d,d.child=f)}if(P=f.child,!(f.lanes&T)){var G=P.memoizedProps;if(S=S.compare,S=S!==null?S:Xm,S(G,E)&&f.ref===d.ref)return Ho(f,d,T)}return d.flags|=1,f=Fa(P,E),f.ref=d.ref,f.return=d,d.child=f}function _C(f,d,S,E,T){if(f!==null&&Xm(f.memoizedProps,E)&&f.ref===d.ref)if(Br=!1,(f.lanes&T)!==0)f.flags&131072&&(Br=!0);else return d.lanes=f.lanes,Ho(f,d,T);return Tx(f,d,S,E,T)}function xC(f,d,S){var E=d.pendingProps,T=E.children,P=f!==null?f.memoizedState:null;if(E.mode==="hidden")if(!(d.mode&1))d.memoizedState={baseLanes:0,cachePool:null},Je(wu,Dr),Dr|=S;else if(S&1073741824)d.memoizedState={baseLanes:0,cachePool:null},E=P!==null?P.baseLanes:S,Je(wu,Dr),Dr|=E;else return f=P!==null?P.baseLanes|S:S,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:f,cachePool:null},d.updateQueue=null,Je(wu,Dr),Dr|=f,null;else P!==null?(E=P.baseLanes|S,d.memoizedState=null):E=S,Je(wu,Dr),Dr|=E;return Yi(f,d,T,S),d.child}function SC(f,d){var S=d.ref;(f===null&&S!==null||f!==null&&f.ref!==S)&&(d.flags|=512,d.flags|=2097152)}function Tx(f,d,S,E,T){var P=ci(S)?ro:It.current;return P=es(d,P),vu(d,T),S=_x(f,d,S,E,P,T),E=xx(),f!==null&&!Br?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~T,Ho(f,d,T)):(vn&&E&&cx(d),d.flags|=1,Yi(f,d,S,T),d.child)}function AC(f,d,S,E,T){if(ci(S)){var P=!0;ui(d)}else P=!1;if(vu(d,T),d.stateNode===null)f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),Fb(d,S,E),lx(d,S,E,T),E=!0;else if(f===null){var G=d.stateNode,ee=d.memoizedProps;G.props=ee;var ue=G.context,Te=S.contextType;typeof Te=="object"&&Te!==null?Te=ts(Te):(Te=ci(S)?ro:It.current,Te=es(d,Te));var Xe=S.getDerivedStateFromProps,xt=typeof Xe=="function"||typeof G.getSnapshotBeforeUpdate=="function";xt||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(ee!==E||ue!==Te)&&Nb(d,G,E,Te),Pa=!1;var rt=d.memoizedState;G.state=rt,Ym(d,E,G,T),ue=d.memoizedState,ee!==E||rt!==ue||Dn.current||Pa?(typeof Xe=="function"&&(ax(d,S,Xe,E),ue=d.memoizedState),(ee=Pa||Ob(d,S,ee,E,rt,ue,Te))?(xt||typeof G.UNSAFE_componentWillMount!="function"&&typeof G.componentWillMount!="function"||(typeof G.componentWillMount=="function"&&G.componentWillMount(),typeof G.UNSAFE_componentWillMount=="function"&&G.UNSAFE_componentWillMount()),typeof G.componentDidMount=="function"&&(d.flags|=4194308)):(typeof G.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=E,d.memoizedState=ue),G.props=E,G.state=ue,G.context=Te,E=ee):(typeof G.componentDidMount=="function"&&(d.flags|=4194308),E=!1)}else{G=d.stateNode,Ib(f,d),ee=d.memoizedProps,Te=d.type===d.elementType?ee:Ls(d.type,ee),G.props=Te,xt=d.pendingProps,rt=G.context,ue=S.contextType,typeof ue=="object"&&ue!==null?ue=ts(ue):(ue=ci(S)?ro:It.current,ue=es(d,ue));var nn=S.getDerivedStateFromProps;(Xe=typeof nn=="function"||typeof G.getSnapshotBeforeUpdate=="function")||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(ee!==xt||rt!==ue)&&Nb(d,G,E,ue),Pa=!1,rt=d.memoizedState,G.state=rt,Ym(d,E,G,T);var et=d.memoizedState;ee!==xt||rt!==et||Dn.current||Pa?(typeof nn=="function"&&(ax(d,S,nn,E),et=d.memoizedState),(Te=Pa||Ob(d,S,Te,E,rt,et,ue)||!1)?(Xe||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(E,et,ue),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(E,et,ue)),typeof G.componentDidUpdate=="function"&&(d.flags|=4),typeof G.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof G.componentDidUpdate!="function"||ee===f.memoizedProps&&rt===f.memoizedState||(d.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||ee===f.memoizedProps&&rt===f.memoizedState||(d.flags|=1024),d.memoizedProps=E,d.memoizedState=et),G.props=E,G.state=et,G.context=ue,E=Te):(typeof G.componentDidUpdate!="function"||ee===f.memoizedProps&&rt===f.memoizedState||(d.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||ee===f.memoizedProps&&rt===f.memoizedState||(d.flags|=1024),E=!1)}return bx(f,d,S,E,P,T)}function bx(f,d,S,E,T,P){SC(f,d);var G=(d.flags&128)!==0;if(!E&&!G)return T&&mu(d,S,!1),Ho(f,d,P);E=d.stateNode,fH.current=d;var ee=G&&typeof S.getDerivedStateFromError!="function"?null:E.render();return d.flags|=1,f!==null&&G?(d.child=Su(d,f.child,null,P),d.child=Su(d,null,ee,P)):Yi(f,d,ee,P),d.memoizedState=E.state,T&&mu(d,S,!0),d.child}function EC(f){var d=f.stateNode;d.pendingContext?so(f,d.pendingContext,d.pendingContext!==d.context):d.context&&so(f,d.context,!1),px(f,d.containerInfo)}function MC(f,d,S,E,T){return xu(),hx(T),d.flags|=256,Yi(f,d,S,E),d.child}var fg={dehydrated:null,treeContext:null,retryLane:0};function dg(f){return{baseLanes:f,cachePool:null}}function wC(f,d,S){var E=d.pendingProps,T=En.current,P=!1,G=(d.flags&128)!==0,ee;if((ee=G)||(ee=f!==null&&f.memoizedState===null?!1:(T&2)!==0),ee?(P=!0,d.flags&=-129):(f===null||f.memoizedState!==null)&&(T|=1),Je(En,T&1),f===null)return dx(d),f=d.memoizedState,f!==null&&(f=f.dehydrated,f!==null)?(d.mode&1?Od(f)?d.lanes=8:d.lanes=1073741824:d.lanes=1,null):(T=E.children,f=E.fallback,P?(E=d.mode,P=d.child,T={mode:"hidden",children:T},!(E&1)&&P!==null?(P.childLanes=0,P.pendingProps=T):P=Bg(T,E,0,null),f=Zl(f,E,S,null),P.return=d,f.return=d,P.sibling=f,d.child=P,d.child.memoizedState=dg(S),d.memoizedState=fg,f):Cx(d,T));if(T=f.memoizedState,T!==null){if(ee=T.dehydrated,ee!==null){if(G)return d.flags&256?(d.flags&=-257,hg(f,d,S,Error(o(422)))):d.memoizedState!==null?(d.child=f.child,d.flags|=128,null):(P=E.fallback,T=d.mode,E=Bg({mode:"visible",children:E.children},T,0,null),P=Zl(P,T,S,null),P.flags|=2,E.return=d,P.return=d,E.sibling=P,d.child=E,d.mode&1&&Su(d,f.child,null,S),d.child.memoizedState=dg(S),d.memoizedState=fg,P);if(!(d.mode&1))d=hg(f,d,S,null);else if(Od(ee))d=hg(f,d,S,Error(o(419)));else if(E=(S&f.childLanes)!==0,Br||E){if(E=Xn,E!==null){switch(S&-S){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}E=P&(E.suspendedLanes|S)?0:P,E!==0&&E!==T.retryLane&&(T.retryLane=E,os(f,E,-1))}Jx(),d=hg(f,d,S,Error(o(421)))}else Ld(ee)?(d.flags|=128,d.child=f.child,d=MH.bind(null,f),du(ee,d),d=null):(S=T.treeContext,ye&&(Ir=km(ee),Pr=d,vn=!0,Os=null,Ud=!1,S!==null&&(ns[is++]=Uo,ns[is++]=ko,ns[is++]=$l,Uo=S.id,ko=S.overflow,$l=d)),d=Cx(d,d.pendingProps.children),d.flags|=4096);return d}return P?(E=bC(f,d,E.children,E.fallback,S),P=d.child,T=f.child.memoizedState,P.memoizedState=T===null?dg(S):{baseLanes:T.baseLanes|S,cachePool:null},P.childLanes=f.childLanes&~S,d.memoizedState=fg,E):(S=TC(f,d,E.children,S),d.memoizedState=null,S)}return P?(E=bC(f,d,E.children,E.fallback,S),P=d.child,T=f.child.memoizedState,P.memoizedState=T===null?dg(S):{baseLanes:T.baseLanes|S,cachePool:null},P.childLanes=f.childLanes&~S,d.memoizedState=fg,E):(S=TC(f,d,E.children,S),d.memoizedState=null,S)}function Cx(f,d){return d=Bg({mode:"visible",children:d},f.mode,0,null),d.return=f,f.child=d}function TC(f,d,S,E){var T=f.child;return f=T.sibling,S=Fa(T,{mode:"visible",children:S}),!(d.mode&1)&&(S.lanes=E),S.return=d,S.sibling=null,f!==null&&(E=d.deletions,E===null?(d.deletions=[f],d.flags|=16):E.push(f)),d.child=S}function bC(f,d,S,E,T){var P=d.mode;f=f.child;var G=f.sibling,ee={mode:"hidden",children:S};return!(P&1)&&d.child!==f?(S=d.child,S.childLanes=0,S.pendingProps=ee,d.deletions=null):(S=Fa(f,ee),S.subtreeFlags=f.subtreeFlags&14680064),G!==null?E=Fa(G,E):(E=Zl(E,P,T,null),E.flags|=2),E.return=d,S.return=d,S.sibling=E,d.child=S,E}function hg(f,d,S,E){return E!==null&&hx(E),Su(d,f.child,null,S),f=Cx(d,d.pendingProps.children),f.flags|=2,d.memoizedState=null,f}function CC(f,d,S){f.lanes|=d;var E=f.alternate;E!==null&&(E.lanes|=d),sx(f.return,d,S)}function Rx(f,d,S,E,T){var P=f.memoizedState;P===null?f.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:E,tail:S,tailMode:T}:(P.isBackwards=d,P.rendering=null,P.renderingStartTime=0,P.last=E,P.tail=S,P.tailMode=T)}function RC(f,d,S){var E=d.pendingProps,T=E.revealOrder,P=E.tail;if(Yi(f,d,E.children,S),E=En.current,E&2)E=E&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&&CC(f,S,d);else if(f.tag===19)CC(f,S,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}E&=1}if(Je(En,E),!(d.mode&1))d.memoizedState=null;else switch(T){case"forwards":for(S=d.child,T=null;S!==null;)f=S.alternate,f!==null&&tg(f)===null&&(T=S),S=S.sibling;S=T,S===null?(T=d.child,d.child=null):(T=S.sibling,S.sibling=null),Rx(d,!1,T,S,P);break;case"backwards":for(S=null,T=d.child,d.child=null;T!==null;){if(f=T.alternate,f!==null&&tg(f)===null){d.child=T;break}f=T.sibling,T.sibling=S,S=T,T=f}Rx(d,!0,S,null,P);break;case"together":Rx(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function Ho(f,d,S){if(f!==null&&(d.dependencies=f.dependencies),Tu|=d.lanes,!(S&d.childLanes))return null;if(f!==null&&d.child!==f.child)throw Error(o(153));if(d.child!==null){for(f=d.child,S=Fa(f,f.pendingProps),d.child=S,S.return=d;f.sibling!==null;)f=f.sibling,S=S.sibling=Fa(f,f.pendingProps),S.return=d;S.sibling=null}return d.child}function dH(f,d,S){switch(d.tag){case 3:EC(d),xu();break;case 5:$b(d);break;case 1:ci(d.type)&&ui(d);break;case 4:px(d,d.stateNode.containerInfo);break;case 10:Pb(d,d.type._context,d.memoizedProps.value);break;case 13:var E=d.memoizedState;if(E!==null)return E.dehydrated!==null?(Je(En,En.current&1),d.flags|=128,null):S&d.child.childLanes?wC(f,d,S):(Je(En,En.current&1),f=Ho(f,d,S),f!==null?f.sibling:null);Je(En,En.current&1);break;case 19:if(E=(S&d.childLanes)!==0,f.flags&128){if(E)return RC(f,d,S);d.flags|=128}var T=d.memoizedState;if(T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),Je(En,En.current),E)break;return null;case 22:case 23:return d.lanes=0,xC(f,d,S)}return Ho(f,d,S)}function hH(f,d){switch(ux(d),d.tag){case 1:return ci(d.type)&&$n(),f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 3:return Eu(),ht(Dn),ht(It),vx(),f=d.flags,f&65536&&!(f&128)?(d.flags=f&-65537|128,d):null;case 5:return mx(d),null;case 13:if(ht(En),f=d.memoizedState,f!==null&&f.dehydrated!==null){if(d.alternate===null)throw Error(o(340));xu()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 19:return ht(En),null;case 4:return Eu(),null;case 10:return rx(d.type._context),null;case 22:case 23:return jx(),null;case 24:return null;default:return null}}var pg=!1,Jl=!1,pH=typeof WeakSet=="function"?WeakSet:Set,Oe=null;function mg(f,d){var S=f.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(E){dr(f,d,E)}else S.current=null}function Px(f,d,S){try{S()}catch(E){dr(f,d,E)}}var PC=!1;function mH(f,d){for(j(f.containerInfo),Oe=d;Oe!==null;)if(f=Oe,d=f.child,(f.subtreeFlags&1028)!==0&&d!==null)d.return=f,Oe=d;else for(;Oe!==null;){f=Oe;try{var S=f.alternate;if(f.flags&1024)switch(f.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var E=S.memoizedProps,T=S.memoizedState,P=f.stateNode,G=P.getSnapshotBeforeUpdate(f.elementType===f.type?E:Ls(f.type,E),T);P.__reactInternalSnapshotBeforeUpdate=G}break;case 3:Ee&&Fe(f.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ee){dr(f,f.return,ee)}if(d=f.sibling,d!==null){d.return=f.return,Oe=d;break}Oe=f.return}return S=PC,PC=!1,S}function Kl(f,d,S){var E=d.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var T=E=E.next;do{if((T.tag&f)===f){var P=T.destroy;T.destroy=void 0,P!==void 0&&Px(d,S,P)}T=T.next}while(T!==E)}}function Yd(f,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var S=d=d.next;do{if((S.tag&f)===f){var E=S.create;S.destroy=E()}S=S.next}while(S!==d)}}function Ix(f){var d=f.ref;if(d!==null){var S=f.stateNode;switch(f.tag){case 5:f=q(S);break;default:f=S}typeof d=="function"?d(f):d.current=f}}function IC(f,d,S){if(oo&&typeof oo.onCommitFiberUnmount=="function")try{oo.onCommitFiberUnmount(Wm,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 E=f=f.next;do{var T=E,P=T.destroy;T=T.tag,P!==void 0&&(T&2||T&4)&&Px(d,S,P),E=E.next}while(E!==f)}break;case 1:if(mg(d,S),f=d.stateNode,typeof f.componentWillUnmount=="function")try{f.props=d.memoizedProps,f.state=d.memoizedState,f.componentWillUnmount()}catch(G){dr(d,S,G)}break;case 5:mg(d,S);break;case 4:Ee?NC(f,d,S):$&&$&&(d=d.stateNode.containerInfo,S=he(d),Ut(d,S))}}function BC(f,d,S){for(var E=d;;)if(IC(f,E,S),E.child===null||Ee&&E.tag===4){if(E===d)break;for(;E.sibling===null;){if(E.return===null||E.return===d)return;E=E.return}E.sibling.return=E.return,E=E.sibling}else E.child.return=E,E=E.child}function DC(f){var d=f.alternate;d!==null&&(f.alternate=null,DC(d)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(d=f.stateNode,d!==null&&He(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 LC(f){return f.tag===5||f.tag===3||f.tag===4}function OC(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||LC(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 FC(f){if(Ee){e:{for(var d=f.return;d!==null;){if(LC(d))break e;d=d.return}throw Error(o(160))}var S=d;switch(S.tag){case 5:d=S.stateNode,S.flags&32&&(it(d),S.flags&=-33),S=OC(f),Dx(f,S,d);break;case 3:case 4:d=S.stateNode.containerInfo,S=OC(f),Bx(f,S,d);break;default:throw Error(o(161))}}}function Bx(f,d,S){var E=f.tag;if(E===5||E===6)f=f.stateNode,d?Me(S,f,d):We(S,f);else if(E!==4&&(f=f.child,f!==null))for(Bx(f,d,S),f=f.sibling;f!==null;)Bx(f,d,S),f=f.sibling}function Dx(f,d,S){var E=f.tag;if(E===5||E===6)f=f.stateNode,d?Rt(S,f,d):Se(S,f);else if(E!==4&&(f=f.child,f!==null))for(Dx(f,d,S),f=f.sibling;f!==null;)Dx(f,d,S),f=f.sibling}function NC(f,d,S){for(var E=d,T=!1,P,G;;){if(!T){T=E.return;e:for(;;){if(T===null)throw Error(o(160));switch(P=T.stateNode,T.tag){case 5:G=!1;break e;case 3:P=P.containerInfo,G=!0;break e;case 4:P=P.containerInfo,G=!0;break e}T=T.return}T=!0}if(E.tag===5||E.tag===6)BC(f,E,S),G?dt(P,E.stateNode):Nt(P,E.stateNode);else if(E.tag===18)G?le(P,E.stateNode):ae(P,E.stateNode);else if(E.tag===4){if(E.child!==null){P=E.stateNode.containerInfo,G=!0,E.child.return=E,E=E.child;continue}}else if(IC(f,E,S),E.child!==null){E.child.return=E,E=E.child;continue}if(E===d)break;for(;E.sibling===null;){if(E.return===null||E.return===d)return;E=E.return,E.tag===4&&(T=!1)}E.sibling.return=E.return,E=E.sibling}}function Lx(f,d){if(Ee){switch(d.tag){case 0:case 11:case 14:case 15:Kl(3,d,d.return),Yd(3,d),Kl(5,d,d.return);return;case 1:return;case 5:var S=d.stateNode;if(S!=null){var E=d.memoizedProps;f=f!==null?f.memoizedProps:E;var T=d.type,P=d.updateQueue;d.updateQueue=null,P!==null&&ot(S,P,T,f,E,d)}return;case 6:if(d.stateNode===null)throw Error(o(162));S=d.memoizedProps,we(d.stateNode,f!==null?f.memoizedProps:S,S);return;case 3:ye&&f!==null&&f.memoizedState.isDehydrated&&ie(d.stateNode.containerInfo);return;case 12:return;case 13:gg(d);return;case 19:gg(d);return;case 17:return}throw Error(o(163))}switch(d.tag){case 0:case 11:case 14:case 15:Kl(3,d,d.return),Yd(3,d),Kl(5,d,d.return);return;case 12:return;case 13:gg(d);return;case 19:gg(d);return;case 3:ye&&f!==null&&f.memoizedState.isDehydrated&&ie(d.stateNode.containerInfo);break;case 22:case 23:return}e:if($){switch(d.tag){case 1:case 5:case 6:break e;case 3:case 4:d=d.stateNode,Ut(d.containerInfo,d.pendingChildren);break e}throw Error(o(163))}}function gg(f){var d=f.updateQueue;if(d!==null){f.updateQueue=null;var S=f.stateNode;S===null&&(S=f.stateNode=new pH),d.forEach(function(E){var T=wH.bind(null,f,E);S.has(E)||(S.add(E),E.then(T,T))})}}function gH(f,d){for(Oe=d;Oe!==null;){d=Oe;var S=d.deletions;if(S!==null)for(var E=0;E";case yg:return":has("+(Nx(f)||"")+")";case _g:return'[role="'+f.value+'"]';case Sg:return'"'+f.value+'"';case xg:return'[data-testname="'+f.value+'"]';default:throw Error(o(365))}}function GC(f,d){var S=[];f=[f,0];for(var E=0;ET&&(T=G),E&=~P}if(E=T,E=fi()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*yH(E/1960))-E,10f?16:f,Da===null)var E=!1;else{if(f=Da,Da=null,Tg=0,Ct&6)throw Error(o(331));var T=Ct;for(Ct|=4,Oe=f.current;Oe!==null;){var P=Oe,G=P.child;if(Oe.flags&16){var ee=P.deletions;if(ee!==null){for(var ue=0;uefi()-Hx?Yl(f,0):zx|=S),fr(f,d)}function QC(f,d){d===0&&(f.mode&1?(d=Gm,Gm<<=1,!(Gm&130023424)&&(Gm=4194304)):d=1);var S=Qi();f=Rg(f,d),f!==null&&(Nd(f,d,S),fr(f,S))}function MH(f){var d=f.memoizedState,S=0;d!==null&&(S=d.retryLane),QC(f,S)}function wH(f,d){var S=0;switch(f.tag){case 13:var E=f.stateNode,T=f.memoizedState;T!==null&&(S=T.retryLane);break;case 19:E=f.stateNode;break;default:throw Error(o(314))}E!==null&&E.delete(d),QC(f,S)}var qC;qC=function(f,d,S){if(f!==null)if(f.memoizedProps!==d.pendingProps||Dn.current)Br=!0;else{if(!(f.lanes&S)&&!(d.flags&128))return Br=!1,dH(f,d,S);Br=!!(f.flags&131072)}else Br=!1,vn&&d.flags&1048576&&Ub(d,Zm,d.index);switch(d.lanes=0,d.tag){case 2:var E=d.type;f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),f=d.pendingProps;var T=es(d,It.current);vu(d,S),T=_x(null,d,E,f,T,S);var P=xx();return d.flags|=1,typeof T=="object"&&T!==null&&typeof T.render=="function"&&T.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,ci(E)?(P=!0,ui(d)):P=!1,d.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,ox(d),T.updater=Qm,d.stateNode=T,T._reactInternals=d,lx(d,E,f,S),d=bx(null,d,E,!0,P,S)):(d.tag=0,vn&&P&&cx(d),Yi(null,d,T,S),d=d.child),d;case 16:E=d.elementType;e:{switch(f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),f=d.pendingProps,T=E._init,E=T(E._payload),d.type=E,T=d.tag=bH(E),f=Ls(E,f),T){case 0:d=Tx(null,d,E,f,S);break e;case 1:d=AC(null,d,E,f,S);break e;case 11:d=vC(null,d,E,f,S);break e;case 14:d=yC(null,d,E,Ls(E.type,f),S);break e}throw Error(o(306,E,""))}return d;case 0:return E=d.type,T=d.pendingProps,T=d.elementType===E?T:Ls(E,T),Tx(f,d,E,T,S);case 1:return E=d.type,T=d.pendingProps,T=d.elementType===E?T:Ls(E,T),AC(f,d,E,T,S);case 3:e:{if(EC(d),f===null)throw Error(o(387));E=d.pendingProps,P=d.memoizedState,T=P.element,Ib(f,d),Ym(d,E,null,S);var G=d.memoizedState;if(E=G.element,ye&&P.isDehydrated)if(P={element:E,isDehydrated:!1,cache:G.cache,transitions:G.transitions},d.updateQueue.baseState=P,d.memoizedState=P,d.flags&256){T=Error(o(423)),d=MC(f,d,E,S,T);break e}else if(E!==T){T=Error(o(424)),d=MC(f,d,E,S,T);break e}else for(ye&&(Ir=Um(d.stateNode.containerInfo),Pr=d,vn=!0,Os=null,Ud=!1),S=Wb(d,null,E,S),d.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(xu(),E===T){d=Ho(f,d,S);break e}Yi(f,d,E,S)}d=d.child}return d;case 5:return $b(d),f===null&&dx(d),E=d.type,T=d.pendingProps,P=f!==null?f.memoizedProps:null,G=T.children,ve(E,T)?G=null:P!==null&&ve(E,P)&&(d.flags|=32),SC(f,d),Yi(f,d,G,S),d.child;case 6:return f===null&&dx(d),null;case 13:return wC(f,d,S);case 4:return px(d,d.stateNode.containerInfo),E=d.pendingProps,f===null?d.child=Su(d,null,E,S):Yi(f,d,E,S),d.child;case 11:return E=d.type,T=d.pendingProps,T=d.elementType===E?T:Ls(E,T),vC(f,d,E,T,S);case 7:return Yi(f,d,d.pendingProps,S),d.child;case 8:return Yi(f,d,d.pendingProps.children,S),d.child;case 12:return Yi(f,d,d.pendingProps.children,S),d.child;case 10:e:{if(E=d.type._context,T=d.pendingProps,P=d.memoizedProps,G=T.value,Pb(d,E,G),P!==null)if(ao(P.value,G)){if(P.children===T.children&&!Dn.current){d=Ho(f,d,S);break e}}else for(P=d.child,P!==null&&(P.return=d);P!==null;){var ee=P.dependencies;if(ee!==null){G=P.child;for(var ue=ee.firstContext;ue!==null;){if(ue.context===E){if(P.tag===1){ue=No(-1,S&-S),ue.tag=2;var Te=P.updateQueue;if(Te!==null){Te=Te.shared;var Xe=Te.pending;Xe===null?ue.next=ue:(ue.next=Xe.next,Xe.next=ue),Te.pending=ue}}P.lanes|=S,ue=P.alternate,ue!==null&&(ue.lanes|=S),sx(P.return,S,d),ee.lanes|=S;break}ue=ue.next}}else if(P.tag===10)G=P.type===d.type?null:P.child;else if(P.tag===18){if(G=P.return,G===null)throw Error(o(341));G.lanes|=S,ee=G.alternate,ee!==null&&(ee.lanes|=S),sx(G,S,d),G=P.sibling}else G=P.child;if(G!==null)G.return=P;else for(G=P;G!==null;){if(G===d){G=null;break}if(P=G.sibling,P!==null){P.return=G.return,G=P;break}G=G.return}P=G}Yi(f,d,T.children,S),d=d.child}return d;case 9:return T=d.type,E=d.pendingProps.children,vu(d,S),T=ts(T),E=E(T),d.flags|=1,Yi(f,d,E,S),d.child;case 14:return E=d.type,T=Ls(E,d.pendingProps),T=Ls(E.type,T),yC(f,d,E,T,S);case 15:return _C(f,d,d.type,d.pendingProps,S);case 17:return E=d.type,T=d.pendingProps,T=d.elementType===E?T:Ls(E,T),f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),d.tag=1,ci(E)?(f=!0,ui(d)):f=!1,vu(d,S),Fb(d,E,T),lx(d,E,T,S),bx(null,d,E,!0,f,S);case 19:return RC(f,d,S);case 22:return xC(f,d,S)}throw Error(o(156,d.tag))};function ZC(f,d){return q_(f,d)}function TH(f,d,S,E){this.tag=f,this.key=S,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=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function as(f,d,S,E){return new TH(f,d,S,E)}function Kx(f){return f=f.prototype,!(!f||!f.isReactComponent)}function bH(f){if(typeof f=="function")return Kx(f)?1:0;if(f!=null){if(f=f.$$typeof,f===y)return 11;if(f===x)return 14}return 2}function Fa(f,d){var S=f.alternate;return S===null?(S=as(f.tag,d,f.key,f.mode),S.elementType=f.elementType,S.type=f.type,S.stateNode=f.stateNode,S.alternate=f,f.alternate=S):(S.pendingProps=d,S.type=f.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=f.flags&14680064,S.childLanes=f.childLanes,S.lanes=f.lanes,S.child=f.child,S.memoizedProps=f.memoizedProps,S.memoizedState=f.memoizedState,S.updateQueue=f.updateQueue,d=f.dependencies,S.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},S.sibling=f.sibling,S.index=f.index,S.ref=f.ref,S}function Ig(f,d,S,E,T,P){var G=2;if(E=f,typeof f=="function")Kx(f)&&(G=1);else if(typeof f=="string")G=5;else e:switch(f){case u:return Zl(S.children,T,P,d);case h:G=8,T|=8;break;case p:return f=as(12,S,d,T|2),f.elementType=p,f.lanes=P,f;case _:return f=as(13,S,d,T),f.elementType=_,f.lanes=P,f;case g:return f=as(19,S,d,T),f.elementType=g,f.lanes=P,f;case M:return Bg(S,T,P,d);default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case m:G=10;break e;case v:G=9;break e;case y:G=11;break e;case x:G=14;break e;case A:G=16,E=null;break e}throw Error(o(130,f==null?f:typeof f,""))}return d=as(G,S,d,T),d.elementType=f,d.type=E,d.lanes=P,d}function Zl(f,d,S,E){return f=as(7,f,E,d),f.lanes=S,f}function Bg(f,d,S,E){return f=as(22,f,E,d),f.elementType=M,f.lanes=S,f.stateNode={},f}function Yx(f,d,S){return f=as(6,f,null,d),f.lanes=S,f}function Qx(f,d,S){return d=as(4,f.children!==null?f.children:[],f.key,d),d.lanes=S,d.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},d}function CH(f,d,S,E,T){this.tag=d,this.containerInfo=f,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Qe,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Y_(0),this.expirationTimes=Y_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Y_(0),this.identifierPrefix=E,this.onRecoverableError=T,ye&&(this.mutableSourceEagerHydrationData=null)}function eR(f,d,S,E,T,P,G,ee,ue){return f=new CH(f,d,S,ee,ue),d===1?(d=1,P===!0&&(d|=8)):d=0,P=as(3,null,null,d),f.current=P,P.stateNode=f,P.memoizedState={element:E,isDehydrated:S,cache:null,transitions:null},ox(P),f}function tR(f){if(!f)return Zr;f=f._reactInternals;e:{if(C(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(ci(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(o(171))}if(f.tag===1){var S=f.type;if(ci(S))return pu(f,S,d)}return d}function nR(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=H(d),f===null?null:f.stateNode}function iR(f,d){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var S=f.retryLane;f.retryLane=S!==0&&S=Te&&P>=xt&&T<=Xe&&G<=rt){f.splice(d,1);break}else if(E!==Te||S.width!==ue.width||rtG){if(!(P!==xt||S.height!==ue.height||XeT)){Te>E&&(ue.width+=Te-E,ue.x=E),XeP&&(ue.height+=xt-P,ue.y=P),rtS&&(S=G)),G ")+` 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 q(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:RH,findFiberByHostInstance:f.findFiberByHostInstance||PH,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{Wm=d.inject(f),oo=d}catch{}f=!!d.checkDCE}}return f},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(f,d,S,E){if(!qe)throw Error(o(363));f=Ux(f,d);var T=pe(f,S,E).disconnect;return{disconnect:function(){T()}}},t.registerMutableSourceForHydration=function(f,d){var S=d._getVersion;S=S(d._source),f.mutableSourceEagerHydrationData==null?f.mutableSourceEagerHydrationData=[d,S]:f.mutableSourceEagerHydrationData.push(d,S)},t.runWithPriority=function(f,d){var S=Vt;try{return Vt=f,d()}finally{Vt=S}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(f,d,S,E){var T=d.current,P=Qi(),G=La(T);return S=tR(S),d.context===null?d.context=S:d.pendingContext=S,d=No(P,G),d.payload={element:f},E=E===void 0?null:E,E!==null&&(d.callback=E),Ia(T,d),f=os(T,G,P),f!==null&&Km(f,T,G),G},t};UF.exports=z7;var H7=UF.exports;const G7=md(H7),V7=n=>typeof n=="object"&&typeof n.then=="function",bc=[];function HF(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=bc.indexOf(r);s!==-1&&bc.splice(s,1)},promise:(V7(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(bc.push(r),!t)throw r.promise}const W7=(n,e,t)=>GF(n,e,!1,t),$7=(n,e,t)=>void GF(n,e,!0,t),X7=n=>{if(n===void 0||n.length===0)bc.splice(0,bc.length);else{const e=bc.find(t=>HF(n,t.keys,t.equal));e&&e.remove()}},yT={},_T=n=>void Object.assign(yT,n);function j7(n,e){function t(u,{args:h=[],attach:p,...m},v){let y=`${u[0].toUpperCase()}${u.slice(1)}`,_;if(u==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;_=nf(g,{type:u,root:v,attach:p,primitive:!0})}else{const g=yT[y];if(!g)throw new Error(`R3F: ${y} 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!");_=nf(new g(...h),{type:u,root:v,attach:p,memoizedProps:{args:h}})}return _.__r3f.attach===void 0&&(_ instanceof Et?_.__r3f.attach="geometry":_ instanceof zn&&(_.__r3f.attach="material")),y!=="inject"&&lS(_,m),_}function i(u,h){let p=!1;if(h){var m,v;(m=h.__r3f)!=null&&m.attach?aS(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),p=!0),p||(v=u.__r3f)==null||v.objects.push(h),h.__r3f||nf(h,{}),h.__r3f.parent=u,CE(h),rf(h)}}function r(u,h,p){let m=!1;if(h){var v,y;if((v=h.__r3f)!=null&&v.attach)aS(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"});const _=u.children.filter(x=>x!==h),g=_.indexOf(p);u.children=[..._.slice(0,g),h,..._.slice(g)],m=!0}m||(y=u.__r3f)==null||y.objects.push(h),h.__r3f||nf(h,{}),h.__r3f.parent=u,CE(h),rf(h)}}function s(u,h,p=!1){u&&[...u].forEach(m=>o(h,m,p))}function o(u,h,p){if(h){var m,v,y;if(h.__r3f&&(h.__r3f.parent=null),(m=u.__r3f)!=null&&m.objects&&(u.__r3f.objects=u.__r3f.objects.filter(M=>M!==h)),(v=h.__r3f)!=null&&v.attach)$P(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var _;u.remove(h),(_=h.__r3f)!=null&&_.root&&nX(Av(h),h)}const x=(y=h.__r3f)==null?void 0:y.primitive,A=!x&&(p===void 0?h.dispose!==null:p);if(!x){var g;s((g=h.__r3f)==null?void 0:g.objects,h,A),s(h.children,h,A)}if(delete h.__r3f,A&&h.dispose&&h.type!=="Scene"){const M=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?TE.unstable_scheduleCallback(TE.unstable_IdlePriority,M):M()}rf(u)}}function a(u,h,p,m){var v;const y=(v=u.__r3f)==null?void 0:v.parent;if(!y)return;const _=t(h,p,u.__r3f.root);if(u.children){for(const g of u.children)g.__r3f&&i(_,g);u.children=u.children.filter(g=>!g.__r3f)}u.__r3f.objects.forEach(g=>i(_,g)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(y,u),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),i(y,_),_.raycast&&_.__r3f.eventCount&&Av(_).getState().internal.interaction.push(_),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=_,g.ref&&(typeof g.ref=="function"?g.ref(_):g.ref.current=_))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:G7({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,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,i(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&&r(m,h,p)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,p,m){var v;if(((v=u==null?void 0:u.__r3f)!=null?v:{}).primitive&&m.object&&m.object!==u)return[!0];{const{args:_=[],children:g,...x}=m,{args:A=[],children:M,...w}=p;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((R,D)=>R!==A[D]))return[!0];const b=KF(u,x,w,!0);return b.changes.length?[!1,b]:null}},commitUpdate(u,[h,p],m,v,y,_){h?a(u,m,y,_):lS(u,p)},commitMount(u,h,p,m){var v;const y=(v=u.__r3f)!=null?v:{};u.raycast&&y.handlers&&y.eventCount&&Av(u).getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>nf(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:p,parent:m}=(h=u.__r3f)!=null?h:{};p&&m&&$P(m,u,p),u.isObject3D&&(u.visible=!1),rf(u)},unhideInstance(u,h){var p;const{attach:m,parent:v}=(p=u.__r3f)!=null?p:{};m&&v&&aS(v,u,m),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),rf(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Sf.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&hn.fun(performance.now)?performance.now:hn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:hn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:hn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:lS}}var HP,GP;const oS=n=>"colorSpace"in n||"outputColorSpace"in n,VF=()=>{var n;return(n=yT.ColorManagement)!=null?n:null},WF=n=>n&&n.isOrthographicCamera,J7=n=>n&&n.hasOwnProperty("current"),Em=typeof window<"u"&&((HP=window.document)!=null&&HP.createElement||((GP=window.navigator)==null?void 0:GP.product)==="ReactNative")?B.useLayoutEffect:B.useEffect;function $F(n){const e=B.useRef(n);return Em(()=>void(e.current=n),[n]),e}function K7({set:n}){return Em(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class XF extends B.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}XF.getDerivedStateFromError=()=>({error:!0});const jF="__default",VP=new Map,Y7=n=>n&&!!n.memoized&&!!n.changes;function JF(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 _h=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()};function Av(n){let e=n.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const hn={obj:n=>n===Object(n)&&!hn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(hn.str(n)||hn.num(n))return n===e;const s=hn.obj(n);if(s&&i==="reference")return n===e;const o=hn.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(a in r?e:n)if(!hn.equ(n[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:n)if(n[a]!==e[a])return!1;if(hn.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 Q7(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 q7(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function nf(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function bE(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const WP=/-\d+$/;function aS(n,e,t){if(hn.str(t)){if(WP.test(t)){const s=t.replace(WP,""),{target:o,key:a}=bE(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=bE(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function $P(n,e,t){var i,r;if(hn.str(t)){const{target:s,key:o}=bE(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function KF(n,{children:e,key:t,ref:i,...r},{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(r),m=[];if(c){const y=Object.keys(l);for(let _=0;_{var g;if((g=n.__r3f)!=null&&g.primitive&&y==="object"||hn.equ(_,l[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return m.push([y,_,!0,[]]);let x=[];y.includes("-")&&(x=y.split("-")),m.push([y,_,!1,x]);for(const A in r){const M=r[A];A.startsWith(`${y}-`)&&m.push([A,M,!1,A.split("-")])}});const v={...r};return h.memoizedProps&&h.memoizedProps.args&&(v.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(v.attach=h.memoizedProps.attach),{memoized:v,changes:m}}const Z7=typeof process<"u"&&!1;function lS(n,e){var t,i,r;const s=(t=n.__r3f)!=null?t:{},o=s.root,a=(i=o==null||o.getState==null?void 0:o.getState())!=null?i:{},{memoized:l,changes:c}=Y7(e)?e:KF(n,e),u=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let p=0;pA[M],n),!(x&&x.set))){const[A,...M]=_.reverse();g=M.reverse().reduce((w,b)=>w[b],n),m=A}if(v===jF+"remove")if(g.constructor){let A=VP.get(g.constructor);A||(A=new g.constructor,VP.set(g.constructor,A)),v=A[m]}else v=0;if(y)v?s.handlers[m]=v:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(x&&x.set&&(x.copy||x instanceof Dc)){if(Array.isArray(v))x.fromArray?x.fromArray(v):x.set(...v);else if(x.copy&&v&&v.constructor&&(Z7?x.constructor.name===v.constructor.name:x.constructor===v.constructor))x.copy(v);else if(v!==void 0){const A=x instanceof Ie;!A&&x.setScalar?x.setScalar(v):x instanceof Dc&&v instanceof Dc?x.mask=v.mask:x.set(v),!VF()&&!a.linear&&A&&x.convertSRGBToLinear()}}else if(g[m]=v,g[m]instanceof cn&&g[m].format===Ti&&g[m].type===si){const A=g[m];oS(A)&&oS(a.gl)?A.colorSpace=a.gl.outputColorSpace:A.encoding=a.gl.outputEncoding}rf(n)}if(s.parent&&n.raycast&&u!==s.eventCount){const p=Av(n).getState().internal,m=p.interaction.indexOf(n);m>-1&&p.interaction.splice(m,1),s.eventCount&&p.interaction.push(n)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(r=n.__r3f)!=null&&r.parent&&CE(n),n}function rf(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function CE(n){n.onUpdate==null||n.onUpdate(n)}function eX(n,e){n.manual||(WF(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 z0(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function tX(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Sf.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Sf.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Sf.ContinuousEventPriority;default:return Sf.DefaultEventPriority}}function YF(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function nX(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{YF(t.capturedMap,e,i,r)})}function iX(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 i(l,c){const u=n.getState(),h=new Set,p=[],m=c?c(u.internal.interaction):u.internal.interaction;for(let g=0;g{const A=_h(g.object),M=_h(x.object);return!A||!M?g.distance-x.distance:M.events.priority-A.events.priority||g.distance-x.distance}).filter(g=>{const x=z0(g);return h.has(x)?!1:(h.add(x),!0)});u.events.filter&&(y=u.events.filter(y,u));for(const g of y){let x=g.object;for(;x;){var _;(_=x.__r3f)!=null&&_.eventCount&&p.push({...g,eventObject:x}),x=x.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let g of u.internal.capturedMap.get(l.pointerId).values())h.has(z0(g.intersection))||p.push(g.intersection);return p}function r(l,c,u,h){const p=n.getState();if(l.length){const m={stopped:!1};for(const v of l){const y=_h(v.object)||p,{raycaster:_,pointer:g,camera:x,internal:A}=y,M=new U(g.x,g.y,0).unproject(x),w=I=>{var O,H;return(O=(H=A.capturedMap.get(I))==null?void 0:H.has(v.eventObject))!=null?O:!1},b=I=>{const O={intersection:v,target:c.target};A.capturedMap.has(I)?A.capturedMap.get(I).set(v.eventObject,O):A.capturedMap.set(I,new Map([[v.eventObject,O]])),c.target.setPointerCapture(I)},R=I=>{const O=A.capturedMap.get(I);O&&YF(A.capturedMap,v.eventObject,O,I)};let D={};for(let I in c){let O=c[I];typeof O!="function"&&(D[I]=O)}let C={...v,...D,pointer:g,intersections:l,stopped:m.stopped,delta:u,unprojectedPoint:M,ray:_.ray,camera:x,stopPropagation(){const I="pointerId"in c&&A.capturedMap.get(c.pointerId);if((!I||I.has(v.eventObject))&&(C.stopped=m.stopped=!0,A.hovered.size&&Array.from(A.hovered.values()).find(O=>O.eventObject===v.eventObject))){const O=l.slice(0,l.indexOf(v));s([...O,v])}},target:{hasPointerCapture:w,setPointerCapture:b,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:b,releasePointerCapture:R},nativeEvent:c};if(h(C),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(z0(u)),p!=null&&p.eventCount){const v={...u,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}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",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=i(u,m?t:void 0),g=v?e(u):0;l==="onPointerDown"&&(p.initialClick=[u.offsetX,u.offsetY],p.initialHits=_.map(A=>A.eventObject)),v&&!_.length&&g<=2&&(o(u,p.interaction),h&&h(u)),m&&s(_);function x(A){const M=A.eventObject,w=M.__r3f,b=w==null?void 0:w.handlers;if(w!=null&&w.eventCount)if(m){if(b.onPointerOver||b.onPointerEnter||b.onPointerOut||b.onPointerLeave){const R=z0(A),D=p.hovered.get(R);D?D.stopped&&A.stopPropagation():(p.hovered.set(R,A),b.onPointerOver==null||b.onPointerOver(A),b.onPointerEnter==null||b.onPointerEnter(A))}b.onPointerMove==null||b.onPointerMove(A)}else{const R=b[l];R?(!v||p.initialHits.includes(M))&&(o(u,p.interaction.filter(D=>!p.initialHits.includes(D))),R(A)):v&&p.initialHits.includes(M)&&o(u,p.interaction.filter(D=>!p.initialHits.includes(D)))}}r(_,u,g,x)}}return{handlePointer:a}}const QF=n=>!!(n!=null&&n.render),qF=B.createContext(null),rX=(n,e)=>{const t=vT((a,l)=>{const c=new U,u=new U,h=new U;function p(g=l().camera,x=u,A=l().size){const{width:M,height:w,top:b,left:R}=A,D=M/w;x instanceof U?h.copy(x):h.set(...x);const C=g.getWorldPosition(c).distanceTo(h);if(WF(g))return{width:M/g.zoom,height:w/g.zoom,top:b,left:R,factor:1,distance:C,aspect:D};{const I=g.fov*Math.PI/180,O=2*Math.tan(I/2)*C,H=O*(M/w);return{width:H,height:O,top:b,left:R,factor:M/H,distance:C,aspect:D}}}let m;const v=g=>a(x=>({performance:{...x.performance,current:g}})),y=new ce;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>n(l(),g),advance:(g,x)=>e(g,x,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new pT,pointer:y,mouse:y,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&v(g.performance.min),m=setTimeout(()=>v(l().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:g=>a(x=>({...x,events:{...x.events,...g}})),setSize:(g,x,A,M,w)=>{const b=l().camera,R={width:g,height:x,top:M||0,left:w||0,updateStyle:A};a(D=>({size:R,viewport:{...D.viewport,...p(b,u,R)}}))},setDpr:g=>a(x=>{const A=JF(g);return{viewport:{...x.viewport,dpr:A,initialDpr:x.viewport.initialDpr||A}}}),setFrameloop:(g="always")=>{const x=l().clock;x.stop(),x.elapsedTime=0,g!=="never"&&(x.start(),x.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:B.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,x,A)=>{const M=l().internal;return M.priority=M.priority+(x>0?1:0),M.subscribers.push({ref:g,priority:x,store:A}),M.subscribers=M.subscribers.sort((w,b)=>w.priority-b.priority),()=>{const w=l().internal;w!=null&&w.subscribers&&(w.priority=w.priority-(x>0?1:0),w.subscribers=w.subscribers.filter(b=>b.ref!==g))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:u,set:h}=t.getState();if(l.width!==r.width||l.height!==r.height||c.dpr!==s){var p;r=l,s=c.dpr,eX(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};function sX(n,e){const t={callback:n};return e.add(t),()=>void e.delete(t)}let H0,ZF=new Set,oX=new Set,aX=new Set;const lX=n=>sX(n,ZF);function cS(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function xh(n,e){switch(n){case"before":return cS(ZF,e);case"after":return cS(oX,e);case"tail":return cS(aX,e)}}let uS,fS;function dS(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),uS=e.internal.subscribers,H0=0;H00)&&!((c=r.gl.xr)!=null&&c.isPresenting)&&(t+=dS(l,r))}if(xh("after",l),t===0)return xh("tail",l),e=!1,cancelAnimationFrame(i)}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&&xh("before",l),u)dS(l,u,h);else for(const p of n.values())dS(l,p.store.getState());c&&xh("after",l)}return{loop:s,invalidate:o,advance:a}}function eN(){const n=B.useContext(qF);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function la(n=t=>t,e){return eN()(n,e)}function Mm(n,e=0){const t=eN(),i=t.getState().internal.subscribe,r=$F(n);return Em(()=>i(r,e,t),[e,i,t]),null}const XP=new WeakMap;function tN(n,e){return function(t,...i){let r=XP.get(t);return r||(r=new t,XP.set(t,r)),n&&n(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,l=>{l.scene&&Object.assign(l,Q7(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l==null?void 0:l.message}`)))))).finally(()=>r.dispose==null?void 0:r.dispose())}}function wm(n,e,t,i){const r=Array.isArray(e)?e:[e],s=W7(tN(t,i),[n,...r],{equal:hn.equ});return Array.isArray(e)?s:s[0]}wm.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return $7(tN(t),[n,...i])};wm.clear=function(n,e){const t=Array.isArray(e)?e:[e];return X7([n,...t])};const id=new Map,{invalidate:jP,advance:JP}=cX(id),{reconciler:sy,applyProps:gc}=j7(id,tX),Ku={objects:"shallow",strict:!1},uX=(n,e)=>{const t=typeof n=="function"?n(e):n;return QF(t)?t:new Xw({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function fX(n,e){const t=typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:s,left:o,updateStyle:a=t}=e;return{width:i,height:r,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:i,height:r,top:s,left:o}=n.parentElement.getBoundingClientRect();return{width:i,height:r,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function dX(n){const e=id.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||rX(jP,JP),o=t||sy.createContainer(s,Sf.ConcurrentRoot,null,!1,null,"",r,null);e||id.set(n,{fiber:o,store:s});let a,l=!1,c;return{configure(u={}){let{gl:h,size:p,scene:m,events:v,onCreated:y,shadows:_=!1,linear:g=!1,flat:x=!1,legacy:A=!1,orthographic:M=!1,frameloop:w="always",dpr:b=[1,2],performance:R,raycaster:D,camera:C,onPointerMissed:I}=u,O=s.getState(),H=O.gl;O.gl||O.set({gl:H=uX(h,n)});let J=O.raycaster;J||O.set({raycaster:J=new LF});const{params:k,...W}=D||{};if(hn.equ(W,J,Ku)||gc(J,{...W}),hn.equ(k,J.params,Ku)||gc(J,{params:{...J.params,...k}}),!O.camera||O.camera===c&&!hn.equ(c,C,Ku)){c=C;const Y=C instanceof Sd,de=Y?C:M?new Hl(0,0,0,0,.1,1e3):new Un(75,0,.1,1e3);Y||(de.position.z=5,C&&gc(de,C),!O.camera&&!(C!=null&&C.rotation)&&de.lookAt(0,0,0)),O.set({camera:de}),J.camera=de}if(!O.scene){let Y;m instanceof qf?Y=m:(Y=new qf,m&&gc(Y,m)),O.set({scene:nf(Y)})}if(!O.xr){var q;const Y=(ve,Ce)=>{const Ue=s.getState();Ue.frameloop!=="never"&&JP(ve,!0,Ue,Ce)},de=()=>{const ve=s.getState();ve.gl.xr.enabled=ve.gl.xr.isPresenting,ve.gl.xr.setAnimationLoop(ve.gl.xr.isPresenting?Y:null),ve.gl.xr.isPresenting||jP(ve)},ge={connect(){const ve=s.getState().gl;ve.xr.addEventListener("sessionstart",de),ve.xr.addEventListener("sessionend",de)},disconnect(){const ve=s.getState().gl;ve.xr.removeEventListener("sessionstart",de),ve.xr.removeEventListener("sessionend",de)}};typeof((q=H.xr)==null?void 0:q.addEventListener)=="function"&&ge.connect(),O.set({xr:ge})}if(H.shadowMap){const Y=H.shadowMap.enabled,de=H.shadowMap.type;if(H.shadowMap.enabled=!!_,hn.boo(_))H.shadowMap.type=Yh;else if(hn.str(_)){var Q;const ge={basic:UO,percentage:qy,soft:Yh,variance:Hs};H.shadowMap.type=(Q=ge[_])!=null?Q:Yh}else hn.obj(_)&&Object.assign(H.shadowMap,_);(Y!==H.shadowMap.enabled||de!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const z=VF();z&&("enabled"in z?z.enabled=!A:"legacyMode"in z&&(z.legacyMode=A)),gc(H,{outputEncoding:g?3e3:3001,toneMapping:x?Ms:ww}),O.legacy!==A&&O.set(()=>({legacy:A})),O.linear!==g&&O.set(()=>({linear:g})),O.flat!==x&&O.set(()=>({flat:x})),h&&!hn.fun(h)&&!QF(h)&&!hn.equ(h,H,Ku)&&gc(H,h),v&&!O.events.handlers&&O.set({events:v(s)});const V=fX(n,p);return hn.equ(V,O.size,Ku)||O.setSize(V.width,V.height,V.updateStyle,V.top,V.left),b&&O.viewport.dpr!==JF(b)&&O.setDpr(b),O.frameloop!==w&&O.setFrameloop(w),O.onPointerMissed||O.set({onPointerMissed:I}),R&&!hn.equ(R,O.performance,Ku)&&O.set(Y=>({performance:{...Y.performance,...R}})),a=y,l=!0,this},render(u){return l||this.configure(),sy.updateContainer(B.createElement(hX,{store:s,children:u,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){nN(n)}}}function hX({store:n,children:e,onCreated:t,rootElement:i}){return Em(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),B.createElement(qF.Provider,{value:n},e)}function nN(n,e){const t=id.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),sy.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),q7(r),id.delete(n),e&&e(n)}catch{}},500)})}}sy.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:B.version});function gn(){return gn=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?i=setTimeout(l,e-u):(i=null,t||(a=n.apply(s,r),s=r=null))}var c=function(){s=this,r=arguments,o=Date.now();var u=t&&!i;return i||(i=setTimeout(l,e)),u&&(a=n.apply(s,r),s=r=null),a};return c.clear=function(){i&&(clearTimeout(i),i=null)},c.flush=function(){i&&(a=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},c}RE.debounce=RE;var pX=RE;const KP=md(pX);function mX(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:r}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,a]=B.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=B.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=B.useRef(!1);B.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[p,m,v]=B.useMemo(()=>{const x=()=>{if(!l.current.element)return;const{left:A,top:M,width:w,height:b,bottom:R,right:D,x:C,y:I}=l.current.element.getBoundingClientRect(),O={left:A,top:M,width:w,height:b,bottom:R,right:D,x:C,y:I};l.current.element instanceof HTMLElement&&r&&(O.height=l.current.element.offsetHeight,O.width=l.current.element.offsetWidth),Object.freeze(O),h.current&&!_X(l.current.lastBounds,O)&&a(l.current.lastBounds=O)};return[x,u?KP(x,u):x,c?KP(x,c):x]},[a,r,c,u]);function y(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(x=>x.removeEventListener("scroll",v,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function _(){l.current.element&&(l.current.resizeObserver=new s(v),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(x=>x.addEventListener("scroll",v,{capture:!0,passive:!0})))}const g=x=>{!x||x===l.current.element||(y(),l.current.element=x,l.current.scrollContainers=iN(x),_())};return vX(v,!!t),gX(m),B.useEffect(()=>{y(),_()},[t,v,m]),B.useEffect(()=>y,[]),[g,o,p]}function gX(n){B.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function vX(n,e){B.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function iN(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...iN(n.parentElement)]}const yX=["x","y","top","bottom","left","right","width","height"],_X=(n,e)=>yX.every(t=>n[t]===e[t]);var xX=Object.defineProperty,SX=Object.defineProperties,AX=Object.getOwnPropertyDescriptors,YP=Object.getOwnPropertySymbols,EX=Object.prototype.hasOwnProperty,MX=Object.prototype.propertyIsEnumerable,QP=(n,e,t)=>e in n?xX(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qP=(n,e)=>{for(var t in e||(e={}))EX.call(e,t)&&QP(n,t,e[t]);if(YP)for(var t of YP(e))MX.call(e,t)&&QP(n,t,e[t]);return n},wX=(n,e)=>SX(n,AX(e));function rN(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const r=rN(i,e,t);if(r)return r;i=e?null:i.sibling}}function sN(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const xT=sN(B.createContext(null));class oN extends B.Component{render(){return B.createElement(xT.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:ZP,ReactCurrentDispatcher:eI}=B.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function TX(){const n=B.useContext(xT);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=B.useId();return B.useMemo(()=>{for(const i of[ZP==null?void 0:ZP.current,n,n==null?void 0:n.alternate]){if(!i)continue;const r=rN(i,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(r)return r}},[n,e])}function bX(){var n,e;const t=TX(),[i]=B.useState(()=>new Map);i.clear();let r=t;for(;r;){const s=(n=r.type)==null?void 0:n._context;s&&s!==xT&&!i.has(s)&&i.set(s,(e=eI==null?void 0:eI.current)==null?void 0:e.readContext(sN(s))),r=r.return}return i}function CX(){const n=bX();return B.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>B.createElement(e,null,B.createElement(t.Provider,wX(qP({},i),{value:n.get(t)}))),e=>B.createElement(oN,qP({},e))),[n])}const hS={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 RX(n){const{handlePointer:e}=iX(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(hS).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,c]=hS[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=hS[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const PX=B.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=RX,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:p,orthographic:m,frameloop:v,dpr:y,performance:_,raycaster:g,camera:x,scene:A,onPointerMissed:M,onCreated:w,...b},R){B.useMemo(()=>_T(FF),[]);const D=CX(),[C,I]=mX({scroll:!0,debounce:{scroll:50,resize:0},...i}),O=B.useRef(null),H=B.useRef(null);B.useImperativeHandle(R,()=>O.current);const J=$F(M),[k,W]=B.useState(!1),[q,Q]=B.useState(!1);if(k)throw k;if(q)throw q;const z=B.useRef(null);Em(()=>{const K=O.current;I.width>0&&I.height>0&&K&&(z.current||(z.current=dX(K)),z.current.configure({gl:s,events:o,shadows:c,linear:u,flat:h,legacy:p,orthographic:m,frameloop:v,dpr:y,performance:_,raycaster:g,camera:x,scene:A,size:I,onPointerMissed:(...V)=>J.current==null?void 0:J.current(...V),onCreated:V=>{V.events.connect==null||V.events.connect(a?J7(a)?a.current:a:H.current),l&&V.setEvents({compute:(Y,de)=>{const ge=Y[l+"X"],ve=Y[l+"Y"];de.pointer.set(ge/de.size.width*2-1,-(ve/de.size.height)*2+1),de.raycaster.setFromCamera(de.pointer,de.camera)}}),w==null||w(V)}}),z.current.render(B.createElement(D,null,B.createElement(XF,{set:Q},B.createElement(B.Suspense,{fallback:B.createElement(K7,{set:W})},e)))))}),B.useEffect(()=>{const K=O.current;if(K)return()=>nN(K)},[]);const j=a?"none":"auto";return B.createElement("div",gn({ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...r}},b),B.createElement("div",{ref:C,style:{width:"100%",height:"100%"}},B.createElement("canvas",{ref:O,style:{display:"block"}},t)))}),aN=B.forwardRef(function(e,t){return B.createElement(oN,null,B.createElement(PX,gn({},e,{ref:t})))}),Tm=new U,ST=new U,IX=new U;function BX(n,e,t){const i=Tm.setFromMatrixPosition(n.matrixWorld);i.project(e);const r=t.width/2,s=t.height/2;return[i.x*r+r,-(i.y*s)+s]}function DX(n,e){const t=Tm.setFromMatrixPosition(n.matrixWorld),i=ST.setFromMatrixPosition(e.matrixWorld),r=t.sub(i),s=e.getWorldDirection(IX);return r.angleTo(s)>Math.PI/2}function LX(n,e,t,i){const r=Tm.setFromMatrixPosition(n.matrixWorld),s=r.clone();s.project(e),t.setFromCamera(s,e);const o=t.intersectObjects(i,!0);if(o.length){const a=o[0].distance;return r.distanceTo(t.ray.origin)Math.abs(n)<1e-10?0:n;function lN(n,e,t=""){let i="matrix3d(";for(let r=0;r!==16;r++)i+=PE(e[r]*n.elements[r])+(r!==15?",":")");return t+i}const NX=(n=>e=>lN(e,n))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),UX=(n=>(e,t)=>lN(e,n(t),"translate(-50%,-50%)"))(n=>[1/n,1/n,1/n,1,-1/n,-1/n,-1/n,-1,1/n,1/n,1/n,1,1,1,1,1]);function kX(n){return n&&typeof n=="object"&&"current"in n}const zX=B.forwardRef(({children:n,eps:e=.001,style:t,className:i,prepend:r,center:s,fullscreen:o,portal:a,distanceFactor:l,sprite:c=!1,transform:u=!1,occlude:h,onOcclude:p,castShadow:m,receiveShadow:v,material:y,geometry:_,zIndexRange:g=[16777271,0],calculatePosition:x=BX,as:A="div",wrapperClass:M,pointerEvents:w="auto",...b},R)=>{const{gl:D,camera:C,scene:I,size:O,raycaster:H,events:J,viewport:k}=la(),[W]=B.useState(()=>document.createElement(A)),q=B.useRef(),Q=B.useRef(null),z=B.useRef(0),j=B.useRef([0,0]),K=B.useRef(null),V=B.useRef(null),Y=(a==null?void 0:a.current)||J.connected||D.domElement.parentNode,de=B.useRef(null),ge=B.useRef(!1),ve=B.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&kX(h[0]),[h]);B.useLayoutEffect(()=>{const tt=D.domElement;h&&h==="blending"?(tt.style.zIndex=`${Math.floor(g[0]/2)}`,tt.style.position="absolute",tt.style.pointerEvents="none"):(tt.style.zIndex=null,tt.style.position=null,tt.style.pointerEvents=null)},[h]),B.useLayoutEffect(()=>{if(Q.current){const tt=q.current=OO(W);if(I.updateMatrixWorld(),u)W.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const Ee=x(Q.current,C,O);W.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${Ee[0]}px,${Ee[1]}px,0);transform-origin:0 0;`}return Y&&(r?Y.prepend(W):Y.appendChild(W)),()=>{Y&&Y.removeChild(W),tt.unmount()}}},[Y,u]),B.useLayoutEffect(()=>{M&&(W.className=M)},[M]);const Ce=B.useMemo(()=>u?{position:"absolute",top:0,left:0,width:O.width,height:O.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-O.height/2,left:-O.width/2,width:O.width,height:O.height},...t},[t,s,o,O,u]),Ue=B.useMemo(()=>({position:"absolute",pointerEvents:w}),[w]);B.useLayoutEffect(()=>{if(ge.current=!1,u){var tt;(tt=q.current)==null||tt.render(B.createElement("div",{ref:K,style:Ce},B.createElement("div",{ref:V,style:Ue},B.createElement("div",{ref:R,className:i,style:t,children:n}))))}else{var Ee;(Ee=q.current)==null||Ee.render(B.createElement("div",{ref:R,style:Ce,className:i,children:n}))}});const Ve=B.useRef(!0);Mm(tt=>{if(Q.current){C.updateMatrixWorld(),Q.current.updateWorldMatrix(!0,!1);const Ee=u?j.current:x(Q.current,C,O);if(u||Math.abs(z.current-C.zoom)>e||Math.abs(j.current[0]-Ee[0])>e||Math.abs(j.current[1]-Ee[1])>e){const $=DX(Q.current,C);let ye=!1;ve&&(Array.isArray(h)?ye=h.map(He=>He.current):h!=="blending"&&(ye=[I]));const fe=Ve.current;if(ye){const He=LX(Q.current,C,H,ye);Ve.current=He&&!$}else Ve.current=!$;fe!==Ve.current&&(p?p(!Ve.current):W.style.display=Ve.current?"block":"none");const _e=Math.floor(g[0]/2),me=h?ve?[g[0],_e]:[_e-1,0]:g;if(W.style.zIndex=`${FX(Q.current,C,me)}`,u){const[He,De]=[O.width/2,O.height/2],ke=C.projectionMatrix.elements[5]*De,{isOrthographicCamera:qe,top:ft,left:Zt,bottom:F,right:L}=C,ne=NX(C.matrixWorldInverse),xe=qe?`scale(${ke})translate(${PE(-(L+Zt)/2)}px,${PE((ft+F)/2)}px)`:`translateZ(${ke}px)`;let pe=Q.current.matrixWorld;c&&(pe=C.matrixWorldInverse.clone().transpose().copyPosition(pe).scale(Q.current.scale),pe.elements[3]=pe.elements[7]=pe.elements[11]=0,pe.elements[15]=1),W.style.width=O.width+"px",W.style.height=O.height+"px",W.style.perspective=qe?"":`${ke}px`,K.current&&V.current&&(K.current.style.transform=`${xe}${ne}translate(${He}px,${De}px)`,V.current.style.transform=UX(pe,1/((l||10)/400)))}else{const He=l===void 0?1:OX(Q.current,C)*l;W.style.transform=`translate3d(${Ee[0]}px,${Ee[1]}px,0) scale(${He})`}j.current=Ee,z.current=C.zoom}}if(!ve&&de.current&&!ge.current)if(u){if(K.current){const Ee=K.current.children[0];if(Ee!=null&&Ee.clientWidth&&Ee!=null&&Ee.clientHeight){const{isOrthographicCamera:$}=C;if($||_)b.scale&&(Array.isArray(b.scale)?b.scale instanceof U?de.current.scale.copy(b.scale.clone().divideScalar(1)):de.current.scale.set(1/b.scale[0],1/b.scale[1],1/b.scale[2]):de.current.scale.setScalar(1/b.scale));else{const ye=(l||10)/400,fe=Ee.clientWidth*ye,_e=Ee.clientHeight*ye;de.current.scale.set(fe,_e,1)}ge.current=!0}}}else{const Ee=W.children[0];if(Ee!=null&&Ee.clientWidth&&Ee!=null&&Ee.clientHeight){const $=1/k.factor,ye=Ee.clientWidth*$,fe=Ee.clientHeight*$;de.current.scale.set(ye,fe,1),ge.current=!0}de.current.lookAt(tt.camera.position)}});const Qe=B.useMemo(()=>({vertexShader:u?void 0:` /* This shader is from the THREE's SpriteMaterial. We need to turn the backing plane into a Sprite (make it always face the camera) if "transfrom" is false. */ #include void main() { vec2 center = vec2(0., 1.); float rotation = 0.0; // This is somewhat arbitrary, but it seems to work well // Need to figure out how to derive this dynamically if it even matters float size = 0.03; 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 ) ); bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; 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; } `,fragmentShader:` void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); } `}),[u]);return B.createElement("group",gn({},b,{ref:Q}),h&&!ve&&B.createElement("mesh",{castShadow:m,receiveShadow:v,ref:de},_||B.createElement("planeGeometry",null),y||B.createElement("shaderMaterial",{side:ki,vertexShader:Qe.vertexShader,fragmentShader:Qe.fragmentShader})))});let Sh=0;const HX=vT(n=>(xf.onStart=(e,t,i)=>{n({active:!0,item:e,loaded:t,total:i,progress:(t-Sh)/(i-Sh)*100})},xf.onLoad=()=>{n({active:!1})},xf.onError=e=>n(t=>({errors:[...t.errors,e]})),xf.onProgress=(e,t,i)=>{t===i&&(Sh=i),n({active:!0,item:e,loaded:t,total:i,progress:(t-Sh)/(i-Sh)*100||100})},{errors:[],active:!1,progress:0,item:"",loaded:0,total:0}));let AT=Cm();const _t=n=>bm(n,AT);let ET=Cm();_t.write=n=>bm(n,ET);let R_=Cm();_t.onStart=n=>bm(n,R_);let MT=Cm();_t.onFrame=n=>bm(n,MT);let wT=Cm();_t.onFinish=n=>bm(n,wT);let Df=[];_t.setTimeout=(n,e)=>{let t=_t.now()+e,i=()=>{let s=Df.findIndex(o=>o.cancel==i);~s&&Df.splice(s,1),ol-=~s?1:0},r={time:t,handler:n,cancel:i};return Df.splice(cN(t),0,r),ol+=1,uN(),r};let cN=n=>~(~Df.findIndex(e=>e.time>n)||~Df.length);_t.cancel=n=>{R_.delete(n),MT.delete(n),wT.delete(n),AT.delete(n),ET.delete(n)};_t.sync=n=>{IE=!0,_t.batchedUpdates(n),IE=!1};_t.throttle=n=>{let e;function t(){try{n(...e)}finally{e=null}}function i(...r){e=r,_t.onStart(t)}return i.handler=n,i.cancel=()=>{R_.delete(t),e=null},i};let TT=typeof window<"u"?window.requestAnimationFrame:()=>{};_t.use=n=>TT=n;_t.now=typeof performance<"u"?()=>performance.now():Date.now;_t.batchedUpdates=n=>n();_t.catch=console.error;_t.frameLoop="always";_t.advance=()=>{_t.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):dN()};let sl=-1,ol=0,IE=!1;function bm(n,e){IE?(e.delete(n),n(0)):(e.add(n),uN())}function uN(){sl<0&&(sl=0,_t.frameLoop!=="demand"&&TT(fN))}function GX(){sl=-1}function fN(){~sl&&(TT(fN),_t.batchedUpdates(dN))}function dN(){let n=sl;sl=_t.now();let e=cN(sl);if(e&&(hN(Df.splice(0,e),t=>t.handler()),ol-=e),!ol){GX();return}R_.flush(),AT.flush(n?Math.min(64,sl-n):16.667),MT.flush(),ET.flush(),wT.flush()}function Cm(){let n=new Set,e=n;return{add(t){ol+=e==n&&!n.has(t)?1:0,n.add(t)},delete(t){return ol-=e==n&&n.has(t)?1:0,n.delete(t)},flush(t){e.size&&(n=new Set,ol-=e.size,hN(e,i=>i(t)&&n.add(i)),ol+=n.size,e=n)}}}function hN(n,e){n.forEach(t=>{try{e(t)}catch(i){_t.catch(i)}})}function BE(){}const VX=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),Pe={arr:Array.isArray,obj:n=>!!n&&n.constructor.name==="Object",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",und:n=>n===void 0};function Yo(n,e){if(Pe.arr(n)){if(!Pe.arr(e)||n.length!==e.length)return!1;for(let t=0;tn.forEach(e);function ya(n,e,t){if(Pe.arr(n)){for(let i=0;iPe.und(n)?[]:Pe.arr(n)?n:[n];function tp(n,e){if(n.size){const t=Array.from(n);n.clear(),Jt(t,e)}}const Nh=(n,...e)=>tp(n,t=>t(...e)),bT=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);let CT,pN,xl=null,mN=!1,RT=BE;const WX=n=>{n.to&&(pN=n.to),n.now&&(_t.now=n.now),n.colors!==void 0&&(xl=n.colors),n.skipAnimation!=null&&(mN=n.skipAnimation),n.createStringInterpolator&&(CT=n.createStringInterpolator),n.requestAnimationFrame&&_t.use(n.requestAnimationFrame),n.batchedUpdates&&(_t.batchedUpdates=n.batchedUpdates),n.willAdvance&&(RT=n.willAdvance),n.frameLoop&&(_t.frameLoop=n.frameLoop)};var Bo=Object.freeze({__proto__:null,get createStringInterpolator(){return CT},get to(){return pN},get colors(){return xl},get skipAnimation(){return mN},get willAdvance(){return RT},assign:WX});const np=new Set;let gs=[],pS=[],oy=0;const P_={get idle(){return!np.size&&!gs.length},start(n){oy>n.priority?(np.add(n),_t.onStart($X)):(gN(n),_t(DE))},advance:DE,sort(n){if(oy)_t.onFrame(()=>P_.sort(n));else{const e=gs.indexOf(n);~e&&(gs.splice(e,1),vN(n))}},clear(){gs=[],np.clear()}};function $X(){np.forEach(gN),np.clear(),_t(DE)}function gN(n){gs.includes(n)||vN(n)}function vN(n){gs.splice(XX(gs,e=>e.priority>n.priority),0,n)}function DE(n){const e=pS;for(let t=0;t0}function XX(n,e){const t=n.findIndex(e);return t<0?n.length:t}const jX=(n,e,t)=>Math.min(Math.max(t,n),e),JX={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Xs="[-+]?\\d*\\.?\\d+",ay=Xs+"%";function I_(...n){return"\\(\\s*("+n.join(")\\s*,\\s*(")+")\\s*\\)"}const KX=new RegExp("rgb"+I_(Xs,Xs,Xs)),YX=new RegExp("rgba"+I_(Xs,Xs,Xs,Xs)),QX=new RegExp("hsl"+I_(Xs,ay,ay)),qX=new RegExp("hsla"+I_(Xs,ay,ay,Xs)),ZX=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ej=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,tj=/^#([0-9a-fA-F]{6})$/,nj=/^#([0-9a-fA-F]{8})$/;function ij(n){let e;return typeof n=="number"?n>>>0===n&&n>=0&&n<=4294967295?n:null:(e=tj.exec(n))?parseInt(e[1]+"ff",16)>>>0:xl&&xl[n]!==void 0?xl[n]:(e=KX.exec(n))?(Yu(e[1])<<24|Yu(e[2])<<16|Yu(e[3])<<8|255)>>>0:(e=YX.exec(n))?(Yu(e[1])<<24|Yu(e[2])<<16|Yu(e[3])<<8|iI(e[4]))>>>0:(e=ZX.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=nj.exec(n))?parseInt(e[1],16)>>>0:(e=ej.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=QX.exec(n))?(tI(nI(e[1]),G0(e[2]),G0(e[3]))|255)>>>0:(e=qX.exec(n))?(tI(nI(e[1]),G0(e[2]),G0(e[3]))|iI(e[4]))>>>0:null}function mS(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)*(2/3-t)*6:n}function tI(n,e,t){const i=t<.5?t*(1+e):t+e-t*e,r=2*t-i,s=mS(r,i,n+1/3),o=mS(r,i,n),a=mS(r,i,n-1/3);return Math.round(s*255)<<24|Math.round(o*255)<<16|Math.round(a*255)<<8}function Yu(n){const e=parseInt(n,10);return e<0?0:e>255?255:e}function nI(n){return(parseFloat(n)%360+360)%360/360}function iI(n){const e=parseFloat(n);return e<0?0:e>1?255:Math.round(e*255)}function G0(n){const e=parseFloat(n);return e<0?0:e>100?1:e/100}function rI(n){let e=ij(n);if(e===null)return n;e=e||0;let t=(e&4278190080)>>>24,i=(e&16711680)>>>16,r=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${i}, ${r}, ${s})`}const Vp=(n,e,t)=>{if(Pe.fun(n))return n;if(Pe.arr(n))return Vp({range:n,output:e,extrapolate:t});if(Pe.str(n.output[0]))return CT(n);const i=n,r=i.output,s=i.range||[0,1],o=i.extrapolateLeft||i.extrapolate||"extend",a=i.extrapolateRight||i.extrapolate||"extend",l=i.easing||(c=>c);return c=>{const u=sj(c,s);return rj(c,s[u],s[u+1],r[u],r[u+1],l,o,a,i.map)}};function rj(n,e,t,i,r,s,o,a,l){let c=l?l(n):n;if(ct){if(a==="identity")return c;a==="clamp"&&(c=t)}return i===r?i:e===t?n<=e?i:r:(e===-1/0?c=-c:t===1/0?c=c-e:c=(c-e)/(t-e),c=s(c),i===-1/0?c=-c:r===1/0?c=c+i:c=c*(r-i)+i,c)}function sj(n,e){for(var t=1;t=n);++t);return t-1}const oj=(n,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*n,r=e==="end"?Math.floor(i):Math.ceil(i);return jX(0,1,r/n)},ly=1.70158,V0=ly*1.525,sI=ly+1,oI=2*Math.PI/3,aI=2*Math.PI/4.5,W0=n=>n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375,aj={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>1-(1-n)*(1-n),easeInOutQuad:n=>n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2,easeInCubic:n=>n*n*n,easeOutCubic:n=>1-Math.pow(1-n,3),easeInOutCubic:n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,easeInQuart:n=>n*n*n*n,easeOutQuart:n=>1-Math.pow(1-n,4),easeInOutQuart:n=>n<.5?8*n*n*n*n:1-Math.pow(-2*n+2,4)/2,easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>1-Math.pow(1-n,5),easeInOutQuint:n=>n<.5?16*n*n*n*n*n:1-Math.pow(-2*n+2,5)/2,easeInSine:n=>1-Math.cos(n*Math.PI/2),easeOutSine:n=>Math.sin(n*Math.PI/2),easeInOutSine:n=>-(Math.cos(Math.PI*n)-1)/2,easeInExpo:n=>n===0?0:Math.pow(2,10*n-10),easeOutExpo:n=>n===1?1:1-Math.pow(2,-10*n),easeInOutExpo:n=>n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2,easeInCirc:n=>1-Math.sqrt(1-Math.pow(n,2)),easeOutCirc:n=>Math.sqrt(1-Math.pow(n-1,2)),easeInOutCirc:n=>n<.5?(1-Math.sqrt(1-Math.pow(2*n,2)))/2:(Math.sqrt(1-Math.pow(-2*n+2,2))+1)/2,easeInBack:n=>sI*n*n*n-ly*n*n,easeOutBack:n=>1+sI*Math.pow(n-1,3)+ly*Math.pow(n-1,2),easeInOutBack:n=>n<.5?Math.pow(2*n,2)*((V0+1)*2*n-V0)/2:(Math.pow(2*n-2,2)*((V0+1)*(n*2-2)+V0)+2)/2,easeInElastic:n=>n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*oI),easeOutElastic:n=>n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n*10-.75)*oI)+1,easeInOutElastic:n=>n===0?0:n===1?1:n<.5?-(Math.pow(2,20*n-10)*Math.sin((20*n-11.125)*aI))/2:Math.pow(2,-20*n+10)*Math.sin((20*n-11.125)*aI)/2+1,easeInBounce:n=>1-W0(1-n),easeOutBounce:W0,easeInOutBounce:n=>n<.5?(1-W0(1-2*n))/2:(1+W0(2*n-1))/2,steps:oj};function LE(){return LE=Object.assign?Object.assign.bind():function(n){for(var e=1;e!!(n&&n[rd]),ds=n=>n&&n[rd]?n[rd]():n,lI=n=>n[Yc]||null;function lj(n,e){n.eventObserved?n.eventObserved(e):n(e)}function cy(n,e){let t=n[Yc];t&&t.forEach(i=>{lj(i,e)})}class cj{constructor(e){if(this[rd]=void 0,this[Yc]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");uj(this,e)}}const uj=(n,e)=>yN(n,rd,e);function Rm(n,e){if(n[rd]){let t=n[Yc];t||yN(n,Yc,t=new Set),t.has(e)||(t.add(e),n.observerAdded&&n.observerAdded(t.size,e))}return e}function uy(n,e){let t=n[Yc];if(t&&t.has(e)){const i=t.size-1;i?t.delete(e):n[Yc]=null,n.observerRemoved&&n.observerRemoved(i,e)}}const yN=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),Ev=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,fj=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,cI=new RegExp(`(${Ev.source})(%|[a-z]+)`,"i"),dj=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,B_=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,_N=n=>{const[e,t]=hj(n);if(!e||bT())return n;const i=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(i)return i.trim();if(t&&t.startsWith("--")){const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r||n}else{if(t&&B_.test(t))return _N(t);if(t)return t}return n},hj=n=>{const e=B_.exec(n);if(!e)return[,];const[,t,i]=e;return[t,i]};let gS;const pj=(n,e,t,i,r)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(i)}, ${r})`,xN=n=>{gS||(gS=xl?new RegExp(`(${Object.keys(xl).join("|")})(?!\\w)`,"g"):/^\b$/);const e=n.output.map(s=>ds(s).replace(B_,_N).replace(fj,rI).replace(gS,rI)),t=e.map(s=>s.match(Ev).map(Number)),r=t[0].map((s,o)=>t.map(a=>{if(!(o in a))throw Error('The arity of each "output" value must be equal');return a[o]})).map(s=>Vp(LE({},n,{output:s})));return s=>{var o;const a=!cI.test(e[0])&&((o=e.find(c=>cI.test(c)))==null?void 0:o.replace(Ev,""));let l=0;return e[0].replace(Ev,()=>`${r[l++](s)}${a||""}`).replace(dj,pj)}},PT="react-spring: ",SN=n=>{const e=n;let t=!1;if(typeof e!="function")throw new TypeError(`${PT}once requires a function parameter`);return(...i)=>{t||(e(...i),t=!0)}},mj=SN(console.warn);function gj(){mj(`${PT}The "interpolate" function is deprecated in v9 (use "to" instead)`)}const vj=SN(console.warn);function yj(){vj(`${PT}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function D_(n){return Pe.str(n)&&(n[0]=="#"||/\d/.test(n)||!bT()&&B_.test(n)||n in(xl||{}))}const IT=bT()?B.useEffect:B.useLayoutEffect,_j=()=>{const n=B.useRef(!1);return IT(()=>(n.current=!0,()=>{n.current=!1}),[]),n};function AN(){const n=B.useState()[1],e=_j();return()=>{e.current&&n(Math.random())}}function xj(n,e){const[t]=B.useState(()=>({inputs:e,result:n()})),i=B.useRef(),r=i.current;let s=r;return s?e&&s.inputs&&Sj(e,s.inputs)||(s={inputs:e,result:n()}):s=t,B.useEffect(()=>{i.current=s,r==t&&(t.inputs=t.result=void 0)},[s]),s.result}function Sj(n,e){if(n.length!==e.length)return!1;for(let t=0;tB.useEffect(n,Aj),Aj=[];function uI(n){const e=B.useRef();return B.useEffect(()=>{e.current=n}),e.current}const Wp=Symbol.for("Animated:node"),Ej=n=>!!n&&n[Wp]===n,vo=n=>n&&n[Wp],BT=(n,e)=>VX(n,Wp,e),L_=n=>n&&n[Wp]&&n[Wp].getPayload();class MN{constructor(){this.payload=void 0,BT(this,this)}getPayload(){return this.payload||[]}}class wd extends MN{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Pe.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new wd(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Pe.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,Pe.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class sd extends wd{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=Vp({output:[e,e]})}static create(e){return new sd(e)}getValue(){let e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(Pe.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=Vp({output:[this.getValue(),e]})),this._value=0,super.reset()}}const fy={dependencies:null};class DT extends MN{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return ya(this.source,(i,r)=>{Ej(i)?t[r]=i.getValue(e):_o(i)?t[r]=ds(i):e||(t[r]=i)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Jt(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return ya(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){fy.dependencies&&_o(e)&&fy.dependencies.add(e);const t=L_(e);t&&Jt(t,i=>this.add(i))}}class LT extends DT{constructor(e){super(e)}static create(e){return new LT(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((i,r)=>i.setValue(e[r])).some(Boolean):(super.setValue(e.map(Mj)),!0)}}function Mj(n){return(D_(n)?sd:wd).create(n)}function OE(n){const e=vo(n);return e?e.constructor:Pe.arr(n)?LT:D_(n)?sd:wd}function dy(){return dy=Object.assign?Object.assign.bind():function(n){for(var e=1;e{const t=!Pe.fun(n)||n.prototype&&n.prototype.isReactComponent;return B.forwardRef((i,r)=>{const s=B.useRef(null),o=t&&B.useCallback(v=>{s.current=bj(r,v)},[r]),[a,l]=Tj(i,e),c=AN(),u=()=>{const v=s.current;if(t&&!v)return;(v?e.applyAnimatedValues(v,a.getValue(!0)):!1)===!1&&c()},h=new wj(u,l),p=B.useRef();IT(()=>(p.current=h,Jt(l,v=>Rm(v,h)),()=>{p.current&&(Jt(p.current.deps,v=>uy(v,p.current)),_t.cancel(p.current.update))})),B.useEffect(u,[]),EN(()=>()=>{const v=p.current;Jt(v.deps,y=>uy(y,v))});const m=e.getComponentProps(a.getValue());return B.createElement(n,dy({},m,{ref:o}))})};class wj{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&_t.write(this.update)}}function Tj(n,e){const t=new Set;return fy.dependencies=t,n.style&&(n=dy({},n,{style:e.createAnimatedStyle(n.style)})),n=new DT(n),fy.dependencies=null,[n,t]}function bj(n,e){return n&&(Pe.fun(n)?n(e):n.current=e),e}const dI=Symbol.for("AnimatedComponent"),Cj=(n,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=r=>new DT(r),getComponentProps:i=r=>r}={})=>{const r={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:i},s=o=>{const a=hI(o)||"Anonymous";return Pe.str(o)?o=s[o]||(s[o]=fI(o,r)):o=o[dI]||(o[dI]=fI(o,r)),o.displayName=`Animated(${a})`,o};return ya(n,(o,a)=>{Pe.arr(n)&&(a=hI(o)),s[a]=s(o)}),{animated:s}},hI=n=>Pe.str(n)?n:n&&Pe.str(n.displayName)?n.displayName:Pe.fun(n)&&n.name||null;function yi(){return yi=Object.assign?Object.assign.bind():function(n){for(var e=1;en===!0||!!(e&&n&&(Pe.fun(n)?n(e):_s(n).includes(e))),wN=(n,e)=>Pe.obj(n)?e&&n[e]:n,TN=(n,e)=>n.default===!0?n[e]:n.default?n.default[e]:void 0,Rj=n=>n,OT=(n,e=Rj)=>{let t=Pj;n.default&&n.default!==!0&&(n=n.default,t=Object.keys(n));const i={};for(const r of t){const s=e(n[r],r);Pe.und(s)||(i[r]=s)}return i},Pj=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Ij={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Bj(n){const e={};let t=0;if(ya(n,(i,r)=>{Ij[r]||(e[r]=i,t++)}),t)return e}function bN(n){const e=Bj(n);if(e){const t={to:e};return ya(n,(i,r)=>r in e||(t[r]=i)),t}return yi({},n)}function $p(n){return n=ds(n),Pe.arr(n)?n.map($p):D_(n)?Bo.createStringInterpolator({range:[0,1],output:[n,n]})(1):n}function Dj(n){for(const e in n)return!0;return!1}function FE(n){return Pe.fun(n)||Pe.arr(n)&&Pe.obj(n[0])}function Lj(n,e){var t;(t=n.ref)==null||t.delete(n),e==null||e.delete(n)}function Oj(n,e){if(e&&n.ref!==e){var t;(t=n.ref)==null||t.delete(n),e.add(n),n.ref=e}}const Fj={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},NE=yi({},Fj.default,{mass:1,damping:1,easing:aj.linear,clamp:!1});class Nj{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,NE)}}function Uj(n,e,t){t&&(t=yi({},t),pI(t,e),e=yi({},t,e)),pI(n,e),Object.assign(n,e);for(const o in NE)n[o]==null&&(n[o]=NE[o]);let{mass:i,frequency:r,damping:s}=n;return Pe.und(r)||(r<.01&&(r=.01),s<0&&(s=0),n.tension=Math.pow(2*Math.PI/r,2)*i,n.friction=4*Math.PI*s*i/r),n}function pI(n,e){if(!Pe.und(e.decay))n.duration=void 0;else{const t=!Pe.und(e.tension)||!Pe.und(e.friction);(t||!Pe.und(e.frequency)||!Pe.und(e.damping)||!Pe.und(e.mass))&&(n.duration=void 0,n.decay=void 0),t&&(n.frequency=void 0)}}const mI=[];let kj=class{constructor(){this.changed=!1,this.values=mI,this.toValues=null,this.fromValues=mI,this.to=void 0,this.from=void 0,this.config=new Nj,this.immediate=!1}};function CN(n,{key:e,props:t,defaultProps:i,state:r,actions:s}){return new Promise((o,a)=>{var l;let c,u,h=ip((l=t.cancel)!=null?l:i==null?void 0:i.cancel,e);if(h)v();else{Pe.und(t.pause)||(r.paused=ip(t.pause,e));let y=i==null?void 0:i.pause;y!==!0&&(y=r.paused||ip(y,e)),c=_c(t.delay||0,e),y?(r.resumeQueue.add(m),s.pause()):(s.resume(),m())}function p(){r.resumeQueue.add(m),r.timeouts.delete(u),u.cancel(),c=u.time-_t.now()}function m(){c>0&&!Bo.skipAnimation?(r.delayed=!0,u=_t.setTimeout(v,c),r.pauseQueue.add(p),r.timeouts.add(u)):v()}function v(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(p),r.timeouts.delete(u),n<=(r.cancelId||0)&&(h=!0);try{s.start(yi({},t,{callId:n,cancel:h}),o)}catch(y){a(y)}}})}const FT=(n,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?Lf(n.get()):e.every(t=>t.noop)?RN(n.get()):$s(n.get(),e.every(t=>t.finished)),RN=n=>({value:n,noop:!0,finished:!0,cancelled:!1}),$s=(n,e,t=!1)=>({value:n,finished:e,cancelled:t}),Lf=n=>({value:n,cancelled:!0,finished:!1});function PN(n,e,t,i){const{callId:r,parentId:s,onRest:o}=e,{asyncTo:a,promise:l}=t;return!s&&n===a&&!e.reset?l:t.promise=(async()=>{t.asyncId=r,t.asyncTo=n;const c=OT(e,(_,g)=>g==="onRest"?void 0:_);let u,h;const p=new Promise((_,g)=>(u=_,h=g)),m=_=>{const g=r<=(t.cancelId||0)&&Lf(i)||r!==t.asyncId&&$s(i,!1);if(g)throw _.result=g,h(_),_},v=(_,g)=>{const x=new gI,A=new vI;return(async()=>{if(Bo.skipAnimation)throw Xp(t),A.result=$s(i,!1),h(A),A;m(x);const M=Pe.obj(_)?yi({},_):yi({},g,{to:_});M.parentId=r,ya(c,(b,R)=>{Pe.und(M[R])&&(M[R]=b)});const w=await i.start(M);return m(x),t.paused&&await new Promise(b=>{t.resumeQueue.add(b)}),w})()};let y;if(Bo.skipAnimation)return Xp(t),$s(i,!1);try{let _;Pe.arr(n)?_=(async g=>{for(const x of g)await v(x)})(n):_=Promise.resolve(n(v,i.stop.bind(i))),await Promise.all([_.then(u),p]),y=$s(i.get(),!0,!1)}catch(_){if(_ instanceof gI)y=_.result;else if(_ instanceof vI)y=_.result;else throw _}finally{r==t.asyncId&&(t.asyncId=s,t.asyncTo=s?a:void 0,t.promise=s?l:void 0)}return Pe.fun(o)&&_t.batchedUpdates(()=>{o(y,i,i.item)}),y})()}function Xp(n,e){tp(n.timeouts,t=>t.cancel()),n.pauseQueue.clear(),n.resumeQueue.clear(),n.asyncId=n.asyncTo=n.promise=void 0,e&&(n.cancelId=e)}class gI extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class vI extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const UE=n=>n instanceof NT;let zj=1;class NT extends cj{constructor(...e){super(...e),this.id=zj++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=vo(this);return e&&e.getValue()}to(...e){return Bo.to(this,e)}interpolate(...e){return gj(),Bo.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){cy(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||P_.sort(this),cy(this,{type:"priority",parent:this,priority:e})}}const Qc=Symbol.for("SpringPhase"),IN=1,kE=2,zE=4,vS=n=>(n[Qc]&IN)>0,$a=n=>(n[Qc]&kE)>0,Ah=n=>(n[Qc]&zE)>0,yI=(n,e)=>e?n[Qc]|=kE|IN:n[Qc]&=~kE,_I=(n,e)=>e?n[Qc]|=zE:n[Qc]&=~zE;class Hj extends NT{constructor(e,t){if(super(),this.key=void 0,this.animation=new kj,this.queue=void 0,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Pe.und(e)||!Pe.und(t)){const i=Pe.obj(e)?yi({},e):yi({},t,{from:e});Pe.und(i.default)&&(i.default=!0),this.start(i)}}get idle(){return!($a(this)||this._state.asyncTo)||Ah(this)}get goal(){return ds(this.animation.to)}get velocity(){const e=vo(this);return e instanceof wd?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return vS(this)}get isAnimating(){return $a(this)}get isPaused(){return Ah(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,i=!1;const r=this.animation;let{config:s,toValues:o}=r;const a=L_(r.to);!a&&_o(r.to)&&(o=_s(ds(r.to))),r.values.forEach((u,h)=>{if(u.done)return;const p=u.constructor==sd?1:a?a[h].lastPosition:o[h];let m=r.immediate,v=p;if(!m){if(v=u.lastPosition,s.tension<=0){u.done=!0;return}let y=u.elapsedTime+=e;const _=r.fromValues[h],g=u.v0!=null?u.v0:u.v0=Pe.arr(s.velocity)?s.velocity[h]:s.velocity;let x;const A=s.precision||(_==p?.005:Math.min(1,Math.abs(p-_)*.001));if(Pe.und(s.duration))if(s.decay){const M=s.decay===!0?.998:s.decay,w=Math.exp(-(1-M)*y);v=_+g/(1-M)*(1-w),m=Math.abs(u.lastPosition-v)<=A,x=g*w}else{x=u.lastVelocity==null?g:u.lastVelocity;const M=s.restVelocity||A/10,w=s.clamp?0:s.bounce,b=!Pe.und(w),R=_==p?u.v0>0:_M,!(!D&&(m=Math.abs(p-v)<=A,m)));++H){b&&(C=v==p||v>p==R,C&&(x=-x*w,v=p));const J=-s.tension*1e-6*(v-p),k=-s.friction*.001*x,W=(J+k)/s.mass;x=x+W*I,v=v+x*I}}else{let M=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,y=u.elapsedTime+=e)),M=(s.progress||0)+y/this._memoizedDuration,M=M>1?1:M<0?0:M,u.durationProgress=M),v=_+s.easing(M)*(p-_),x=(v-u.lastPosition)/e,m=M==1}u.lastVelocity=x,Number.isNaN(v)&&(console.warn("Got NaN while animating:",this),m=!0)}a&&!a[h].done&&(m=!1),m?u.done=!0:t=!1,u.setValue(v,s.round)&&(i=!0)});const l=vo(this),c=l.getValue();if(t){const u=ds(r.to);(c!==u||i)&&!s.decay?(l.setValue(u),this._onChange(u)):i&&s.decay&&this._onChange(c),this._stop()}else i&&this._onChange(c)}set(e){return _t.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if($a(this)){const{to:e,config:t}=this.animation;_t.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let i;return Pe.und(e)?(i=this.queue||[],this.queue=[]):i=[Pe.obj(e)?e:yi({},t,{to:e})],Promise.all(i.map(r=>this._update(r))).then(r=>FT(this,r))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),Xp(this._state,e&&this._lastCallId),_t.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:i,from:r}=e;i=Pe.obj(i)?i[t]:i,(i==null||FE(i))&&(i=void 0),r=Pe.obj(r)?r[t]:r,r==null&&(r=void 0);const s={to:i,from:r};return vS(this)||(e.reverse&&([i,r]=[r,i]),r=ds(r),Pe.und(r)?vo(this)||this._set(i):this._set(r)),s}_update(e,t){let i=yi({},e);const{key:r,defaultProps:s}=this;i.default&&Object.assign(s,OT(i,(l,c)=>/^on/.test(c)?wN(l,r):l)),SI(this,i,"onProps"),Mh(this,"onProps",i,this);const o=this._prepareNode(i);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const a=this._state;return CN(++this._lastCallId,{key:r,props:i,defaultProps:s,state:a,actions:{pause:()=>{Ah(this)||(_I(this,!0),Nh(a.pauseQueue),Mh(this,"onPause",$s(this,Eh(this,this.animation.to)),this))},resume:()=>{Ah(this)&&(_I(this,!1),$a(this)&&this._resume(),Nh(a.resumeQueue),Mh(this,"onResume",$s(this,Eh(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(l=>{if(i.loop&&l.finished&&!(t&&l.noop)){const c=BN(i);if(c)return this._update(c,!0)}return l})}_merge(e,t,i){if(t.cancel)return this.stop(!0),i(Lf(this));const r=!Pe.und(e.to),s=!Pe.und(e.from);if(r||s)if(t.callId>this._lastToId)this._lastToId=t.callId;else return i(Lf(this));const{key:o,defaultProps:a,animation:l}=this,{to:c,from:u}=l;let{to:h=c,from:p=u}=e;s&&!r&&(!t.default||Pe.und(h))&&(h=p),t.reverse&&([h,p]=[p,h]);const m=!Yo(p,u);m&&(l.from=p),p=ds(p);const v=!Yo(h,c);v&&this._focus(h);const y=FE(t.to),{config:_}=l,{decay:g,velocity:x}=_;(r||s)&&(_.velocity=0),t.config&&!y&&Uj(_,_c(t.config,o),t.config!==a.config?_c(a.config,o):void 0);let A=vo(this);if(!A||Pe.und(h))return i($s(this,!0));const M=Pe.und(t.reset)?s&&!t.default:!Pe.und(p)&&ip(t.reset,o),w=M?p:this.get(),b=$p(h),R=Pe.num(b)||Pe.arr(b)||D_(b),D=!y&&(!R||ip(a.immediate||t.immediate,o));if(v){const H=OE(h);if(H!==A.constructor)if(D)A=this._set(b);else throw Error(`Cannot animate between ${A.constructor.name} and ${H.name}, as the "to" prop suggests`)}const C=A.constructor;let I=_o(h),O=!1;if(!I){const H=M||!vS(this)&&m;(v||H)&&(O=Yo($p(w),b),I=!O),(!Yo(l.immediate,D)&&!D||!Yo(_.decay,g)||!Yo(_.velocity,x))&&(I=!0)}if(O&&$a(this)&&(l.changed&&!M?I=!0:I||this._stop(c)),!y&&((I||_o(c))&&(l.values=A.getPayload(),l.toValues=_o(h)?null:C==sd?[1]:_s(b)),l.immediate!=D&&(l.immediate=D,!D&&!M&&this._set(c)),I)){const{onRest:H}=l;Jt(Vj,k=>SI(this,t,k));const J=$s(this,Eh(this,c));Nh(this._pendingCalls,J),this._pendingCalls.add(i),l.changed&&_t.batchedUpdates(()=>{l.changed=!M,H==null||H(J,this),M?_c(a.onRest,J):l.onStart==null||l.onStart(J,this)})}M&&this._set(w),y?i(PN(t.to,t,this._state,this)):I?this._start():$a(this)&&!v?this._pendingCalls.add(i):i(RN(w))}_focus(e){const t=this.animation;e!==t.to&&(lI(this)&&this._detach(),t.to=e,lI(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;_o(t)&&(Rm(t,this),UE(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;_o(e)&&uy(e,this)}_set(e,t=!0){const i=ds(e);if(!Pe.und(i)){const r=vo(this);if(!r||!Yo(i,r.getValue())){const s=OE(i);!r||r.constructor!=s?BT(this,s.create(i)):r.setValue(i),r&&_t.batchedUpdates(()=>{this._onChange(i,t)})}}return vo(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,Mh(this,"onStart",$s(this,Eh(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),_c(this.animation.onChange,e,this)),_c(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;vo(this).reset(ds(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),$a(this)||(yI(this,!0),Ah(this)||this._resume())}_resume(){Bo.skipAnimation?this.finish():P_.start(this)}_stop(e,t){if($a(this)){yI(this,!1);const i=this.animation;Jt(i.values,s=>{s.done=!0}),i.toValues&&(i.onChange=i.onPause=i.onResume=void 0),cy(this,{type:"idle",parent:this});const r=t?Lf(this.get()):$s(this.get(),Eh(this,e??i.to));Nh(this._pendingCalls,r),i.changed&&(i.changed=!1,Mh(this,"onRest",r,this))}}}function Eh(n,e){const t=$p(e),i=$p(n.get());return Yo(i,t)}function BN(n,e=n.loop,t=n.to){let i=_c(e);if(i){const r=i!==!0&&bN(i),s=(r||n).reverse,o=!r||r.reset;return jp(yi({},n,{loop:e,default:!1,pause:void 0,to:!s||FE(t)?t:void 0,from:o?n.from:void 0,reset:o},r))}}function jp(n){const{to:e,from:t}=n=bN(n),i=new Set;return Pe.obj(e)&&xI(e,i),Pe.obj(t)&&xI(t,i),n.keys=i.size?Array.from(i):null,n}function Gj(n){const e=jp(n);return Pe.und(e.default)&&(e.default=OT(e)),e}function xI(n,e){ya(n,(t,i)=>t!=null&&e.add(i))}const Vj=["onStart","onRest","onChange","onPause","onResume"];function SI(n,e,t){n.animation[t]=e[t]!==TN(e,t)?wN(e[t],n.key):void 0}function Mh(n,e,...t){var i,r,s,o;(i=(r=n.animation)[e])==null||i.call(r,...t),(s=(o=n.defaultProps)[e])==null||s.call(o,...t)}const Wj=["onStart","onChange","onRest"];let $j=1,Xj=class{constructor(e,t){this.id=$j++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(yi({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,i)=>e[i]=t.get()),e}set(e){for(const t in e){const i=e[t];Pe.und(i)||this.springs[t].set(i)}}update(e){return e&&this.queue.push(jp(e)),this}start(e){let{queue:t}=this;return e?t=_s(e).map(jp):this.queue=[],this._flush?this._flush(this,t):(NN(this,t),HE(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const i=this.springs;Jt(_s(t),r=>i[r].stop(!!e))}else Xp(this._state,this._lastAsyncId),this.each(i=>i.stop(!!e));return this}pause(e){if(Pe.und(e))this.start({pause:!0});else{const t=this.springs;Jt(_s(e),i=>t[i].pause())}return this}resume(e){if(Pe.und(e))this.start({pause:!1});else{const t=this.springs;Jt(_s(e),i=>t[i].resume())}return this}each(e){ya(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:i}=this._events,r=this._active.size>0,s=this._changed.size>0;(r&&!this._started||s&&!this._started)&&(this._started=!0,tp(e,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const o=!r&&this._started,a=s||o&&i.size?this.get():null;s&&t.size&&tp(t,([l,c])=>{c.value=a,l(c,this,this._item)}),o&&(this._started=!1,tp(i,([l,c])=>{c.value=a,l(c,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;_t.onFrame(this._onFrame)}};function HE(n,e){return Promise.all(e.map(t=>DN(n,t))).then(t=>FT(n,t))}async function DN(n,e,t){const{keys:i,to:r,from:s,loop:o,onRest:a,onResolve:l}=e,c=Pe.obj(e.default)&&e.default;o&&(e.loop=!1),r===!1&&(e.to=null),s===!1&&(e.from=null);const u=Pe.arr(r)||Pe.fun(r)?r:void 0;u?(e.to=void 0,e.onRest=void 0,c&&(c.onRest=void 0)):Jt(Wj,y=>{const _=e[y];if(Pe.fun(_)){const g=n._events[y];e[y]=({finished:x,cancelled:A})=>{const M=g.get(_);M?(x||(M.finished=!1),A&&(M.cancelled=!0)):g.set(_,{value:null,finished:x||!1,cancelled:A||!1})},c&&(c[y]=e[y])}});const h=n._state;e.pause===!h.paused?(h.paused=e.pause,Nh(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const p=(i||Object.keys(n.springs)).map(y=>n.springs[y].start(e)),m=e.cancel===!0||TN(e,"cancel")===!0;(u||m&&h.asyncId)&&p.push(CN(++n._lastAsyncId,{props:e,state:h,actions:{pause:BE,resume:BE,start(y,_){m?(Xp(h,n._lastAsyncId),_(Lf(n))):(y.onRest=a,_(PN(u,y,h,n)))}}})),h.paused&&await new Promise(y=>{h.resumeQueue.add(y)});const v=FT(n,await Promise.all(p));if(o&&v.finished&&!(t&&v.noop)){const y=BN(e,o,r);if(y)return NN(n,[y]),DN(n,y,!0)}return l&&_t.batchedUpdates(()=>l(v,n,n.item)),v}function AI(n,e){const t=yi({},n.springs);return e&&Jt(_s(e),i=>{Pe.und(i.keys)&&(i=jp(i)),Pe.obj(i.to)||(i=yi({},i,{to:void 0})),FN(t,i,r=>ON(r))}),LN(n,t),t}function LN(n,e){ya(e,(t,i)=>{n.springs[i]||(n.springs[i]=t,Rm(t,n))})}function ON(n,e){const t=new Hj;return t.key=n,e&&Rm(t,e),t}function FN(n,e,t){e.keys&&Jt(e.keys,i=>{(n[i]||(n[i]=t(i)))._prepareNode(e)})}function NN(n,e){Jt(e,t=>{FN(n.springs,t,i=>ON(i,n))})}function jj(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}const Jj=["children"],O_=n=>{let{children:e}=n,t=jj(n,Jj);const i=B.useContext(hy),r=t.pause||!!i.pause,s=t.immediate||!!i.immediate;t=xj(()=>({pause:r,immediate:s}),[r,s]);const{Provider:o}=hy;return B.createElement(o,{value:t},e)},hy=Kj(O_,{});O_.Provider=hy.Provider;O_.Consumer=hy.Consumer;function Kj(n,e){return Object.assign(n,B.createContext(e)),n.Provider._context=n,n.Consumer._context=n,n}const Yj=()=>{const n=[],e=function(r){yj();const s=[];return Jt(n,(o,a)=>{if(Pe.und(r))s.push(o.start());else{const l=t(r,o,a);l&&s.push(o.start(l))}}),s};e.current=n,e.add=function(i){n.includes(i)||n.push(i)},e.delete=function(i){const r=n.indexOf(i);~r&&n.splice(r,1)},e.pause=function(){return Jt(n,i=>i.pause(...arguments)),this},e.resume=function(){return Jt(n,i=>i.resume(...arguments)),this},e.set=function(i){Jt(n,r=>r.set(i))},e.start=function(i){const r=[];return Jt(n,(s,o)=>{if(Pe.und(i))r.push(s.start());else{const a=this._getProps(i,s,o);a&&r.push(s.start(a))}}),r},e.stop=function(){return Jt(n,i=>i.stop(...arguments)),this},e.update=function(i){return Jt(n,(r,s)=>r.update(this._getProps(i,r,s))),this};const t=function(r,s,o){return Pe.fun(r)?r(o,s):r};return e._getProps=t,e};function Qj(n,e,t){const i=Pe.fun(e)&&e;i&&!t&&(t=[]);const r=B.useMemo(()=>i||arguments.length==3?Yj():void 0,[]),s=B.useRef(0),o=AN(),a=B.useMemo(()=>({ctrls:[],queue:[],flush(g,x){const A=AI(g,x);return s.current>0&&!a.queue.length&&!Object.keys(A).some(w=>!g.springs[w])?HE(g,x):new Promise(w=>{LN(g,A),a.queue.push(()=>{w(HE(g,x))}),o()})}}),[]),l=B.useRef([...a.ctrls]),c=[],u=uI(n)||0;B.useMemo(()=>{Jt(l.current.slice(n,u),g=>{Lj(g,r),g.stop(!0)}),l.current.length=n,h(u,n)},[n]),B.useMemo(()=>{h(0,Math.min(u,n))},t);function h(g,x){for(let A=g;AAI(g,c[x])),m=B.useContext(O_),v=uI(m),y=m!==v&&Dj(m);IT(()=>{s.current++,a.ctrls=l.current;const{queue:g}=a;g.length&&(a.queue=[],Jt(g,x=>x())),Jt(l.current,(x,A)=>{r==null||r.add(x),y&&x.start({default:m});const M=c[A];M&&(Oj(x,M.ref),x.ref?x.queue.push(M):x.start(M))})}),EN(()=>()=>{Jt(a.ctrls,g=>g.stop(!0))});const _=p.map(g=>yi({},g));return r?[_,r]:_}function qj(n,e){const t=Pe.fun(n),[[i],r]=Qj(1,t?n:[n],t?e||[]:e);return t||arguments.length==2?[i,r]:i}let EI;(function(n){n.MOUNT="mount",n.ENTER="enter",n.UPDATE="update",n.LEAVE="leave"})(EI||(EI={}));class Zj extends NT{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=Vp(...t);const i=this._get(),r=OE(i);BT(this,r.create(i))}advance(e){const t=this._get(),i=this.get();Yo(t,i)||(vo(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&MI(this._active)&&yS(this)}_get(){const e=Pe.arr(this.source)?this.source.map(ds):_s(ds(this.source));return this.calc(...e)}_start(){this.idle&&!MI(this._active)&&(this.idle=!1,Jt(L_(this),e=>{e.done=!1}),Bo.skipAnimation?(_t.batchedUpdates(()=>this.advance()),yS(this)):P_.start(this))}_attach(){let e=1;Jt(_s(this.source),t=>{_o(t)&&Rm(t,this),UE(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){Jt(_s(this.source),e=>{_o(e)&&uy(e,this)}),this._active.clear(),yS(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=_s(this.source).reduce((t,i)=>Math.max(t,(UE(i)?i.priority:0)+1),0))}}function eJ(n){return n.idle!==!1}function MI(n){return!n.size||Array.from(n).every(eJ)}function yS(n){n.idle||(n.idle=!0,Jt(L_(n),e=>{e.done=!0}),cy(n,{type:"idle",parent:n}))}Bo.assign({createStringInterpolator:xN,to:(n,e)=>new Zj(n,e)});const tJ=["primitive"].concat(Object.keys(FF).filter(n=>/^[A-Z]/.test(n)).map(n=>n[0].toLowerCase()+n.slice(1)));Bo.assign({createStringInterpolator:xN,colors:JX,frameLoop:"demand"});lX(()=>{_t.advance()});const nJ=Cj(tJ,{applyAnimatedValues:gc}),iJ=nJ.animated;function rJ(n,e,t){return Math.max(e,Math.min(n,t))}const mn={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 wI(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function TI(n,e,t,i=.15){return i===0?rJ(n,e,t):nt?+wI(n-t,t-e,i)+t:n}function sJ(n,[e,t],[i,r]){const[[s,o],[a,l]]=n;return[TI(e,s,o,i),TI(t,a,l,r)]}function oJ(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function aJ(n){var e=oJ(n,"string");return typeof e=="symbol"?e:String(e)}function Kn(n,e,t){return e=aJ(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bI(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function Pn(n){for(var e=1;e{var t,i;return e.target===n.currentTarget||((t=n.currentTarget)===null||t===void 0||(i=t.contains)===null||i===void 0?void 0:i.call(t,e.target))})}function mJ(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function zN(n){return F_(n)?mJ(n)[0]:n}function GE(n,e){try{const t=e.clientX-n.clientX,i=e.clientY-n.clientY,r=(e.clientX+n.clientX)/2,s=(e.clientY+n.clientY)/2,o=Math.hypot(t,i);return{angle:-(Math.atan2(t,i)*180)/Math.PI,distance:o,origin:[r,s]}}catch{}return null}function gJ(n){return pJ(n).map(e=>e.identifier)}function RI(n,e){const[t,i]=Array.from(n.touches).filter(r=>e.includes(r.identifier));return GE(t,i)}function _S(n){const e=zN(n);return F_(n)?e.identifier:e.pointerId}function od(n){const e=zN(n);return[e.clientX,e.clientY]}const PI=40,II=800;function HN(n){let{deltaX:e,deltaY:t,deltaMode:i}=n;return i===1?(e*=PI,t*=PI):i===2&&(e*=II,t*=II),[e,t]}function vJ(n){var e,t;const{scrollX:i,scrollY:r,scrollLeft:s,scrollTop:o}=n.currentTarget;return[(e=i??s)!==null&&e!==void 0?e:0,(t=r??o)!==null&&t!==void 0?t:0]}function yJ(n){const e={};if("buttons"in n&&(e.buttons=n.buttons),"shiftKey"in n){const{shiftKey:t,altKey:i,metaKey:r,ctrlKey:s}=n;Object.assign(e,{shiftKey:t,altKey:i,metaKey:r,ctrlKey:s})}return e}function py(n,...e){return typeof n=="function"?n(...e):n}function _J(){}function xJ(...n){return n.length===0?_J:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function BI(n,e){return Object.assign({},e,n||{})}const SJ=32;class GN{constructor(e,t,i){this.ctrl=e,this.args=t,this.key=i,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:i,args:r}=this;t[i]=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=r,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,i=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=i.from?py(i.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:i,shared:r}=this;t.args=this.args;let s=0;if(e&&(t.event=e,i.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,r.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,r.locked=!!document.pointerLockElement,Object.assign(r,yJ(e)),r.down=r.pressed=r.buttons%2===1||r.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);mn.addTo(t._distance,b)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[l,c]=i.threshold,{_step:u,values:h}=t;if(i.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(i.hasCustomTransform){const[b,R]=h;p[0]=u[0]!==!1?b-u[0]:0,p[1]=u[1]!==!1?R-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,v=t._active&&!t._blocked||t.active;v&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=r[this.ingKey]=t._active,e&&(t.first&&("bounds"in i&&(t._bounds=py(i.bounds,t)),this.setup&&this.setup()),t.movement=p,this.computeOffset()));const[y,_]=t.offset,[[g,x],[A,M]]=t._bounds;t.overflow=[yx?1:0,_M?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 w=t._active?i.rubberband||[0,0]:[0,0];if(t.offset=sJ(t._bounds,t.offset,w),t.delta=mn.sub(t.offset,m),this.computeMovement(),v&&(!t.last||s>SJ)){t.delta=mn.sub(t.offset,m);const b=t.delta.map(Math.abs);mn.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,i=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!i.triggerAllEvents)return;const r=this.handler(Pn(Pn(Pn({},t),e),{},{[this.aliasKey]:e.values}));r!==void 0&&(e.memo=r)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function AJ([n,e],t){const i=Math.abs(n),r=Math.abs(e);if(i>r&&i>t)return"x";if(r>i&&r>t)return"y"}class Pm extends GN{constructor(...e){super(...e),Kn(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=mn.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=mn.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,i=this.config;if(!t.axis&&e){const r=typeof i.axisThreshold=="object"?i.axisThreshold[kN(e)]:i.axisThreshold;t.axis=AJ(t._movement,r)}t._blocked=(i.lockDirection||!!i.axis)&&!t.axis||!!i.axis&&i.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 EJ=n=>n,DI=.15,VN={enabled(n=!0){return n},eventOptions(n,e,t){return Pn(Pn({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[DI,DI];case!1:return[0,0];default:return mn.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return mn.toVector(n)},transform(n,e,t){const i=n||t.shared.transform;return this.hasCustomTransform=!!i,i||EJ},threshold(n){return mn.toVector(n,0)}},MJ=0,lu=Pn(Pn({},VN),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=MJ){return n},bounds(n={}){if(typeof n=="function")return s=>lu.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:i=-1/0,bottom:r=1/0}=n;return[[e,t],[i,r]]}}),LI={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 wJ extends Pm{constructor(...e){super(...e),Kn(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(),i=e.currentTarget.getBoundingClientRect(),r={left:t.left-i.left+e.offset[0],right:t.right-i.right+e.offset[0],top:t.top-i.top+e.offset[1],bottom:t.bottom-i.bottom+e.offset[1]};e._bounds=lu.bounds(r)}}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,i=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const r=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(r&&r.size>1&&i._pointerActive)&&(this.start(e),this.setupPointer(e),i._pointerId=_S(e),i._pointerActive=!0,this.computeValues(od(e)),this.computeInitial(),t.preventScrollAxis&&kN(e)!=="mouse"?(i._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,i=this.config;if(!t._pointerActive)return;const r=_S(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;const s=od(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=mn.sub(s,t._values),this.computeValues(s)),mn.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(i.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===i.preventScrollAxis||i.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,i=this.config;if(!t._active||!t._pointerActive)return;const r=_S(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=i.tapsThreshold&&o<=i.tapsThreshold,t.tap&&i.filterTaps)t._force=!0;else{const[a,l]=t._delta,[c,u]=t._movement,[h,p]=i.swipe.velocity,[m,v]=i.swipe.distance,y=i.swipe.duration;if(t.elapsedTimeh&&Math.abs(c)>m&&(t.swipe[0]=Math.sign(a)),g>p&&Math.abs(u)>v&&(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,i=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,i,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,i,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,i,"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,TJ(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=LI[e.key];if(t){const i=this.state,r=e.shiftKey?10:e.altKey?.1:1;this.start(e),i._delta=t(this.config.keyboardDisplacement,r),i._keyboardActive=!0,mn.addTo(i._movement,i._delta),this.compute(e),this.emit()}}keyUp(e){e.key in LI&&(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 TJ(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const Im=typeof window<"u"&&window.document&&window.document.createElement;function WN(){return Im&&"ontouchstart"in window}function bJ(){return WN()||Im&&window.navigator.maxTouchPoints>1}function CJ(){return Im&&"onpointerdown"in window}function RJ(){return Im&&"exitPointerLock"in window.document}function PJ(){try{return"constructor"in GestureEvent}catch{return!1}}const ms={isBrowser:Im,gesture:PJ(),touch:WN(),touchscreen:bJ(),pointer:CJ(),pointerLock:RJ()},IJ=250,BJ=180,DJ=.5,LJ=50,OJ=250,FJ=10,OI={mouse:0,touch:0,pen:8},NJ=Pn(Pn({},lu),{},{device(n,e,{pointer:{touch:t=!1,lock:i=!1,mouse:r=!1}={}}){return this.pointerLock=i&&ms.pointerLock,ms.touch&&t?"touch":this.pointerLock?"mouse":ms.pointer&&!r?"pointer":ms.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?IJ:void 0,!(!ms.touchscreen||t===!1))return n||(t!==void 0?"y":void 0)},pointerCapture(n,e,{pointer:{capture:t=!0,buttons:i=1,keys:r=!0}={}}){return this.pointerButtons=i,this.keys=r,!this.pointerLock&&this.device==="pointer"&&t},threshold(n,e,{filterTaps:t=!1,tapsThreshold:i=3,axis:r=void 0}){const s=mn.toVector(n,t?i:r?1:0);return this.filterTaps=t,this.tapsThreshold=i,s},swipe({velocity:n=DJ,distance:e=LJ,duration:t=OJ}={}){return{velocity:this.transform(mn.toVector(n)),distance:this.transform(mn.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return BJ;case!1:return 0;default:return n}},axisThreshold(n){return n?Pn(Pn({},OI),n):OI},keyboardDisplacement(n=FJ){return n}});function $N(n){const[e,t]=n.overflow,[i,r]=n._delta,[s,o]=n._direction;(e<0&&i>0&&s<0||e>0&&i<0&&s>0)&&(n._movement[0]=n._movementBound[0]),(t<0&&r>0&&o<0||t>0&&r<0&&o>0)&&(n._movement[1]=n._movementBound[1])}const UJ=30,kJ=100;class zJ extends GN{constructor(...e){super(...e),Kn(this,"ingKey","pinching"),Kn(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:i}=this.state;e==="wheel"?this.state.offset=mn.add(t,i):this.state.offset=[(1+t[0])*i[0],t[1]+i[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,i]=e._movement;if(!e.axis){const r=Math.abs(t)*UJ-Math.abs(i);r<0?e.axis="angle":r>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,i=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>i.has(s))||i.size<2)return;this.start(e),t._touchIds=Array.from(i).slice(0,2);const r=RI(e,t._touchIds);r&&this.pinchStart(e,r)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,i=t._pointerEvents,r=this.ctrl.pointerIds;if(t._active&&Array.from(i.keys()).every(o=>r.has(o))||(i.size<2&&i.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=GE(...Array.from(i.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const i=this.state;i.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=RI(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const i=GE(...Array.from(t.values()));i&&this.pinchMove(e,i)}pinchMove(e,t){const i=this.state,r=i._values[1],s=t.angle-r;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),i.origin=t.origin,i.turns=o,i._movement=[i._values[0]/i._initial[0]-1,i._values[1]-i._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const i=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=mn.sub(t._movement,i),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(i=>e[i]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const i=this.state;i._delta=[-HN(e)[1]/kJ*i.offset[0],0],mn.addTo(i._movement,i._delta),$N(i),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const HJ=Pn(Pn({},VN),{},{device(n,e,{shared:t,pointer:{touch:i=!1}={}}){if(t.target&&!ms.touch&&ms.gesture)return"gesture";if(ms.touch&&i)return"touch";if(ms.touchscreen){if(ms.pointer)return"pointer";if(ms.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:i={}}){const r=o=>{const a=BI(py(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=BI(py(i,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof i!="function"?[r(),s()]:o=>[r(o),s(o)]},threshold(n,e,t){return this.lockDirection=t.axis==="lock",mn.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});class GJ extends Pm{constructor(...e){super(...e),Kn(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(od(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=od(e),i=this.state;i._delta=mn.sub(t,i._values),mn.addTo(i._movement,i._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const VJ=Pn(Pn({},lu),{},{mouseOnly:(n=!0)=>n});class WJ extends Pm{constructor(...e){super(...e),Kn(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,i=vJ(e);t._delta=mn.sub(i,t._values),mn.addTo(t._movement,t._delta),this.computeValues(i),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const $J=lu;class XJ extends Pm{constructor(...e){super(...e),Kn(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=HN(e),mn.addTo(t._movement,t._delta),$N(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const jJ=lu;class JJ extends Pm{constructor(...e){super(...e),Kn(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(od(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const i=od(e);t._movement=t._delta=mn.sub(i,t._values),this.computeValues(i),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const KJ=Pn(Pn({},lu),{},{mouseOnly:(n=!0)=>n}),UT=new Map,VE=new Map;function XN(n){UT.set(n.key,n.engine),VE.set(n.key,n.resolver)}const jN={key:"drag",engine:wJ,resolver:NJ},YJ={key:"hover",engine:JJ,resolver:KJ},QJ={key:"move",engine:GJ,resolver:VJ},qJ={key:"pinch",engine:zJ,resolver:HJ},ZJ={key:"scroll",engine:WJ,resolver:$J},eK={key:"wheel",engine:XJ,resolver:jJ};function tK(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}function nK(n,e){if(n==null)return{};var t=tK(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}const iK={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=ms.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},rK=["target","eventOptions","window","enabled","transform"];function Mv(n={},e){const t={};for(const[i,r]of Object.entries(e))switch(typeof r){case"function":t[i]=r.call(t,n[i],i,n);break;case"object":t[i]=Mv(n[i],r);break;case"boolean":r&&(t[i]=n[i]);break}return t}function sK(n,e,t={}){const i=n,{target:r,eventOptions:s,window:o,enabled:a,transform:l}=i,c=nK(i,rK);if(t.shared=Mv({target:r,eventOptions:s,window:o,enabled:a,transform:l},iK),e){const u=VE.get(e);t[e]=Mv(Pn({shared:t.shared},c),u)}else for(const u in c){const h=VE.get(u);h&&(t[u]=Mv(Pn({shared:t.shared},c[u]),h))}return t}class JN{constructor(e,t){Kn(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,i,r,s){const o=this._listeners,a=hJ(t,i),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},c=Pn(Pn({},l),s);e.addEventListener(a,r,c);const u=()=>{e.removeEventListener(a,r,c),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class oK{constructor(){Kn(this,"_timeouts",new Map)}add(e,t,i=140,...r){this.remove(e),this._timeouts.set(e,window.setTimeout(t,i,...r))}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 aK{constructor(e){Kn(this,"gestures",new Set),Kn(this,"_targetEventStore",new JN(this)),Kn(this,"gestureEventStores",{}),Kn(this,"gestureTimeoutStores",{}),Kn(this,"handlers",{}),Kn(this,"config",{}),Kn(this,"pointerIds",new Set),Kn(this,"touchIds",new Set),Kn(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),lK(this,e)}setEventIds(e){if(F_(e))return this.touchIds=new Set(gJ(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=sK(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,i={};let r;if(!(t.target&&(r=t.target(),!r))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],l=FI(i,a.eventOptions,!!r);if(a.enabled){const c=UT.get(o);new c(this,e,o).bind(l)}}const s=FI(i,t.eventOptions,!!r);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Pn(Pn({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in i)i[s]=xJ(...i[s]);if(!r)return i;for(const s in i){const{device:o,capture:a,passive:l}=dJ(s);this._targetEventStore.add(r,o,"",i[s],{capture:a,passive:l})}}}}function Qu(n,e){n.gestures.add(e),n.gestureEventStores[e]=new JN(n,e),n.gestureTimeoutStores[e]=new oK}function lK(n,e){e.drag&&Qu(n,"drag"),e.wheel&&Qu(n,"wheel"),e.scroll&&Qu(n,"scroll"),e.move&&Qu(n,"move"),e.pinch&&Qu(n,"pinch"),e.hover&&Qu(n,"hover")}const FI=(n,e,t)=>(i,r,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?i:uJ(i,r,u);t&&h&&(p+="Passive"),n[p]=n[p]||[],n[p].push(s)},cK=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function uK(n){const e={},t={},i=new Set;for(let r in n)cK.test(r)?(i.add(RegExp.lastMatch),t[r]=n[r]):e[r]=n[r];return[t,e,i]}function qu(n,e,t,i,r,s){if(!n.has(t)||!UT.has(i))return;const o=t+"Start",a=t+"End",l=c=>{let u;return c.first&&o in e&&e[o](c),t in e&&(u=e[t](c)),c.last&&a in e&&e[a](c),u};r[i]=l,s[i]=s[i]||{}}function fK(n,e){const[t,i,r]=uK(n),s={};return qu(r,t,"onDrag","drag",s,e),qu(r,t,"onWheel","wheel",s,e),qu(r,t,"onScroll","scroll",s,e),qu(r,t,"onPinch","pinch",s,e),qu(r,t,"onMove","move",s,e),qu(r,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:i}}function KN(n,e={},t,i){const r=X.useMemo(()=>new aK(n),[]);if(r.applyHandlers(n,i),r.applyConfig(e,t),X.useEffect(r.effect.bind(r)),X.useEffect(()=>r.clean.bind(r),[]),e.target===void 0)return r.bind.bind(r)}function dK(n,e){return XN(jN),KN({drag:n},e||{},"drag")}function hK(n){return n.forEach(XN),function(t,i){const{handlers:r,nativeHandlers:s,config:o}=fK(t,i||{});return KN(r,o,void 0,s)}}function pK(n,e){return hK([jN,qJ,ZJ,eK,QJ,YJ])(n,e||{})}function mK({enabled:n=!0,snap:e,global:t,domElement:i,cursor:r=!0,children:s,speed:o=1,rotation:a=[0,0,0],zoom:l=1,polar:c=[0,Math.PI/2],azimuth:u=[-1/0,1/0],config:h={mass:1,tension:170,friction:26}}){const p=la(b=>b.events),m=la(b=>b.gl),v=i||p.connected||m.domElement,{size:y}=la(),_=B.useMemo(()=>[a[0]+c[0],a[0]+c[1]],[a[0],c[0],c[1]]),g=B.useMemo(()=>[a[1]+u[0],a[1]+u[1]],[a[1],u[0],u[1]]),x=B.useMemo(()=>[Mo.clamp(a[0],..._),Mo.clamp(a[1],...g),a[2]],[a[0],a[1],a[2],_,g]),[A,M]=qj(()=>({scale:1,rotation:x,config:h}));B.useEffect(()=>void M.start({scale:1,rotation:x,config:h}),[x]),B.useEffect(()=>{if(t&&r&&n)return v.style.cursor="grab",m.domElement.style.cursor="",()=>{v.style.cursor="default",m.domElement.style.cursor="default"}},[t,r,v,n]);const w=pK({onHover:({last:b})=>{r&&!t&&n&&(v.style.cursor=b?"auto":"grab")},onDrag:({down:b,delta:[R,D],memo:[C,I]=A.rotation.animation.to||x})=>{if(!n)return[D,R];r&&(v.style.cursor=b?"grabbing":"grab"),R=Mo.clamp(I+R/y.width*Math.PI*o,...g),D=Mo.clamp(C+D/y.height*Math.PI*o,..._);const O=e&&!b&&typeof e!="boolean"?e:h;return M.start({scale:b&&D>_[1]/2?l:1,rotation:e&&!b?x:[D,R,0],config:H=>H==="scale"?{...O,friction:O.friction*3}:O}),[D,R]}},{target:t?v:void 0});return B.createElement(iJ.group,gn({},w==null?void 0:w(),A),s)}const gK=n=>(e,t,i)=>{const r=i.subscribe;return i.subscribe=(o,a,l)=>{let c=o;if(a){const u=(l==null?void 0:l.equalityFn)||Object.is;let h=o(i.getState());c=p=>{const m=o(p);if(!u(h,m)){const v=h;a(h=m,v)}},l!=null&&l.fireImmediately&&a(h,h)}return r(c)},n(e,t,i)};let wh;function vK(){var n;if(wh!==void 0)return wh;try{let e;const t=document.createElement("canvas");return wh=!!(window.WebGL2RenderingContext&&(e=t.getContext("webgl2"))),e&&((n=e.getExtension("WEBGL_lose_context"))==null||n.loseContext()),wh}catch{return wh=!1}}function NI(n,e){if(e===M3)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===ty||e===Ow){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const l=new KK(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(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function _K(){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 Lt={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 xK{constructor(e){this.parser=e,this.name=Lt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class BK{constructor(e){this.parser=e,this.name=Lt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.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 DK{constructor(e){this.parser=e,this.name=Lt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.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 LK{constructor(e){this.name=Lt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.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=r.byteOffset||0,c=r.byteLength||0,u=r.count,h=r.byteStride,p=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,p,r.mode,r.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,r.mode,r.filter),m})})}else return null}}class OK{constructor(e){this.name=Lt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const c of r.primitives)if(c.mode!==fs.TRIANGLES&&c.mode!==fs.TRIANGLE_STRIP&&c.mode!==fs.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=i.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 v of h){const y=new mt,_=new U,g=new Gi,x=new U(1,1,1),A=new Kw(v.geometry,v.material,p);for(let M=0;M=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"},Xa={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},GK={CUBICSPLINE:void 0,LINEAR:jc,STEP:Kf},SS={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function VK(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Am({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:bs})),n.DefaultMaterial}function cc(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function qa(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 WK(n,e,t){let i=!1,r=!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 JK=new mt;class KK{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new _K,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 i=!1,r=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||r&&s<98?this.textureLoader=new AF(this.options.manager):this.textureLoader=new PF(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Jr(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 i=this,r=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([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};cc(s,a,r),qa(a,r),Promise.all(i._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||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{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(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&_.setY(C,b[R*l+1]),l>=3&&_.setZ(C,b[R*l+2]),l>=4&&_.setW(C,b[R*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=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,i).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=kI[p.magFilter]||Qt,u.minFilter=kI[p.minFilter]||Ys,u.wrapS=zI[p.wrapS]||ga,u.wrapT=zI[p.wrapT]||ga,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.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 v=p;t.isImageBitmapLoader===!0&&(v=function(y){const _=new cn(y);_.needsUpdate=!0,p(_)}),t.load(Ro.resolveURL(h,s.path),v,void 0,m)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||jK(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,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[Lt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Lt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Lt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&("colorSpace"in o?o.colorSpace=r===3001?"srgb":"srgb-linear":o.encoding=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new d_,zn.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new Xi,zn.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return Am}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Lt.KHR_MATERIALS_UNLIT]){const h=r[Lt.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new Ie(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=ki);const u=s.alphaMode||SS.OPAQUE;if(u===SS.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===SS.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Hr&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new ce(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}return s.occlusionTexture!==void 0&&o!==Hr&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Hr&&(a.emissive=new Ie().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Hr&&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),qa(h,s),t.associations.set(h,{materials:e}),s.extensions&&cc(r,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,i=this.extensions,r=this.primitiveCache;function s(a){return i[Lt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return HI(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&$K(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),qa(g,s),_.extensions&&cc(r,g,_),t.assignFinalMaterial(g),h.push(g)}for(let m=0,v=h.length;m1?u=new sa:c.length===1?u=c[0]:u=new zt,u!==c[0])for(let h=0,p=c.length;h{const h=new Map;for(const[p,m]of r.associations)(p instanceof zn||p instanceof cn)&&h.set(p,m);return u.traverse(p=>{const m=r.associations.get(p);m!=null&&h.set(p,m)}),h};return r.associations=c(s),s})}}function YK(n,e,t){const i=e.attributes,r=new qs;if(i.POSITION!==void 0){const a=t.json.accessors[i.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(r.set(new U(l[0],l[1],l[2]),new U(c[0],c[1],c[2])),a.normalized){const u=$E(Of[a.componentType]);r.min.multiplyScalar(u),r.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 U,l=new U;for(let c=0,u=s.length;c{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){const s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};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 i=JSON.stringify(t);if(ES.has(e)){const l=ES.get(e);if(l.key===i)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 r;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((c,u)=>{r._callbacks[s]={resolve:c,reject:u},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),ES.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new Et;e.index&&t.setIndex(new Ht(e.index.array,1));for(let i=0;i{i.load(e,r,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(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=qK.toString(),o=["/* draco decoder */",r,"","/* 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 i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_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 v=t(h,p,m,c),y=v.attributes.map(_=>_.array.buffer);v.index&&y.push(v.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:v},y)}catch(v){console.error(v),self.postMessage({type:"error",id:a.id,error:v.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 v=a.GetEncodedGeometryType(l);if(v===o.TRIANGULAR_MESH)p=new o.Mesh,m=a.DecodeBufferToMesh(l,p);else if(v===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 y={index:null,attributes:[]};for(const _ in u){const g=self[h[_]];let x,A;if(c.useUniqueIDs)A=u[_],x=a.GetAttributeByUniqueId(p,A);else{if(A=a.GetAttributeId(p,o[u[_]]),A===-1)continue;x=a.GetAttribute(p,A)}y.attributes.push(r(o,a,p,_,g,x))}return v===o.TRIANGULAR_MESH&&(y.index=i(o,a,p)),o.destroy(p),y}function i(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 r(o,a,l,c,u,h){const p=h.num_components(),v=l.num_points()*p,y=v*u.BYTES_PER_ELEMENT,_=s(o,u),g=o._malloc(y);a.GetAttributeDataArrayForAllPoints(l,h,_,y,g);const x=new u(o.HEAPF32.buffer,g,v).slice();return o._free(g),{name:c,array:x,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 $0;const MS=()=>{if($0)return $0;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]),i=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 r=n;WebAssembly.validate(t)&&(r=e);let s;const o=WebAssembly.instantiate(a(r),{}).then(h=>{s=h.instance,s.exports.__wasm_call_ctors()});function a(h){const p=new Uint8Array(h.length);for(let v=0;v96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}let m=0;for(let v=0;v{const h=Gw.clone({[c]:{value:u}});return{...l,...h}},{}),vertexShader:e,fragmentShader:t}),this.key="",a.forEach(([l])=>Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:c=>this.uniforms[l].value=c})),Object.assign(this,o),i&&i(this)}};return r.key=Mo.generateUUID(),r}const eY=()=>parseInt(Ta.replace(/\D+/g,"")),tY=eY();let X0=null,ZN="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function eU(n,e,t){return i=>{t&&t(i),n&&(X0||(X0=new QK),X0.setDecoderPath(typeof n=="string"?n:ZN),i.setDRACOLoader(X0)),e&&i.setMeshoptDecoder(typeof MS=="function"?MS():MS)}}function cu(n,e=!0,t=!0,i){return wm(kT,n,eU(e,t,i))}cu.preload=(n,e=!0,t=!0,i)=>wm.preload(kT,n,eU(e,t,i));cu.clear=n=>wm.clear(kT,n);cu.setDecoderPath=n=>{ZN=n};function GI(n,e,t){const i=la(p=>p.size),r=la(p=>p.viewport),s=typeof n=="number"?n:i.width*r.dpr,o=typeof e=="number"?e:i.height*r.dpr,a=(typeof n=="number"?t:n)||{},{samples:l=0,depth:c,...u}=a,h=B.useMemo(()=>{const p=new xn(s,o,{minFilter:Qt,magFilter:Qt,type:Tl,...u});return c&&(p.depthTexture=new l_(s,o,ys)),p.samples=l,p},[]);return B.useLayoutEffect(()=>{h.setSize(s,o),l&&(h.samples=l)},[l,h,s,o]),B.useEffect(()=>()=>h.dispose(),[]),h}var tU={exports:{}},nY="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",iY=nY,rY=iY;function nU(){}function iU(){}iU.resetWarningCache=nU;var sY=function(){function n(i,r,s,o,a,l){if(l!==rY){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:iU,resetWarningCache:nU};return t.PropTypes=t,t};tU.exports=sY();var oY=tU.exports;const sn=md(oY),aY=ZK({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");class lY extends to{constructor(e=6,t=!1){super(),this.uniforms={chromaticAberration:{value:.05},transmission:{value:0},_transmission:{value:1},transmissionMap:{value:null},roughness:{value:0},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:1/0},attenuationColor:{value:new Ie("white")},anisotropicBlur:{value:.1},time:{value:0},distortion:{value:0},distortionScale:{value:.5},temporalDistortion:{value:0},buffer:{value:null}},this.onBeforeCompile=i=>{i.uniforms={...i.uniforms,...this.uniforms},this.anisotropy>0&&(i.defines.USE_ANISOTROPY=""),t?i.defines.USE_SAMPLER="":i.defines.USE_TRANSMISSION="",i.fragmentShader=` uniform float chromaticAberration; uniform float anisotropicBlur; uniform float time; uniform float distortion; uniform float distortionScale; uniform float temporalDistortion; uniform sampler2D buffer; vec3 random3(vec3 c) { float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); vec3 r; r.z = fract(512.0*j); j *= .125; r.x = fract(512.0*j); j *= .125; r.y = fract(512.0*j); return r-0.5; } float seed = 0.0; uint hash( uint x ) { x += ( x << 10u ); x ^= ( x >> 6u ); x += ( x << 3u ); x ^= ( x >> 11u ); x += ( x << 15u ); return x; } // Compound versions of the hashing algorithm I whipped together. uint hash( uvec2 v ) { return hash( v.x ^ hash(v.y) ); } uint hash( uvec3 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ); } uint hash( uvec4 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ^ hash(v.w) ); } // Construct a float with half-open range [0:1] using low 23 bits. // All zeroes yields 0.0, all ones yields the next smallest representable value below 1.0. float floatConstruct( uint m ) { const uint ieeeMantissa = 0x007FFFFFu; // binary32 mantissa bitmask const uint ieeeOne = 0x3F800000u; // 1.0 in IEEE binary32 m &= ieeeMantissa; // Keep only mantissa bits (fractional part) m |= ieeeOne; // Add fractional part to 1.0 float f = uintBitsToFloat( m ); // Range [1:2] return f - 1.0; // Range [0:1] } // Pseudo-random value in half-open range [0:1]. float random( float x ) { return floatConstruct(hash(floatBitsToUint(x))); } float random( vec2 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float random( vec3 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float random( vec4 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float rand() { float result = random(vec3(gl_FragCoord.xy, seed)); seed += 1.0; return result; } const float F3 = 0.3333333; const float G3 = 0.1666667; float snoise(vec3 p) { vec3 s = floor(p + dot(p, vec3(F3))); vec3 x = p - s + dot(s, vec3(G3)); vec3 e = step(vec3(0.0), x - x.yzx); vec3 i1 = e*(1.0 - e.zxy); vec3 i2 = 1.0 - e.zxy*(1.0 - e); vec3 x1 = x - i1 + G3; vec3 x2 = x - i2 + 2.0*G3; vec3 x3 = x - 1.0 + 3.0*G3; vec4 w, d; w.x = dot(x, x); w.y = dot(x1, x1); w.z = dot(x2, x2); w.w = dot(x3, x3); w = max(0.6 - w, 0.0); d.x = dot(random3(s), x); d.y = dot(random3(s + i1), x1); d.z = dot(random3(s + i2), x2); d.w = dot(random3(s + 1.0), x3); w *= w; w *= w; d *= w; return dot(d, vec4(52.0)); } float snoiseFractal(vec3 m) { return 0.5333333* snoise(m) +0.2666667* snoise(2.0*m) +0.1333333* snoise(4.0*m) +0.0666667* snoise(8.0*m); } `+i.fragmentShader,i.fragmentShader=i.fragmentShader.replace("#include ",` #ifdef USE_TRANSMISSION // Transmission code is based on glTF-Sampler-Viewer // https://github.com/KhronosGroup/glTF-Sample-Viewer uniform float _transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { // Direction of refracted light. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); // Compute rotation-independant scaling of the model matrix. vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); // The thickness is specified in local space. return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and // an IOR of 1.5 results in the default amount of microfacet refraction. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); #ifdef USE_SAMPLER #ifdef texture2DLodEXT return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod); #else return texture2D(transmissionSamplerMap, fragCoord.xy, framebufferLod); #endif #else return texture2D(buffer, fragCoord.xy); #endif } vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { // Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all. return radiance; } else { // Compute light attenuation using Beer's law. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law return transmittance * radiance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; // Sample framebuffer to get pixel the refracted ray hits. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); // Get the specular component. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } #endif `),i.fragmentShader=i.fragmentShader.replace("#include ",` // Improve the refraction to use the world pos material.transmission = _transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec3 transmission = vec3(0.0); float transmissionR, transmissionB, transmissionG; float randomCoords = rand(); float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropicBlur); vec3 distortionNormal = vec3(0.0); vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion; if (distortion > 0.0) { distortionNormal = distortion * vec3(snoiseFractal(vec3((pos * distortionScale + temporalOffset))), snoiseFractal(vec3(pos.zxy * distortionScale - temporalOffset)), snoiseFractal(vec3(pos.yxz * distortionScale + temporalOffset))); } for (float i = 0.0; i < ${e}.0; i ++) { vec3 sampleNorm = normalize(n + roughnessFactor * roughnessFactor * 2.0 * normalize(vec3(rand() - 0.5, rand() - 0.5, rand() - 0.5)) * pow(rand(), 0.33) + distortionNormal); transmissionR = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).r; transmissionG = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + chromaticAberration * (i + randomCoords) / float(${e})) , material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).g; transmissionB = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + 2.0 * chromaticAberration * (i + randomCoords) / float(${e})), material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).b; transmission.r += transmissionR; transmission.g += transmissionG; transmission.b += transmissionB; } transmission /= ${e}.0; totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); `)},Object.keys(this.uniforms).forEach(i=>Object.defineProperty(this,i,{get:()=>this.uniforms[i].value,set:r=>this.uniforms[i].value=r}))}}const cY=B.forwardRef(({buffer:n,transmissionSampler:e=!1,backside:t=!1,side:i=bs,transmission:r=1,thickness:s=0,backsideThickness:o=0,samples:a=10,resolution:l,backsideResolution:c,background:u,anisotropy:h,anisotropicBlur:p,...m},v)=>{_T({MeshTransmissionMaterial:lY});const y=B.useRef(null),[_]=B.useState(()=>new aY),g=GI(c||l),x=GI(l);let A,M,w;return Mm(b=>{y.current.time=b.clock.getElapsedTime(),y.current.buffer===x.texture&&!e&&(w=y.current.__r3f.parent,w&&(M=b.gl.toneMapping,A=b.scene.background,b.gl.toneMapping=Ms,u&&(b.scene.background=u),w.material=_,t&&(b.gl.setRenderTarget(g),b.gl.render(b.scene,b.camera),w.material=y.current,w.material.buffer=g.texture,w.material.thickness=o,w.material.side=qn),b.gl.setRenderTarget(x),b.gl.render(b.scene,b.camera),w.material=y.current,w.material.thickness=s,w.material.side=i,w.material.buffer=x.texture,b.scene.background=A,b.gl.setRenderTarget(null),b.gl.toneMapping=M))}),B.useImperativeHandle(v,()=>y.current,[]),B.createElement("meshTransmissionMaterial",gn({args:[a,e],ref:y},m,{buffer:n||x.texture,_transmission:r,anisotropicBlur:p??h,transmission:e?r:0,thickness:s,side:i}))}),uY=B.createContext(null),fY=B.forwardRef(({castShadow:n=!0,bias:e=.001,mapSize:t=512,size:i=5,near:r=.5,far:s=500,frames:o=1,position:a=[0,0,0],radius:l=1,amount:c=8,intensity:u=tY>=155?Math.PI:1,ambient:h=.5,...p},m)=>{const v=B.useRef(null),y=new U(...a).length(),_=B.useContext(uY),g=B.useCallback(()=>{let A;if(v.current)for(let M=0;Mh)A.position.set(a[0]+Mo.randFloatSpread(l),a[1]+Mo.randFloatSpread(l),a[2]+Mo.randFloatSpread(l));else{let w=Math.acos(2*Math.random()-1)-Math.PI/2,b=2*Math.PI*Math.random();A.position.set(Math.cos(w)*Math.cos(b)*y,Math.abs(Math.cos(w)*Math.sin(b)*y),Math.sin(w)*y)}},[l,h,y,...a]),x=B.useMemo(()=>({update:g}),[g]);return B.useImperativeHandle(m,()=>x,[x]),B.useLayoutEffect(()=>{var A;const M=v.current;return _&&((A=_.lights)==null||A.set(M.uuid,x)),()=>{var w;return void(_==null||(w=_.lights)==null?void 0:w.delete(M.uuid))}},[_,x]),B.createElement("group",gn({ref:v},p),Array.from({length:c},(A,M)=>B.createElement("directionalLight",{key:M,castShadow:n,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:u/c},B.createElement("orthographicCamera",{attach:"shadow-camera",args:[-i,i,i,-i,r,s]}))))});function dY(n,e){typeof n=="function"?n(e):n!=null&&(n.current=e)}function rU(...n){return e=>n.forEach(t=>dY(t,e))}function Td(...n){return B.useCallback(rU(...n),n)}const sU=B.forwardRef((n,e)=>{const{children:t,...i}=n,r=B.Children.toArray(t),s=r.find(hY);if(s){const o=s.props.children,a=r.map(l=>l===s?B.Children.count(o)>1?B.Children.only(null):B.isValidElement(o)?o.props.children:null:l);return B.createElement(XE,gn({},i,{ref:e}),B.isValidElement(o)?B.cloneElement(o,void 0,a):null)}return B.createElement(XE,gn({},i,{ref:e}),t)});sU.displayName="Slot";const XE=B.forwardRef((n,e)=>{const{children:t,...i}=n;return B.isValidElement(t)?B.cloneElement(t,{...pY(i,t.props),ref:e?rU(e,t.ref):t.ref}):B.Children.count(t)>1?B.Children.only(null):null});XE.displayName="SlotClone";const oU=({children:n})=>B.createElement(B.Fragment,null,n);function hY(n){return B.isValidElement(n)&&n.type===oU}function pY(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}const mY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],uu=mY.reduce((n,e)=>{const t=B.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?sU:e;return B.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),B.createElement(a,gn({},o,{ref:r}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function gY(n,e){n&&fm.flushSync(()=>n.dispatchEvent(e))}const vY=B.forwardRef((n,e)=>{var t;const{container:i=globalThis==null||(t=globalThis.document)===null||t===void 0?void 0:t.body,...r}=n;return i?r5.createPortal(B.createElement(uu.div,gn({},r,{ref:e})),i):null}),yY=vY;var VI=Object.prototype.hasOwnProperty;function my(n,e){var t,i;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((i=n.length)===e.length)for(;i--&&my(n[i],e[i]););return i===-1}if(!t||typeof n=="object"){i=0;for(t in n)if(VI.call(n,t)&&++i&&!VI.call(e,t)||!(t in e)||!my(n[t],e[t]))return!1;return Object.keys(e).length===i}}return n!==n&&e!==e}var N_=function(e,t,i,r){this.name=e,this.fn=t,this.args=i,this.modifiers=r};N_.prototype._test=function(e){var t=this.fn;try{Ff(this.modifiers.slice(),t,this)(e)}catch{t=function(){return!1}}try{return Ff(this.modifiers.slice(),t,this)(e)}catch{return!1}};N_.prototype._check=function(e){try{Ff(this.modifiers.slice(),this.fn,this)(e)}catch{if(Ff(this.modifiers.slice(),function(i){return i},this)(!1))return}if(!Ff(this.modifiers.slice(),this.fn,this)(e))throw null};N_.prototype._testAsync=function(e){var t=this;return new Promise(function(i,r){lU(t.modifiers.slice(),t.fn,t)(e).then(function(s){s?i(e):r(null)}).catch(function(s){return r(s)})})};function aU(n,e){return e===void 0&&(e="simple"),typeof n=="object"?n[e]:n}function Ff(n,e,t){if(n.length){var i=n.shift(),r=Ff(n,e,t);return i.perform(r,t)}else return aU(e)}function lU(n,e,t){if(n.length){var i=n.shift(),r=lU(n,e,t);return i.performAsync(r,t)}else return function(s){return Promise.resolve(aU(e,"async")(s))}}var _Y=function(e,t,i){this.name=e,this.perform=t,this.performAsync=i},zT=function(n){function e(t,i,r,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=i,this.cause=r,this.target=s}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(Error),Do=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=[]),this.chain=e,this.nextRuleModifiers=t};Do.prototype._applyRule=function(e,t){var i=this;return function(){for(var r=[],s=arguments.length;s--;)r[s]=arguments[s];return i.chain.push(new N_(t,e.apply(i,r),r,i.nextRuleModifiers)),i.nextRuleModifiers=[],i}};Do.prototype._applyModifier=function(e,t){return this.nextRuleModifiers.push(new _Y(t,e.simple,e.async)),this};Do.prototype._clone=function(){return new Do(this.chain.slice(),this.nextRuleModifiers.slice())};Do.prototype.test=function(e){return this.chain.every(function(t){return t._test(e)})};Do.prototype.testAll=function(e){var t=[];return this.chain.forEach(function(i){try{i._check(e)}catch(r){t.push(new zT(i,e,r))}}),t};Do.prototype.check=function(e){this.chain.forEach(function(t){try{t._check(e)}catch(i){throw new zT(t,e,i)}})};Do.prototype.testAsync=function(e){var t=this;return new Promise(function(i,r){cU(e,t.chain.slice(),i,r)})};function cU(n,e,t,i){if(e.length){var r=e.shift();r._testAsync(n).then(function(){cU(n,e,t,i)},function(s){i(new zT(r,n,s))})}else t(n)}var WI=function(n,e){return e&&typeof n=="string"&&n.trim().length===0?!0:n==null};function xY(n,e){return e===void 0&&(e=!1),{simple:function(t){return WI(t,e)||n.check(t)===void 0},async:function(t){return WI(t,e)||n.testAsync(t)}}}function xr(){return typeof Proxy<"u"?uU(new Do):jE(new Do)}var Jp={};xr.extend=function(n){Object.assign(Jp,n)};xr.clearCustomRules=function(){Jp={}};function uU(n){return new Proxy(n,{get:function(t,i){if(i in t)return t[i];var r=uU(n._clone());if(i in gy)return r._applyModifier(gy[i],i);if(i in Jp)return r._applyRule(Jp[i],i);if(i in JE)return r._applyRule(JE[i],i)}})}function jE(n){var e=function(r,s){return Object.keys(r).forEach(function(o){s[o]=function(){for(var a=[],l=arguments.length;l--;)a[l]=arguments[l];var c=jE(s._clone()),u=c._applyRule(r[o],o).apply(void 0,a);return u}}),s},t=e(JE,n),i=e(Jp,t);return Object.keys(gy).forEach(function(r){Object.defineProperty(i,r,{get:function(){var s=jE(i._clone());return s._applyModifier(gy[r],r)}})}),i}var gy={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 j0(e).some(function(t){try{return n(t)}catch{return!1}})}},async:function(n){return function(e){return Promise.all(j0(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&&j0(e).every(n)}},async:function(n){return function(e){return Promise.all(j0(e).map(n)).then(function(t){return t.every(Boolean)})}}},strict:{simple:function(n,e){return function(t){return $I(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(i){return $I(e)&&t&&typeof t=="object"?Object.keys(e.args[0]).length===Object.keys(t).length&&i:i}).catch(function(){return!1})}}}};function $I(n){return n&&n.name==="schema"&&n.args.length>0&&typeof n.args[0]=="object"}function j0(n){return typeof n=="string"?n.split(""):n}var JE={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||SY;return e(n)}},numeric:function(){return function(n){return!isNaN(parseFloat(n))&&isFinite(n)}},string:function(){return Zu("string")},boolean:function(){return Zu("boolean")},undefined:function(){return Zu("undefined")},null:function(){return Zu("null")},array:function(){return Zu("array")},object:function(){return Zu("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 AY(n)},passesAnyOf:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return function(t){return n.some(function(i){return i.test(t)})}},optional:xY};function Zu(n){return function(e){return Array.isArray(e)&&n==="array"||e===null&&n==="null"||typeof e===n}}function SY(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n}function AY(n){return{simple:function(e){var t=[];if(Object.keys(n).forEach(function(i){var r=n[i];try{r.check((e||{})[i])}catch(s){s.target=i,t.push(s)}}),t.length>0)throw t;return!0},async:function(e){var t=[],i=Object.keys(n).map(function(r){var s=n[r];return s.testAsync((e||{})[r]).catch(function(o){o.target=r,t.push(o)})});return Promise.all(i).then(function(){if(t.length>0)throw t;return!0})}}}var tn="colors",Zi="sizes",je="space",EY={gap:je,gridGap:je,columnGap:je,gridColumnGap:je,rowGap:je,gridRowGap:je,inset:je,insetBlock:je,insetBlockEnd:je,insetBlockStart:je,insetInline:je,insetInlineEnd:je,insetInlineStart:je,margin:je,marginTop:je,marginRight:je,marginBottom:je,marginLeft:je,marginBlock:je,marginBlockEnd:je,marginBlockStart:je,marginInline:je,marginInlineEnd:je,marginInlineStart:je,padding:je,paddingTop:je,paddingRight:je,paddingBottom:je,paddingLeft:je,paddingBlock:je,paddingBlockEnd:je,paddingBlockStart:je,paddingInline:je,paddingInlineEnd:je,paddingInlineStart:je,top:je,right:je,bottom:je,left:je,scrollMargin:je,scrollMarginTop:je,scrollMarginRight:je,scrollMarginBottom:je,scrollMarginLeft:je,scrollMarginX:je,scrollMarginY:je,scrollMarginBlock:je,scrollMarginBlockEnd:je,scrollMarginBlockStart:je,scrollMarginInline:je,scrollMarginInlineEnd:je,scrollMarginInlineStart:je,scrollPadding:je,scrollPaddingTop:je,scrollPaddingRight:je,scrollPaddingBottom:je,scrollPaddingLeft:je,scrollPaddingX:je,scrollPaddingY:je,scrollPaddingBlock:je,scrollPaddingBlockEnd:je,scrollPaddingBlockStart:je,scrollPaddingInline:je,scrollPaddingInlineEnd:je,scrollPaddingInlineStart:je,fontSize:"fontSizes",background:tn,backgroundColor:tn,backgroundImage:tn,borderImage:tn,border:tn,borderBlock:tn,borderBlockEnd:tn,borderBlockStart:tn,borderBottom:tn,borderBottomColor:tn,borderColor:tn,borderInline:tn,borderInlineEnd:tn,borderInlineStart:tn,borderLeft:tn,borderLeftColor:tn,borderRight:tn,borderRightColor:tn,borderTop:tn,borderTopColor:tn,caretColor:tn,color:tn,columnRuleColor:tn,fill:tn,outline:tn,outlineColor:tn,stroke:tn,textDecorationColor:tn,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:Zi,minBlockSize:Zi,maxBlockSize:Zi,inlineSize:Zi,minInlineSize:Zi,maxInlineSize:Zi,width:Zi,minWidth:Zi,maxWidth:Zi,height:Zi,minHeight:Zi,maxHeight:Zi,flexBasis:Zi,gridTemplateColumns:Zi,gridTemplateRows:Zi,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"},MY=(n,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,bd=()=>{const n=Object.create(null);return(e,t,...i)=>{const r=(s=>JSON.stringify(s,MY))(e);return r in n?n[r]:n[r]=t(e,...i)}},Fc=Symbol.for("sxs.internal"),HT=(n,e)=>Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),XI=n=>{for(const e in n)return!0;return!1},{hasOwnProperty:wY}=Object.prototype,KE=n=>n.includes("-")?n:n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),TY=/\s+(?![^()]*\))/,ef=n=>e=>n(...typeof e=="string"?String(e).split(TY):[e]),jI={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:ef((n,e)=>({marginBlockStart:n,marginBlockEnd:e||n})),marginInline:ef((n,e)=>({marginInlineStart:n,marginInlineEnd:e||n})),maxSize:ef((n,e)=>({maxBlockSize:n,maxInlineSize:e||n})),minSize:ef((n,e)=>({minBlockSize:n,minInlineSize:e||n})),paddingBlock:ef((n,e)=>({paddingBlockStart:n,paddingBlockEnd:e||n})),paddingInline:ef((n,e)=>({paddingInlineStart:n,paddingInlineEnd:e||n}))},wS=/([\d.]+)([^]*)/,bY=(n,e)=>n.length?n.reduce((t,i)=>(t.push(...e.map(r=>r.includes("&")?r.replace(/&/g,/[ +>|~]/.test(i)&&/&.*&/.test(r)?`:is(${i})`:i):i+" "+r)),t),[]):e,CY=(n,e)=>n in RY&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,(t,i,r,s)=>i+(r==="stretch"?`-moz-available${s};${KE(n)}:${i}-webkit-fill-available`:`-moz-fit-content${s};${KE(n)}:${i}fit-content`)+s):String(e),RY={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},_a=n=>n?n+"-":"",fU=(n,e,t)=>n.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,(i,r,s,o,a)=>o=="$"==!!s?i:(r||o=="--"?"calc(":"")+"var(--"+(o==="$"?_a(e)+(a.includes("$")?"":_a(t))+a.replace(/\$/g,"-"):a)+")"+(r||o=="--"?"*"+(r||"")+(s||"1")+")":"")),PY=/\s*,\s*(?![^()]*\))/,IY=Object.prototype.toString,Af=(n,e,t,i,r)=>{let s,o,a;const l=(c,u,h)=>{let p,m;const v=y=>{for(p in y){const x=p.charCodeAt(0)===64,A=x&&Array.isArray(y[p])?y[p]:[y[p]];for(m of A){const M=/[A-Z]/.test(g=p)?g:g.replace(/-[^]/g,b=>b[1].toUpperCase()),w=typeof m=="object"&&m&&m.toString===IY&&(!i.utils[M]||!u.length);if(M in i.utils&&!w){const b=i.utils[M];if(b!==o){o=b,v(b(m)),o=null;continue}}else if(M in jI){const b=jI[M];if(b!==a){a=b,v(b(m)),a=null;continue}}if(x&&(_=p.slice(1)in i.media?"@media "+i.media[p.slice(1)]:p,p=_.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,(b,R,D,C,I,O)=>{const H=wS.test(R),J=.0625*(H?-1:1),[k,W]=H?[C,R]:[R,C];return"("+(D[0]==="="?"":D[0]===">"===H?"max-":"min-")+k+":"+(D[0]!=="="&&D.length===1?W.replace(wS,(q,Q,z)=>Number(Q)+J*(D===">"?1:-1)+z):W)+(I?") and ("+(I[0]===">"?"min-":"max-")+k+":"+(I.length===1?O.replace(wS,(q,Q,z)=>Number(Q)+J*(I===">"?-1:1)+z):O):"")+")"})),w){const b=x?h.concat(p):[...h],R=x?[...u]:bY(u,p.split(PY));s!==void 0&&r(JI(...s)),s=void 0,l(m,R,b)}else s===void 0&&(s=[[],u,h]),p=x||p.charCodeAt(0)!==36?p:`--${_a(i.prefix)}${p.slice(1).replace(/\$/g,"-")}`,m=w?m:typeof m=="number"?m&&M in BY?String(m)+"px":String(m):fU(CY(M,m??""),i.prefix,i.themeMap[M]),s[0].push(`${x?`${p} `:`${KE(p)}:`}${m}`)}}var _,g};v(c),s!==void 0&&r(JI(...s)),s=void 0};l(n,e,t)},JI=(n,e,t)=>`${t.map(i=>`${i}{`).join("")}${e.length?`${e.join(",")}{`:""}${n.join(";")}${e.length?"}":""}${Array(t.length?t.length+1:0).join("}")}`,BY={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},KI=n=>String.fromCharCode(n+(n>25?39:97)),Nc=n=>(e=>{let t,i="";for(t=Math.abs(e);t>52;t=t/52|0)i=KI(t%52)+i;return KI(t%52)+i})(((e,t)=>{let i=t.length;for(;i;)e=33*e^t.charCodeAt(--i);return e})(5381,JSON.stringify(n))>>>0),Uh=["themed","global","styled","onevar","resonevar","allvar","inline"],DY=n=>{if(n.href&&!n.href.startsWith(location.origin))return!1;try{return!!n.cssRules}catch{return!1}},LY=n=>{let e;const t=()=>{const{cssRules:r}=e.sheet;return[].map.call(r,(s,o)=>{const{cssText:a}=s;let l="";if(a.startsWith("--sxs"))return"";if(r[o-1]&&(l=r[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("")},i=()=>{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 r=Object(n).styleSheets||[];for(const a of r)if(DY(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+/),v=Uh[m[0]];v&&(e||(e={sheet:a,reset:i,rules:{},toString:t}),e.rules[v]={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:i,toString:t}}const{sheet:s,rules:o}=e;for(let a=Uh.length-1;a>=0;--a){const l=Uh[a];if(!o[l]){const c=Uh[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])}}OY(o[l])}};return i(),e},OY=n=>{const e=n.group;let t=e.cssRules.length;n.apply=i=>{try{e.insertRule(i,t),++t}catch{}}},bh=Symbol(),FY=bd(),YI=(n,e)=>FY(n,()=>(...t)=>{let i={type:null,composers:new Set};for(const r of t)if(r!=null)if(r[Fc]){i.type==null&&(i.type=r[Fc].type);for(const s of r[Fc].composers)i.composers.add(s)}else r.constructor!==Object||r.$$typeof?i.type==null&&(i.type=r):i.composers.add(NY(r,n));return i.type==null&&(i.type="span"),i.composers.size||i.composers.add(["PJLV",{},[],[],{},[]]),UY(n,i,e)}),NY=({variants:n,compoundVariants:e,defaultVariants:t,...i},r)=>{const s=`${_a(r.prefix)}c-${Nc(i)}`,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,wY.call(u,h)||(l[p]="undefined");const m=n[p];for(const v in m){const y={[p]:String(v)};String(v)==="undefined"&&c.push(p);const _=m[v],g=[y,_,!XI(_)];o.push(g)}}var u,h;if(typeof e=="object"&&e)for(const p of e){let{css:m,...v}=p;m=typeof m=="object"&&m||{};for(const _ in v)v[_]=String(v[_]);const y=[v,m,!XI(m)];a.push(y)}return[s,i,o,a,l,c]},UY=(n,e,t)=>{const[i,r,s,o]=kY(e.composers),a=typeof e.type=="function"||e.type.$$typeof?(h=>{function p(){for(let m=0;mp.rules[m]={apply:v=>p[bh].push([m,v])}),p})(t):null,l=(a||t).rules,c=`.${i}${r.length>1?`:where(.${r.slice(1).join(".")})`:""}`,u=h=>{h=typeof h=="object"&&h||zY;const{css:p,...m}=h,v={};for(const g in s)if(delete m[g],g in h){let x=h[g];typeof x=="object"&&x?v[g]={"@initial":s[g],...x}:(x=String(x),v[g]=x!=="undefined"||o.has(g)?x:s[g])}else v[g]=s[g];const y=new Set([...r]);for(const[g,x,A,M]of e.composers){t.rules.styled.cache.has(g)||(t.rules.styled.cache.add(g),Af(x,[`.${g}`],[],n,R=>{l.styled.apply(R)}));const w=QI(A,v,n.media),b=QI(M,v,n.media,!0);for(const R of w)if(R!==void 0)for(const[D,C,I]of R){const O=`${g}-${Nc(C)}-${D}`;y.add(O);const H=(I?t.rules.resonevar:t.rules.onevar).cache,J=I?l.resonevar:l.onevar;H.has(O)||(H.add(O),Af(C,[`.${O}`],[],n,k=>{J.apply(k)}))}for(const R of b)if(R!==void 0)for(const[D,C]of R){const I=`${g}-${Nc(C)}-${D}`;y.add(I),t.rules.allvar.cache.has(I)||(t.rules.allvar.cache.add(I),Af(C,[`.${I}`],[],n,O=>{l.allvar.apply(O)}))}}if(typeof p=="object"&&p){const g=`${i}-i${Nc(p)}-css`;y.add(g),t.rules.inline.cache.has(g)||(t.rules.inline.cache.add(g),Af(p,[`.${g}`],[],n,x=>{l.inline.apply(x)}))}for(const g of String(h.className||"").trim().split(/\s+/))g&&y.add(g);const _=m.className=[...y].join(" ");return{type:e.type,className:_,selector:c,props:m,toString:()=>_,deferredInjector:a}};return HT(u,{className:i,selector:c,[Fc]:e,toString:()=>(t.rules.styled.cache.has(i)||u(),i)})},kY=n=>{let e="";const t=[],i={},r=[];for(const[s,,,,o,a]of n){e===""&&(e=s),t.push(s),r.push(...a);for(const l in o){const c=o[l];(i[l]===void 0||c!=="undefined"||a.includes(c))&&(i[l]=c)}}return[e,t,i,new Set(r)]},QI=(n,e,t,i)=>{const r=[];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,v,y=0;for(const _ in p){if(h===String(p[_])){if(_!=="@initial"){const g=_.slice(1);(v=v||[]).push(g in t?t[g]:_.replace(/^@media ?/,"")),u=!0}c+=y,m=!0}++y}if(v&&v.length&&(o={["@media "+v.join(", ")]:o}),!m)continue e}}}(r[c]=r[c]||[]).push([i?"cv":`${l}-${s[l]}`,o,u])}return r},zY={},HY=bd(),GY=(n,e)=>HY(n,()=>(...t)=>{const i=()=>{for(let r of t){r=typeof r=="object"&&r||{};let s=Nc(r);if(!e.rules.global.cache.has(s)){if(e.rules.global.cache.add(s),"@import"in r){let o=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let a of[].concat(r["@import"]))a=a.includes('"')||a.includes("'")?a:`"${a}"`,e.sheet.insertRule(`@import ${a};`,o++);delete r["@import"]}Af(r,[],[],n,o=>{e.rules.global.apply(o)})}}return""};return HT(i,{toString:i})}),VY=bd(),WY=(n,e)=>VY(n,()=>t=>{const i=`${_a(n.prefix)}k-${Nc(t)}`,r=()=>{if(!e.rules.global.cache.has(i)){e.rules.global.cache.add(i);const s=[];Af(t,[],[],n,a=>s.push(a));const o=`@keyframes ${i}{${s.join("")}}`;e.rules.global.apply(o)}return i};return HT(r,{get name(){return r()},toString:r})}),$Y=class{constructor(n,e,t,i){this.token=n==null?"":String(n),this.value=e==null?"":String(e),this.scale=t==null?"":String(t),this.prefix=i==null?"":String(i)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+_a(this.prefix)+_a(this.scale)+this.token}toString(){return this.computedValue}},XY=bd(),jY=(n,e)=>XY(n,()=>(t,i)=>{i=typeof t=="object"&&t||Object(i);const r=`.${t=(t=typeof t=="string"?t:"")||`${_a(n.prefix)}t-${Nc(i)}`}`,s={},o=[];for(const l in i){s[l]={};for(const c in i[l]){const u=`--${_a(n.prefix)}${l}-${c}`,h=fU(String(i[l][c]),n.prefix,l);s[l][c]=new $Y(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=`${i===n.theme?":root,":""}.${t}{${o.join(";")}}`;e.rules.themed.apply(l)}return t};return{...s,get className(){return a()},selector:r,toString:a}}),JY=bd(),KY=bd(),YY=n=>{const e=(t=>{let i=!1;const r=JY(t,s=>{i=!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||{...EY},utils:typeof s.utils=="object"&&s.utils||{}},h=LY(l),p={css:YI(u,h),globalCss:GY(u,h),keyframes:WY(u,h),createTheme:jY(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 i||r.reset(),r})(n);return e.styled=(({config:t,sheet:i})=>KY(t,()=>{const r=YI(t,i);return(...s)=>{const o=r(...s),a=o[Fc].type,l=X.forwardRef((c,u)=>{const h=c&&c.as||a,{props:p,deferredInjector:m}=o(c);return delete p.as,p.ref=u,m?X.createElement(X.Fragment,null,X.createElement(h,p),X.createElement(m,null)):X.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[Fc]=o[Fc],l}}))(e),e};function Zo(n,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(n==null||n(r),t===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}function dU(n,e=[]){let t=[];function i(s,o){const a=B.createContext(o),l=t.length;t=[...t,o];function c(h){const{scope:p,children:m,...v}=h,y=(p==null?void 0:p[n][l])||a,_=B.useMemo(()=>v,Object.values(v));return B.createElement(y.Provider,{value:_},m)}function u(h,p){const m=(p==null?void 0:p[n][l])||a,v=B.useContext(m);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const r=()=>{const s=t.map(o=>B.createContext(o));return function(a){const l=(a==null?void 0:a[n])||s;return B.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,QY(r,...e)]}function QY(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return B.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function Cd(n){const e=B.useRef(n);return B.useEffect(()=>{e.current=n}),B.useMemo(()=>(...t)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...t)},[])}function qY(n,e=globalThis==null?void 0:globalThis.document){const t=Cd(n);B.useEffect(()=>{const i=r=>{r.key==="Escape"&&t(r)};return e.addEventListener("keydown",i),()=>e.removeEventListener("keydown",i)},[t,e])}const YE="dismissableLayer.update",ZY="dismissableLayer.pointerDownOutside",eQ="dismissableLayer.focusOutside";let qI;const tQ=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nQ=B.forwardRef((n,e)=>{var t;const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=n,u=B.useContext(tQ),[h,p]=B.useState(null),m=(t=h==null?void 0:h.ownerDocument)!==null&&t!==void 0?t:globalThis==null?void 0:globalThis.document,[,v]=B.useState({}),y=Td(e,D=>p(D)),_=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=_.indexOf(g),A=h?_.indexOf(h):-1,M=u.layersWithOutsidePointerEventsDisabled.size>0,w=A>=x,b=iQ(D=>{const C=D.target,I=[...u.branches].some(O=>O.contains(C));!w||I||(s==null||s(D),a==null||a(D),D.defaultPrevented||l==null||l())},m),R=rQ(D=>{const C=D.target;[...u.branches].some(O=>O.contains(C))||(o==null||o(D),a==null||a(D),D.defaultPrevented||l==null||l())},m);return qY(D=>{A===u.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},m),B.useEffect(()=>{if(h)return i&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(qI=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(h)),u.layers.add(h),ZI(),()=>{i&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=qI)}},[h,m,i,u]),B.useEffect(()=>()=>{h&&(u.layers.delete(h),u.layersWithOutsidePointerEventsDisabled.delete(h),ZI())},[h,u]),B.useEffect(()=>{const D=()=>v({});return document.addEventListener(YE,D),()=>document.removeEventListener(YE,D)},[]),B.createElement(uu.div,gn({},c,{ref:y,style:{pointerEvents:M?w?"auto":"none":void 0,...n.style},onFocusCapture:Zo(n.onFocusCapture,R.onFocusCapture),onBlurCapture:Zo(n.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Zo(n.onPointerDownCapture,b.onPointerDownCapture)}))});function iQ(n,e=globalThis==null?void 0:globalThis.document){const t=Cd(n),i=B.useRef(!1),r=B.useRef(()=>{});return B.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let u=function(){hU(ZY,t,c,{discrete:!0})};var l=u;const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=u,e.addEventListener("click",r.current,{once:!0})):u()}else e.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",r.current)}},[e,t]),{onPointerDownCapture:()=>i.current=!0}}function rQ(n,e=globalThis==null?void 0:globalThis.document){const t=Cd(n),i=B.useRef(!1);return B.useEffect(()=>{const r=s=>{s.target&&!i.current&&hU(eQ,t,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,t]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function ZI(){const n=new CustomEvent(YE);document.dispatchEvent(n)}function hU(n,e,t,{discrete:i}){const r=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&r.addEventListener(n,e,{once:!0}),i?gY(r,s):r.dispatchEvent(s)}const ad=globalThis!=null&&globalThis.document?B.useLayoutEffect:()=>{},sQ=JH["useId".toString()]||(()=>{});let oQ=0;function aQ(n){const[e,t]=B.useState(sQ());return ad(()=>{n||t(i=>i??String(oQ++))},[n]),n||(e?`radix-${e}`:"")}const lQ=["top","right","bottom","left"],Pl=Math.min,Ur=Math.max,vy=Math.round,J0=Math.floor,Il=n=>({x:n,y:n}),cQ={left:"right",right:"left",bottom:"top",top:"bottom"},uQ={start:"end",end:"start"};function QE(n,e,t){return Ur(n,Pl(e,t))}function xa(n,e){return typeof n=="function"?n(e):n}function Sa(n){return n.split("-")[0]}function Rd(n){return n.split("-")[1]}function GT(n){return n==="x"?"y":"x"}function VT(n){return n==="y"?"height":"width"}function Pd(n){return["top","bottom"].includes(Sa(n))?"y":"x"}function WT(n){return GT(Pd(n))}function fQ(n,e,t){t===void 0&&(t=!1);const i=Rd(n),r=WT(n),s=VT(r);let o=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=yy(o)),[o,yy(o)]}function dQ(n){const e=yy(n);return[qE(n),e,qE(e)]}function qE(n){return n.replace(/start|end/g,e=>uQ[e])}function hQ(n,e,t){const i=["left","right"],r=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?s:o;default:return[]}}function pQ(n,e,t,i){const r=Rd(n);let s=hQ(Sa(n),t==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(qE)))),s}function yy(n){return n.replace(/left|right|bottom|top/g,e=>cQ[e])}function mQ(n){return{top:0,right:0,bottom:0,left:0,...n}}function pU(n){return typeof n!="number"?mQ(n):{top:n,right:n,bottom:n,left:n}}function _y(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function eB(n,e,t){let{reference:i,floating:r}=n;const s=Pd(e),o=WT(e),a=VT(o),l=Sa(e),c=s==="y",u=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,p=i[a]/2-r[a]/2;let m;switch(l){case"top":m={x:u,y:i.y-r.height};break;case"bottom":m={x:u,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:h};break;case"left":m={x:i.x-r.width,y:h};break;default:m={x:i.x,y:i.y}}switch(Rd(e)){case"start":m[o]-=p*(t&&c?-1:1);break;case"end":m[o]+=p*(t&&c?-1:1);break}return m}const gQ=async(n,e,t)=>{const{placement:i="bottom",strategy:r="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:r}),{x:u,y:h}=eB(c,i,l),p=i,m={},v=0;for(let y=0;y({name:"arrow",options:n,async fn(e){const{x:t,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=xa(n,e)||{};if(c==null)return{};const h=pU(u),p={x:t,y:i},m=WT(r),v=VT(m),y=await o.getDimensions(c),_=m==="y",g=_?"top":"left",x=_?"bottom":"right",A=_?"clientHeight":"clientWidth",M=s.reference[v]+s.reference[m]-p[m]-s.floating[v],w=p[m]-s.reference[m],b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let R=b?b[A]:0;(!R||!await(o.isElement==null?void 0:o.isElement(b)))&&(R=a.floating[A]||s.floating[v]);const D=M/2-w/2,C=R/2-y[v]/2-1,I=Pl(h[g],C),O=Pl(h[x],C),H=I,J=R-y[v]-O,k=R/2-y[v]/2+D,W=QE(H,k,J),q=!l.arrow&&Rd(r)!=null&&k!==W&&s.reference[v]/2-(kH<=0)){var C,I;const H=(((C=s.flip)==null?void 0:C.index)||0)+1,J=w[H];if(J)return{data:{index:H,overflows:D},reset:{placement:J}};let k=(I=D.filter(W=>W.overflows[0]<=0).sort((W,q)=>W.overflows[1]-q.overflows[1])[0])==null?void 0:I.placement;if(!k)switch(m){case"bestFit":{var O;const W=(O=D.map(q=>[q.placement,q.overflows.filter(Q=>Q>0).reduce((Q,z)=>Q+z,0)]).sort((q,Q)=>q[1]-Q[1])[0])==null?void 0:O[0];W&&(k=W);break}case"initialPlacement":k=a;break}if(r!==k)return{reset:{placement:k}}}return{}}}};function tB(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function nB(n){return lQ.some(e=>n[e]>=0)}const _Q=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:i="referenceHidden",...r}=xa(n,e);switch(i){case"referenceHidden":{const s=await Kp(e,{...r,elementContext:"reference"}),o=tB(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:nB(o)}}}case"escaped":{const s=await Kp(e,{...r,altBoundary:!0}),o=tB(s,t.floating);return{data:{escapedOffsets:o,escaped:nB(o)}}}default:return{}}}}};async function xQ(n,e){const{placement:t,platform:i,elements:r}=n,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Sa(t),a=Rd(t),l=Pd(t)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,h=xa(e,n);let{mainAxis:p,crossAxis:m,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&typeof v=="number"&&(m=a==="end"?v*-1:v),l?{x:m*u,y:p*c}:{x:p*c,y:m*u}}const SQ=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,i;const{x:r,y:s,placement:o,middlewareData:a}=e,l=await xQ(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:o}}}}},AQ=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:_=>{let{x:g,y:x}=_;return{x:g,y:x}}},...l}=xa(n,e),c={x:t,y:i},u=await Kp(e,l),h=Pd(Sa(r)),p=GT(h);let m=c[p],v=c[h];if(s){const _=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=m+u[_],A=m-u[g];m=QE(x,m,A)}if(o){const _=h==="y"?"top":"left",g=h==="y"?"bottom":"right",x=v+u[_],A=v-u[g];v=QE(x,v,A)}const y=a.fn({...e,[p]:m,[h]:v});return{...y,data:{x:y.x-t,y:y.y-i}}}}},EQ=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:i,placement:r,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=xa(n,e),u={x:t,y:i},h=Pd(r),p=GT(h);let m=u[p],v=u[h];const y=xa(a,e),_=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(l){const A=p==="y"?"height":"width",M=s.reference[p]-s.floating[A]+_.mainAxis,w=s.reference[p]+s.reference[A]-_.mainAxis;mw&&(m=w)}if(c){var g,x;const A=p==="y"?"width":"height",M=["top","left"].includes(Sa(r)),w=s.reference[h]-s.floating[A]+(M&&((g=o.offset)==null?void 0:g[h])||0)+(M?0:_.crossAxis),b=s.reference[h]+s.reference[A]+(M?0:((x=o.offset)==null?void 0:x[h])||0)-(M?_.crossAxis:0);vb&&(v=b)}return{[p]:m,[h]:v}}}},MQ=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:i,platform:r,elements:s}=e,{apply:o=()=>{},...a}=xa(n,e),l=await Kp(e,a),c=Sa(t),u=Rd(t),h=Pd(t)==="y",{width:p,height:m}=i.floating;let v,y;c==="top"||c==="bottom"?(v=c,y=u===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(y=c,v=u==="end"?"top":"bottom");const _=m-l[v],g=p-l[y],x=!e.middlewareData.shift;let A=_,M=g;if(h){const b=p-l.left-l.right;M=u||x?Pl(g,b):b}else{const b=m-l.top-l.bottom;A=u||x?Pl(_,b):b}if(x&&!u){const b=Ur(l.left,0),R=Ur(l.right,0),D=Ur(l.top,0),C=Ur(l.bottom,0);h?M=p-2*(b!==0||R!==0?b+R:Ur(l.left,l.right)):A=m-2*(D!==0||C!==0?D+C:Ur(l.top,l.bottom))}await o({...e,availableWidth:M,availableHeight:A});const w=await r.getDimensions(s.floating);return p!==w.width||m!==w.height?{reset:{rects:!0}}:{}}}};function Bl(n){return mU(n)?(n.nodeName||"").toLowerCase():"#document"}function $r(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function ba(n){var e;return(e=(mU(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function mU(n){return n instanceof Node||n instanceof $r(n).Node}function Aa(n){return n instanceof Element||n instanceof $r(n).Element}function Lo(n){return n instanceof HTMLElement||n instanceof $r(n).HTMLElement}function iB(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof $r(n).ShadowRoot}function Bm(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=Rs(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function wQ(n){return["table","td","th"].includes(Bl(n))}function $T(n){const e=XT(),t=Rs(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function gU(n){let e=ld(n);for(;Lo(e)&&!U_(e);){if($T(e))return e;e=ld(e)}return null}function XT(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function U_(n){return["html","body","#document"].includes(Bl(n))}function Rs(n){return $r(n).getComputedStyle(n)}function k_(n){return Aa(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function ld(n){if(Bl(n)==="html")return n;const e=n.assignedSlot||n.parentNode||iB(n)&&n.host||ba(n);return iB(e)?e.host:e}function vU(n){const e=ld(n);return U_(e)?n.ownerDocument?n.ownerDocument.body:n.body:Lo(e)&&Bm(e)?e:vU(e)}function Yp(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=vU(n),s=r===((i=n.ownerDocument)==null?void 0:i.body),o=$r(r);return s?e.concat(o,o.visualViewport||[],Bm(r)?r:[],o.frameElement&&t?Yp(o.frameElement):[]):e.concat(r,Yp(r,[],t))}function yU(n){const e=Rs(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=Lo(n),s=r?n.offsetWidth:t,o=r?n.offsetHeight:i,a=vy(t)!==s||vy(i)!==o;return a&&(t=s,i=o),{width:t,height:i,$:a}}function jT(n){return Aa(n)?n:n.contextElement}function Nf(n){const e=jT(n);if(!Lo(e))return Il(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:s}=yU(e);let o=(s?vy(t.width):t.width)/i,a=(s?vy(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const TQ=Il(0);function _U(n){const e=$r(n);return!XT()||!e.visualViewport?TQ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bQ(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==$r(n)?!1:e}function qc(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),s=jT(n);let o=Il(1);e&&(i?Aa(i)&&(o=Nf(i)):o=Nf(n));const a=bQ(s,t,i)?_U(s):Il(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,u=r.width/o.x,h=r.height/o.y;if(s){const p=$r(s),m=i&&Aa(i)?$r(i):i;let v=p.frameElement;for(;v&&i&&m!==p;){const y=Nf(v),_=v.getBoundingClientRect(),g=Rs(v),x=_.left+(v.clientLeft+parseFloat(g.paddingLeft))*y.x,A=_.top+(v.clientTop+parseFloat(g.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,h*=y.y,l+=x,c+=A,v=$r(v).frameElement}}return _y({width:u,height:h,x:l,y:c})}const CQ=[":popover-open",":modal"];function xU(n){let e=!1,t=0,i=0;function r(o){try{e=e||n.matches(o)}catch{}}CQ.forEach(o=>{r(o)});const s=gU(n);if(e&&s){const o=s.getBoundingClientRect();t=o.x,i=o.y}return[e,t,i]}function RQ(n){let{elements:e,rect:t,offsetParent:i,strategy:r}=n;const s=ba(i),[o]=e?xU(e.floating):[!1];if(i===s||o)return t;let a={scrollLeft:0,scrollTop:0},l=Il(1);const c=Il(0),u=Lo(i);if((u||!u&&r!=="fixed")&&((Bl(i)!=="body"||Bm(s))&&(a=k_(i)),Lo(i))){const h=qc(i);l=Nf(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-a.scrollLeft*l.x+c.x,y:t.y*l.y-a.scrollTop*l.y+c.y}}function PQ(n){return Array.from(n.getClientRects())}function SU(n){return qc(ba(n)).left+k_(n).scrollLeft}function IQ(n){const e=ba(n),t=k_(n),i=n.ownerDocument.body,r=Ur(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Ur(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+SU(n);const a=-t.scrollTop;return Rs(i).direction==="rtl"&&(o+=Ur(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function BQ(n,e){const t=$r(n),i=ba(n),r=t.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;const c=XT();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a,y:l}}function DQ(n,e){const t=qc(n,!0,e==="fixed"),i=t.top+n.clientTop,r=t.left+n.clientLeft,s=Lo(n)?Nf(n):Il(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:o,height:a,x:l,y:c}}function rB(n,e,t){let i;if(e==="viewport")i=BQ(n,t);else if(e==="document")i=IQ(ba(n));else if(Aa(e))i=DQ(e,t);else{const r=_U(n);i={...e,x:e.x-r.x,y:e.y-r.y}}return _y(i)}function AU(n,e){const t=ld(n);return t===e||!Aa(t)||U_(t)?!1:Rs(t).position==="fixed"||AU(t,e)}function LQ(n,e){const t=e.get(n);if(t)return t;let i=Yp(n,[],!1).filter(a=>Aa(a)&&Bl(a)!=="body"),r=null;const s=Rs(n).position==="fixed";let o=s?ld(n):n;for(;Aa(o)&&!U_(o);){const a=Rs(o),l=$T(o);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Bm(o)&&!l&&AU(n,o))?i=i.filter(u=>u!==o):r=a,o=ld(o)}return e.set(n,i),i}function OQ(n){let{element:e,boundary:t,rootBoundary:i,strategy:r}=n;const o=[...t==="clippingAncestors"?LQ(e,this._c):[].concat(t),i],a=o[0],l=o.reduce((c,u)=>{const h=rB(e,u,r);return c.top=Ur(h.top,c.top),c.right=Pl(h.right,c.right),c.bottom=Pl(h.bottom,c.bottom),c.left=Ur(h.left,c.left),c},rB(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function FQ(n){const{width:e,height:t}=yU(n);return{width:e,height:t}}function NQ(n,e,t,i){const r=Lo(e),s=ba(e),o=t==="fixed",a=qc(n,!0,o,e);let l={scrollLeft:0,scrollTop:0};const c=Il(0);if(r||!r&&!o)if((Bl(e)!=="body"||Bm(s))&&(l=k_(e)),r){const y=qc(e,!0,o,e);c.x=y.x+e.clientLeft,c.y=y.y+e.clientTop}else s&&(c.x=SU(s));let u=a.left+l.scrollLeft-c.x,h=a.top+l.scrollTop-c.y;const[p,m,v]=xU(i);return p&&(u+=m,h+=v,r&&(u+=e.clientLeft,h+=e.clientTop)),{x:u,y:h,width:a.width,height:a.height}}function sB(n,e){return!Lo(n)||Rs(n).position==="fixed"?null:e?e(n):n.offsetParent}function EU(n,e){const t=$r(n);if(!Lo(n))return t;let i=sB(n,e);for(;i&&wQ(i)&&Rs(i).position==="static";)i=sB(i,e);return i&&(Bl(i)==="html"||Bl(i)==="body"&&Rs(i).position==="static"&&!$T(i))?t:i||gU(n)||t}const UQ=async function(n){const e=this.getOffsetParent||EU,t=this.getDimensions;return{reference:NQ(n.reference,await e(n.floating),n.strategy,n.floating),floating:{x:0,y:0,...await t(n.floating)}}};function kQ(n){return Rs(n).direction==="rtl"}const zQ={convertOffsetParentRelativeRectToViewportRelativeRect:RQ,getDocumentElement:ba,getClippingRect:OQ,getOffsetParent:EU,getElementRects:UQ,getClientRects:PQ,getDimensions:FQ,getScale:Nf,isElement:Aa,isRTL:kQ};function HQ(n,e){let t=null,i;const r=ba(n);function s(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:h,height:p}=n.getBoundingClientRect();if(a||e(),!h||!p)return;const m=J0(u),v=J0(r.clientWidth-(c+h)),y=J0(r.clientHeight-(u+p)),_=J0(c),x={rootMargin:-m+"px "+-v+"px "+-y+"px "+-_+"px",threshold:Ur(0,Pl(1,l))||1};let A=!0;function M(w){const b=w[0].intersectionRatio;if(b!==l){if(!A)return o();b?o(!1,b):i=setTimeout(()=>{o(!1,1e-7)},100)}A=!1}try{t=new IntersectionObserver(M,{...x,root:r.ownerDocument})}catch{t=new IntersectionObserver(M,x)}t.observe(n)}return o(!0),s}function GQ(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=jT(n),u=r||s?[...c?Yp(c):[],...Yp(e)]:[];u.forEach(g=>{r&&g.addEventListener("scroll",t,{passive:!0}),s&&g.addEventListener("resize",t)});const h=c&&a?HQ(c,t):null;let p=-1,m=null;o&&(m=new ResizeObserver(g=>{let[x]=g;x&&x.target===c&&m&&(m.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var A;(A=m)==null||A.observe(e)})),t()}),c&&!l&&m.observe(c),m.observe(e));let v,y=l?qc(n):null;l&&_();function _(){const g=qc(n);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&t(),y=g,v=requestAnimationFrame(_)}return t(),()=>{var g;u.forEach(x=>{r&&x.removeEventListener("scroll",t),s&&x.removeEventListener("resize",t)}),h==null||h(),(g=m)==null||g.disconnect(),m=null,l&&cancelAnimationFrame(v)}}const VQ=AQ,WQ=yQ,$Q=MQ,XQ=_Q,oB=vQ,jQ=EQ,JQ=(n,e,t)=>{const i=new Map,r={platform:zQ,...t},s={...r.platform,_c:i};return gQ(n,e,{...r,platform:s})},KQ=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:i,padding:r}=typeof n=="function"?n(t):n;return i&&e(i)?i.current!=null?oB({element:i.current,padding:r}).fn(t):{}:i?oB({element:i,padding:r}).fn(t):{}}}};var wv=typeof document<"u"?B.useLayoutEffect:B.useEffect;function xy(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,i,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(i=t;i--!==0;)if(!xy(n[i],e[i]))return!1;return!0}if(r=Object.keys(n),t=r.length,t!==Object.keys(e).length)return!1;for(i=t;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=t;i--!==0;){const s=r[i];if(!(s==="_owner"&&n.$$typeof)&&!xy(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function MU(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function aB(n,e){const t=MU(n);return Math.round(e*t)/t}function lB(n){const e=B.useRef(n);return wv(()=>{e.current=n}),e}function YQ(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,h]=B.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[p,m]=B.useState(i);xy(p,i)||m(i);const[v,y]=B.useState(null),[_,g]=B.useState(null),x=B.useCallback(Q=>{Q!==b.current&&(b.current=Q,y(Q))},[]),A=B.useCallback(Q=>{Q!==R.current&&(R.current=Q,g(Q))},[]),M=s||v,w=o||_,b=B.useRef(null),R=B.useRef(null),D=B.useRef(u),C=l!=null,I=lB(l),O=lB(r),H=B.useCallback(()=>{if(!b.current||!R.current)return;const Q={placement:e,strategy:t,middleware:p};O.current&&(Q.platform=O.current),JQ(b.current,R.current,Q).then(z=>{const j={...z,isPositioned:!0};J.current&&!xy(D.current,j)&&(D.current=j,fm.flushSync(()=>{h(j)}))})},[p,e,t,O]);wv(()=>{c===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,h(Q=>({...Q,isPositioned:!1})))},[c]);const J=B.useRef(!1);wv(()=>(J.current=!0,()=>{J.current=!1}),[]),wv(()=>{if(M&&(b.current=M),w&&(R.current=w),M&&w){if(I.current)return I.current(M,w,H);H()}},[M,w,H,I,C]);const k=B.useMemo(()=>({reference:b,floating:R,setReference:x,setFloating:A}),[x,A]),W=B.useMemo(()=>({reference:M,floating:w}),[M,w]),q=B.useMemo(()=>{const Q={position:t,left:0,top:0};if(!W.floating)return Q;const z=aB(W.floating,u.x),j=aB(W.floating,u.y);return a?{...Q,transform:"translate("+z+"px, "+j+"px)",...MU(W.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:z,top:j}},[t,a,W.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:H,refs:k,elements:W,floatingStyles:q}),[u,H,k,W,q])}const QQ=B.forwardRef((n,e)=>{const{children:t,width:i=10,height:r=5,...s}=n;return B.createElement(uu.svg,gn({},s,{ref:e,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),n.asChild?t:B.createElement("polygon",{points:"0,0 30,0 15,10"}))}),qQ=QQ;function ZQ(n){const[e,t]=B.useState(void 0);return ad(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[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 i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}const wU="Popper",[TU,bU]=dU(wU),[eq,CU]=TU(wU),tq=n=>{const{__scopePopper:e,children:t}=n,[i,r]=B.useState(null);return B.createElement(eq,{scope:e,anchor:i,onAnchorChange:r},t)},nq="PopperAnchor",iq=B.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:i,...r}=n,s=CU(nq,t),o=B.useRef(null),a=Td(e,o);return B.useEffect(()=>{s.onAnchorChange((i==null?void 0:i.current)||o.current)}),i?null:B.createElement(uu.div,gn({},r,{ref:a}))}),RU="PopperContent",[rq,sq]=TU(RU),oq=B.forwardRef((n,e)=>{var t,i,r,s,o,a,l,c;const{__scopePopper:u,side:h="bottom",sideOffset:p=0,align:m="center",alignOffset:v=0,arrowPadding:y=0,avoidCollisions:_=!0,collisionBoundary:g=[],collisionPadding:x=0,sticky:A="partial",hideWhenDetached:M=!1,updatePositionStrategy:w="optimized",onPlaced:b,...R}=n,D=CU(RU,u),[C,I]=B.useState(null),O=Td(e,_e=>I(_e)),[H,J]=B.useState(null),k=ZQ(H),W=(t=k==null?void 0:k.width)!==null&&t!==void 0?t:0,q=(i=k==null?void 0:k.height)!==null&&i!==void 0?i:0,Q=h+(m!=="center"?"-"+m:""),z=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},j=Array.isArray(g)?g:[g],K=j.length>0,V={padding:z,boundary:j.filter(uq),altBoundary:K},{refs:Y,floatingStyles:de,placement:ge,isPositioned:ve,middlewareData:Ce}=YQ({strategy:"fixed",placement:Q,whileElementsMounted:(..._e)=>GQ(..._e,{animationFrame:w==="always"}),elements:{reference:D.anchor},middleware:[SQ({mainAxis:p+q,alignmentAxis:v}),_&&VQ({mainAxis:!0,crossAxis:!1,limiter:A==="partial"?jQ():void 0,...V}),_&&WQ({...V}),$Q({...V,apply:({elements:_e,rects:me,availableWidth:He,availableHeight:De})=>{const{width:ke,height:qe}=me.reference,ft=_e.floating.style;ft.setProperty("--radix-popper-available-width",`${He}px`),ft.setProperty("--radix-popper-available-height",`${De}px`),ft.setProperty("--radix-popper-anchor-width",`${ke}px`),ft.setProperty("--radix-popper-anchor-height",`${qe}px`)}}),H&&KQ({element:H,padding:y}),fq({arrowWidth:W,arrowHeight:q}),M&&XQ({strategy:"referenceHidden",...V})]}),[Ue,Ve]=PU(ge),Qe=Cd(b);ad(()=>{ve&&(Qe==null||Qe())},[ve,Qe]);const tt=(r=Ce.arrow)===null||r===void 0?void 0:r.x,Ee=(s=Ce.arrow)===null||s===void 0?void 0:s.y,$=((o=Ce.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[ye,fe]=B.useState();return ad(()=>{C&&fe(window.getComputedStyle(C).zIndex)},[C]),B.createElement("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...de,transform:ve?de.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ye,"--radix-popper-transform-origin":[(a=Ce.transformOrigin)===null||a===void 0?void 0:a.x,(l=Ce.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:n.dir},B.createElement(rq,{scope:u,placedSide:Ue,onArrowChange:J,arrowX:tt,arrowY:Ee,shouldHideArrow:$},B.createElement(uu.div,gn({"data-side":Ue,"data-align":Ve},R,{ref:O,style:{...R.style,animation:ve?void 0:"none",opacity:(c=Ce.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))}),aq="PopperArrow",lq={top:"bottom",right:"left",bottom:"top",left:"right"},cq=B.forwardRef(function(e,t){const{__scopePopper:i,...r}=e,s=sq(aq,i),o=lq[s.placedSide];return B.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}},B.createElement(qQ,gn({},r,{ref:t,style:{...r.style,display:"block"}})))});function uq(n){return n!==null}const fq=n=>({name:"transformOrigin",options:n,fn(e){var t,i,r,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,[v,y]=PU(a),_={start:"0%",center:"50%",end:"100%"}[y],g=((i=(r=c.arrow)===null||r===void 0?void 0:r.x)!==null&&i!==void 0?i:0)+p/2,x=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+m/2;let A="",M="";return v==="bottom"?(A=h?_:`${g}px`,M=`${-m}px`):v==="top"?(A=h?_:`${g}px`,M=`${l.floating.height+m}px`):v==="right"?(A=`${-m}px`,M=h?_:`${x}px`):v==="left"&&(A=`${l.floating.width+m}px`,M=h?_:`${x}px`),{data:{x:A,y:M}}}});function PU(n){const[e,t="center"]=n.split("-");return[e,t]}const dq=tq,hq=iq,pq=oq,mq=cq;function gq(n,e){return B.useReducer((t,i)=>{const r=e[t][i];return r??t},n)}const IU=n=>{const{present:e,children:t}=n,i=vq(e),r=typeof t=="function"?t({present:i.isPresent}):B.Children.only(t),s=Td(i.ref,r.ref);return typeof t=="function"||i.isPresent?B.cloneElement(r,{ref:s}):null};IU.displayName="Presence";function vq(n){const[e,t]=B.useState(),i=B.useRef({}),r=B.useRef(n),s=B.useRef("none"),o=n?"mounted":"unmounted",[a,l]=gq(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B.useEffect(()=>{const c=K0(i.current);s.current=a==="mounted"?c:"none"},[a]),ad(()=>{const c=i.current,u=r.current;if(u!==n){const p=s.current,m=K0(c);n?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==m?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),ad(()=>{if(e){const c=h=>{const m=K0(i.current).includes(h.animationName);h.target===e&&m&&fm.flushSync(()=>l("ANIMATION_END"))},u=h=>{h.target===e&&(s.current=K0(i.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:B.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function K0(n){return(n==null?void 0:n.animationName)||"none"}function yq({prop:n,defaultProp:e,onChange:t=()=>{}}){const[i,r]=_q({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:i,a=Cd(t),l=B.useCallback(c=>{if(s){const h=typeof c=="function"?c(n):c;h!==n&&a(h)}else r(c)},[s,n,r,a]);return[o,l]}function _q({defaultProp:n,onChange:e}){const t=B.useState(n),[i]=t,r=B.useRef(i),s=Cd(e);return B.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),t}const xq=B.forwardRef((n,e)=>B.createElement(uu.span,gn({},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}}))),Sq=xq,[z_,Hoe]=dU("Tooltip",[bU]),H_=bU(),Aq="TooltipProvider",ZE="tooltip.open",[Goe,JT]=z_(Aq),KT="Tooltip",[Eq,G_]=z_(KT),Mq=n=>{const{__scopeTooltip:e,children:t,open:i,defaultOpen:r=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=n,l=JT(KT,n.__scopeTooltip),c=H_(e),[u,h]=B.useState(null),p=aQ(),m=B.useRef(0),v=o??l.disableHoverableContent,y=a??l.delayDuration,_=B.useRef(!1),[g=!1,x]=yq({prop:i,defaultProp:r,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(ZE))):l.onClose(),s==null||s(R)}}),A=B.useMemo(()=>g?_.current?"delayed-open":"instant-open":"closed",[g]),M=B.useCallback(()=>{window.clearTimeout(m.current),_.current=!1,x(!0)},[x]),w=B.useCallback(()=>{window.clearTimeout(m.current),x(!1)},[x]),b=B.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,x(!0)},y)},[y,x]);return B.useEffect(()=>()=>window.clearTimeout(m.current),[]),B.createElement(dq,c,B.createElement(Eq,{scope:e,contentId:p,open:g,stateAttribute:A,trigger:u,onTriggerChange:h,onTriggerEnter:B.useCallback(()=>{l.isOpenDelayed?b():M()},[l.isOpenDelayed,b,M]),onTriggerLeave:B.useCallback(()=>{v?w():window.clearTimeout(m.current)},[w,v]),onOpen:M,onClose:w,disableHoverableContent:v},t))},cB="TooltipTrigger",wq=B.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=G_(cB,t),s=JT(cB,t),o=H_(t),a=B.useRef(null),l=Td(e,a,r.onTriggerChange),c=B.useRef(!1),u=B.useRef(!1),h=B.useCallback(()=>c.current=!1,[]);return B.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),B.createElement(hq,gn({asChild:!0},o),B.createElement(uu.button,gn({"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute},i,{ref:l,onPointerMove:Zo(n.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),u.current=!0)}),onPointerLeave:Zo(n.onPointerLeave,()=>{r.onTriggerLeave(),u.current=!1}),onPointerDown:Zo(n.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Zo(n.onFocus,()=>{c.current||r.onOpen()}),onBlur:Zo(n.onBlur,r.onClose),onClick:Zo(n.onClick,r.onClose)})))}),Tq="TooltipPortal",[Voe,bq]=z_(Tq,{forceMount:void 0}),Qp="TooltipContent",Cq=B.forwardRef((n,e)=>{const t=bq(Qp,n.__scopeTooltip),{forceMount:i=t.forceMount,side:r="top",...s}=n,o=G_(Qp,n.__scopeTooltip);return B.createElement(IU,{present:i||o.open},o.disableHoverableContent?B.createElement(BU,gn({side:r},s,{ref:e})):B.createElement(Rq,gn({side:r},s,{ref:e})))}),Rq=B.forwardRef((n,e)=>{const t=G_(Qp,n.__scopeTooltip),i=JT(Qp,n.__scopeTooltip),r=B.useRef(null),s=Td(e,r),[o,a]=B.useState(null),{trigger:l,onClose:c}=t,u=r.current,{onPointerInTransitChange:h}=i,p=B.useCallback(()=>{a(null),h(!1)},[h]),m=B.useCallback((v,y)=>{const _=v.currentTarget,g={x:v.clientX,y:v.clientY},x=Lq(g,_.getBoundingClientRect()),A=Oq(g,x),M=Fq(y.getBoundingClientRect()),w=Uq([...A,...M]);a(w),h(!0)},[h]);return B.useEffect(()=>()=>p(),[p]),B.useEffect(()=>{if(l&&u){const v=_=>m(_,u),y=_=>m(_,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",y)}}},[l,u,m,p]),B.useEffect(()=>{if(o){const v=y=>{const _=y.target,g={x:y.clientX,y:y.clientY},x=(l==null?void 0:l.contains(_))||(u==null?void 0:u.contains(_)),A=!Nq(g,o);x?p():A&&(p(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,o,c,p]),B.createElement(BU,gn({},n,{ref:s}))}),[Pq,Iq]=z_(KT,{isInside:!1}),BU=B.forwardRef((n,e)=>{const{__scopeTooltip:t,children:i,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=n,l=G_(Qp,t),c=H_(t),{onClose:u}=l;return B.useEffect(()=>(document.addEventListener(ZE,u),()=>document.removeEventListener(ZE,u)),[u]),B.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]),B.createElement(nQ,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:u},B.createElement(pq,gn({"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)"}}),B.createElement(oU,null,i),B.createElement(Pq,{scope:t,isInside:!0},B.createElement(Sq,{id:l.contentId,role:"tooltip"},r||i))))}),Bq="TooltipArrow",Dq=B.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=H_(t);return Iq(Bq,t).isInside?null:B.createElement(mq,gn({},r,i,{ref:e}))});function Lq(n,e){const t=Math.abs(e.top-n.y),i=Math.abs(e.bottom-n.y),r=Math.abs(e.right-n.x),s=Math.abs(e.left-n.x);switch(Math.min(t,i,r,s)){case s:return"left";case r:return"right";case t:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function Oq(n,e,t=5){const i=[];switch(e){case"top":i.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":i.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":i.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":i.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return i}function Fq(n){const{top:e,right:t,bottom:i,left:r}=n;return[{x:r,y:e},{x:t,y:e},{x:t,y:i},{x:r,y:i}]}function Nq(n,e){const{x:t,y:i}=n;let r=!1;for(let s=0,o=e.length-1;si!=u>i&&t<(c-a)*(i-l)/(u-l)+a&&(r=!r)}return r}function Uq(n){const e=n.slice();return e.sort((t,i)=>t.xi.x?1:t.yi.y?1:0),kq(e)}function kq(n){if(n.length<=1)return n.slice();const e=[];for(let i=0;i=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))e.pop();else break}e.push(r)}e.pop();const t=[];for(let i=n.length-1;i>=0;i--){const r=n[i];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}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 zq=Mq,Hq=wq,Gq=Cq,Vq=Dq;function Wq(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}function un(n,e){if(n==null)return{};var t=Wq(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}let wn;(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"})(wn||(wn={}));const $q={[wn.UNSUPPORTED_INPUT]:(n,e)=>[`An input with type \`${n}\` input was found at path \`${e}\` but it's not supported yet.`],[wn.NO_COMPONENT_FOR_TYPE]:(n,e)=>[`Type \`${n}\` found at path \`${e}\` can't be displayed in panel because no component supports it yet.`],[wn.UNKNOWN_INPUT]:(n,e)=>[`input at path \`${n}\` is not recognized.`,e],[wn.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.`],[wn.ALREADY_REGISTERED_TYPE]:n=>[`Type ${n} has already been registered. You can't register a component with the same type.`],[wn.CLIPBOARD_ERROR]:n=>["Error copying the value",n],[wn.THEME_ERROR]:(n,e)=>[`Error accessing the theme \`${n}.${e}\` value.`],[wn.PATH_DOESNT_EXIST]:n=>[`Error getting the value at path \`${n}\`. There is probably an error in your \`render\` function.`],[wn.PATH_DOESNT_EXIST]:n=>[`Error accessing the value at path \`${n}\``],[wn.INPUT_TYPE_OVERRIDE]:(n,e,t)=>[`Input at path \`${n}\` already exists with type: \`${e}\`. Its type cannot be overridden with type \`${t}\`.`],[wn.EMPTY_KEY]:()=>["Keys can not be empty, if you want to hide a label use whitespace."]};function DU(n,e,...t){const[i,...r]=$q[e](...t);console[n]("LEVA: "+i,...r)}const na=DU.bind(null,"warn"),Xq=DU.bind(null,"log"),jq=["value"],Jq=["schema"],Kq=["value"],LU=[],Zc={};function uB(n){let{value:e}=n,t=un(n,jq);for(let i of LU){const r=i(e,t);if(r)return r}}function Ca(n,e){let{schema:t}=e,i=un(e,Jq);if(n in Zc){na(wn.ALREADY_REGISTERED_TYPE,n);return}LU.push((r,s)=>t(r,s)&&n),Zc[n]=i}function TS(n,e,t,i){const{normalize:r}=Zc[n];if(r)return r(e,t,i);if(typeof e!="object"||!("value"in e))return{value:e};const{value:s}=e,o=un(e,Kq);return{value:s,settings:o}}function Yq(n,e,t,i,r,s){const{sanitize:o}=Zc[n];return o?o(e,t,i,r,s):e}function fB(n,e,t){const{format:i}=Zc[n];return i?i(e,t):e}function Qq(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dB(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function At(n){for(var e=1;en>t?t:n{if(n===""||typeof n=="number")return n;try{const e=Ja(n);if(!isNaN(e))return e}catch{}return parseFloat(n)},Zq=Math.log(10);function hB(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)/Zq)+1,i=Math.floor(Math.log10(Math.abs(n))),r=Math.pow(10,i-t);return Math.max(r,.001)}const Sy=(n,e,t)=>t===e?0:(Dl(n,e,t)-e)/(t-e),Ay=(n,e,t)=>n*(t-e)+e,eZ=()=>"_"+Math.random().toString(36).substr(2,9),pB=/\(([0-9+\-*/^ .]+)\)/,mB=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,gB=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,vB=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,yB=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,_B=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function Ja(n){if(isNaN(Number(n)))if(pB.test(n)){const e=n.replace(pB,(t,i)=>String(Ja(i)));return Ja(e)}else if(mB.test(n)){const e=n.replace(mB,(t,i,r)=>String(Math.pow(Number(i),Number(r))));return Ja(e)}else if(gB.test(n)){const e=n.replace(gB,(t,i,r)=>String(Number(i)*Number(r)));return Ja(e)}else if(vB.test(n)){const e=n.replace(vB,(t,i,r)=>{if(r!=0)return String(Number(i)/Number(r));throw new Error("Division by zero")});return Ja(e)}else if(yB.test(n)){const e=n.replace(yB,(t,i,r)=>String(Number(i)+Number(r)));return Ja(e)}else if(_B.test(n)){const e=n.replace(_B,(t,i,r)=>String(Number(i)-Number(r)));return Ja(e)}else return Number(n);return Number(n)}function tZ(n,e){const t=At({},n);return e.forEach(i=>i in n&&delete t[i]),t}function nZ(n,e){return n.reduce((t,i,r)=>Object.assign(t,{[e[r]]:i}),{})}function OU(n){return Object.prototype.toString.call(n)==="[object Object]"}const iZ=n=>OU(n)&&Object.keys(n).length===0;let Po;(function(n){n.BUTTON="BUTTON",n.BUTTON_GROUP="BUTTON_GROUP",n.MONITOR="MONITOR",n.FOLDER="FOLDER"})(Po||(Po={}));let Qs;(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"})(Qs||(Qs={}));const rZ=["type","__customInput"],sZ=["render","label","optional","order","disabled","hint","onChange","onEditStart","onEditEnd","transient"],oZ=["type"];function FU(n,e,t={},i){var r,s;if(typeof n!="object"||Array.isArray(n))return{type:i,input:n,options:At({key:e,label:e,optional:!1,disabled:!1,order:0},t)};if("__customInput"in n){const{type:w,__customInput:b}=n,R=un(n,rZ);return FU(b,e,R,w)}const{render:o,label:a,optional:l,order:c=0,disabled:u,hint:h,onChange:p,onEditStart:m,onEditEnd:v,transient:y}=n,_=un(n,sZ),g=At({render:o,key:e,label:a??e,hint:h,transient:y??!!p,onEditStart:m,onEditEnd:v,disabled:u,optional:l,order:c},t);let{type:x}=_,A=un(_,oZ);if(x=i??x,x in Po)return{type:x,input:A,options:g};let M;return i&&OU(A)&&"value"in A?M=A.value:M=iZ(A)?void 0:A,{type:x,input:M,options:At(At({},g),{},{onChange:p,optional:(r=g.optional)!==null&&r!==void 0?r:!1,disabled:(s=g.disabled)!==null&&s!==void 0?s:!1})}}function aZ(n,e,t,i){const r=FU(n,e),{type:s,input:o,options:a}=r;if(s)return s in Po?r:{type:s,input:TS(s,o,t,i),options:a};let l=uB(o);return l?{type:l,input:TS(l,o,t,i),options:a}:(l=uB({value:o}),l?{type:l,input:TS(l,{value:o},t,i),options:a}:!1)}function xB(n,e,t,i,r){const{value:s,type:o,settings:a}=n;n.value=NU({type:o,value:s,settings:a},e,t,i),n.fromPanel=r}const lZ=function(e,t,i){this.type="LEVA_ERROR",this.message="LEVA: "+e,this.previousValue=t,this.error=i};function NU({type:n,value:e,settings:t},i,r,s){const o=n!=="SELECT"&&typeof i=="function"?i(e):i;let a;try{a=Yq(n,o,t,e,r,s)}catch(l){throw new lZ(`The value \`${i}\` did not result in a correct value.`,e,l)}return my(a,e)?e:a}const UU=(n,e,t=!1)=>{let i=0;return function(){const r=arguments,s=t&&!i,o=()=>n.apply(this,r);window.clearTimeout(i),i=window.setTimeout(o,e),s&&o()}},kU=n=>n.shiftKey?5:n.altKey?1/5:1,cZ=["value"],uZ=["min","max"],fZ=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},zU=(n,{min:e=-1/0,max:t=1/0,suffix:i})=>{const r=parseFloat(n);if(n===""||isNaN(r))throw Error("Invalid number");const s=Dl(r,e,t);return i?s+i:s},dZ=(n,{pad:e=0,suffix:t})=>{const i=parseFloat(n).toFixed(e);return t?i+t:i},HU=n=>{let{value:e}=n,t=un(n,cZ);const{min:i=-1/0,max:r=1/0}=t,s=un(t,uZ);let o=parseFloat(e);const a=typeof e=="string"?e.substring((""+o).length):void 0;o=Dl(o,i,r);let l=t.step;l||(Number.isFinite(i)?Number.isFinite(r)?l=+(Math.abs(r-i)/100).toPrecision(1):l=+(Math.abs(o-i)/100).toPrecision(1):Number.isFinite(r)&&(l=+(Math.abs(r-o)/100).toPrecision(1)));const c=l?hB(l)*10:hB(o);l=l||c/10;const u=Math.round(Dl(Math.log10(1/c),0,2));return{value:a?o+a:o,settings:At({initialValue:o,step:l,pad:u,min:i,max:r,suffix:a},s)}},GU=(n,{step:e,initialValue:t})=>{const i=Math.round((n-t)/e);return t+i*e};var VU=Object.freeze({__proto__:null,schema:fZ,sanitize:zU,format:dZ,normalize:HU,sanitizeStep:GU});function ei(){return ei=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 Y0(n,e){const[t,i]=n.split(" "),r={};return t!=="none"&&(r.boxShadow=`${e.inset?"inset ":""}0 0 0 $borderWidths${[e.key]} $colors${t!=="default"&&t||e.borderColor}`),i&&(r.backgroundColor=i),r}const Ch={$inputStyle:()=>n=>Y0(n,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>n=>Y0(n,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>n=>Y0(n,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>n=>Y0(n,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:st,css:Woe,createTheme:$oe,globalCss:mZ,keyframes:Xoe}=YY({prefix:"leva",theme:pZ(),utils:At(At({},Ch),{},{$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":Ch.$focusStyle()(n)}),$focusWithin:n=>({"&:focus-within":Ch.$focusStyle()(n)}),$hover:n=>({"&:hover":Ch.$hoverStyle()(n)}),$active:n=>({"&:active":Ch.$activeStyle()(n)})})}),gZ=mZ({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});function ca(n,e){const{theme:t}=B.useContext($U);if(!(n in t)||!(e in t[n]))return na(wn.THEME_ERROR,n,e),"";let i=e;for(;;){let r=t[n][i];if(typeof r=="string"&&r.charAt(0)==="$")i=r.substr(1);else return r}}const JU=st("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),KU=st("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${JU}`]:{paddingLeft:0}}),vZ=st(KU,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),yZ=st("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),_Z=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],xZ=["onUpdate"];function YT(n){let{innerLabel:e,value:t,onUpdate:i,onChange:r,onKeyDown:s,type:o,id:a,inputType:l="text",rows:c=0}=n,u=un(n,_Z);const{id:h,emitOnEditStart:p,emitOnEditEnd:m,disabled:v}=Ji(),y=a||h,_=B.useRef(null),g=c>0,x=g?"textarea":"input",A=B.useCallback(b=>R=>{const D=R.currentTarget.value;b(D)},[]);X.useEffect(()=>{const b=_.current,R=A(D=>{i(D),m()});return b==null||b.addEventListener("blur",R),()=>b==null?void 0:b.removeEventListener("blur",R)},[A,i,m]);const M=B.useCallback(b=>{b.key==="Enter"&&A(i)(b)},[A,i]),w=Object.assign({as:x},g?{rows:c}:{},u);return X.createElement(yZ,{textArea:g},e&&typeof e=="string"?X.createElement(KU,null,e):e,X.createElement(JU,ei({levaType:o,ref:_,id:y,type:l,autoComplete:"off",spellCheck:"false",value:t,onChange:A(r),onFocus:()=>p(),onKeyPress:M,onKeyDown:s,disabled:v},w)))}function SZ(n){let{onUpdate:e}=n,t=un(n,xZ);const i=B.useCallback(s=>e(qq(s)),[e]),r=B.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 X.createElement(YT,ei({},t,{onUpdate:i,onKeyDown:r,type:"number"}))}const Ey=st("div",{}),eM=st("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"}}]}),AZ=st("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 + ${eM}::after`]:{opacity:.6},[`${Ey}:hover > & + ${eM}::after`]:{opacity:.6},[`${Ey}:hover > & > svg`]:{opacity:1}}),YU=st("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"},[`> ${Ey}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),QU=st("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${YU} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),qU=st(QU,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),EZ=st("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"}}}}),MZ=st("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"}}),tM=st("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}}),wZ=st("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${tM}`]:{pointerEvents:"auto"}}}}}),ZU=st("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"}),TZ=st("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),bZ=st(Vq,{fill:"$toolTipBackground"});function QT({children:n}){const{className:e}=B.useContext($U);return X.createElement(yY,{className:e},n)}const CZ=["align"];function RZ(){const{id:n,disable:e,disabled:t}=Ji();return X.createElement(X.Fragment,null,X.createElement(MZ,{id:n+"__disable",type:"checkbox",checked:!t,onChange:()=>e(!t)}),X.createElement("label",{htmlFor:n+"__disable"}))}function PZ(n){const{id:e,optional:t,hint:i}=Ji(),r=n.htmlFor||(e?{htmlFor:e}:null),s=!i&&typeof n.children=="string"?{title:n.children}:null;return X.createElement(X.Fragment,null,t&&X.createElement(RZ,null),i!==void 0?X.createElement(zq,null,X.createElement(Hq,{asChild:!0},X.createElement(tM,ei({},r,n))),X.createElement(Gq,{side:"top",sideOffset:2},X.createElement(TZ,null,i,X.createElement(bZ,null)))):X.createElement(tM,ei({},r,s,n)))}function io(n){let{align:e}=n,t=un(n,CZ);const{value:i,label:r,key:s,disabled:o}=Ji(),{hideCopyButton:a}=hZ(),l=!a&&s!==void 0,[c,u]=B.useState(!1),h=async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[s]:i??""})),u(!0)}catch{na(wn.CLIPBOARD_ERROR,{[s]:i})}};return X.createElement(EZ,{align:e,onPointerLeave:()=>u(!1)},X.createElement(PZ,t),l&&!o&&X.createElement("div",{title:`Click to copy ${typeof r=="string"?r:s} value`},c?X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},X.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),X.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"})):X.createElement("svg",{onClick:h,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},X.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),X.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 IZ=["toggled"],BZ=st("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function qT(n){let{toggled:e}=n,t=un(n,IZ);return X.createElement(BZ,ei({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e?0:-90}deg)`}},t),X.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 DZ=["input"];function Ds(n){let{input:e}=n,t=un(n,DZ);return e?X.createElement(qU,t):X.createElement(QU,t)}function ek({value:n,type:e,settings:t,setValue:i}){const[r,s]=B.useState(fB(e,n,t)),o=B.useRef(n),a=B.useRef(t);a.current=t;const l=B.useCallback(u=>s(fB(e,u,a.current)),[e]),c=B.useCallback(u=>{try{i(u)}catch(h){const{type:p,previousValue:m}=h;if(p!=="LEVA_ERROR")throw h;l(m)}},[l,i]);return B.useEffect(()=>{my(n,o.current)||l(n),o.current=n},[n,l]),{displayValue:r,onChange:s,onUpdate:c}}function Lm(n,e){const{emitOnEditStart:t,emitOnEditEnd:i}=Ji();return dK(r=>{r.first&&(document.body.classList.add("leva__panel__dragged"),t==null||t());const s=n(r);return r.last&&(document.body.classList.remove("leva__panel__dragged"),i==null||i()),s},e)}function LZ(n){const e=B.useRef(null),t=B.useRef(null),i=B.useRef(!1);return B.useEffect(()=>{const r=UU(()=>{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",r),i.current||(r(),i.current=!0),()=>window.removeEventListener("resize",r)},[n]),B.useEffect(()=>{t.current=e.current.getContext("2d")},[]),[e,t]}function tk(){const n=B.useRef(null),e=B.useRef({x:0,y:0}),t=B.useCallback(i=>{Object.assign(e.current,i),n.current&&(n.current.style.transform=`translate3d(${e.current.x}px, ${e.current.y}px, 0)`)},[]);return[n,t]}const OZ=["__refCount"],bS=(n,e)=>{if(!n[e])return null;const t=n[e];return un(t,OZ)};function FZ(n){const e=Dm(),[t,i]=B.useState(bS(e.getData(),n)),r=B.useCallback(c=>e.setValueAtPath(n,c,!0),[n,e]),s=B.useCallback(c=>e.setSettingsAtPath(n,c),[n,e]),o=B.useCallback(c=>e.disableInputAtPath(n,c),[n,e]),a=B.useCallback(()=>e.emitOnEditStart(n),[n,e]),l=B.useCallback(()=>e.emitOnEditEnd(n),[n,e]);return B.useEffect(()=>{i(bS(e.getData(),n));const c=e.useStore.subscribe(u=>bS(u.data,n),i,{equalityFn:qN});return()=>c()},[e,n]),[t,{set:r,setSettings:s,disable:o,storeId:e.storeId,emitOnEditStart:a,emitOnEditEnd:l}]}const NZ=st("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),nk=st("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),nM=st("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)))"}}}}),ik=st("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),rk=st("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function UZ({value:n,min:e,max:t,onDrag:i,step:r,initialValue:s}){const o=B.useRef(null),a=B.useRef(null),l=B.useRef(0),c=ca("sizes","scrubberWidth"),u=Lm(({event:p,first:m,xy:[v],movement:[y],memo:_})=>{if(m){const{width:x,left:A}=o.current.getBoundingClientRect();l.current=x-parseFloat(c),_=(p==null?void 0:p.target)===a.current?n:Ay((v-A)/x,e,t)}const g=_+Ay(y/l.current,0,t-e);return i(GU(g,{step:r,initialValue:s})),_}),h=Sy(n,e,t);return X.createElement(ik,ei({ref:o},u()),X.createElement(nk,null,X.createElement(rk,{style:{left:0,right:`${(1-h)*100}%`}})),X.createElement(nM,{ref:a,style:{left:`calc(${h} * (100% - ${c}))`}}))}const kZ=X.memo(({label:n,onUpdate:e,step:t,innerLabelTrim:i})=>{const[r,s]=B.useState(!1),o=Lm(({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*kU(c)),u=0),u));return X.createElement(vZ,ei({dragging:r,title:n.length>1?n:""},o()),n.slice(0,i))});function sk({label:n,id:e,displayValue:t,onUpdate:i,onChange:r,settings:s,innerLabelTrim:o=1}){const a=o>0&&X.createElement(kZ,{label:n,step:s.step,onUpdate:i,innerLabelTrim:o});return X.createElement(SZ,{id:e,value:String(t),onUpdate:i,onChange:r,innerLabel:a})}function zZ(){const n=Ji(),{label:e,value:t,onUpdate:i,settings:r,id:s}=n,{min:o,max:a}=r,l=a!==1/0&&o!==-1/0;return X.createElement(Ds,{input:!0},X.createElement(io,null,e),X.createElement(NZ,{hasRange:l},l&&X.createElement(UZ,ei({value:parseFloat(t),onDrag:i},r)),X.createElement(sk,ei({},n,{id:s,label:"value",innerLabelTrim:l?0:1}))))}const{sanitizeStep:HZ}=VU,GZ=un(VU,["sanitizeStep"]);var VZ=At({component:zZ},GZ);const WZ=(n,e)=>xr().schema({options:xr().passesAnyOf(xr().object(),xr().array())}).test(e),$Z=(n,{values:e})=>{if(e.indexOf(n)<0)throw Error("Selected value doesn't match Select options");return n},XZ=(n,{values:e})=>e.indexOf(n),jZ=n=>{let{value:e,options:t}=n,i,r;return Array.isArray(t)?(r=t,i=t.map(s=>String(s))):(r=Object.values(t),i=Object.keys(t)),"value"in n?r.includes(e)||(i.unshift(String(e)),r.unshift(e)):e=r[0],Object.values(t).includes(e)||(t[String(e)]=e),{value:e,settings:{keys:i,values:r}}};var JZ=Object.freeze({__proto__:null,schema:WZ,sanitize:$Z,format:XZ,normalize:jZ});const KZ=st("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),iM=st("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),YZ=st("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${iM}:focus + &`]:{$focusStyle:""},[`${iM}:hover + &`]:{$hoverStyle:""}});function QZ({displayValue:n,value:e,onUpdate:t,id:i,settings:r,disabled:s}){const{keys:o,values:a}=r,l=B.useRef();return e===a[n]&&(l.current=o[n]),X.createElement(KZ,null,X.createElement(iM,{id:i,value:n,onChange:c=>t(a[Number(c.currentTarget.value)]),disabled:s},o.map((c,u)=>X.createElement("option",{key:c,value:u},c))),X.createElement(YZ,null,l.current),X.createElement(qT,{toggled:!0}))}function qZ(){const{label:n,value:e,displayValue:t,onUpdate:i,id:r,disabled:s,settings:o}=Ji();return X.createElement(Ds,{input:!0},X.createElement(io,null,n),X.createElement(QZ,{id:r,value:e,displayValue:t,onUpdate:i,settings:o,disabled:s}))}var ZZ=At({component:qZ},JZ);const eee=n=>xr().string().test(n),tee=n=>{if(typeof n!="string")throw Error("Invalid string");return n},nee=({value:n,editable:e=!0,rows:t=!1})=>({value:n,settings:{editable:e,rows:typeof t=="number"?t:t?5:0}});var iee=Object.freeze({__proto__:null,schema:eee,sanitize:tee,normalize:nee});const ree=["displayValue","onUpdate","onChange","editable"],see=st("div",{whiteSpace:"pre-wrap"});function oee(n){let{displayValue:e,onUpdate:t,onChange:i,editable:r=!0}=n,s=un(n,ree);return r?X.createElement(YT,ei({value:e,onUpdate:t,onChange:i},s)):X.createElement(see,null,e)}function aee(){const{label:n,settings:e,displayValue:t,onUpdate:i,onChange:r}=Ji();return X.createElement(Ds,{input:!0},X.createElement(io,null,n),X.createElement(oee,ei({displayValue:t,onUpdate:i,onChange:r},e)))}var lee=At({component:aee},iee);const cee=n=>xr().boolean().test(n),uee=n=>{if(typeof n!="boolean")throw Error("Invalid boolean");return n};var fee=Object.freeze({__proto__:null,schema:cee,sanitize:uee});const dee=st("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 hee({value:n,onUpdate:e,id:t,disabled:i}){return X.createElement(dee,null,X.createElement("input",{id:t,type:"checkbox",checked:n,onChange:r=>e(r.currentTarget.checked),disabled:i}),X.createElement("label",{htmlFor:t},X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}function pee(){const{label:n,value:e,onUpdate:t,disabled:i,id:r}=Ji();return X.createElement(Ds,{input:!0},X.createElement(io,null,n),X.createElement(hee,{value:e,onUpdate:t,id:r,disabled:i}))}var mee=At({component:pee},fee);const gee=["locked"];function vee({value:n,id:e,valueKey:t,settings:i,onUpdate:r,innerLabelTrim:s}){const o=B.useRef(n[t]);o.current=n[t];const a=B.useCallback(c=>r({[t]:NU({type:"NUMBER",value:o.current,settings:i},c)}),[r,i,t]),l=ek({type:"NUMBER",value:n[t],settings:i,setValue:a});return X.createElement(sk,{id:e,label:t,value:n[t],displayValue:l.displayValue,onUpdate:l.onUpdate,onChange:l.onChange,settings:i,innerLabelTrim:s})}const yee=st("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});function _ee(n){let{locked:e}=n,t=un(n,gee);return X.createElement("svg",ei({width:"10",height:"10",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),e?X.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"}):X.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 ZT({value:n,onUpdate:e,settings:t,innerLabelTrim:i}){const{id:r,setSettings:s}=Ji(),{lock:o,locked:a}=t;return X.createElement(yee,{withLock:o},o&&X.createElement(_ee,{locked:a,onClick:()=>s({locked:!a})}),Object.keys(n).map((l,c)=>X.createElement(vee,{id:c===0?r:`${r}.${l}`,key:l,valueKey:l,value:n,settings:t[l],onUpdate:e,innerLabelTrim:i})))}const ok=(n,e)=>{const t={};let i=0,r=1/0;Object.entries(n).forEach(([s,o])=>{t[s]=HU(At({value:o},e[s])).settings,i=Math.max(i,t[s].step),r=Math.min(r,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=i,t[s].pad=r)}return t},xee=["lock"],See=["value"];function Aee(n){const e=xr().array().length(n).every.number(),t=i=>{if(!i||typeof i!="object")return!1;const r=Object.values(i);return r.length===n&&r.every(s=>isFinite(s))};return i=>e.test(i)||t(i)}function Eee(n){return Array.isArray(n)?"array":"object"}function rp(n,e,t){return Eee(n)===e?n:e==="array"?Object.values(n):nZ(n,t)}const Mee=(n,e,t)=>{const i=rp(n,"object",e.keys);for(let o in i)i[o]=zU(i[o],e[o]);const r=Object.keys(i);let s={};if(r.length===e.keys.length)s=i;else{const o=rp(t,"object",e.keys);if(r.length===1&&e.locked){const a=r[0],l=i[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=At(At({},o),i)}return rp(s,e.format,e.keys)},wee=(n,e)=>rp(n,"object",e.keys),Tee=n=>!!n&&("step"in n||"min"in n||"max"in n);function bee(n,e,t=[]){const{lock:i=!1}=e,r=un(e,xee),s=Array.isArray(n)?"array":"object",o=s==="object"?Object.keys(n):t,a=rp(n,"object",o),l=Tee(r)?o.reduce((u,h)=>Object.assign(u,{[h]:r}),{}):r,c=ok(a,l);return{value:s==="array"?n:a,settings:At(At({},c),{},{format:s,keys:o,lock:i,locked:!1})}}function ak(n){return{schema:Aee(n.length),normalize:e=>{let{value:t}=e,i=un(e,See);return bee(t,i,n)},format:(e,t)=>wee(e,t),sanitize:(e,t,i)=>Mee(e,t,i)}}var Cee={grad:.9,turn:360,rad:360/(2*Math.PI)},Jo=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},gi=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},xs=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n>e?n:e},lk=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},SB=function(n){return{r:xs(n.r,0,255),g:xs(n.g,0,255),b:xs(n.b,0,255),a:xs(n.a)}},CS=function(n){return{r:gi(n.r),g:gi(n.g),b:gi(n.b),a:gi(n.a,3)}},Ree=/^#([0-9a-f]{3,8})$/i,Q0=function(n){var e=n.toString(16);return e.length<2?"0"+e:e},ck=function(n){var e=n.r,t=n.g,i=n.b,r=n.a,s=Math.max(e,t,i),o=s-Math.min(e,t,i),a=o?s===e?(t-i)/o:s===t?2+(i-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:r}},uk=function(n){var e=n.h,t=n.s,i=n.v,r=n.a;e=e/360*6,t/=100,i/=100;var s=Math.floor(e),o=i*(1-t),a=i*(1-(e-s)*t),l=i*(1-(1-e+s)*t),c=s%6;return{r:255*[i,a,o,o,l,i][c],g:255*[l,i,i,a,o,o][c],b:255*[o,o,l,i,i,a][c],a:r}},AB=function(n){return{h:lk(n.h),s:xs(n.s,0,100),l:xs(n.l,0,100),a:xs(n.a)}},EB=function(n){return{h:gi(n.h),s:gi(n.s),l:gi(n.l),a:gi(n.a,3)}},MB=function(n){return uk((t=(e=n).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},sp=function(n){return{h:(e=ck(n)).h,s:(r=(200-(t=e.s))*(i=e.v)/100)>0&&r<200?t*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:e.a};var e,t,i,r},Pee=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Iee=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bee=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dee=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rM={string:[[function(n){var e=Ree.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?gi(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?gi(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var e=Bee.exec(n)||Dee.exec(n);return e?e[2]!==e[4]||e[4]!==e[6]?null:SB({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=Pee.exec(n)||Iee.exec(n);if(!e)return null;var t,i,r=AB({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(Cee[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return MB(r)},"hsl"]],object:[[function(n){var e=n.r,t=n.g,i=n.b,r=n.a,s=r===void 0?1:r;return Jo(e)&&Jo(t)&&Jo(i)?SB({r:Number(e),g:Number(t),b:Number(i),a:Number(s)}):null},"rgb"],[function(n){var e=n.h,t=n.s,i=n.l,r=n.a,s=r===void 0?1:r;if(!Jo(e)||!Jo(t)||!Jo(i))return null;var o=AB({h:Number(e),s:Number(t),l:Number(i),a:Number(s)});return MB(o)},"hsl"],[function(n){var e=n.h,t=n.s,i=n.v,r=n.a,s=r===void 0?1:r;if(!Jo(e)||!Jo(t)||!Jo(i))return null;var o=function(a){return{h:lk(a.h),s:xs(a.s,0,100),v:xs(a.v,0,100),a:xs(a.a)}}({h:Number(e),s:Number(t),v:Number(i),a:Number(s)});return uk(o)},"hsv"]]},wB=function(n,e){for(var t=0;t=.5},n.prototype.toHex=function(){return e=CS(this.rgba),t=e.r,i=e.g,r=e.b,o=(s=e.a)<1?Q0(gi(255*s)):"","#"+Q0(t)+Q0(i)+Q0(r)+o;var e,t,i,r,s,o},n.prototype.toRgb=function(){return CS(this.rgba)},n.prototype.toRgbString=function(){return e=CS(this.rgba),t=e.r,i=e.g,r=e.b,(s=e.a)<1?"rgba("+t+", "+i+", "+r+", "+s+")":"rgb("+t+", "+i+", "+r+")";var e,t,i,r,s},n.prototype.toHsl=function(){return EB(sp(this.rgba))},n.prototype.toHslString=function(){return e=EB(sp(this.rgba)),t=e.h,i=e.s,r=e.l,(s=e.a)<1?"hsla("+t+", "+i+"%, "+r+"%, "+s+")":"hsl("+t+", "+i+"%, "+r+"%)";var e,t,i,r,s},n.prototype.toHsv=function(){return e=ck(this.rgba),{h:gi(e.h),s:gi(e.s),v:gi(e.v),a:gi(e.a,3)};var e},n.prototype.invert=function(){return nr({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),nr(RS(this.rgba,e))},n.prototype.desaturate=function(e){return e===void 0&&(e=.1),nr(RS(this.rgba,-e))},n.prototype.grayscale=function(){return nr(RS(this.rgba,-1))},n.prototype.lighten=function(e){return e===void 0&&(e=.1),nr(TB(this.rgba,e))},n.prototype.darken=function(e){return e===void 0&&(e=.1),nr(TB(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"?nr({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):gi(this.rgba.a,3);var t},n.prototype.hue=function(e){var t=sp(this.rgba);return typeof e=="number"?nr({h:e,s:t.s,l:t.l,a:t.a}):gi(t.h)},n.prototype.isEqual=function(e){return this.toHex()===nr(e).toHex()},n}(),nr=function(n){return n instanceof sM?n:new sM(n)},bB=[],Oee=function(n){n.forEach(function(e){bB.indexOf(e)<0&&(e(sM,rM),bB.push(e))})};function Fee(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"},i={};for(var r in t)i[t[r]]=r;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=i[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 v in t){var y=(a=u,l=s[v],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y=0||(r[t]=n[t]);return r}function oM(n){var e=B.useRef(n),t=B.useRef(function(i){e.current&&e.current(i)});return e.current=n,t.current}var cd=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n0:_.buttons>0)&&r.current?s(CB(r.current,_,a.current)):y(!1)},v=function(){return y(!1)};function y(_){var g=l.current,x=aM(r.current),A=_?x.addEventListener:x.removeEventListener;A(g?"touchmove":"mousemove",m),A(g?"touchend":"mouseup",v)}return[function(_){var g=_.nativeEvent,x=r.current;if(x&&(RB(g),!function(M,w){return w&&!op(M)}(g,l.current)&&x)){if(op(g)){l.current=!0;var A=g.changedTouches||[];A.length&&(a.current=A[0].identifier)}x.focus(),s(CB(x,g,a.current)),y(!0)}},function(_){var g=_.which||_.keyCode;g<37||g>40||(_.preventDefault(),o({left:g===39?.05:g===37?-.05:0,top:g===40?.05:g===38?-.05:0}))},y]},[o,s]),u=c[0],h=c[1],p=c[2];return B.useEffect(function(){return p},[p]),X.createElement("div",Id({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:h,tabIndex:0,role:"slider"}))}),Om=function(n){return n.filter(Boolean).join(" ")},nb=function(n){var e=n.color,t=n.left,i=n.top,r=i===void 0?.5:i,s=Om(["react-colorful__pointer",n.className]);return X.createElement("div",{className:s,style:{top:100*r+"%",left:100*t+"%"}},X.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},sr=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t},dk=function(n){var e=n.s,t=n.v,i=n.a,r=(200-e)*t/100;return{h:sr(n.h),s:sr(r>0&&r<200?e*t/100/(r<=100?r:200-r)*100:0),l:sr(r/2),a:sr(i,2)}},lM=function(n){var e=dk(n);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},IS=function(n){var e=dk(n);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},hk=function(n){var e=n.h,t=n.s,i=n.v,r=n.a;e=e/360*6,t/=100,i/=100;var s=Math.floor(e),o=i*(1-t),a=i*(1-(e-s)*t),l=i*(1-(1-e+s)*t),c=s%6;return{r:sr(255*[i,a,o,o,l,i][c]),g:sr(255*[l,i,i,a,o,o][c]),b:sr(255*[o,o,l,i,i,a][c]),a:sr(r,2)}},pk=function(n){var e=n.r,t=n.g,i=n.b,r=n.a,s=Math.max(e,t,i),o=s-Math.min(e,t,i),a=o?s===e?(t-i)/o:s===t?2+(i-e)/o:4+(e-t)/o:0;return{h:sr(60*(a<0?a+6:a)),s:sr(s?o/s*100:0),v:sr(s/255*100),a:r}},mk=X.memo(function(n){var e=n.hue,t=n.onChange,i=Om(["react-colorful__hue",n.className]);return X.createElement("div",{className:i},X.createElement(tb,{onMove:function(r){t({h:360*r.left})},onKey:function(r){t({h:cd(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":sr(e),"aria-valuemax":"360","aria-valuemin":"0"},X.createElement(nb,{className:"react-colorful__hue-pointer",left:e/360,color:lM({h:e,s:100,v:100,a:1})})))}),gk=X.memo(function(n){var e=n.hsva,t=n.onChange,i={backgroundColor:lM({h:e.h,s:100,v:100,a:1})};return X.createElement("div",{className:"react-colorful__saturation",style:i},X.createElement(tb,{onMove:function(r){t({s:100*r.left,v:100-100*r.top})},onKey:function(r){t({s:cd(e.s+100*r.left,0,100),v:cd(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+sr(e.s)+"%, Brightness "+sr(e.v)+"%"},X.createElement(nb,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:lM(e)})))}),ib=function(n,e){if(n===e)return!0;for(var t in n)if(n[t]!==e[t])return!1;return!0};function vk(n,e,t){var i=oM(t),r=B.useState(function(){return n.toHsva(e)}),s=r[0],o=r[1],a=B.useRef({color:e,hsva:s});B.useEffect(function(){if(!n.equal(e,a.current.color)){var c=n.toHsva(e);a.current={hsva:c,color:e},o(c)}},[e,n]),B.useEffect(function(){var c;ib(s,a.current.hsva)||n.equal(c=n.fromHsva(s),a.current.color)||(a.current={hsva:s,color:c},i(c))},[s,n,i]);var l=B.useCallback(function(c){o(function(u){return Object.assign({},u,c)})},[]);return[s,l]}var Nee=typeof window<"u"?B.useLayoutEffect:B.useEffect,Uee=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},PB=new Map,yk=function(n){Nee(function(){var e=n.current?n.current.ownerDocument:document;if(e!==void 0&&!PB.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}`,PB.set(e,t);var i=Uee();i&&t.setAttribute("nonce",i),e.head.appendChild(t)}},[])},kee=function(n){var e=n.className,t=n.colorModel,i=n.color,r=i===void 0?t.defaultColor:i,s=n.onChange,o=eb(n,["className","colorModel","color","onChange"]),a=B.useRef(null);yk(a);var l=vk(t,r,s),c=l[0],u=l[1],h=Om(["react-colorful",e]);return X.createElement("div",Id({},o,{ref:a,className:h}),X.createElement(gk,{hsva:c,onChange:u}),X.createElement(mk,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},zee=function(n){var e=n.className,t=n.hsva,i=n.onChange,r={backgroundImage:"linear-gradient(90deg, "+IS(Object.assign({},t,{a:0}))+", "+IS(Object.assign({},t,{a:1}))+")"},s=Om(["react-colorful__alpha",e]),o=sr(100*t.a);return X.createElement("div",{className:s},X.createElement("div",{className:"react-colorful__alpha-gradient",style:r}),X.createElement(tb,{onMove:function(a){i({a:a.left})},onKey:function(a){i({a:cd(t.a+a.left)})},"aria-label":"Alpha","aria-valuetext":o+"%","aria-valuenow":o,"aria-valuemin":"0","aria-valuemax":"100"},X.createElement(nb,{className:"react-colorful__alpha-pointer",left:t.a,color:IS(t)})))},Hee=function(n){var e=n.className,t=n.colorModel,i=n.color,r=i===void 0?t.defaultColor:i,s=n.onChange,o=eb(n,["className","colorModel","color","onChange"]),a=B.useRef(null);yk(a);var l=vk(t,r,s),c=l[0],u=l[1],h=Om(["react-colorful",e]);return X.createElement("div",Id({},o,{ref:a,className:h}),X.createElement(gk,{hsva:c,onChange:u}),X.createElement(mk,{hue:c.h,onChange:u}),X.createElement(zee,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},Gee={defaultColor:{r:0,g:0,b:0,a:1},toHsva:pk,fromHsva:hk,equal:ib},Vee=function(n){return X.createElement(Hee,Id({},n,{colorModel:Gee}))},Wee={defaultColor:{r:0,g:0,b:0},toHsva:function(n){return pk({r:n.r,g:n.g,b:n.b,a:1})},fromHsva:function(n){return{r:(e=hk(n)).r,g:e.g,b:e.b};var e},equal:ib},$ee=function(n){return X.createElement(kee,Id({},n,{colorModel:Wee}))};function Bd(n,e,t,i){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(u){try{c(i.next(u))}catch(h){o(h)}}function l(u){try{c(i.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):r(u.value).then(a,l)}c((i=i.apply(n,e||[])).next())})}function Dd(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function jee(){for(var n=[],e=0;e0?i:n.name,writable:!1,configurable:!1,enumerable:!0})}return t}function Kee(n){var e=n.name,t=e&&e.lastIndexOf(".")!==-1;if(t&&!n.type){var i=e.split(".").pop().toLowerCase(),r=Jee.get(i);r&&Object.defineProperty(n,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return n}var Yee=[".DS_Store","Thumbs.db"];function Qee(n){return Bd(this,void 0,void 0,function(){return Dd(this,function(e){return My(n)&&qee(n)?[2,nte(n.dataTransfer,n.type)]:Zee(n)?[2,ete(n)]:Array.isArray(n)&&n.every(function(t){return"getFile"in t&&typeof t.getFile=="function"})?[2,tte(n)]:[2,[]]})})}function qee(n){return My(n.dataTransfer)}function Zee(n){return My(n)&&My(n.target)}function My(n){return typeof n=="object"&&n!==null}function ete(n){return cM(n.target.files).map(function(e){return Fm(e)})}function tte(n){return Bd(this,void 0,void 0,function(){var e;return Dd(this,function(t){switch(t.label){case 0:return[4,Promise.all(n.map(function(i){return i.getFile()}))];case 1:return e=t.sent(),[2,e.map(function(i){return Fm(i)})]}})})}function nte(n,e){return Bd(this,void 0,void 0,function(){var t,i;return Dd(this,function(r){switch(r.label){case 0:return n===null?[2,[]]:n.items?(t=cM(n.items).filter(function(s){return s.kind==="file"}),e!=="drop"?[2,t]:[4,Promise.all(t.map(ite))]):[3,2];case 1:return i=r.sent(),[2,IB(_k(i))];case 2:return[2,IB(cM(n.files).map(function(s){return Fm(s)}))]}})})}function IB(n){return n.filter(function(e){return Yee.indexOf(e.name)===-1})}function cM(n){if(n===null)return[];for(var e=[],t=0;tn.length)&&(e=n.length);for(var t=0,i=new Array(e);tt)return[!1,NB(t)];if(n.sizet)return[!1,NB(t)]}return[!0,null]}function Rh(n){return n!=null}function vte(n){var e=n.files,t=n.accept,i=n.minSize,r=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=Ak(a,t),c=OB(l,1),u=c[0],h=Ek(a,i,r),p=OB(h,1),m=p[0];return u&&m})}function wy(n){return typeof n.isPropagationStopped=="function"?n.isPropagationStopped():typeof n.cancelBubble<"u"?n.cancelBubble:!1}function q0(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 kB(n){n.preventDefault()}function yte(n){return n.indexOf("MSIE")!==-1||n.indexOf("Trident/")!==-1}function _te(n){return n.indexOf("Edge/")!==-1}function xte(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return yte(n)||_te(n)}function mo(){for(var n=arguments.length,e=new Array(n),t=0;t1?r-1:0),o=1;on.length)&&(e=n.length);for(var t=0,i=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Fte(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}var rb=B.forwardRef(function(n,e){var t=n.children,i=Ty(n,wte),r=Tk(i),s=r.open,o=Ty(r,Tte);return B.useImperativeHandle(e,function(){return{open:s}},[s]),X.createElement(B.Fragment,null,t(Mn(Mn({},o),{},{open:s})))});rb.displayName="Dropzone";var wk={disabled:!1,getFilesFromEvent:Qee,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};rb.defaultProps=wk;rb.propTypes={children:sn.func,accept:sn.oneOfType([sn.string,sn.arrayOf(sn.string)]),multiple:sn.bool,preventDropOnDocument:sn.bool,noClick:sn.bool,noKeyboard:sn.bool,noDrag:sn.bool,noDragEventsBubbling:sn.bool,minSize:sn.number,maxSize:sn.number,maxFiles:sn.number,disabled:sn.bool,getFilesFromEvent:sn.func,onFileDialogCancel:sn.func,onFileDialogOpen:sn.func,useFsAccessApi:sn.bool,onDragEnter:sn.func,onDragLeave:sn.func,onDragOver:sn.func,onDrop:sn.func,onDropAccepted:sn.func,onDropRejected:sn.func,validator:sn.func};var dM={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function Tk(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Mn(Mn({},wk),n),t=e.accept,i=e.disabled,r=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,v=e.onDropRejected,y=e.onFileDialogCancel,_=e.onFileDialogOpen,g=e.useFsAccessApi,x=e.preventDropOnDocument,A=e.noClick,M=e.noKeyboard,w=e.noDrag,b=e.noDragEventsBubbling,R=e.validator,D=B.useMemo(function(){return typeof _=="function"?_:HB},[_]),C=B.useMemo(function(){return typeof y=="function"?y:HB},[y]),I=B.useRef(null),O=B.useRef(null),H=B.useReducer(Nte,dM),J=BS(H,2),k=J[0],W=J[1],q=k.isFocused,Q=k.isFileDialogActive,z=k.draggedFiles,j=B.useRef(typeof window<"u"&&window.isSecureContext&&g&&Ste()),K=function(){!j.current&&Q&&setTimeout(function(){if(O.current){var L=O.current.files;L.length||(W({type:"closeDialog"}),C())}},300)};B.useEffect(function(){return window.addEventListener("focus",K,!1),function(){window.removeEventListener("focus",K,!1)}},[O,Q,C,j]);var V=B.useRef([]),Y=function(L){I.current&&I.current.contains(L.target)||(L.preventDefault(),V.current=[])};B.useEffect(function(){return x&&(document.addEventListener("dragover",kB,!1),document.addEventListener("drop",Y,!1)),function(){x&&(document.removeEventListener("dragover",kB),document.removeEventListener("drop",Y))}},[I,x]);var de=B.useCallback(function(F){F.preventDefault(),F.persist(),me(F),V.current=[].concat(Rte(V.current),[F.target]),q0(F)&&Promise.resolve(r(F)).then(function(L){wy(F)&&!b||(W({draggedFiles:L,isDragActive:!0,type:"setDraggedFiles"}),c&&c(F))})},[r,c,b]),ge=B.useCallback(function(F){F.preventDefault(),F.persist(),me(F);var L=q0(F);if(L&&F.dataTransfer)try{F.dataTransfer.dropEffect="copy"}catch{}return L&&h&&h(F),!1},[h,b]),ve=B.useCallback(function(F){F.preventDefault(),F.persist(),me(F);var L=V.current.filter(function(xe){return I.current&&I.current.contains(xe)}),ne=L.indexOf(F.target);ne!==-1&&L.splice(ne,1),V.current=L,!(L.length>0)&&(W({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),q0(F)&&u&&u(F))},[I,u,b]),Ce=B.useCallback(function(F,L){var ne=[],xe=[];F.forEach(function(pe){var Se=Ak(pe,t),We=BS(Se,2),we=We[0],Le=We[1],ot=Ek(pe,o,s),Rt=BS(ot,2),Me=Rt[0],Nt=Rt[1],dt=R?R(pe):null;if(we&&Me&&!dt)ne.push(pe);else{var it=[Le,Nt];dt&&(it=it.concat(dt)),xe.push({file:pe,errors:it.filter(function(nt){return nt})})}}),(!a&&ne.length>1||a&&l>=1&&ne.length>l)&&(ne.forEach(function(pe){xe.push({file:pe,errors:[gte]})}),ne.splice(0)),W({acceptedFiles:ne,fileRejections:xe,type:"setFiles"}),p&&p(ne,xe,L),xe.length>0&&v&&v(xe,L),ne.length>0&&m&&m(ne,L)},[W,a,t,o,s,l,p,m,v,R]),Ue=B.useCallback(function(F){F.preventDefault(),F.persist(),me(F),V.current=[],q0(F)&&Promise.resolve(r(F)).then(function(L){wy(F)&&!b||Ce(L,F)}),W({type:"reset"})},[r,Ce,b]),Ve=B.useCallback(function(){if(j.current){W({type:"openDialog"}),D();var F={multiple:a,types:Ate(t)};window.showOpenFilePicker(F).then(function(L){return r(L)}).then(function(L){Ce(L,null),W({type:"closeDialog"})}).catch(function(L){Ete(L)?(C(L),W({type:"closeDialog"})):Mte(L)&&(j.current=!1,O.current&&(O.current.value=null,O.current.click()))});return}O.current&&(W({type:"openDialog"}),D(),O.current.value=null,O.current.click())},[W,D,C,g,Ce,t,a]),Qe=B.useCallback(function(F){!I.current||!I.current.isEqualNode(F.target)||(F.key===" "||F.key==="Enter"||F.keyCode===32||F.keyCode===13)&&(F.preventDefault(),Ve())},[I,Ve]),tt=B.useCallback(function(){W({type:"focus"})},[]),Ee=B.useCallback(function(){W({type:"blur"})},[]),$=B.useCallback(function(){A||(xte()?setTimeout(Ve,0):Ve())},[A,Ve]),ye=function(L){return i?null:L},fe=function(L){return M?null:ye(L)},_e=function(L){return w?null:ye(L)},me=function(L){b&&L.stopPropagation()},He=B.useMemo(function(){return function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},L=F.refKey,ne=L===void 0?"ref":L,xe=F.role,pe=F.onKeyDown,Se=F.onFocus,We=F.onBlur,we=F.onClick,Le=F.onDragEnter,ot=F.onDragOver,Rt=F.onDragLeave,Me=F.onDrop,Nt=Ty(F,bte);return Mn(Mn(fM({onKeyDown:fe(mo(pe,Qe)),onFocus:fe(mo(Se,tt)),onBlur:fe(mo(We,Ee)),onClick:ye(mo(we,$)),onDragEnter:_e(mo(Le,de)),onDragOver:_e(mo(ot,ge)),onDragLeave:_e(mo(Rt,ve)),onDrop:_e(mo(Me,Ue)),role:typeof xe=="string"&&xe!==""?xe:"button"},ne,I),!i&&!M?{tabIndex:0}:{}),Nt)}},[I,Qe,tt,Ee,$,de,ge,ve,Ue,M,w,i]),De=B.useCallback(function(F){F.stopPropagation()},[]),ke=B.useMemo(function(){return function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},L=F.refKey,ne=L===void 0?"ref":L,xe=F.onChange,pe=F.onClick,Se=Ty(F,Cte),We=fM({accept:t,multiple:a,type:"file",style:{display:"none"},onChange:ye(mo(xe,Ue)),onClick:ye(mo(pe,De)),tabIndex:-1},ne,O);return Mn(Mn({},We),Se)}},[O,t,a,Ue,i]),qe=z.length,ft=qe>0&&vte({files:z,accept:t,minSize:o,maxSize:s,multiple:a,maxFiles:l}),Zt=qe>0&&!ft;return Mn(Mn({},k),{},{isDragAccept:ft,isDragReject:Zt,isFocused:q&&!i,getRootProps:He,getInputProps:ke,rootRef:I,inputRef:O,open:ye(Ve)})}function Nte(n,e){switch(e.type){case"focus":return Mn(Mn({},n),{},{isFocused:!0});case"blur":return Mn(Mn({},n),{},{isFocused:!1});case"openDialog":return Mn(Mn({},dM),{},{isFileDialogActive:!0});case"closeDialog":return Mn(Mn({},n),{},{isFileDialogActive:!1});case"setDraggedFiles":var t=e.isDragActive,i=e.draggedFiles;return Mn(Mn({},n),{},{draggedFiles:i,isDragActive:t});case"setFiles":return Mn(Mn({},n),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections});case"reset":return Mn({},dM);default:return n}}function HB(){}/*! * isobject * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var Ute=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 kte=Ute;function GB(n){return kte(n)===!0&&Object.prototype.toString.call(n)==="[object Object]"}var bk=function(e){var t,i;return!(GB(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,GB(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)};/*! * is-extendable * * Copyright (c) 2015-2017, Jon Schlinkert. * Released under the MIT License. */var zte=bk,sb=function(e){return zte(e)||typeof e=="function"||Array.isArray(e)};/*! * for-in * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var Hte=function(e,t,i){for(var r in e)if(t.call(i,e[r],r,e)===!1)break},Gte=sb,Vte=Hte;function Ck(n,e){for(var t=arguments.length,i=0;++i * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */var jte=function(n,e,t,i,r){if(!Jte(n)||!e)return n;if(e=Z0(e),t&&(e+="."+Z0(t)),i&&(e+="."+Z0(i)),r&&(e+="."+Z0(r)),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 Kte=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,i=Object(n),r=arguments.length,s=0;++s"u")throw new TypeError("Cannot convert undefined or null to object");VB(n)||(n={});for(var e=1;e * * Copyright (c) 2015-2017, Jon Schlinkert. * Released under the MIT License. */var ine=qte,rne=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 i=ine({sep:"."},e),r=i.quotes||['"',"'","`"],s;i.brackets===!0?s={"<":">","(":")","[":"]","{":"}"}:i.brackets&&(s=i.brackets);var o=[],a=[],l=[""],c=i.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 ane=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")},WB=ane,lne=function(e){WB(e)||(e={});for(var t=arguments.length,i=1;i * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */var fne=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 dne=rne,hne=lne,$B=bk,XB=fne,pne=function(n,e,t){if(!XB(n)||(Array.isArray(e)&&(e=[].concat.apply([],e).join(".")),typeof e!="string"))return n;for(var i=dne(e,{sep:".",brackets:!0}).filter(mne),r=i.length,s=-1,o=n;++sn.filter(Boolean).join(".");function _ne(n){const e=n.split(".");return[e.pop(),e.join(".")||void 0]}function xne(n){const e=B.useRef(null),t=B.useRef(null),i=B.useRef(!0);return B.useLayoutEffect(()=>{n||(e.current.style.height="0px",e.current.style.overflow="hidden")},[]),B.useEffect(()=>{if(i.current){i.current=!1;return}let r;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",r=window.setTimeout(()=>s.style.height="0px",50)),()=>{s.removeEventListener("transitionend",o),clearTimeout(r)}},[n]),{wrapperRef:e,contentRef:t}}const Sne=n=>{const[e,t]=B.useState(n.getVisiblePaths());return B.useEffect(()=>{t(n.getVisiblePaths());const i=n.useStore.subscribe(n.getVisiblePaths,t,{equalityFn:qN});return()=>i()},[n]),e};function Rk(n=3){const e=B.useRef(null),t=B.useRef(null),[i,r]=B.useState(!1),s=B.useCallback(()=>r(!0),[]),o=B.useCallback(()=>r(!1),[]);return B.useLayoutEffect(()=>{if(i){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,i]),{popinRef:e,wrapperRef:t,shown:i,show:s,hide:o}}Oee([Fee]);const Ane={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};xr.extend({color:()=>n=>nr(n).isValid()});const Ene=n=>xr().color().test(n);function Pk(n,{format:e,hasAlpha:t,isString:i}){const r=Ane[e]+(i&&e!=="hex"?"String":""),s=n[r]();return typeof s=="object"&&!t?tZ(s,["a"]):s}const Ik=(n,e)=>{const t=nr(n);if(!t.isValid())throw Error("Invalid color");return Pk(t,e)},Mne=(n,e)=>Pk(nr(n),At(At({},e),{},{isString:!0,format:"hex"})),wne=({value:n})=>{const e=Lee(n),t=e==="name"?"hex":e,i=typeof n=="object"?"a"in n:e==="hex"&&n.length===8||/^(rgba)|(hsla)|(hsva)/.test(n),r={format:t,hasAlpha:i,isString:typeof n=="string"};return{value:Ik(n,r),settings:r}};var Tne=Object.freeze({__proto__:null,schema:Ene,sanitize:Ik,format:Mne,normalize:wne});const bne=st("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}}),Cne=st("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),Rne=st("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 KB(n,e){return e!=="rgb"?nr(n).toRgb():n}function Pne({value:n,displayValue:e,settings:t,onUpdate:i}){const{emitOnEditStart:r,emitOnEditEnd:s}=Ji(),{format:o,hasAlpha:a}=t,{popinRef:l,wrapperRef:c,shown:u,show:h,hide:p}=Rk(),m=B.useRef(0),[v,y]=B.useState(()=>KB(n,o)),_=a?Vee:$ee,g=()=>{y(KB(n,o)),h(),r()},x=()=>{p(),s(),window.clearTimeout(m.current)},A=()=>{m.current=window.setTimeout(x,500)};return B.useEffect(()=>()=>window.clearTimeout(m.current),[]),X.createElement(X.Fragment,null,X.createElement(bne,{ref:l,active:u,onClick:()=>g(),style:{color:e}}),u&&X.createElement(QT,null,X.createElement(ZU,{onPointerUp:x}),X.createElement(Rne,{ref:c,onMouseEnter:()=>window.clearTimeout(m.current),onMouseLeave:M=>M.buttons===0&&A()},X.createElement(_,{color:v,onChange:i}))))}function Ine(){const{value:n,displayValue:e,label:t,onChange:i,onUpdate:r,settings:s}=Ji();return X.createElement(Ds,{input:!0},X.createElement(io,null,t),X.createElement(Cne,null,X.createElement(Pne,{value:n,displayValue:e,onChange:i,onUpdate:r,settings:s}),X.createElement(YT,{value:e,onChange:i,onUpdate:r})))}var Bne=At({component:Ine},Tne);function Dne(){const{label:n,displayValue:e,onUpdate:t,settings:i}=Ji();return X.createElement(Ds,{input:!0},X.createElement(io,null,n),X.createElement(ZT,{value:e,settings:i,onUpdate:t}))}var Lne=At({component:Dne},ak(["x","y","z"]));const One=st("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}}),Fne=st("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 Nne({value:n,settings:e,onUpdate:t}){const i=B.useRef(),r=B.useRef(0),s=B.useRef(0),o=B.useRef(1),[a,l]=B.useState(!1),[c,u]=B.useState(!1),[h,p]=tk(),m=B.useRef(null),v=B.useRef(null);B.useLayoutEffect(()=>{if(a){const{top:H,left:J,width:k,height:W}=m.current.getBoundingClientRect();v.current.style.left=J+k/2+"px",v.current.style.top=H+W/2+"px"}},[a]);const{keys:[y,_],joystick:g}=e,x=g==="invertY"?1:-1,{[y]:{step:A},[_]:{step:M}}=e,w=ca("sizes","joystickWidth"),b=ca("sizes","joystickHeight"),R=parseFloat(w)*.8/2,D=parseFloat(b)*.8/2,C=B.useCallback(()=>{i.current||(u(!0),r.current&&p({x:r.current*R}),s.current&&p({y:s.current*-D}),i.current=window.setInterval(()=>{t(H=>{const J=A*r.current*o.current,k=x*M*s.current*o.current;return Array.isArray(H)?{[y]:H[0]+J,[_]:H[1]+k}:{[y]:H[y]+J,[_]:H[_]+k}})},16))},[R,D,t,p,A,M,y,_,x]),I=B.useCallback(()=>{window.clearTimeout(i.current),i.current=void 0,u(!1)},[]);B.useEffect(()=>{function H(J){o.current=kU(J)}return window.addEventListener("keydown",H),window.addEventListener("keyup",H),()=>{window.clearTimeout(i.current),window.removeEventListener("keydown",H),window.removeEventListener("keyup",H)}},[]);const O=Lm(({first:H,active:J,delta:[k,W],movement:[q,Q]})=>{H&&l(!0);const z=Dl(q,-R,R),j=Dl(Q,-D,D);r.current=Math.abs(q)>Math.abs(z)?Math.sign(q-z):0,s.current=Math.abs(Q)>Math.abs(j)?Math.sign(j-Q):0;let K=n[y],V=n[_];J?(r.current||(K+=k*A*o.current,p({x:z})),s.current||(V-=x*W*M*o.current,p({y:j})),r.current||s.current?C():I(),t({[y]:K,[_]:V})):(l(!1),r.current=0,s.current=0,p({x:0,y:0}),I())});return X.createElement(One,ei({ref:m},O()),a&&X.createElement(QT,null,X.createElement(Fne,{ref:v,isOutOfBounds:c},X.createElement("div",null),X.createElement("span",{ref:h}))))}const Une=st("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function kne(){const{label:n,displayValue:e,onUpdate:t,settings:i}=Ji();return X.createElement(Ds,{input:!0},X.createElement(io,null,n),X.createElement(Une,{withJoystick:!!i.joystick},i.joystick&&X.createElement(Nne,{value:e,settings:i,onUpdate:t}),X.createElement(ZT,{value:e,settings:i,onUpdate:t})))}const zne=["joystick"],Bk=ak(["x","y"]),Hne=n=>{let{joystick:e=!0}=n,t=un(n,zne);const{value:i,settings:r}=Bk.normalize(t);return{value:i,settings:At(At({},r),{},{joystick:e})}};var Gne=At(At({component:kne},Bk),{},{normalize:Hne});const Vne=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].")}},Wne=(n,e)=>typeof e=="object"&&"image"in e,$ne=({image:n})=>({value:n});var Xne=Object.freeze({__proto__:null,sanitize:Vne,schema:Wne,normalize:$ne});const jne=st("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),Jne=st("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"}}}}),Kne=st("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),Yne=st("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),Qne=st("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),qne=st("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 Zne(){const{label:n,value:e,onUpdate:t,disabled:i}=Ji(),{popinRef:r,wrapperRef:s,shown:o,show:a,hide:l}=Rk(),c=B.useCallback(v=>{v.length&&t(v[0])},[t]),u=B.useCallback(v=>{v.stopPropagation(),t(void 0)},[t]),{getRootProps:h,getInputProps:p,isDragAccept:m}=Tk({maxFiles:1,accept:"image/*",onDrop:c,disabled:i});return X.createElement(Ds,{input:!0},X.createElement(io,null,n),X.createElement(jne,null,X.createElement(Kne,{ref:r,hasImage:!!e,onPointerDown:()=>!!e&&a(),onPointerUp:l,style:{backgroundImage:e?`url(${e})`:"none"}}),o&&!!e&&X.createElement(QT,null,X.createElement(ZU,{onPointerUp:l,style:{cursor:"pointer"}}),X.createElement(Yne,{ref:s,style:{backgroundImage:`url(${e})`}})),X.createElement(Jne,h({isDragAccept:m}),X.createElement("input",p()),X.createElement(Qne,null,m?"drop image":"click or drop")),X.createElement(qne,{onClick:u,disabled:!e})))}var eie=At({component:Zne},Xne);const YB=xr().number(),tie=(n,e)=>xr().array().length(2).every.number().test(n)&&xr().schema({min:YB,max:YB}).test(e),by=n=>({min:n[0],max:n[1]}),Dk=(n,{bounds:[e,t]},i)=>{const r=Array.isArray(n)?by(n):n,s={min:i[0],max:i[1]},{min:o,max:a}=At(At({},s),r);return[Dl(Number(o),e,Math.max(e,a)),Dl(Number(a),Math.min(t,o),t)]},nie=({value:n,min:e,max:t})=>{const i={min:e,max:t},r=ok(by(n),{min:i,max:i}),s=[e,t],o=At(At({},r),{},{bounds:s});return{value:Dk(by(n),o,n),settings:o}};var iie=Object.freeze({__proto__:null,schema:tie,format:by,sanitize:Dk,normalize:nie});const rie=["value","bounds","onDrag"],sie=["bounds"],oie=st("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function aie(n){let{value:e,bounds:[t,i],onDrag:r}=n,s=un(n,rie);const o=B.useRef(null),a=B.useRef(null),l=B.useRef(null),c=B.useRef(0),u=ca("sizes","scrubberWidth"),h=Lm(({event:v,first:y,xy:[_],movement:[g],memo:x={}})=>{if(y){const{width:M,left:w}=o.current.getBoundingClientRect();c.current=M-parseFloat(u);const b=(v==null?void 0:v.target)===a.current||(v==null?void 0:v.target)===l.current;x.pos=Ay((_-w)/M,t,i);const R=Math.abs(x.pos-e.min)-Math.abs(x.pos-e.max);x.key=R<0||R===0&&x.pos<=e.min?"min":"max",b&&(x.pos=e[x.key])}const A=x.pos+Ay(g/c.current,0,i-t);return r({[x.key]:HZ(A,s[x.key])}),x}),p=`calc(${Sy(e.min,t,i)} * (100% - ${u} - 8px) + 4px)`,m=`calc(${1-Sy(e.max,t,i)} * (100% - ${u} - 8px) + 4px)`;return X.createElement(ik,ei({ref:o},h()),X.createElement(nk,null,X.createElement(rk,{style:{left:p,right:m}})),X.createElement(nM,{position:"left",ref:a,style:{left:p}}),X.createElement(nM,{position:"right",ref:l,style:{right:m}}))}function lie(){const{label:n,displayValue:e,onUpdate:t,settings:i}=Ji(),r=un(i,sie);return X.createElement(X.Fragment,null,X.createElement(Ds,{input:!0},X.createElement(io,null,n),X.createElement(oie,null,X.createElement(aie,ei({value:e},i,{onDrag:t})),X.createElement(ZT,{value:e,settings:r,onUpdate:t,innerLabelTrim:0}))))}var cie=At({component:lie},iie);const uie=()=>{const n=new Map;return{on:(e,t)=>{let i=n.get(e);i===void 0&&(i=new Set,n.set(e,i)),i.add(t)},off:(e,t)=>{const i=n.get(e);i!==void 0&&(i.delete(t),i.size===0&&n.delete(e))},emit:(e,...t)=>{const i=n.get(e);if(i!==void 0)for(const r of i)r(...t)}}},fie=["type","value"],die=["onChange","transient","onEditStart","onEditEnd"],hie=function(){const e=vT(gK(()=>({data:{}}))),t=uie();this.storeId=eZ(),this.useStore=e;const i={},r=new Set;this.getVisiblePaths=()=>{const o=this.getData(),a=Object.keys(o),l=[];Object.entries(i).forEach(([u,h])=>{h.render&&a.some(p=>p.indexOf(u)===0)&&!h.render(this.get)&&l.push(u+".")});const c=[];return r.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=>r.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 Po&&delete l[c]}}),{data:l}})},this.dispose=()=>{e.setState(()=>({data:{}}))},this.getFolderSettings=o=>i[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:v}=h,y=un(h,fie);m!==p.type?na(wn.INPUT_TYPE_OVERRIDE,m):((p.__refCount===0||a)&&Object.assign(p,y),p.__refCount++)}else c[u]=At(At({},h),{},{__refCount:1})}),{data:c}})},this.setValueAtPath=(o,a,l)=>{e.setState(c=>{const u=c.data;return xB(u[o],a,o,this,l),{data:u}})},this.setSettingsAtPath=(o,a)=>{e.setState(l=>{const c=l.data;return c[o].settings=At(At({},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{xB(c[u],h,void 0,void 0,a)}catch{}}),{data:c}})},this.getInput=o=>{try{return this.getData()[o]}catch{na(wn.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,At(At({},this.getInput(o)),{},{get:this.get}))},this.emitOnEditEnd=o=>{t.emit(`onEditEnd:${o}`,this.get(o),o,At(At({},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 na(wn.EMPTY_KEY);let p=ob(a,u);if(h.type===Po.FOLDER){const m=s(h.schema,p,l);Object.assign(c,m),p in i||(i[p]=h.settings)}else if(u in l)na(wn.DUPLICATE_KEYS,u,p,l[u].path);else{const m=aZ(h,u,p,c);if(m){const{type:v,options:y,input:_}=m,{onChange:g,transient:x,onEditStart:A,onEditEnd:M}=y,w=un(y,die);c[p]=At(At(At({type:v},w),_),{},{fromPanel:!0}),l[u]={path:p,onChange:g,transient:x,onEditStart:A,onEditEnd:M}}else na(wn.UNKNOWN_INPUT,p,h)}}),c};this.getDataFromSchema=o=>{const a={};return[s(o,"",a),a]}};new hie;const QB=n=>"__levaInput"in n,pie=(n,e)=>{const t={},i=e?e.toLowerCase():null;return n.forEach(r=>{const[s,o]=_ne(r);(!i||s.toLowerCase().indexOf(i)>-1)&&yne(t,o,{[s]:{__levaInput:!0,path:r}})}),t},mie=["type","label","path","valueKey","value","settings","setValue","disabled"];function gie(n){let{type:e,label:t,path:i,valueKey:r,value:s,settings:o,setValue:a,disabled:l}=n,c=un(n,mie);const{displayValue:u,onChange:h,onUpdate:p}=ek({type:e,value:s,settings:o,setValue:a}),m=Zc[e].component;return m?X.createElement(WU.Provider,{value:At({key:r,path:i,id:""+i,label:t,displayValue:u,value:s,onChange:h,onUpdate:p,settings:o,setValue:a,disabled:l},c)},X.createElement(wZ,{disabled:l},X.createElement(m,null))):(na(wn.NO_COMPONENT_FOR_TYPE,e,i),null)}const vie=st("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 yie({onClick:n,settings:e,label:t}){const i=Dm();return X.createElement(Ds,null,X.createElement(vie,{disabled:e.disabled,onClick:()=>n(i.get)},t))}const _ie=st("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),xie=st("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),Sie=({label:n,opts:e})=>{let t=typeof n=="string"&&n.trim()===""?null:n,i=e;return typeof e.opts=="object"&&(i.label!==void 0&&(t=e.label),i=e.opts),{label:t,opts:i}};function Aie(n){const{label:e,opts:t}=Sie(n),i=Dm();return X.createElement(Ds,{input:!!e},e&&X.createElement(io,null,e),X.createElement(_ie,null,Object.entries(t).map(([r,s])=>X.createElement(xie,{key:r,onClick:()=>s(i.get)},r))))}const Eie=st("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),Lk=100;function Mie(n,e){n.push(e),n.length>Lk&&n.shift()}const wie=B.forwardRef(function({initialValue:n},e){const t=ca("colors","highlight3"),i=ca("colors","elevation2"),r=ca("colors","highlight1"),[s,o]=B.useMemo(()=>[nr(r).alpha(.4).toRgbString(),nr(r).alpha(.1).toRgbString()],[r]),a=B.useRef([n]),l=B.useRef(n),c=B.useRef(n),u=B.useRef(),h=B.useCallback((v,y)=>{if(!v)return;const{width:_,height:g}=v,x=new Path2D,A=_/Lk,M=g*.05;for(let R=0;R({frame:v=>{(l.current===void 0||vc.current)&&(c.current=v),Mie(a.current,v),u.current=requestAnimationFrame(()=>h(p.current,m.current))}}),[p,m,h]),B.useEffect(()=>()=>cancelAnimationFrame(u.current),[]),X.createElement(Eie,{ref:p})}),qB=n=>Number.isFinite(n)?n.toPrecision(2):n.toString(),Tie=B.forwardRef(function({initialValue:n},e){const[t,i]=B.useState(qB(n));return B.useImperativeHandle(e,()=>({frame:r=>i(qB(r))}),[]),X.createElement("div",null,t)});function ZB(n){return typeof n=="function"?n():n.current}function bie({label:n,objectOrFn:e,settings:t}){const i=B.useRef(),r=B.useRef(ZB(e));return B.useEffect(()=>{const s=window.setInterval(()=>{var o;document.hidden||(o=i.current)===null||o===void 0||o.frame(ZB(e))},t.interval);return()=>window.clearInterval(s)},[e,t.interval]),X.createElement(Ds,{input:!0},X.createElement(io,{align:"top"},n),t.graph?X.createElement(wie,{ref:i,initialValue:r.current}):X.createElement(Tie,{ref:i,initialValue:r.current}))}const Cie=["type","label","key"],Rie={[Po.BUTTON]:yie,[Po.BUTTON_GROUP]:Aie,[Po.MONITOR]:bie},Pie=X.memo(({path:n})=>{const[e,{set:t,setSettings:i,disable:r,storeId:s,emitOnEditStart:o,emitOnEditEnd:a}]=FZ(n);if(!e)return null;const{type:l,label:c,key:u}=e,h=un(e,Cie);if(l in Po){const p=Rie[l];return X.createElement(p,ei({label:c,path:n},h))}return l in Zc?X.createElement(gie,ei({key:s+n,type:l,label:c,storeId:s,path:n,valueKey:u,setValue:t,setSettings:i,disable:r,emitOnEditStart:o,emitOnEditEnd:a},h)):(Xq(wn.UNSUPPORTED_INPUT,l,n),null)});function Iie({toggle:n,toggled:e,name:t}){return X.createElement(AZ,{onClick:()=>n()},X.createElement(qT,{toggled:e}),X.createElement("div",null,t))}const Bie=({name:n,path:e,tree:t})=>{const i=Dm(),r=ob(e,n),{collapsed:s,color:o}=i.getFolderSettings(r),[a,l]=B.useState(!s),c=B.useRef(null),u=ca("colors","folderWidgetColor"),h=ca("colors","folderTextColor");return B.useLayoutEffect(()=>{c.current.style.setProperty("--leva-colors-folderWidgetColor",o||u),c.current.style.setProperty("--leva-colors-folderTextColor",o||h)},[o,u,h]),X.createElement(Ey,{ref:c},X.createElement(Iie,{name:n,toggled:a,toggle:()=>l(p=>!p)}),X.createElement(Ok,{parent:r,tree:t,toggled:a}))},Ok=X.memo(({isRoot:n=!1,fill:e=!1,flat:t=!1,parent:i,tree:r,toggled:s})=>{const{wrapperRef:o,contentRef:a}=xne(s),l=Dm(),c=([h,p])=>{var m;return(QB(p)?(m=l.getInput(p.path))===null||m===void 0?void 0:m.order:l.getFolderSettings(ob(i,h)).order)||0},u=Object.entries(r).sort((h,p)=>c(h)-c(p));return X.createElement(eM,{ref:o,isRoot:n,fill:e,flat:t},X.createElement(YU,{ref:a,isRoot:n,toggled:s},u.map(([h,p])=>QB(p)?X.createElement(Pie,{key:p.path,valueKey:p.valueKey,path:p.path}):X.createElement(Bie,{key:h,name:h,path:i,tree:p}))))}),Die=st("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:{[`${qU}`]:{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"}}),Fk=40,Cy=st("i",{$flexCenter:"",width:Fk,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),Lie=st("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),Oie=st("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${Cy}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),Fie=st("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),Nie=st("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:Fk}}}}),Uie=X.forwardRef(({setFilter:n,toggle:e},t)=>{const[i,r]=B.useState(""),s=B.useMemo(()=>UU(n,250),[n]),o=()=>{n(""),r("")},a=l=>{const c=l.currentTarget.value;e(!0),r(c)};return B.useEffect(()=>{s(i)},[i,s]),X.createElement(X.Fragment,null,X.createElement(Fie,{ref:t,value:i,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:l=>l.stopPropagation(),onChange:a}),X.createElement(Cy,{onClick:()=>o(),style:{visibility:i?"visible":"hidden"}},X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},X.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 kie({setFilter:n,onDrag:e,onDragStart:t,onDragEnd:i,toggle:r,toggled:s,title:o,drag:a,filterEnabled:l,from:c}){const[u,h]=B.useState(!1),p=B.useRef(null);B.useEffect(()=>{var v,y;u?(v=p.current)===null||v===void 0||v.focus():(y=p.current)===null||y===void 0||y.blur()},[u]);const m=Lm(({offset:[v,y],first:_,last:g})=>{e({x:v,y}),_&&t({x:v,y}),g&&i({x:v,y})},{filterTaps:!0,from:({offset:[v,y]})=>[(c==null?void 0:c.x)||v,(c==null?void 0:c.y)||y]});return B.useEffect(()=>{const v=y=>{y.key==="L"&&y.shiftKey&&y.metaKey&&h(_=>!_)};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]),X.createElement(X.Fragment,null,X.createElement(Lie,{mode:a?"drag":void 0},X.createElement(Cy,{active:!s,onClick:()=>r()},X.createElement(qT,{toggled:s,width:12,height:8})),X.createElement(Nie,ei({},a?m():{},{drag:a,filterEnabled:l}),o===void 0&&a?X.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},X.createElement("circle",{cx:"2",cy:"2",r:"2"}),X.createElement("circle",{cx:"14",cy:"2",r:"2"}),X.createElement("circle",{cx:"26",cy:"2",r:"2"}),X.createElement("circle",{cx:"2",cy:"12",r:"2"}),X.createElement("circle",{cx:"14",cy:"12",r:"2"}),X.createElement("circle",{cx:"26",cy:"12",r:"2"})):o),l&&X.createElement(Cy,{active:u,onClick:()=>h(v=>!v)},X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},X.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),X.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"})))),X.createElement(Oie,{toggled:u},X.createElement(Uie,{ref:p,setFilter:n,toggle:r})))}X.memo(({store:n,rootClass:e,fill:t=!1,flat:i=!1,neverHide:r=!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=Sne(n),[m,v]=B.useState(""),y=B.useMemo(()=>pie(p,m),[p,m]),[_,g]=tk(),x=r||p.length>0,A=typeof o=="object"&&o.title||void 0,M=typeof o=="object"&&(u=o.drag)!==null&&u!==void 0?u:!0,w=typeof o=="object"&&(h=o.filter)!==null&&h!==void 0?h:!0,b=typeof o=="object"&&o.position||void 0,R=typeof o=="object"&&o.onDrag||void 0,D=typeof o=="object"&&o.onDragStart||void 0,C=typeof o=="object"&&o.onDragEnd||void 0;return X.useEffect(()=>{g({x:b==null?void 0:b.x,y:b==null?void 0:b.y})},[b,g]),gZ(),X.createElement(jU.Provider,{value:{hideCopyButton:a}},X.createElement(Die,{ref:_,className:e,fill:t,flat:i,oneLineLabels:s,hideTitleBar:!o,style:{display:x?"block":"none"}},o&&X.createElement(kie,{onDrag:I=>{g(I),R==null||R(I)},onDragStart:I=>D==null?void 0:D(I),onDragEnd:I=>C==null?void 0:C(I),setFilter:v,toggle:I=>c(O=>I??!O),toggled:l,title:A,drag:M,filterEnabled:w,from:b}),x&&X.createElement(XU.Provider,{value:n},X.createElement(Ok,{isRoot:!0,fill:t,flat:i,tree:y,toggled:l}))))});Ca(Qs.SELECT,ZZ);Ca(Qs.IMAGE,eie);Ca(Qs.NUMBER,VZ);Ca(Qs.COLOR,Bne);Ca(Qs.STRING,lee);Ca(Qs.BOOLEAN,mee);Ca(Qs.INTERVAL,cie);Ca(Qs.VECTOR3D,Lne);Ca(Qs.VECTOR2D,Gne);function Qo(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Nk(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! * GSAP 3.12.5 * https://gsap.com * * @license Copyright 2008-2024, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var Xr={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},ud={duration:.5,overwrite:!1,delay:0},ab,Vi,_n,Ss=1e8,an=1/Ss,mM=Math.PI*2,zie=mM/4,Hie=0,Uk=Math.sqrt,Gie=Math.cos,Vie=Math.sin,xi=function(e){return typeof e=="string"},kn=function(e){return typeof e=="function"},Ea=function(e){return typeof e=="number"},lb=function(e){return typeof e>"u"},Oo=function(e){return typeof e=="object"},Mr=function(e){return e!==!1},cb=function(){return typeof window<"u"},ev=function(e){return kn(e)||xi(e)},kk=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Wi=Array.isArray,gM=/(?:-?\.?\d|\.)+/gi,zk=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ef=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,LS=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Hk=/[+-]=-?[.\d]+/,Gk=/[^,'"\[\]\s]+/gi,Wie=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,bn,yo,vM,ub,Kr={},Ry={},Vk,Wk=function(e){return(Ry=eu(e,Kr))&&Cr},fb=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},qp=function(e,t){return!t&&console.warn(e)},$k=function(e,t){return e&&(Kr[e]=t)&&Ry&&(Ry[e]=t)||Kr},Zp=function(){return 0},$ie={suppressEvents:!0,isStart:!0,kill:!1},Tv={suppressEvents:!0,kill:!1},Xie={suppressEvents:!0},db={},Sl=[],yM={},Xk,Nr={},OS={},eD=30,bv=[],hb="",pb=function(e){var t=e[0],i,r;if(Oo(t)||kn(t)||(e=[e]),!(i=(t._gsap||{}).harness)){for(r=bv.length;r--&&!bv[r].targetTest(t););i=bv[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new gz(e[r],i)))||e.splice(r,1);return e},Uc=function(e){return e._gsap||pb(As(e))[0]._gsap},jk=function(e,t,i){return(i=e[t])&&kn(i)?e[t]():lb(i)&&e.getAttribute&&e.getAttribute(t)||i},wr=function(e,t){return(e=e.split(",")).forEach(t)||e},Vn=function(e){return Math.round(e*1e5)/1e5||0},vi=function(e){return Math.round(e*1e7)/1e7||0},Uf=function(e,t){var i=t.charAt(0),r=parseFloat(t.substr(2));return e=parseFloat(e),i==="+"?e+r:i==="-"?e-r:i==="*"?e*r:e/r},jie=function(e,t){for(var i=t.length,r=0;e.indexOf(t[r])<0&&++ra;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[i],e[i]=t),t._next?t._next._prev=t:e[r]=t,t._prev=o,t.parent=t._dp=e,t},V_=function(e,t,i,r){i===void 0&&(i="_first"),r===void 0&&(r="_last");var s=t._prev,o=t._next;s?s._next=o:e[i]===t&&(e[i]=o),o?o._prev=s:e[r]===t&&(e[r]=s),t._next=t._prev=t.parent=null},Ll=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},kc=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var i=e;i;)i._dirty=1,i=i.parent;return e},Yie=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},_M=function(e,t,i,r){return e._startAt&&(Vi?e._startAt.revert(Tv):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,r))},Qie=function n(e){return!e||e._ts&&n(e.parent)},nD=function(e){return e._repeat?fd(e._tTime,e=e.duration()+e._rDelay)*e:0},fd=function(e,t){var i=Math.floor(e/=t);return e&&i===e?i-1:i},By=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},W_=function(e){return e._end=vi(e._start+(e._tDur/Math.abs(e._ts||e._rts||an)||0))},$_=function(e,t){var i=e._dp;return i&&i.smoothChildTiming&&e._ts&&(e._start=vi(i._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),W_(e),i._dirty||kc(i,e)),e},qk=function(e,t){var i;if((t._time||!t._dur&&t._initted||t._startan)&&t.render(i,!0)),kc(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&i.totalTime(i._tTime),i=i._dp;e._zTime=-an}},So=function(e,t,i,r){return t.parent&&Ll(t),t._start=vi((Ea(i)?i:i||e!==bn?us(e,i,t):e._time)+t._delay),t._end=vi(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),Qk(e,t,"_first","_last",e._sort?"_start":0),xM(t)||(e._recent=t),r||qk(e,t),e._ts<0&&$_(e,e._tTime),e},Zk=function(e,t){return(Kr.ScrollTrigger||fb("scrollTrigger",t))&&Kr.ScrollTrigger.create(t,e)},ez=function(e,t,i,r,s){if(gb(e,t,s),!e._initted)return 1;if(!i&&e._pt&&!Vi&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&Xk!==kr.frame)return Sl.push(e),e._lazy=[s,r],1},qie=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},xM=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},Zie=function(e,t,i,r){var s=e.ratio,o=t<0||!t&&(!e._start&&qie(e)&&!(!e._initted&&xM(e))||(e._ts<0||e._dp._ts<0)&&!xM(e))?0:1,a=e._rDelay,l=0,c,u,h;if(a&&e._repeat&&(l=Nm(0,e._tDur,t),u=fd(l,a),e._yoyo&&u&1&&(o=1-o),u!==fd(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||Vi||r||e._zTime===an||!t&&e._zTime){if(!e._initted&&ez(e,t,r,i,l))return;for(h=e._zTime,e._zTime=t||(i?an:0),i||(i=t&&!h),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,c=e._pt;c;)c.r(o,c.d),c=c._next;t<0&&_M(e,t,i,!0),e._onUpdate&&!i&&Gr(e,"onUpdate"),l&&e._repeat&&!i&&e.parent&&Gr(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&Ll(e,1),!i&&!Vi&&(Gr(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},ere=function(e,t,i){var r;if(i>t)for(r=e._first;r&&r._start<=i;){if(r.data==="isPause"&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=i;){if(r.data==="isPause"&&r._start0&&!r&&$_(e,e._tTime=e._tDur*a),e.parent&&W_(e),i||kc(e.parent,e),e},iD=function(e){return e instanceof rr?kc(e):dd(e,e._dur)},tre={_start:0,endTime:Zp,totalDuration:Zp},us=function n(e,t,i){var r=e.labels,s=e._recent||tre,o=e.duration()>=Ss?s.endTime(!1):e._dur,a,l,c;return xi(t)&&(isNaN(t)||t in r)?(l=t.charAt(0),c=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(c?(a<0?s:i).totalDuration()/100:1)):a<0?(t in r||(r[t]=o),r[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),c&&i&&(l=l/100*(Wi(i)?i[0]:i).totalDuration()),a>1?n(e,t.substr(0,a-1),i)+l:o+l)):t==null?o:+t},lp=function(e,t,i){var r=Ea(t[1]),s=(r?2:1)+(e<2?0:1),o=t[s],a,l;if(r&&(o.duration=t[1]),o.parent=i,e){for(a=o,l=i;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=Mr(l.vars.inherit)&&l.parent;o.immediateRender=Mr(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new Yn(t[0],o,t[s+1])},Wl=function(e,t){return e||e===0?t(e):t},Nm=function(e,t,i){return it?t:i},zi=function(e,t){return!xi(e)||!(t=Wie.exec(e))?"":t[1]},nre=function(e,t,i){return Wl(i,function(r){return Nm(e,t,r)})},SM=[].slice,tz=function(e,t){return e&&Oo(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Oo(e[0]))&&!e.nodeType&&e!==yo},ire=function(e,t,i){return i===void 0&&(i=[]),e.forEach(function(r){var s;return xi(r)&&!t||tz(r,1)?(s=i).push.apply(s,As(r)):i.push(r)})||i},As=function(e,t,i){return _n&&!t&&_n.selector?_n.selector(e):xi(e)&&!i&&(vM||!hd())?SM.call((t||ub).querySelectorAll(e),0):Wi(e)?ire(e,i):tz(e)?SM.call(e,0):e?[e]:[]},AM=function(e){return e=As(e)[0]||qp("Invalid scope")||{},function(t){var i=e.current||e.nativeElement||e;return As(t,i.querySelectorAll?i:i===e?qp("Invalid scope")||ub.createElement("div"):e)}},nz=function(e){return e.sort(function(){return .5-Math.random()})},iz=function(e){if(kn(e))return e;var t=Oo(e)?e:{each:e},i=zc(t.ease),r=t.from||0,s=parseFloat(t.base)||0,o={},a=r>0&&r<1,l=isNaN(r)||a,c=t.axis,u=r,h=r;return xi(r)?u=h={center:.5,edges:.5,end:1}[r]||0:!a&&l&&(u=r[0],h=r[1]),function(p,m,v){var y=(v||t).length,_=o[y],g,x,A,M,w,b,R,D,C;if(!_){if(C=t.grid==="auto"?0:(t.grid||[1,Ss])[1],!C){for(R=-Ss;R<(R=v[C++].getBoundingClientRect().left)&&CR&&(R=w),wy?y-1:c?c==="y"?y/C:C:Math.max(C,y/C))||0)*(r==="edges"?-1:1),_.b=y<0?s-y:s,_.u=zi(t.amount||t.each)||0,i=i&&y<0?hz(i):i}return y=(_[p]-_.min)/_.max||0,vi(_.b+(i?i(y):y)*_.v)+_.u}},EM=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(i){var r=vi(Math.round(parseFloat(i)/e)*e*t);return(r-r%1)/t+(Ea(i)?0:zi(i))}},rz=function(e,t){var i=Wi(e),r,s;return!i&&Oo(e)&&(r=i=e.radius||Ss,e.values?(e=As(e.values),(s=!Ea(e[0]))&&(r*=r)):e=EM(e.increment)),Wl(t,i?kn(e)?function(o){return s=e(o),Math.abs(s-o)<=r?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),c=Ss,u=0,h=e.length,p,m;h--;)s?(p=e[h].x-a,m=e[h].y-l,p=p*p+m*m):p=Math.abs(e[h]-a),pr?s-o:o)})},em=function(e){for(var t=0,i="",r,s,o,a;~(r=e.indexOf("random(",t));)o=e.indexOf(")",r),a=e.charAt(r+7)==="[",s=e.substr(r+7,o-r-7).match(a?Gk:gM),i+=e.substr(t,r-t)+sz(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return i+e.substr(t,e.length-t)},az=function(e,t,i,r,s){var o=t-e,a=r-i;return Wl(s,function(l){return i+((l-e)/o*a||0)})},cre=function n(e,t,i,r){var s=isNaN(e+t)?0:function(m){return(1-m)*e+m*t};if(!s){var o=xi(e),a={},l,c,u,h,p;if(i===!0&&(r=1)&&(i=null),o)e={p:e},t={p:t};else if(Wi(e)&&!Wi(t)){for(u=[],h=e.length,p=h-2,c=1;c(a=Math.abs(a))&&(l=o,s=a);return l},Gr=function(e,t,i){var r=e.vars,s=r[t],o=_n,a=e._ctx,l,c,u;if(s)return l=r[t+"Params"],c=r.callbackScope||e,i&&Sl.length&&Py(),a&&(_n=a),u=l?s.apply(c,l):s.call(c),_n=o,u},kh=function(e){return Ll(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Vi),e.progress()<1&&Gr(e,"onInterrupt"),e},Mf,lz=[],cz=function(e){if(e)if(e=!e.name&&e.default||e,cb()||e.headless){var t=e.name,i=kn(e),r=t&&!i&&e.init?function(){this._props=[]}:e,s={init:Zp,render:_b,add:mb,kill:wre,modifier:Mre,rawVars:0},o={targetTest:0,get:0,getSetter:yb,aliases:{},register:0};if(hd(),e!==r){if(Nr[t])return;Ps(r,Ps(Iy(e,s),o)),eu(r.prototype,eu(s,Iy(e,o))),Nr[r.prop=t]=r,e.targetTest&&(bv.push(r),db[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}$k(t,r),e.register&&e.register(Cr,r,Tr)}else lz.push(e)},rn=255,zh={aqua:[0,rn,rn],lime:[0,rn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,rn],navy:[0,0,128],white:[rn,rn,rn],olive:[128,128,0],yellow:[rn,rn,0],orange:[rn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[rn,0,0],pink:[rn,192,203],cyan:[0,rn,rn],transparent:[rn,rn,rn,0]},FS=function(e,t,i){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(i-t)*e*6:e<.5?i:e*3<2?t+(i-t)*(2/3-e)*6:t)*rn+.5|0},uz=function(e,t,i){var r=e?Ea(e)?[e>>16,e>>8&rn,e&rn]:0:zh.black,s,o,a,l,c,u,h,p,m,v;if(!r){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),zh[e])r=zh[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return r=parseInt(e.substr(1,6),16),[r>>16,r>>8&rn,r&rn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),r=[e>>16,e>>8&rn,e&rn]}else if(e.substr(0,3)==="hsl"){if(r=v=e.match(gM),!t)l=+r[0]%360/360,c=+r[1]/100,u=+r[2]/100,o=u<=.5?u*(c+1):u+c-u*c,s=u*2-o,r.length>3&&(r[3]*=1),r[0]=FS(l+1/3,s,o),r[1]=FS(l,s,o),r[2]=FS(l-1/3,s,o);else if(~e.indexOf("="))return r=e.match(zk),i&&r.length<4&&(r[3]=1),r}else r=e.match(gM)||zh.transparent;r=r.map(Number)}return t&&!v&&(s=r[0]/rn,o=r[1]/rn,a=r[2]/rn,h=Math.max(s,o,a),p=Math.min(s,o,a),u=(h+p)/2,h===p?l=c=0:(m=h-p,c=u>.5?m/(2-h-p):m/(h+p),l=h===s?(o-a)/m+(oe||g<0)&&(i+=g-t),r+=g,w=r-i,A=w-o,(A>0||x)&&(b=++h.frame,p=w-h.time*1e3,h.time=w=w/1e3,o+=A+(A>=s?4:s-A),M=1),x||(l=c(y)),M)for(m=0;m=g&&m--},_listeners:a},h}(),hd=function(){return!tm&&kr.wake()},Ft={},fre=/^[\d.\-M][\d.\-,\s]/,dre=/["']/g,hre=function(e){for(var t={},i=e.substr(1,e.length-3).split(":"),r=i[0],s=1,o=i.length,a,l,c;s1&&i.config?i.config.apply(null,~e.indexOf("{")?[hre(t[1])]:pre(e).split(",").map(Kk)):Ft._CE&&fre.test(e)?Ft._CE("",e):i},hz=function(e){return function(t){return 1-e(1-t)}},pz=function n(e,t){for(var i=e._first,r;i;)i instanceof rr?n(i,t):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==t&&(i.timeline?n(i.timeline,t):(r=i._ease,i._ease=i._yEase,i._yEase=r,i._yoyo=t)),i=i._next},zc=function(e,t){return e&&(kn(e)?e:Ft[e]||mre(e))||t},fu=function(e,t,i,r){i===void 0&&(i=function(l){return 1-t(1-l)}),r===void 0&&(r=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:i,easeInOut:r},o;return wr(e,function(a){Ft[a]=Kr[a]=s,Ft[o=a.toLowerCase()]=i;for(var l in s)Ft[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Ft[a+"."+l]=s[l]}),s},mz=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},NS=function n(e,t,i){var r=t>=1?t:1,s=(i||(e?.3:.45))/(t<1?t:1),o=s/mM*(Math.asin(1/r)||0),a=function(u){return u===1?1:r*Math.pow(2,-10*u)*Vie((u-o)*s)+1},l=e==="out"?a:e==="in"?function(c){return 1-a(1-c)}:mz(a);return s=mM/s,l.config=function(c,u){return n(e,c,u)},l},US=function n(e,t){t===void 0&&(t=1.70158);var i=function(o){return o?--o*o*((t+1)*o+t)+1:0},r=e==="out"?i:e==="in"?function(s){return 1-i(1-s)}:mz(i);return r.config=function(s){return n(e,s)},r};wr("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;fu(n+",Power"+(t-1),e?function(i){return Math.pow(i,t)}:function(i){return i},function(i){return 1-Math.pow(1-i,t)},function(i){return i<.5?Math.pow(i*2,t)/2:1-Math.pow((1-i)*2,t)/2})});Ft.Linear.easeNone=Ft.none=Ft.Linear.easeIn;fu("Elastic",NS("in"),NS("out"),NS());(function(n,e){var t=1/e,i=2*t,r=2.5*t,s=function(a){return a0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},e.totalDuration=function(i){return arguments.length?(this._dirty=0,dd(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(i,r){if(hd(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for($_(this,i),!s._dp||s.parent||qk(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i0||!this._tDur&&!i)&&So(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===an||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),Jk(this,i,r)),this},e.time=function(i,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+nD(this))%(this._dur+this._rDelay)||(i?this._dur:0),r):this._time},e.totalProgress=function(i,r){return arguments.length?this.totalTime(this.totalDuration()*i,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(i,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+nD(this),r):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(i,r){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*s,r):this._repeat?fd(this._tTime,s)+1:1},e.timeScale=function(i,r){if(!arguments.length)return this._rts===-an?0:this._rts;if(this._rts===i)return this;var s=this.parent&&this._ts?By(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-an?0:this._rts,this.totalTime(Nm(-Math.abs(this._delay),this._tDur,s),r!==!1),W_(this),Yie(this)},e.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(hd(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==an&&(this._tTime-=an)))),this):this._ps},e.startTime=function(i){if(arguments.length){this._start=i;var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&So(r,this,i-this._delay),this}return this._start},e.endTime=function(i){return this._start+(Mr(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(i){var r=this.parent||this._dp;return r?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?By(r.rawTime(i),this):this._tTime:this._tTime},e.revert=function(i){i===void 0&&(i=Xie);var r=Vi;return Vi=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),Vi=r,this},e.globalTime=function(i){for(var r=this,s=arguments.length?i:r.rawTime();r;)s=r._start+s/(Math.abs(r._ts)||1),r=r._dp;return!this.parent&&this._sat?this._sat.globalTime(i):s},e.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,iD(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(i){if(arguments.length){var r=this._time;return this._rDelay=i,iD(this),r?this.time(r):this}return this._rDelay},e.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},e.seek=function(i,r){return this.totalTime(us(this,i),Mr(r))},e.restart=function(i,r){return this.play().totalTime(i?-this._delay:0,Mr(r))},e.play=function(i,r){return i!=null&&this.seek(i,r),this.reversed(!1).paused(!1)},e.reverse=function(i,r){return i!=null&&this.seek(i||this.totalDuration(),r),this.reversed(!0).paused(!1)},e.pause=function(i,r){return i!=null&&this.seek(i,r),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-an:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-an,this},e.isActive=function(){var i=this.parent||this._dp,r=this._start,s;return!!(!i||this._ts&&this._initted&&i.isActive()&&(s=i.rawTime(!0))>=r&&s1?(r?(o[i]=r,s&&(o[i+"Params"]=s),i==="onUpdate"&&(this._onUpdate=r)):delete o[i],this):o[i]},e.then=function(i){var r=this;return new Promise(function(s){var o=kn(i)?i:Yk,a=function(){var c=r.then;r.then=null,kn(o)&&(o=o(r))&&(o.then||o===r)&&(r.then=c),s(o),r.then=c};r._initted&&r.totalProgress()===1&&r._ts>=0||!r._tTime&&r._ts<0?a():r._prom=a})},e.kill=function(){kh(this)},n}();Ps(nm.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-an,_prom:0,_ps:!1,_rts:1});var rr=function(n){Nk(e,n);function e(i,r){var s;return i===void 0&&(i={}),s=n.call(this,i)||this,s.labels={},s.smoothChildTiming=!!i.smoothChildTiming,s.autoRemoveChildren=!!i.autoRemoveChildren,s._sort=Mr(i.sortChildren),bn&&So(i.parent||bn,Qo(s),r),i.reversed&&s.reverse(),i.paused&&s.paused(!0),i.scrollTrigger&&Zk(Qo(s),i.scrollTrigger),s}var t=e.prototype;return t.to=function(r,s,o){return lp(0,arguments,this),this},t.from=function(r,s,o){return lp(1,arguments,this),this},t.fromTo=function(r,s,o,a){return lp(2,arguments,this),this},t.set=function(r,s,o){return s.duration=0,s.parent=this,ap(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new Yn(r,s,us(this,o),1),this},t.call=function(r,s,o){return So(this,Yn.delayedCall(0,r,s),o)},t.staggerTo=function(r,s,o,a,l,c,u){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=c,o.onCompleteParams=u,o.parent=this,new Yn(r,o,us(this,l)),this},t.staggerFrom=function(r,s,o,a,l,c,u){return o.runBackwards=1,ap(o).immediateRender=Mr(o.immediateRender),this.staggerTo(r,s,o,a,l,c,u)},t.staggerFromTo=function(r,s,o,a,l,c,u,h){return a.startAt=o,ap(a).immediateRender=Mr(a.immediateRender),this.staggerTo(r,s,a,l,c,u,h)},t.render=function(r,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,c=this._dur,u=r<=0?0:vi(r),h=this._zTime<0!=r<0&&(this._initted||!c),p,m,v,y,_,g,x,A,M,w,b,R;if(this!==bn&&u>l&&r>=0&&(u=l),u!==this._tTime||o||h){if(a!==this._time&&c&&(u+=this._time-a,r+=this._time-a),p=u,M=this._start,A=this._ts,g=!A,h&&(c||(a=this._zTime),(r||!s)&&(this._zTime=r)),this._repeat){if(b=this._yoyo,_=c+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(_*100+r,s,o);if(p=vi(u%_),u===l?(y=this._repeat,p=c):(y=~~(u/_),y&&y===u/_&&(p=c,y--),p>c&&(p=c)),w=fd(this._tTime,_),!a&&this._tTime&&w!==y&&this._tTime-w*_-this._dur<=0&&(w=y),b&&y&1&&(p=c-p,R=1),y!==w&&!this._lock){var D=b&&w&1,C=D===(b&&y&1);if(y=a&&r>=0)for(m=this._first;m;){if(v=m._next,(m._act||p>=m._start)&&m._ts&&x!==m){if(m.parent!==this)return this.render(r,s,o);if(m.render(m._ts>0?(p-m._start)*m._ts:(m._dirty?m.totalDuration():m._tDur)+(p-m._start)*m._ts,s,o),p!==this._time||!this._ts&&!g){x=0,v&&(u+=this._zTime=-an);break}}m=v}else{m=this._last;for(var I=r<0?r:p;m;){if(v=m._prev,(m._act||I<=m._end)&&m._ts&&x!==m){if(m.parent!==this)return this.render(r,s,o);if(m.render(m._ts>0?(I-m._start)*m._ts:(m._dirty?m.totalDuration():m._tDur)+(I-m._start)*m._ts,s,o||Vi&&(m._initted||m._startAt)),p!==this._time||!this._ts&&!g){x=0,v&&(u+=this._zTime=I?-an:an);break}}m=v}}if(x&&!s&&(this.pause(),x.render(p>=a?0:-an)._zTime=p>=a?1:-1,this._ts))return this._start=M,W_(this),this.render(r,s,o);this._onUpdate&&!s&&Gr(this,"onUpdate",!0),(u===l&&this._tTime>=this.totalDuration()||!u&&a)&&(M===this._start||Math.abs(A)!==Math.abs(this._ts))&&(this._lock||((r||!c)&&(u===l&&this._ts>0||!u&&this._ts<0)&&Ll(this,1),!s&&!(r<0&&!a)&&(u||a||!l)&&(Gr(this,u===l&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom())))}return this},t.add=function(r,s){var o=this;if(Ea(s)||(s=us(this,s,r)),!(r instanceof nm)){if(Wi(r))return r.forEach(function(a){return o.add(a,s)}),this;if(xi(r))return this.addLabel(r,s);if(kn(r))r=Yn.delayedCall(0,r);else return this}return this!==r?So(this,r,s):this},t.getChildren=function(r,s,o,a){r===void 0&&(r=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ss);for(var l=[],c=this._first;c;)c._start>=a&&(c instanceof Yn?s&&l.push(c):(o&&l.push(c),r&&l.push.apply(l,c.getChildren(!0,s,o)))),c=c._next;return l},t.getById=function(r){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===r)return s[o]},t.remove=function(r){return xi(r)?this.removeLabel(r):kn(r)?this.killTweensOf(r):(V_(this,r),r===this._recent&&(this._recent=this._last),kc(this))},t.totalTime=function(r,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=vi(kr.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),n.prototype.totalTime.call(this,r,s),this._forcing=0,this):this._tTime},t.addLabel=function(r,s){return this.labels[r]=us(this,s),this},t.removeLabel=function(r){return delete this.labels[r],this},t.addPause=function(r,s,o){var a=Yn.delayedCall(0,s||Zp,o);return a.data="isPause",this._hasPause=1,So(this,a,us(this,r))},t.removePause=function(r){var s=this._first;for(r=us(this,r);s;)s._start===r&&s.data==="isPause"&&Ll(s),s=s._next},t.killTweensOf=function(r,s,o){for(var a=this.getTweensOf(r,o),l=a.length;l--;)al!==a[l]&&a[l].kill(r,s);return this},t.getTweensOf=function(r,s){for(var o=[],a=As(r),l=this._first,c=Ea(s),u;l;)l instanceof Yn?jie(l._targets,a)&&(c?(!al||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(u=l.getTweensOf(a,s)).length&&o.push.apply(o,u),l=l._next;return o},t.tweenTo=function(r,s){s=s||{};var o=this,a=us(o,r),l=s,c=l.startAt,u=l.onStart,h=l.onStartParams,p=l.immediateRender,m,v=Yn.to(o,Ps({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale())||an,onStart:function(){if(o.pause(),!m){var _=s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale());v._dur!==_&&dd(v,_,0,1).render(v._time,!0,!0),m=1}u&&u.apply(v,h||[])}},s));return p?v.render(0):v},t.tweenFromTo=function(r,s,o){return this.tweenTo(s,Ps({startAt:{time:us(this,r)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(r){return r===void 0&&(r=this._time),rD(this,us(this,r))},t.previousLabel=function(r){return r===void 0&&(r=this._time),rD(this,us(this,r),1)},t.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+an)},t.shiftChildren=function(r,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,c;a;)a._start>=o&&(a._start+=r,a._end+=r),a=a._next;if(s)for(c in l)l[c]>=o&&(l[c]+=r);return kc(this)},t.invalidate=function(r){var s=this._first;for(this._lock=0;s;)s.invalidate(r),s=s._next;return n.prototype.invalidate.call(this,r)},t.clear=function(r){r===void 0&&(r=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),r&&(this.labels={}),kc(this)},t.totalDuration=function(r){var s=0,o=this,a=o._last,l=Ss,c,u,h;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-r:r));if(o._dirty){for(h=o.parent;a;)c=a._prev,a._dirty&&a.totalDuration(),u=a._start,u>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,So(o,a,u-a._delay,1)._lock=0):l=u,u<0&&a._ts&&(s-=u,(!h&&!o._dp||h&&h.smoothChildTiming)&&(o._start+=u/o._ts,o._time-=u,o._tTime-=u),o.shiftChildren(-u,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=c;dd(o,o===bn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(r){if(bn._ts&&(Jk(bn,By(r,bn)),Xk=kr.frame),kr.frame>=eD){eD+=Xr.autoSleep||120;var s=bn._first;if((!s||!s._ts)&&Xr.autoSleep&&kr._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||kr.sleep()}}},e}(nm);Ps(rr.prototype,{_lock:0,_hasPause:0,_forcing:0});var gre=function(e,t,i,r,s,o,a){var l=new Tr(this._pt,e,t,0,1,Az,null,s),c=0,u=0,h,p,m,v,y,_,g,x;for(l.b=i,l.e=r,i+="",r+="",(g=~r.indexOf("random("))&&(r=em(r)),o&&(x=[i,r],o(x,e,t),i=x[0],r=x[1]),p=i.match(LS)||[];h=LS.exec(r);)v=h[0],y=r.substring(c,h.index),m?m=(m+1)%5:y.substr(-5)==="rgba("&&(m=1),v!==p[u++]&&(_=parseFloat(p[u-1])||0,l._pt={_next:l._pt,p:y||u===1?y:",",s:_,c:v.charAt(1)==="="?Uf(_,v)-_:parseFloat(v)-_,m:m&&m<4?Math.round:0},c=LS.lastIndex);return l.c=c")}),M.duration();else{b={};for(D in v)D==="ease"||D==="easeEach"||xre(D,v[D],b,v.easeEach);for(D in b)for(J=b[D].sort(function(q,Q){return q.t-Q.t}),H=0,w=0;wl-an&&!u?l:rc&&(p=c)),g=this._yoyo&&v&1,g&&(M=this._yEase,p=c-p),_=fd(this._tTime,y),p===a&&!o&&this._initted&&v===_)return this._tTime=h,this;v!==_&&(A&&this._yEase&&pz(A,g),this.vars.repeatRefresh&&!g&&!this._lock&&this._time!==y&&this._initted&&(this._lock=o=1,this.render(vi(y*v),!0).invalidate()._lock=0))}if(!this._initted){if(ez(this,u?r:p,o,s,h))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&v!==_))return this;if(c!==this._dur)return this.render(r,s,o)}if(this._tTime=h,this._time=p,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(M||this._ease)(p/c),this._from&&(this.ratio=x=1-x),p&&!a&&!s&&!v&&(Gr(this,"onStart"),this._tTime!==h))return this;for(m=this._pt;m;)m.r(x,m.d),m=m._next;A&&A.render(r<0?r:A._dur*A._ease(p/this._dur),s,o)||this._startAt&&(this._zTime=r),this._onUpdate&&!s&&(u&&_M(this,r,s,o),Gr(this,"onUpdate")),this._repeat&&v!==_&&this.vars.onRepeat&&!s&&this.parent&&Gr(this,"onRepeat"),(h===this._tDur||!h)&&this._tTime===h&&(u&&!this._onUpdate&&_M(this,r,!0,!0),(r||!c)&&(h===this._tDur&&this._ts>0||!h&&this._ts<0)&&Ll(this,1),!s&&!(u&&!a)&&(h||a||g)&&(Gr(this,h===l?"onComplete":"onReverseComplete",!0),this._prom&&!(h0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(r){return(!r||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),n.prototype.invalidate.call(this,r)},t.resetTo=function(r,s,o,a,l){tm||kr.wake(),this._ts||this.play();var c=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||gb(this,c),u=this._ease(c/this._dur),yre(this,r,s,o,a,u,c,l)?this.resetTo(r,s,o,a,1):($_(this,0),this.parent||Qk(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(r,s){if(s===void 0&&(s="all"),!r&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?kh(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(r,s,al&&al.vars.overwrite!==!0)._first||kh(this),this.parent&&o!==this.timeline.totalDuration()&&dd(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=r?As(r):a,c=this._ptLookup,u=this._pt,h,p,m,v,y,_,g;if((!s||s==="all")&&Kie(a,l))return s==="all"&&(this._pt=0),kh(this);for(h=this._op=this._op||[],s!=="all"&&(xi(s)&&(y={},wr(s,function(x){return y[x]=1}),s=y),s=_re(a,s)),g=a.length;g--;)if(~l.indexOf(a[g])){p=c[g],s==="all"?(h[g]=s,v=p,m={}):(m=h[g]=h[g]||{},v=s);for(y in v)_=p&&p[y],_&&((!("kill"in _.d)||_.d.kill(y)===!0)&&V_(this,_,"_pt"),delete p[y]),m!=="all"&&(m[y]=1)}return this._initted&&!this._pt&&u&&kh(this),this},e.to=function(r,s){return new e(r,s,arguments[2])},e.from=function(r,s){return lp(1,arguments)},e.delayedCall=function(r,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(r,s,o){return lp(2,arguments)},e.set=function(r,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(r,s)},e.killTweensOf=function(r,s,o){return bn.killTweensOf(r,s,o)},e}(nm);Ps(Yn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});wr("staggerTo,staggerFrom,staggerFromTo",function(n){Yn[n]=function(){var e=new rr,t=SM.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var vb=function(e,t,i){return e[t]=i},xz=function(e,t,i){return e[t](i)},Sre=function(e,t,i,r){return e[t](r.fp,i)},Are=function(e,t,i){return e.setAttribute(t,i)},yb=function(e,t){return kn(e[t])?xz:lb(e[t])&&e.setAttribute?Are:vb},Sz=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},Ere=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},Az=function(e,t){var i=t._pt,r="";if(!e&&t.b)r=t.b;else if(e===1&&t.e)r=t.e;else{for(;i;)r=i.p+(i.m?i.m(i.s+i.c*e):Math.round((i.s+i.c*e)*1e4)/1e4)+r,i=i._next;r+=t.c}t.set(t.t,t.p,r,t)},_b=function(e,t){for(var i=t._pt;i;)i.r(e,i.d),i=i._next},Mre=function(e,t,i,r){for(var s=this._pt,o;s;)o=s._next,s.p===r&&s.modifier(e,t,i),s=o},wre=function(e){for(var t=this._pt,i,r;t;)r=t._next,t.p===e&&!t.op||t.op===e?V_(this,t,"_pt"):t.dep||(i=1),t=r;return!i},Tre=function(e,t,i,r){r.mSet(e,t,r.m.call(r.tween,i,r.mt),r)},Ez=function(e){for(var t=e._pt,i,r,s,o;t;){for(i=t._next,r=s;r&&r.pr>t.pr;)r=r._next;(t._prev=r?r._prev:o)?t._prev._next=t:s=t,(t._next=r)?r._prev=t:o=t,t=i}e._pt=s},Tr=function(){function n(t,i,r,s,o,a,l,c,u){this.t=i,this.s=s,this.c=o,this.p=r,this.r=a||Sz,this.d=l||this,this.set=c||vb,this.pr=u||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(i,r,s){this.mSet=this.mSet||this.set,this.set=Tre,this.m=i,this.mt=s,this.tween=r},n}();wr(hb+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return db[n]=1});Kr.TweenMax=Kr.TweenLite=Yn;Kr.TimelineLite=Kr.TimelineMax=rr;bn=new rr({sortChildren:!1,defaults:ud,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Xr.stringFilter=dz;var Hc=[],Cv={},bre=[],oD=0,Cre=0,kS=function(e){return(Cv[e]||bre).map(function(t){return t()})},wM=function(){var e=Date.now(),t=[];e-oD>2&&(kS("matchMediaInit"),Hc.forEach(function(i){var r=i.queries,s=i.conditions,o,a,l,c;for(a in r)o=yo.matchMedia(r[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,c=1);c&&(i.revert(),l&&t.push(i))}),kS("matchMediaRevert"),t.forEach(function(i){return i.onMatch(i,function(r){return i.add(null,r)})}),oD=e,kS("matchMedia"))},Mz=function(){function n(t,i){this.selector=i&&AM(i),this.data=[],this._r=[],this.isReverted=!1,this.id=Cre++,t&&this.add(t)}var e=n.prototype;return e.add=function(i,r,s){kn(i)&&(s=r,r=i,i=kn);var o=this,a=function(){var c=_n,u=o.selector,h;return c&&c!==o&&c.data.push(o),s&&(o.selector=AM(s)),_n=o,h=r.apply(o,arguments),kn(h)&&o._r.push(h),_n=c,o.selector=u,o.isReverted=!1,h};return o.last=a,i===kn?a(o,function(l){return o.add(null,l)}):i?o[i]=a:a},e.ignore=function(i){var r=_n;_n=null,i(this),_n=r},e.getTweens=function(){var i=[];return this.data.forEach(function(r){return r instanceof n?i.push.apply(i,r.getTweens()):r instanceof Yn&&!(r.parent&&r.parent.data==="nested")&&i.push(r)}),i},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(i,r){var s=this;if(i?function(){for(var a=s.getTweens(),l=s.data.length,c;l--;)c=s.data[l],c.data==="isFlip"&&(c.revert(),c.getChildren(!0,!0,!1).forEach(function(u){return a.splice(a.indexOf(u),1)}));for(a.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,h){return h.g-u.g||-1/0}).forEach(function(u){return u.t.revert(i)}),l=s.data.length;l--;)c=s.data[l],c instanceof rr?c.data!=="nested"&&(c.scrollTrigger&&c.scrollTrigger.revert(),c.kill()):!(c instanceof Yn)&&c.revert&&c.revert(i);s._r.forEach(function(u){return u(i,s)}),s.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),r)for(var o=Hc.length;o--;)Hc[o].id===this.id&&Hc.splice(o,1)},e.revert=function(i){this.kill(i||{})},n}(),Rre=function(){function n(t){this.contexts=[],this.scope=t,_n&&_n.data.push(this)}var e=n.prototype;return e.add=function(i,r,s){Oo(i)||(i={matches:i});var o=new Mz(0,s||this.scope),a=o.conditions={},l,c,u;_n&&!o.selector&&(o.selector=_n.selector),this.contexts.push(o),r=o.add("onMatch",r),o.queries=i;for(c in i)c==="all"?u=1:(l=yo.matchMedia(i[c]),l&&(Hc.indexOf(o)<0&&Hc.push(o),(a[c]=l.matches)&&(u=1),l.addListener?l.addListener(wM):l.addEventListener("change",wM)));return u&&r(o,function(h){return o.add(null,h)}),this},e.revert=function(i){this.kill(i||{})},e.kill=function(i){this.contexts.forEach(function(r){return r.kill(i,!0)})},n}(),Dy={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),i=0;i1){var r=e.map(function(u){return Cr.quickSetter(u,t,i)}),s=r.length;return function(u){for(var h=s;h--;)r[h](u)}}e=e[0]||{};var o=Nr[t],a=Uc(e),l=a.harness&&(a.harness.aliases||{})[t]||t,c=o?function(u){var h=new o;Mf._pt=0,h.init(e,i?u+i:u,Mf,0,[e]),h.render(1,h),Mf._pt&&_b(1,Mf)}:a.set(e,l);return o?c:function(u){return c(e,l,i?u+i:u,a,1)}},quickTo:function(e,t,i){var r,s=Cr.to(e,eu((r={},r[t]="+=0.1",r.paused=!0,r),i||{})),o=function(l,c,u){return s.resetTo(t,l,c,u)};return o.tween=s,o},isTweening:function(e){return bn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=zc(e.ease,ud.ease)),tD(ud,e||{})},config:function(e){return tD(Xr,e||{})},registerEffect:function(e){var t=e.name,i=e.effect,r=e.plugins,s=e.defaults,o=e.extendTimeline;(r||"").split(",").forEach(function(a){return a&&!Nr[a]&&!Kr[a]&&qp(t+" effect requires "+a+" plugin.")}),OS[t]=function(a,l,c){return i(As(a),Ps(l||{},s),c)},o&&(rr.prototype[t]=function(a,l,c){return this.add(OS[t](a,Oo(l)?l:(c=l)&&{},this),c)})},registerEase:function(e,t){Ft[e]=zc(t)},parseEase:function(e,t){return arguments.length?zc(e,t):Ft},getById:function(e){return bn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var i=new rr(e),r,s;for(i.smoothChildTiming=Mr(e.smoothChildTiming),bn.remove(i),i._dp=0,i._time=i._tTime=bn._time,r=bn._first;r;)s=r._next,(t||!(!r._dur&&r instanceof Yn&&r.vars.onComplete===r._targets[0]))&&So(i,r,r._start-r._delay),r=s;return So(bn,i,0),i},context:function(e,t){return e?new Mz(e,t):_n},matchMedia:function(e){return new Rre(e)},matchMediaRefresh:function(){return Hc.forEach(function(e){var t=e.conditions,i,r;for(r in t)t[r]&&(t[r]=!1,i=1);i&&e.revert()})||wM()},addEventListener:function(e,t){var i=Cv[e]||(Cv[e]=[]);~i.indexOf(t)||i.push(t)},removeEventListener:function(e,t){var i=Cv[e],r=i&&i.indexOf(t);r>=0&&i.splice(r,1)},utils:{wrap:are,wrapYoyo:lre,distribute:iz,random:sz,snap:rz,normalize:ore,getUnit:zi,clamp:nre,splitColor:uz,toArray:As,selector:AM,mapRange:az,pipe:rre,unitize:sre,interpolate:cre,shuffle:nz},install:Wk,effects:OS,ticker:kr,updateRoot:rr.updateRoot,plugins:Nr,globalTimeline:bn,core:{PropTween:Tr,globals:$k,Tween:Yn,Timeline:rr,Animation:nm,getCache:Uc,_removeLinkedListItem:V_,reverting:function(){return Vi},context:function(e){return e&&_n&&(_n.data.push(e),e._ctx=_n),_n},suppressOverwrites:function(e){return ab=e}}};wr("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return Dy[n]=Yn[n]});kr.add(rr.updateRoot);Mf=Dy.to({},{duration:0});var Pre=function(e,t){for(var i=e._pt;i&&i.p!==t&&i.op!==t&&i.fp!==t;)i=i._next;return i},Ire=function(e,t){var i=e._targets,r,s,o;for(r in t)for(s=i.length;s--;)o=e._ptLookup[s][r],o&&(o=o.d)&&(o._pt&&(o=Pre(o,r)),o&&o.modifier&&o.modifier(t[r],e,i[s],r))},zS=function(e,t){return{name:e,rawVars:1,init:function(r,s,o){o._onInit=function(a){var l,c;if(xi(s)&&(l={},wr(s,function(u){return l[u]=1}),s=l),t){l={};for(c in s)l[c]=t(s[c]);s=l}Ire(a,s)}}}},Cr=Dy.registerPlugin({name:"attr",init:function(e,t,i,r,s){var o,a,l;this.tween=i;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],r,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var i=t._pt;i;)Vi?i.set(i.t,i.p,i.b,i):i.r(e,i.d),i=i._next}},{name:"endArray",init:function(e,t){for(var i=t.length;i--;)this.add(e,i,e[i]||0,t[i],0,0,0,0,0,1)}},zS("roundProps",EM),zS("modifiers"),zS("snap",rz))||Dy;Yn.version=rr.version=Cr.version="3.12.5";Vk=1;cb()&&hd();Ft.Power0;Ft.Power1;Ft.Power2;Ft.Power3;Ft.Power4;Ft.Linear;Ft.Quad;Ft.Cubic;Ft.Quart;Ft.Quint;Ft.Strong;Ft.Elastic;Ft.Back;Ft.SteppedEase;Ft.Bounce;Ft.Sine;Ft.Expo;Ft.Circ;/*! * CSSPlugin 3.12.5 * https://gsap.com * * Copyright 2008-2024, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var aD,ll,kf,xb,Cc,lD,Sb,Bre=function(){return typeof window<"u"},Ma={},vc=180/Math.PI,zf=Math.PI/180,tf=Math.atan2,cD=1e8,Ab=/([A-Z])/g,Dre=/(left|right|width|margin|padding|x)/i,Lre=/[\s,\(]\S/,wo={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},TM=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},Ore=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},Fre=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},Nre=function(e,t){var i=t.s+t.c*e;t.set(t.t,t.p,~~(i+(i<0?-.5:.5))+t.u,t)},wz=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},Tz=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},Ure=function(e,t,i){return e.style[t]=i},kre=function(e,t,i){return e.style.setProperty(t,i)},zre=function(e,t,i){return e._gsap[t]=i},Hre=function(e,t,i){return e._gsap.scaleX=e._gsap.scaleY=i},Gre=function(e,t,i,r,s){var o=e._gsap;o.scaleX=o.scaleY=i,o.renderTransform(s,o)},Vre=function(e,t,i,r,s){var o=e._gsap;o[t]=i,o.renderTransform(s,o)},Rn="transform",br=Rn+"Origin",Wre=function n(e,t){var i=this,r=this.target,s=r.style,o=r._gsap;if(e in Ma&&s){if(this.tfm=this.tfm||{},e!=="transform")e=wo[e]||e,~e.indexOf(",")?e.split(",").forEach(function(a){return i.tfm[a]=ea(r,a)}):this.tfm[e]=o.x?o[e]:ea(r,e),e===br&&(this.tfm.zOrigin=o.zOrigin);else return wo.transform.split(",").forEach(function(a){return n.call(i,a,t)});if(this.props.indexOf(Rn)>=0)return;o.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(br,t,"")),e=Rn}(s||t)&&this.props.push(e,t,s[e])},bz=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},$re=function(){var e=this.props,t=this.target,i=t.style,r=t._gsap,s,o;for(s=0;s=0?uD[o]:"")+e},CM=function(){Bre()&&window.document&&(aD=window,ll=aD.document,kf=ll.documentElement,Cc=bM("div")||{style:{}},bM("div"),Rn=pd(Rn),br=Rn+"Origin",Cc.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Rz=!!pd("perspective"),Sb=Cr.core.reverting,xb=1)},HS=function n(e){var t=bM("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,r=this.nextSibling,s=this.style.cssText,o;if(kf.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(r?i.insertBefore(this,r):i.appendChild(this)),kf.removeChild(t),this.style.cssText=s,o},fD=function(e,t){for(var i=t.length;i--;)if(e.hasAttribute(t[i]))return e.getAttribute(t[i])},Pz=function(e){var t;try{t=e.getBBox()}catch{t=HS.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===HS||(t=HS.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+fD(e,["x","cx","x1"])||0,y:+fD(e,["y","cy","y1"])||0,width:0,height:0}:t},Iz=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&Pz(e))},tu=function(e,t){if(t){var i=e.style,r;t in Ma&&t!==br&&(t=Rn),i.removeProperty?(r=t.substr(0,2),(r==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),i.removeProperty(r==="--"?t:t.replace(Ab,"-$1").toLowerCase())):i.removeAttribute(t)}},cl=function(e,t,i,r,s,o){var a=new Tr(e._pt,t,i,0,1,o?Tz:wz);return e._pt=a,a.b=r,a.e=s,e._props.push(i),a},dD={deg:1,rad:1,turn:1},Xre={grid:1,flex:1},Ol=function n(e,t,i,r){var s=parseFloat(i)||0,o=(i+"").trim().substr((s+"").length)||"px",a=Cc.style,l=Dre.test(t),c=e.tagName.toLowerCase()==="svg",u=(c?"client":"offset")+(l?"Width":"Height"),h=100,p=r==="px",m=r==="%",v,y,_,g;if(r===o||!s||dD[r]||dD[o])return s;if(o!=="px"&&!p&&(s=n(e,t,i,"px")),g=e.getCTM&&Iz(e),(m||o==="%")&&(Ma[t]||~t.indexOf("adius")))return v=g?e.getBBox()[l?"width":"height"]:e[u],Vn(m?s/v*h:s/100*v);if(a[l?"width":"height"]=h+(p?o:r),y=~t.indexOf("adius")||r==="em"&&e.appendChild&&!c?e:e.parentNode,g&&(y=(e.ownerSVGElement||{}).parentNode),(!y||y===ll||!y.appendChild)&&(y=ll.body),_=y._gsap,_&&m&&_.width&&l&&_.time===kr.time&&!_.uncache)return Vn(s/_.width*h);if(m&&(t==="height"||t==="width")){var x=e.style[t];e.style[t]=h+r,v=e[u],x?e.style[t]=x:tu(e,t)}else(m||o==="%")&&!Xre[Io(y,"display")]&&(a.position=Io(e,"position")),y===e&&(a.position="static"),y.appendChild(Cc),v=Cc[u],y.removeChild(Cc),a.position="absolute";return l&&m&&(_=Uc(y),_.time=kr.time,_.width=y[u]),Vn(p?v*s/h:v&&s?h/v*s:0)},ea=function(e,t,i,r){var s;return xb||CM(),t in wo&&t!=="transform"&&(t=wo[t],~t.indexOf(",")&&(t=t.split(",")[0])),Ma[t]&&t!=="transform"?(s=rm(e,r),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:Oy(Io(e,br))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||r||~(s+"").indexOf("calc("))&&(s=Ly[t]&&Ly[t](e,t,i)||Io(e,t)||jk(e,t)||(t==="opacity"?1:0))),i&&!~(s+"").trim().indexOf(" ")?Ol(e,t,s,i)+i:s},jre=function(e,t,i,r){if(!i||i==="none"){var s=pd(t,e,1),o=s&&Io(e,s,1);o&&o!==i?(t=s,i=o):t==="borderColor"&&(i=Io(e,"borderTopColor"))}var a=new Tr(this._pt,e.style,t,0,1,Az),l=0,c=0,u,h,p,m,v,y,_,g,x,A,M,w;if(a.b=i,a.e=r,i+="",r+="",r==="auto"&&(y=e.style[t],e.style[t]=r,r=Io(e,t)||r,y?e.style[t]=y:tu(e,t)),u=[i,r],dz(u),i=u[0],r=u[1],p=i.match(Ef)||[],w=r.match(Ef)||[],w.length){for(;h=Ef.exec(r);)_=h[0],x=r.substring(l,h.index),v?v=(v+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(v=1),_!==(y=p[c++]||"")&&(m=parseFloat(y)||0,M=y.substr((m+"").length),_.charAt(1)==="="&&(_=Uf(m,_)+M),g=parseFloat(_),A=_.substr((g+"").length),l=Ef.lastIndex-A.length,A||(A=A||Xr.units[t]||M,l===r.length&&(r+=A,a.e+=A)),M!==A&&(m=Ol(e,t,y,A)||0),a._pt={_next:a._pt,p:x||c===1?x:",",s:m,c:g-m,m:v&&v<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[c],Ma[a]&&(l=1,a=a==="transformOrigin"?br:Rn),tu(i,a);l&&(tu(i,Rn),o&&(o.svg&&i.removeAttribute("transform"),rm(i,1),o.uncache=1,bz(r)))}},Ly={clearProps:function(e,t,i,r,s){if(s.data!=="isFromStart"){var o=e._pt=new Tr(e._pt,t,i,0,0,Kre);return o.u=r,o.pr=-10,o.tween=s,e._props.push(i),1}}},im=[1,0,0,1,0,0],Bz={},Dz=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},pD=function(e){var t=Io(e,Rn);return Dz(t)?im:t.substr(7).match(zk).map(Vn)},Eb=function(e,t){var i=e._gsap||Uc(e),r=e.style,s=pD(e),o,a,l,c;return i.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?im:s):(s===im&&!e.offsetParent&&e!==kf&&!i.svg&&(l=r.display,r.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(c=1,a=e.nextElementSibling,kf.appendChild(e)),s=pD(e),l?r.display=l:tu(e,"display"),c&&(a?o.insertBefore(e,a):o?o.appendChild(e):kf.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},RM=function(e,t,i,r,s,o){var a=e._gsap,l=s||Eb(e,!0),c=a.xOrigin||0,u=a.yOrigin||0,h=a.xOffset||0,p=a.yOffset||0,m=l[0],v=l[1],y=l[2],_=l[3],g=l[4],x=l[5],A=t.split(" "),M=parseFloat(A[0])||0,w=parseFloat(A[1])||0,b,R,D,C;i?l!==im&&(R=m*_-v*y)&&(D=M*(_/R)+w*(-y/R)+(y*x-_*g)/R,C=M*(-v/R)+w*(m/R)-(m*x-v*g)/R,M=D,w=C):(b=Pz(e),M=b.x+(~A[0].indexOf("%")?M/100*b.width:M),w=b.y+(~(A[1]||A[0]).indexOf("%")?w/100*b.height:w)),r||r!==!1&&a.smooth?(g=M-c,x=w-u,a.xOffset=h+(g*m+x*y)-g,a.yOffset=p+(g*v+x*_)-x):a.xOffset=a.yOffset=0,a.xOrigin=M,a.yOrigin=w,a.smooth=!!r,a.origin=t,a.originIsAbsolute=!!i,e.style[br]="0px 0px",o&&(cl(o,a,"xOrigin",c,M),cl(o,a,"yOrigin",u,w),cl(o,a,"xOffset",h,a.xOffset),cl(o,a,"yOffset",p,a.yOffset)),e.setAttribute("data-svg-origin",M+" "+w)},rm=function(e,t){var i=e._gsap||new gz(e);if("x"in i&&!t&&!i.uncache)return i;var r=e.style,s=i.scaleX<0,o="px",a="deg",l=getComputedStyle(e),c=Io(e,br)||"0",u,h,p,m,v,y,_,g,x,A,M,w,b,R,D,C,I,O,H,J,k,W,q,Q,z,j,K,V,Y,de,ge,ve;return u=h=p=y=_=g=x=A=M=0,m=v=1,i.svg=!!(e.getCTM&&Iz(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(r[Rn]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Rn]!=="none"?l[Rn]:"")),r.scale=r.rotate=r.translate="none"),R=Eb(e,i.svg),i.svg&&(i.uncache?(z=e.getBBox(),c=i.xOrigin-z.x+"px "+(i.yOrigin-z.y)+"px",Q=""):Q=!t&&e.getAttribute("data-svg-origin"),RM(e,Q||c,!!Q||i.originIsAbsolute,i.smooth!==!1,R)),w=i.xOrigin||0,b=i.yOrigin||0,R!==im&&(O=R[0],H=R[1],J=R[2],k=R[3],u=W=R[4],h=q=R[5],R.length===6?(m=Math.sqrt(O*O+H*H),v=Math.sqrt(k*k+J*J),y=O||H?tf(H,O)*vc:0,x=J||k?tf(J,k)*vc+y:0,x&&(v*=Math.abs(Math.cos(x*zf))),i.svg&&(u-=w-(w*O+b*J),h-=b-(w*H+b*k))):(ve=R[6],de=R[7],K=R[8],V=R[9],Y=R[10],ge=R[11],u=R[12],h=R[13],p=R[14],D=tf(ve,Y),_=D*vc,D&&(C=Math.cos(-D),I=Math.sin(-D),Q=W*C+K*I,z=q*C+V*I,j=ve*C+Y*I,K=W*-I+K*C,V=q*-I+V*C,Y=ve*-I+Y*C,ge=de*-I+ge*C,W=Q,q=z,ve=j),D=tf(-J,Y),g=D*vc,D&&(C=Math.cos(-D),I=Math.sin(-D),Q=O*C-K*I,z=H*C-V*I,j=J*C-Y*I,ge=k*I+ge*C,O=Q,H=z,J=j),D=tf(H,O),y=D*vc,D&&(C=Math.cos(D),I=Math.sin(D),Q=O*C+H*I,z=W*C+q*I,H=H*C-O*I,q=q*C-W*I,O=Q,W=z),_&&Math.abs(_)+Math.abs(y)>359.9&&(_=y=0,g=180-g),m=Vn(Math.sqrt(O*O+H*H+J*J)),v=Vn(Math.sqrt(q*q+ve*ve)),D=tf(W,q),x=Math.abs(D)>2e-4?D*vc:0,M=ge?1/(ge<0?-ge:ge):0),i.svg&&(Q=e.getAttribute("transform"),i.forceCSS=e.setAttribute("transform","")||!Dz(Io(e,Rn)),Q&&e.setAttribute("transform",Q))),Math.abs(x)>90&&Math.abs(x)<270&&(s?(m*=-1,x+=y<=0?180:-180,y+=y<=0?180:-180):(v*=-1,x+=x<=0?180:-180)),t=t||i.uncache,i.x=u-((i.xPercent=u&&(!t&&i.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-u)?-50:0)))?e.offsetWidth*i.xPercent/100:0)+o,i.y=h-((i.yPercent=h&&(!t&&i.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-h)?-50:0)))?e.offsetHeight*i.yPercent/100:0)+o,i.z=p+o,i.scaleX=Vn(m),i.scaleY=Vn(v),i.rotation=Vn(y)+a,i.rotationX=Vn(_)+a,i.rotationY=Vn(g)+a,i.skewX=x+a,i.skewY=A+a,i.transformPerspective=M+o,(i.zOrigin=parseFloat(c.split(" ")[2])||!t&&i.zOrigin||0)&&(r[br]=Oy(c)),i.xOffset=i.yOffset=0,i.force3D=Xr.force3D,i.renderTransform=i.svg?Qre:Rz?Lz:Yre,i.uncache=0,i},Oy=function(e){return(e=e.split(" "))[0]+" "+e[1]},GS=function(e,t,i){var r=zi(t);return Vn(parseFloat(t)+parseFloat(Ol(e,"x",i+"px",r)))+r},Yre=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,Lz(e,t)},uc="0deg",Ph="0px",fc=") ",Lz=function(e,t){var i=t||this,r=i.xPercent,s=i.yPercent,o=i.x,a=i.y,l=i.z,c=i.rotation,u=i.rotationY,h=i.rotationX,p=i.skewX,m=i.skewY,v=i.scaleX,y=i.scaleY,_=i.transformPerspective,g=i.force3D,x=i.target,A=i.zOrigin,M="",w=g==="auto"&&e&&e!==1||g===!0;if(A&&(h!==uc||u!==uc)){var b=parseFloat(u)*zf,R=Math.sin(b),D=Math.cos(b),C;b=parseFloat(h)*zf,C=Math.cos(b),o=GS(x,o,R*C*-A),a=GS(x,a,-Math.sin(b)*-A),l=GS(x,l,D*C*-A+A)}_!==Ph&&(M+="perspective("+_+fc),(r||s)&&(M+="translate("+r+"%, "+s+"%) "),(w||o!==Ph||a!==Ph||l!==Ph)&&(M+=l!==Ph||w?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+fc),c!==uc&&(M+="rotate("+c+fc),u!==uc&&(M+="rotateY("+u+fc),h!==uc&&(M+="rotateX("+h+fc),(p!==uc||m!==uc)&&(M+="skew("+p+", "+m+fc),(v!==1||y!==1)&&(M+="scale("+v+", "+y+fc),x.style[Rn]=M||"translate(0, 0)"},Qre=function(e,t){var i=t||this,r=i.xPercent,s=i.yPercent,o=i.x,a=i.y,l=i.rotation,c=i.skewX,u=i.skewY,h=i.scaleX,p=i.scaleY,m=i.target,v=i.xOrigin,y=i.yOrigin,_=i.xOffset,g=i.yOffset,x=i.forceCSS,A=parseFloat(o),M=parseFloat(a),w,b,R,D,C;l=parseFloat(l),c=parseFloat(c),u=parseFloat(u),u&&(u=parseFloat(u),c+=u,l+=u),l||c?(l*=zf,c*=zf,w=Math.cos(l)*h,b=Math.sin(l)*h,R=Math.sin(l-c)*-p,D=Math.cos(l-c)*p,c&&(u*=zf,C=Math.tan(c-u),C=Math.sqrt(1+C*C),R*=C,D*=C,u&&(C=Math.tan(u),C=Math.sqrt(1+C*C),w*=C,b*=C)),w=Vn(w),b=Vn(b),R=Vn(R),D=Vn(D)):(w=h,D=p,b=R=0),(A&&!~(o+"").indexOf("px")||M&&!~(a+"").indexOf("px"))&&(A=Ol(m,"x",o,"px"),M=Ol(m,"y",a,"px")),(v||y||_||g)&&(A=Vn(A+v-(v*w+y*R)+_),M=Vn(M+y-(v*b+y*D)+g)),(r||s)&&(C=m.getBBox(),A=Vn(A+r/100*C.width),M=Vn(M+s/100*C.height)),C="matrix("+w+","+b+","+R+","+D+","+A+","+M+")",m.setAttribute("transform",C),x&&(m.style[Rn]=C)},qre=function(e,t,i,r,s){var o=360,a=xi(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?vc:1),c=l-r,u=r+c+"deg",h,p;return a&&(h=s.split("_")[1],h==="short"&&(c%=o,c!==c%(o/2)&&(c+=c<0?o:-o)),h==="cw"&&c<0?c=(c+o*cD)%o-~~(c/o)*o:h==="ccw"&&c>0&&(c=(c-o*cD)%o-~~(c/o)*o)),e._pt=p=new Tr(e._pt,t,i,r,c,Ore),p.e=u,p.u="deg",e._props.push(i),p},mD=function(e,t){for(var i in t)e[i]=t[i];return e},Zre=function(e,t,i){var r=mD({},i._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,l,c,u,h,p,m,v;r.svg?(c=i.getAttribute("transform"),i.setAttribute("transform",""),o[Rn]=t,a=rm(i,1),tu(i,Rn),i.setAttribute("transform",c)):(c=getComputedStyle(i)[Rn],o[Rn]=t,a=rm(i,1),o[Rn]=c);for(l in Ma)c=r[l],u=a[l],c!==u&&s.indexOf(l)<0&&(m=zi(c),v=zi(u),h=m!==v?Ol(i,l,c,v):parseFloat(c),p=parseFloat(u),e._pt=new Tr(e._pt,a,l,h,p-h,TM),e._pt.u=v||0,e._props.push(l));mD(a,r)};wr("padding,margin,Width,Radius",function(n,e){var t="Top",i="Right",r="Bottom",s="Left",o=(e<3?[t,i,r,s]:[t+s,t+i,r+i,r+s]).map(function(a){return e<2?n+a:"border"+a+n});Ly[e>1?"border"+n:n]=function(a,l,c,u,h){var p,m;if(arguments.length<4)return p=o.map(function(v){return ea(a,v,c)}),m=p.join(" "),m.split(p[0]).length===5?p[0]:m;p=(u+"").split(" "),m={},o.forEach(function(v,y){return m[v]=p[y]=p[y]||p[(y-1)/2|0]}),a.init(l,m,h)}});var Oz={name:"css",register:CM,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,i,r,s){var o=this._props,a=e.style,l=i.vars.startAt,c,u,h,p,m,v,y,_,g,x,A,M,w,b,R,D;xb||CM(),this.styles=this.styles||Cz(e),D=this.styles.props,this.tween=i;for(y in t)if(y!=="autoRound"&&(u=t[y],!(Nr[y]&&vz(y,t,i,r,e,s)))){if(m=typeof u,v=Ly[y],m==="function"&&(u=u.call(i,r,e,s),m=typeof u),m==="string"&&~u.indexOf("random(")&&(u=em(u)),v)v(this,e,y,u,i)&&(R=1);else if(y.substr(0,2)==="--")c=(getComputedStyle(e).getPropertyValue(y)+"").trim(),u+="",Al.lastIndex=0,Al.test(c)||(_=zi(c),g=zi(u)),g?_!==g&&(c=Ol(e,y,c,g)+g):_&&(u+=_),this.add(a,"setProperty",c,u,r,s,0,0,y),o.push(y),D.push(y,0,a[y]);else if(m!=="undefined"){if(l&&y in l?(c=typeof l[y]=="function"?l[y].call(i,r,e,s):l[y],xi(c)&&~c.indexOf("random(")&&(c=em(c)),zi(c+"")||c==="auto"||(c+=Xr.units[y]||zi(ea(e,y))||""),(c+"").charAt(1)==="="&&(c=ea(e,y))):c=ea(e,y),p=parseFloat(c),x=m==="string"&&u.charAt(1)==="="&&u.substr(0,2),x&&(u=u.substr(2)),h=parseFloat(u),y in wo&&(y==="autoAlpha"&&(p===1&&ea(e,"visibility")==="hidden"&&h&&(p=0),D.push("visibility",0,a.visibility),cl(this,a,"visibility",p?"inherit":"hidden",h?"inherit":"hidden",!h)),y!=="scale"&&y!=="transform"&&(y=wo[y],~y.indexOf(",")&&(y=y.split(",")[0]))),A=y in Ma,A){if(this.styles.save(y),M||(w=e._gsap,w.renderTransform&&!t.parseTransform||rm(e,t.parseTransform),b=t.smoothOrigin!==!1&&w.smooth,M=this._pt=new Tr(this._pt,a,Rn,0,1,w.renderTransform,w,0,-1),M.dep=1),y==="scale")this._pt=new Tr(this._pt,w,"scaleY",w.scaleY,(x?Uf(w.scaleY,x+h):h)-w.scaleY||0,TM),this._pt.u=0,o.push("scaleY",y),y+="X";else if(y==="transformOrigin"){D.push(br,0,a[br]),u=Jre(u),w.svg?RM(e,u,0,b,0,this):(g=parseFloat(u.split(" ")[2])||0,g!==w.zOrigin&&cl(this,w,"zOrigin",w.zOrigin,g),cl(this,a,y,Oy(c),Oy(u)));continue}else if(y==="svgOrigin"){RM(e,u,1,b,0,this);continue}else if(y in Bz){qre(this,w,y,p,x?Uf(p,x+u):u);continue}else if(y==="smoothOrigin"){cl(this,w,"smooth",w.smooth,u);continue}else if(y==="force3D"){w[y]=u;continue}else if(y==="transform"){Zre(this,u,e);continue}}else y in a||(y=pd(y)||y);if(A||(h||h===0)&&(p||p===0)&&!Lre.test(u)&&y in a)_=(c+"").substr((p+"").length),h||(h=0),g=zi(u)||(y in Xr.units?Xr.units[y]:_),_!==g&&(p=Ol(e,y,c,g)),this._pt=new Tr(this._pt,A?w:a,y,p,(x?Uf(p,x+h):h)-p,!A&&(g==="px"||y==="zIndex")&&t.autoRound!==!1?Nre:TM),this._pt.u=g||0,_!==g&&g!=="%"&&(this._pt.b=c,this._pt.r=Fre);else if(y in a)jre.call(this,e,y,c,x?x+u:u);else if(y in e)this.add(e,y,c||e[y],x?x+u:u,r,s);else if(y!=="parseTransform"){fb(y,u);continue}A||(y in a?D.push(y,0,a[y]):D.push(y,1,c||e[y])),o.push(y)}}R&&Ez(this)},render:function(e,t){if(t.tween._time||!Sb())for(var i=t._pt;i;)i.r(e,i.d),i=i._next;else t.styles.revert()},get:ea,aliases:wo,getSetter:function(e,t,i){var r=wo[t];return r&&r.indexOf(",")<0&&(t=r),t in Ma&&t!==br&&(e._gsap.x||ea(e,"x"))?i&&lD===i?t==="scale"?Hre:zre:(lD=i||{})&&(t==="scale"?Gre:Vre):e.style&&!lb(e.style[t])?Ure:~t.indexOf("-")?kre:yb(e,t)},core:{_removeProperty:tu,_getMatrix:Eb}};Cr.utils.checkPrefix=pd;Cr.core.getStyleSaver=Cz;(function(n,e,t,i){var r=wr(n+","+e+","+t,function(s){Ma[s]=1});wr(e,function(s){Xr.units[s]="deg",Bz[s]=1}),wo[r[13]]=n+","+e,wr(i,function(s){var o=s.split(":");wo[o[1]]=r[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");wr("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){Xr.units[n]="px"});Cr.registerPlugin(Oz);var Mb=Cr.registerPlugin(Oz)||Cr;Mb.core.Tween;function ese(){const{nodes:n,materials:e}=cu("./circle_text_13.glb"),t=B.useRef(),i=B.useRef(),r=B.useRef(),s=B.useRef(),o=B.useRef(0),a=3,l=2,c=l+a;return Mm((u,h)=>{if(t.current.rotation.y-=h*.3,i.current){o.current=u.clock.elapsedTime%c;let p;if(o.current{e||Mb.to(t.current,{opacity:0,duration:.5,onComplete:()=>{t.current.style.display="none"}})},[e]),pt.jsxs("div",{ref:t,style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"#000000",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",zIndex:1e3,opacity:1,transition:"opacity 0.5s",fontFamily:"m6x11plus"},children:[pt.jsx("h1",{style:{fontSize:"4rem",margin:0,color:"#ffffff",fontWeight:700,letterSpacing:"0.1em"},children:"LOADING"}),pt.jsxs("p",{style:{fontSize:"2rem",margin:"1rem 0",color:"rgba(255, 255, 255, 0.8)",fontWeight:400,letterSpacing:"0.05em"},children:[Math.round(n),"%"]})]})}const nse=()=>{const[n,e]=B.useState(!1),t=768;return B.useEffect(()=>{const i=()=>{const r=window.innerWidth;e(rwindow.removeEventListener("resize",i)},[]),n};/** * postprocessing v6.36.7 build Thu Feb 06 2025 * https://github.com/pmndrs/postprocessing * Copyright 2015-2025 Raoul van Rüschen * @license Zlib */var VS=1/1e3,ise=1e3,rse=class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(n){typeof document<"u"&&document.hidden!==void 0&&(n?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=n)}get delta(){return this._delta*VS}get fixedDelta(){return this._fixedDelta*VS}set fixedDelta(n){this._fixedDelta=n*ise}get elapsed(){return this._elapsed*VS}update(n){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(n!==void 0?n:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(n){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},sse=(()=>{const n=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]),t=new Et;return t.setAttribute("position",new Ht(n,3)),t.setAttribute("uv",new Ht(e,2)),t})(),cr=class PM{static get fullscreenGeometry(){return sse}constructor(e="Pass",t=new qf,i=new Sd){this.name=e,this.renderer=null,this.scene=t,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;t!==null&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return this.screen!==null?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;t!==null?t.material=e:(t=new ri(PM.fullscreenGeometry,e),t.frustumCulled=!1,this.scene===null&&(this.scene=new qf),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=kl){}render(e,t,i,r,s){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,i){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof xn||t instanceof zn||t instanceof cn||t instanceof PM)&&this[e].dispose()}this.fullscreenMaterial!==null&&this.fullscreenMaterial.dispose()}},ose=class extends cr{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(n,e,t,i,r){const s=n.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},ase=`#include #include #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel; #include #include }`,wb="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Fz=class extends Zn{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new ut(null),opacity:new ut(1)},blending:Ci,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:ase,vertexShader:wb})}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}getOpacity(n){return this.uniforms.opacity.value}setOpacity(n){this.uniforms.opacity.value=n}},Nz=class extends cr{constructor(n,e=!0){super("CopyPass"),this.fullscreenMaterial=new Fz,this.needsSwap=!1,this.renderTarget=n,n===void 0&&(this.renderTarget=new xn(1,1,{minFilter:Qt,magFilter:Qt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(n){this.autoResize=n}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(n){this.autoResize=n}render(n,e,t,i,r){this.fullscreenMaterial.inputBuffer=e.texture,n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,e){this.autoResize&&this.renderTarget.setSize(n,e)}initialize(n,e,t){t!==void 0&&(this.renderTarget.texture.type=t,t!==si?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":n!==null&&n.outputColorSpace===Ot&&(this.renderTarget.texture.colorSpace=Ot))}},gD=new Ie,Uz=class extends cr{constructor(n=!0,e=!0,t=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=n,this.depth=e,this.stencil=t,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(n,e,t){this.color=n,this.depth=e,this.stencil=t}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(n){this.overrideClearColor=n}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(n){this.overrideClearAlpha=n}render(n,e,t,i,r){const s=this.overrideClearColor,o=this.overrideClearAlpha,a=n.getClearAlpha(),l=s!==null,c=o>=0;l?(n.getClearColor(gD),n.setClearColor(s,c?o:a)):c&&n.setClearAlpha(o),n.setRenderTarget(this.renderToScreen?null:e),n.clear(this.color,this.depth,this.stencil),l?n.setClearColor(gD,a):c&&n.setClearAlpha(a)}},lse=class extends cr{constructor(n,e){super("MaskPass",n,e),this.needsSwap=!1,this.clearPass=new Uz(!1,!1,!0),this.inverse=!1}set mainScene(n){this.scene=n}set mainCamera(n){this.camera=n}get inverted(){return this.inverse}set inverted(n){this.inverse=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(n){this.inverted=n}render(n,e,t,i,r){const s=n.getContext(),o=n.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,u=this.inverted?0:1,h=1-u;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,u,4294967295),o.stencil.setClear(h),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(n,null):(c.render(n,e),c.render(n,t))),this.renderToScreen?(n.setRenderTarget(null),n.render(a,l)):(n.setRenderTarget(e),n.render(a,l),n.setRenderTarget(t),n.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}},cse=class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:s}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,i,s,r),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new Nz,this.depthTexture=null,this.passes=[],this.timer=new rse,this.autoRenderToScreen=!0,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){const t=this.inputBuffer,i=this.multisampling;i>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,e!==null){const t=e.getSize(new ce),i=e.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;r===si&&e.outputColorSpace===Ot&&(this.inputBuffer.texture.colorSpace=Ot,this.outputBuffer.texture.colorSpace=Ot,this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height);for(const s of this.passes)s.initialize(e,i,r)}}replaceRenderer(e,t=!0){const i=this.renderer,r=i.domElement.parentNode;return this.setRenderer(e),t&&r!==null&&(r.removeChild(i.domElement),r.appendChild(e.domElement)),i}createDepthTexture(){const e=this.depthTexture=new l_;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=bl,e.type=aa):e.type=Ao,e}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,i,r){const s=this.renderer,o=s===null?new ce:s.getDrawingBufferSize(new ce),a={minFilter:Qt,magFilter:Qt,stencilBuffer:t,depthBuffer:e,type:i},l=new xn(o.width,o.height,a);return r>0&&(l.ignoreDepthForMultisampleCopy=!1,l.samples=r),i===si&&s!==null&&s.outputColorSpace===Ot&&(l.texture.colorSpace=Ot),l.texture.name="EffectComposer.Buffer",l.texture.generateMipmaps=!1,l}setMainScene(e){for(const t of this.passes)t.mainScene=e}setMainCamera(e){for(const t of this.passes)t.mainCamera=e}addPass(e,t){const i=this.passes,r=this.renderer,s=r.getDrawingBufferSize(new ce),o=r.getContext().getContextAttributes().alpha,a=this.inputBuffer.texture.type;if(e.setRenderer(r),e.setSize(s.width,s.height),e.initialize(r,o,a),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),t!==void 0?i.splice(t,0,e):i.push(e),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),e.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){const l=this.createDepthTexture();for(e of i)e.setDepthTexture(l)}else e.setDepthTexture(this.depthTexture)}removePass(e){const t=this.passes,i=t.indexOf(e);if(i!==-1&&t.splice(i,1).length>0){if(this.depthTexture!==null){const o=(l,c)=>l||c.needsDepthTexture;t.reduce(o,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&i===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,i=this.copyPass;let r=this.inputBuffer,s=this.outputBuffer,o=!1,a,l,c;e===void 0&&(this.timer.update(),e=this.timer.getDelta());for(const u of this.passes)u.enabled&&(u.render(t,r,s,e,o),u.needsSwap&&(o&&(i.renderToScreen=u.renderToScreen,a=t.getContext(),l=t.state.buffers.stencil,l.setFunc(a.NOTEQUAL,1,4294967295),i.render(t,r,s,e,o),l.setFunc(a.EQUAL,1,4294967295)),c=r,r=s,s=c),u instanceof lse?o=!0:u instanceof ose&&(o=!1))}setSize(e,t,i){const r=this.renderer,s=r.getSize(new ce);(e===void 0||t===void 0)&&(e=s.width,t=s.height),(s.width!==e||s.height!==t)&&r.setSize(e,t,i);const o=r.getDrawingBufferSize(new ce);this.inputBuffer.setSize(o.width,o.height),this.outputBuffer.setSize(o.width,o.height);for(const a of this.passes)a.setSize(o.width,o.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const e of this.passes)e.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),cr.fullscreenGeometry.dispose()}},ua={NONE:0,DEPTH:1,CONVOLUTION:2},Xt={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},use=class{constructor(){this.shaderParts=new Map([[Xt.FRAGMENT_HEAD,null],[Xt.FRAGMENT_MAIN_UV,null],[Xt.FRAGMENT_MAIN_IMAGE,null],[Xt.VERTEX_HEAD,null],[Xt.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=ua.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=Cs}},WS=!1,vD=class{constructor(n=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(n),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case ki:t=this.materialsFlatShadedDoubleSide;break;case qn:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded;break}else switch(e.material.side){case ki:t=this.materialsDoubleSide;break;case qn:t=this.materialsBackSide;break;default:t=this.materials;break}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(n){if(!(n instanceof Zn))return n.clone();const e=n.uniforms,t=new Map;for(const r in e){const s=e[r].value;s.isRenderTargetTexture&&(e[r].value=null,t.set(r,s))}const i=n.clone();for(const r of t)e[r[0]].value=r[1],i.uniforms[r[0]].value=r[1];return i}setMaterial(n){if(this.disposeMaterials(),this.material=n,n!==null){const e=this.materials=[this.cloneMaterial(n),this.cloneMaterial(n),this.cloneMaterial(n)];for(const t of e)t.uniforms=Object.assign({},n.uniforms),t.side=bs;e[2].skinning=!0,this.materialsBackSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.side=qn,i}),this.materialsDoubleSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.side=ki,i}),this.materialsFlatShaded=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i.side=qn,i}),this.materialsFlatShadedDoubleSide=e.map(t=>{const i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i.side=ki,i})}}render(n,e,t){const i=n.shadowMap.enabled;if(n.shadowMap.enabled=!1,WS){const r=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),n.render(e,t);for(const s of r)s[0].material=s[1];this.meshCount!==r.size&&r.clear()}else{const r=e.overrideMaterial;e.overrideMaterial=this.material,n.render(e,t),e.overrideMaterial=r}n.shadowMap.enabled=i}disposeMaterials(){if(this.material!==null){const n=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const e of n)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return WS}static set workaroundEnabled(n){WS=n}},ja=-1,Hi=class extends Is{constructor(n,e=ja,t=ja,i=1){super(),this.resizable=n,this.baseSize=new ce(1,1),this.preferredSize=new ce(e,t),this.target=this.preferredSize,this.s=i,this.effectiveSize=new ce,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){const n=this.baseSize,e=this.preferredSize,t=this.effectiveSize,i=this.scale;e.width!==ja?t.width=e.width:e.height!==ja?t.width=Math.round(e.height*(n.width/Math.max(n.height,1))):t.width=Math.round(n.width*i),e.height!==ja?t.height=e.height:e.width!==ja?t.height=Math.round(e.width/Math.max(n.width/Math.max(n.height,1),1)):t.height=Math.round(n.height*i)}get width(){return this.effectiveSize.width}set width(n){this.preferredWidth=n}get height(){return this.effectiveSize.height}set height(n){this.preferredHeight=n}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(n){this.s!==n&&(this.s=n,this.preferredSize.setScalar(ja),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(n){this.scale=n}get baseWidth(){return this.baseSize.width}set baseWidth(n){this.baseSize.width!==n&&(this.baseSize.width=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(n){this.baseWidth=n}get baseHeight(){return this.baseSize.height}set baseHeight(n){this.baseSize.height!==n&&(this.baseSize.height=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(n){this.baseHeight=n}setBaseSize(n,e){(this.baseSize.width!==n||this.baseSize.height!==e)&&(this.baseSize.set(n,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(n){this.preferredSize.width!==n&&(this.preferredSize.width=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(n){this.preferredWidth=n}get preferredHeight(){return this.preferredSize.height}set preferredHeight(n){this.preferredSize.height!==n&&(this.preferredSize.height=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(n){this.preferredHeight=n}setPreferredSize(n,e){(this.preferredSize.width!==n||this.preferredSize.height!==e)&&(this.preferredSize.set(n,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(n){this.s=n.scale,this.baseSize.set(n.baseWidth,n.baseHeight),this.preferredSize.set(n.preferredWidth,n.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return ja}},Pt={SKIP:9,SET:30,ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},fse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}",dse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}",hse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}",pse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",mse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}",gse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}",vse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}",yse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}",_se="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}",xse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}",Sse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}",Ase="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}",Ese="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}",Mse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}",wse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}",Tse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}",bse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}",Cse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}",Rse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}",Pse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",Ise="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}",Bse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}",Dse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}",Lse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}",Ose="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}",Fse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}",Nse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",Use="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}",kse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}",zse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}",Hse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}",Gse="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}",Vse=new Map([[Pt.ADD,fse],[Pt.ALPHA,dse],[Pt.AVERAGE,hse],[Pt.COLOR,pse],[Pt.COLOR_BURN,mse],[Pt.COLOR_DODGE,gse],[Pt.DARKEN,vse],[Pt.DIFFERENCE,yse],[Pt.DIVIDE,_se],[Pt.DST,null],[Pt.EXCLUSION,xse],[Pt.HARD_LIGHT,Sse],[Pt.HARD_MIX,Ase],[Pt.HUE,Ese],[Pt.INVERT,Mse],[Pt.INVERT_RGB,wse],[Pt.LIGHTEN,Tse],[Pt.LINEAR_BURN,bse],[Pt.LINEAR_DODGE,Cse],[Pt.LINEAR_LIGHT,Rse],[Pt.LUMINOSITY,Pse],[Pt.MULTIPLY,Ise],[Pt.NEGATION,Bse],[Pt.NORMAL,Dse],[Pt.OVERLAY,Lse],[Pt.PIN_LIGHT,Ose],[Pt.REFLECT,Fse],[Pt.SATURATION,Nse],[Pt.SCREEN,Use],[Pt.SOFT_LIGHT,kse],[Pt.SRC,zse],[Pt.SUBTRACT,Hse],[Pt.VIVID_LIGHT,Gse]]),Wse=class extends Is{constructor(n,e=1){super(),this._blendFunction=n,this.opacity=new ut(e)}getOpacity(){return this.opacity.value}setOpacity(n){this.opacity.value=n}get blendFunction(){return this._blendFunction}set blendFunction(n){this._blendFunction=n,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(n){this.blendFunction=n}getShaderCode(){return Vse.get(this.blendFunction)}},Tb={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},$se=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25; #include }`,Xse="uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",jse=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],Jse=class extends Zn{constructor(n=new jt){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new ut(null),texelSize:new ut(new jt),scale:new ut(1),kernel:new ut(0)},blending:Ci,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:$se,vertexShader:Xse}),this.setTexelSize(n.x,n.y),this.kernelSize=Tb.MEDIUM}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.inputBuffer=n}get kernelSequence(){return jse[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(n){this.uniforms.scale.value=n}getScale(){return this.uniforms.scale.value}setScale(n){this.uniforms.scale.value=n}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(n){this.uniforms.kernel.value=n}setKernel(n){this.kernel=n}setTexelSize(n,e){this.uniforms.texelSize.value.set(n,e,n*.5,e*.5)}setSize(n,e){const t=1/n,i=1/e;this.uniforms.texelSize.value.set(t,i,t*.5,i*.5)}},Kse=class extends cr{constructor({kernelSize:n=Tb.MEDIUM,resolutionScale:e=.5,width:t=Hi.AUTO_SIZE,height:i=Hi.AUTO_SIZE,resolutionX:r=t,resolutionY:s=i}={}){super("KawaseBlurPass"),this.renderTargetA=new xn(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const o=this.resolution=new Hi(this,r,s,e);o.addEventListener("change",a=>this.setSize(o.baseWidth,o.baseHeight)),this._blurMaterial=new Jse,this._blurMaterial.kernelSize=n,this.copyMaterial=new Fz}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(n){this._blurMaterial=n}get dithering(){return this.copyMaterial.dithering}set dithering(n){this.copyMaterial.dithering=n}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(n){this.blurMaterial.kernelSize=n}get width(){return this.resolution.width}set width(n){this.resolution.preferredWidth=n}get height(){return this.resolution.height}set height(n){this.resolution.preferredHeight=n}get scale(){return this.blurMaterial.scale}set scale(n){this.blurMaterial.scale=n}getScale(){return this.blurMaterial.scale}setScale(n){this.blurMaterial.scale=n}getKernelSize(){return this.kernelSize}setKernelSize(n){this.kernelSize=n}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}render(n,e,t,i,r){const s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=this.blurMaterial,u=c.kernelSequence;let h=e;this.fullscreenMaterial=c;for(let p=0,m=u.length;p #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif #ifdef RANGE uniform vec2 range; #elif defined(THRESHOLD) uniform float threshold;uniform float smoothing; #endif varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb); #ifdef RANGE float low=step(range.x,l);float high=step(l,range.y);l*=low*high; #elif defined(THRESHOLD) l=smoothstep(threshold,threshold+smoothing,l)*l; #endif #ifdef COLOR gl_FragColor=vec4(texel.rgb*clamp(l,0.0,1.0),l); #else gl_FragColor=vec4(l); #endif }`,Qse=class extends Zn{constructor(n=!1,e=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:Ta.replace(/\D+/g,"")},uniforms:{inputBuffer:new ut(null),threshold:new ut(0),smoothing:new ut(1),range:new ut(null)},blending:Ci,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:Yse,vertexShader:wb}),this.colorOutput=n,this.luminanceRange=e}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get threshold(){return this.uniforms.threshold.value}set threshold(n){this.smoothing>0||n>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=n}getThreshold(){return this.threshold}setThreshold(n){this.threshold=n}get smoothing(){return this.uniforms.smoothing.value}set smoothing(n){this.threshold>0||n>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=n}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(n){this.smoothing=n}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(n){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(n){n?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(n){return this.colorOutput}setColorOutputEnabled(n){this.colorOutput=n}get useRange(){return this.luminanceRange!==null}set useRange(n){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(n){n!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=n,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(n){this.luminanceRange=n}},kz=class extends cr{constructor({renderTarget:n,luminanceRange:e,colorOutput:t,resolutionScale:i=1,width:r=Hi.AUTO_SIZE,height:s=Hi.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("LuminancePass"),this.fullscreenMaterial=new Qse(t,e),this.needsSwap=!1,this.renderTarget=n,this.renderTarget===void 0&&(this.renderTarget=new xn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const l=this.resolution=new Hi(this,o,a,i);l.addEventListener("change",c=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(n,e,t,i,r){const s=this.fullscreenMaterial;s.inputBuffer=e.texture,n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,e){const t=this.resolution;t.setBaseSize(n,e),this.renderTarget.setSize(t.width,t.height)}initialize(n,e,t){t!==void 0&&t!==si&&(this.renderTarget.texture.type=t,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},qse=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif #define WEIGHT_INNER 0.125 #define WEIGHT_OUTER 0.0555555 varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c; #include }`,Zse="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}",eoe=class extends Zn{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new ut(null),texelSize:new ut(new ce)},blending:Ci,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:qse,vertexShader:Zse})}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setSize(n,e){this.uniforms.texelSize.value.set(1/n,1/e)}},toe=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer; #else uniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer; #endif uniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius); #include }`,noe="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}",ioe=class extends Zn{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new ut(null),supportBuffer:new ut(null),texelSize:new ut(new ce),radius:new ut(.85)},blending:Ci,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:toe,vertexShader:noe})}set inputBuffer(n){this.uniforms.inputBuffer.value=n}set supportBuffer(n){this.uniforms.supportBuffer.value=n}get radius(){return this.uniforms.radius.value}set radius(n){this.uniforms.radius.value=n}setSize(n,e){this.uniforms.texelSize.value.set(1/n,1/e)}},roe=class extends cr{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new xn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new eoe,this.upsamplingMaterial=new ioe,this.resolution=new ce}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(n){if(this.levels!==n){const e=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let t=0;t=0;--p){const m=u[p];l.setSize(h.width,h.height),l.inputBuffer=h.texture,l.supportBuffer=c[p].texture,n.setRenderTarget(m),n.render(s,o),h=m}}setSize(n,e){const t=this.resolution;t.set(n,e);let i=t.width,r=t.height;for(let s=0,o=this.downsamplingMipmaps.length;sthis.setChanged()),this._inputColorSpace=Cs,this._outputColorSpace=ir}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(n){this._inputColorSpace=n,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(n){this._outputColorSpace=n,this.setChanged()}set mainScene(n){}set mainCamera(n){}getName(){return this.name}setRenderer(n){this.renderer=n}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(n){this.attributes=n,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(n){this.fragmentShader=n,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(n){this.vertexShader=n,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(n,e=kl){}update(n,e,t){}setSize(n,e){}initialize(n,e,t){}dispose(){for(const n of Object.keys(this)){const e=this[n];(e instanceof xn||e instanceof zn||e instanceof cn||e instanceof cr)&&this[n].dispose()}}},soe=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D map; #else uniform lowp sampler2D map; #endif uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 texel=texture2D(map,uv);outputColor=vec4(texel.rgb*intensity,texel.a);}`,ooe=class extends sm{constructor({blendFunction:n=Pt.SCREEN,luminanceThreshold:e=.9,luminanceSmoothing:t=.025,mipmapBlur:i=!1,intensity:r=1,radius:s=.85,levels:o=8,kernelSize:a=Tb.LARGE,resolutionScale:l=.5,width:c=Hi.AUTO_SIZE,height:u=Hi.AUTO_SIZE,resolutionX:h=c,resolutionY:p=u}={}){super("BloomEffect",soe,{blendFunction:n,uniforms:new Map([["map",new ut(null)],["intensity",new ut(r)]])}),this.renderTarget=new xn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new Kse({kernelSize:a}),this.luminancePass=new kz({colorOutput:!0}),this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothing=t,this.mipmapBlurPass=new roe,this.mipmapBlurPass.enabled=i,this.mipmapBlurPass.radius=s,this.mipmapBlurPass.levels=o,this.uniforms.get("map").value=i?this.mipmapBlurPass.texture:this.renderTarget.texture;const m=this.resolution=new Hi(this,h,p,l);m.addEventListener("change",v=>this.setSize(m.baseWidth,m.baseHeight))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(n){this.resolution.preferredWidth=n}get height(){return this.resolution.height}set height(n){this.resolution.preferredHeight=n}get dithering(){return this.blurPass.dithering}set dithering(n){this.blurPass.dithering=n}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(n){this.blurPass.kernelSize=n}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(n){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(n){this.uniforms.get("intensity").value=n}getIntensity(){return this.intensity}setIntensity(n){this.intensity=n}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}update(n,e,t){const i=this.renderTarget,r=this.luminancePass;r.enabled?(r.render(n,e),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(n,r.renderTarget):this.blurPass.render(n,r.renderTarget,i)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(n,e):this.blurPass.render(n,e,i)}setSize(n,e){const t=this.resolution;t.setBaseSize(n,e),this.renderTarget.setSize(t.width,t.height),this.blurPass.resolution.copy(t),this.luminancePass.setSize(n,e),this.mipmapBlurPass.setSize(n,e)}initialize(n,e,t){this.blurPass.initialize(n,e,t),this.luminancePass.initialize(n,e,t),this.mipmapBlurPass.initialize(n,e,t),t!==void 0&&(this.renderTarget.texture.type=t,n!==null&&n.outputColorSpace===Ot&&(this.renderTarget.texture.colorSpace=Ot))}},nl={DISABLED:0,SPORADIC:1,CONSTANT_MILD:2,CONSTANT_WILD:3};function aoe(n,e,t){const i=new Map([[n_,1],[Rw,1],[Iw,2],[Ti,4]]);let r;if(i.has(e)||console.error("Invalid noise texture format"),t===si){r=new Uint8Array(n*i.get(e));for(let s=0,o=r.length;sdistortion.x-columns*random){float sx=clamp(ceil(seeds.x),0.0,1.0);uv.y=sx*(1.0-(uv.y+distortion.y))+(1.0-sx)*distortion.y;}if(uv.xdistortion.y-columns*random){float sy=clamp(ceil(seeds.y),0.0,1.0);uv.x=sy*distortion.x+(1.0-sy)*(1.0-(uv.x+distortion.x));}vec2 normal=texture2D(perturbationMap,uv*random*random).rg;uv+=normal*seeds*(random*0.2);}}",tv="Glitch.Generated";function hr(n,e){return n+Math.random()*(e-n)}var coe=class extends sm{constructor({chromaticAberrationOffset:n=null,delay:e=new ce(1.5,3.5),duration:t=new ce(.6,1),strength:i=new ce(.3,1),columns:r=.05,ratio:s=.85,perturbationMap:o=null,dtSize:a=64}={}){if(super("GlitchEffect",loe,{uniforms:new Map([["perturbationMap",new ut(null)],["columns",new ut(r)],["active",new ut(!1)],["random",new ut(1)],["seeds",new ut(new ce)],["distortion",new ut(new ce)]])}),o===null){const l=new yD(a,a,Ti);l.name=tv,this.perturbationMap=l}else this.perturbationMap=o;this.time=0,this.distortion=this.uniforms.get("distortion").value,this.delay=e,this.duration=t,this.breakPoint=new ce(hr(this.delay.x,this.delay.y),hr(this.duration.x,this.duration.y)),this.strength=i,this.mode=nl.SPORADIC,this.ratio=s,this.chromaticAberrationOffset=n}get seeds(){return this.uniforms.get("seeds").value}get active(){return this.uniforms.get("active").value}isActive(){return this.active}get minDelay(){return this.delay.x}set minDelay(n){this.delay.x=n}getMinDelay(){return this.delay.x}setMinDelay(n){this.delay.x=n}get maxDelay(){return this.delay.y}set maxDelay(n){this.delay.y=n}getMaxDelay(){return this.delay.y}setMaxDelay(n){this.delay.y=n}get minDuration(){return this.duration.x}set minDuration(n){this.duration.x=n}getMinDuration(){return this.duration.x}setMinDuration(n){this.duration.x=n}get maxDuration(){return this.duration.y}set maxDuration(n){this.duration.y=n}getMaxDuration(){return this.duration.y}setMaxDuration(n){this.duration.y=n}get minStrength(){return this.strength.x}set minStrength(n){this.strength.x=n}getMinStrength(){return this.strength.x}setMinStrength(n){this.strength.x=n}get maxStrength(){return this.strength.y}set maxStrength(n){this.strength.y=n}getMaxStrength(){return this.strength.y}setMaxStrength(n){this.strength.y=n}getMode(){return this.mode}setMode(n){this.mode=n}getGlitchRatio(){return 1-this.ratio}setGlitchRatio(n){this.ratio=Math.min(Math.max(1-n,0),1)}get columns(){return this.uniforms.get("columns").value}set columns(n){this.uniforms.get("columns").value=n}getGlitchColumns(){return this.columns}setGlitchColumns(n){this.columns=n}getChromaticAberrationOffset(){return this.chromaticAberrationOffset}setChromaticAberrationOffset(n){this.chromaticAberrationOffset=n}get perturbationMap(){return this.uniforms.get("perturbationMap").value}set perturbationMap(n){const e=this.perturbationMap;e!==null&&e.name===tv&&e.dispose(),n.minFilter=n.magFilter=Yt,n.wrapS=n.wrapT=ga,n.generateMipmaps=!1,this.uniforms.get("perturbationMap").value=n}getPerturbationMap(){return this.perturbationMap}setPerturbationMap(n){this.perturbationMap=n}generatePerturbationMap(n=64){const e=new yD(n,n,Ti);return e.name=tv,e}update(n,e,t){const i=this.mode,r=this.breakPoint,s=this.chromaticAberrationOffset,o=this.strength;let a=this.time,l=!1,c=0,u=0,h;i!==nl.DISABLED&&(i===nl.SPORADIC&&(a+=t,h=a>r.x,a>=r.x+r.y&&(r.set(hr(this.delay.x,this.delay.y),hr(this.duration.x,this.duration.y)),a=0)),c=Math.random(),this.uniforms.get("random").value=c,h&&c>this.ratio||i===nl.CONSTANT_WILD?(l=!0,c*=o.y*.03,u=hr(-Math.PI,Math.PI),this.seeds.set(hr(-o.y,o.y),hr(-o.y,o.y)),this.distortion.set(hr(0,1),hr(0,1))):(h||i===nl.CONSTANT_MILD)&&(l=!0,c*=o.x*.03,u=hr(-Math.PI,Math.PI),this.seeds.set(hr(-o.x,o.x),hr(-o.x,o.x)),this.distortion.set(hr(0,1),hr(0,1))),this.time=a),s!==null&&(l?s.set(Math.cos(u),Math.sin(u)).multiplyScalar(c):s.set(0,0)),this.uniforms.get("active").value=l}dispose(){const n=this.perturbationMap;n!==null&&n.name===tv&&n.dispose()}},zz=class extends cr{constructor(n,e,t=null){super("RenderPass",n,e),this.needsSwap=!1,this.clearPass=new Uz,this.overrideMaterialManager=t===null?null:new vD(t),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(n){this.scene=n}set mainCamera(n){this.camera=n}get renderToScreen(){return super.renderToScreen}set renderToScreen(n){super.renderToScreen=n,this.clearPass.renderToScreen=n}get overrideMaterial(){const n=this.overrideMaterialManager;return n!==null?n.material:null}set overrideMaterial(n){const e=this.overrideMaterialManager;n!==null?e!==null?e.setMaterial(n):this.overrideMaterialManager=new vD(n):e!==null&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(n){this.overrideMaterial=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getSelection(){return this.selection}setSelection(n){this.selection=n}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(n){this.ignoreBackground=n}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(n){this.skipShadowMapUpdate=n}getClearPass(){return this.clearPass}render(n,e,t,i,r){const s=this.scene,o=this.camera,a=this.selection,l=o.layers.mask,c=s.background,u=n.shadowMap.autoUpdate,h=this.renderToScreen?null:e;a!==null&&o.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(n.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(n,e),n.setRenderTarget(h),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(n,s,o):n.render(s,o),o.layers.mask=l,s.background=c,n.shadowMap.autoUpdate=u}},mr={LINEAR:0,REINHARD:1,REINHARD2:2,REINHARD2_ADAPTIVE:3,UNCHARTED2:4,OPTIMIZED_CINEON:5,CINEON:5,ACES_FILMIC:6,AGX:7,NEUTRAL:8},uoe=`#include #ifdef GL_FRAGMENT_PRECISION_HIGH uniform highp sampler2D depthBuffer; #else uniform mediump sampler2D depthBuffer; #endif #ifdef DOWNSAMPLE_NORMALS uniform lowp sampler2D normalBuffer; #endif varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){ #if DEPTH_PACKING == 3201 return unpackRGBAToDepth(texture2D(depthBuffer,uv)); #else return texture2D(depthBuffer,uv).r; #endif }int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[4];distances[0]=abs(c-samples[0]);distances[1]=abs(c-samples[1]);distances[2]=abs(c-samples[2]);distances[3]=abs(c-samples[3]);float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]this.setSize(a.baseWidth,a.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(n,e=kl){this.fullscreenMaterial.depthBuffer=n,this.fullscreenMaterial.depthPacking=e}render(n,e,t,i,r){n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,e){const t=this.resolution;t.setBaseSize(n,e),this.renderTarget.setSize(t.width,t.height),this.fullscreenMaterial.setSize(n,e)}initialize(n,e,t){const i=n.getContext();if(!(i.getExtension("EXT_color_buffer_float")||i.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}},poe=`#include #define packFloatToRGBA(v) packDepthToRGBA(v) #define unpackRGBAToFloat(v) unpackRGBAToDepth(v) uniform lowp sampler2D luminanceBuffer0;uniform lowp sampler2D luminanceBuffer1;uniform float minLuminance;uniform float deltaTime;uniform float tau;varying vec2 vUv;void main(){float l0=unpackRGBAToFloat(texture2D(luminanceBuffer0,vUv)); #if __VERSION__ < 300 float l1=texture2DLodEXT(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r; #else float l1=textureLod(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r; #endif l0=max(minLuminance,l0);l1=max(minLuminance,l1);float adaptedLum=l0+(l1-l0)*(1.0-exp(-deltaTime*tau));gl_FragColor=(adaptedLum==1.0)?vec4(1.0):packFloatToRGBA(adaptedLum);}`,moe=class extends Zn{constructor(){super({name:"AdaptiveLuminanceMaterial",defines:{MIP_LEVEL_1X1:"0.0"},uniforms:{luminanceBuffer0:new ut(null),luminanceBuffer1:new ut(null),minLuminance:new ut(.01),deltaTime:new ut(0),tau:new ut(1)},extensions:{shaderTextureLOD:!0},blending:Ci,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:poe,vertexShader:wb})}set luminanceBuffer0(n){this.uniforms.luminanceBuffer0.value=n}setLuminanceBuffer0(n){this.uniforms.luminanceBuffer0.value=n}set luminanceBuffer1(n){this.uniforms.luminanceBuffer1.value=n}setLuminanceBuffer1(n){this.uniforms.luminanceBuffer1.value=n}set mipLevel1x1(n){this.defines.MIP_LEVEL_1X1=n.toFixed(1),this.needsUpdate=!0}setMipLevel1x1(n){this.mipLevel1x1=n}set deltaTime(n){this.uniforms.deltaTime.value=n}setDeltaTime(n){this.uniforms.deltaTime.value=n}get minLuminance(){return this.uniforms.minLuminance.value}set minLuminance(n){this.uniforms.minLuminance.value=n}getMinLuminance(){return this.uniforms.minLuminance.value}setMinLuminance(n){this.uniforms.minLuminance.value=n}get adaptationRate(){return this.uniforms.tau.value}set adaptationRate(n){this.uniforms.tau.value=n}getAdaptationRate(){return this.uniforms.tau.value}setAdaptationRate(n){this.uniforms.tau.value=n}},goe=class extends cr{constructor(n,{minLuminance:e=.01,adaptationRate:t=1}={}){super("AdaptiveLuminancePass"),this.fullscreenMaterial=new moe,this.needsSwap=!1,this.renderTargetPrevious=new xn(1,1,{minFilter:Yt,magFilter:Yt,depthBuffer:!1}),this.renderTargetPrevious.texture.name="Luminance.Previous";const i=this.fullscreenMaterial;i.luminanceBuffer0=this.renderTargetPrevious.texture,i.luminanceBuffer1=n,i.minLuminance=e,i.adaptationRate=t,this.renderTargetAdapted=this.renderTargetPrevious.clone(),this.renderTargetAdapted.texture.name="Luminance.Adapted",this.copyPass=new Nz(this.renderTargetPrevious,!1)}get texture(){return this.renderTargetAdapted.texture}getTexture(){return this.renderTargetAdapted.texture}set mipLevel1x1(n){this.fullscreenMaterial.mipLevel1x1=n}get adaptationRate(){return this.fullscreenMaterial.adaptationRate}set adaptationRate(n){this.fullscreenMaterial.adaptationRate=n}render(n,e,t,i,r){this.fullscreenMaterial.deltaTime=i,n.setRenderTarget(this.renderToScreen?null:this.renderTargetAdapted),n.render(this.scene,this.camera),this.copyPass.render(n,this.renderTargetAdapted)}},voe=`#include uniform float whitePoint; #if TONE_MAPPING_MODE == 2 || TONE_MAPPING_MODE == 3 uniform float middleGrey; #if TONE_MAPPING_MODE == 3 uniform lowp sampler2D luminanceBuffer; #else uniform float averageLuminance; #endif vec3 Reinhard2ToneMapping(vec3 color){color*=toneMappingExposure;float l=luminance(color); #if TONE_MAPPING_MODE == 3 float lumAvg=unpackRGBAToFloat(texture2D(luminanceBuffer,vec2(0.5))); #else float lumAvg=averageLuminance; #endif float lumScaled=(l*middleGrey)/max(lumAvg,1e-6);float lumCompressed=lumScaled*(1.0+lumScaled/(whitePoint*whitePoint));lumCompressed/=(1.0+lumScaled);return clamp(lumCompressed*color,0.0,1.0);} #elif TONE_MAPPING_MODE == 4 #define A 0.15 #define B 0.50 #define C 0.10 #define D 0.20 #define E 0.02 #define F 0.30 vec3 Uncharted2Helper(const in vec3 x){return((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}vec3 Uncharted2ToneMapping(vec3 color){color*=toneMappingExposure;return clamp(Uncharted2Helper(color)/Uncharted2Helper(vec3(whitePoint)),0.0,1.0);} #endif void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){ #if TONE_MAPPING_MODE == 2 || TONE_MAPPING_MODE == 3 outputColor=vec4(Reinhard2ToneMapping(inputColor.rgb),inputColor.a); #elif TONE_MAPPING_MODE == 4 outputColor=vec4(Uncharted2ToneMapping(inputColor.rgb),inputColor.a); #else outputColor=vec4(toneMapping(inputColor.rgb),inputColor.a); #endif }`,yoe=class extends sm{constructor({blendFunction:n=Pt.SRC,adaptive:e=!1,mode:t=e?mr.REINHARD2_ADAPTIVE:mr.AGX,resolution:i=256,maxLuminance:r=4,whitePoint:s=r,middleGrey:o=.6,minLuminance:a=.01,averageLuminance:l=1,adaptationRate:c=1}={}){super("ToneMappingEffect",voe,{blendFunction:n,uniforms:new Map([["luminanceBuffer",new ut(null)],["maxLuminance",new ut(r)],["whitePoint",new ut(s)],["middleGrey",new ut(o)],["averageLuminance",new ut(l)]])}),this.renderTargetLuminance=new xn(1,1,{minFilter:Ys,depthBuffer:!1}),this.renderTargetLuminance.texture.generateMipmaps=!0,this.renderTargetLuminance.texture.name="Luminance",this.luminancePass=new kz({renderTarget:this.renderTargetLuminance}),this.adaptiveLuminancePass=new goe(this.luminancePass.texture,{minLuminance:a,adaptationRate:c}),this.uniforms.get("luminanceBuffer").value=this.adaptiveLuminancePass.texture,this.resolution=i,this.mode=t}get mode(){return Number(this.defines.get("TONE_MAPPING_MODE"))}set mode(n){if(this.mode===n)return;const t=Ta.replace(/\D+/g,"")>=168?"CineonToneMapping(texel)":"OptimizedCineonToneMapping(texel)";switch(this.defines.clear(),this.defines.set("TONE_MAPPING_MODE",n.toFixed(0)),n){case mr.LINEAR:this.defines.set("toneMapping(texel)","LinearToneMapping(texel)");break;case mr.REINHARD:this.defines.set("toneMapping(texel)","ReinhardToneMapping(texel)");break;case mr.CINEON:case mr.OPTIMIZED_CINEON:this.defines.set("toneMapping(texel)",t);break;case mr.ACES_FILMIC:this.defines.set("toneMapping(texel)","ACESFilmicToneMapping(texel)");break;case mr.AGX:this.defines.set("toneMapping(texel)","AgXToneMapping(texel)");break;case mr.NEUTRAL:this.defines.set("toneMapping(texel)","NeutralToneMapping(texel)");break;default:this.defines.set("toneMapping(texel)","texel");break}this.adaptiveLuminancePass.enabled=n===mr.REINHARD2_ADAPTIVE,this.setChanged()}getMode(){return this.mode}setMode(n){this.mode=n}get whitePoint(){return this.uniforms.get("whitePoint").value}set whitePoint(n){this.uniforms.get("whitePoint").value=n}get middleGrey(){return this.uniforms.get("middleGrey").value}set middleGrey(n){this.uniforms.get("middleGrey").value=n}get averageLuminance(){return this.uniforms.get("averageLuminance").value}set averageLuminance(n){this.uniforms.get("averageLuminance").value=n}get adaptiveLuminanceMaterial(){return this.adaptiveLuminancePass.fullscreenMaterial}getAdaptiveLuminanceMaterial(){return this.adaptiveLuminanceMaterial}get resolution(){return this.luminancePass.resolution.width}set resolution(n){const e=Math.max(0,Math.ceil(Math.log2(n))),t=Math.pow(2,e);this.luminancePass.resolution.setPreferredSize(t,t),this.adaptiveLuminanceMaterial.mipLevel1x1=e}getResolution(){return this.resolution}setResolution(n){this.resolution=n}get adaptive(){return this.mode===mr.REINHARD2_ADAPTIVE}set adaptive(n){this.mode=n?mr.REINHARD2_ADAPTIVE:mr.REINHARD2}get adaptationRate(){return this.adaptiveLuminanceMaterial.adaptationRate}set adaptationRate(n){this.adaptiveLuminanceMaterial.adaptationRate=n}get distinction(){return console.warn(this.name,"distinction was removed."),1}set distinction(n){console.warn(this.name,"distinction was removed.")}update(n,e,t){this.adaptiveLuminancePass.enabled&&(this.luminancePass.render(n,e),this.adaptiveLuminancePass.render(n,null,null,t))}initialize(n,e,t){this.adaptiveLuminancePass.initialize(n,e,t)}},_oe=`#include #include #include #define packFloatToRGBA(v) packDepthToRGBA(v) #define unpackRGBAToFloat(v) unpackRGBAToDepth(v) #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif #if DEPTH_PACKING == 3201 uniform lowp sampler2D depthBuffer; #elif defined(GL_FRAGMENT_PRECISION_HIGH) uniform highp sampler2D depthBuffer; #else uniform mediump sampler2D depthBuffer; #endif uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}float readDepth(const in vec2 uv){ #if DEPTH_PACKING == 3201 return unpackRGBAToDepth(texture2D(depthBuffer,uv)); #else return texture2D(depthBuffer,uv).r; #endif }float getViewZ(const in float depth){ #ifdef PERSPECTIVE_CAMERA return perspectiveDepthToViewZ(depth,cameraNear,cameraFar); #else return orthographicDepthToViewZ(depth,cameraNear,cameraFar); #endif }vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0; #ifdef ENCODE_OUTPUT #include #endif #include }`,xoe="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}",Soe=class extends Zn{constructor(n,e,t,i,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:Ta.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new ut(null),depthBuffer:new ut(null),resolution:new ut(new ce),texelSize:new ut(new ce),cameraNear:new ut(.3),cameraFar:new ut(1e3),aspect:new ut(1),time:new ut(0)},blending:Ci,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:r}),n&&this.setShaderParts(n),e&&this.setDefines(e),t&&this.setUniforms(t),this.copyCameraSettings(i)}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(n){this.uniforms.depthBuffer.value=n}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(n){this.defines.DEPTH_PACKING=n.toFixed(0),this.needsUpdate=!0}setDepthBuffer(n,e=kl){this.depthBuffer=n,this.depthPacking=e}setShaderData(n){this.setShaderParts(n.shaderParts),this.setDefines(n.defines),this.setUniforms(n.uniforms),this.setExtensions(n.extensions)}setShaderParts(n){return this.fragmentShader=_oe.replace(Xt.FRAGMENT_HEAD,n.get(Xt.FRAGMENT_HEAD)||"").replace(Xt.FRAGMENT_MAIN_UV,n.get(Xt.FRAGMENT_MAIN_UV)||"").replace(Xt.FRAGMENT_MAIN_IMAGE,n.get(Xt.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=xoe.replace(Xt.VERTEX_HEAD,n.get(Xt.VERTEX_HEAD)||"").replace(Xt.VERTEX_MAIN_SUPPORT,n.get(Xt.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(n){for(const e of n.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(n){for(const e of n.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(n){this.extensions={};for(const e of n)this.extensions[e]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(n){this.encodeOutput!==n&&(n?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(n){return this.encodeOutput}setOutputEncodingEnabled(n){this.encodeOutput=n}get time(){return this.uniforms.time.value}set time(n){this.uniforms.time.value=n}setDeltaTime(n){this.uniforms.time.value+=n}adoptCameraSettings(n){this.copyCameraSettings(n)}copyCameraSettings(n){n&&(this.uniforms.cameraNear.value=n.near,this.uniforms.cameraFar.value=n.far,n instanceof Un?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(n,e){const t=this.uniforms;t.resolution.value.set(n,e),t.texelSize.value.set(1/n,1/e),t.aspect.value=n/e}static get Section(){return Xt}};function _D(n,e,t){for(const i of e){const r="$1"+n+i.charAt(0).toUpperCase()+i.slice(1),s=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(const o of t.entries())o[1]!==null&&t.set(o[0],o[1].replace(s,r))}}function Aoe(n,e,t){let i=e.getFragmentShader(),r=e.getVertexShader();const s=i!==void 0&&/mainImage/.test(i),o=i!==void 0&&/mainUv/.test(i);if(t.attributes|=e.getAttributes(),i===void 0)throw new Error(`Missing fragment shader (${e.name})`);if(o&&t.attributes&ua.CONVOLUTION)throw new Error(`Effects that transform UVs are incompatible with convolution effects (${e.name})`);if(!s&&!o)throw new Error(`Could not find mainImage or mainUv function (${e.name})`);{const a=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,l=t.shaderParts;let c=l.get(Xt.FRAGMENT_HEAD)||"",u=l.get(Xt.FRAGMENT_MAIN_UV)||"",h=l.get(Xt.FRAGMENT_MAIN_IMAGE)||"",p=l.get(Xt.VERTEX_HEAD)||"",m=l.get(Xt.VERTEX_MAIN_SUPPORT)||"";const v=new Set,y=new Set;if(o&&(u+=` ${n}MainUv(UV); `,t.uvTransformation=!0),r!==null&&/mainSupport/.test(r)){const x=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);m+=` ${n}MainSupport(`,m+=x?`vUv); `:`); `;for(const A of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const M of A[1].split(/\s*,\s*/))t.varyings.add(M),v.add(M),y.add(M);for(const A of r.matchAll(a))y.add(A[1])}for(const x of i.matchAll(a))y.add(x[1]);for(const x of e.defines.keys())y.add(x.replace(/\([\w\s,]*\)/g,""));for(const x of e.uniforms.keys())y.add(x);y.delete("while"),y.delete("for"),y.delete("if"),e.uniforms.forEach((x,A)=>t.uniforms.set(n+A.charAt(0).toUpperCase()+A.slice(1),x)),e.defines.forEach((x,A)=>t.defines.set(n+A.charAt(0).toUpperCase()+A.slice(1),x));const _=new Map([["fragment",i],["vertex",r]]);_D(n,y,t.defines),_D(n,y,_),i=_.get("fragment"),r=_.get("vertex");const g=e.blendMode;if(t.blendModes.set(g.blendFunction,g),s){e.inputColorSpace!==null&&e.inputColorSpace!==t.colorSpace&&(h+=e.inputColorSpace===Ot?`color0 = sRGBTransferOETF(color0); `:`color0 = sRGBToLinear(color0); `),e.outputColorSpace!==ir?t.colorSpace=e.outputColorSpace:e.inputColorSpace!==null&&(t.colorSpace=e.inputColorSpace);const x=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;h+=`${n}MainImage(color0, UV, `,t.attributes&ua.DEPTH&&x.test(i)&&(h+="depth, ",t.readDepth=!0),h+=`color1); `;const A=n+"BlendOpacity";t.uniforms.set(A,g.opacity),h+=`color0 = blend${g.blendFunction}(color0, color1, ${A}); `,c+=`uniform float ${A}; `}if(c+=i+` `,r!==null&&(p+=r+` `),l.set(Xt.FRAGMENT_HEAD,c),l.set(Xt.FRAGMENT_MAIN_UV,u),l.set(Xt.FRAGMENT_MAIN_IMAGE,h),l.set(Xt.VERTEX_HEAD,p),l.set(Xt.VERTEX_MAIN_SUPPORT,m),e.extensions!==null)for(const x of e.extensions)t.extensions.add(x)}}var Eoe=class extends cr{constructor(n,...e){super("EffectPass"),this.fullscreenMaterial=new Soe(null,null,null,n),this.listener=t=>this.handleEvent(t),this.effects=[],this.setEffects(e),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(n){for(const e of this.effects)e.mainScene=n}set mainCamera(n){this.fullscreenMaterial.copyCameraSettings(n);for(const e of this.effects)e.mainCamera=n}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(n){this.fullscreenMaterial.encodeOutput=n}get dithering(){return this.fullscreenMaterial.dithering}set dithering(n){const e=this.fullscreenMaterial;e.dithering=n,e.needsUpdate=!0}setEffects(n){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=n.sort((e,t)=>t.attributes-e.attributes);for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const n=new use;let e=0;for(const o of this.effects)if(o.blendMode.blendFunction===Pt.DST)n.attributes|=o.getAttributes()&ua.DEPTH;else{if(n.attributes&o.getAttributes()&ua.CONVOLUTION)throw new Error(`Convolution effects cannot be merged (${o.name})`);Aoe("e"+e++,o,n)}let t=n.shaderParts.get(Xt.FRAGMENT_HEAD),i=n.shaderParts.get(Xt.FRAGMENT_MAIN_IMAGE),r=n.shaderParts.get(Xt.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const o of n.blendModes.values())t+=o.getShaderCode().replace(s,`blend${o.blendFunction}`)+` `;n.attributes&ua.DEPTH?(n.readDepth&&(i=`float depth = readDepth(UV); `+i),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,n.colorSpace===Ot&&(i+=`color0 = sRGBToLinear(color0); `),n.uvTransformation?(r=`vec2 transformedUv = vUv; `+r,n.defines.set("UV","transformedUv")):n.defines.set("UV","vUv"),n.shaderParts.set(Xt.FRAGMENT_HEAD,t),n.shaderParts.set(Xt.FRAGMENT_MAIN_IMAGE,i),n.shaderParts.set(Xt.FRAGMENT_MAIN_UV,r);for(const[o,a]of n.shaderParts)a!==null&&n.shaderParts.set(o,a.trim().replace(/^#/,` #`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(n)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(n,e=kl){this.fullscreenMaterial.depthBuffer=n,this.fullscreenMaterial.depthPacking=e;for(const t of this.effects)t.setDepthTexture(n,e)}render(n,e,t,i,r){for(const s of this.effects)s.update(n,e,i);if(!this.skipRendering||this.renderToScreen){const s=this.fullscreenMaterial;s.inputBuffer=e.texture,s.time+=i*this.timeScale,n.setRenderTarget(this.renderToScreen?null:t),n.render(this.scene,this.camera)}}setSize(n,e){this.fullscreenMaterial.setSize(n,e);for(const t of this.effects)t.setSize(n,e)}initialize(n,e,t){this.renderer=n;for(const i of this.effects)i.initialize(n,e,t);this.updateMaterial(),t!==void 0&&t!==si&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const n of this.effects)n.removeEventListener("change",this.listener),n.dispose()}handleEvent(n){switch(n.type){case"change":this.recompile();break}}},Moe=class extends cr{constructor(n,e,{renderTarget:t,resolutionScale:i=1,width:r=Hi.AUTO_SIZE,height:s=Hi.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new zz(n,e,new rT);const l=this.renderPass;l.ignoreBackground=!0,l.skipShadowMapUpdate=!0;const c=l.getClearPass();c.overrideClearColor=new Ie(7829503),c.overrideClearAlpha=1,this.renderTarget=t,this.renderTarget===void 0&&(this.renderTarget=new xn(1,1,{minFilter:Yt,magFilter:Yt}),this.renderTarget.texture.name="NormalPass.Target");const u=this.resolution=new Hi(this,o,a,i);u.addEventListener("change",h=>this.setSize(u.baseWidth,u.baseHeight))}set mainScene(n){this.renderPass.mainScene=n}set mainCamera(n){this.renderPass.mainCamera=n}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}render(n,e,t,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(n,s,s)}setSize(n,e){const t=this.resolution;t.setBaseSize(n,e),this.renderTarget.setSize(t.width,t.height)}};const woe=B.createContext(null),xD=n=>(n.getAttributes()&ua.CONVOLUTION)===ua.CONVOLUTION,Toe=X.memo(B.forwardRef(({children:n,camera:e,scene:t,resolutionScale:i,enabled:r=!0,renderPriority:s=1,autoClear:o=!0,depthBuffer:a,enableNormalPass:l,stencilBuffer:c,multisampling:u=8,frameBufferType:h=Tl},p)=>{const{gl:m,scene:v,camera:y,size:_}=la(),g=t||v,x=e||y,[A,M,w]=B.useMemo(()=>{const D=vK(),C=new cse(m,{depthBuffer:a,stencilBuffer:c,multisampling:u>0&&D?u:0,frameBufferType:h});C.addPass(new zz(g,x));let I=null,O=null;return l&&(O=new Moe(g,x),O.enabled=!1,C.addPass(O),i!==void 0&&D&&(I=new hoe({normalBuffer:O.texture,resolutionScale:i}),I.enabled=!1,C.addPass(I))),[C,O,I]},[x,m,a,c,u,h,g,l,i]);B.useEffect(()=>A==null?void 0:A.setSize(_.width,_.height),[A,_]),Mm((D,C)=>{if(r){const I=m.autoClear;m.autoClear=o,c&&!o&&m.clearStencil(),A.render(C),m.autoClear=I}},r?s:0);const b=B.useRef(null);B.useLayoutEffect(()=>{var D;const C=[],I=(D=b.current)==null?void 0:D.__r3f;if(I&&A){const O=I.objects;for(let H=0;H{for(const O of C)A==null||A.removePass(O);M&&(M.enabled=!1),w&&(w.enabled=!1)}},[A,n,x,M,w]),B.useEffect(()=>{const D=m.toneMapping;return m.toneMapping=Ms,()=>{m.toneMapping=D}},[m]);const R=B.useMemo(()=>({composer:A,normalPass:M,downSamplingPass:w,resolutionScale:i,camera:x,scene:g}),[A,M,w,i,x,g]);return B.useImperativeHandle(p,()=>A,[A]),pt.jsx(woe.Provider,{value:R,children:pt.jsx("group",{ref:b,children:n})})}));let boe=0;const SD=new WeakMap,Hz=(n,e)=>X.forwardRef(function({blendFunction:i=e==null?void 0:e.blendFunction,opacity:r=e==null?void 0:e.opacity,...s},o){let a=SD.get(n);if(!a){const u=`@react-three/postprocessing/${n.name}-${boe++}`;_T({[u]:n}),SD.set(n,a=u)}const l=la(u=>u.camera),c=X.useMemo(()=>{var u,h;return[...(u=e==null?void 0:e.args)!=null?u:[],...(h=s.args)!=null?h:[{...e,...s}]]},[JSON.stringify(s)]);return pt.jsx(a,{camera:l,"blendMode-blendFunction":i,"blendMode-opacity-value":r,...s,ref:o,args:c})}),nv=(n,e)=>{const t=n[e];return X.useMemo(()=>typeof t=="number"?new ce(t,t):t?new ce(...t):new ce,[t])},Coe=Hz(ooe,{blendFunction:Pt.ADD}),Roe=B.forwardRef(function({active:e=!0,...t},i){const r=la(u=>u.invalidate),s=nv(t,"delay"),o=nv(t,"duration"),a=nv(t,"strength"),l=nv(t,"chromaticAberrationOffset"),c=B.useMemo(()=>new coe({...t,delay:s,duration:o,strength:a,chromaticAberrationOffset:l}),[s,o,t,a,l]);return B.useLayoutEffect(()=>{c.mode=e?t.mode||nl.SPORADIC:nl.DISABLED,r()},[e,c,r,t.mode]),B.useEffect(()=>()=>{var u;(u=c.dispose)==null||u.call(c)},[c]),pt.jsx("primitive",{ref:i,object:c,dispose:null})}),Poe=Hz(yoe);function Ioe(){const{nodes:n,materials:e}=cu("./matt-park-text.glb"),t=B.useRef(),i=1;return Mm((r,s)=>{t.current&&(t.current.rotation.z+=s*i)}),pt.jsxs("group",{children:[pt.jsx("group",{position:[.1,0,.8],children:pt.jsxs("group",{ref:t,rotation:[Math.PI/2,0,0],scale:[.8,.6,.6],children:[pt.jsx("mesh",{geometry:n.Plane026.geometry,material:e["Material.007"]}),pt.jsx("mesh",{geometry:n.Plane026_1.geometry,material:e["smoke-white"]})]})}),pt.jsxs(Toe,{disableNormalPass:!0,children:[pt.jsx(Poe,{mode:mr.ACES_FILMIC}),pt.jsx(Coe,{luminanceThreshold:.5,intensity:.4,mipmapBlur:!0}),pt.jsx(Roe,{delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],mode:nl.SPORADIC,active:!0,ratio:.85})]})]})}cu.preload("./matt-park-text.glb");function Boe(){return pt.jsxs(pt.Fragment,{children:[pt.jsx("directionalLight",{position:[4,4,1],intensity:20}),pt.jsx("ambientLight",{intensity:1.5})]})}function Doe(){return pt.jsxs(aN,{camera:{position:[0,0,10],fov:50},children:[pt.jsx("color",{args:["black"],attach:"background"}),pt.jsxs(B.Suspense,{fallback:null,children:[pt.jsx(Ioe,{}),pt.jsx(Boe,{}),pt.jsx(zX,{transform:!1,children:pt.jsx("div",{style:{position:"fixed",top:"0",left:"50%",transform:"translate(-50%, 300%)",fontFamily:"'m6x11plus', Arial, sans-serif",fontSize:"clamp(15px, 6vw, 25px)",color:"white",textAlign:"center",pointerEvents:"none",letterSpacing:"1px",padding:"0 20px",minWidth:"300px",maxWidth:"none",margin:"0 auto",lineHeight:"1.4",whiteSpace:"pre-line",zIndex:1e3},children:"Get to know me better on PC :)"})})]})]})}function Loe(){const n=nse();return pt.jsx(pt.Fragment,{children:n?pt.jsx(Doe,{}):pt.jsxs(pt.Fragment,{children:[pt.jsx(tse,{}),pt.jsx(aN,{shadows:!0,camera:{fov:45,near:.1,far:200,position:[2.5,2,2]},children:pt.jsx(ese,{})})]})})}const Ooe=$S.createRoot(document.querySelector("#root"));Ooe.render(pt.jsx(Loe,{})); //# sourceMappingURL=index-6f9d3ef7.js.map