tokentracker-cli 0.5.69 → 0.5.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dashboard/dist/assets/{Card-ClNKd74W.js → Card-5ebScQbM.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-DiUhik_k.js → DashboardPage-B32RhUB1.js} +2 -2
- package/dashboard/dist/assets/{FadeIn-c2wFBL_u.js → FadeIn-CHjFUAEe.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-UPn-zQGB.js → IpCheckPage-CrbKufId.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-ZpuPopCf.js → LeaderboardPage-CVKBhGzY.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfilePage-C62TdxVy.js → LeaderboardProfilePage-CbpzxvLA.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-CQEaB_b2.js → LimitsPage-BwQ4isbM.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-8RdfHCcA.js → SettingsPage-Y3Znzs1i.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DiKFOpFH.js → WidgetsPage-tNojCBaj.js} +1 -1
- package/dashboard/dist/assets/{download-BmThIfGZ.js → download-CQASvwEL.js} +1 -1
- package/dashboard/dist/assets/leaderboard-columns-DFG1TWe9.js +1 -0
- package/dashboard/dist/assets/{main-D49FUfq7.js → main-Cv6YpYdZ.js} +16 -15
- package/dashboard/dist/assets/{use-limits-display-prefs-BHo0gzBa.js → use-limits-display-prefs-BUrHqTkA.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-BGttWixw.js → use-usage-limits-D-gv2i1R.js} +1 -1
- package/dashboard/dist/brand-logos/kimi.svg +1 -0
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/commands/init.js +11 -0
- package/src/commands/status.js +9 -0
- package/src/commands/sync.js +26 -0
- package/src/lib/rollout.js +172 -0
- package/dashboard/dist/assets/leaderboard-columns-9wPbwNaz.js +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-
|
|
2
|
-
function v2(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(t,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 n(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=n(r);fetch(r.href,s)}})();function OE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function y2(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function i(){var r=!1;try{r=this instanceof i}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),n}var Sm={exports:{}},Ic={},wm={exports:{}},Jt={};var Tb;function _2(){if(Tb)return Jt;Tb=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;function m(z){return z===null||typeof z!="object"?null:(z=p&&z[p]||z["@@iterator"],typeof z=="function"?z:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function y(z,ie,Ee){this.props=z,this.context=ie,this.refs=w,this.updater=Ee||v}y.prototype.isReactComponent={},y.prototype.setState=function(z,ie){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,ie,"setState")},y.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function b(){}b.prototype=y.prototype;function T(z,ie,Ee){this.props=z,this.context=ie,this.refs=w,this.updater=Ee||v}var A=T.prototype=new b;A.constructor=T,_(A,y.prototype),A.isPureReactComponent=!0;var M=Array.isArray,I=Object.prototype.hasOwnProperty,k={current:null},U={key:!0,ref:!0,__self:!0,__source:!0};function S(z,ie,Ee){var ze,Se={},ne=null,ye=null;if(ie!=null)for(ze in ie.ref!==void 0&&(ye=ie.ref),ie.key!==void 0&&(ne=""+ie.key),ie)I.call(ie,ze)&&!U.hasOwnProperty(ze)&&(Se[ze]=ie[ze]);var be=arguments.length-2;if(be===1)Se.children=Ee;else if(1<be){for(var Ne=Array(be),et=0;et<be;et++)Ne[et]=arguments[et+2];Se.children=Ne}if(z&&z.defaultProps)for(ze in be=z.defaultProps,be)Se[ze]===void 0&&(Se[ze]=be[ze]);return{$$typeof:t,type:z,key:ne,ref:ye,props:Se,_owner:k.current}}function P(z,ie){return{$$typeof:t,type:z.type,key:ie,ref:z.ref,props:z.props,_owner:z._owner}}function V(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function O(z){var ie={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Ee){return ie[Ee]})}var G=/\/+/g;function J(z,ie){return typeof z=="object"&&z!==null&&z.key!=null?O(""+z.key):ie.toString(36)}function H(z,ie,Ee,ze,Se){var ne=typeof z;(ne==="undefined"||ne==="boolean")&&(z=null);var ye=!1;if(z===null)ye=!0;else switch(ne){case"string":case"number":ye=!0;break;case"object":switch(z.$$typeof){case t:case e:ye=!0}}if(ye)return ye=z,Se=Se(ye),z=ze===""?"."+J(ye,0):ze,M(Se)?(Ee="",z!=null&&(Ee=z.replace(G,"$&/")+"/"),H(Se,ie,Ee,"",function(et){return et})):Se!=null&&(V(Se)&&(Se=P(Se,Ee+(!Se.key||ye&&ye.key===Se.key?"":(""+Se.key).replace(G,"$&/")+"/")+z)),ie.push(Se)),1;if(ye=0,ze=ze===""?".":ze+":",M(z))for(var be=0;be<z.length;be++){ne=z[be];var Ne=ze+J(ne,be);ye+=H(ne,ie,Ee,Ne,Se)}else if(Ne=m(z),typeof Ne=="function")for(z=Ne.call(z),be=0;!(ne=z.next()).done;)ne=ne.value,Ne=ze+J(ne,be++),ye+=H(ne,ie,Ee,Ne,Se);else if(ne==="object")throw ie=String(z),Error("Objects are not valid as a React child (found: "+(ie==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":ie)+"). If you meant to render a collection of children, use an array instead.");return ye}function X(z,ie,Ee){if(z==null)return z;var ze=[],Se=0;return H(z,ze,"","",function(ne){return ie.call(Ee,ne,Se++)}),ze}function K(z){if(z._status===-1){var ie=z._result;ie=ie(),ie.then(function(Ee){(z._status===0||z._status===-1)&&(z._status=1,z._result=Ee)},function(Ee){(z._status===0||z._status===-1)&&(z._status=2,z._result=Ee)}),z._status===-1&&(z._status=0,z._result=ie)}if(z._status===1)return z._result.default;throw z._result}var Q={current:null},W={transition:null},q={ReactCurrentDispatcher:Q,ReactCurrentBatchConfig:W,ReactCurrentOwner:k};function Z(){throw Error("act(...) is not supported in production builds of React.")}return Jt.Children={map:X,forEach:function(z,ie,Ee){X(z,function(){ie.apply(this,arguments)},Ee)},count:function(z){var ie=0;return X(z,function(){ie++}),ie},toArray:function(z){return X(z,function(ie){return ie})||[]},only:function(z){if(!V(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},Jt.Component=y,Jt.Fragment=n,Jt.Profiler=r,Jt.PureComponent=T,Jt.StrictMode=i,Jt.Suspense=u,Jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,Jt.act=Z,Jt.cloneElement=function(z,ie,Ee){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var ze=_({},z.props),Se=z.key,ne=z.ref,ye=z._owner;if(ie!=null){if(ie.ref!==void 0&&(ne=ie.ref,ye=k.current),ie.key!==void 0&&(Se=""+ie.key),z.type&&z.type.defaultProps)var be=z.type.defaultProps;for(Ne in ie)I.call(ie,Ne)&&!U.hasOwnProperty(Ne)&&(ze[Ne]=ie[Ne]===void 0&&be!==void 0?be[Ne]:ie[Ne])}var Ne=arguments.length-2;if(Ne===1)ze.children=Ee;else if(1<Ne){be=Array(Ne);for(var et=0;et<Ne;et++)be[et]=arguments[et+2];ze.children=be}return{$$typeof:t,type:z.type,key:Se,ref:ne,props:ze,_owner:ye}},Jt.createContext=function(z){return z={$$typeof:o,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},z.Provider={$$typeof:s,_context:z},z.Consumer=z},Jt.createElement=S,Jt.createFactory=function(z){var ie=S.bind(null,z);return ie.type=z,ie},Jt.createRef=function(){return{current:null}},Jt.forwardRef=function(z){return{$$typeof:c,render:z}},Jt.isValidElement=V,Jt.lazy=function(z){return{$$typeof:h,_payload:{_status:-1,_result:z},_init:K}},Jt.memo=function(z,ie){return{$$typeof:d,type:z,compare:ie===void 0?null:ie}},Jt.startTransition=function(z){var ie=W.transition;W.transition={};try{z()}finally{W.transition=ie}},Jt.unstable_act=Z,Jt.useCallback=function(z,ie){return Q.current.useCallback(z,ie)},Jt.useContext=function(z){return Q.current.useContext(z)},Jt.useDebugValue=function(){},Jt.useDeferredValue=function(z){return Q.current.useDeferredValue(z)},Jt.useEffect=function(z,ie){return Q.current.useEffect(z,ie)},Jt.useId=function(){return Q.current.useId()},Jt.useImperativeHandle=function(z,ie,Ee){return Q.current.useImperativeHandle(z,ie,Ee)},Jt.useInsertionEffect=function(z,ie){return Q.current.useInsertionEffect(z,ie)},Jt.useLayoutEffect=function(z,ie){return Q.current.useLayoutEffect(z,ie)},Jt.useMemo=function(z,ie){return Q.current.useMemo(z,ie)},Jt.useReducer=function(z,ie,Ee){return Q.current.useReducer(z,ie,Ee)},Jt.useRef=function(z){return Q.current.useRef(z)},Jt.useState=function(z){return Q.current.useState(z)},Jt.useSyncExternalStore=function(z,ie,Ee){return Q.current.useSyncExternalStore(z,ie,Ee)},Jt.useTransition=function(){return Q.current.useTransition()},Jt.version="18.3.1",Jt}var Ab;function Ov(){return Ab||(Ab=1,wm.exports=_2()),wm.exports}var Cb;function x2(){if(Cb)return Ic;Cb=1;var t=Ov(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,d){var h,p={},m=null,v=null;d!==void 0&&(m=""+d),u.key!==void 0&&(m=""+u.key),u.ref!==void 0&&(v=u.ref);for(h in u)i.call(u,h)&&!s.hasOwnProperty(h)&&(p[h]=u[h]);if(c&&c.defaultProps)for(h in u=c.defaultProps,u)p[h]===void 0&&(p[h]=u[h]);return{$$typeof:e,type:c,key:m,ref:v,props:p,_owner:r.current}}return Ic.Fragment=n,Ic.jsx=o,Ic.jsxs=o,Ic}var Pb;function b2(){return Pb||(Pb=1,Sm.exports=x2()),Sm.exports}var F=b2(),L=Ov();const hs=OE(L),BE=v2({__proto__:null,default:hs},[L]);var zd={},Em={exports:{}},Vi={},Mm={exports:{}},Tm={};var Rb;function S2(){return Rb||(Rb=1,(function(t){function e(W,q){var Z=W.length;W.push(q);e:for(;0<Z;){var z=Z-1>>>1,ie=W[z];if(0<r(ie,q))W[z]=q,W[Z]=ie,Z=z;else break e}}function n(W){return W.length===0?null:W[0]}function i(W){if(W.length===0)return null;var q=W[0],Z=W.pop();if(Z!==q){W[0]=Z;e:for(var z=0,ie=W.length,Ee=ie>>>1;z<Ee;){var ze=2*(z+1)-1,Se=W[ze],ne=ze+1,ye=W[ne];if(0>r(Se,Z))ne<ie&&0>r(ye,Se)?(W[z]=ye,W[ne]=Z,z=ne):(W[z]=Se,W[ze]=Z,z=ze);else if(ne<ie&&0>r(ye,Z))W[z]=ye,W[ne]=Z,z=ne;else break e}}return q}function r(W,q){var Z=W.sortIndex-q.sortIndex;return Z!==0?Z:W.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],d=[],h=1,p=null,m=3,v=!1,_=!1,w=!1,y=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,T=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(W){for(var q=n(d);q!==null;){if(q.callback===null)i(d);else if(q.startTime<=W)i(d),q.sortIndex=q.expirationTime,e(u,q);else break;q=n(d)}}function M(W){if(w=!1,A(W),!_)if(n(u)!==null)_=!0,K(I);else{var q=n(d);q!==null&&Q(M,q.startTime-W)}}function I(W,q){_=!1,w&&(w=!1,b(S),S=-1),v=!0;var Z=m;try{for(A(q),p=n(u);p!==null&&(!(p.expirationTime>q)||W&&!O());){var z=p.callback;if(typeof z=="function"){p.callback=null,m=p.priorityLevel;var ie=z(p.expirationTime<=q);q=t.unstable_now(),typeof ie=="function"?p.callback=ie:p===n(u)&&i(u),A(q)}else i(u);p=n(u)}if(p!==null)var Ee=!0;else{var ze=n(d);ze!==null&&Q(M,ze.startTime-q),Ee=!1}return Ee}finally{p=null,m=Z,v=!1}}var k=!1,U=null,S=-1,P=5,V=-1;function O(){return!(t.unstable_now()-V<P)}function G(){if(U!==null){var W=t.unstable_now();V=W;var q=!0;try{q=U(!0,W)}finally{q?J():(k=!1,U=null)}}else k=!1}var J;if(typeof T=="function")J=function(){T(G)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,X=H.port2;H.port1.onmessage=G,J=function(){X.postMessage(null)}}else J=function(){y(G,0)};function K(W){U=W,k||(k=!0,J())}function Q(W,q){S=y(function(){W(t.unstable_now())},q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(W){W.callback=null},t.unstable_continueExecution=function(){_||v||(_=!0,K(I))},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(W){switch(m){case 1:case 2:case 3:var q=3;break;default:q=m}var Z=m;m=q;try{return W()}finally{m=Z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(W,q){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var Z=m;m=W;try{return q()}finally{m=Z}},t.unstable_scheduleCallback=function(W,q,Z){var z=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?z+Z:z):Z=z,W){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=Z+ie,W={id:h++,callback:q,priorityLevel:W,startTime:Z,expirationTime:ie,sortIndex:-1},Z>z?(W.sortIndex=Z,e(d,W),n(u)===null&&W===n(d)&&(w?(b(S),S=-1):w=!0,Q(M,Z-z))):(W.sortIndex=ie,e(u,W),_||v||(_=!0,K(I))),W},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(W){var q=m;return function(){var Z=m;m=q;try{return W.apply(this,arguments)}finally{m=Z}}}})(Tm)),Tm}var kb;function w2(){return kb||(kb=1,Mm.exports=S2()),Mm.exports}var Lb;function E2(){if(Lb)return Vi;Lb=1;var t=Ov(),e=w2();function n(a){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+a,f=1;f<arguments.length;f++)l+="&args[]="+encodeURIComponent(arguments[f]);return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,r={};function s(a,l){o(a,l),o(a+"Capture",l)}function o(a,l){for(r[a]=l,a=0;a<l.length;a++)i.add(l[a])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,h={},p={};function m(a){return u.call(p,a)?!0:u.call(h,a)?!1:d.test(a)?p[a]=!0:(h[a]=!0,!1)}function v(a,l,f,g){if(f!==null&&f.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return g?!1:f!==null?!f.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function _(a,l,f,g){if(l===null||typeof l>"u"||v(a,l,f,g))return!0;if(g)return!1;if(f!==null)switch(f.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function w(a,l,f,g,x,E,D){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=g,this.attributeNamespace=x,this.mustUseProperty=f,this.propertyName=a,this.type=l,this.sanitizeURL=E,this.removeEmptyString=D}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){y[a]=new w(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var l=a[0];y[l]=new w(l,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){y[a]=new w(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){y[a]=new w(a,2,!1,a,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(a){y[a]=new w(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){y[a]=new w(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){y[a]=new w(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){y[a]=new w(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){y[a]=new w(a,5,!1,a.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function T(a){return a[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(a){var l=a.replace(b,T);y[l]=new w(l,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var l=a.replace(b,T);y[l]=new w(l,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var l=a.replace(b,T);y[l]=new w(l,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){y[a]=new w(a,1,!1,a.toLowerCase(),null,!1,!1)}),y.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){y[a]=new w(a,1,!1,a.toLowerCase(),null,!0,!0)});function A(a,l,f,g){var x=y.hasOwnProperty(l)?y[l]:null;(x!==null?x.type!==0:g||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(_(l,f,x,g)&&(f=null),g||x===null?m(l)&&(f===null?a.removeAttribute(l):a.setAttribute(l,""+f)):x.mustUseProperty?a[x.propertyName]=f===null?x.type===3?!1:"":f:(l=x.attributeName,g=x.attributeNamespace,f===null?a.removeAttribute(l):(x=x.type,f=x===3||x===4&&f===!0?"":""+f,g?a.setAttributeNS(g,l,f):a.setAttribute(l,f))))}var M=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),k=Symbol.for("react.portal"),U=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),V=Symbol.for("react.provider"),O=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),Q=Symbol.for("react.offscreen"),W=Symbol.iterator;function q(a){return a===null||typeof a!="object"?null:(a=W&&a[W]||a["@@iterator"],typeof a=="function"?a:null)}var Z=Object.assign,z;function ie(a){if(z===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);z=l&&l[1]||""}return`
|
|
3
|
-
`+z+a}var
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-B32RhUB1.js","assets/use-usage-limits-D-gv2i1R.js","assets/Card-5ebScQbM.js","assets/FadeIn-CHjFUAEe.js","assets/LeaderboardPage-CVKBhGzY.js","assets/leaderboard-columns-DFG1TWe9.js","assets/LeaderboardProfilePage-CbpzxvLA.js","assets/LimitsPage-BwQ4isbM.js","assets/use-limits-display-prefs-BUrHqTkA.js","assets/SettingsPage-Y3Znzs1i.js","assets/download-CQASvwEL.js","assets/WidgetsPage-tNojCBaj.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
function v2(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(t,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 n(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=n(r);fetch(r.href,s)}})();function OE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function y2(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function i(){var r=!1;try{r=this instanceof i}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),n}var Sm={exports:{}},Ic={},wm={exports:{}},Jt={};var Tb;function _2(){if(Tb)return Jt;Tb=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;function m(z){return z===null||typeof z!="object"?null:(z=p&&z[p]||z["@@iterator"],typeof z=="function"?z:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function y(z,ie,we){this.props=z,this.context=ie,this.refs=w,this.updater=we||v}y.prototype.isReactComponent={},y.prototype.setState=function(z,ie){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,ie,"setState")},y.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function b(){}b.prototype=y.prototype;function T(z,ie,we){this.props=z,this.context=ie,this.refs=w,this.updater=we||v}var A=T.prototype=new b;A.constructor=T,_(A,y.prototype),A.isPureReactComponent=!0;var M=Array.isArray,I=Object.prototype.hasOwnProperty,k={current:null},U={key:!0,ref:!0,__self:!0,__source:!0};function S(z,ie,we){var He,Se={},ne=null,ye=null;if(ie!=null)for(He in ie.ref!==void 0&&(ye=ie.ref),ie.key!==void 0&&(ne=""+ie.key),ie)I.call(ie,He)&&!U.hasOwnProperty(He)&&(Se[He]=ie[He]);var be=arguments.length-2;if(be===1)Se.children=we;else if(1<be){for(var Ne=Array(be),et=0;et<be;et++)Ne[et]=arguments[et+2];Se.children=Ne}if(z&&z.defaultProps)for(He in be=z.defaultProps,be)Se[He]===void 0&&(Se[He]=be[He]);return{$$typeof:t,type:z,key:ne,ref:ye,props:Se,_owner:k.current}}function P(z,ie){return{$$typeof:t,type:z.type,key:ie,ref:z.ref,props:z.props,_owner:z._owner}}function V(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function O(z){var ie={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(we){return ie[we]})}var G=/\/+/g;function J(z,ie){return typeof z=="object"&&z!==null&&z.key!=null?O(""+z.key):ie.toString(36)}function H(z,ie,we,He,Se){var ne=typeof z;(ne==="undefined"||ne==="boolean")&&(z=null);var ye=!1;if(z===null)ye=!0;else switch(ne){case"string":case"number":ye=!0;break;case"object":switch(z.$$typeof){case t:case e:ye=!0}}if(ye)return ye=z,Se=Se(ye),z=He===""?"."+J(ye,0):He,M(Se)?(we="",z!=null&&(we=z.replace(G,"$&/")+"/"),H(Se,ie,we,"",function(et){return et})):Se!=null&&(V(Se)&&(Se=P(Se,we+(!Se.key||ye&&ye.key===Se.key?"":(""+Se.key).replace(G,"$&/")+"/")+z)),ie.push(Se)),1;if(ye=0,He=He===""?".":He+":",M(z))for(var be=0;be<z.length;be++){ne=z[be];var Ne=He+J(ne,be);ye+=H(ne,ie,we,Ne,Se)}else if(Ne=m(z),typeof Ne=="function")for(z=Ne.call(z),be=0;!(ne=z.next()).done;)ne=ne.value,Ne=He+J(ne,be++),ye+=H(ne,ie,we,Ne,Se);else if(ne==="object")throw ie=String(z),Error("Objects are not valid as a React child (found: "+(ie==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":ie)+"). If you meant to render a collection of children, use an array instead.");return ye}function X(z,ie,we){if(z==null)return z;var He=[],Se=0;return H(z,He,"","",function(ne){return ie.call(we,ne,Se++)}),He}function K(z){if(z._status===-1){var ie=z._result;ie=ie(),ie.then(function(we){(z._status===0||z._status===-1)&&(z._status=1,z._result=we)},function(we){(z._status===0||z._status===-1)&&(z._status=2,z._result=we)}),z._status===-1&&(z._status=0,z._result=ie)}if(z._status===1)return z._result.default;throw z._result}var Q={current:null},W={transition:null},q={ReactCurrentDispatcher:Q,ReactCurrentBatchConfig:W,ReactCurrentOwner:k};function Z(){throw Error("act(...) is not supported in production builds of React.")}return Jt.Children={map:X,forEach:function(z,ie,we){X(z,function(){ie.apply(this,arguments)},we)},count:function(z){var ie=0;return X(z,function(){ie++}),ie},toArray:function(z){return X(z,function(ie){return ie})||[]},only:function(z){if(!V(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},Jt.Component=y,Jt.Fragment=n,Jt.Profiler=r,Jt.PureComponent=T,Jt.StrictMode=i,Jt.Suspense=u,Jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,Jt.act=Z,Jt.cloneElement=function(z,ie,we){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var He=_({},z.props),Se=z.key,ne=z.ref,ye=z._owner;if(ie!=null){if(ie.ref!==void 0&&(ne=ie.ref,ye=k.current),ie.key!==void 0&&(Se=""+ie.key),z.type&&z.type.defaultProps)var be=z.type.defaultProps;for(Ne in ie)I.call(ie,Ne)&&!U.hasOwnProperty(Ne)&&(He[Ne]=ie[Ne]===void 0&&be!==void 0?be[Ne]:ie[Ne])}var Ne=arguments.length-2;if(Ne===1)He.children=we;else if(1<Ne){be=Array(Ne);for(var et=0;et<Ne;et++)be[et]=arguments[et+2];He.children=be}return{$$typeof:t,type:z.type,key:Se,ref:ne,props:He,_owner:ye}},Jt.createContext=function(z){return z={$$typeof:o,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},z.Provider={$$typeof:s,_context:z},z.Consumer=z},Jt.createElement=S,Jt.createFactory=function(z){var ie=S.bind(null,z);return ie.type=z,ie},Jt.createRef=function(){return{current:null}},Jt.forwardRef=function(z){return{$$typeof:c,render:z}},Jt.isValidElement=V,Jt.lazy=function(z){return{$$typeof:h,_payload:{_status:-1,_result:z},_init:K}},Jt.memo=function(z,ie){return{$$typeof:d,type:z,compare:ie===void 0?null:ie}},Jt.startTransition=function(z){var ie=W.transition;W.transition={};try{z()}finally{W.transition=ie}},Jt.unstable_act=Z,Jt.useCallback=function(z,ie){return Q.current.useCallback(z,ie)},Jt.useContext=function(z){return Q.current.useContext(z)},Jt.useDebugValue=function(){},Jt.useDeferredValue=function(z){return Q.current.useDeferredValue(z)},Jt.useEffect=function(z,ie){return Q.current.useEffect(z,ie)},Jt.useId=function(){return Q.current.useId()},Jt.useImperativeHandle=function(z,ie,we){return Q.current.useImperativeHandle(z,ie,we)},Jt.useInsertionEffect=function(z,ie){return Q.current.useInsertionEffect(z,ie)},Jt.useLayoutEffect=function(z,ie){return Q.current.useLayoutEffect(z,ie)},Jt.useMemo=function(z,ie){return Q.current.useMemo(z,ie)},Jt.useReducer=function(z,ie,we){return Q.current.useReducer(z,ie,we)},Jt.useRef=function(z){return Q.current.useRef(z)},Jt.useState=function(z){return Q.current.useState(z)},Jt.useSyncExternalStore=function(z,ie,we){return Q.current.useSyncExternalStore(z,ie,we)},Jt.useTransition=function(){return Q.current.useTransition()},Jt.version="18.3.1",Jt}var Ab;function Ov(){return Ab||(Ab=1,wm.exports=_2()),wm.exports}var Cb;function x2(){if(Cb)return Ic;Cb=1;var t=Ov(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,d){var h,p={},m=null,v=null;d!==void 0&&(m=""+d),u.key!==void 0&&(m=""+u.key),u.ref!==void 0&&(v=u.ref);for(h in u)i.call(u,h)&&!s.hasOwnProperty(h)&&(p[h]=u[h]);if(c&&c.defaultProps)for(h in u=c.defaultProps,u)p[h]===void 0&&(p[h]=u[h]);return{$$typeof:e,type:c,key:m,ref:v,props:p,_owner:r.current}}return Ic.Fragment=n,Ic.jsx=o,Ic.jsxs=o,Ic}var Pb;function b2(){return Pb||(Pb=1,Sm.exports=x2()),Sm.exports}var F=b2(),L=Ov();const hs=OE(L),BE=v2({__proto__:null,default:hs},[L]);var zd={},Em={exports:{}},Vi={},Mm={exports:{}},Tm={};var Rb;function S2(){return Rb||(Rb=1,(function(t){function e(W,q){var Z=W.length;W.push(q);e:for(;0<Z;){var z=Z-1>>>1,ie=W[z];if(0<r(ie,q))W[z]=q,W[Z]=ie,Z=z;else break e}}function n(W){return W.length===0?null:W[0]}function i(W){if(W.length===0)return null;var q=W[0],Z=W.pop();if(Z!==q){W[0]=Z;e:for(var z=0,ie=W.length,we=ie>>>1;z<we;){var He=2*(z+1)-1,Se=W[He],ne=He+1,ye=W[ne];if(0>r(Se,Z))ne<ie&&0>r(ye,Se)?(W[z]=ye,W[ne]=Z,z=ne):(W[z]=Se,W[He]=Z,z=He);else if(ne<ie&&0>r(ye,Z))W[z]=ye,W[ne]=Z,z=ne;else break e}}return q}function r(W,q){var Z=W.sortIndex-q.sortIndex;return Z!==0?Z:W.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],d=[],h=1,p=null,m=3,v=!1,_=!1,w=!1,y=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,T=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(W){for(var q=n(d);q!==null;){if(q.callback===null)i(d);else if(q.startTime<=W)i(d),q.sortIndex=q.expirationTime,e(u,q);else break;q=n(d)}}function M(W){if(w=!1,A(W),!_)if(n(u)!==null)_=!0,K(I);else{var q=n(d);q!==null&&Q(M,q.startTime-W)}}function I(W,q){_=!1,w&&(w=!1,b(S),S=-1),v=!0;var Z=m;try{for(A(q),p=n(u);p!==null&&(!(p.expirationTime>q)||W&&!O());){var z=p.callback;if(typeof z=="function"){p.callback=null,m=p.priorityLevel;var ie=z(p.expirationTime<=q);q=t.unstable_now(),typeof ie=="function"?p.callback=ie:p===n(u)&&i(u),A(q)}else i(u);p=n(u)}if(p!==null)var we=!0;else{var He=n(d);He!==null&&Q(M,He.startTime-q),we=!1}return we}finally{p=null,m=Z,v=!1}}var k=!1,U=null,S=-1,P=5,V=-1;function O(){return!(t.unstable_now()-V<P)}function G(){if(U!==null){var W=t.unstable_now();V=W;var q=!0;try{q=U(!0,W)}finally{q?J():(k=!1,U=null)}}else k=!1}var J;if(typeof T=="function")J=function(){T(G)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,X=H.port2;H.port1.onmessage=G,J=function(){X.postMessage(null)}}else J=function(){y(G,0)};function K(W){U=W,k||(k=!0,J())}function Q(W,q){S=y(function(){W(t.unstable_now())},q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(W){W.callback=null},t.unstable_continueExecution=function(){_||v||(_=!0,K(I))},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(W){switch(m){case 1:case 2:case 3:var q=3;break;default:q=m}var Z=m;m=q;try{return W()}finally{m=Z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(W,q){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var Z=m;m=W;try{return q()}finally{m=Z}},t.unstable_scheduleCallback=function(W,q,Z){var z=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?z+Z:z):Z=z,W){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=Z+ie,W={id:h++,callback:q,priorityLevel:W,startTime:Z,expirationTime:ie,sortIndex:-1},Z>z?(W.sortIndex=Z,e(d,W),n(u)===null&&W===n(d)&&(w?(b(S),S=-1):w=!0,Q(M,Z-z))):(W.sortIndex=ie,e(u,W),_||v||(_=!0,K(I))),W},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(W){var q=m;return function(){var Z=m;m=q;try{return W.apply(this,arguments)}finally{m=Z}}}})(Tm)),Tm}var kb;function w2(){return kb||(kb=1,Mm.exports=S2()),Mm.exports}var Lb;function E2(){if(Lb)return Vi;Lb=1;var t=Ov(),e=w2();function n(a){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+a,f=1;f<arguments.length;f++)l+="&args[]="+encodeURIComponent(arguments[f]);return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,r={};function s(a,l){o(a,l),o(a+"Capture",l)}function o(a,l){for(r[a]=l,a=0;a<l.length;a++)i.add(l[a])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,h={},p={};function m(a){return u.call(p,a)?!0:u.call(h,a)?!1:d.test(a)?p[a]=!0:(h[a]=!0,!1)}function v(a,l,f,g){if(f!==null&&f.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return g?!1:f!==null?!f.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function _(a,l,f,g){if(l===null||typeof l>"u"||v(a,l,f,g))return!0;if(g)return!1;if(f!==null)switch(f.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function w(a,l,f,g,x,E,D){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=g,this.attributeNamespace=x,this.mustUseProperty=f,this.propertyName=a,this.type=l,this.sanitizeURL=E,this.removeEmptyString=D}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){y[a]=new w(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var l=a[0];y[l]=new w(l,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){y[a]=new w(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){y[a]=new w(a,2,!1,a,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(a){y[a]=new w(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){y[a]=new w(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){y[a]=new w(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){y[a]=new w(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){y[a]=new w(a,5,!1,a.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function T(a){return a[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(a){var l=a.replace(b,T);y[l]=new w(l,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var l=a.replace(b,T);y[l]=new w(l,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var l=a.replace(b,T);y[l]=new w(l,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){y[a]=new w(a,1,!1,a.toLowerCase(),null,!1,!1)}),y.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){y[a]=new w(a,1,!1,a.toLowerCase(),null,!0,!0)});function A(a,l,f,g){var x=y.hasOwnProperty(l)?y[l]:null;(x!==null?x.type!==0:g||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(_(l,f,x,g)&&(f=null),g||x===null?m(l)&&(f===null?a.removeAttribute(l):a.setAttribute(l,""+f)):x.mustUseProperty?a[x.propertyName]=f===null?x.type===3?!1:"":f:(l=x.attributeName,g=x.attributeNamespace,f===null?a.removeAttribute(l):(x=x.type,f=x===3||x===4&&f===!0?"":""+f,g?a.setAttributeNS(g,l,f):a.setAttribute(l,f))))}var M=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),k=Symbol.for("react.portal"),U=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),V=Symbol.for("react.provider"),O=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),Q=Symbol.for("react.offscreen"),W=Symbol.iterator;function q(a){return a===null||typeof a!="object"?null:(a=W&&a[W]||a["@@iterator"],typeof a=="function"?a:null)}var Z=Object.assign,z;function ie(a){if(z===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);z=l&&l[1]||""}return`
|
|
3
|
+
`+z+a}var we=!1;function He(a,l){if(!a||we)return"";we=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(ge){var g=ge}Reflect.construct(a,[],l)}else{try{l.call()}catch(ge){g=ge}a.call(l.prototype)}else{try{throw Error()}catch(ge){g=ge}a()}}catch(ge){if(ge&&g&&typeof ge.stack=="string"){for(var x=ge.stack.split(`
|
|
4
4
|
`),E=g.stack.split(`
|
|
5
5
|
`),D=x.length-1,$=E.length-1;1<=D&&0<=$&&x[D]!==E[$];)$--;for(;1<=D&&0<=$;D--,$--)if(x[D]!==E[$]){if(D!==1||$!==1)do if(D--,$--,0>$||x[D]!==E[$]){var te=`
|
|
6
|
-
`+x[D].replace(" at new "," at ");return a.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",a.displayName)),te}while(1<=D&&0<=$);break}}}finally{Ee=!1,Error.prepareStackTrace=f}return(a=a?a.displayName||a.name:"")?ie(a):""}function Se(a){switch(a.tag){case 5:return ie(a.type);case 16:return ie("Lazy");case 13:return ie("Suspense");case 19:return ie("SuspenseList");case 0:case 2:case 15:return a=ze(a.type,!1),a;case 11:return a=ze(a.type.render,!1),a;case 1:return a=ze(a.type,!0),a;default:return""}}function ne(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case U:return"Fragment";case k:return"Portal";case P:return"Profiler";case S:return"StrictMode";case J:return"Suspense";case H:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case O:return(a.displayName||"Context")+".Consumer";case V:return(a._context.displayName||"Context")+".Provider";case G:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case X:return l=a.displayName||null,l!==null?l:ne(a.type)||"Memo";case K:l=a._payload,a=a._init;try{return ne(a(l))}catch{}}return null}function ye(a){var l=a.type;switch(a.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=l.render,a=a.displayName||a.name||"",l.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(l);case 8:return l===S?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function be(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Ne(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function et(a){var l=Ne(a)?"checked":"value",f=Object.getOwnPropertyDescriptor(a.constructor.prototype,l),g=""+a[l];if(!a.hasOwnProperty(l)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,E=f.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return x.call(this)},set:function(D){g=""+D,E.call(this,D)}}),Object.defineProperty(a,l,{enumerable:f.enumerable}),{getValue:function(){return g},setValue:function(D){g=""+D},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function xt(a){a._valueTracker||(a._valueTracker=et(a))}function pn(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var f=l.getValue(),g="";return a&&(g=Ne(a)?a.checked?"true":"false":a.value),a=g,a!==f?(l.setValue(a),!0):!1}function ht(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Ft(a,l){var f=l.checked;return Z({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:f??a._wrapperState.initialChecked})}function nn(a,l){var f=l.defaultValue==null?"":l.defaultValue,g=l.checked!=null?l.checked:l.defaultChecked;f=be(l.value!=null?l.value:f),a._wrapperState={initialChecked:g,initialValue:f,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function Dt(a,l){l=l.checked,l!=null&&A(a,"checked",l,!1)}function an(a,l){Dt(a,l);var f=be(l.value),g=l.type;if(f!=null)g==="number"?(f===0&&a.value===""||a.value!=f)&&(a.value=""+f):a.value!==""+f&&(a.value=""+f);else if(g==="submit"||g==="reset"){a.removeAttribute("value");return}l.hasOwnProperty("value")?Sn(a,l.type,f):l.hasOwnProperty("defaultValue")&&Sn(a,l.type,be(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(a.defaultChecked=!!l.defaultChecked)}function ee(a,l,f){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var g=l.type;if(!(g!=="submit"&&g!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+a._wrapperState.initialValue,f||l===a.value||(a.value=l),a.defaultValue=l}f=a.name,f!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,f!==""&&(a.name=f)}function Sn(a,l,f){(l!=="number"||ht(a.ownerDocument)!==a)&&(f==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+f&&(a.defaultValue=""+f))}var At=Array.isArray;function Lt(a,l,f,g){if(a=a.options,l){l={};for(var x=0;x<f.length;x++)l["$"+f[x]]=!0;for(f=0;f<a.length;f++)x=l.hasOwnProperty("$"+a[f].value),a[f].selected!==x&&(a[f].selected=x),x&&g&&(a[f].defaultSelected=!0)}else{for(f=""+be(f),l=null,x=0;x<a.length;x++){if(a[x].value===f){a[x].selected=!0,g&&(a[x].defaultSelected=!0);return}l!==null||a[x].disabled||(l=a[x])}l!==null&&(l.selected=!0)}}function it(a,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return Z({},l,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function B(a,l){var f=l.value;if(f==null){if(f=l.children,l=l.defaultValue,f!=null){if(l!=null)throw Error(n(92));if(At(f)){if(1<f.length)throw Error(n(93));f=f[0]}l=f}l==null&&(l=""),f=l}a._wrapperState={initialValue:be(f)}}function R(a,l){var f=be(l.value),g=be(l.defaultValue);f!=null&&(f=""+f,f!==a.value&&(a.value=f),l.defaultValue==null&&a.defaultValue!==f&&(a.defaultValue=f)),g!=null&&(a.defaultValue=""+g)}function se(a){var l=a.textContent;l===a._wrapperState.initialValue&&l!==""&&l!==null&&(a.value=l)}function xe(a){switch(a){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function we(a,l){return a==null||a==="http://www.w3.org/1999/xhtml"?xe(l):a==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var ve,Ke=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,f,g,x){MSApp.execUnsafeLocalFunction(function(){return a(l,f,g,x)})}:a})(function(a,l){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=l;else{for(ve=ve||document.createElement("div"),ve.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=ve.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}});function ke(a,l){if(l){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=l;return}}a.textContent=l}var pt={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},Pt=["Webkit","ms","Moz","O"];Object.keys(pt).forEach(function(a){Pt.forEach(function(l){l=l+a.charAt(0).toUpperCase()+a.substring(1),pt[l]=pt[a]})});function Pe(a,l,f){return l==null||typeof l=="boolean"||l===""?"":f||typeof l!="number"||l===0||pt.hasOwnProperty(a)&&pt[a]?(""+l).trim():l+"px"}function Oe(a,l){a=a.style;for(var f in l)if(l.hasOwnProperty(f)){var g=f.indexOf("--")===0,x=Pe(f,l[f],g);f==="float"&&(f="cssFloat"),g?a.setProperty(f,x):a[f]=x}}var Ze=Z({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 rt(a,l){if(l){if(Ze[a]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function $e(a,l){if(a.indexOf("-")===-1)return typeof l.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ht=null;function re(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Ve=null,Le=null,Xe=null;function Re(a){if(a=xc(a)){if(typeof Ve!="function")throw Error(n(280));var l=a.stateNode;l&&(l=td(l),Ve(a.stateNode,a.type,l))}}function _e(a){Le?Xe?Xe.push(a):Xe=[a]:Le=a}function st(){if(Le){var a=Le,l=Xe;if(Xe=Le=null,Re(a),l)for(a=0;a<l.length;a++)Re(l[a])}}function Nt(a,l){return a(l)}function mn(){}var Kt=!1;function ui(a,l,f){if(Kt)return a(l,f);Kt=!0;try{return Nt(a,l,f)}finally{Kt=!1,(Le!==null||Xe!==null)&&(mn(),st())}}function ri(a,l){var f=a.stateNode;if(f===null)return null;var g=td(f);if(g===null)return null;f=g[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(a=a.type,g=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!g;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(n(231,l,typeof f));return f}var Xs=!1;if(c)try{var Sr={};Object.defineProperty(Sr,"passive",{get:function(){Xs=!0}}),window.addEventListener("test",Sr,Sr),window.removeEventListener("test",Sr,Sr)}catch{Xs=!1}function Y(a,l,f,g,x,E,D,$,te){var ge=Array.prototype.slice.call(arguments,3);try{l.apply(f,ge)}catch(Ce){this.onError(Ce)}}var le=!1,he=null,Me=!1,Ie=null,vt={onError:function(a){le=!0,he=a}};function tt(a,l,f,g,x,E,D,$,te){le=!1,he=null,Y.apply(vt,arguments)}function yt(a,l,f,g,x,E,D,$,te){if(tt.apply(this,arguments),le){if(le){var ge=he;le=!1,he=null}else throw Error(n(198));Me||(Me=!0,Ie=ge)}}function Qe(a){var l=a,f=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(f=l.return),a=l.return;while(a)}return l.tag===3?f:null}function Et(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function Tt(a){if(Qe(a)!==a)throw Error(n(188))}function bt(a){var l=a.alternate;if(!l){if(l=Qe(a),l===null)throw Error(n(188));return l!==a?null:a}for(var f=a,g=l;;){var x=f.return;if(x===null)break;var E=x.alternate;if(E===null){if(g=x.return,g!==null){f=g;continue}break}if(x.child===E.child){for(E=x.child;E;){if(E===f)return Tt(x),a;if(E===g)return Tt(x),l;E=E.sibling}throw Error(n(188))}if(f.return!==g.return)f=x,g=E;else{for(var D=!1,$=x.child;$;){if($===f){D=!0,f=x,g=E;break}if($===g){D=!0,g=x,f=E;break}$=$.sibling}if(!D){for($=E.child;$;){if($===f){D=!0,f=E,g=x;break}if($===g){D=!0,g=E,f=x;break}$=$.sibling}if(!D)throw Error(n(189))}}if(f.alternate!==g)throw Error(n(190))}if(f.tag!==3)throw Error(n(188));return f.stateNode.current===f?a:l}function un(a){return a=bt(a),a!==null?en(a):null}function en(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var l=en(a);if(l!==null)return l;a=a.sibling}return null}var En=e.unstable_scheduleCallback,In=e.unstable_cancelCallback,Zn=e.unstable_shouldYield,gn=e.unstable_requestPaint,N=e.unstable_now,oe=e.unstable_getCurrentPriorityLevel,pe=e.unstable_ImmediatePriority,de=e.unstable_UserBlockingPriority,ce=e.unstable_NormalPriority,je=e.unstable_LowPriority,qe=e.unstable_IdlePriority,Ge=null,We=null;function ct(a){if(We&&typeof We.onCommitFiberRoot=="function")try{We.onCommitFiberRoot(Ge,a,void 0,(a.current.flags&128)===128)}catch{}}var He=Math.clz32?Math.clz32:Zt,Mt=Math.log,lt=Math.LN2;function Zt(a){return a>>>=0,a===0?32:31-(Mt(a)/lt|0)|0}var It=64,vn=4194304;function tn(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Un(a,l){var f=a.pendingLanes;if(f===0)return 0;var g=0,x=a.suspendedLanes,E=a.pingedLanes,D=f&268435455;if(D!==0){var $=D&~x;$!==0?g=tn($):(E&=D,E!==0&&(g=tn(E)))}else D=f&~x,D!==0?g=tn(D):E!==0&&(g=tn(E));if(g===0)return 0;if(l!==0&&l!==g&&(l&x)===0&&(x=g&-g,E=l&-l,x>=E||x===16&&(E&4194240)!==0))return l;if((g&4)!==0&&(g|=f&16),l=a.entangledLanes,l!==0)for(a=a.entanglements,l&=g;0<l;)f=31-He(l),x=1<<f,g|=a[f],l&=~x;return g}function _t(a,l){switch(a){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mi(a,l){for(var f=a.suspendedLanes,g=a.pingedLanes,x=a.expirationTimes,E=a.pendingLanes;0<E;){var D=31-He(E),$=1<<D,te=x[D];te===-1?(($&f)===0||($&g)!==0)&&(x[D]=_t($,l)):te<=l&&(a.expiredLanes|=$),E&=~$}}function rn(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function Ni(){var a=It;return It<<=1,(It&4194240)===0&&(It=64),a}function Ii(a){for(var l=[],f=0;31>f;f++)l.push(a);return l}function ji(a,l,f){a.pendingLanes|=l,l!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,l=31-He(l),a[l]=f}function qs(a,l){var f=a.pendingLanes&~l;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=l,a.mutableReadLanes&=l,a.entangledLanes&=l,l=a.entanglements;var g=a.eventTimes;for(a=a.expirationTimes;0<f;){var x=31-He(f),E=1<<x;l[x]=0,g[x]=-1,a[x]=-1,f&=~E}}function xn(a,l){var f=a.entangledLanes|=l;for(a=a.entanglements;f;){var g=31-He(f),x=1<<g;x&l|a[g]&l&&(a[g]|=l),f&=~x}}var Ot=0;function wr(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var Hn,tr,vs,ic,l_,Xh=!1,zu=[],Ys=null,Ks=null,Zs=null,rc=new Map,sc=new Map,Js=[],BP="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function c_(a,l){switch(a){case"focusin":case"focusout":Ys=null;break;case"dragenter":case"dragleave":Ks=null;break;case"mouseover":case"mouseout":Zs=null;break;case"pointerover":case"pointerout":rc.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":sc.delete(l.pointerId)}}function ac(a,l,f,g,x,E){return a===null||a.nativeEvent!==E?(a={blockedOn:l,domEventName:f,eventSystemFlags:g,nativeEvent:E,targetContainers:[x]},l!==null&&(l=xc(l),l!==null&&tr(l)),a):(a.eventSystemFlags|=g,l=a.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),a)}function zP(a,l,f,g,x){switch(l){case"focusin":return Ys=ac(Ys,a,l,f,g,x),!0;case"dragenter":return Ks=ac(Ks,a,l,f,g,x),!0;case"mouseover":return Zs=ac(Zs,a,l,f,g,x),!0;case"pointerover":var E=x.pointerId;return rc.set(E,ac(rc.get(E)||null,a,l,f,g,x)),!0;case"gotpointercapture":return E=x.pointerId,sc.set(E,ac(sc.get(E)||null,a,l,f,g,x)),!0}return!1}function u_(a){var l=Ba(a.target);if(l!==null){var f=Qe(l);if(f!==null){if(l=f.tag,l===13){if(l=Et(f),l!==null){a.blockedOn=l,l_(a.priority,function(){vs(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Vu(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var f=Yh(a.domEventName,a.eventSystemFlags,l[0],a.nativeEvent);if(f===null){f=a.nativeEvent;var g=new f.constructor(f.type,f);Ht=g,f.target.dispatchEvent(g),Ht=null}else return l=xc(f),l!==null&&tr(l),a.blockedOn=f,!1;l.shift()}return!0}function d_(a,l,f){Vu(a)&&f.delete(l)}function VP(){Xh=!1,Ys!==null&&Vu(Ys)&&(Ys=null),Ks!==null&&Vu(Ks)&&(Ks=null),Zs!==null&&Vu(Zs)&&(Zs=null),rc.forEach(d_),sc.forEach(d_)}function oc(a,l){a.blockedOn===l&&(a.blockedOn=null,Xh||(Xh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,VP)))}function lc(a){function l(x){return oc(x,a)}if(0<zu.length){oc(zu[0],a);for(var f=1;f<zu.length;f++){var g=zu[f];g.blockedOn===a&&(g.blockedOn=null)}}for(Ys!==null&&oc(Ys,a),Ks!==null&&oc(Ks,a),Zs!==null&&oc(Zs,a),rc.forEach(l),sc.forEach(l),f=0;f<Js.length;f++)g=Js[f],g.blockedOn===a&&(g.blockedOn=null);for(;0<Js.length&&(f=Js[0],f.blockedOn===null);)u_(f),f.blockedOn===null&&Js.shift()}var Uo=M.ReactCurrentBatchConfig,Hu=!0;function HP(a,l,f,g){var x=Ot,E=Uo.transition;Uo.transition=null;try{Ot=1,qh(a,l,f,g)}finally{Ot=x,Uo.transition=E}}function GP(a,l,f,g){var x=Ot,E=Uo.transition;Uo.transition=null;try{Ot=4,qh(a,l,f,g)}finally{Ot=x,Uo.transition=E}}function qh(a,l,f,g){if(Hu){var x=Yh(a,l,f,g);if(x===null)fp(a,l,g,Gu,f),c_(a,g);else if(zP(x,a,l,f,g))g.stopPropagation();else if(c_(a,g),l&4&&-1<BP.indexOf(a)){for(;x!==null;){var E=xc(x);if(E!==null&&Hn(E),E=Yh(a,l,f,g),E===null&&fp(a,l,g,Gu,f),E===x)break;x=E}x!==null&&g.stopPropagation()}else fp(a,l,g,null,f)}}var Gu=null;function Yh(a,l,f,g){if(Gu=null,a=re(g),a=Ba(a),a!==null)if(l=Qe(a),l===null)a=null;else if(f=l.tag,f===13){if(a=Et(l),a!==null)return a;a=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null);return Gu=a,null}function f_(a){switch(a){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(oe()){case pe:return 1;case de:return 4;case ce:case je:return 16;case qe:return 536870912;default:return 16}default:return 16}}var Qs=null,Kh=null,ju=null;function h_(){if(ju)return ju;var a,l=Kh,f=l.length,g,x="value"in Qs?Qs.value:Qs.textContent,E=x.length;for(a=0;a<f&&l[a]===x[a];a++);var D=f-a;for(g=1;g<=D&&l[f-g]===x[E-g];g++);return ju=x.slice(a,1<g?1-g:void 0)}function Wu(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function $u(){return!0}function p_(){return!1}function Wi(a){function l(f,g,x,E,D){this._reactName=f,this._targetInst=x,this.type=g,this.nativeEvent=E,this.target=D,this.currentTarget=null;for(var $ in a)a.hasOwnProperty($)&&(f=a[$],this[$]=f?f(E):E[$]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?$u:p_,this.isPropagationStopped=p_,this}return Z(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=$u)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=$u)},persist:function(){},isPersistent:$u}),l}var Fo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zh=Wi(Fo),cc=Z({},Fo,{view:0,detail:0}),jP=Wi(cc),Jh,Qh,uc,Xu=Z({},cc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tp,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==uc&&(uc&&a.type==="mousemove"?(Jh=a.screenX-uc.screenX,Qh=a.screenY-uc.screenY):Qh=Jh=0,uc=a),Jh)},movementY:function(a){return"movementY"in a?a.movementY:Qh}}),m_=Wi(Xu),WP=Z({},Xu,{dataTransfer:0}),$P=Wi(WP),XP=Z({},cc,{relatedTarget:0}),ep=Wi(XP),qP=Z({},Fo,{animationName:0,elapsedTime:0,pseudoElement:0}),YP=Wi(qP),KP=Z({},Fo,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),ZP=Wi(KP),JP=Z({},Fo,{data:0}),g_=Wi(JP),QP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},tR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nR(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=tR[a])?!!l[a]:!1}function tp(){return nR}var iR=Z({},cc,{key:function(a){if(a.key){var l=QP[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=Wu(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?eR[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tp,charCode:function(a){return a.type==="keypress"?Wu(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?Wu(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),rR=Wi(iR),sR=Z({},Xu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),v_=Wi(sR),aR=Z({},cc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tp}),oR=Wi(aR),lR=Z({},Fo,{propertyName:0,elapsedTime:0,pseudoElement:0}),cR=Wi(lR),uR=Z({},Xu,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),dR=Wi(uR),fR=[9,13,27,32],np=c&&"CompositionEvent"in window,dc=null;c&&"documentMode"in document&&(dc=document.documentMode);var hR=c&&"TextEvent"in window&&!dc,y_=c&&(!np||dc&&8<dc&&11>=dc),__=" ",x_=!1;function b_(a,l){switch(a){case"keyup":return fR.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S_(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Oo=!1;function pR(a,l){switch(a){case"compositionend":return S_(l);case"keypress":return l.which!==32?null:(x_=!0,__);case"textInput":return a=l.data,a===__&&x_?null:a;default:return null}}function mR(a,l){if(Oo)return a==="compositionend"||!np&&b_(a,l)?(a=h_(),ju=Kh=Qs=null,Oo=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return y_&&l.locale!=="ko"?null:l.data;default:return null}}var gR={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function w_(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!gR[a.type]:l==="textarea"}function E_(a,l,f,g){_e(g),l=Ju(l,"onChange"),0<l.length&&(f=new Zh("onChange","change",null,f,g),a.push({event:f,listeners:l}))}var fc=null,hc=null;function vR(a){H_(a,0)}function qu(a){var l=Go(a);if(pn(l))return a}function yR(a,l){if(a==="change")return l}var M_=!1;if(c){var ip;if(c){var rp="oninput"in document;if(!rp){var T_=document.createElement("div");T_.setAttribute("oninput","return;"),rp=typeof T_.oninput=="function"}ip=rp}else ip=!1;M_=ip&&(!document.documentMode||9<document.documentMode)}function A_(){fc&&(fc.detachEvent("onpropertychange",C_),hc=fc=null)}function C_(a){if(a.propertyName==="value"&&qu(hc)){var l=[];E_(l,hc,a,re(a)),ui(vR,l)}}function _R(a,l,f){a==="focusin"?(A_(),fc=l,hc=f,fc.attachEvent("onpropertychange",C_)):a==="focusout"&&A_()}function xR(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return qu(hc)}function bR(a,l){if(a==="click")return qu(l)}function SR(a,l){if(a==="input"||a==="change")return qu(l)}function wR(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Er=typeof Object.is=="function"?Object.is:wR;function pc(a,l){if(Er(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var f=Object.keys(a),g=Object.keys(l);if(f.length!==g.length)return!1;for(g=0;g<f.length;g++){var x=f[g];if(!u.call(l,x)||!Er(a[x],l[x]))return!1}return!0}function P_(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function R_(a,l){var f=P_(a);a=0;for(var g;f;){if(f.nodeType===3){if(g=a+f.textContent.length,a<=l&&g>=l)return{node:f,offset:l-a};a=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=P_(f)}}function k_(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?k_(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function L_(){for(var a=window,l=ht();l instanceof a.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)a=l.contentWindow;else break;l=ht(a.document)}return l}function sp(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}function ER(a){var l=L_(),f=a.focusedElem,g=a.selectionRange;if(l!==f&&f&&f.ownerDocument&&k_(f.ownerDocument.documentElement,f)){if(g!==null&&sp(f)){if(l=g.start,a=g.end,a===void 0&&(a=l),"selectionStart"in f)f.selectionStart=l,f.selectionEnd=Math.min(a,f.value.length);else if(a=(l=f.ownerDocument||document)&&l.defaultView||window,a.getSelection){a=a.getSelection();var x=f.textContent.length,E=Math.min(g.start,x);g=g.end===void 0?E:Math.min(g.end,x),!a.extend&&E>g&&(x=g,g=E,E=x),x=R_(f,E);var D=R_(f,g);x&&D&&(a.rangeCount!==1||a.anchorNode!==x.node||a.anchorOffset!==x.offset||a.focusNode!==D.node||a.focusOffset!==D.offset)&&(l=l.createRange(),l.setStart(x.node,x.offset),a.removeAllRanges(),E>g?(a.addRange(l),a.extend(D.node,D.offset)):(l.setEnd(D.node,D.offset),a.addRange(l)))}}for(l=[],a=f;a=a.parentNode;)a.nodeType===1&&l.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<l.length;f++)a=l[f],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var MR=c&&"documentMode"in document&&11>=document.documentMode,Bo=null,ap=null,mc=null,op=!1;function D_(a,l,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;op||Bo==null||Bo!==ht(g)||(g=Bo,"selectionStart"in g&&sp(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),mc&&pc(mc,g)||(mc=g,g=Ju(ap,"onSelect"),0<g.length&&(l=new Zh("onSelect","select",null,l,f),a.push({event:l,listeners:g}),l.target=Bo)))}function Yu(a,l){var f={};return f[a.toLowerCase()]=l.toLowerCase(),f["Webkit"+a]="webkit"+l,f["Moz"+a]="moz"+l,f}var zo={animationend:Yu("Animation","AnimationEnd"),animationiteration:Yu("Animation","AnimationIteration"),animationstart:Yu("Animation","AnimationStart"),transitionend:Yu("Transition","TransitionEnd")},lp={},N_={};c&&(N_=document.createElement("div").style,"AnimationEvent"in window||(delete zo.animationend.animation,delete zo.animationiteration.animation,delete zo.animationstart.animation),"TransitionEvent"in window||delete zo.transitionend.transition);function Ku(a){if(lp[a])return lp[a];if(!zo[a])return a;var l=zo[a],f;for(f in l)if(l.hasOwnProperty(f)&&f in N_)return lp[a]=l[f];return a}var I_=Ku("animationend"),U_=Ku("animationiteration"),F_=Ku("animationstart"),O_=Ku("transitionend"),B_=new Map,z_="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ea(a,l){B_.set(a,l),s(l,[a])}for(var cp=0;cp<z_.length;cp++){var up=z_[cp],TR=up.toLowerCase(),AR=up[0].toUpperCase()+up.slice(1);ea(TR,"on"+AR)}ea(I_,"onAnimationEnd"),ea(U_,"onAnimationIteration"),ea(F_,"onAnimationStart"),ea("dblclick","onDoubleClick"),ea("focusin","onFocus"),ea("focusout","onBlur"),ea(O_,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),CR=new Set("cancel close invalid load scroll toggle".split(" ").concat(gc));function V_(a,l,f){var g=a.type||"unknown-event";a.currentTarget=f,yt(g,l,void 0,a),a.currentTarget=null}function H_(a,l){l=(l&4)!==0;for(var f=0;f<a.length;f++){var g=a[f],x=g.event;g=g.listeners;e:{var E=void 0;if(l)for(var D=g.length-1;0<=D;D--){var $=g[D],te=$.instance,ge=$.currentTarget;if($=$.listener,te!==E&&x.isPropagationStopped())break e;V_(x,$,ge),E=te}else for(D=0;D<g.length;D++){if($=g[D],te=$.instance,ge=$.currentTarget,$=$.listener,te!==E&&x.isPropagationStopped())break e;V_(x,$,ge),E=te}}}if(Me)throw a=Ie,Me=!1,Ie=null,a}function Pn(a,l){var f=l[yp];f===void 0&&(f=l[yp]=new Set);var g=a+"__bubble";f.has(g)||(G_(l,a,2,!1),f.add(g))}function dp(a,l,f){var g=0;l&&(g|=4),G_(f,a,g,l)}var Zu="_reactListening"+Math.random().toString(36).slice(2);function vc(a){if(!a[Zu]){a[Zu]=!0,i.forEach(function(f){f!=="selectionchange"&&(CR.has(f)||dp(f,!1,a),dp(f,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[Zu]||(l[Zu]=!0,dp("selectionchange",!1,l))}}function G_(a,l,f,g){switch(f_(l)){case 1:var x=HP;break;case 4:x=GP;break;default:x=qh}f=x.bind(null,l,f,a),x=void 0,!Xs||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),g?x!==void 0?a.addEventListener(l,f,{capture:!0,passive:x}):a.addEventListener(l,f,!0):x!==void 0?a.addEventListener(l,f,{passive:x}):a.addEventListener(l,f,!1)}function fp(a,l,f,g,x){var E=g;if((l&1)===0&&(l&2)===0&&g!==null)e:for(;;){if(g===null)return;var D=g.tag;if(D===3||D===4){var $=g.stateNode.containerInfo;if($===x||$.nodeType===8&&$.parentNode===x)break;if(D===4)for(D=g.return;D!==null;){var te=D.tag;if((te===3||te===4)&&(te=D.stateNode.containerInfo,te===x||te.nodeType===8&&te.parentNode===x))return;D=D.return}for(;$!==null;){if(D=Ba($),D===null)return;if(te=D.tag,te===5||te===6){g=E=D;continue e}$=$.parentNode}}g=g.return}ui(function(){var ge=E,Ce=re(f),De=[];e:{var Ae=B_.get(a);if(Ae!==void 0){var nt=Zh,ut=a;switch(a){case"keypress":if(Wu(f)===0)break e;case"keydown":case"keyup":nt=rR;break;case"focusin":ut="focus",nt=ep;break;case"focusout":ut="blur",nt=ep;break;case"beforeblur":case"afterblur":nt=ep;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":nt=m_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":nt=$P;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":nt=oR;break;case I_:case U_:case F_:nt=YP;break;case O_:nt=cR;break;case"scroll":nt=jP;break;case"wheel":nt=dR;break;case"copy":case"cut":case"paste":nt=ZP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":nt=v_}var gt=(l&4)!==0,Gn=!gt&&a==="scroll",ue=gt?Ae!==null?Ae+"Capture":null:Ae;gt=[];for(var ae=ge,fe;ae!==null;){fe=ae;var Be=fe.stateNode;if(fe.tag===5&&Be!==null&&(fe=Be,ue!==null&&(Be=ri(ae,ue),Be!=null&>.push(yc(ae,Be,fe)))),Gn)break;ae=ae.return}0<gt.length&&(Ae=new nt(Ae,ut,null,f,Ce),De.push({event:Ae,listeners:gt}))}}if((l&7)===0){e:{if(Ae=a==="mouseover"||a==="pointerover",nt=a==="mouseout"||a==="pointerout",Ae&&f!==Ht&&(ut=f.relatedTarget||f.fromElement)&&(Ba(ut)||ut[ys]))break e;if((nt||Ae)&&(Ae=Ce.window===Ce?Ce:(Ae=Ce.ownerDocument)?Ae.defaultView||Ae.parentWindow:window,nt?(ut=f.relatedTarget||f.toElement,nt=ge,ut=ut?Ba(ut):null,ut!==null&&(Gn=Qe(ut),ut!==Gn||ut.tag!==5&&ut.tag!==6)&&(ut=null)):(nt=null,ut=ge),nt!==ut)){if(gt=m_,Be="onMouseLeave",ue="onMouseEnter",ae="mouse",(a==="pointerout"||a==="pointerover")&&(gt=v_,Be="onPointerLeave",ue="onPointerEnter",ae="pointer"),Gn=nt==null?Ae:Go(nt),fe=ut==null?Ae:Go(ut),Ae=new gt(Be,ae+"leave",nt,f,Ce),Ae.target=Gn,Ae.relatedTarget=fe,Be=null,Ba(Ce)===ge&&(gt=new gt(ue,ae+"enter",ut,f,Ce),gt.target=fe,gt.relatedTarget=Gn,Be=gt),Gn=Be,nt&&ut)t:{for(gt=nt,ue=ut,ae=0,fe=gt;fe;fe=Vo(fe))ae++;for(fe=0,Be=ue;Be;Be=Vo(Be))fe++;for(;0<ae-fe;)gt=Vo(gt),ae--;for(;0<fe-ae;)ue=Vo(ue),fe--;for(;ae--;){if(gt===ue||ue!==null&>===ue.alternate)break t;gt=Vo(gt),ue=Vo(ue)}gt=null}else gt=null;nt!==null&&j_(De,Ae,nt,gt,!1),ut!==null&&Gn!==null&&j_(De,Gn,ut,gt,!0)}}e:{if(Ae=ge?Go(ge):window,nt=Ae.nodeName&&Ae.nodeName.toLowerCase(),nt==="select"||nt==="input"&&Ae.type==="file")var St=yR;else if(w_(Ae))if(M_)St=SR;else{St=xR;var Rt=_R}else(nt=Ae.nodeName)&&nt.toLowerCase()==="input"&&(Ae.type==="checkbox"||Ae.type==="radio")&&(St=bR);if(St&&(St=St(a,ge))){E_(De,St,f,Ce);break e}Rt&&Rt(a,Ae,ge),a==="focusout"&&(Rt=Ae._wrapperState)&&Rt.controlled&&Ae.type==="number"&&Sn(Ae,"number",Ae.value)}switch(Rt=ge?Go(ge):window,a){case"focusin":(w_(Rt)||Rt.contentEditable==="true")&&(Bo=Rt,ap=ge,mc=null);break;case"focusout":mc=ap=Bo=null;break;case"mousedown":op=!0;break;case"contextmenu":case"mouseup":case"dragend":op=!1,D_(De,f,Ce);break;case"selectionchange":if(MR)break;case"keydown":case"keyup":D_(De,f,Ce)}var kt;if(np)e:{switch(a){case"compositionstart":var Bt="onCompositionStart";break e;case"compositionend":Bt="onCompositionEnd";break e;case"compositionupdate":Bt="onCompositionUpdate";break e}Bt=void 0}else Oo?b_(a,f)&&(Bt="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(Bt="onCompositionStart");Bt&&(y_&&f.locale!=="ko"&&(Oo||Bt!=="onCompositionStart"?Bt==="onCompositionEnd"&&Oo&&(kt=h_()):(Qs=Ce,Kh="value"in Qs?Qs.value:Qs.textContent,Oo=!0)),Rt=Ju(ge,Bt),0<Rt.length&&(Bt=new g_(Bt,a,null,f,Ce),De.push({event:Bt,listeners:Rt}),kt?Bt.data=kt:(kt=S_(f),kt!==null&&(Bt.data=kt)))),(kt=hR?pR(a,f):mR(a,f))&&(ge=Ju(ge,"onBeforeInput"),0<ge.length&&(Ce=new g_("onBeforeInput","beforeinput",null,f,Ce),De.push({event:Ce,listeners:ge}),Ce.data=kt))}H_(De,l)})}function yc(a,l,f){return{instance:a,listener:l,currentTarget:f}}function Ju(a,l){for(var f=l+"Capture",g=[];a!==null;){var x=a,E=x.stateNode;x.tag===5&&E!==null&&(x=E,E=ri(a,f),E!=null&&g.unshift(yc(a,E,x)),E=ri(a,l),E!=null&&g.push(yc(a,E,x))),a=a.return}return g}function Vo(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function j_(a,l,f,g,x){for(var E=l._reactName,D=[];f!==null&&f!==g;){var $=f,te=$.alternate,ge=$.stateNode;if(te!==null&&te===g)break;$.tag===5&&ge!==null&&($=ge,x?(te=ri(f,E),te!=null&&D.unshift(yc(f,te,$))):x||(te=ri(f,E),te!=null&&D.push(yc(f,te,$)))),f=f.return}D.length!==0&&a.push({event:l,listeners:D})}var PR=/\r\n?/g,RR=/\u0000|\uFFFD/g;function W_(a){return(typeof a=="string"?a:""+a).replace(PR,`
|
|
7
|
-
`).replace(RR,"")}function Qu(a,l,f){if(l=W_(l),W_(a)!==l&&f)throw Error(n(425))}function ed(){}var hp=null,pp=null;function mp(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var gp=typeof setTimeout=="function"?setTimeout:void 0,kR=typeof clearTimeout=="function"?clearTimeout:void 0,$_=typeof Promise=="function"?Promise:void 0,LR=typeof queueMicrotask=="function"?queueMicrotask:typeof $_<"u"?function(a){return $_.resolve(null).then(a).catch(DR)}:gp;function DR(a){setTimeout(function(){throw a})}function vp(a,l){var f=l,g=0;do{var x=f.nextSibling;if(a.removeChild(f),x&&x.nodeType===8)if(f=x.data,f==="/$"){if(g===0){a.removeChild(x),lc(l);return}g--}else f!=="$"&&f!=="$?"&&f!=="$!"||g++;f=x}while(f);lc(l)}function ta(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return a}function X_(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"){if(l===0)return a;l--}else f==="/$"&&l++}a=a.previousSibling}return null}var Ho=Math.random().toString(36).slice(2),Hr="__reactFiber$"+Ho,_c="__reactProps$"+Ho,ys="__reactContainer$"+Ho,yp="__reactEvents$"+Ho,NR="__reactListeners$"+Ho,IR="__reactHandles$"+Ho;function Ba(a){var l=a[Hr];if(l)return l;for(var f=a.parentNode;f;){if(l=f[ys]||f[Hr]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(a=X_(a);a!==null;){if(f=a[Hr])return f;a=X_(a)}return l}a=f,f=a.parentNode}return null}function xc(a){return a=a[Hr]||a[ys],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function Go(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(n(33))}function td(a){return a[_c]||null}var _p=[],jo=-1;function na(a){return{current:a}}function Rn(a){0>jo||(a.current=_p[jo],_p[jo]=null,jo--)}function Cn(a,l){jo++,_p[jo]=a.current,a.current=l}var ia={},gi=na(ia),Ui=na(!1),za=ia;function Wo(a,l){var f=a.type.contextTypes;if(!f)return ia;var g=a.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===l)return g.__reactInternalMemoizedMaskedChildContext;var x={},E;for(E in f)x[E]=l[E];return g&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=l,a.__reactInternalMemoizedMaskedChildContext=x),x}function Fi(a){return a=a.childContextTypes,a!=null}function nd(){Rn(Ui),Rn(gi)}function q_(a,l,f){if(gi.current!==ia)throw Error(n(168));Cn(gi,l),Cn(Ui,f)}function Y_(a,l,f){var g=a.stateNode;if(l=l.childContextTypes,typeof g.getChildContext!="function")return f;g=g.getChildContext();for(var x in g)if(!(x in l))throw Error(n(108,ye(a)||"Unknown",x));return Z({},f,g)}function id(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||ia,za=gi.current,Cn(gi,a),Cn(Ui,Ui.current),!0}function K_(a,l,f){var g=a.stateNode;if(!g)throw Error(n(169));f?(a=Y_(a,l,za),g.__reactInternalMemoizedMergedChildContext=a,Rn(Ui),Rn(gi),Cn(gi,a)):Rn(Ui),Cn(Ui,f)}var _s=null,rd=!1,xp=!1;function Z_(a){_s===null?_s=[a]:_s.push(a)}function UR(a){rd=!0,Z_(a)}function ra(){if(!xp&&_s!==null){xp=!0;var a=0,l=Ot;try{var f=_s;for(Ot=1;a<f.length;a++){var g=f[a];do g=g(!0);while(g!==null)}_s=null,rd=!1}catch(x){throw _s!==null&&(_s=_s.slice(a+1)),En(pe,ra),x}finally{Ot=l,xp=!1}}return null}var $o=[],Xo=0,sd=null,ad=0,nr=[],ir=0,Va=null,xs=1,bs="";function Ha(a,l){$o[Xo++]=ad,$o[Xo++]=sd,sd=a,ad=l}function J_(a,l,f){nr[ir++]=xs,nr[ir++]=bs,nr[ir++]=Va,Va=a;var g=xs;a=bs;var x=32-He(g)-1;g&=~(1<<x),f+=1;var E=32-He(l)+x;if(30<E){var D=x-x%5;E=(g&(1<<D)-1).toString(32),g>>=D,x-=D,xs=1<<32-He(l)+x|f<<x|g,bs=E+a}else xs=1<<E|f<<x|g,bs=a}function bp(a){a.return!==null&&(Ha(a,1),J_(a,1,0))}function Sp(a){for(;a===sd;)sd=$o[--Xo],$o[Xo]=null,ad=$o[--Xo],$o[Xo]=null;for(;a===Va;)Va=nr[--ir],nr[ir]=null,bs=nr[--ir],nr[ir]=null,xs=nr[--ir],nr[ir]=null}var $i=null,Xi=null,Dn=!1,Mr=null;function Q_(a,l){var f=or(5,null,null,0);f.elementType="DELETED",f.stateNode=l,f.return=a,l=a.deletions,l===null?(a.deletions=[f],a.flags|=16):l.push(f)}function ex(a,l){switch(a.tag){case 5:var f=a.type;return l=l.nodeType!==1||f.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(a.stateNode=l,$i=a,Xi=ta(l.firstChild),!0):!1;case 6:return l=a.pendingProps===""||l.nodeType!==3?null:l,l!==null?(a.stateNode=l,$i=a,Xi=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(f=Va!==null?{id:xs,overflow:bs}:null,a.memoizedState={dehydrated:l,treeContext:f,retryLane:1073741824},f=or(18,null,null,0),f.stateNode=l,f.return=a,a.child=f,$i=a,Xi=null,!0):!1;default:return!1}}function wp(a){return(a.mode&1)!==0&&(a.flags&128)===0}function Ep(a){if(Dn){var l=Xi;if(l){var f=l;if(!ex(a,l)){if(wp(a))throw Error(n(418));l=ta(f.nextSibling);var g=$i;l&&ex(a,l)?Q_(g,f):(a.flags=a.flags&-4097|2,Dn=!1,$i=a)}}else{if(wp(a))throw Error(n(418));a.flags=a.flags&-4097|2,Dn=!1,$i=a}}}function tx(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;$i=a}function od(a){if(a!==$i)return!1;if(!Dn)return tx(a),Dn=!0,!1;var l;if((l=a.tag!==3)&&!(l=a.tag!==5)&&(l=a.type,l=l!=="head"&&l!=="body"&&!mp(a.type,a.memoizedProps)),l&&(l=Xi)){if(wp(a))throw nx(),Error(n(418));for(;l;)Q_(a,l),l=ta(l.nextSibling)}if(tx(a),a.tag===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));e:{for(a=a.nextSibling,l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"){if(l===0){Xi=ta(a.nextSibling);break e}l--}else f!=="$"&&f!=="$!"&&f!=="$?"||l++}a=a.nextSibling}Xi=null}}else Xi=$i?ta(a.stateNode.nextSibling):null;return!0}function nx(){for(var a=Xi;a;)a=ta(a.nextSibling)}function qo(){Xi=$i=null,Dn=!1}function Mp(a){Mr===null?Mr=[a]:Mr.push(a)}var FR=M.ReactCurrentBatchConfig;function bc(a,l,f){if(a=f.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(f._owner){if(f=f._owner,f){if(f.tag!==1)throw Error(n(309));var g=f.stateNode}if(!g)throw Error(n(147,a));var x=g,E=""+a;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===E?l.ref:(l=function(D){var $=x.refs;D===null?delete $[E]:$[E]=D},l._stringRef=E,l)}if(typeof a!="string")throw Error(n(284));if(!f._owner)throw Error(n(290,a))}return a}function ld(a,l){throw a=Object.prototype.toString.call(l),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a))}function ix(a){var l=a._init;return l(a._payload)}function rx(a){function l(ue,ae){if(a){var fe=ue.deletions;fe===null?(ue.deletions=[ae],ue.flags|=16):fe.push(ae)}}function f(ue,ae){if(!a)return null;for(;ae!==null;)l(ue,ae),ae=ae.sibling;return null}function g(ue,ae){for(ue=new Map;ae!==null;)ae.key!==null?ue.set(ae.key,ae):ue.set(ae.index,ae),ae=ae.sibling;return ue}function x(ue,ae){return ue=fa(ue,ae),ue.index=0,ue.sibling=null,ue}function E(ue,ae,fe){return ue.index=fe,a?(fe=ue.alternate,fe!==null?(fe=fe.index,fe<ae?(ue.flags|=2,ae):fe):(ue.flags|=2,ae)):(ue.flags|=1048576,ae)}function D(ue){return a&&ue.alternate===null&&(ue.flags|=2),ue}function $(ue,ae,fe,Be){return ae===null||ae.tag!==6?(ae=gm(fe,ue.mode,Be),ae.return=ue,ae):(ae=x(ae,fe),ae.return=ue,ae)}function te(ue,ae,fe,Be){var St=fe.type;return St===U?Ce(ue,ae,fe.props.children,Be,fe.key):ae!==null&&(ae.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===K&&ix(St)===ae.type)?(Be=x(ae,fe.props),Be.ref=bc(ue,ae,fe),Be.return=ue,Be):(Be=Ld(fe.type,fe.key,fe.props,null,ue.mode,Be),Be.ref=bc(ue,ae,fe),Be.return=ue,Be)}function ge(ue,ae,fe,Be){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==fe.containerInfo||ae.stateNode.implementation!==fe.implementation?(ae=vm(fe,ue.mode,Be),ae.return=ue,ae):(ae=x(ae,fe.children||[]),ae.return=ue,ae)}function Ce(ue,ae,fe,Be,St){return ae===null||ae.tag!==7?(ae=Ka(fe,ue.mode,Be,St),ae.return=ue,ae):(ae=x(ae,fe),ae.return=ue,ae)}function De(ue,ae,fe){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=gm(""+ae,ue.mode,fe),ae.return=ue,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case I:return fe=Ld(ae.type,ae.key,ae.props,null,ue.mode,fe),fe.ref=bc(ue,null,ae),fe.return=ue,fe;case k:return ae=vm(ae,ue.mode,fe),ae.return=ue,ae;case K:var Be=ae._init;return De(ue,Be(ae._payload),fe)}if(At(ae)||q(ae))return ae=Ka(ae,ue.mode,fe,null),ae.return=ue,ae;ld(ue,ae)}return null}function Ae(ue,ae,fe,Be){var St=ae!==null?ae.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number")return St!==null?null:$(ue,ae,""+fe,Be);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case I:return fe.key===St?te(ue,ae,fe,Be):null;case k:return fe.key===St?ge(ue,ae,fe,Be):null;case K:return St=fe._init,Ae(ue,ae,St(fe._payload),Be)}if(At(fe)||q(fe))return St!==null?null:Ce(ue,ae,fe,Be,null);ld(ue,fe)}return null}function nt(ue,ae,fe,Be,St){if(typeof Be=="string"&&Be!==""||typeof Be=="number")return ue=ue.get(fe)||null,$(ae,ue,""+Be,St);if(typeof Be=="object"&&Be!==null){switch(Be.$$typeof){case I:return ue=ue.get(Be.key===null?fe:Be.key)||null,te(ae,ue,Be,St);case k:return ue=ue.get(Be.key===null?fe:Be.key)||null,ge(ae,ue,Be,St);case K:var Rt=Be._init;return nt(ue,ae,fe,Rt(Be._payload),St)}if(At(Be)||q(Be))return ue=ue.get(fe)||null,Ce(ae,ue,Be,St,null);ld(ae,Be)}return null}function ut(ue,ae,fe,Be){for(var St=null,Rt=null,kt=ae,Bt=ae=0,oi=null;kt!==null&&Bt<fe.length;Bt++){kt.index>Bt?(oi=kt,kt=null):oi=kt.sibling;var yn=Ae(ue,kt,fe[Bt],Be);if(yn===null){kt===null&&(kt=oi);break}a&&kt&&yn.alternate===null&&l(ue,kt),ae=E(yn,ae,Bt),Rt===null?St=yn:Rt.sibling=yn,Rt=yn,kt=oi}if(Bt===fe.length)return f(ue,kt),Dn&&Ha(ue,Bt),St;if(kt===null){for(;Bt<fe.length;Bt++)kt=De(ue,fe[Bt],Be),kt!==null&&(ae=E(kt,ae,Bt),Rt===null?St=kt:Rt.sibling=kt,Rt=kt);return Dn&&Ha(ue,Bt),St}for(kt=g(ue,kt);Bt<fe.length;Bt++)oi=nt(kt,ue,Bt,fe[Bt],Be),oi!==null&&(a&&oi.alternate!==null&&kt.delete(oi.key===null?Bt:oi.key),ae=E(oi,ae,Bt),Rt===null?St=oi:Rt.sibling=oi,Rt=oi);return a&&kt.forEach(function(ha){return l(ue,ha)}),Dn&&Ha(ue,Bt),St}function gt(ue,ae,fe,Be){var St=q(fe);if(typeof St!="function")throw Error(n(150));if(fe=St.call(fe),fe==null)throw Error(n(151));for(var Rt=St=null,kt=ae,Bt=ae=0,oi=null,yn=fe.next();kt!==null&&!yn.done;Bt++,yn=fe.next()){kt.index>Bt?(oi=kt,kt=null):oi=kt.sibling;var ha=Ae(ue,kt,yn.value,Be);if(ha===null){kt===null&&(kt=oi);break}a&&kt&&ha.alternate===null&&l(ue,kt),ae=E(ha,ae,Bt),Rt===null?St=ha:Rt.sibling=ha,Rt=ha,kt=oi}if(yn.done)return f(ue,kt),Dn&&Ha(ue,Bt),St;if(kt===null){for(;!yn.done;Bt++,yn=fe.next())yn=De(ue,yn.value,Be),yn!==null&&(ae=E(yn,ae,Bt),Rt===null?St=yn:Rt.sibling=yn,Rt=yn);return Dn&&Ha(ue,Bt),St}for(kt=g(ue,kt);!yn.done;Bt++,yn=fe.next())yn=nt(kt,ue,Bt,yn.value,Be),yn!==null&&(a&&yn.alternate!==null&&kt.delete(yn.key===null?Bt:yn.key),ae=E(yn,ae,Bt),Rt===null?St=yn:Rt.sibling=yn,Rt=yn);return a&&kt.forEach(function(g2){return l(ue,g2)}),Dn&&Ha(ue,Bt),St}function Gn(ue,ae,fe,Be){if(typeof fe=="object"&&fe!==null&&fe.type===U&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case I:e:{for(var St=fe.key,Rt=ae;Rt!==null;){if(Rt.key===St){if(St=fe.type,St===U){if(Rt.tag===7){f(ue,Rt.sibling),ae=x(Rt,fe.props.children),ae.return=ue,ue=ae;break e}}else if(Rt.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===K&&ix(St)===Rt.type){f(ue,Rt.sibling),ae=x(Rt,fe.props),ae.ref=bc(ue,Rt,fe),ae.return=ue,ue=ae;break e}f(ue,Rt);break}else l(ue,Rt);Rt=Rt.sibling}fe.type===U?(ae=Ka(fe.props.children,ue.mode,Be,fe.key),ae.return=ue,ue=ae):(Be=Ld(fe.type,fe.key,fe.props,null,ue.mode,Be),Be.ref=bc(ue,ae,fe),Be.return=ue,ue=Be)}return D(ue);case k:e:{for(Rt=fe.key;ae!==null;){if(ae.key===Rt)if(ae.tag===4&&ae.stateNode.containerInfo===fe.containerInfo&&ae.stateNode.implementation===fe.implementation){f(ue,ae.sibling),ae=x(ae,fe.children||[]),ae.return=ue,ue=ae;break e}else{f(ue,ae);break}else l(ue,ae);ae=ae.sibling}ae=vm(fe,ue.mode,Be),ae.return=ue,ue=ae}return D(ue);case K:return Rt=fe._init,Gn(ue,ae,Rt(fe._payload),Be)}if(At(fe))return ut(ue,ae,fe,Be);if(q(fe))return gt(ue,ae,fe,Be);ld(ue,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,ae!==null&&ae.tag===6?(f(ue,ae.sibling),ae=x(ae,fe),ae.return=ue,ue=ae):(f(ue,ae),ae=gm(fe,ue.mode,Be),ae.return=ue,ue=ae),D(ue)):f(ue,ae)}return Gn}var Yo=rx(!0),sx=rx(!1),cd=na(null),ud=null,Ko=null,Tp=null;function Ap(){Tp=Ko=ud=null}function Cp(a){var l=cd.current;Rn(cd),a._currentValue=l}function Pp(a,l,f){for(;a!==null;){var g=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,g!==null&&(g.childLanes|=l)):g!==null&&(g.childLanes&l)!==l&&(g.childLanes|=l),a===f)break;a=a.return}}function Zo(a,l){ud=a,Tp=Ko=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&l)!==0&&(Oi=!0),a.firstContext=null)}function rr(a){var l=a._currentValue;if(Tp!==a)if(a={context:a,memoizedValue:l,next:null},Ko===null){if(ud===null)throw Error(n(308));Ko=a,ud.dependencies={lanes:0,firstContext:a}}else Ko=Ko.next=a;return l}var Ga=null;function Rp(a){Ga===null?Ga=[a]:Ga.push(a)}function ax(a,l,f,g){var x=l.interleaved;return x===null?(f.next=f,Rp(l)):(f.next=x.next,x.next=f),l.interleaved=f,Ss(a,g)}function Ss(a,l){a.lanes|=l;var f=a.alternate;for(f!==null&&(f.lanes|=l),f=a,a=a.return;a!==null;)a.childLanes|=l,f=a.alternate,f!==null&&(f.childLanes|=l),f=a,a=a.return;return f.tag===3?f.stateNode:null}var sa=!1;function kp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ox(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function ws(a,l){return{eventTime:a,lane:l,tag:0,payload:null,callback:null,next:null}}function aa(a,l,f){var g=a.updateQueue;if(g===null)return null;if(g=g.shared,(dn&2)!==0){var x=g.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),g.pending=l,Ss(a,f)}return x=g.interleaved,x===null?(l.next=l,Rp(g)):(l.next=x.next,x.next=l),g.interleaved=l,Ss(a,f)}function dd(a,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194240)!==0)){var g=l.lanes;g&=a.pendingLanes,f|=g,l.lanes=f,xn(a,f)}}function lx(a,l){var f=a.updateQueue,g=a.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var x=null,E=null;if(f=f.firstBaseUpdate,f!==null){do{var D={eventTime:f.eventTime,lane:f.lane,tag:f.tag,payload:f.payload,callback:f.callback,next:null};E===null?x=E=D:E=E.next=D,f=f.next}while(f!==null);E===null?x=E=l:E=E.next=l}else x=E=l;f={baseState:g.baseState,firstBaseUpdate:x,lastBaseUpdate:E,shared:g.shared,effects:g.effects},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=l}function fd(a,l,f,g){var x=a.updateQueue;sa=!1;var E=x.firstBaseUpdate,D=x.lastBaseUpdate,$=x.shared.pending;if($!==null){x.shared.pending=null;var te=$,ge=te.next;te.next=null,D===null?E=ge:D.next=ge,D=te;var Ce=a.alternate;Ce!==null&&(Ce=Ce.updateQueue,$=Ce.lastBaseUpdate,$!==D&&($===null?Ce.firstBaseUpdate=ge:$.next=ge,Ce.lastBaseUpdate=te))}if(E!==null){var De=x.baseState;D=0,Ce=ge=te=null,$=E;do{var Ae=$.lane,nt=$.eventTime;if((g&Ae)===Ae){Ce!==null&&(Ce=Ce.next={eventTime:nt,lane:0,tag:$.tag,payload:$.payload,callback:$.callback,next:null});e:{var ut=a,gt=$;switch(Ae=l,nt=f,gt.tag){case 1:if(ut=gt.payload,typeof ut=="function"){De=ut.call(nt,De,Ae);break e}De=ut;break e;case 3:ut.flags=ut.flags&-65537|128;case 0:if(ut=gt.payload,Ae=typeof ut=="function"?ut.call(nt,De,Ae):ut,Ae==null)break e;De=Z({},De,Ae);break e;case 2:sa=!0}}$.callback!==null&&$.lane!==0&&(a.flags|=64,Ae=x.effects,Ae===null?x.effects=[$]:Ae.push($))}else nt={eventTime:nt,lane:Ae,tag:$.tag,payload:$.payload,callback:$.callback,next:null},Ce===null?(ge=Ce=nt,te=De):Ce=Ce.next=nt,D|=Ae;if($=$.next,$===null){if($=x.shared.pending,$===null)break;Ae=$,$=Ae.next,Ae.next=null,x.lastBaseUpdate=Ae,x.shared.pending=null}}while(!0);if(Ce===null&&(te=De),x.baseState=te,x.firstBaseUpdate=ge,x.lastBaseUpdate=Ce,l=x.shared.interleaved,l!==null){x=l;do D|=x.lane,x=x.next;while(x!==l)}else E===null&&(x.shared.lanes=0);$a|=D,a.lanes=D,a.memoizedState=De}}function cx(a,l,f){if(a=l.effects,l.effects=null,a!==null)for(l=0;l<a.length;l++){var g=a[l],x=g.callback;if(x!==null){if(g.callback=null,g=f,typeof x!="function")throw Error(n(191,x));x.call(g)}}}var Sc={},Gr=na(Sc),wc=na(Sc),Ec=na(Sc);function ja(a){if(a===Sc)throw Error(n(174));return a}function Lp(a,l){switch(Cn(Ec,l),Cn(wc,a),Cn(Gr,Sc),a=l.nodeType,a){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:we(null,"");break;default:a=a===8?l.parentNode:l,l=a.namespaceURI||null,a=a.tagName,l=we(l,a)}Rn(Gr),Cn(Gr,l)}function Jo(){Rn(Gr),Rn(wc),Rn(Ec)}function ux(a){ja(Ec.current);var l=ja(Gr.current),f=we(l,a.type);l!==f&&(Cn(wc,a),Cn(Gr,f))}function Dp(a){wc.current===a&&(Rn(Gr),Rn(wc))}var Fn=na(0);function hd(a){for(var l=a;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||f.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Np=[];function Ip(){for(var a=0;a<Np.length;a++)Np[a]._workInProgressVersionPrimary=null;Np.length=0}var pd=M.ReactCurrentDispatcher,Up=M.ReactCurrentBatchConfig,Wa=0,On=null,Jn=null,si=null,md=!1,Mc=!1,Tc=0,OR=0;function vi(){throw Error(n(321))}function Fp(a,l){if(l===null)return!1;for(var f=0;f<l.length&&f<a.length;f++)if(!Er(a[f],l[f]))return!1;return!0}function Op(a,l,f,g,x,E){if(Wa=E,On=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,pd.current=a===null||a.memoizedState===null?HR:GR,a=f(g,x),Mc){E=0;do{if(Mc=!1,Tc=0,25<=E)throw Error(n(301));E+=1,si=Jn=null,l.updateQueue=null,pd.current=jR,a=f(g,x)}while(Mc)}if(pd.current=yd,l=Jn!==null&&Jn.next!==null,Wa=0,si=Jn=On=null,md=!1,l)throw Error(n(300));return a}function Bp(){var a=Tc!==0;return Tc=0,a}function jr(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return si===null?On.memoizedState=si=a:si=si.next=a,si}function sr(){if(Jn===null){var a=On.alternate;a=a!==null?a.memoizedState:null}else a=Jn.next;var l=si===null?On.memoizedState:si.next;if(l!==null)si=l,Jn=a;else{if(a===null)throw Error(n(310));Jn=a,a={memoizedState:Jn.memoizedState,baseState:Jn.baseState,baseQueue:Jn.baseQueue,queue:Jn.queue,next:null},si===null?On.memoizedState=si=a:si=si.next=a}return si}function Ac(a,l){return typeof l=="function"?l(a):l}function zp(a){var l=sr(),f=l.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=a;var g=Jn,x=g.baseQueue,E=f.pending;if(E!==null){if(x!==null){var D=x.next;x.next=E.next,E.next=D}g.baseQueue=x=E,f.pending=null}if(x!==null){E=x.next,g=g.baseState;var $=D=null,te=null,ge=E;do{var Ce=ge.lane;if((Wa&Ce)===Ce)te!==null&&(te=te.next={lane:0,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),g=ge.hasEagerState?ge.eagerState:a(g,ge.action);else{var De={lane:Ce,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null};te===null?($=te=De,D=g):te=te.next=De,On.lanes|=Ce,$a|=Ce}ge=ge.next}while(ge!==null&&ge!==E);te===null?D=g:te.next=$,Er(g,l.memoizedState)||(Oi=!0),l.memoizedState=g,l.baseState=D,l.baseQueue=te,f.lastRenderedState=g}if(a=f.interleaved,a!==null){x=a;do E=x.lane,On.lanes|=E,$a|=E,x=x.next;while(x!==a)}else x===null&&(f.lanes=0);return[l.memoizedState,f.dispatch]}function Vp(a){var l=sr(),f=l.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=a;var g=f.dispatch,x=f.pending,E=l.memoizedState;if(x!==null){f.pending=null;var D=x=x.next;do E=a(E,D.action),D=D.next;while(D!==x);Er(E,l.memoizedState)||(Oi=!0),l.memoizedState=E,l.baseQueue===null&&(l.baseState=E),f.lastRenderedState=E}return[E,g]}function dx(){}function fx(a,l){var f=On,g=sr(),x=l(),E=!Er(g.memoizedState,x);if(E&&(g.memoizedState=x,Oi=!0),g=g.queue,Hp(mx.bind(null,f,g,a),[a]),g.getSnapshot!==l||E||si!==null&&si.memoizedState.tag&1){if(f.flags|=2048,Cc(9,px.bind(null,f,g,x,l),void 0,null),ai===null)throw Error(n(349));(Wa&30)!==0||hx(f,l,x)}return x}function hx(a,l,f){a.flags|=16384,a={getSnapshot:l,value:f},l=On.updateQueue,l===null?(l={lastEffect:null,stores:null},On.updateQueue=l,l.stores=[a]):(f=l.stores,f===null?l.stores=[a]:f.push(a))}function px(a,l,f,g){l.value=f,l.getSnapshot=g,gx(l)&&vx(a)}function mx(a,l,f){return f(function(){gx(l)&&vx(a)})}function gx(a){var l=a.getSnapshot;a=a.value;try{var f=l();return!Er(a,f)}catch{return!0}}function vx(a){var l=Ss(a,1);l!==null&&Pr(l,a,1,-1)}function yx(a){var l=jr();return typeof a=="function"&&(a=a()),l.memoizedState=l.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ac,lastRenderedState:a},l.queue=a,a=a.dispatch=VR.bind(null,On,a),[l.memoizedState,a]}function Cc(a,l,f,g){return a={tag:a,create:l,destroy:f,deps:g,next:null},l=On.updateQueue,l===null?(l={lastEffect:null,stores:null},On.updateQueue=l,l.lastEffect=a.next=a):(f=l.lastEffect,f===null?l.lastEffect=a.next=a:(g=f.next,f.next=a,a.next=g,l.lastEffect=a)),a}function _x(){return sr().memoizedState}function gd(a,l,f,g){var x=jr();On.flags|=a,x.memoizedState=Cc(1|l,f,void 0,g===void 0?null:g)}function vd(a,l,f,g){var x=sr();g=g===void 0?null:g;var E=void 0;if(Jn!==null){var D=Jn.memoizedState;if(E=D.destroy,g!==null&&Fp(g,D.deps)){x.memoizedState=Cc(l,f,E,g);return}}On.flags|=a,x.memoizedState=Cc(1|l,f,E,g)}function xx(a,l){return gd(8390656,8,a,l)}function Hp(a,l){return vd(2048,8,a,l)}function bx(a,l){return vd(4,2,a,l)}function Sx(a,l){return vd(4,4,a,l)}function wx(a,l){if(typeof l=="function")return a=a(),l(a),function(){l(null)};if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function Ex(a,l,f){return f=f!=null?f.concat([a]):null,vd(4,4,wx.bind(null,l,a),f)}function Gp(){}function Mx(a,l){var f=sr();l=l===void 0?null:l;var g=f.memoizedState;return g!==null&&l!==null&&Fp(l,g[1])?g[0]:(f.memoizedState=[a,l],a)}function Tx(a,l){var f=sr();l=l===void 0?null:l;var g=f.memoizedState;return g!==null&&l!==null&&Fp(l,g[1])?g[0]:(a=a(),f.memoizedState=[a,l],a)}function Ax(a,l,f){return(Wa&21)===0?(a.baseState&&(a.baseState=!1,Oi=!0),a.memoizedState=f):(Er(f,l)||(f=Ni(),On.lanes|=f,$a|=f,a.baseState=!0),l)}function BR(a,l){var f=Ot;Ot=f!==0&&4>f?f:4,a(!0);var g=Up.transition;Up.transition={};try{a(!1),l()}finally{Ot=f,Up.transition=g}}function Cx(){return sr().memoizedState}function zR(a,l,f){var g=ua(a);if(f={lane:g,action:f,hasEagerState:!1,eagerState:null,next:null},Px(a))Rx(l,f);else if(f=ax(a,l,f,g),f!==null){var x=Ai();Pr(f,a,g,x),kx(f,l,g)}}function VR(a,l,f){var g=ua(a),x={lane:g,action:f,hasEagerState:!1,eagerState:null,next:null};if(Px(a))Rx(l,x);else{var E=a.alternate;if(a.lanes===0&&(E===null||E.lanes===0)&&(E=l.lastRenderedReducer,E!==null))try{var D=l.lastRenderedState,$=E(D,f);if(x.hasEagerState=!0,x.eagerState=$,Er($,D)){var te=l.interleaved;te===null?(x.next=x,Rp(l)):(x.next=te.next,te.next=x),l.interleaved=x;return}}catch{}f=ax(a,l,x,g),f!==null&&(x=Ai(),Pr(f,a,g,x),kx(f,l,g))}}function Px(a){var l=a.alternate;return a===On||l!==null&&l===On}function Rx(a,l){Mc=md=!0;var f=a.pending;f===null?l.next=l:(l.next=f.next,f.next=l),a.pending=l}function kx(a,l,f){if((f&4194240)!==0){var g=l.lanes;g&=a.pendingLanes,f|=g,l.lanes=f,xn(a,f)}}var yd={readContext:rr,useCallback:vi,useContext:vi,useEffect:vi,useImperativeHandle:vi,useInsertionEffect:vi,useLayoutEffect:vi,useMemo:vi,useReducer:vi,useRef:vi,useState:vi,useDebugValue:vi,useDeferredValue:vi,useTransition:vi,useMutableSource:vi,useSyncExternalStore:vi,useId:vi,unstable_isNewReconciler:!1},HR={readContext:rr,useCallback:function(a,l){return jr().memoizedState=[a,l===void 0?null:l],a},useContext:rr,useEffect:xx,useImperativeHandle:function(a,l,f){return f=f!=null?f.concat([a]):null,gd(4194308,4,wx.bind(null,l,a),f)},useLayoutEffect:function(a,l){return gd(4194308,4,a,l)},useInsertionEffect:function(a,l){return gd(4,2,a,l)},useMemo:function(a,l){var f=jr();return l=l===void 0?null:l,a=a(),f.memoizedState=[a,l],a},useReducer:function(a,l,f){var g=jr();return l=f!==void 0?f(l):l,g.memoizedState=g.baseState=l,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:l},g.queue=a,a=a.dispatch=zR.bind(null,On,a),[g.memoizedState,a]},useRef:function(a){var l=jr();return a={current:a},l.memoizedState=a},useState:yx,useDebugValue:Gp,useDeferredValue:function(a){return jr().memoizedState=a},useTransition:function(){var a=yx(!1),l=a[0];return a=BR.bind(null,a[1]),jr().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,f){var g=On,x=jr();if(Dn){if(f===void 0)throw Error(n(407));f=f()}else{if(f=l(),ai===null)throw Error(n(349));(Wa&30)!==0||hx(g,l,f)}x.memoizedState=f;var E={value:f,getSnapshot:l};return x.queue=E,xx(mx.bind(null,g,E,a),[a]),g.flags|=2048,Cc(9,px.bind(null,g,E,f,l),void 0,null),f},useId:function(){var a=jr(),l=ai.identifierPrefix;if(Dn){var f=bs,g=xs;f=(g&~(1<<32-He(g)-1)).toString(32)+f,l=":"+l+"R"+f,f=Tc++,0<f&&(l+="H"+f.toString(32)),l+=":"}else f=OR++,l=":"+l+"r"+f.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},GR={readContext:rr,useCallback:Mx,useContext:rr,useEffect:Hp,useImperativeHandle:Ex,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:zp,useRef:_x,useState:function(){return zp(Ac)},useDebugValue:Gp,useDeferredValue:function(a){var l=sr();return Ax(l,Jn.memoizedState,a)},useTransition:function(){var a=zp(Ac)[0],l=sr().memoizedState;return[a,l]},useMutableSource:dx,useSyncExternalStore:fx,useId:Cx,unstable_isNewReconciler:!1},jR={readContext:rr,useCallback:Mx,useContext:rr,useEffect:Hp,useImperativeHandle:Ex,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:Vp,useRef:_x,useState:function(){return Vp(Ac)},useDebugValue:Gp,useDeferredValue:function(a){var l=sr();return Jn===null?l.memoizedState=a:Ax(l,Jn.memoizedState,a)},useTransition:function(){var a=Vp(Ac)[0],l=sr().memoizedState;return[a,l]},useMutableSource:dx,useSyncExternalStore:fx,useId:Cx,unstable_isNewReconciler:!1};function Tr(a,l){if(a&&a.defaultProps){l=Z({},l),a=a.defaultProps;for(var f in a)l[f]===void 0&&(l[f]=a[f]);return l}return l}function jp(a,l,f,g){l=a.memoizedState,f=f(g,l),f=f==null?l:Z({},l,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var _d={isMounted:function(a){return(a=a._reactInternals)?Qe(a)===a:!1},enqueueSetState:function(a,l,f){a=a._reactInternals;var g=Ai(),x=ua(a),E=ws(g,x);E.payload=l,f!=null&&(E.callback=f),l=aa(a,E,x),l!==null&&(Pr(l,a,x,g),dd(l,a,x))},enqueueReplaceState:function(a,l,f){a=a._reactInternals;var g=Ai(),x=ua(a),E=ws(g,x);E.tag=1,E.payload=l,f!=null&&(E.callback=f),l=aa(a,E,x),l!==null&&(Pr(l,a,x,g),dd(l,a,x))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var f=Ai(),g=ua(a),x=ws(f,g);x.tag=2,l!=null&&(x.callback=l),l=aa(a,x,g),l!==null&&(Pr(l,a,g,f),dd(l,a,g))}};function Lx(a,l,f,g,x,E,D){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(g,E,D):l.prototype&&l.prototype.isPureReactComponent?!pc(f,g)||!pc(x,E):!0}function Dx(a,l,f){var g=!1,x=ia,E=l.contextType;return typeof E=="object"&&E!==null?E=rr(E):(x=Fi(l)?za:gi.current,g=l.contextTypes,E=(g=g!=null)?Wo(a,x):ia),l=new l(f,E),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=_d,a.stateNode=l,l._reactInternals=a,g&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=x,a.__reactInternalMemoizedMaskedChildContext=E),l}function Nx(a,l,f,g){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,g),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,g),l.state!==a&&_d.enqueueReplaceState(l,l.state,null)}function Wp(a,l,f,g){var x=a.stateNode;x.props=f,x.state=a.memoizedState,x.refs={},kp(a);var E=l.contextType;typeof E=="object"&&E!==null?x.context=rr(E):(E=Fi(l)?za:gi.current,x.context=Wo(a,E)),x.state=a.memoizedState,E=l.getDerivedStateFromProps,typeof E=="function"&&(jp(a,l,E,f),x.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(l=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),l!==x.state&&_d.enqueueReplaceState(x,x.state,null),fd(a,f,x,g),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308)}function Qo(a,l){try{var f="",g=l;do f+=Se(g),g=g.return;while(g);var x=f}catch(E){x=`
|
|
6
|
+
`+x[D].replace(" at new "," at ");return a.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",a.displayName)),te}while(1<=D&&0<=$);break}}}finally{we=!1,Error.prepareStackTrace=f}return(a=a?a.displayName||a.name:"")?ie(a):""}function Se(a){switch(a.tag){case 5:return ie(a.type);case 16:return ie("Lazy");case 13:return ie("Suspense");case 19:return ie("SuspenseList");case 0:case 2:case 15:return a=He(a.type,!1),a;case 11:return a=He(a.type.render,!1),a;case 1:return a=He(a.type,!0),a;default:return""}}function ne(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case U:return"Fragment";case k:return"Portal";case P:return"Profiler";case S:return"StrictMode";case J:return"Suspense";case H:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case O:return(a.displayName||"Context")+".Consumer";case V:return(a._context.displayName||"Context")+".Provider";case G:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case X:return l=a.displayName||null,l!==null?l:ne(a.type)||"Memo";case K:l=a._payload,a=a._init;try{return ne(a(l))}catch{}}return null}function ye(a){var l=a.type;switch(a.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=l.render,a=a.displayName||a.name||"",l.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(l);case 8:return l===S?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function be(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Ne(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function et(a){var l=Ne(a)?"checked":"value",f=Object.getOwnPropertyDescriptor(a.constructor.prototype,l),g=""+a[l];if(!a.hasOwnProperty(l)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,E=f.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return x.call(this)},set:function(D){g=""+D,E.call(this,D)}}),Object.defineProperty(a,l,{enumerable:f.enumerable}),{getValue:function(){return g},setValue:function(D){g=""+D},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function xt(a){a._valueTracker||(a._valueTracker=et(a))}function pn(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var f=l.getValue(),g="";return a&&(g=Ne(a)?a.checked?"true":"false":a.value),a=g,a!==f?(l.setValue(a),!0):!1}function ht(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Ft(a,l){var f=l.checked;return Z({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:f??a._wrapperState.initialChecked})}function nn(a,l){var f=l.defaultValue==null?"":l.defaultValue,g=l.checked!=null?l.checked:l.defaultChecked;f=be(l.value!=null?l.value:f),a._wrapperState={initialChecked:g,initialValue:f,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function Dt(a,l){l=l.checked,l!=null&&A(a,"checked",l,!1)}function an(a,l){Dt(a,l);var f=be(l.value),g=l.type;if(f!=null)g==="number"?(f===0&&a.value===""||a.value!=f)&&(a.value=""+f):a.value!==""+f&&(a.value=""+f);else if(g==="submit"||g==="reset"){a.removeAttribute("value");return}l.hasOwnProperty("value")?Sn(a,l.type,f):l.hasOwnProperty("defaultValue")&&Sn(a,l.type,be(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(a.defaultChecked=!!l.defaultChecked)}function ee(a,l,f){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var g=l.type;if(!(g!=="submit"&&g!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+a._wrapperState.initialValue,f||l===a.value||(a.value=l),a.defaultValue=l}f=a.name,f!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,f!==""&&(a.name=f)}function Sn(a,l,f){(l!=="number"||ht(a.ownerDocument)!==a)&&(f==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+f&&(a.defaultValue=""+f))}var At=Array.isArray;function Lt(a,l,f,g){if(a=a.options,l){l={};for(var x=0;x<f.length;x++)l["$"+f[x]]=!0;for(f=0;f<a.length;f++)x=l.hasOwnProperty("$"+a[f].value),a[f].selected!==x&&(a[f].selected=x),x&&g&&(a[f].defaultSelected=!0)}else{for(f=""+be(f),l=null,x=0;x<a.length;x++){if(a[x].value===f){a[x].selected=!0,g&&(a[x].defaultSelected=!0);return}l!==null||a[x].disabled||(l=a[x])}l!==null&&(l.selected=!0)}}function it(a,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return Z({},l,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function B(a,l){var f=l.value;if(f==null){if(f=l.children,l=l.defaultValue,f!=null){if(l!=null)throw Error(n(92));if(At(f)){if(1<f.length)throw Error(n(93));f=f[0]}l=f}l==null&&(l=""),f=l}a._wrapperState={initialValue:be(f)}}function R(a,l){var f=be(l.value),g=be(l.defaultValue);f!=null&&(f=""+f,f!==a.value&&(a.value=f),l.defaultValue==null&&a.defaultValue!==f&&(a.defaultValue=f)),g!=null&&(a.defaultValue=""+g)}function se(a){var l=a.textContent;l===a._wrapperState.initialValue&&l!==""&&l!==null&&(a.value=l)}function xe(a){switch(a){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ee(a,l){return a==null||a==="http://www.w3.org/1999/xhtml"?xe(l):a==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var ve,Ke=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,f,g,x){MSApp.execUnsafeLocalFunction(function(){return a(l,f,g,x)})}:a})(function(a,l){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=l;else{for(ve=ve||document.createElement("div"),ve.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=ve.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}});function ke(a,l){if(l){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=l;return}}a.textContent=l}var pt={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},Pt=["Webkit","ms","Moz","O"];Object.keys(pt).forEach(function(a){Pt.forEach(function(l){l=l+a.charAt(0).toUpperCase()+a.substring(1),pt[l]=pt[a]})});function Pe(a,l,f){return l==null||typeof l=="boolean"||l===""?"":f||typeof l!="number"||l===0||pt.hasOwnProperty(a)&&pt[a]?(""+l).trim():l+"px"}function Oe(a,l){a=a.style;for(var f in l)if(l.hasOwnProperty(f)){var g=f.indexOf("--")===0,x=Pe(f,l[f],g);f==="float"&&(f="cssFloat"),g?a.setProperty(f,x):a[f]=x}}var Ze=Z({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 rt(a,l){if(l){if(Ze[a]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function $e(a,l){if(a.indexOf("-")===-1)return typeof l.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ht=null;function re(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var ze=null,Le=null,Xe=null;function Re(a){if(a=xc(a)){if(typeof ze!="function")throw Error(n(280));var l=a.stateNode;l&&(l=td(l),ze(a.stateNode,a.type,l))}}function _e(a){Le?Xe?Xe.push(a):Xe=[a]:Le=a}function st(){if(Le){var a=Le,l=Xe;if(Xe=Le=null,Re(a),l)for(a=0;a<l.length;a++)Re(l[a])}}function Nt(a,l){return a(l)}function mn(){}var Kt=!1;function ui(a,l,f){if(Kt)return a(l,f);Kt=!0;try{return Nt(a,l,f)}finally{Kt=!1,(Le!==null||Xe!==null)&&(mn(),st())}}function ri(a,l){var f=a.stateNode;if(f===null)return null;var g=td(f);if(g===null)return null;f=g[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(a=a.type,g=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!g;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(n(231,l,typeof f));return f}var Xs=!1;if(c)try{var Sr={};Object.defineProperty(Sr,"passive",{get:function(){Xs=!0}}),window.addEventListener("test",Sr,Sr),window.removeEventListener("test",Sr,Sr)}catch{Xs=!1}function Y(a,l,f,g,x,E,D,$,te){var ge=Array.prototype.slice.call(arguments,3);try{l.apply(f,ge)}catch(Ce){this.onError(Ce)}}var le=!1,he=null,Me=!1,Ie=null,vt={onError:function(a){le=!0,he=a}};function tt(a,l,f,g,x,E,D,$,te){le=!1,he=null,Y.apply(vt,arguments)}function yt(a,l,f,g,x,E,D,$,te){if(tt.apply(this,arguments),le){if(le){var ge=he;le=!1,he=null}else throw Error(n(198));Me||(Me=!0,Ie=ge)}}function Qe(a){var l=a,f=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(f=l.return),a=l.return;while(a)}return l.tag===3?f:null}function Et(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function Tt(a){if(Qe(a)!==a)throw Error(n(188))}function bt(a){var l=a.alternate;if(!l){if(l=Qe(a),l===null)throw Error(n(188));return l!==a?null:a}for(var f=a,g=l;;){var x=f.return;if(x===null)break;var E=x.alternate;if(E===null){if(g=x.return,g!==null){f=g;continue}break}if(x.child===E.child){for(E=x.child;E;){if(E===f)return Tt(x),a;if(E===g)return Tt(x),l;E=E.sibling}throw Error(n(188))}if(f.return!==g.return)f=x,g=E;else{for(var D=!1,$=x.child;$;){if($===f){D=!0,f=x,g=E;break}if($===g){D=!0,g=x,f=E;break}$=$.sibling}if(!D){for($=E.child;$;){if($===f){D=!0,f=E,g=x;break}if($===g){D=!0,g=E,f=x;break}$=$.sibling}if(!D)throw Error(n(189))}}if(f.alternate!==g)throw Error(n(190))}if(f.tag!==3)throw Error(n(188));return f.stateNode.current===f?a:l}function un(a){return a=bt(a),a!==null?en(a):null}function en(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var l=en(a);if(l!==null)return l;a=a.sibling}return null}var En=e.unstable_scheduleCallback,In=e.unstable_cancelCallback,Zn=e.unstable_shouldYield,gn=e.unstable_requestPaint,N=e.unstable_now,oe=e.unstable_getCurrentPriorityLevel,pe=e.unstable_ImmediatePriority,de=e.unstable_UserBlockingPriority,ce=e.unstable_NormalPriority,je=e.unstable_LowPriority,qe=e.unstable_IdlePriority,Ge=null,We=null;function ct(a){if(We&&typeof We.onCommitFiberRoot=="function")try{We.onCommitFiberRoot(Ge,a,void 0,(a.current.flags&128)===128)}catch{}}var Ve=Math.clz32?Math.clz32:Zt,Mt=Math.log,lt=Math.LN2;function Zt(a){return a>>>=0,a===0?32:31-(Mt(a)/lt|0)|0}var It=64,vn=4194304;function tn(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Un(a,l){var f=a.pendingLanes;if(f===0)return 0;var g=0,x=a.suspendedLanes,E=a.pingedLanes,D=f&268435455;if(D!==0){var $=D&~x;$!==0?g=tn($):(E&=D,E!==0&&(g=tn(E)))}else D=f&~x,D!==0?g=tn(D):E!==0&&(g=tn(E));if(g===0)return 0;if(l!==0&&l!==g&&(l&x)===0&&(x=g&-g,E=l&-l,x>=E||x===16&&(E&4194240)!==0))return l;if((g&4)!==0&&(g|=f&16),l=a.entangledLanes,l!==0)for(a=a.entanglements,l&=g;0<l;)f=31-Ve(l),x=1<<f,g|=a[f],l&=~x;return g}function _t(a,l){switch(a){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mi(a,l){for(var f=a.suspendedLanes,g=a.pingedLanes,x=a.expirationTimes,E=a.pendingLanes;0<E;){var D=31-Ve(E),$=1<<D,te=x[D];te===-1?(($&f)===0||($&g)!==0)&&(x[D]=_t($,l)):te<=l&&(a.expiredLanes|=$),E&=~$}}function rn(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function Ni(){var a=It;return It<<=1,(It&4194240)===0&&(It=64),a}function Ii(a){for(var l=[],f=0;31>f;f++)l.push(a);return l}function ji(a,l,f){a.pendingLanes|=l,l!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,l=31-Ve(l),a[l]=f}function qs(a,l){var f=a.pendingLanes&~l;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=l,a.mutableReadLanes&=l,a.entangledLanes&=l,l=a.entanglements;var g=a.eventTimes;for(a=a.expirationTimes;0<f;){var x=31-Ve(f),E=1<<x;l[x]=0,g[x]=-1,a[x]=-1,f&=~E}}function xn(a,l){var f=a.entangledLanes|=l;for(a=a.entanglements;f;){var g=31-Ve(f),x=1<<g;x&l|a[g]&l&&(a[g]|=l),f&=~x}}var Ot=0;function wr(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var Hn,tr,vs,ic,l_,Xh=!1,zu=[],Ys=null,Ks=null,Zs=null,rc=new Map,sc=new Map,Js=[],BP="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function c_(a,l){switch(a){case"focusin":case"focusout":Ys=null;break;case"dragenter":case"dragleave":Ks=null;break;case"mouseover":case"mouseout":Zs=null;break;case"pointerover":case"pointerout":rc.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":sc.delete(l.pointerId)}}function ac(a,l,f,g,x,E){return a===null||a.nativeEvent!==E?(a={blockedOn:l,domEventName:f,eventSystemFlags:g,nativeEvent:E,targetContainers:[x]},l!==null&&(l=xc(l),l!==null&&tr(l)),a):(a.eventSystemFlags|=g,l=a.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),a)}function zP(a,l,f,g,x){switch(l){case"focusin":return Ys=ac(Ys,a,l,f,g,x),!0;case"dragenter":return Ks=ac(Ks,a,l,f,g,x),!0;case"mouseover":return Zs=ac(Zs,a,l,f,g,x),!0;case"pointerover":var E=x.pointerId;return rc.set(E,ac(rc.get(E)||null,a,l,f,g,x)),!0;case"gotpointercapture":return E=x.pointerId,sc.set(E,ac(sc.get(E)||null,a,l,f,g,x)),!0}return!1}function u_(a){var l=Ba(a.target);if(l!==null){var f=Qe(l);if(f!==null){if(l=f.tag,l===13){if(l=Et(f),l!==null){a.blockedOn=l,l_(a.priority,function(){vs(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Vu(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var f=Yh(a.domEventName,a.eventSystemFlags,l[0],a.nativeEvent);if(f===null){f=a.nativeEvent;var g=new f.constructor(f.type,f);Ht=g,f.target.dispatchEvent(g),Ht=null}else return l=xc(f),l!==null&&tr(l),a.blockedOn=f,!1;l.shift()}return!0}function d_(a,l,f){Vu(a)&&f.delete(l)}function VP(){Xh=!1,Ys!==null&&Vu(Ys)&&(Ys=null),Ks!==null&&Vu(Ks)&&(Ks=null),Zs!==null&&Vu(Zs)&&(Zs=null),rc.forEach(d_),sc.forEach(d_)}function oc(a,l){a.blockedOn===l&&(a.blockedOn=null,Xh||(Xh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,VP)))}function lc(a){function l(x){return oc(x,a)}if(0<zu.length){oc(zu[0],a);for(var f=1;f<zu.length;f++){var g=zu[f];g.blockedOn===a&&(g.blockedOn=null)}}for(Ys!==null&&oc(Ys,a),Ks!==null&&oc(Ks,a),Zs!==null&&oc(Zs,a),rc.forEach(l),sc.forEach(l),f=0;f<Js.length;f++)g=Js[f],g.blockedOn===a&&(g.blockedOn=null);for(;0<Js.length&&(f=Js[0],f.blockedOn===null);)u_(f),f.blockedOn===null&&Js.shift()}var Uo=M.ReactCurrentBatchConfig,Hu=!0;function HP(a,l,f,g){var x=Ot,E=Uo.transition;Uo.transition=null;try{Ot=1,qh(a,l,f,g)}finally{Ot=x,Uo.transition=E}}function GP(a,l,f,g){var x=Ot,E=Uo.transition;Uo.transition=null;try{Ot=4,qh(a,l,f,g)}finally{Ot=x,Uo.transition=E}}function qh(a,l,f,g){if(Hu){var x=Yh(a,l,f,g);if(x===null)fp(a,l,g,Gu,f),c_(a,g);else if(zP(x,a,l,f,g))g.stopPropagation();else if(c_(a,g),l&4&&-1<BP.indexOf(a)){for(;x!==null;){var E=xc(x);if(E!==null&&Hn(E),E=Yh(a,l,f,g),E===null&&fp(a,l,g,Gu,f),E===x)break;x=E}x!==null&&g.stopPropagation()}else fp(a,l,g,null,f)}}var Gu=null;function Yh(a,l,f,g){if(Gu=null,a=re(g),a=Ba(a),a!==null)if(l=Qe(a),l===null)a=null;else if(f=l.tag,f===13){if(a=Et(l),a!==null)return a;a=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null);return Gu=a,null}function f_(a){switch(a){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(oe()){case pe:return 1;case de:return 4;case ce:case je:return 16;case qe:return 536870912;default:return 16}default:return 16}}var Qs=null,Kh=null,ju=null;function h_(){if(ju)return ju;var a,l=Kh,f=l.length,g,x="value"in Qs?Qs.value:Qs.textContent,E=x.length;for(a=0;a<f&&l[a]===x[a];a++);var D=f-a;for(g=1;g<=D&&l[f-g]===x[E-g];g++);return ju=x.slice(a,1<g?1-g:void 0)}function Wu(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function $u(){return!0}function p_(){return!1}function Wi(a){function l(f,g,x,E,D){this._reactName=f,this._targetInst=x,this.type=g,this.nativeEvent=E,this.target=D,this.currentTarget=null;for(var $ in a)a.hasOwnProperty($)&&(f=a[$],this[$]=f?f(E):E[$]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?$u:p_,this.isPropagationStopped=p_,this}return Z(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=$u)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=$u)},persist:function(){},isPersistent:$u}),l}var Fo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zh=Wi(Fo),cc=Z({},Fo,{view:0,detail:0}),jP=Wi(cc),Jh,Qh,uc,Xu=Z({},cc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tp,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==uc&&(uc&&a.type==="mousemove"?(Jh=a.screenX-uc.screenX,Qh=a.screenY-uc.screenY):Qh=Jh=0,uc=a),Jh)},movementY:function(a){return"movementY"in a?a.movementY:Qh}}),m_=Wi(Xu),WP=Z({},Xu,{dataTransfer:0}),$P=Wi(WP),XP=Z({},cc,{relatedTarget:0}),ep=Wi(XP),qP=Z({},Fo,{animationName:0,elapsedTime:0,pseudoElement:0}),YP=Wi(qP),KP=Z({},Fo,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),ZP=Wi(KP),JP=Z({},Fo,{data:0}),g_=Wi(JP),QP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},tR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nR(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=tR[a])?!!l[a]:!1}function tp(){return nR}var iR=Z({},cc,{key:function(a){if(a.key){var l=QP[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=Wu(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?eR[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tp,charCode:function(a){return a.type==="keypress"?Wu(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?Wu(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),rR=Wi(iR),sR=Z({},Xu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),v_=Wi(sR),aR=Z({},cc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tp}),oR=Wi(aR),lR=Z({},Fo,{propertyName:0,elapsedTime:0,pseudoElement:0}),cR=Wi(lR),uR=Z({},Xu,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),dR=Wi(uR),fR=[9,13,27,32],np=c&&"CompositionEvent"in window,dc=null;c&&"documentMode"in document&&(dc=document.documentMode);var hR=c&&"TextEvent"in window&&!dc,y_=c&&(!np||dc&&8<dc&&11>=dc),__=" ",x_=!1;function b_(a,l){switch(a){case"keyup":return fR.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S_(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Oo=!1;function pR(a,l){switch(a){case"compositionend":return S_(l);case"keypress":return l.which!==32?null:(x_=!0,__);case"textInput":return a=l.data,a===__&&x_?null:a;default:return null}}function mR(a,l){if(Oo)return a==="compositionend"||!np&&b_(a,l)?(a=h_(),ju=Kh=Qs=null,Oo=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return y_&&l.locale!=="ko"?null:l.data;default:return null}}var gR={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function w_(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!gR[a.type]:l==="textarea"}function E_(a,l,f,g){_e(g),l=Ju(l,"onChange"),0<l.length&&(f=new Zh("onChange","change",null,f,g),a.push({event:f,listeners:l}))}var fc=null,hc=null;function vR(a){H_(a,0)}function qu(a){var l=Go(a);if(pn(l))return a}function yR(a,l){if(a==="change")return l}var M_=!1;if(c){var ip;if(c){var rp="oninput"in document;if(!rp){var T_=document.createElement("div");T_.setAttribute("oninput","return;"),rp=typeof T_.oninput=="function"}ip=rp}else ip=!1;M_=ip&&(!document.documentMode||9<document.documentMode)}function A_(){fc&&(fc.detachEvent("onpropertychange",C_),hc=fc=null)}function C_(a){if(a.propertyName==="value"&&qu(hc)){var l=[];E_(l,hc,a,re(a)),ui(vR,l)}}function _R(a,l,f){a==="focusin"?(A_(),fc=l,hc=f,fc.attachEvent("onpropertychange",C_)):a==="focusout"&&A_()}function xR(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return qu(hc)}function bR(a,l){if(a==="click")return qu(l)}function SR(a,l){if(a==="input"||a==="change")return qu(l)}function wR(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Er=typeof Object.is=="function"?Object.is:wR;function pc(a,l){if(Er(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var f=Object.keys(a),g=Object.keys(l);if(f.length!==g.length)return!1;for(g=0;g<f.length;g++){var x=f[g];if(!u.call(l,x)||!Er(a[x],l[x]))return!1}return!0}function P_(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function R_(a,l){var f=P_(a);a=0;for(var g;f;){if(f.nodeType===3){if(g=a+f.textContent.length,a<=l&&g>=l)return{node:f,offset:l-a};a=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=P_(f)}}function k_(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?k_(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function L_(){for(var a=window,l=ht();l instanceof a.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)a=l.contentWindow;else break;l=ht(a.document)}return l}function sp(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}function ER(a){var l=L_(),f=a.focusedElem,g=a.selectionRange;if(l!==f&&f&&f.ownerDocument&&k_(f.ownerDocument.documentElement,f)){if(g!==null&&sp(f)){if(l=g.start,a=g.end,a===void 0&&(a=l),"selectionStart"in f)f.selectionStart=l,f.selectionEnd=Math.min(a,f.value.length);else if(a=(l=f.ownerDocument||document)&&l.defaultView||window,a.getSelection){a=a.getSelection();var x=f.textContent.length,E=Math.min(g.start,x);g=g.end===void 0?E:Math.min(g.end,x),!a.extend&&E>g&&(x=g,g=E,E=x),x=R_(f,E);var D=R_(f,g);x&&D&&(a.rangeCount!==1||a.anchorNode!==x.node||a.anchorOffset!==x.offset||a.focusNode!==D.node||a.focusOffset!==D.offset)&&(l=l.createRange(),l.setStart(x.node,x.offset),a.removeAllRanges(),E>g?(a.addRange(l),a.extend(D.node,D.offset)):(l.setEnd(D.node,D.offset),a.addRange(l)))}}for(l=[],a=f;a=a.parentNode;)a.nodeType===1&&l.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<l.length;f++)a=l[f],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var MR=c&&"documentMode"in document&&11>=document.documentMode,Bo=null,ap=null,mc=null,op=!1;function D_(a,l,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;op||Bo==null||Bo!==ht(g)||(g=Bo,"selectionStart"in g&&sp(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),mc&&pc(mc,g)||(mc=g,g=Ju(ap,"onSelect"),0<g.length&&(l=new Zh("onSelect","select",null,l,f),a.push({event:l,listeners:g}),l.target=Bo)))}function Yu(a,l){var f={};return f[a.toLowerCase()]=l.toLowerCase(),f["Webkit"+a]="webkit"+l,f["Moz"+a]="moz"+l,f}var zo={animationend:Yu("Animation","AnimationEnd"),animationiteration:Yu("Animation","AnimationIteration"),animationstart:Yu("Animation","AnimationStart"),transitionend:Yu("Transition","TransitionEnd")},lp={},N_={};c&&(N_=document.createElement("div").style,"AnimationEvent"in window||(delete zo.animationend.animation,delete zo.animationiteration.animation,delete zo.animationstart.animation),"TransitionEvent"in window||delete zo.transitionend.transition);function Ku(a){if(lp[a])return lp[a];if(!zo[a])return a;var l=zo[a],f;for(f in l)if(l.hasOwnProperty(f)&&f in N_)return lp[a]=l[f];return a}var I_=Ku("animationend"),U_=Ku("animationiteration"),F_=Ku("animationstart"),O_=Ku("transitionend"),B_=new Map,z_="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ea(a,l){B_.set(a,l),s(l,[a])}for(var cp=0;cp<z_.length;cp++){var up=z_[cp],TR=up.toLowerCase(),AR=up[0].toUpperCase()+up.slice(1);ea(TR,"on"+AR)}ea(I_,"onAnimationEnd"),ea(U_,"onAnimationIteration"),ea(F_,"onAnimationStart"),ea("dblclick","onDoubleClick"),ea("focusin","onFocus"),ea("focusout","onBlur"),ea(O_,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),CR=new Set("cancel close invalid load scroll toggle".split(" ").concat(gc));function V_(a,l,f){var g=a.type||"unknown-event";a.currentTarget=f,yt(g,l,void 0,a),a.currentTarget=null}function H_(a,l){l=(l&4)!==0;for(var f=0;f<a.length;f++){var g=a[f],x=g.event;g=g.listeners;e:{var E=void 0;if(l)for(var D=g.length-1;0<=D;D--){var $=g[D],te=$.instance,ge=$.currentTarget;if($=$.listener,te!==E&&x.isPropagationStopped())break e;V_(x,$,ge),E=te}else for(D=0;D<g.length;D++){if($=g[D],te=$.instance,ge=$.currentTarget,$=$.listener,te!==E&&x.isPropagationStopped())break e;V_(x,$,ge),E=te}}}if(Me)throw a=Ie,Me=!1,Ie=null,a}function Pn(a,l){var f=l[yp];f===void 0&&(f=l[yp]=new Set);var g=a+"__bubble";f.has(g)||(G_(l,a,2,!1),f.add(g))}function dp(a,l,f){var g=0;l&&(g|=4),G_(f,a,g,l)}var Zu="_reactListening"+Math.random().toString(36).slice(2);function vc(a){if(!a[Zu]){a[Zu]=!0,i.forEach(function(f){f!=="selectionchange"&&(CR.has(f)||dp(f,!1,a),dp(f,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[Zu]||(l[Zu]=!0,dp("selectionchange",!1,l))}}function G_(a,l,f,g){switch(f_(l)){case 1:var x=HP;break;case 4:x=GP;break;default:x=qh}f=x.bind(null,l,f,a),x=void 0,!Xs||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),g?x!==void 0?a.addEventListener(l,f,{capture:!0,passive:x}):a.addEventListener(l,f,!0):x!==void 0?a.addEventListener(l,f,{passive:x}):a.addEventListener(l,f,!1)}function fp(a,l,f,g,x){var E=g;if((l&1)===0&&(l&2)===0&&g!==null)e:for(;;){if(g===null)return;var D=g.tag;if(D===3||D===4){var $=g.stateNode.containerInfo;if($===x||$.nodeType===8&&$.parentNode===x)break;if(D===4)for(D=g.return;D!==null;){var te=D.tag;if((te===3||te===4)&&(te=D.stateNode.containerInfo,te===x||te.nodeType===8&&te.parentNode===x))return;D=D.return}for(;$!==null;){if(D=Ba($),D===null)return;if(te=D.tag,te===5||te===6){g=E=D;continue e}$=$.parentNode}}g=g.return}ui(function(){var ge=E,Ce=re(f),De=[];e:{var Ae=B_.get(a);if(Ae!==void 0){var nt=Zh,ut=a;switch(a){case"keypress":if(Wu(f)===0)break e;case"keydown":case"keyup":nt=rR;break;case"focusin":ut="focus",nt=ep;break;case"focusout":ut="blur",nt=ep;break;case"beforeblur":case"afterblur":nt=ep;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":nt=m_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":nt=$P;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":nt=oR;break;case I_:case U_:case F_:nt=YP;break;case O_:nt=cR;break;case"scroll":nt=jP;break;case"wheel":nt=dR;break;case"copy":case"cut":case"paste":nt=ZP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":nt=v_}var gt=(l&4)!==0,Gn=!gt&&a==="scroll",ue=gt?Ae!==null?Ae+"Capture":null:Ae;gt=[];for(var ae=ge,fe;ae!==null;){fe=ae;var Be=fe.stateNode;if(fe.tag===5&&Be!==null&&(fe=Be,ue!==null&&(Be=ri(ae,ue),Be!=null&>.push(yc(ae,Be,fe)))),Gn)break;ae=ae.return}0<gt.length&&(Ae=new nt(Ae,ut,null,f,Ce),De.push({event:Ae,listeners:gt}))}}if((l&7)===0){e:{if(Ae=a==="mouseover"||a==="pointerover",nt=a==="mouseout"||a==="pointerout",Ae&&f!==Ht&&(ut=f.relatedTarget||f.fromElement)&&(Ba(ut)||ut[ys]))break e;if((nt||Ae)&&(Ae=Ce.window===Ce?Ce:(Ae=Ce.ownerDocument)?Ae.defaultView||Ae.parentWindow:window,nt?(ut=f.relatedTarget||f.toElement,nt=ge,ut=ut?Ba(ut):null,ut!==null&&(Gn=Qe(ut),ut!==Gn||ut.tag!==5&&ut.tag!==6)&&(ut=null)):(nt=null,ut=ge),nt!==ut)){if(gt=m_,Be="onMouseLeave",ue="onMouseEnter",ae="mouse",(a==="pointerout"||a==="pointerover")&&(gt=v_,Be="onPointerLeave",ue="onPointerEnter",ae="pointer"),Gn=nt==null?Ae:Go(nt),fe=ut==null?Ae:Go(ut),Ae=new gt(Be,ae+"leave",nt,f,Ce),Ae.target=Gn,Ae.relatedTarget=fe,Be=null,Ba(Ce)===ge&&(gt=new gt(ue,ae+"enter",ut,f,Ce),gt.target=fe,gt.relatedTarget=Gn,Be=gt),Gn=Be,nt&&ut)t:{for(gt=nt,ue=ut,ae=0,fe=gt;fe;fe=Vo(fe))ae++;for(fe=0,Be=ue;Be;Be=Vo(Be))fe++;for(;0<ae-fe;)gt=Vo(gt),ae--;for(;0<fe-ae;)ue=Vo(ue),fe--;for(;ae--;){if(gt===ue||ue!==null&>===ue.alternate)break t;gt=Vo(gt),ue=Vo(ue)}gt=null}else gt=null;nt!==null&&j_(De,Ae,nt,gt,!1),ut!==null&&Gn!==null&&j_(De,Gn,ut,gt,!0)}}e:{if(Ae=ge?Go(ge):window,nt=Ae.nodeName&&Ae.nodeName.toLowerCase(),nt==="select"||nt==="input"&&Ae.type==="file")var St=yR;else if(w_(Ae))if(M_)St=SR;else{St=xR;var Rt=_R}else(nt=Ae.nodeName)&&nt.toLowerCase()==="input"&&(Ae.type==="checkbox"||Ae.type==="radio")&&(St=bR);if(St&&(St=St(a,ge))){E_(De,St,f,Ce);break e}Rt&&Rt(a,Ae,ge),a==="focusout"&&(Rt=Ae._wrapperState)&&Rt.controlled&&Ae.type==="number"&&Sn(Ae,"number",Ae.value)}switch(Rt=ge?Go(ge):window,a){case"focusin":(w_(Rt)||Rt.contentEditable==="true")&&(Bo=Rt,ap=ge,mc=null);break;case"focusout":mc=ap=Bo=null;break;case"mousedown":op=!0;break;case"contextmenu":case"mouseup":case"dragend":op=!1,D_(De,f,Ce);break;case"selectionchange":if(MR)break;case"keydown":case"keyup":D_(De,f,Ce)}var kt;if(np)e:{switch(a){case"compositionstart":var Bt="onCompositionStart";break e;case"compositionend":Bt="onCompositionEnd";break e;case"compositionupdate":Bt="onCompositionUpdate";break e}Bt=void 0}else Oo?b_(a,f)&&(Bt="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(Bt="onCompositionStart");Bt&&(y_&&f.locale!=="ko"&&(Oo||Bt!=="onCompositionStart"?Bt==="onCompositionEnd"&&Oo&&(kt=h_()):(Qs=Ce,Kh="value"in Qs?Qs.value:Qs.textContent,Oo=!0)),Rt=Ju(ge,Bt),0<Rt.length&&(Bt=new g_(Bt,a,null,f,Ce),De.push({event:Bt,listeners:Rt}),kt?Bt.data=kt:(kt=S_(f),kt!==null&&(Bt.data=kt)))),(kt=hR?pR(a,f):mR(a,f))&&(ge=Ju(ge,"onBeforeInput"),0<ge.length&&(Ce=new g_("onBeforeInput","beforeinput",null,f,Ce),De.push({event:Ce,listeners:ge}),Ce.data=kt))}H_(De,l)})}function yc(a,l,f){return{instance:a,listener:l,currentTarget:f}}function Ju(a,l){for(var f=l+"Capture",g=[];a!==null;){var x=a,E=x.stateNode;x.tag===5&&E!==null&&(x=E,E=ri(a,f),E!=null&&g.unshift(yc(a,E,x)),E=ri(a,l),E!=null&&g.push(yc(a,E,x))),a=a.return}return g}function Vo(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function j_(a,l,f,g,x){for(var E=l._reactName,D=[];f!==null&&f!==g;){var $=f,te=$.alternate,ge=$.stateNode;if(te!==null&&te===g)break;$.tag===5&&ge!==null&&($=ge,x?(te=ri(f,E),te!=null&&D.unshift(yc(f,te,$))):x||(te=ri(f,E),te!=null&&D.push(yc(f,te,$)))),f=f.return}D.length!==0&&a.push({event:l,listeners:D})}var PR=/\r\n?/g,RR=/\u0000|\uFFFD/g;function W_(a){return(typeof a=="string"?a:""+a).replace(PR,`
|
|
7
|
+
`).replace(RR,"")}function Qu(a,l,f){if(l=W_(l),W_(a)!==l&&f)throw Error(n(425))}function ed(){}var hp=null,pp=null;function mp(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var gp=typeof setTimeout=="function"?setTimeout:void 0,kR=typeof clearTimeout=="function"?clearTimeout:void 0,$_=typeof Promise=="function"?Promise:void 0,LR=typeof queueMicrotask=="function"?queueMicrotask:typeof $_<"u"?function(a){return $_.resolve(null).then(a).catch(DR)}:gp;function DR(a){setTimeout(function(){throw a})}function vp(a,l){var f=l,g=0;do{var x=f.nextSibling;if(a.removeChild(f),x&&x.nodeType===8)if(f=x.data,f==="/$"){if(g===0){a.removeChild(x),lc(l);return}g--}else f!=="$"&&f!=="$?"&&f!=="$!"||g++;f=x}while(f);lc(l)}function ta(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return a}function X_(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"){if(l===0)return a;l--}else f==="/$"&&l++}a=a.previousSibling}return null}var Ho=Math.random().toString(36).slice(2),Hr="__reactFiber$"+Ho,_c="__reactProps$"+Ho,ys="__reactContainer$"+Ho,yp="__reactEvents$"+Ho,NR="__reactListeners$"+Ho,IR="__reactHandles$"+Ho;function Ba(a){var l=a[Hr];if(l)return l;for(var f=a.parentNode;f;){if(l=f[ys]||f[Hr]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(a=X_(a);a!==null;){if(f=a[Hr])return f;a=X_(a)}return l}a=f,f=a.parentNode}return null}function xc(a){return a=a[Hr]||a[ys],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function Go(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(n(33))}function td(a){return a[_c]||null}var _p=[],jo=-1;function na(a){return{current:a}}function Rn(a){0>jo||(a.current=_p[jo],_p[jo]=null,jo--)}function Cn(a,l){jo++,_p[jo]=a.current,a.current=l}var ia={},gi=na(ia),Ui=na(!1),za=ia;function Wo(a,l){var f=a.type.contextTypes;if(!f)return ia;var g=a.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===l)return g.__reactInternalMemoizedMaskedChildContext;var x={},E;for(E in f)x[E]=l[E];return g&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=l,a.__reactInternalMemoizedMaskedChildContext=x),x}function Fi(a){return a=a.childContextTypes,a!=null}function nd(){Rn(Ui),Rn(gi)}function q_(a,l,f){if(gi.current!==ia)throw Error(n(168));Cn(gi,l),Cn(Ui,f)}function Y_(a,l,f){var g=a.stateNode;if(l=l.childContextTypes,typeof g.getChildContext!="function")return f;g=g.getChildContext();for(var x in g)if(!(x in l))throw Error(n(108,ye(a)||"Unknown",x));return Z({},f,g)}function id(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||ia,za=gi.current,Cn(gi,a),Cn(Ui,Ui.current),!0}function K_(a,l,f){var g=a.stateNode;if(!g)throw Error(n(169));f?(a=Y_(a,l,za),g.__reactInternalMemoizedMergedChildContext=a,Rn(Ui),Rn(gi),Cn(gi,a)):Rn(Ui),Cn(Ui,f)}var _s=null,rd=!1,xp=!1;function Z_(a){_s===null?_s=[a]:_s.push(a)}function UR(a){rd=!0,Z_(a)}function ra(){if(!xp&&_s!==null){xp=!0;var a=0,l=Ot;try{var f=_s;for(Ot=1;a<f.length;a++){var g=f[a];do g=g(!0);while(g!==null)}_s=null,rd=!1}catch(x){throw _s!==null&&(_s=_s.slice(a+1)),En(pe,ra),x}finally{Ot=l,xp=!1}}return null}var $o=[],Xo=0,sd=null,ad=0,nr=[],ir=0,Va=null,xs=1,bs="";function Ha(a,l){$o[Xo++]=ad,$o[Xo++]=sd,sd=a,ad=l}function J_(a,l,f){nr[ir++]=xs,nr[ir++]=bs,nr[ir++]=Va,Va=a;var g=xs;a=bs;var x=32-Ve(g)-1;g&=~(1<<x),f+=1;var E=32-Ve(l)+x;if(30<E){var D=x-x%5;E=(g&(1<<D)-1).toString(32),g>>=D,x-=D,xs=1<<32-Ve(l)+x|f<<x|g,bs=E+a}else xs=1<<E|f<<x|g,bs=a}function bp(a){a.return!==null&&(Ha(a,1),J_(a,1,0))}function Sp(a){for(;a===sd;)sd=$o[--Xo],$o[Xo]=null,ad=$o[--Xo],$o[Xo]=null;for(;a===Va;)Va=nr[--ir],nr[ir]=null,bs=nr[--ir],nr[ir]=null,xs=nr[--ir],nr[ir]=null}var $i=null,Xi=null,Dn=!1,Mr=null;function Q_(a,l){var f=or(5,null,null,0);f.elementType="DELETED",f.stateNode=l,f.return=a,l=a.deletions,l===null?(a.deletions=[f],a.flags|=16):l.push(f)}function ex(a,l){switch(a.tag){case 5:var f=a.type;return l=l.nodeType!==1||f.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(a.stateNode=l,$i=a,Xi=ta(l.firstChild),!0):!1;case 6:return l=a.pendingProps===""||l.nodeType!==3?null:l,l!==null?(a.stateNode=l,$i=a,Xi=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(f=Va!==null?{id:xs,overflow:bs}:null,a.memoizedState={dehydrated:l,treeContext:f,retryLane:1073741824},f=or(18,null,null,0),f.stateNode=l,f.return=a,a.child=f,$i=a,Xi=null,!0):!1;default:return!1}}function wp(a){return(a.mode&1)!==0&&(a.flags&128)===0}function Ep(a){if(Dn){var l=Xi;if(l){var f=l;if(!ex(a,l)){if(wp(a))throw Error(n(418));l=ta(f.nextSibling);var g=$i;l&&ex(a,l)?Q_(g,f):(a.flags=a.flags&-4097|2,Dn=!1,$i=a)}}else{if(wp(a))throw Error(n(418));a.flags=a.flags&-4097|2,Dn=!1,$i=a}}}function tx(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;$i=a}function od(a){if(a!==$i)return!1;if(!Dn)return tx(a),Dn=!0,!1;var l;if((l=a.tag!==3)&&!(l=a.tag!==5)&&(l=a.type,l=l!=="head"&&l!=="body"&&!mp(a.type,a.memoizedProps)),l&&(l=Xi)){if(wp(a))throw nx(),Error(n(418));for(;l;)Q_(a,l),l=ta(l.nextSibling)}if(tx(a),a.tag===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));e:{for(a=a.nextSibling,l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"){if(l===0){Xi=ta(a.nextSibling);break e}l--}else f!=="$"&&f!=="$!"&&f!=="$?"||l++}a=a.nextSibling}Xi=null}}else Xi=$i?ta(a.stateNode.nextSibling):null;return!0}function nx(){for(var a=Xi;a;)a=ta(a.nextSibling)}function qo(){Xi=$i=null,Dn=!1}function Mp(a){Mr===null?Mr=[a]:Mr.push(a)}var FR=M.ReactCurrentBatchConfig;function bc(a,l,f){if(a=f.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(f._owner){if(f=f._owner,f){if(f.tag!==1)throw Error(n(309));var g=f.stateNode}if(!g)throw Error(n(147,a));var x=g,E=""+a;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===E?l.ref:(l=function(D){var $=x.refs;D===null?delete $[E]:$[E]=D},l._stringRef=E,l)}if(typeof a!="string")throw Error(n(284));if(!f._owner)throw Error(n(290,a))}return a}function ld(a,l){throw a=Object.prototype.toString.call(l),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a))}function ix(a){var l=a._init;return l(a._payload)}function rx(a){function l(ue,ae){if(a){var fe=ue.deletions;fe===null?(ue.deletions=[ae],ue.flags|=16):fe.push(ae)}}function f(ue,ae){if(!a)return null;for(;ae!==null;)l(ue,ae),ae=ae.sibling;return null}function g(ue,ae){for(ue=new Map;ae!==null;)ae.key!==null?ue.set(ae.key,ae):ue.set(ae.index,ae),ae=ae.sibling;return ue}function x(ue,ae){return ue=fa(ue,ae),ue.index=0,ue.sibling=null,ue}function E(ue,ae,fe){return ue.index=fe,a?(fe=ue.alternate,fe!==null?(fe=fe.index,fe<ae?(ue.flags|=2,ae):fe):(ue.flags|=2,ae)):(ue.flags|=1048576,ae)}function D(ue){return a&&ue.alternate===null&&(ue.flags|=2),ue}function $(ue,ae,fe,Be){return ae===null||ae.tag!==6?(ae=gm(fe,ue.mode,Be),ae.return=ue,ae):(ae=x(ae,fe),ae.return=ue,ae)}function te(ue,ae,fe,Be){var St=fe.type;return St===U?Ce(ue,ae,fe.props.children,Be,fe.key):ae!==null&&(ae.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===K&&ix(St)===ae.type)?(Be=x(ae,fe.props),Be.ref=bc(ue,ae,fe),Be.return=ue,Be):(Be=Ld(fe.type,fe.key,fe.props,null,ue.mode,Be),Be.ref=bc(ue,ae,fe),Be.return=ue,Be)}function ge(ue,ae,fe,Be){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==fe.containerInfo||ae.stateNode.implementation!==fe.implementation?(ae=vm(fe,ue.mode,Be),ae.return=ue,ae):(ae=x(ae,fe.children||[]),ae.return=ue,ae)}function Ce(ue,ae,fe,Be,St){return ae===null||ae.tag!==7?(ae=Ka(fe,ue.mode,Be,St),ae.return=ue,ae):(ae=x(ae,fe),ae.return=ue,ae)}function De(ue,ae,fe){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=gm(""+ae,ue.mode,fe),ae.return=ue,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case I:return fe=Ld(ae.type,ae.key,ae.props,null,ue.mode,fe),fe.ref=bc(ue,null,ae),fe.return=ue,fe;case k:return ae=vm(ae,ue.mode,fe),ae.return=ue,ae;case K:var Be=ae._init;return De(ue,Be(ae._payload),fe)}if(At(ae)||q(ae))return ae=Ka(ae,ue.mode,fe,null),ae.return=ue,ae;ld(ue,ae)}return null}function Ae(ue,ae,fe,Be){var St=ae!==null?ae.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number")return St!==null?null:$(ue,ae,""+fe,Be);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case I:return fe.key===St?te(ue,ae,fe,Be):null;case k:return fe.key===St?ge(ue,ae,fe,Be):null;case K:return St=fe._init,Ae(ue,ae,St(fe._payload),Be)}if(At(fe)||q(fe))return St!==null?null:Ce(ue,ae,fe,Be,null);ld(ue,fe)}return null}function nt(ue,ae,fe,Be,St){if(typeof Be=="string"&&Be!==""||typeof Be=="number")return ue=ue.get(fe)||null,$(ae,ue,""+Be,St);if(typeof Be=="object"&&Be!==null){switch(Be.$$typeof){case I:return ue=ue.get(Be.key===null?fe:Be.key)||null,te(ae,ue,Be,St);case k:return ue=ue.get(Be.key===null?fe:Be.key)||null,ge(ae,ue,Be,St);case K:var Rt=Be._init;return nt(ue,ae,fe,Rt(Be._payload),St)}if(At(Be)||q(Be))return ue=ue.get(fe)||null,Ce(ae,ue,Be,St,null);ld(ae,Be)}return null}function ut(ue,ae,fe,Be){for(var St=null,Rt=null,kt=ae,Bt=ae=0,oi=null;kt!==null&&Bt<fe.length;Bt++){kt.index>Bt?(oi=kt,kt=null):oi=kt.sibling;var yn=Ae(ue,kt,fe[Bt],Be);if(yn===null){kt===null&&(kt=oi);break}a&&kt&&yn.alternate===null&&l(ue,kt),ae=E(yn,ae,Bt),Rt===null?St=yn:Rt.sibling=yn,Rt=yn,kt=oi}if(Bt===fe.length)return f(ue,kt),Dn&&Ha(ue,Bt),St;if(kt===null){for(;Bt<fe.length;Bt++)kt=De(ue,fe[Bt],Be),kt!==null&&(ae=E(kt,ae,Bt),Rt===null?St=kt:Rt.sibling=kt,Rt=kt);return Dn&&Ha(ue,Bt),St}for(kt=g(ue,kt);Bt<fe.length;Bt++)oi=nt(kt,ue,Bt,fe[Bt],Be),oi!==null&&(a&&oi.alternate!==null&&kt.delete(oi.key===null?Bt:oi.key),ae=E(oi,ae,Bt),Rt===null?St=oi:Rt.sibling=oi,Rt=oi);return a&&kt.forEach(function(ha){return l(ue,ha)}),Dn&&Ha(ue,Bt),St}function gt(ue,ae,fe,Be){var St=q(fe);if(typeof St!="function")throw Error(n(150));if(fe=St.call(fe),fe==null)throw Error(n(151));for(var Rt=St=null,kt=ae,Bt=ae=0,oi=null,yn=fe.next();kt!==null&&!yn.done;Bt++,yn=fe.next()){kt.index>Bt?(oi=kt,kt=null):oi=kt.sibling;var ha=Ae(ue,kt,yn.value,Be);if(ha===null){kt===null&&(kt=oi);break}a&&kt&&ha.alternate===null&&l(ue,kt),ae=E(ha,ae,Bt),Rt===null?St=ha:Rt.sibling=ha,Rt=ha,kt=oi}if(yn.done)return f(ue,kt),Dn&&Ha(ue,Bt),St;if(kt===null){for(;!yn.done;Bt++,yn=fe.next())yn=De(ue,yn.value,Be),yn!==null&&(ae=E(yn,ae,Bt),Rt===null?St=yn:Rt.sibling=yn,Rt=yn);return Dn&&Ha(ue,Bt),St}for(kt=g(ue,kt);!yn.done;Bt++,yn=fe.next())yn=nt(kt,ue,Bt,yn.value,Be),yn!==null&&(a&&yn.alternate!==null&&kt.delete(yn.key===null?Bt:yn.key),ae=E(yn,ae,Bt),Rt===null?St=yn:Rt.sibling=yn,Rt=yn);return a&&kt.forEach(function(g2){return l(ue,g2)}),Dn&&Ha(ue,Bt),St}function Gn(ue,ae,fe,Be){if(typeof fe=="object"&&fe!==null&&fe.type===U&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case I:e:{for(var St=fe.key,Rt=ae;Rt!==null;){if(Rt.key===St){if(St=fe.type,St===U){if(Rt.tag===7){f(ue,Rt.sibling),ae=x(Rt,fe.props.children),ae.return=ue,ue=ae;break e}}else if(Rt.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===K&&ix(St)===Rt.type){f(ue,Rt.sibling),ae=x(Rt,fe.props),ae.ref=bc(ue,Rt,fe),ae.return=ue,ue=ae;break e}f(ue,Rt);break}else l(ue,Rt);Rt=Rt.sibling}fe.type===U?(ae=Ka(fe.props.children,ue.mode,Be,fe.key),ae.return=ue,ue=ae):(Be=Ld(fe.type,fe.key,fe.props,null,ue.mode,Be),Be.ref=bc(ue,ae,fe),Be.return=ue,ue=Be)}return D(ue);case k:e:{for(Rt=fe.key;ae!==null;){if(ae.key===Rt)if(ae.tag===4&&ae.stateNode.containerInfo===fe.containerInfo&&ae.stateNode.implementation===fe.implementation){f(ue,ae.sibling),ae=x(ae,fe.children||[]),ae.return=ue,ue=ae;break e}else{f(ue,ae);break}else l(ue,ae);ae=ae.sibling}ae=vm(fe,ue.mode,Be),ae.return=ue,ue=ae}return D(ue);case K:return Rt=fe._init,Gn(ue,ae,Rt(fe._payload),Be)}if(At(fe))return ut(ue,ae,fe,Be);if(q(fe))return gt(ue,ae,fe,Be);ld(ue,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,ae!==null&&ae.tag===6?(f(ue,ae.sibling),ae=x(ae,fe),ae.return=ue,ue=ae):(f(ue,ae),ae=gm(fe,ue.mode,Be),ae.return=ue,ue=ae),D(ue)):f(ue,ae)}return Gn}var Yo=rx(!0),sx=rx(!1),cd=na(null),ud=null,Ko=null,Tp=null;function Ap(){Tp=Ko=ud=null}function Cp(a){var l=cd.current;Rn(cd),a._currentValue=l}function Pp(a,l,f){for(;a!==null;){var g=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,g!==null&&(g.childLanes|=l)):g!==null&&(g.childLanes&l)!==l&&(g.childLanes|=l),a===f)break;a=a.return}}function Zo(a,l){ud=a,Tp=Ko=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&l)!==0&&(Oi=!0),a.firstContext=null)}function rr(a){var l=a._currentValue;if(Tp!==a)if(a={context:a,memoizedValue:l,next:null},Ko===null){if(ud===null)throw Error(n(308));Ko=a,ud.dependencies={lanes:0,firstContext:a}}else Ko=Ko.next=a;return l}var Ga=null;function Rp(a){Ga===null?Ga=[a]:Ga.push(a)}function ax(a,l,f,g){var x=l.interleaved;return x===null?(f.next=f,Rp(l)):(f.next=x.next,x.next=f),l.interleaved=f,Ss(a,g)}function Ss(a,l){a.lanes|=l;var f=a.alternate;for(f!==null&&(f.lanes|=l),f=a,a=a.return;a!==null;)a.childLanes|=l,f=a.alternate,f!==null&&(f.childLanes|=l),f=a,a=a.return;return f.tag===3?f.stateNode:null}var sa=!1;function kp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ox(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function ws(a,l){return{eventTime:a,lane:l,tag:0,payload:null,callback:null,next:null}}function aa(a,l,f){var g=a.updateQueue;if(g===null)return null;if(g=g.shared,(dn&2)!==0){var x=g.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),g.pending=l,Ss(a,f)}return x=g.interleaved,x===null?(l.next=l,Rp(g)):(l.next=x.next,x.next=l),g.interleaved=l,Ss(a,f)}function dd(a,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194240)!==0)){var g=l.lanes;g&=a.pendingLanes,f|=g,l.lanes=f,xn(a,f)}}function lx(a,l){var f=a.updateQueue,g=a.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var x=null,E=null;if(f=f.firstBaseUpdate,f!==null){do{var D={eventTime:f.eventTime,lane:f.lane,tag:f.tag,payload:f.payload,callback:f.callback,next:null};E===null?x=E=D:E=E.next=D,f=f.next}while(f!==null);E===null?x=E=l:E=E.next=l}else x=E=l;f={baseState:g.baseState,firstBaseUpdate:x,lastBaseUpdate:E,shared:g.shared,effects:g.effects},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=l}function fd(a,l,f,g){var x=a.updateQueue;sa=!1;var E=x.firstBaseUpdate,D=x.lastBaseUpdate,$=x.shared.pending;if($!==null){x.shared.pending=null;var te=$,ge=te.next;te.next=null,D===null?E=ge:D.next=ge,D=te;var Ce=a.alternate;Ce!==null&&(Ce=Ce.updateQueue,$=Ce.lastBaseUpdate,$!==D&&($===null?Ce.firstBaseUpdate=ge:$.next=ge,Ce.lastBaseUpdate=te))}if(E!==null){var De=x.baseState;D=0,Ce=ge=te=null,$=E;do{var Ae=$.lane,nt=$.eventTime;if((g&Ae)===Ae){Ce!==null&&(Ce=Ce.next={eventTime:nt,lane:0,tag:$.tag,payload:$.payload,callback:$.callback,next:null});e:{var ut=a,gt=$;switch(Ae=l,nt=f,gt.tag){case 1:if(ut=gt.payload,typeof ut=="function"){De=ut.call(nt,De,Ae);break e}De=ut;break e;case 3:ut.flags=ut.flags&-65537|128;case 0:if(ut=gt.payload,Ae=typeof ut=="function"?ut.call(nt,De,Ae):ut,Ae==null)break e;De=Z({},De,Ae);break e;case 2:sa=!0}}$.callback!==null&&$.lane!==0&&(a.flags|=64,Ae=x.effects,Ae===null?x.effects=[$]:Ae.push($))}else nt={eventTime:nt,lane:Ae,tag:$.tag,payload:$.payload,callback:$.callback,next:null},Ce===null?(ge=Ce=nt,te=De):Ce=Ce.next=nt,D|=Ae;if($=$.next,$===null){if($=x.shared.pending,$===null)break;Ae=$,$=Ae.next,Ae.next=null,x.lastBaseUpdate=Ae,x.shared.pending=null}}while(!0);if(Ce===null&&(te=De),x.baseState=te,x.firstBaseUpdate=ge,x.lastBaseUpdate=Ce,l=x.shared.interleaved,l!==null){x=l;do D|=x.lane,x=x.next;while(x!==l)}else E===null&&(x.shared.lanes=0);$a|=D,a.lanes=D,a.memoizedState=De}}function cx(a,l,f){if(a=l.effects,l.effects=null,a!==null)for(l=0;l<a.length;l++){var g=a[l],x=g.callback;if(x!==null){if(g.callback=null,g=f,typeof x!="function")throw Error(n(191,x));x.call(g)}}}var Sc={},Gr=na(Sc),wc=na(Sc),Ec=na(Sc);function ja(a){if(a===Sc)throw Error(n(174));return a}function Lp(a,l){switch(Cn(Ec,l),Cn(wc,a),Cn(Gr,Sc),a=l.nodeType,a){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:Ee(null,"");break;default:a=a===8?l.parentNode:l,l=a.namespaceURI||null,a=a.tagName,l=Ee(l,a)}Rn(Gr),Cn(Gr,l)}function Jo(){Rn(Gr),Rn(wc),Rn(Ec)}function ux(a){ja(Ec.current);var l=ja(Gr.current),f=Ee(l,a.type);l!==f&&(Cn(wc,a),Cn(Gr,f))}function Dp(a){wc.current===a&&(Rn(Gr),Rn(wc))}var Fn=na(0);function hd(a){for(var l=a;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||f.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Np=[];function Ip(){for(var a=0;a<Np.length;a++)Np[a]._workInProgressVersionPrimary=null;Np.length=0}var pd=M.ReactCurrentDispatcher,Up=M.ReactCurrentBatchConfig,Wa=0,On=null,Jn=null,si=null,md=!1,Mc=!1,Tc=0,OR=0;function vi(){throw Error(n(321))}function Fp(a,l){if(l===null)return!1;for(var f=0;f<l.length&&f<a.length;f++)if(!Er(a[f],l[f]))return!1;return!0}function Op(a,l,f,g,x,E){if(Wa=E,On=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,pd.current=a===null||a.memoizedState===null?HR:GR,a=f(g,x),Mc){E=0;do{if(Mc=!1,Tc=0,25<=E)throw Error(n(301));E+=1,si=Jn=null,l.updateQueue=null,pd.current=jR,a=f(g,x)}while(Mc)}if(pd.current=yd,l=Jn!==null&&Jn.next!==null,Wa=0,si=Jn=On=null,md=!1,l)throw Error(n(300));return a}function Bp(){var a=Tc!==0;return Tc=0,a}function jr(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return si===null?On.memoizedState=si=a:si=si.next=a,si}function sr(){if(Jn===null){var a=On.alternate;a=a!==null?a.memoizedState:null}else a=Jn.next;var l=si===null?On.memoizedState:si.next;if(l!==null)si=l,Jn=a;else{if(a===null)throw Error(n(310));Jn=a,a={memoizedState:Jn.memoizedState,baseState:Jn.baseState,baseQueue:Jn.baseQueue,queue:Jn.queue,next:null},si===null?On.memoizedState=si=a:si=si.next=a}return si}function Ac(a,l){return typeof l=="function"?l(a):l}function zp(a){var l=sr(),f=l.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=a;var g=Jn,x=g.baseQueue,E=f.pending;if(E!==null){if(x!==null){var D=x.next;x.next=E.next,E.next=D}g.baseQueue=x=E,f.pending=null}if(x!==null){E=x.next,g=g.baseState;var $=D=null,te=null,ge=E;do{var Ce=ge.lane;if((Wa&Ce)===Ce)te!==null&&(te=te.next={lane:0,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),g=ge.hasEagerState?ge.eagerState:a(g,ge.action);else{var De={lane:Ce,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null};te===null?($=te=De,D=g):te=te.next=De,On.lanes|=Ce,$a|=Ce}ge=ge.next}while(ge!==null&&ge!==E);te===null?D=g:te.next=$,Er(g,l.memoizedState)||(Oi=!0),l.memoizedState=g,l.baseState=D,l.baseQueue=te,f.lastRenderedState=g}if(a=f.interleaved,a!==null){x=a;do E=x.lane,On.lanes|=E,$a|=E,x=x.next;while(x!==a)}else x===null&&(f.lanes=0);return[l.memoizedState,f.dispatch]}function Vp(a){var l=sr(),f=l.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=a;var g=f.dispatch,x=f.pending,E=l.memoizedState;if(x!==null){f.pending=null;var D=x=x.next;do E=a(E,D.action),D=D.next;while(D!==x);Er(E,l.memoizedState)||(Oi=!0),l.memoizedState=E,l.baseQueue===null&&(l.baseState=E),f.lastRenderedState=E}return[E,g]}function dx(){}function fx(a,l){var f=On,g=sr(),x=l(),E=!Er(g.memoizedState,x);if(E&&(g.memoizedState=x,Oi=!0),g=g.queue,Hp(mx.bind(null,f,g,a),[a]),g.getSnapshot!==l||E||si!==null&&si.memoizedState.tag&1){if(f.flags|=2048,Cc(9,px.bind(null,f,g,x,l),void 0,null),ai===null)throw Error(n(349));(Wa&30)!==0||hx(f,l,x)}return x}function hx(a,l,f){a.flags|=16384,a={getSnapshot:l,value:f},l=On.updateQueue,l===null?(l={lastEffect:null,stores:null},On.updateQueue=l,l.stores=[a]):(f=l.stores,f===null?l.stores=[a]:f.push(a))}function px(a,l,f,g){l.value=f,l.getSnapshot=g,gx(l)&&vx(a)}function mx(a,l,f){return f(function(){gx(l)&&vx(a)})}function gx(a){var l=a.getSnapshot;a=a.value;try{var f=l();return!Er(a,f)}catch{return!0}}function vx(a){var l=Ss(a,1);l!==null&&Pr(l,a,1,-1)}function yx(a){var l=jr();return typeof a=="function"&&(a=a()),l.memoizedState=l.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ac,lastRenderedState:a},l.queue=a,a=a.dispatch=VR.bind(null,On,a),[l.memoizedState,a]}function Cc(a,l,f,g){return a={tag:a,create:l,destroy:f,deps:g,next:null},l=On.updateQueue,l===null?(l={lastEffect:null,stores:null},On.updateQueue=l,l.lastEffect=a.next=a):(f=l.lastEffect,f===null?l.lastEffect=a.next=a:(g=f.next,f.next=a,a.next=g,l.lastEffect=a)),a}function _x(){return sr().memoizedState}function gd(a,l,f,g){var x=jr();On.flags|=a,x.memoizedState=Cc(1|l,f,void 0,g===void 0?null:g)}function vd(a,l,f,g){var x=sr();g=g===void 0?null:g;var E=void 0;if(Jn!==null){var D=Jn.memoizedState;if(E=D.destroy,g!==null&&Fp(g,D.deps)){x.memoizedState=Cc(l,f,E,g);return}}On.flags|=a,x.memoizedState=Cc(1|l,f,E,g)}function xx(a,l){return gd(8390656,8,a,l)}function Hp(a,l){return vd(2048,8,a,l)}function bx(a,l){return vd(4,2,a,l)}function Sx(a,l){return vd(4,4,a,l)}function wx(a,l){if(typeof l=="function")return a=a(),l(a),function(){l(null)};if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function Ex(a,l,f){return f=f!=null?f.concat([a]):null,vd(4,4,wx.bind(null,l,a),f)}function Gp(){}function Mx(a,l){var f=sr();l=l===void 0?null:l;var g=f.memoizedState;return g!==null&&l!==null&&Fp(l,g[1])?g[0]:(f.memoizedState=[a,l],a)}function Tx(a,l){var f=sr();l=l===void 0?null:l;var g=f.memoizedState;return g!==null&&l!==null&&Fp(l,g[1])?g[0]:(a=a(),f.memoizedState=[a,l],a)}function Ax(a,l,f){return(Wa&21)===0?(a.baseState&&(a.baseState=!1,Oi=!0),a.memoizedState=f):(Er(f,l)||(f=Ni(),On.lanes|=f,$a|=f,a.baseState=!0),l)}function BR(a,l){var f=Ot;Ot=f!==0&&4>f?f:4,a(!0);var g=Up.transition;Up.transition={};try{a(!1),l()}finally{Ot=f,Up.transition=g}}function Cx(){return sr().memoizedState}function zR(a,l,f){var g=ua(a);if(f={lane:g,action:f,hasEagerState:!1,eagerState:null,next:null},Px(a))Rx(l,f);else if(f=ax(a,l,f,g),f!==null){var x=Ai();Pr(f,a,g,x),kx(f,l,g)}}function VR(a,l,f){var g=ua(a),x={lane:g,action:f,hasEagerState:!1,eagerState:null,next:null};if(Px(a))Rx(l,x);else{var E=a.alternate;if(a.lanes===0&&(E===null||E.lanes===0)&&(E=l.lastRenderedReducer,E!==null))try{var D=l.lastRenderedState,$=E(D,f);if(x.hasEagerState=!0,x.eagerState=$,Er($,D)){var te=l.interleaved;te===null?(x.next=x,Rp(l)):(x.next=te.next,te.next=x),l.interleaved=x;return}}catch{}f=ax(a,l,x,g),f!==null&&(x=Ai(),Pr(f,a,g,x),kx(f,l,g))}}function Px(a){var l=a.alternate;return a===On||l!==null&&l===On}function Rx(a,l){Mc=md=!0;var f=a.pending;f===null?l.next=l:(l.next=f.next,f.next=l),a.pending=l}function kx(a,l,f){if((f&4194240)!==0){var g=l.lanes;g&=a.pendingLanes,f|=g,l.lanes=f,xn(a,f)}}var yd={readContext:rr,useCallback:vi,useContext:vi,useEffect:vi,useImperativeHandle:vi,useInsertionEffect:vi,useLayoutEffect:vi,useMemo:vi,useReducer:vi,useRef:vi,useState:vi,useDebugValue:vi,useDeferredValue:vi,useTransition:vi,useMutableSource:vi,useSyncExternalStore:vi,useId:vi,unstable_isNewReconciler:!1},HR={readContext:rr,useCallback:function(a,l){return jr().memoizedState=[a,l===void 0?null:l],a},useContext:rr,useEffect:xx,useImperativeHandle:function(a,l,f){return f=f!=null?f.concat([a]):null,gd(4194308,4,wx.bind(null,l,a),f)},useLayoutEffect:function(a,l){return gd(4194308,4,a,l)},useInsertionEffect:function(a,l){return gd(4,2,a,l)},useMemo:function(a,l){var f=jr();return l=l===void 0?null:l,a=a(),f.memoizedState=[a,l],a},useReducer:function(a,l,f){var g=jr();return l=f!==void 0?f(l):l,g.memoizedState=g.baseState=l,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:l},g.queue=a,a=a.dispatch=zR.bind(null,On,a),[g.memoizedState,a]},useRef:function(a){var l=jr();return a={current:a},l.memoizedState=a},useState:yx,useDebugValue:Gp,useDeferredValue:function(a){return jr().memoizedState=a},useTransition:function(){var a=yx(!1),l=a[0];return a=BR.bind(null,a[1]),jr().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,f){var g=On,x=jr();if(Dn){if(f===void 0)throw Error(n(407));f=f()}else{if(f=l(),ai===null)throw Error(n(349));(Wa&30)!==0||hx(g,l,f)}x.memoizedState=f;var E={value:f,getSnapshot:l};return x.queue=E,xx(mx.bind(null,g,E,a),[a]),g.flags|=2048,Cc(9,px.bind(null,g,E,f,l),void 0,null),f},useId:function(){var a=jr(),l=ai.identifierPrefix;if(Dn){var f=bs,g=xs;f=(g&~(1<<32-Ve(g)-1)).toString(32)+f,l=":"+l+"R"+f,f=Tc++,0<f&&(l+="H"+f.toString(32)),l+=":"}else f=OR++,l=":"+l+"r"+f.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},GR={readContext:rr,useCallback:Mx,useContext:rr,useEffect:Hp,useImperativeHandle:Ex,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:zp,useRef:_x,useState:function(){return zp(Ac)},useDebugValue:Gp,useDeferredValue:function(a){var l=sr();return Ax(l,Jn.memoizedState,a)},useTransition:function(){var a=zp(Ac)[0],l=sr().memoizedState;return[a,l]},useMutableSource:dx,useSyncExternalStore:fx,useId:Cx,unstable_isNewReconciler:!1},jR={readContext:rr,useCallback:Mx,useContext:rr,useEffect:Hp,useImperativeHandle:Ex,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:Vp,useRef:_x,useState:function(){return Vp(Ac)},useDebugValue:Gp,useDeferredValue:function(a){var l=sr();return Jn===null?l.memoizedState=a:Ax(l,Jn.memoizedState,a)},useTransition:function(){var a=Vp(Ac)[0],l=sr().memoizedState;return[a,l]},useMutableSource:dx,useSyncExternalStore:fx,useId:Cx,unstable_isNewReconciler:!1};function Tr(a,l){if(a&&a.defaultProps){l=Z({},l),a=a.defaultProps;for(var f in a)l[f]===void 0&&(l[f]=a[f]);return l}return l}function jp(a,l,f,g){l=a.memoizedState,f=f(g,l),f=f==null?l:Z({},l,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var _d={isMounted:function(a){return(a=a._reactInternals)?Qe(a)===a:!1},enqueueSetState:function(a,l,f){a=a._reactInternals;var g=Ai(),x=ua(a),E=ws(g,x);E.payload=l,f!=null&&(E.callback=f),l=aa(a,E,x),l!==null&&(Pr(l,a,x,g),dd(l,a,x))},enqueueReplaceState:function(a,l,f){a=a._reactInternals;var g=Ai(),x=ua(a),E=ws(g,x);E.tag=1,E.payload=l,f!=null&&(E.callback=f),l=aa(a,E,x),l!==null&&(Pr(l,a,x,g),dd(l,a,x))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var f=Ai(),g=ua(a),x=ws(f,g);x.tag=2,l!=null&&(x.callback=l),l=aa(a,x,g),l!==null&&(Pr(l,a,g,f),dd(l,a,g))}};function Lx(a,l,f,g,x,E,D){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(g,E,D):l.prototype&&l.prototype.isPureReactComponent?!pc(f,g)||!pc(x,E):!0}function Dx(a,l,f){var g=!1,x=ia,E=l.contextType;return typeof E=="object"&&E!==null?E=rr(E):(x=Fi(l)?za:gi.current,g=l.contextTypes,E=(g=g!=null)?Wo(a,x):ia),l=new l(f,E),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=_d,a.stateNode=l,l._reactInternals=a,g&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=x,a.__reactInternalMemoizedMaskedChildContext=E),l}function Nx(a,l,f,g){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,g),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,g),l.state!==a&&_d.enqueueReplaceState(l,l.state,null)}function Wp(a,l,f,g){var x=a.stateNode;x.props=f,x.state=a.memoizedState,x.refs={},kp(a);var E=l.contextType;typeof E=="object"&&E!==null?x.context=rr(E):(E=Fi(l)?za:gi.current,x.context=Wo(a,E)),x.state=a.memoizedState,E=l.getDerivedStateFromProps,typeof E=="function"&&(jp(a,l,E,f),x.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(l=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),l!==x.state&&_d.enqueueReplaceState(x,x.state,null),fd(a,f,x,g),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308)}function Qo(a,l){try{var f="",g=l;do f+=Se(g),g=g.return;while(g);var x=f}catch(E){x=`
|
|
8
8
|
Error generating stack: `+E.message+`
|
|
9
|
-
`+E.stack}return{value:a,source:l,stack:x,digest:null}}function $p(a,l,f){return{value:a,source:null,stack:f??null,digest:l??null}}function Xp(a,l){try{console.error(l.value)}catch(f){setTimeout(function(){throw f})}}var WR=typeof WeakMap=="function"?WeakMap:Map;function Ix(a,l,f){f=ws(-1,f),f.tag=3,f.payload={element:null};var g=l.value;return f.callback=function(){Td||(Td=!0,lm=g),Xp(a,l)},f}function Ux(a,l,f){f=ws(-1,f),f.tag=3;var g=a.type.getDerivedStateFromError;if(typeof g=="function"){var x=l.value;f.payload=function(){return g(x)},f.callback=function(){Xp(a,l)}}var E=a.stateNode;return E!==null&&typeof E.componentDidCatch=="function"&&(f.callback=function(){Xp(a,l),typeof g!="function"&&(la===null?la=new Set([this]):la.add(this));var D=l.stack;this.componentDidCatch(l.value,{componentStack:D!==null?D:""})}),f}function Fx(a,l,f){var g=a.pingCache;if(g===null){g=a.pingCache=new WR;var x=new Set;g.set(l,x)}else x=g.get(l),x===void 0&&(x=new Set,g.set(l,x));x.has(f)||(x.add(f),a=s2.bind(null,a,l,f),l.then(a,a))}function Ox(a){do{var l;if((l=a.tag===13)&&(l=a.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return a;a=a.return}while(a!==null);return null}function Bx(a,l,f,g,x){return(a.mode&1)===0?(a===l?a.flags|=65536:(a.flags|=128,f.flags|=131072,f.flags&=-52805,f.tag===1&&(f.alternate===null?f.tag=17:(l=ws(-1,1),l.tag=2,aa(f,l,1))),f.lanes|=1),a):(a.flags|=65536,a.lanes=x,a)}var $R=M.ReactCurrentOwner,Oi=!1;function Ti(a,l,f,g){l.child=a===null?sx(l,null,f,g):Yo(l,a.child,f,g)}function zx(a,l,f,g,x){f=f.render;var E=l.ref;return Zo(l,x),g=Op(a,l,f,g,E,x),f=Bp(),a!==null&&!Oi?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~x,Es(a,l,x)):(Dn&&f&&bp(l),l.flags|=1,Ti(a,l,g,x),l.child)}function Vx(a,l,f,g,x){if(a===null){var E=f.type;return typeof E=="function"&&!mm(E)&&E.defaultProps===void 0&&f.compare===null&&f.defaultProps===void 0?(l.tag=15,l.type=E,Hx(a,l,E,g,x)):(a=Ld(f.type,null,g,l,l.mode,x),a.ref=l.ref,a.return=l,l.child=a)}if(E=a.child,(a.lanes&x)===0){var D=E.memoizedProps;if(f=f.compare,f=f!==null?f:pc,f(D,g)&&a.ref===l.ref)return Es(a,l,x)}return l.flags|=1,a=fa(E,g),a.ref=l.ref,a.return=l,l.child=a}function Hx(a,l,f,g,x){if(a!==null){var E=a.memoizedProps;if(pc(E,g)&&a.ref===l.ref)if(Oi=!1,l.pendingProps=g=E,(a.lanes&x)!==0)(a.flags&131072)!==0&&(Oi=!0);else return l.lanes=a.lanes,Es(a,l,x)}return qp(a,l,f,g,x)}function Gx(a,l,f){var g=l.pendingProps,x=g.children,E=a!==null?a.memoizedState:null;if(g.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Cn(tl,qi),qi|=f;else{if((f&1073741824)===0)return a=E!==null?E.baseLanes|f:f,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:a,cachePool:null,transitions:null},l.updateQueue=null,Cn(tl,qi),qi|=a,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=E!==null?E.baseLanes:f,Cn(tl,qi),qi|=g}else E!==null?(g=E.baseLanes|f,l.memoizedState=null):g=f,Cn(tl,qi),qi|=g;return Ti(a,l,x,f),l.child}function jx(a,l){var f=l.ref;(a===null&&f!==null||a!==null&&a.ref!==f)&&(l.flags|=512,l.flags|=2097152)}function qp(a,l,f,g,x){var E=Fi(f)?za:gi.current;return E=Wo(l,E),Zo(l,x),f=Op(a,l,f,g,E,x),g=Bp(),a!==null&&!Oi?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~x,Es(a,l,x)):(Dn&&g&&bp(l),l.flags|=1,Ti(a,l,f,x),l.child)}function Wx(a,l,f,g,x){if(Fi(f)){var E=!0;id(l)}else E=!1;if(Zo(l,x),l.stateNode===null)bd(a,l),Dx(l,f,g),Wp(l,f,g,x),g=!0;else if(a===null){var D=l.stateNode,$=l.memoizedProps;D.props=$;var te=D.context,ge=f.contextType;typeof ge=="object"&&ge!==null?ge=rr(ge):(ge=Fi(f)?za:gi.current,ge=Wo(l,ge));var Ce=f.getDerivedStateFromProps,De=typeof Ce=="function"||typeof D.getSnapshotBeforeUpdate=="function";De||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||($!==g||te!==ge)&&Nx(l,D,g,ge),sa=!1;var Ae=l.memoizedState;D.state=Ae,fd(l,g,D,x),te=l.memoizedState,$!==g||Ae!==te||Ui.current||sa?(typeof Ce=="function"&&(jp(l,f,Ce,g),te=l.memoizedState),($=sa||Lx(l,f,$,g,Ae,te,ge))?(De||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(l.flags|=4194308)):(typeof D.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=g,l.memoizedState=te),D.props=g,D.state=te,D.context=ge,g=$):(typeof D.componentDidMount=="function"&&(l.flags|=4194308),g=!1)}else{D=l.stateNode,ox(a,l),$=l.memoizedProps,ge=l.type===l.elementType?$:Tr(l.type,$),D.props=ge,De=l.pendingProps,Ae=D.context,te=f.contextType,typeof te=="object"&&te!==null?te=rr(te):(te=Fi(f)?za:gi.current,te=Wo(l,te));var nt=f.getDerivedStateFromProps;(Ce=typeof nt=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||($!==De||Ae!==te)&&Nx(l,D,g,te),sa=!1,Ae=l.memoizedState,D.state=Ae,fd(l,g,D,x);var ut=l.memoizedState;$!==De||Ae!==ut||Ui.current||sa?(typeof nt=="function"&&(jp(l,f,nt,g),ut=l.memoizedState),(ge=sa||Lx(l,f,ge,g,Ae,ut,te)||!1)?(Ce||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(g,ut,te),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(g,ut,te)),typeof D.componentDidUpdate=="function"&&(l.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof D.componentDidUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=1024),l.memoizedProps=g,l.memoizedState=ut),D.props=g,D.state=ut,D.context=te,g=ge):(typeof D.componentDidUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=1024),g=!1)}return Yp(a,l,f,g,E,x)}function Yp(a,l,f,g,x,E){jx(a,l);var D=(l.flags&128)!==0;if(!g&&!D)return x&&K_(l,f,!1),Es(a,l,E);g=l.stateNode,$R.current=l;var $=D&&typeof f.getDerivedStateFromError!="function"?null:g.render();return l.flags|=1,a!==null&&D?(l.child=Yo(l,a.child,null,E),l.child=Yo(l,null,$,E)):Ti(a,l,$,E),l.memoizedState=g.state,x&&K_(l,f,!0),l.child}function $x(a){var l=a.stateNode;l.pendingContext?q_(a,l.pendingContext,l.pendingContext!==l.context):l.context&&q_(a,l.context,!1),Lp(a,l.containerInfo)}function Xx(a,l,f,g,x){return qo(),Mp(x),l.flags|=256,Ti(a,l,f,g),l.child}var Kp={dehydrated:null,treeContext:null,retryLane:0};function Zp(a){return{baseLanes:a,cachePool:null,transitions:null}}function qx(a,l,f){var g=l.pendingProps,x=Fn.current,E=!1,D=(l.flags&128)!==0,$;if(($=D)||($=a!==null&&a.memoizedState===null?!1:(x&2)!==0),$?(E=!0,l.flags&=-129):(a===null||a.memoizedState!==null)&&(x|=1),Cn(Fn,x&1),a===null)return Ep(l),a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((l.mode&1)===0?l.lanes=1:a.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(D=g.children,a=g.fallback,E?(g=l.mode,E=l.child,D={mode:"hidden",children:D},(g&1)===0&&E!==null?(E.childLanes=0,E.pendingProps=D):E=Dd(D,g,0,null),a=Ka(a,g,f,null),E.return=l,a.return=l,E.sibling=a,l.child=E,l.child.memoizedState=Zp(f),l.memoizedState=Kp,a):Jp(l,D));if(x=a.memoizedState,x!==null&&($=x.dehydrated,$!==null))return XR(a,l,D,g,$,x,f);if(E){E=g.fallback,D=l.mode,x=a.child,$=x.sibling;var te={mode:"hidden",children:g.children};return(D&1)===0&&l.child!==x?(g=l.child,g.childLanes=0,g.pendingProps=te,l.deletions=null):(g=fa(x,te),g.subtreeFlags=x.subtreeFlags&14680064),$!==null?E=fa($,E):(E=Ka(E,D,f,null),E.flags|=2),E.return=l,g.return=l,g.sibling=E,l.child=g,g=E,E=l.child,D=a.child.memoizedState,D=D===null?Zp(f):{baseLanes:D.baseLanes|f,cachePool:null,transitions:D.transitions},E.memoizedState=D,E.childLanes=a.childLanes&~f,l.memoizedState=Kp,g}return E=a.child,a=E.sibling,g=fa(E,{mode:"visible",children:g.children}),(l.mode&1)===0&&(g.lanes=f),g.return=l,g.sibling=null,a!==null&&(f=l.deletions,f===null?(l.deletions=[a],l.flags|=16):f.push(a)),l.child=g,l.memoizedState=null,g}function Jp(a,l){return l=Dd({mode:"visible",children:l},a.mode,0,null),l.return=a,a.child=l}function xd(a,l,f,g){return g!==null&&Mp(g),Yo(l,a.child,null,f),a=Jp(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function XR(a,l,f,g,x,E,D){if(f)return l.flags&256?(l.flags&=-257,g=$p(Error(n(422))),xd(a,l,D,g)):l.memoizedState!==null?(l.child=a.child,l.flags|=128,null):(E=g.fallback,x=l.mode,g=Dd({mode:"visible",children:g.children},x,0,null),E=Ka(E,x,D,null),E.flags|=2,g.return=l,E.return=l,g.sibling=E,l.child=g,(l.mode&1)!==0&&Yo(l,a.child,null,D),l.child.memoizedState=Zp(D),l.memoizedState=Kp,E);if((l.mode&1)===0)return xd(a,l,D,null);if(x.data==="$!"){if(g=x.nextSibling&&x.nextSibling.dataset,g)var $=g.dgst;return g=$,E=Error(n(419)),g=$p(E,g,void 0),xd(a,l,D,g)}if($=(D&a.childLanes)!==0,Oi||$){if(g=ai,g!==null){switch(D&-D){case 4:x=2;break;case 16:x=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:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(g.suspendedLanes|D))!==0?0:x,x!==0&&x!==E.retryLane&&(E.retryLane=x,Ss(a,x),Pr(g,a,x,-1))}return pm(),g=$p(Error(n(421))),xd(a,l,D,g)}return x.data==="$?"?(l.flags|=128,l.child=a.child,l=a2.bind(null,a),x._reactRetry=l,null):(a=E.treeContext,Xi=ta(x.nextSibling),$i=l,Dn=!0,Mr=null,a!==null&&(nr[ir++]=xs,nr[ir++]=bs,nr[ir++]=Va,xs=a.id,bs=a.overflow,Va=l),l=Jp(l,g.children),l.flags|=4096,l)}function Yx(a,l,f){a.lanes|=l;var g=a.alternate;g!==null&&(g.lanes|=l),Pp(a.return,l,f)}function Qp(a,l,f,g,x){var E=a.memoizedState;E===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:g,tail:f,tailMode:x}:(E.isBackwards=l,E.rendering=null,E.renderingStartTime=0,E.last=g,E.tail=f,E.tailMode=x)}function Kx(a,l,f){var g=l.pendingProps,x=g.revealOrder,E=g.tail;if(Ti(a,l,g.children,f),g=Fn.current,(g&2)!==0)g=g&1|2,l.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Yx(a,f,l);else if(a.tag===19)Yx(a,f,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}g&=1}if(Cn(Fn,g),(l.mode&1)===0)l.memoizedState=null;else switch(x){case"forwards":for(f=l.child,x=null;f!==null;)a=f.alternate,a!==null&&hd(a)===null&&(x=f),f=f.sibling;f=x,f===null?(x=l.child,l.child=null):(x=f.sibling,f.sibling=null),Qp(l,!1,x,f,E);break;case"backwards":for(f=null,x=l.child,l.child=null;x!==null;){if(a=x.alternate,a!==null&&hd(a)===null){l.child=x;break}a=x.sibling,x.sibling=f,f=x,x=a}Qp(l,!0,f,null,E);break;case"together":Qp(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function bd(a,l){(l.mode&1)===0&&a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2)}function Es(a,l,f){if(a!==null&&(l.dependencies=a.dependencies),$a|=l.lanes,(f&l.childLanes)===0)return null;if(a!==null&&l.child!==a.child)throw Error(n(153));if(l.child!==null){for(a=l.child,f=fa(a,a.pendingProps),l.child=f,f.return=l;a.sibling!==null;)a=a.sibling,f=f.sibling=fa(a,a.pendingProps),f.return=l;f.sibling=null}return l.child}function qR(a,l,f){switch(l.tag){case 3:$x(l),qo();break;case 5:ux(l);break;case 1:Fi(l.type)&&id(l);break;case 4:Lp(l,l.stateNode.containerInfo);break;case 10:var g=l.type._context,x=l.memoizedProps.value;Cn(cd,g._currentValue),g._currentValue=x;break;case 13:if(g=l.memoizedState,g!==null)return g.dehydrated!==null?(Cn(Fn,Fn.current&1),l.flags|=128,null):(f&l.child.childLanes)!==0?qx(a,l,f):(Cn(Fn,Fn.current&1),a=Es(a,l,f),a!==null?a.sibling:null);Cn(Fn,Fn.current&1);break;case 19:if(g=(f&l.childLanes)!==0,(a.flags&128)!==0){if(g)return Kx(a,l,f);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Cn(Fn,Fn.current),g)break;return null;case 22:case 23:return l.lanes=0,Gx(a,l,f)}return Es(a,l,f)}var Zx,em,Jx,Qx;Zx=function(a,l){for(var f=l.child;f!==null;){if(f.tag===5||f.tag===6)a.appendChild(f.stateNode);else if(f.tag!==4&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===l)break;for(;f.sibling===null;){if(f.return===null||f.return===l)return;f=f.return}f.sibling.return=f.return,f=f.sibling}},em=function(){},Jx=function(a,l,f,g){var x=a.memoizedProps;if(x!==g){a=l.stateNode,ja(Gr.current);var E=null;switch(f){case"input":x=Ft(a,x),g=Ft(a,g),E=[];break;case"select":x=Z({},x,{value:void 0}),g=Z({},g,{value:void 0}),E=[];break;case"textarea":x=it(a,x),g=it(a,g),E=[];break;default:typeof x.onClick!="function"&&typeof g.onClick=="function"&&(a.onclick=ed)}rt(f,g);var D;f=null;for(ge in x)if(!g.hasOwnProperty(ge)&&x.hasOwnProperty(ge)&&x[ge]!=null)if(ge==="style"){var $=x[ge];for(D in $)$.hasOwnProperty(D)&&(f||(f={}),f[D]="")}else ge!=="dangerouslySetInnerHTML"&&ge!=="children"&&ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&ge!=="autoFocus"&&(r.hasOwnProperty(ge)?E||(E=[]):(E=E||[]).push(ge,null));for(ge in g){var te=g[ge];if($=x?.[ge],g.hasOwnProperty(ge)&&te!==$&&(te!=null||$!=null))if(ge==="style")if($){for(D in $)!$.hasOwnProperty(D)||te&&te.hasOwnProperty(D)||(f||(f={}),f[D]="");for(D in te)te.hasOwnProperty(D)&&$[D]!==te[D]&&(f||(f={}),f[D]=te[D])}else f||(E||(E=[]),E.push(ge,f)),f=te;else ge==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,$=$?$.__html:void 0,te!=null&&$!==te&&(E=E||[]).push(ge,te)):ge==="children"?typeof te!="string"&&typeof te!="number"||(E=E||[]).push(ge,""+te):ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&(r.hasOwnProperty(ge)?(te!=null&&ge==="onScroll"&&Pn("scroll",a),E||$===te||(E=[])):(E=E||[]).push(ge,te))}f&&(E=E||[]).push("style",f);var ge=E;(l.updateQueue=ge)&&(l.flags|=4)}},Qx=function(a,l,f,g){f!==g&&(l.flags|=4)};function Pc(a,l){if(!Dn)switch(a.tailMode){case"hidden":l=a.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var g=null;f!==null;)f.alternate!==null&&(g=f),f=f.sibling;g===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:g.sibling=null}}function yi(a){var l=a.alternate!==null&&a.alternate.child===a.child,f=0,g=0;if(l)for(var x=a.child;x!==null;)f|=x.lanes|x.childLanes,g|=x.subtreeFlags&14680064,g|=x.flags&14680064,x.return=a,x=x.sibling;else for(x=a.child;x!==null;)f|=x.lanes|x.childLanes,g|=x.subtreeFlags,g|=x.flags,x.return=a,x=x.sibling;return a.subtreeFlags|=g,a.childLanes=f,l}function YR(a,l,f){var g=l.pendingProps;switch(Sp(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yi(l),null;case 1:return Fi(l.type)&&nd(),yi(l),null;case 3:return g=l.stateNode,Jo(),Rn(Ui),Rn(gi),Ip(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(a===null||a.child===null)&&(od(l)?l.flags|=4:a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Mr!==null&&(dm(Mr),Mr=null))),em(a,l),yi(l),null;case 5:Dp(l);var x=ja(Ec.current);if(f=l.type,a!==null&&l.stateNode!=null)Jx(a,l,f,g,x),a.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!g){if(l.stateNode===null)throw Error(n(166));return yi(l),null}if(a=ja(Gr.current),od(l)){g=l.stateNode,f=l.type;var E=l.memoizedProps;switch(g[Hr]=l,g[_c]=E,a=(l.mode&1)!==0,f){case"dialog":Pn("cancel",g),Pn("close",g);break;case"iframe":case"object":case"embed":Pn("load",g);break;case"video":case"audio":for(x=0;x<gc.length;x++)Pn(gc[x],g);break;case"source":Pn("error",g);break;case"img":case"image":case"link":Pn("error",g),Pn("load",g);break;case"details":Pn("toggle",g);break;case"input":nn(g,E),Pn("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!E.multiple},Pn("invalid",g);break;case"textarea":B(g,E),Pn("invalid",g)}rt(f,E),x=null;for(var D in E)if(E.hasOwnProperty(D)){var $=E[D];D==="children"?typeof $=="string"?g.textContent!==$&&(E.suppressHydrationWarning!==!0&&Qu(g.textContent,$,a),x=["children",$]):typeof $=="number"&&g.textContent!==""+$&&(E.suppressHydrationWarning!==!0&&Qu(g.textContent,$,a),x=["children",""+$]):r.hasOwnProperty(D)&&$!=null&&D==="onScroll"&&Pn("scroll",g)}switch(f){case"input":xt(g),ee(g,E,!0);break;case"textarea":xt(g),se(g);break;case"select":case"option":break;default:typeof E.onClick=="function"&&(g.onclick=ed)}g=x,l.updateQueue=g,g!==null&&(l.flags|=4)}else{D=x.nodeType===9?x:x.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=xe(f)),a==="http://www.w3.org/1999/xhtml"?f==="script"?(a=D.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof g.is=="string"?a=D.createElement(f,{is:g.is}):(a=D.createElement(f),f==="select"&&(D=a,g.multiple?D.multiple=!0:g.size&&(D.size=g.size))):a=D.createElementNS(a,f),a[Hr]=l,a[_c]=g,Zx(a,l,!1,!1),l.stateNode=a;e:{switch(D=$e(f,g),f){case"dialog":Pn("cancel",a),Pn("close",a),x=g;break;case"iframe":case"object":case"embed":Pn("load",a),x=g;break;case"video":case"audio":for(x=0;x<gc.length;x++)Pn(gc[x],a);x=g;break;case"source":Pn("error",a),x=g;break;case"img":case"image":case"link":Pn("error",a),Pn("load",a),x=g;break;case"details":Pn("toggle",a),x=g;break;case"input":nn(a,g),x=Ft(a,g),Pn("invalid",a);break;case"option":x=g;break;case"select":a._wrapperState={wasMultiple:!!g.multiple},x=Z({},g,{value:void 0}),Pn("invalid",a);break;case"textarea":B(a,g),x=it(a,g),Pn("invalid",a);break;default:x=g}rt(f,x),$=x;for(E in $)if($.hasOwnProperty(E)){var te=$[E];E==="style"?Oe(a,te):E==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&Ke(a,te)):E==="children"?typeof te=="string"?(f!=="textarea"||te!=="")&&ke(a,te):typeof te=="number"&&ke(a,""+te):E!=="suppressContentEditableWarning"&&E!=="suppressHydrationWarning"&&E!=="autoFocus"&&(r.hasOwnProperty(E)?te!=null&&E==="onScroll"&&Pn("scroll",a):te!=null&&A(a,E,te,D))}switch(f){case"input":xt(a),ee(a,g,!1);break;case"textarea":xt(a),se(a);break;case"option":g.value!=null&&a.setAttribute("value",""+be(g.value));break;case"select":a.multiple=!!g.multiple,E=g.value,E!=null?Lt(a,!!g.multiple,E,!1):g.defaultValue!=null&&Lt(a,!!g.multiple,g.defaultValue,!0);break;default:typeof x.onClick=="function"&&(a.onclick=ed)}switch(f){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return yi(l),null;case 6:if(a&&l.stateNode!=null)Qx(a,l,a.memoizedProps,g);else{if(typeof g!="string"&&l.stateNode===null)throw Error(n(166));if(f=ja(Ec.current),ja(Gr.current),od(l)){if(g=l.stateNode,f=l.memoizedProps,g[Hr]=l,(E=g.nodeValue!==f)&&(a=$i,a!==null))switch(a.tag){case 3:Qu(g.nodeValue,f,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&Qu(g.nodeValue,f,(a.mode&1)!==0)}E&&(l.flags|=4)}else g=(f.nodeType===9?f:f.ownerDocument).createTextNode(g),g[Hr]=l,l.stateNode=g}return yi(l),null;case 13:if(Rn(Fn),g=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Dn&&Xi!==null&&(l.mode&1)!==0&&(l.flags&128)===0)nx(),qo(),l.flags|=98560,E=!1;else if(E=od(l),g!==null&&g.dehydrated!==null){if(a===null){if(!E)throw Error(n(318));if(E=l.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(n(317));E[Hr]=l}else qo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;yi(l),E=!1}else Mr!==null&&(dm(Mr),Mr=null),E=!0;if(!E)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=f,l):(g=g!==null,g!==(a!==null&&a.memoizedState!==null)&&g&&(l.child.flags|=8192,(l.mode&1)!==0&&(a===null||(Fn.current&1)!==0?Qn===0&&(Qn=3):pm())),l.updateQueue!==null&&(l.flags|=4),yi(l),null);case 4:return Jo(),em(a,l),a===null&&vc(l.stateNode.containerInfo),yi(l),null;case 10:return Cp(l.type._context),yi(l),null;case 17:return Fi(l.type)&&nd(),yi(l),null;case 19:if(Rn(Fn),E=l.memoizedState,E===null)return yi(l),null;if(g=(l.flags&128)!==0,D=E.rendering,D===null)if(g)Pc(E,!1);else{if(Qn!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(D=hd(a),D!==null){for(l.flags|=128,Pc(E,!1),g=D.updateQueue,g!==null&&(l.updateQueue=g,l.flags|=4),l.subtreeFlags=0,g=f,f=l.child;f!==null;)E=f,a=g,E.flags&=14680066,D=E.alternate,D===null?(E.childLanes=0,E.lanes=a,E.child=null,E.subtreeFlags=0,E.memoizedProps=null,E.memoizedState=null,E.updateQueue=null,E.dependencies=null,E.stateNode=null):(E.childLanes=D.childLanes,E.lanes=D.lanes,E.child=D.child,E.subtreeFlags=0,E.deletions=null,E.memoizedProps=D.memoizedProps,E.memoizedState=D.memoizedState,E.updateQueue=D.updateQueue,E.type=D.type,a=D.dependencies,E.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),f=f.sibling;return Cn(Fn,Fn.current&1|2),l.child}a=a.sibling}E.tail!==null&&N()>nl&&(l.flags|=128,g=!0,Pc(E,!1),l.lanes=4194304)}else{if(!g)if(a=hd(D),a!==null){if(l.flags|=128,g=!0,f=a.updateQueue,f!==null&&(l.updateQueue=f,l.flags|=4),Pc(E,!0),E.tail===null&&E.tailMode==="hidden"&&!D.alternate&&!Dn)return yi(l),null}else 2*N()-E.renderingStartTime>nl&&f!==1073741824&&(l.flags|=128,g=!0,Pc(E,!1),l.lanes=4194304);E.isBackwards?(D.sibling=l.child,l.child=D):(f=E.last,f!==null?f.sibling=D:l.child=D,E.last=D)}return E.tail!==null?(l=E.tail,E.rendering=l,E.tail=l.sibling,E.renderingStartTime=N(),l.sibling=null,f=Fn.current,Cn(Fn,g?f&1|2:f&1),l):(yi(l),null);case 22:case 23:return hm(),g=l.memoizedState!==null,a!==null&&a.memoizedState!==null!==g&&(l.flags|=8192),g&&(l.mode&1)!==0?(qi&1073741824)!==0&&(yi(l),l.subtreeFlags&6&&(l.flags|=8192)):yi(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function KR(a,l){switch(Sp(l),l.tag){case 1:return Fi(l.type)&&nd(),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return Jo(),Rn(Ui),Rn(gi),Ip(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 5:return Dp(l),null;case 13:if(Rn(Fn),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(n(340));qo()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Rn(Fn),null;case 4:return Jo(),null;case 10:return Cp(l.type._context),null;case 22:case 23:return hm(),null;case 24:return null;default:return null}}var Sd=!1,_i=!1,ZR=typeof WeakSet=="function"?WeakSet:Set,at=null;function el(a,l){var f=a.ref;if(f!==null)if(typeof f=="function")try{f(null)}catch(g){Bn(a,l,g)}else f.current=null}function tm(a,l,f){try{f()}catch(g){Bn(a,l,g)}}var eb=!1;function JR(a,l){if(hp=Hu,a=L_(),sp(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var x=g.anchorOffset,E=g.focusNode;g=g.focusOffset;try{f.nodeType,E.nodeType}catch{f=null;break e}var D=0,$=-1,te=-1,ge=0,Ce=0,De=a,Ae=null;t:for(;;){for(var nt;De!==f||x!==0&&De.nodeType!==3||($=D+x),De!==E||g!==0&&De.nodeType!==3||(te=D+g),De.nodeType===3&&(D+=De.nodeValue.length),(nt=De.firstChild)!==null;)Ae=De,De=nt;for(;;){if(De===a)break t;if(Ae===f&&++ge===x&&($=D),Ae===E&&++Ce===g&&(te=D),(nt=De.nextSibling)!==null)break;De=Ae,Ae=De.parentNode}De=nt}f=$===-1||te===-1?null:{start:$,end:te}}else f=null}f=f||{start:0,end:0}}else f=null;for(pp={focusedElem:a,selectionRange:f},Hu=!1,at=l;at!==null;)if(l=at,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,at=a;else for(;at!==null;){l=at;try{var ut=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(ut!==null){var gt=ut.memoizedProps,Gn=ut.memoizedState,ue=l.stateNode,ae=ue.getSnapshotBeforeUpdate(l.elementType===l.type?gt:Tr(l.type,gt),Gn);ue.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var fe=l.stateNode.containerInfo;fe.nodeType===1?fe.textContent="":fe.nodeType===9&&fe.documentElement&&fe.removeChild(fe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Be){Bn(l,l.return,Be)}if(a=l.sibling,a!==null){a.return=l.return,at=a;break}at=l.return}return ut=eb,eb=!1,ut}function Rc(a,l,f){var g=l.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var x=g=g.next;do{if((x.tag&a)===a){var E=x.destroy;x.destroy=void 0,E!==void 0&&tm(l,f,E)}x=x.next}while(x!==g)}}function wd(a,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var f=l=l.next;do{if((f.tag&a)===a){var g=f.create;f.destroy=g()}f=f.next}while(f!==l)}}function nm(a){var l=a.ref;if(l!==null){var f=a.stateNode;a.tag,a=f,typeof l=="function"?l(a):l.current=a}}function tb(a){var l=a.alternate;l!==null&&(a.alternate=null,tb(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&(delete l[Hr],delete l[_c],delete l[yp],delete l[NR],delete l[IR])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function nb(a){return a.tag===5||a.tag===3||a.tag===4}function ib(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||nb(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function im(a,l,f){var g=a.tag;if(g===5||g===6)a=a.stateNode,l?f.nodeType===8?f.parentNode.insertBefore(a,l):f.insertBefore(a,l):(f.nodeType===8?(l=f.parentNode,l.insertBefore(a,f)):(l=f,l.appendChild(a)),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=ed));else if(g!==4&&(a=a.child,a!==null))for(im(a,l,f),a=a.sibling;a!==null;)im(a,l,f),a=a.sibling}function rm(a,l,f){var g=a.tag;if(g===5||g===6)a=a.stateNode,l?f.insertBefore(a,l):f.appendChild(a);else if(g!==4&&(a=a.child,a!==null))for(rm(a,l,f),a=a.sibling;a!==null;)rm(a,l,f),a=a.sibling}var di=null,Ar=!1;function oa(a,l,f){for(f=f.child;f!==null;)rb(a,l,f),f=f.sibling}function rb(a,l,f){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(Ge,f)}catch{}switch(f.tag){case 5:_i||el(f,l);case 6:var g=di,x=Ar;di=null,oa(a,l,f),di=g,Ar=x,di!==null&&(Ar?(a=di,f=f.stateNode,a.nodeType===8?a.parentNode.removeChild(f):a.removeChild(f)):di.removeChild(f.stateNode));break;case 18:di!==null&&(Ar?(a=di,f=f.stateNode,a.nodeType===8?vp(a.parentNode,f):a.nodeType===1&&vp(a,f),lc(a)):vp(di,f.stateNode));break;case 4:g=di,x=Ar,di=f.stateNode.containerInfo,Ar=!0,oa(a,l,f),di=g,Ar=x;break;case 0:case 11:case 14:case 15:if(!_i&&(g=f.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){x=g=g.next;do{var E=x,D=E.destroy;E=E.tag,D!==void 0&&((E&2)!==0||(E&4)!==0)&&tm(f,l,D),x=x.next}while(x!==g)}oa(a,l,f);break;case 1:if(!_i&&(el(f,l),g=f.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=f.memoizedProps,g.state=f.memoizedState,g.componentWillUnmount()}catch($){Bn(f,l,$)}oa(a,l,f);break;case 21:oa(a,l,f);break;case 22:f.mode&1?(_i=(g=_i)||f.memoizedState!==null,oa(a,l,f),_i=g):oa(a,l,f);break;default:oa(a,l,f)}}function sb(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var f=a.stateNode;f===null&&(f=a.stateNode=new ZR),l.forEach(function(g){var x=o2.bind(null,a,g);f.has(g)||(f.add(g),g.then(x,x))})}}function Cr(a,l){var f=l.deletions;if(f!==null)for(var g=0;g<f.length;g++){var x=f[g];try{var E=a,D=l,$=D;e:for(;$!==null;){switch($.tag){case 5:di=$.stateNode,Ar=!1;break e;case 3:di=$.stateNode.containerInfo,Ar=!0;break e;case 4:di=$.stateNode.containerInfo,Ar=!0;break e}$=$.return}if(di===null)throw Error(n(160));rb(E,D,x),di=null,Ar=!1;var te=x.alternate;te!==null&&(te.return=null),x.return=null}catch(ge){Bn(x,l,ge)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)ab(l,a),l=l.sibling}function ab(a,l){var f=a.alternate,g=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(Cr(l,a),Wr(a),g&4){try{Rc(3,a,a.return),wd(3,a)}catch(gt){Bn(a,a.return,gt)}try{Rc(5,a,a.return)}catch(gt){Bn(a,a.return,gt)}}break;case 1:Cr(l,a),Wr(a),g&512&&f!==null&&el(f,f.return);break;case 5:if(Cr(l,a),Wr(a),g&512&&f!==null&&el(f,f.return),a.flags&32){var x=a.stateNode;try{ke(x,"")}catch(gt){Bn(a,a.return,gt)}}if(g&4&&(x=a.stateNode,x!=null)){var E=a.memoizedProps,D=f!==null?f.memoizedProps:E,$=a.type,te=a.updateQueue;if(a.updateQueue=null,te!==null)try{$==="input"&&E.type==="radio"&&E.name!=null&&Dt(x,E),$e($,D);var ge=$e($,E);for(D=0;D<te.length;D+=2){var Ce=te[D],De=te[D+1];Ce==="style"?Oe(x,De):Ce==="dangerouslySetInnerHTML"?Ke(x,De):Ce==="children"?ke(x,De):A(x,Ce,De,ge)}switch($){case"input":an(x,E);break;case"textarea":R(x,E);break;case"select":var Ae=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!E.multiple;var nt=E.value;nt!=null?Lt(x,!!E.multiple,nt,!1):Ae!==!!E.multiple&&(E.defaultValue!=null?Lt(x,!!E.multiple,E.defaultValue,!0):Lt(x,!!E.multiple,E.multiple?[]:"",!1))}x[_c]=E}catch(gt){Bn(a,a.return,gt)}}break;case 6:if(Cr(l,a),Wr(a),g&4){if(a.stateNode===null)throw Error(n(162));x=a.stateNode,E=a.memoizedProps;try{x.nodeValue=E}catch(gt){Bn(a,a.return,gt)}}break;case 3:if(Cr(l,a),Wr(a),g&4&&f!==null&&f.memoizedState.isDehydrated)try{lc(l.containerInfo)}catch(gt){Bn(a,a.return,gt)}break;case 4:Cr(l,a),Wr(a);break;case 13:Cr(l,a),Wr(a),x=a.child,x.flags&8192&&(E=x.memoizedState!==null,x.stateNode.isHidden=E,!E||x.alternate!==null&&x.alternate.memoizedState!==null||(om=N())),g&4&&sb(a);break;case 22:if(Ce=f!==null&&f.memoizedState!==null,a.mode&1?(_i=(ge=_i)||Ce,Cr(l,a),_i=ge):Cr(l,a),Wr(a),g&8192){if(ge=a.memoizedState!==null,(a.stateNode.isHidden=ge)&&!Ce&&(a.mode&1)!==0)for(at=a,Ce=a.child;Ce!==null;){for(De=at=Ce;at!==null;){switch(Ae=at,nt=Ae.child,Ae.tag){case 0:case 11:case 14:case 15:Rc(4,Ae,Ae.return);break;case 1:el(Ae,Ae.return);var ut=Ae.stateNode;if(typeof ut.componentWillUnmount=="function"){g=Ae,f=Ae.return;try{l=g,ut.props=l.memoizedProps,ut.state=l.memoizedState,ut.componentWillUnmount()}catch(gt){Bn(g,f,gt)}}break;case 5:el(Ae,Ae.return);break;case 22:if(Ae.memoizedState!==null){cb(De);continue}}nt!==null?(nt.return=Ae,at=nt):cb(De)}Ce=Ce.sibling}e:for(Ce=null,De=a;;){if(De.tag===5){if(Ce===null){Ce=De;try{x=De.stateNode,ge?(E=x.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none"):($=De.stateNode,te=De.memoizedProps.style,D=te!=null&&te.hasOwnProperty("display")?te.display:null,$.style.display=Pe("display",D))}catch(gt){Bn(a,a.return,gt)}}}else if(De.tag===6){if(Ce===null)try{De.stateNode.nodeValue=ge?"":De.memoizedProps}catch(gt){Bn(a,a.return,gt)}}else if((De.tag!==22&&De.tag!==23||De.memoizedState===null||De===a)&&De.child!==null){De.child.return=De,De=De.child;continue}if(De===a)break e;for(;De.sibling===null;){if(De.return===null||De.return===a)break e;Ce===De&&(Ce=null),De=De.return}Ce===De&&(Ce=null),De.sibling.return=De.return,De=De.sibling}}break;case 19:Cr(l,a),Wr(a),g&4&&sb(a);break;case 21:break;default:Cr(l,a),Wr(a)}}function Wr(a){var l=a.flags;if(l&2){try{e:{for(var f=a.return;f!==null;){if(nb(f)){var g=f;break e}f=f.return}throw Error(n(160))}switch(g.tag){case 5:var x=g.stateNode;g.flags&32&&(ke(x,""),g.flags&=-33);var E=ib(a);rm(a,E,x);break;case 3:case 4:var D=g.stateNode.containerInfo,$=ib(a);im(a,$,D);break;default:throw Error(n(161))}}catch(te){Bn(a,a.return,te)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function QR(a,l,f){at=a,ob(a)}function ob(a,l,f){for(var g=(a.mode&1)!==0;at!==null;){var x=at,E=x.child;if(x.tag===22&&g){var D=x.memoizedState!==null||Sd;if(!D){var $=x.alternate,te=$!==null&&$.memoizedState!==null||_i;$=Sd;var ge=_i;if(Sd=D,(_i=te)&&!ge)for(at=x;at!==null;)D=at,te=D.child,D.tag===22&&D.memoizedState!==null?ub(x):te!==null?(te.return=D,at=te):ub(x);for(;E!==null;)at=E,ob(E),E=E.sibling;at=x,Sd=$,_i=ge}lb(a)}else(x.subtreeFlags&8772)!==0&&E!==null?(E.return=x,at=E):lb(a)}}function lb(a){for(;at!==null;){var l=at;if((l.flags&8772)!==0){var f=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:_i||wd(5,l);break;case 1:var g=l.stateNode;if(l.flags&4&&!_i)if(f===null)g.componentDidMount();else{var x=l.elementType===l.type?f.memoizedProps:Tr(l.type,f.memoizedProps);g.componentDidUpdate(x,f.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var E=l.updateQueue;E!==null&&cx(l,E,g);break;case 3:var D=l.updateQueue;if(D!==null){if(f=null,l.child!==null)switch(l.child.tag){case 5:f=l.child.stateNode;break;case 1:f=l.child.stateNode}cx(l,D,f)}break;case 5:var $=l.stateNode;if(f===null&&l.flags&4){f=$;var te=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&f.focus();break;case"img":te.src&&(f.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var ge=l.alternate;if(ge!==null){var Ce=ge.memoizedState;if(Ce!==null){var De=Ce.dehydrated;De!==null&&lc(De)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}_i||l.flags&512&&nm(l)}catch(Ae){Bn(l,l.return,Ae)}}if(l===a){at=null;break}if(f=l.sibling,f!==null){f.return=l.return,at=f;break}at=l.return}}function cb(a){for(;at!==null;){var l=at;if(l===a){at=null;break}var f=l.sibling;if(f!==null){f.return=l.return,at=f;break}at=l.return}}function ub(a){for(;at!==null;){var l=at;try{switch(l.tag){case 0:case 11:case 15:var f=l.return;try{wd(4,l)}catch(te){Bn(l,f,te)}break;case 1:var g=l.stateNode;if(typeof g.componentDidMount=="function"){var x=l.return;try{g.componentDidMount()}catch(te){Bn(l,x,te)}}var E=l.return;try{nm(l)}catch(te){Bn(l,E,te)}break;case 5:var D=l.return;try{nm(l)}catch(te){Bn(l,D,te)}}}catch(te){Bn(l,l.return,te)}if(l===a){at=null;break}var $=l.sibling;if($!==null){$.return=l.return,at=$;break}at=l.return}}var e2=Math.ceil,Ed=M.ReactCurrentDispatcher,sm=M.ReactCurrentOwner,ar=M.ReactCurrentBatchConfig,dn=0,ai=null,Wn=null,fi=0,qi=0,tl=na(0),Qn=0,kc=null,$a=0,Md=0,am=0,Lc=null,Bi=null,om=0,nl=1/0,Ms=null,Td=!1,lm=null,la=null,Ad=!1,ca=null,Cd=0,Dc=0,cm=null,Pd=-1,Rd=0;function Ai(){return(dn&6)!==0?N():Pd!==-1?Pd:Pd=N()}function ua(a){return(a.mode&1)===0?1:(dn&2)!==0&&fi!==0?fi&-fi:FR.transition!==null?(Rd===0&&(Rd=Ni()),Rd):(a=Ot,a!==0||(a=window.event,a=a===void 0?16:f_(a.type)),a)}function Pr(a,l,f,g){if(50<Dc)throw Dc=0,cm=null,Error(n(185));ji(a,f,g),((dn&2)===0||a!==ai)&&(a===ai&&((dn&2)===0&&(Md|=f),Qn===4&&da(a,fi)),zi(a,g),f===1&&dn===0&&(l.mode&1)===0&&(nl=N()+500,rd&&ra()))}function zi(a,l){var f=a.callbackNode;Mi(a,l);var g=Un(a,a===ai?fi:0);if(g===0)f!==null&&In(f),a.callbackNode=null,a.callbackPriority=0;else if(l=g&-g,a.callbackPriority!==l){if(f!=null&&In(f),l===1)a.tag===0?UR(fb.bind(null,a)):Z_(fb.bind(null,a)),LR(function(){(dn&6)===0&&ra()}),f=null;else{switch(wr(g)){case 1:f=pe;break;case 4:f=de;break;case 16:f=ce;break;case 536870912:f=qe;break;default:f=ce}f=xb(f,db.bind(null,a))}a.callbackPriority=l,a.callbackNode=f}}function db(a,l){if(Pd=-1,Rd=0,(dn&6)!==0)throw Error(n(327));var f=a.callbackNode;if(il()&&a.callbackNode!==f)return null;var g=Un(a,a===ai?fi:0);if(g===0)return null;if((g&30)!==0||(g&a.expiredLanes)!==0||l)l=kd(a,g);else{l=g;var x=dn;dn|=2;var E=pb();(ai!==a||fi!==l)&&(Ms=null,nl=N()+500,qa(a,l));do try{i2();break}catch($){hb(a,$)}while(!0);Ap(),Ed.current=E,dn=x,Wn!==null?l=0:(ai=null,fi=0,l=Qn)}if(l!==0){if(l===2&&(x=rn(a),x!==0&&(g=x,l=um(a,x))),l===1)throw f=kc,qa(a,0),da(a,g),zi(a,N()),f;if(l===6)da(a,g);else{if(x=a.current.alternate,(g&30)===0&&!t2(x)&&(l=kd(a,g),l===2&&(E=rn(a),E!==0&&(g=E,l=um(a,E))),l===1))throw f=kc,qa(a,0),da(a,g),zi(a,N()),f;switch(a.finishedWork=x,a.finishedLanes=g,l){case 0:case 1:throw Error(n(345));case 2:Ya(a,Bi,Ms);break;case 3:if(da(a,g),(g&130023424)===g&&(l=om+500-N(),10<l)){if(Un(a,0)!==0)break;if(x=a.suspendedLanes,(x&g)!==g){Ai(),a.pingedLanes|=a.suspendedLanes&x;break}a.timeoutHandle=gp(Ya.bind(null,a,Bi,Ms),l);break}Ya(a,Bi,Ms);break;case 4:if(da(a,g),(g&4194240)===g)break;for(l=a.eventTimes,x=-1;0<g;){var D=31-He(g);E=1<<D,D=l[D],D>x&&(x=D),g&=~E}if(g=x,g=N()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*e2(g/1960))-g,10<g){a.timeoutHandle=gp(Ya.bind(null,a,Bi,Ms),g);break}Ya(a,Bi,Ms);break;case 5:Ya(a,Bi,Ms);break;default:throw Error(n(329))}}}return zi(a,N()),a.callbackNode===f?db.bind(null,a):null}function um(a,l){var f=Lc;return a.current.memoizedState.isDehydrated&&(qa(a,l).flags|=256),a=kd(a,l),a!==2&&(l=Bi,Bi=f,l!==null&&dm(l)),a}function dm(a){Bi===null?Bi=a:Bi.push.apply(Bi,a)}function t2(a){for(var l=a;;){if(l.flags&16384){var f=l.updateQueue;if(f!==null&&(f=f.stores,f!==null))for(var g=0;g<f.length;g++){var x=f[g],E=x.getSnapshot;x=x.value;try{if(!Er(E(),x))return!1}catch{return!1}}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function da(a,l){for(l&=~am,l&=~Md,a.suspendedLanes|=l,a.pingedLanes&=~l,a=a.expirationTimes;0<l;){var f=31-He(l),g=1<<f;a[f]=-1,l&=~g}}function fb(a){if((dn&6)!==0)throw Error(n(327));il();var l=Un(a,0);if((l&1)===0)return zi(a,N()),null;var f=kd(a,l);if(a.tag!==0&&f===2){var g=rn(a);g!==0&&(l=g,f=um(a,g))}if(f===1)throw f=kc,qa(a,0),da(a,l),zi(a,N()),f;if(f===6)throw Error(n(345));return a.finishedWork=a.current.alternate,a.finishedLanes=l,Ya(a,Bi,Ms),zi(a,N()),null}function fm(a,l){var f=dn;dn|=1;try{return a(l)}finally{dn=f,dn===0&&(nl=N()+500,rd&&ra())}}function Xa(a){ca!==null&&ca.tag===0&&(dn&6)===0&&il();var l=dn;dn|=1;var f=ar.transition,g=Ot;try{if(ar.transition=null,Ot=1,a)return a()}finally{Ot=g,ar.transition=f,dn=l,(dn&6)===0&&ra()}}function hm(){qi=tl.current,Rn(tl)}function qa(a,l){a.finishedWork=null,a.finishedLanes=0;var f=a.timeoutHandle;if(f!==-1&&(a.timeoutHandle=-1,kR(f)),Wn!==null)for(f=Wn.return;f!==null;){var g=f;switch(Sp(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&nd();break;case 3:Jo(),Rn(Ui),Rn(gi),Ip();break;case 5:Dp(g);break;case 4:Jo();break;case 13:Rn(Fn);break;case 19:Rn(Fn);break;case 10:Cp(g.type._context);break;case 22:case 23:hm()}f=f.return}if(ai=a,Wn=a=fa(a.current,null),fi=qi=l,Qn=0,kc=null,am=Md=$a=0,Bi=Lc=null,Ga!==null){for(l=0;l<Ga.length;l++)if(f=Ga[l],g=f.interleaved,g!==null){f.interleaved=null;var x=g.next,E=f.pending;if(E!==null){var D=E.next;E.next=x,g.next=D}f.pending=g}Ga=null}return a}function hb(a,l){do{var f=Wn;try{if(Ap(),pd.current=yd,md){for(var g=On.memoizedState;g!==null;){var x=g.queue;x!==null&&(x.pending=null),g=g.next}md=!1}if(Wa=0,si=Jn=On=null,Mc=!1,Tc=0,sm.current=null,f===null||f.return===null){Qn=1,kc=l,Wn=null;break}e:{var E=a,D=f.return,$=f,te=l;if(l=fi,$.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var ge=te,Ce=$,De=Ce.tag;if((Ce.mode&1)===0&&(De===0||De===11||De===15)){var Ae=Ce.alternate;Ae?(Ce.updateQueue=Ae.updateQueue,Ce.memoizedState=Ae.memoizedState,Ce.lanes=Ae.lanes):(Ce.updateQueue=null,Ce.memoizedState=null)}var nt=Ox(D);if(nt!==null){nt.flags&=-257,Bx(nt,D,$,E,l),nt.mode&1&&Fx(E,ge,l),l=nt,te=ge;var ut=l.updateQueue;if(ut===null){var gt=new Set;gt.add(te),l.updateQueue=gt}else ut.add(te);break e}else{if((l&1)===0){Fx(E,ge,l),pm();break e}te=Error(n(426))}}else if(Dn&&$.mode&1){var Gn=Ox(D);if(Gn!==null){(Gn.flags&65536)===0&&(Gn.flags|=256),Bx(Gn,D,$,E,l),Mp(Qo(te,$));break e}}E=te=Qo(te,$),Qn!==4&&(Qn=2),Lc===null?Lc=[E]:Lc.push(E),E=D;do{switch(E.tag){case 3:E.flags|=65536,l&=-l,E.lanes|=l;var ue=Ix(E,te,l);lx(E,ue);break e;case 1:$=te;var ae=E.type,fe=E.stateNode;if((E.flags&128)===0&&(typeof ae.getDerivedStateFromError=="function"||fe!==null&&typeof fe.componentDidCatch=="function"&&(la===null||!la.has(fe)))){E.flags|=65536,l&=-l,E.lanes|=l;var Be=Ux(E,$,l);lx(E,Be);break e}}E=E.return}while(E!==null)}gb(f)}catch(St){l=St,Wn===f&&f!==null&&(Wn=f=f.return);continue}break}while(!0)}function pb(){var a=Ed.current;return Ed.current=yd,a===null?yd:a}function pm(){(Qn===0||Qn===3||Qn===2)&&(Qn=4),ai===null||($a&268435455)===0&&(Md&268435455)===0||da(ai,fi)}function kd(a,l){var f=dn;dn|=2;var g=pb();(ai!==a||fi!==l)&&(Ms=null,qa(a,l));do try{n2();break}catch(x){hb(a,x)}while(!0);if(Ap(),dn=f,Ed.current=g,Wn!==null)throw Error(n(261));return ai=null,fi=0,Qn}function n2(){for(;Wn!==null;)mb(Wn)}function i2(){for(;Wn!==null&&!Zn();)mb(Wn)}function mb(a){var l=_b(a.alternate,a,qi);a.memoizedProps=a.pendingProps,l===null?gb(a):Wn=l,sm.current=null}function gb(a){var l=a;do{var f=l.alternate;if(a=l.return,(l.flags&32768)===0){if(f=YR(f,l,qi),f!==null){Wn=f;return}}else{if(f=KR(f,l),f!==null){f.flags&=32767,Wn=f;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{Qn=6,Wn=null;return}}if(l=l.sibling,l!==null){Wn=l;return}Wn=l=a}while(l!==null);Qn===0&&(Qn=5)}function Ya(a,l,f){var g=Ot,x=ar.transition;try{ar.transition=null,Ot=1,r2(a,l,f,g)}finally{ar.transition=x,Ot=g}return null}function r2(a,l,f,g){do il();while(ca!==null);if((dn&6)!==0)throw Error(n(327));f=a.finishedWork;var x=a.finishedLanes;if(f===null)return null;if(a.finishedWork=null,a.finishedLanes=0,f===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0;var E=f.lanes|f.childLanes;if(qs(a,E),a===ai&&(Wn=ai=null,fi=0),(f.subtreeFlags&2064)===0&&(f.flags&2064)===0||Ad||(Ad=!0,xb(ce,function(){return il(),null})),E=(f.flags&15990)!==0,(f.subtreeFlags&15990)!==0||E){E=ar.transition,ar.transition=null;var D=Ot;Ot=1;var $=dn;dn|=4,sm.current=null,JR(a,f),ab(f,a),ER(pp),Hu=!!hp,pp=hp=null,a.current=f,QR(f),gn(),dn=$,Ot=D,ar.transition=E}else a.current=f;if(Ad&&(Ad=!1,ca=a,Cd=x),E=a.pendingLanes,E===0&&(la=null),ct(f.stateNode),zi(a,N()),l!==null)for(g=a.onRecoverableError,f=0;f<l.length;f++)x=l[f],g(x.value,{componentStack:x.stack,digest:x.digest});if(Td)throw Td=!1,a=lm,lm=null,a;return(Cd&1)!==0&&a.tag!==0&&il(),E=a.pendingLanes,(E&1)!==0?a===cm?Dc++:(Dc=0,cm=a):Dc=0,ra(),null}function il(){if(ca!==null){var a=wr(Cd),l=ar.transition,f=Ot;try{if(ar.transition=null,Ot=16>a?16:a,ca===null)var g=!1;else{if(a=ca,ca=null,Cd=0,(dn&6)!==0)throw Error(n(331));var x=dn;for(dn|=4,at=a.current;at!==null;){var E=at,D=E.child;if((at.flags&16)!==0){var $=E.deletions;if($!==null){for(var te=0;te<$.length;te++){var ge=$[te];for(at=ge;at!==null;){var Ce=at;switch(Ce.tag){case 0:case 11:case 15:Rc(8,Ce,E)}var De=Ce.child;if(De!==null)De.return=Ce,at=De;else for(;at!==null;){Ce=at;var Ae=Ce.sibling,nt=Ce.return;if(tb(Ce),Ce===ge){at=null;break}if(Ae!==null){Ae.return=nt,at=Ae;break}at=nt}}}var ut=E.alternate;if(ut!==null){var gt=ut.child;if(gt!==null){ut.child=null;do{var Gn=gt.sibling;gt.sibling=null,gt=Gn}while(gt!==null)}}at=E}}if((E.subtreeFlags&2064)!==0&&D!==null)D.return=E,at=D;else e:for(;at!==null;){if(E=at,(E.flags&2048)!==0)switch(E.tag){case 0:case 11:case 15:Rc(9,E,E.return)}var ue=E.sibling;if(ue!==null){ue.return=E.return,at=ue;break e}at=E.return}}var ae=a.current;for(at=ae;at!==null;){D=at;var fe=D.child;if((D.subtreeFlags&2064)!==0&&fe!==null)fe.return=D,at=fe;else e:for(D=ae;at!==null;){if($=at,($.flags&2048)!==0)try{switch($.tag){case 0:case 11:case 15:wd(9,$)}}catch(St){Bn($,$.return,St)}if($===D){at=null;break e}var Be=$.sibling;if(Be!==null){Be.return=$.return,at=Be;break e}at=$.return}}if(dn=x,ra(),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(Ge,a)}catch{}g=!0}return g}finally{Ot=f,ar.transition=l}}return!1}function vb(a,l,f){l=Qo(f,l),l=Ix(a,l,1),a=aa(a,l,1),l=Ai(),a!==null&&(ji(a,1,l),zi(a,l))}function Bn(a,l,f){if(a.tag===3)vb(a,a,f);else for(;l!==null;){if(l.tag===3){vb(l,a,f);break}else if(l.tag===1){var g=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(la===null||!la.has(g))){a=Qo(f,a),a=Ux(l,a,1),l=aa(l,a,1),a=Ai(),l!==null&&(ji(l,1,a),zi(l,a));break}}l=l.return}}function s2(a,l,f){var g=a.pingCache;g!==null&&g.delete(l),l=Ai(),a.pingedLanes|=a.suspendedLanes&f,ai===a&&(fi&f)===f&&(Qn===4||Qn===3&&(fi&130023424)===fi&&500>N()-om?qa(a,0):am|=f),zi(a,l)}function yb(a,l){l===0&&((a.mode&1)===0?l=1:(l=vn,vn<<=1,(vn&130023424)===0&&(vn=4194304)));var f=Ai();a=Ss(a,l),a!==null&&(ji(a,l,f),zi(a,f))}function a2(a){var l=a.memoizedState,f=0;l!==null&&(f=l.retryLane),yb(a,f)}function o2(a,l){var f=0;switch(a.tag){case 13:var g=a.stateNode,x=a.memoizedState;x!==null&&(f=x.retryLane);break;case 19:g=a.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(l),yb(a,f)}var _b;_b=function(a,l,f){if(a!==null)if(a.memoizedProps!==l.pendingProps||Ui.current)Oi=!0;else{if((a.lanes&f)===0&&(l.flags&128)===0)return Oi=!1,qR(a,l,f);Oi=(a.flags&131072)!==0}else Oi=!1,Dn&&(l.flags&1048576)!==0&&J_(l,ad,l.index);switch(l.lanes=0,l.tag){case 2:var g=l.type;bd(a,l),a=l.pendingProps;var x=Wo(l,gi.current);Zo(l,f),x=Op(null,l,g,a,x,f);var E=Bp();return l.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Fi(g)?(E=!0,id(l)):E=!1,l.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,kp(l),x.updater=_d,l.stateNode=x,x._reactInternals=l,Wp(l,g,a,f),l=Yp(null,l,g,!0,E,f)):(l.tag=0,Dn&&E&&bp(l),Ti(null,l,x,f),l=l.child),l;case 16:g=l.elementType;e:{switch(bd(a,l),a=l.pendingProps,x=g._init,g=x(g._payload),l.type=g,x=l.tag=c2(g),a=Tr(g,a),x){case 0:l=qp(null,l,g,a,f);break e;case 1:l=Wx(null,l,g,a,f);break e;case 11:l=zx(null,l,g,a,f);break e;case 14:l=Vx(null,l,g,Tr(g.type,a),f);break e}throw Error(n(306,g,""))}return l;case 0:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),qp(a,l,g,x,f);case 1:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),Wx(a,l,g,x,f);case 3:e:{if($x(l),a===null)throw Error(n(387));g=l.pendingProps,E=l.memoizedState,x=E.element,ox(a,l),fd(l,g,null,f);var D=l.memoizedState;if(g=D.element,E.isDehydrated)if(E={element:g,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},l.updateQueue.baseState=E,l.memoizedState=E,l.flags&256){x=Qo(Error(n(423)),l),l=Xx(a,l,g,f,x);break e}else if(g!==x){x=Qo(Error(n(424)),l),l=Xx(a,l,g,f,x);break e}else for(Xi=ta(l.stateNode.containerInfo.firstChild),$i=l,Dn=!0,Mr=null,f=sx(l,null,g,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(qo(),g===x){l=Es(a,l,f);break e}Ti(a,l,g,f)}l=l.child}return l;case 5:return ux(l),a===null&&Ep(l),g=l.type,x=l.pendingProps,E=a!==null?a.memoizedProps:null,D=x.children,mp(g,x)?D=null:E!==null&&mp(g,E)&&(l.flags|=32),jx(a,l),Ti(a,l,D,f),l.child;case 6:return a===null&&Ep(l),null;case 13:return qx(a,l,f);case 4:return Lp(l,l.stateNode.containerInfo),g=l.pendingProps,a===null?l.child=Yo(l,null,g,f):Ti(a,l,g,f),l.child;case 11:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),zx(a,l,g,x,f);case 7:return Ti(a,l,l.pendingProps,f),l.child;case 8:return Ti(a,l,l.pendingProps.children,f),l.child;case 12:return Ti(a,l,l.pendingProps.children,f),l.child;case 10:e:{if(g=l.type._context,x=l.pendingProps,E=l.memoizedProps,D=x.value,Cn(cd,g._currentValue),g._currentValue=D,E!==null)if(Er(E.value,D)){if(E.children===x.children&&!Ui.current){l=Es(a,l,f);break e}}else for(E=l.child,E!==null&&(E.return=l);E!==null;){var $=E.dependencies;if($!==null){D=E.child;for(var te=$.firstContext;te!==null;){if(te.context===g){if(E.tag===1){te=ws(-1,f&-f),te.tag=2;var ge=E.updateQueue;if(ge!==null){ge=ge.shared;var Ce=ge.pending;Ce===null?te.next=te:(te.next=Ce.next,Ce.next=te),ge.pending=te}}E.lanes|=f,te=E.alternate,te!==null&&(te.lanes|=f),Pp(E.return,f,l),$.lanes|=f;break}te=te.next}}else if(E.tag===10)D=E.type===l.type?null:E.child;else if(E.tag===18){if(D=E.return,D===null)throw Error(n(341));D.lanes|=f,$=D.alternate,$!==null&&($.lanes|=f),Pp(D,f,l),D=E.sibling}else D=E.child;if(D!==null)D.return=E;else for(D=E;D!==null;){if(D===l){D=null;break}if(E=D.sibling,E!==null){E.return=D.return,D=E;break}D=D.return}E=D}Ti(a,l,x.children,f),l=l.child}return l;case 9:return x=l.type,g=l.pendingProps.children,Zo(l,f),x=rr(x),g=g(x),l.flags|=1,Ti(a,l,g,f),l.child;case 14:return g=l.type,x=Tr(g,l.pendingProps),x=Tr(g.type,x),Vx(a,l,g,x,f);case 15:return Hx(a,l,l.type,l.pendingProps,f);case 17:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),bd(a,l),l.tag=1,Fi(g)?(a=!0,id(l)):a=!1,Zo(l,f),Dx(l,g,x),Wp(l,g,x,f),Yp(null,l,g,!0,a,f);case 19:return Kx(a,l,f);case 22:return Gx(a,l,f)}throw Error(n(156,l.tag))};function xb(a,l){return En(a,l)}function l2(a,l,f,g){this.tag=a,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function or(a,l,f,g){return new l2(a,l,f,g)}function mm(a){return a=a.prototype,!(!a||!a.isReactComponent)}function c2(a){if(typeof a=="function")return mm(a)?1:0;if(a!=null){if(a=a.$$typeof,a===G)return 11;if(a===X)return 14}return 2}function fa(a,l){var f=a.alternate;return f===null?(f=or(a.tag,l,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=l,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&14680064,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,l=a.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f}function Ld(a,l,f,g,x,E){var D=2;if(g=a,typeof a=="function")mm(a)&&(D=1);else if(typeof a=="string")D=5;else e:switch(a){case U:return Ka(f.children,x,E,l);case S:D=8,x|=8;break;case P:return a=or(12,f,l,x|2),a.elementType=P,a.lanes=E,a;case J:return a=or(13,f,l,x),a.elementType=J,a.lanes=E,a;case H:return a=or(19,f,l,x),a.elementType=H,a.lanes=E,a;case Q:return Dd(f,x,E,l);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case V:D=10;break e;case O:D=9;break e;case G:D=11;break e;case X:D=14;break e;case K:D=16,g=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return l=or(D,f,l,x),l.elementType=a,l.type=g,l.lanes=E,l}function Ka(a,l,f,g){return a=or(7,a,g,l),a.lanes=f,a}function Dd(a,l,f,g){return a=or(22,a,g,l),a.elementType=Q,a.lanes=f,a.stateNode={isHidden:!1},a}function gm(a,l,f){return a=or(6,a,null,l),a.lanes=f,a}function vm(a,l,f){return l=or(4,a.children!==null?a.children:[],a.key,l),l.lanes=f,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}function u2(a,l,f,g,x){this.tag=l,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ii(0),this.expirationTimes=Ii(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ii(0),this.identifierPrefix=g,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function ym(a,l,f,g,x,E,D,$,te){return a=new u2(a,l,f,$,te),l===1?(l=1,E===!0&&(l|=8)):l=0,E=or(3,null,null,l),a.current=E,E.stateNode=a,E.memoizedState={element:g,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null},kp(E),a}function d2(a,l,f){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:k,key:g==null?null:""+g,children:a,containerInfo:l,implementation:f}}function bb(a){if(!a)return ia;a=a._reactInternals;e:{if(Qe(a)!==a||a.tag!==1)throw Error(n(170));var l=a;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Fi(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(a.tag===1){var f=a.type;if(Fi(f))return Y_(a,f,l)}return l}function Sb(a,l,f,g,x,E,D,$,te){return a=ym(f,g,!0,a,x,E,D,$,te),a.context=bb(null),f=a.current,g=Ai(),x=ua(f),E=ws(g,x),E.callback=l??null,aa(f,E,x),a.current.lanes=x,ji(a,x,g),zi(a,g),a}function Nd(a,l,f,g){var x=l.current,E=Ai(),D=ua(x);return f=bb(f),l.context===null?l.context=f:l.pendingContext=f,l=ws(E,D),l.payload={element:a},g=g===void 0?null:g,g!==null&&(l.callback=g),a=aa(x,l,D),a!==null&&(Pr(a,x,D,E),dd(a,x,D)),D}function Id(a){return a=a.current,a.child?(a.child.tag===5,a.child.stateNode):null}function wb(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<l?f:l}}function _m(a,l){wb(a,l),(a=a.alternate)&&wb(a,l)}function f2(){return null}var Eb=typeof reportError=="function"?reportError:function(a){console.error(a)};function xm(a){this._internalRoot=a}Ud.prototype.render=xm.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(n(409));Nd(a,l,null,null)},Ud.prototype.unmount=xm.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;Xa(function(){Nd(null,a,null,null)}),l[ys]=null}};function Ud(a){this._internalRoot=a}Ud.prototype.unstable_scheduleHydration=function(a){if(a){var l=ic();a={blockedOn:null,target:a,priority:l};for(var f=0;f<Js.length&&l!==0&&l<Js[f].priority;f++);Js.splice(f,0,a),f===0&&u_(a)}};function bm(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function Fd(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function Mb(){}function h2(a,l,f,g,x){if(x){if(typeof g=="function"){var E=g;g=function(){var ge=Id(D);E.call(ge)}}var D=Sb(l,g,a,0,null,!1,!1,"",Mb);return a._reactRootContainer=D,a[ys]=D.current,vc(a.nodeType===8?a.parentNode:a),Xa(),D}for(;x=a.lastChild;)a.removeChild(x);if(typeof g=="function"){var $=g;g=function(){var ge=Id(te);$.call(ge)}}var te=ym(a,0,!1,null,null,!1,!1,"",Mb);return a._reactRootContainer=te,a[ys]=te.current,vc(a.nodeType===8?a.parentNode:a),Xa(function(){Nd(l,te,f,g)}),te}function Od(a,l,f,g,x){var E=f._reactRootContainer;if(E){var D=E;if(typeof x=="function"){var $=x;x=function(){var te=Id(D);$.call(te)}}Nd(l,D,a,x)}else D=h2(f,l,a,x,g);return Id(D)}Hn=function(a){switch(a.tag){case 3:var l=a.stateNode;if(l.current.memoizedState.isDehydrated){var f=tn(l.pendingLanes);f!==0&&(xn(l,f|1),zi(l,N()),(dn&6)===0&&(nl=N()+500,ra()))}break;case 13:Xa(function(){var g=Ss(a,1);if(g!==null){var x=Ai();Pr(g,a,1,x)}}),_m(a,1)}},tr=function(a){if(a.tag===13){var l=Ss(a,134217728);if(l!==null){var f=Ai();Pr(l,a,134217728,f)}_m(a,134217728)}},vs=function(a){if(a.tag===13){var l=ua(a),f=Ss(a,l);if(f!==null){var g=Ai();Pr(f,a,l,g)}_m(a,l)}},ic=function(){return Ot},l_=function(a,l){var f=Ot;try{return Ot=a,l()}finally{Ot=f}},Ve=function(a,l,f){switch(l){case"input":if(an(a,f),l=f.name,f.type==="radio"&&l!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<f.length;l++){var g=f[l];if(g!==a&&g.form===a.form){var x=td(g);if(!x)throw Error(n(90));pn(g),an(g,x)}}}break;case"textarea":R(a,f);break;case"select":l=f.value,l!=null&&Lt(a,!!f.multiple,l,!1)}},Nt=fm,mn=Xa;var p2={usingClientEntryPoint:!1,Events:[xc,Go,td,_e,st,fm]},Nc={findFiberByHostInstance:Ba,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},m2={bundleType:Nc.bundleType,version:Nc.version,rendererPackageName:Nc.rendererPackageName,rendererConfig:Nc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){return a=un(a),a===null?null:a.stateNode},findFiberByHostInstance:Nc.findFiberByHostInstance||f2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bd.isDisabled&&Bd.supportsFiber)try{Ge=Bd.inject(m2),We=Bd}catch{}}return Vi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=p2,Vi.createPortal=function(a,l){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bm(l))throw Error(n(200));return d2(a,l,null,f)},Vi.createRoot=function(a,l){if(!bm(a))throw Error(n(299));var f=!1,g="",x=Eb;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onRecoverableError!==void 0&&(x=l.onRecoverableError)),l=ym(a,1,!1,null,null,f,!1,g,x),a[ys]=l.current,vc(a.nodeType===8?a.parentNode:a),new xm(l)},Vi.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=un(l),a=a===null?null:a.stateNode,a},Vi.flushSync=function(a){return Xa(a)},Vi.hydrate=function(a,l,f){if(!Fd(l))throw Error(n(200));return Od(null,a,l,!0,f)},Vi.hydrateRoot=function(a,l,f){if(!bm(a))throw Error(n(405));var g=f!=null&&f.hydratedSources||null,x=!1,E="",D=Eb;if(f!=null&&(f.unstable_strictMode===!0&&(x=!0),f.identifierPrefix!==void 0&&(E=f.identifierPrefix),f.onRecoverableError!==void 0&&(D=f.onRecoverableError)),l=Sb(l,null,a,1,f??null,x,!1,E,D),a[ys]=l.current,vc(a),g)for(a=0;a<g.length;a++)f=g[a],x=f._getVersion,x=x(f._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[f,x]:l.mutableSourceEagerHydrationData.push(f,x);return new Ud(l)},Vi.render=function(a,l,f){if(!Fd(l))throw Error(n(200));return Od(null,a,l,!1,f)},Vi.unmountComponentAtNode=function(a){if(!Fd(a))throw Error(n(40));return a._reactRootContainer?(Xa(function(){Od(null,null,a,!1,function(){a._reactRootContainer=null,a[ys]=null})}),!0):!1},Vi.unstable_batchedUpdates=fm,Vi.unstable_renderSubtreeIntoContainer=function(a,l,f,g){if(!Fd(f))throw Error(n(200));if(a==null||a._reactInternals===void 0)throw Error(n(38));return Od(a,l,f,!1,g)},Vi.version="18.3.1-next-f1338f8080-20240426",Vi}var Db;function zE(){if(Db)return Em.exports;Db=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Em.exports=E2(),Em.exports}var Nb;function M2(){if(Nb)return zd;Nb=1;var t=zE();return zd.createRoot=t.createRoot,zd.hydrateRoot=t.hydrateRoot,zd}var T2=M2();var VE=t=>{throw TypeError(t)},A2=(t,e,n)=>e.has(t)||VE("Cannot "+n),Am=(t,e,n)=>(A2(t,e,"read from private field"),n?n.call(t):e.get(t)),C2=(t,e,n)=>e.has(t)?VE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ib="popstate";function Ub(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function P2(t={}){function e(i,r){let s=r.state?.masked,{pathname:o,search:c,hash:u}=s||i.location;return du("",{pathname:o,search:c,hash:u},r.state&&r.state.usr||null,r.state&&r.state.key||"default",s?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:ss(r)}return k2(e,n,null,t)}function Qt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function jn(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function R2(){return Math.random().toString(36).substring(2,10)}function Fb(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function du(t,e,n=null,i,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?js(e):e,state:n,key:e&&e.key||i||R2(),unstable_mask:r}}function ss({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function js(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let i=t.indexOf("?");i>=0&&(e.search=t.substring(i),t=t.substring(0,i)),t&&(e.pathname=t)}return e}function k2(t,e,n,i={}){let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,c="POP",u=null,d=h();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function h(){return(o.state||{idx:null}).idx}function p(){c="POP";let y=h(),b=y==null?null:y-d;d=y,u&&u({action:c,location:w.location,delta:b})}function m(y,b){c="PUSH";let T=Ub(y)?y:du(w.location,y,b);d=h()+1;let A=Fb(T,d),M=w.createHref(T.unstable_mask||T);try{o.pushState(A,"",M)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;r.location.assign(M)}s&&u&&u({action:c,location:w.location,delta:1})}function v(y,b){c="REPLACE";let T=Ub(y)?y:du(w.location,y,b);d=h();let A=Fb(T,d),M=w.createHref(T.unstable_mask||T);o.replaceState(A,"",M),s&&u&&u({action:c,location:w.location,delta:0})}function _(y){return HE(y)}let w={get action(){return c},get location(){return t(r,o)},listen(y){if(u)throw new Error("A history only accepts one active listener");return r.addEventListener(Ib,p),u=y,()=>{r.removeEventListener(Ib,p),u=null}},createHref(y){return e(r,y)},createURL:_,encodeLocation(y){let b=_(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:m,replace:v,go(y){return o.go(y)}};return w}function HE(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Qt(n,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:ss(t);return i=i.replace(/ $/,"%20"),!e&&i.startsWith("//")&&(i=n+i),new URL(i,n)}var Kc,Ob=class{constructor(t){if(C2(this,Kc,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(Am(this,Kc).has(t))return Am(this,Kc).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){Am(this,Kc).set(t,e)}};Kc=new WeakMap;var L2=new Set(["lazy","caseSensitive","path","id","index","children"]);function D2(t){return L2.has(t)}var N2=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function I2(t){return N2.has(t)}function U2(t){return t.index===!0}function fu(t,e,n=[],i={},r=!1){return t.map((s,o)=>{let c=[...n,String(o)],u=typeof s.id=="string"?s.id:c.join("-");if(Qt(s.index!==!0||!s.children,"Cannot specify children on an index route"),Qt(r||!i[u],`Found a route id collision on id "${u}". Route id's must be globally unique within Data Router usages`),U2(s)){let d={...s,id:u};return i[u]=Bb(d,e(d)),d}else{let d={...s,id:u,children:void 0};return i[u]=Bb(d,e(d)),s.children&&(d.children=fu(s.children,e,c,i,r)),d}})}function Bb(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function Ea(t,e,n="/"){return Zc(t,e,n,!1)}function Zc(t,e,n,i){let r=typeof e=="string"?js(e):e,s=mr(r.pathname||"/",n);if(s==null)return null;let o=GE(t);O2(o);let c=null;for(let u=0;c==null&&u<o.length;++u){let d=Y2(s);c=X2(o[u],d,i)}return c}function F2(t,e){let{route:n,pathname:i,params:r}=t;return{id:n.id,pathname:i,params:r,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function GE(t,e=[],n=[],i="",r=!1){let s=(o,c,u=r,d)=>{let h={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(i)&&u)return;Qt(h.relativePath.startsWith(i),`Absolute route path "${h.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(i.length)}let p=Br([i,h.relativePath]),m=n.concat(h);o.children&&o.children.length>0&&(Qt(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),GE(o.children,e,m,p,u)),!(o.path==null&&!o.index)&&e.push({path:p,score:W2(p,o.index),routesMeta:m})};return t.forEach((o,c)=>{if(o.path===""||!o.path?.includes("?"))s(o,c);else for(let u of jE(o.path))s(o,c,!0,u)}),e}function jE(t){let e=t.split("/");if(e.length===0)return[];let[n,...i]=e,r=n.endsWith("?"),s=n.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let o=jE(i.join("/")),c=[];return c.push(...o.map(u=>u===""?s:[s,u].join("/"))),r&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function O2(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:$2(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var B2=/^:[\w-]+$/,z2=3,V2=2,H2=1,G2=10,j2=-2,zb=t=>t==="*";function W2(t,e){let n=t.split("/"),i=n.length;return n.some(zb)&&(i+=j2),e&&(i+=V2),n.filter(r=>!zb(r)).reduce((r,s)=>r+(B2.test(s)?z2:s===""?H2:G2),i)}function $2(t,e){return t.length===e.length&&t.slice(0,-1).every((i,r)=>i===e[r])?t[t.length-1]-e[e.length-1]:0}function X2(t,e,n=!1){let{routesMeta:i}=t,r={},s="/",o=[];for(let c=0;c<i.length;++c){let u=i[c],d=c===i.length-1,h=s==="/"?e:e.slice(s.length)||"/",p=Kf({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},h),m=u.route;if(!p&&d&&n&&!i[i.length-1].route.index&&(p=Kf({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!p)return null;Object.assign(r,p.params),o.push({params:r,pathname:Br([s,p.pathname]),pathnameBase:J2(Br([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=Br([s,p.pathnameBase]))}return o}function Kf(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,i]=q2(t.path,t.caseSensitive,t.end),r=e.match(n);if(!r)return null;let s=r[0],o=s.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:i.reduce((d,{paramName:h,isOptional:p},m)=>{if(h==="*"){let _=c[m]||"";o=s.slice(0,s.length-_.length).replace(/(.)\/+$/,"$1")}const v=c[m];return p&&!v?d[h]=void 0:d[h]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:t}}function q2(t,e=!1,n=!0){jn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let i=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u,d,h)=>{if(i.push({paramName:c,isOptional:u!=null}),u){let p=h.charAt(d+o.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(i.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function Y2(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return jn(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function mr(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,i=t.charAt(n);return i&&i!=="/"?null:t.slice(n)||"/"}function K2({basename:t,pathname:e}){return e==="/"?t:Br([t,e])}var WE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Bv=t=>WE.test(t);function Z2(t,e="/"){let{pathname:n,search:i="",hash:r=""}=typeof t=="string"?js(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=Vb(n.substring(1),"/"):s=Vb(n,e)):s=e,{pathname:s,search:Q2(i),hash:ek(r)}}function Vb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Cm(t,e,n,i){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function $E(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function zv(t){let e=$E(t);return e.map((n,i)=>i===e.length-1?n.pathname:n.pathnameBase)}function Ah(t,e,n,i=!1){let r;typeof t=="string"?r=js(t):(r={...t},Qt(!r.pathname||!r.pathname.includes("?"),Cm("?","pathname","search",r)),Qt(!r.pathname||!r.pathname.includes("#"),Cm("#","pathname","hash",r)),Qt(!r.search||!r.search.includes("#"),Cm("#","search","hash",r)));let s=t===""||r.pathname==="",o=s?"/":r.pathname,c;if(o==null)c=n;else{let p=e.length-1;if(!i&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),p-=1;r.pathname=m.join("/")}c=p>=0?e[p]:"/"}let u=Z2(r,c),d=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(d||h)&&(u.pathname+="/"),u}var Br=t=>t.join("/").replace(/\/\/+/g,"/"),J2=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Q2=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ek=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,wu=class{constructor(t,e,n,i=!1){this.status=t,this.statusText=e||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function hu(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Eu(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var XE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qE(t,e){let n=t;if(typeof n!="string"||!WE.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(XE)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),c=mr(o.pathname,e);o.origin===s.origin&&c!=null?n=c+o.search+o.hash:r=!0}catch{jn(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}var Pa=Symbol("Uninstrumented");function tk(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(r=>r({id:e.id,index:e.index,path:e.path,instrument(s){let o=Object.keys(n);for(let c of o)s[c]&&n[c].push(s[c])}}));let i={};if(typeof e.lazy=="function"&&n.lazy.length>0){let r=Cl(n.lazy,e.lazy,()=>{});r&&(i.lazy=r)}if(typeof e.lazy=="object"){let r=e.lazy;["middleware","loader","action"].forEach(s=>{let o=r[s],c=n[`lazy.${s}`];if(typeof o=="function"&&c.length>0){let u=Cl(c,o,()=>{});u&&(i.lazy=Object.assign(i.lazy||{},{[s]:u}))}})}return["loader","action"].forEach(r=>{let s=e[r];if(typeof s=="function"&&n[r].length>0){let o=s[Pa]??s,c=Cl(n[r],o,(...u)=>Hb(u[0]));c&&(r==="loader"&&o.hydrate===!0&&(c.hydrate=!0),c[Pa]=o,i[r]=c)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(i.middleware=e.middleware.map(r=>{let s=r[Pa]??r,o=Cl(n.middleware,s,(...c)=>Hb(c[0]));return o?(o[Pa]=s,o):r})),i}function nk(t,e){let n={navigate:[],fetch:[]};if(e.forEach(i=>i({instrument(r){let s=Object.keys(r);for(let o of s)r[o]&&n[o].push(r[o])}})),n.navigate.length>0){let i=t.navigate[Pa]??t.navigate,r=Cl(n.navigate,i,(...s)=>{let[o,c]=s;return{to:typeof o=="number"||typeof o=="string"?o:o?ss(o):".",...Gb(t,c??{})}});r&&(r[Pa]=i,t.navigate=r)}if(n.fetch.length>0){let i=t.fetch[Pa]??t.fetch,r=Cl(n.fetch,i,(...s)=>{let[o,,c,u]=s;return{href:c??".",fetcherKey:o,...Gb(t,u??{})}});r&&(r[Pa]=i,t.fetch=r)}return t}function Cl(t,e,n){return t.length===0?null:async(...i)=>{let r=await YE(t,n(...i),()=>e(...i),t.length-1);if(r.type==="error")throw r.value;return r.value}}async function YE(t,e,n,i){let r=t[i],s;if(r){let o,c=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=YE(t,e,n,i-1),s=await o,Qt(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await r(c,e)}catch(u){console.error("An instrumentation function threw an error:",u)}o||await c(),await o}else try{s={type:"success",value:await n()}}catch(o){s={type:"error",value:o}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Hb(t){let{request:e,context:n,params:i,unstable_pattern:r}=t;return{request:ik(e),params:{...i},unstable_pattern:r,context:rk(n)}}function Gb(t,e){return{currentUrl:ss(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function ik(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function rk(t){if(ak(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var sk=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ak(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===sk}var KE=["POST","PUT","PATCH","DELETE"],ok=new Set(KE),lk=["GET",...KE],ck=new Set(lk),ZE=new Set([301,302,303,307,308]),uk=new Set([307,308]),Pm={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},dk={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Uc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},fk=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),JE="remix-router-transitions",QE=Symbol("ResetLoaderData");function hk(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";Qt(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i=t.hydrationRouteProperties||[],r=t.mapRouteProperties||fk,s=r;if(t.unstable_instrumentations){let Y=t.unstable_instrumentations;s=le=>({...r(le),...tk(Y.map(he=>he.route).filter(Boolean),le)})}let o={},c=fu(t.routes,s,void 0,o),u,d=t.basename||"/";d.startsWith("/")||(d=`/${d}`);let h=t.dataStrategy||yk,p={...t.future},m=null,v=new Set,_=null,w=null,y=null,b=t.hydrationData!=null,T=Ea(c,t.history.location,d),A=!1,M=null,I,k;if(T==null&&!t.patchRoutesOnNavigation){let Y=cr(404,{pathname:t.history.location.pathname}),{matches:le,route:he}=Vd(c);I=!0,k=!I,T=le,M={[he.id]:Y}}else if(T&&!t.hydrationData&&Kt(T,c,t.history.location.pathname).active&&(T=null),T)if(T.some(Y=>Y.route.lazy))I=!1,k=!I;else if(!T.some(Y=>Vv(Y.route)))I=!0,k=!I;else{let Y=t.hydrationData?t.hydrationData.loaderData:null,le=t.hydrationData?t.hydrationData.errors:null,he=T;if(le){let Me=T.findIndex(Ie=>le[Ie.route.id]!==void 0);he=he.slice(0,Me+1)}k=!1,I=he.every(Me=>{let Ie=eM(Me.route,Y,le);return k=k||Ie.renderFallback,!Ie.shouldLoad})}else{I=!1,k=!I,T=[];let Y=Kt(null,c,t.history.location.pathname);Y.active&&Y.matches&&(A=!0,T=Y.matches)}let U,S={historyAction:t.history.action,location:t.history.location,matches:T,initialized:I,renderFallback:k,navigation:Pm,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||M,fetchers:new Map,blockers:new Map},P="POP",V=null,O=!1,G,J=!1,H=new Map,X=null,K=!1,Q=!1,W=new Set,q=new Map,Z=0,z=-1,ie=new Map,Ee=new Set,ze=new Map,Se=new Map,ne=new Set,ye=new Map,be,Ne=null;function et(){if(m=t.history.listen(({action:Y,location:le,delta:he})=>{if(be){be(),be=void 0;return}jn(ye.size===0||he!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Me=Xe({currentLocation:S.location,nextLocation:le,historyAction:Y});if(Me&&he!=null){let Ie=new Promise(vt=>{be=vt});t.history.go(he*-1),Le(Me,{state:"blocked",location:le,proceed(){Le(Me,{state:"proceeding",proceed:void 0,reset:void 0,location:le}),Ie.then(()=>t.history.go(he))},reset(){let vt=new Map(S.blockers);vt.set(Me,Uc),ht({blockers:vt})}}),V?.resolve(),V=null;return}return an(Y,le)}),n){Uk(e,H);let Y=()=>Fk(e,H);e.addEventListener("pagehide",Y),X=()=>e.removeEventListener("pagehide",Y)}return S.initialized||an("POP",S.location,{initialHydration:!0}),U}function xt(){m&&m(),X&&X(),v.clear(),G&&G.abort(),S.fetchers.forEach((Y,le)=>Pe(le)),S.blockers.forEach((Y,le)=>Ve(le))}function pn(Y){return v.add(Y),()=>v.delete(Y)}function ht(Y,le={}){Y.matches&&(Y.matches=Y.matches.map(Ie=>{let vt=o[Ie.route.id],tt=Ie.route;return tt.element!==vt.element||tt.errorElement!==vt.errorElement||tt.hydrateFallbackElement!==vt.hydrateFallbackElement?{...Ie,route:vt}:Ie})),S={...S,...Y};let he=[],Me=[];S.fetchers.forEach((Ie,vt)=>{Ie.state==="idle"&&(ne.has(vt)?he.push(vt):Me.push(vt))}),ne.forEach(Ie=>{!S.fetchers.has(Ie)&&!q.has(Ie)&&he.push(Ie)}),[...v].forEach(Ie=>Ie(S,{deletedFetchers:he,newErrors:Y.errors??null,viewTransitionOpts:le.viewTransitionOpts,flushSync:le.flushSync===!0})),he.forEach(Ie=>Pe(Ie)),Me.forEach(Ie=>S.fetchers.delete(Ie))}function Ft(Y,le,{flushSync:he}={}){let Me=S.actionData!=null&&S.navigation.formMethod!=null&&Si(S.navigation.formMethod)&&S.navigation.state==="loading"&&Y.state?._isRedirect!==!0,Ie;le.actionData?Object.keys(le.actionData).length>0?Ie=le.actionData:Ie=null:Me?Ie=S.actionData:Ie=null;let vt=le.loaderData?Qb(S.loaderData,le.loaderData,le.matches||[],le.errors):S.loaderData,tt=S.blockers;tt.size>0&&(tt=new Map(tt),tt.forEach((Tt,bt)=>tt.set(bt,Uc)));let yt=K?!1:mn(Y,le.matches||S.matches),Qe=O===!0||S.navigation.formMethod!=null&&Si(S.navigation.formMethod)&&Y.state?._isRedirect!==!0;u&&(c=u,u=void 0),K||P==="POP"||(P==="PUSH"?t.history.push(Y,Y.state):P==="REPLACE"&&t.history.replace(Y,Y.state));let Et;if(P==="POP"){let Tt=H.get(S.location.pathname);Tt&&Tt.has(Y.pathname)?Et={currentLocation:S.location,nextLocation:Y}:H.has(Y.pathname)&&(Et={currentLocation:Y,nextLocation:S.location})}else if(J){let Tt=H.get(S.location.pathname);Tt?Tt.add(Y.pathname):(Tt=new Set([Y.pathname]),H.set(S.location.pathname,Tt)),Et={currentLocation:S.location,nextLocation:Y}}ht({...le,actionData:Ie,loaderData:vt,historyAction:P,location:Y,initialized:!0,renderFallback:!1,navigation:Pm,revalidation:"idle",restoreScrollPosition:yt,preventScrollReset:Qe,blockers:tt},{viewTransitionOpts:Et,flushSync:he===!0}),P="POP",O=!1,J=!1,K=!1,Q=!1,V?.resolve(),V=null,Ne?.resolve(),Ne=null}async function nn(Y,le){if(V?.resolve(),V=null,typeof Y=="number"){V||(V=iS());let En=V.promise;return t.history.go(Y),En}let he=Wg(S.location,S.matches,d,Y,le?.fromRouteId,le?.relative),{path:Me,submission:Ie,error:vt}=jb(!1,he,le),tt;le?.unstable_mask&&(tt={pathname:"",search:"",hash:"",...typeof le.unstable_mask=="string"?js(le.unstable_mask):{...S.location.unstable_mask,...le.unstable_mask}});let yt=S.location,Qe=du(yt,Me,le&&le.state,void 0,tt);Qe={...Qe,...t.history.encodeLocation(Qe)};let Et=le&&le.replace!=null?le.replace:void 0,Tt="PUSH";Et===!0?Tt="REPLACE":Et===!1||Ie!=null&&Si(Ie.formMethod)&&Ie.formAction===S.location.pathname+S.location.search&&(Tt="REPLACE");let bt=le&&"preventScrollReset"in le?le.preventScrollReset===!0:void 0,un=(le&&le.flushSync)===!0,en=Xe({currentLocation:yt,nextLocation:Qe,historyAction:Tt});if(en){Le(en,{state:"blocked",location:Qe,proceed(){Le(en,{state:"proceeding",proceed:void 0,reset:void 0,location:Qe}),nn(Y,le)},reset(){let En=new Map(S.blockers);En.set(en,Uc),ht({blockers:En})}});return}await an(Tt,Qe,{submission:Ie,pendingError:vt,preventScrollReset:bt,replace:le&&le.replace,enableViewTransition:le&&le.viewTransition,flushSync:un,callSiteDefaultShouldRevalidate:le&&le.unstable_defaultShouldRevalidate})}function Dt(){Ne||(Ne=iS()),ve(),ht({revalidation:"loading"});let Y=Ne.promise;return S.navigation.state==="submitting"?Y:S.navigation.state==="idle"?(an(S.historyAction,S.location,{startUninterruptedRevalidation:!0}),Y):(an(P||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation,enableViewTransition:J===!0}),Y)}async function an(Y,le,he){G&&G.abort(),G=null,P=Y,K=(he&&he.startUninterruptedRevalidation)===!0,Nt(S.location,S.matches),O=(he&&he.preventScrollReset)===!0,J=(he&&he.enableViewTransition)===!0;let Me=u||c,Ie=he&&he.overrideNavigation,vt=he?.initialHydration&&S.matches&&S.matches.length>0&&!A?S.matches:Ea(Me,le,d),tt=(he&&he.flushSync)===!0;if(vt&&S.initialized&&!Q&&Tk(S.location,le)&&!(he&&he.submission&&Si(he.submission.formMethod))){Ft(le,{matches:vt},{flushSync:tt});return}let yt=Kt(vt,Me,le.pathname);if(yt.active&&yt.matches&&(vt=yt.matches),!vt){let{error:In,notFoundMatches:Zn,route:gn}=Re(le.pathname);Ft(le,{matches:Zn,loaderData:{},errors:{[gn.id]:In}},{flushSync:tt});return}G=new AbortController;let Qe=wl(t.history,le,G.signal,he&&he.submission),Et=t.getContext?await t.getContext():new Ob,Tt;if(he&&he.pendingError)Tt=[Ma(vt).route.id,{type:"error",error:he.pendingError}];else if(he&&he.submission&&Si(he.submission.formMethod)){let In=await ee(Qe,le,he.submission,vt,Et,yt.active,he&&he.initialHydration===!0,{replace:he.replace,flushSync:tt});if(In.shortCircuited)return;if(In.pendingActionResult){let[Zn,gn]=In.pendingActionResult;if(Ji(gn)&&hu(gn.error)&&gn.error.status===404){G=null,Ft(le,{matches:In.matches,loaderData:{},errors:{[Zn]:gn.error}});return}}vt=In.matches||vt,Tt=In.pendingActionResult,Ie=Rm(le,he.submission),tt=!1,yt.active=!1,Qe=wl(t.history,Qe.url,Qe.signal)}let{shortCircuited:bt,matches:un,loaderData:en,errors:En}=await Sn(Qe,le,vt,Et,yt.active,Ie,he&&he.submission,he&&he.fetcherSubmission,he&&he.replace,he&&he.initialHydration===!0,tt,Tt,he&&he.callSiteDefaultShouldRevalidate);bt||(G=null,Ft(le,{matches:un||vt,...eS(Tt),loaderData:en,errors:En}))}async function ee(Y,le,he,Me,Ie,vt,tt,yt={}){ve();let Qe=Nk(le,he);if(ht({navigation:Qe},{flushSync:yt.flushSync===!0}),vt){let bt=await ui(Me,le.pathname,Y.signal);if(bt.type==="aborted")return{shortCircuited:!0};if(bt.type==="error"){if(bt.partialMatches.length===0){let{matches:en,route:En}=Vd(c);return{matches:en,pendingActionResult:[En.id,{type:"error",error:bt.error}]}}let un=Ma(bt.partialMatches).route.id;return{matches:bt.partialMatches,pendingActionResult:[un,{type:"error",error:bt.error}]}}else if(bt.matches)Me=bt.matches;else{let{notFoundMatches:un,error:en,route:En}=Re(le.pathname);return{matches:un,pendingActionResult:[En.id,{type:"error",error:en}]}}}let Et,Tt=Tf(Me,le);if(!Tt.route.action&&!Tt.route.lazy)Et={type:"error",error:cr(405,{method:Y.method,pathname:le.pathname,routeId:Tt.route.id})};else{let bt=Dl(s,o,Y,Me,Tt,tt?[]:i,Ie),un=await xe(Y,bt,Ie,null);if(Et=un[Tt.route.id],!Et){for(let en of Me)if(un[en.route.id]){Et=un[en.route.id];break}}if(Y.signal.aborted)return{shortCircuited:!0}}if(uo(Et)){let bt;return yt&&yt.replace!=null?bt=yt.replace:bt=Kb(Et.response.headers.get("Location"),new URL(Y.url),d,t.history)===S.location.pathname+S.location.search,await se(Y,Et,!0,{submission:he,replace:bt}),{shortCircuited:!0}}if(Ji(Et)){let bt=Ma(Me,Tt.route.id);return(yt&&yt.replace)!==!0&&(P="PUSH"),{matches:Me,pendingActionResult:[bt.route.id,Et,Tt.route.id]}}return{matches:Me,pendingActionResult:[Tt.route.id,Et]}}async function Sn(Y,le,he,Me,Ie,vt,tt,yt,Qe,Et,Tt,bt,un){let en=vt||Rm(le,tt),En=tt||yt||nS(en),In=!K&&!Et;if(Ie){if(In){let Mt=At(bt);ht({navigation:en,...Mt!==void 0?{actionData:Mt}:{}},{flushSync:Tt})}let He=await ui(he,le.pathname,Y.signal);if(He.type==="aborted")return{shortCircuited:!0};if(He.type==="error"){if(He.partialMatches.length===0){let{matches:lt,route:Zt}=Vd(c);return{matches:lt,loaderData:{},errors:{[Zt.id]:He.error}}}let Mt=Ma(He.partialMatches).route.id;return{matches:He.partialMatches,loaderData:{},errors:{[Mt]:He.error}}}else if(He.matches)he=He.matches;else{let{error:Mt,notFoundMatches:lt,route:Zt}=Re(le.pathname);return{matches:lt,loaderData:{},errors:{[Zt.id]:Mt}}}}let Zn=u||c,{dsMatches:gn,revalidatingFetchers:N}=Wb(Y,Me,s,o,t.history,S,he,En,le,Et?[]:i,Et===!0,Q,W,ne,ze,Ee,Zn,d,t.patchRoutesOnNavigation!=null,bt,un);if(z=++Z,!t.dataStrategy&&!gn.some(He=>He.shouldLoad)&&!gn.some(He=>He.route.middleware&&He.route.middleware.length>0)&&N.length===0){let He=$e();return Ft(le,{matches:he,loaderData:{},errors:bt&&Ji(bt[1])?{[bt[0]]:bt[1].error}:null,...eS(bt),...He?{fetchers:new Map(S.fetchers)}:{}},{flushSync:Tt}),{shortCircuited:!0}}if(In){let He={};if(!Ie){He.navigation=en;let Mt=At(bt);Mt!==void 0&&(He.actionData=Mt)}N.length>0&&(He.fetchers=Lt(N)),ht(He,{flushSync:Tt})}N.forEach(He=>{Ze(He.key),He.controller&&q.set(He.key,He.controller)});let oe=()=>N.forEach(He=>Ze(He.key));G&&G.signal.addEventListener("abort",oe);let{loaderResults:pe,fetcherResults:de}=await we(gn,N,Y,Me);if(Y.signal.aborted)return{shortCircuited:!0};G&&G.signal.removeEventListener("abort",oe),N.forEach(He=>q.delete(He.key));let ce=Hd(pe);if(ce)return await se(Y,ce.result,!0,{replace:Qe}),{shortCircuited:!0};if(ce=Hd(de),ce)return Ee.add(ce.key),await se(Y,ce.result,!0,{replace:Qe}),{shortCircuited:!0};let{loaderData:je,errors:qe}=Jb(S,he,pe,bt,N,de);Et&&S.errors&&(qe={...S.errors,...qe});let Ge=$e(),We=Ht(z),ct=Ge||We||N.length>0;return{matches:he,loaderData:je,errors:qe,...ct?{fetchers:new Map(S.fetchers)}:{}}}function At(Y){if(Y&&!Ji(Y[1]))return{[Y[0]]:Y[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function Lt(Y){return Y.forEach(le=>{let he=S.fetchers.get(le.key),Me=Fc(void 0,he?he.data:void 0);S.fetchers.set(le.key,Me)}),new Map(S.fetchers)}async function it(Y,le,he,Me){Ze(Y);let Ie=(Me&&Me.flushSync)===!0,vt=u||c,tt=Wg(S.location,S.matches,d,he,le,Me?.relative),yt=Ea(vt,tt,d),Qe=Kt(yt,vt,tt);if(Qe.active&&Qe.matches&&(yt=Qe.matches),!yt){ke(Y,le,cr(404,{pathname:tt}),{flushSync:Ie});return}let{path:Et,submission:Tt,error:bt}=jb(!0,tt,Me);if(bt){ke(Y,le,bt,{flushSync:Ie});return}let un=t.getContext?await t.getContext():new Ob,en=(Me&&Me.preventScrollReset)===!0;if(Tt&&Si(Tt.formMethod)){await B(Y,le,Et,yt,un,Qe.active,Ie,en,Tt,Me&&Me.unstable_defaultShouldRevalidate);return}ze.set(Y,{routeId:le,path:Et}),await R(Y,le,Et,yt,un,Qe.active,Ie,en,Tt)}async function B(Y,le,he,Me,Ie,vt,tt,yt,Qe,Et){ve(),ze.delete(Y);let Tt=S.fetchers.get(Y);Ke(Y,Ik(Qe,Tt),{flushSync:tt});let bt=new AbortController,un=wl(t.history,he,bt.signal,Qe);if(vt){let It=await ui(Me,new URL(un.url).pathname,un.signal,Y);if(It.type==="aborted")return;if(It.type==="error"){ke(Y,le,It.error,{flushSync:tt});return}else if(It.matches)Me=It.matches;else{ke(Y,le,cr(404,{pathname:he}),{flushSync:tt});return}}let en=Tf(Me,he);if(!en.route.action&&!en.route.lazy){let It=cr(405,{method:Qe.formMethod,pathname:he,routeId:le});ke(Y,le,It,{flushSync:tt});return}q.set(Y,bt);let En=Z,In=Dl(s,o,un,Me,en,i,Ie),Zn=await xe(un,In,Ie,Y),gn=Zn[en.route.id];if(!gn){for(let It of In)if(Zn[It.route.id]){gn=Zn[It.route.id];break}}if(un.signal.aborted){q.get(Y)===bt&&q.delete(Y);return}if(ne.has(Y)){if(uo(gn)||Ji(gn)){Ke(Y,Ls(void 0));return}}else{if(uo(gn))if(q.delete(Y),z>En){Ke(Y,Ls(void 0));return}else return Ee.add(Y),Ke(Y,Fc(Qe)),se(un,gn,!1,{fetcherSubmission:Qe,preventScrollReset:yt});if(Ji(gn)){ke(Y,le,gn.error);return}}let N=S.navigation.location||S.location,oe=wl(t.history,N,bt.signal),pe=u||c,de=S.navigation.state!=="idle"?Ea(pe,S.navigation.location,d):S.matches;Qt(de,"Didn't find any matches after fetcher action");let ce=++Z;ie.set(Y,ce);let je=Fc(Qe,gn.data);S.fetchers.set(Y,je);let{dsMatches:qe,revalidatingFetchers:Ge}=Wb(oe,Ie,s,o,t.history,S,de,Qe,N,i,!1,Q,W,ne,ze,Ee,pe,d,t.patchRoutesOnNavigation!=null,[en.route.id,gn],Et);Ge.filter(It=>It.key!==Y).forEach(It=>{let vn=It.key,tn=S.fetchers.get(vn),Un=Fc(void 0,tn?tn.data:void 0);S.fetchers.set(vn,Un),Ze(vn),It.controller&&q.set(vn,It.controller)}),ht({fetchers:new Map(S.fetchers)});let We=()=>Ge.forEach(It=>Ze(It.key));bt.signal.addEventListener("abort",We);let{loaderResults:ct,fetcherResults:He}=await we(qe,Ge,oe,Ie);if(bt.signal.aborted)return;if(bt.signal.removeEventListener("abort",We),ie.delete(Y),q.delete(Y),Ge.forEach(It=>q.delete(It.key)),S.fetchers.has(Y)){let It=Ls(gn.data);S.fetchers.set(Y,It)}let Mt=Hd(ct);if(Mt)return se(oe,Mt.result,!1,{preventScrollReset:yt});if(Mt=Hd(He),Mt)return Ee.add(Mt.key),se(oe,Mt.result,!1,{preventScrollReset:yt});let{loaderData:lt,errors:Zt}=Jb(S,de,ct,void 0,Ge,He);Ht(ce),S.navigation.state==="loading"&&ce>z?(Qt(P,"Expected pending action"),G&&G.abort(),Ft(S.navigation.location,{matches:de,loaderData:lt,errors:Zt,fetchers:new Map(S.fetchers)})):(ht({errors:Zt,loaderData:Qb(S.loaderData,lt,de,Zt),fetchers:new Map(S.fetchers)}),Q=!1)}async function R(Y,le,he,Me,Ie,vt,tt,yt,Qe){let Et=S.fetchers.get(Y);Ke(Y,Fc(Qe,Et?Et.data:void 0),{flushSync:tt});let Tt=new AbortController,bt=wl(t.history,he,Tt.signal);if(vt){let gn=await ui(Me,new URL(bt.url).pathname,bt.signal,Y);if(gn.type==="aborted")return;if(gn.type==="error"){ke(Y,le,gn.error,{flushSync:tt});return}else if(gn.matches)Me=gn.matches;else{ke(Y,le,cr(404,{pathname:he}),{flushSync:tt});return}}let un=Tf(Me,he);q.set(Y,Tt);let en=Z,En=Dl(s,o,bt,Me,un,i,Ie),Zn=(await xe(bt,En,Ie,Y))[un.route.id];if(q.get(Y)===Tt&&q.delete(Y),!bt.signal.aborted){if(ne.has(Y)){Ke(Y,Ls(void 0));return}if(uo(Zn))if(z>en){Ke(Y,Ls(void 0));return}else{Ee.add(Y),await se(bt,Zn,!1,{preventScrollReset:yt});return}if(Ji(Zn)){ke(Y,le,Zn.error);return}Ke(Y,Ls(Zn.data))}}async function se(Y,le,he,{submission:Me,fetcherSubmission:Ie,preventScrollReset:vt,replace:tt}={}){he||(V?.resolve(),V=null),le.response.headers.has("X-Remix-Revalidate")&&(Q=!0);let yt=le.response.headers.get("Location");Qt(yt,"Expected a Location header on the redirect Response"),yt=Kb(yt,new URL(Y.url),d,t.history);let Qe=du(S.location,yt,{_isRedirect:!0});if(n){let En=!1;if(le.response.headers.has("X-Remix-Reload-Document"))En=!0;else if(Bv(yt)){const In=HE(yt,!0);En=In.origin!==e.location.origin||mr(In.pathname,d)==null}if(En){tt?e.location.replace(yt):e.location.assign(yt);return}}G=null;let Et=tt===!0||le.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Tt,formAction:bt,formEncType:un}=S.navigation;!Me&&!Ie&&Tt&&bt&&un&&(Me=nS(S.navigation));let en=Me||Ie;if(uk.has(le.response.status)&&en&&Si(en.formMethod))await an(Et,Qe,{submission:{...en,formAction:yt},preventScrollReset:vt||O,enableViewTransition:he?J:void 0});else{let En=Rm(Qe,Me);await an(Et,Qe,{overrideNavigation:En,fetcherSubmission:Ie,preventScrollReset:vt||O,enableViewTransition:he?J:void 0})}}async function xe(Y,le,he,Me){let Ie,vt={};try{Ie=await xk(h,Y,le,Me,he,!1)}catch(tt){return le.filter(yt=>yt.shouldLoad).forEach(yt=>{vt[yt.route.id]={type:"error",error:tt}}),vt}if(Y.signal.aborted)return vt;if(!Si(Y.method))for(let tt of le){if(Ie[tt.route.id]?.type==="error")break;!Ie.hasOwnProperty(tt.route.id)&&!S.loaderData.hasOwnProperty(tt.route.id)&&(!S.errors||!S.errors.hasOwnProperty(tt.route.id))&&tt.shouldCallHandler()&&(Ie[tt.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${tt.route.id}`)})}for(let[tt,yt]of Object.entries(Ie))if(Rk(yt)){let Qe=yt.result;vt[tt]={type:"redirect",response:Ek(Qe,Y,tt,le,d)}}else vt[tt]=await wk(yt);return vt}async function we(Y,le,he,Me){let Ie=xe(he,Y,Me,null),vt=Promise.all(le.map(async Qe=>{if(Qe.matches&&Qe.match&&Qe.request&&Qe.controller){let Tt=(await xe(Qe.request,Qe.matches,Me,Qe.key))[Qe.match.route.id];return{[Qe.key]:Tt}}else return Promise.resolve({[Qe.key]:{type:"error",error:cr(404,{pathname:Qe.path})}})})),tt=await Ie,yt=(await vt).reduce((Qe,Et)=>Object.assign(Qe,Et),{});return{loaderResults:tt,fetcherResults:yt}}function ve(){Q=!0,ze.forEach((Y,le)=>{q.has(le)&&W.add(le),Ze(le)})}function Ke(Y,le,he={}){S.fetchers.set(Y,le),ht({fetchers:new Map(S.fetchers)},{flushSync:(he&&he.flushSync)===!0})}function ke(Y,le,he,Me={}){let Ie=Ma(S.matches,le);Pe(Y),ht({errors:{[Ie.route.id]:he},fetchers:new Map(S.fetchers)},{flushSync:(Me&&Me.flushSync)===!0})}function pt(Y){return Se.set(Y,(Se.get(Y)||0)+1),ne.has(Y)&&ne.delete(Y),S.fetchers.get(Y)||dk}function Pt(Y,le){Ze(Y,le?.reason),Ke(Y,Ls(null))}function Pe(Y){let le=S.fetchers.get(Y);q.has(Y)&&!(le&&le.state==="loading"&&ie.has(Y))&&Ze(Y),ze.delete(Y),ie.delete(Y),Ee.delete(Y),ne.delete(Y),W.delete(Y),S.fetchers.delete(Y)}function Oe(Y){let le=(Se.get(Y)||0)-1;le<=0?(Se.delete(Y),ne.add(Y)):Se.set(Y,le),ht({fetchers:new Map(S.fetchers)})}function Ze(Y,le){let he=q.get(Y);he&&(he.abort(le),q.delete(Y))}function rt(Y){for(let le of Y){let he=pt(le),Me=Ls(he.data);S.fetchers.set(le,Me)}}function $e(){let Y=[],le=!1;for(let he of Ee){let Me=S.fetchers.get(he);Qt(Me,`Expected fetcher: ${he}`),Me.state==="loading"&&(Ee.delete(he),Y.push(he),le=!0)}return rt(Y),le}function Ht(Y){let le=[];for(let[he,Me]of ie)if(Me<Y){let Ie=S.fetchers.get(he);Qt(Ie,`Expected fetcher: ${he}`),Ie.state==="loading"&&(Ze(he),ie.delete(he),le.push(he))}return rt(le),le.length>0}function re(Y,le){let he=S.blockers.get(Y)||Uc;return ye.get(Y)!==le&&ye.set(Y,le),he}function Ve(Y){S.blockers.delete(Y),ye.delete(Y)}function Le(Y,le){let he=S.blockers.get(Y)||Uc;Qt(he.state==="unblocked"&&le.state==="blocked"||he.state==="blocked"&&le.state==="blocked"||he.state==="blocked"&&le.state==="proceeding"||he.state==="blocked"&&le.state==="unblocked"||he.state==="proceeding"&&le.state==="unblocked",`Invalid blocker state transition: ${he.state} -> ${le.state}`);let Me=new Map(S.blockers);Me.set(Y,le),ht({blockers:Me})}function Xe({currentLocation:Y,nextLocation:le,historyAction:he}){if(ye.size===0)return;ye.size>1&&jn(!1,"A router only supports one blocker at a time");let Me=Array.from(ye.entries()),[Ie,vt]=Me[Me.length-1],tt=S.blockers.get(Ie);if(!(tt&&tt.state==="proceeding")&&vt({currentLocation:Y,nextLocation:le,historyAction:he}))return Ie}function Re(Y){let le=cr(404,{pathname:Y}),he=u||c,{matches:Me,route:Ie}=Vd(he);return{notFoundMatches:Me,route:Ie,error:le}}function _e(Y,le,he){if(_=Y,y=le,w=he||null,!b&&S.navigation===Pm){b=!0;let Me=mn(S.location,S.matches);Me!=null&&ht({restoreScrollPosition:Me})}return()=>{_=null,y=null,w=null}}function st(Y,le){return w&&w(Y,le.map(Me=>F2(Me,S.loaderData)))||Y.key}function Nt(Y,le){if(_&&y){let he=st(Y,le);_[he]=y()}}function mn(Y,le){if(_){let he=st(Y,le),Me=_[he];if(typeof Me=="number")return Me}return null}function Kt(Y,le,he){if(t.patchRoutesOnNavigation)if(Y){if(Object.keys(Y[0].params).length>0)return{active:!0,matches:Zc(le,he,d,!0)}}else return{active:!0,matches:Zc(le,he,d,!0)||[]};return{active:!1,matches:null}}async function ui(Y,le,he,Me){if(!t.patchRoutesOnNavigation)return{type:"success",matches:Y};let Ie=Y;for(;;){let vt=u==null,tt=u||c,yt=o;try{await t.patchRoutesOnNavigation({signal:he,path:le,matches:Ie,fetcherKey:Me,patch:(Tt,bt)=>{he.aborted||$b(Tt,bt,tt,yt,s,!1)}})}catch(Tt){return{type:"error",error:Tt,partialMatches:Ie}}finally{vt&&!he.aborted&&(c=[...c])}if(he.aborted)return{type:"aborted"};let Qe=Ea(tt,le,d),Et=null;if(Qe){if(Object.keys(Qe[0].params).length===0)return{type:"success",matches:Qe};if(Et=Zc(tt,le,d,!0),!(Et&&Ie.length<Et.length&&ri(Ie,Et.slice(0,Ie.length))))return{type:"success",matches:Qe}}if(Et||(Et=Zc(tt,le,d,!0)),!Et||ri(Ie,Et))return{type:"success",matches:null};Ie=Et}}function ri(Y,le){return Y.length===le.length&&Y.every((he,Me)=>he.route.id===le[Me].route.id)}function Xs(Y){o={},u=fu(Y,s,void 0,o)}function Sr(Y,le,he=!1){let Me=u==null;$b(Y,le,u||c,o,s,he),Me&&(c=[...c],ht({}))}return U={get basename(){return d},get future(){return p},get state(){return S},get routes(){return c},get window(){return e},initialize:et,subscribe:pn,enableScrollRestoration:_e,navigate:nn,fetch:it,revalidate:Dt,createHref:Y=>t.history.createHref(Y),encodeLocation:Y=>t.history.encodeLocation(Y),getFetcher:pt,resetFetcher:Pt,deleteFetcher:Oe,dispose:xt,getBlocker:re,deleteBlocker:Ve,patchRoutes:Sr,_internalFetchControllers:q,_internalSetRoutes:Xs,_internalSetStateDoNotUseOrYouWillBreakYourApp(Y){ht(Y)}},t.unstable_instrumentations&&(U=nk(U,t.unstable_instrumentations.map(Y=>Y.router).filter(Boolean))),U}function pk(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Wg(t,e,n,i,r,s){let o,c;if(r){o=[];for(let d of e)if(o.push(d),d.route.id===r){c=d;break}}else o=e,c=e[e.length-1];let u=Ah(i||".",zv(o),mr(t.pathname,n)||t.pathname,s==="path");if(i==null&&(u.search=t.search,u.hash=t.hash),(i==null||i===""||i===".")&&c){let d=Gv(u.search);if(c.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let h=new URLSearchParams(u.search),p=h.getAll("index");h.delete("index"),p.filter(v=>v).forEach(v=>h.append("index",v));let m=h.toString();u.search=m?`?${m}`:""}}return n!=="/"&&(u.pathname=K2({basename:n,pathname:u.pathname})),ss(u)}function jb(t,e,n){if(!n||!pk(n))return{path:e};if(n.formMethod&&!Dk(n.formMethod))return{path:e,error:cr(405,{method:n.formMethod})};let i=()=>({path:e,error:cr(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),o=aM(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Si(s))return i();let p=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((m,[v,_])=>`${m}${v}=${_}
|
|
10
|
-
`,""):String(n.body);return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:p}}}else if(n.formEncType==="application/json"){if(!Si(s))return i();try{let p=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:p,text:void 0}}}catch{return i()}}}Qt(typeof FormData=="function","FormData is not available in this environment");let c,u;if(n.formData)c=Xg(n.formData),u=n.formData;else if(n.body instanceof FormData)c=Xg(n.body),u=n.body;else if(n.body instanceof URLSearchParams)c=n.body,u=Zb(c);else if(n.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(n.body),u=Zb(c)}catch{return i()}let d={formMethod:s,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(Si(d.formMethod))return{path:e,submission:d};let h=js(e);return t&&h.search&&Gv(h.search)&&c.append("index",""),h.search=`?${c}`,{path:ss(h),submission:d}}function Wb(t,e,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y,b,T,A,M){let I=A?Ji(A[1])?A[1].error:A[1].data:void 0,k=r.createURL(s.location),U=r.createURL(u),S;if(h&&s.errors){let X=Object.keys(s.errors)[0];S=o.findIndex(K=>K.route.id===X)}else if(A&&Ji(A[1])){let X=A[0];S=o.findIndex(K=>K.route.id===X)-1}let P=A?A[1].statusCode:void 0,V=P&&P>=400,O={currentUrl:k,currentParams:s.matches[0]?.params||{},nextUrl:U,nextParams:o[0].params,...c,actionResult:I,actionStatus:P},G=Eu(o),J=o.map((X,K)=>{let{route:Q}=X,W=null;if(S!=null&&K>S)W=!1;else if(Q.lazy)W=!0;else if(!Vv(Q))W=!1;else if(h){let{shouldLoad:ie}=eM(Q,s.loaderData,s.errors);W=ie}else mk(s.loaderData,s.matches[K],X)&&(W=!0);if(W!==null)return $g(n,i,t,G,X,d,e,W);let q=!1;typeof M=="boolean"?q=M:V?q=!1:(p||k.pathname+k.search===U.pathname+U.search||k.search!==U.search||gk(s.matches[K],X))&&(q=!0);let Z={...O,defaultShouldRevalidate:q},z=iu(X,Z);return $g(n,i,t,G,X,d,e,z,Z,M)}),H=[];return _.forEach((X,K)=>{if(h||!o.some(ze=>ze.route.id===X.routeId)||v.has(K))return;let Q=s.fetchers.get(K),W=Q&&Q.state!=="idle"&&Q.data===void 0,q=Ea(y,X.path,b);if(!q){if(T&&W)return;H.push({key:K,routeId:X.routeId,path:X.path,matches:null,match:null,request:null,controller:null});return}if(w.has(K))return;let Z=Tf(q,X.path),z=new AbortController,ie=wl(r,X.path,z.signal),Ee=null;if(m.has(K))m.delete(K),Ee=Dl(n,i,ie,q,Z,d,e);else if(W)p&&(Ee=Dl(n,i,ie,q,Z,d,e));else{let ze;typeof M=="boolean"?ze=M:V?ze=!1:ze=p;let Se={...O,defaultShouldRevalidate:ze};iu(Z,Se)&&(Ee=Dl(n,i,ie,q,Z,d,e,Se))}Ee&&H.push({key:K,routeId:X.routeId,path:X.path,matches:Ee,match:Z,request:ie,controller:z})}),{dsMatches:J,revalidatingFetchers:H}}function Vv(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function eM(t,e,n){if(t.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Vv(t))return{shouldLoad:!1,renderFallback:!1};let i=e!=null&&t.id in e,r=n!=null&&n[t.id]!==void 0;if(!i&&r)return{shouldLoad:!1,renderFallback:!1};if(typeof t.loader=="function"&&t.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!i};let s=!i&&!r;return{shouldLoad:s,renderFallback:s}}function mk(t,e,n){let i=!e||n.route.id!==e.route.id,r=!t.hasOwnProperty(n.route.id);return i||r}function gk(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function iu(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function $b(t,e,n,i,r,s){let o;if(t){let d=i[t];Qt(d,`No route found to patch children into: routeId = ${t}`),d.children||(d.children=[]),o=d.children}else o=n;let c=[],u=[];if(e.forEach(d=>{let h=o.find(p=>tM(d,p));h?u.push({existingRoute:h,newRoute:d}):c.push(d)}),c.length>0){let d=fu(c,r,[t||"_","patch",String(o?.length||"0")],i);o.push(...d)}if(s&&u.length>0)for(let d=0;d<u.length;d++){let{existingRoute:h,newRoute:p}=u[d],m=h,[v]=fu([p],r,[],{},!0);Object.assign(m,{element:v.element?v.element:m.element,errorElement:v.errorElement?v.errorElement:m.errorElement,hydrateFallbackElement:v.hydrateFallbackElement?v.hydrateFallbackElement:m.hydrateFallbackElement})}}function tM(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children?.every((n,i)=>e.children?.some(r=>tM(n,r)))??!1:!1}var Xb=new WeakMap,nM=({key:t,route:e,manifest:n,mapRouteProperties:i})=>{let r=n[e.id];if(Qt(r,"No route found in manifest"),!r.lazy||typeof r.lazy!="object")return;let s=r.lazy[t];if(!s)return;let o=Xb.get(r);o||(o={},Xb.set(r,o));let c=o[t];if(c)return c;let u=(async()=>{let d=D2(t),p=r[t]!==void 0&&t!=="hasErrorBoundary";if(d)jn(!d,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(p)jn(!1,`Route "${r.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let m=await s();m!=null&&(Object.assign(r,{[t]:m}),Object.assign(r,i(r)))}typeof r.lazy=="object"&&(r.lazy[t]=void 0,Object.values(r.lazy).every(m=>m===void 0)&&(r.lazy=void 0))})();return o[t]=u,u},qb=new WeakMap;function vk(t,e,n,i,r){let s=n[t.id];if(Qt(s,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let h=qb.get(s);if(h)return{lazyRoutePromise:h,lazyHandlerPromise:h};let p=(async()=>{Qt(typeof t.lazy=="function","No lazy route function found");let m=await t.lazy(),v={};for(let _ in m){let w=m[_];if(w===void 0)continue;let y=I2(_),T=s[_]!==void 0&&_!=="hasErrorBoundary";y?jn(!y,"Route property "+_+" is not a supported property to be returned from a lazy route function. This property will be ignored."):T?jn(!T,`Route "${s.id}" has a static property "${_}" defined but its lazy function is also returning a value for this property. The lazy route property "${_}" will be ignored.`):v[_]=w}Object.assign(s,v),Object.assign(s,{...i(s),lazy:void 0})})();return qb.set(s,p),p.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:p}}let o=Object.keys(t.lazy),c=[],u;for(let h of o){if(r&&r.includes(h))continue;let p=nM({key:h,route:t,manifest:n,mapRouteProperties:i});p&&(c.push(p),h===e&&(u=p))}let d=c.length>0?Promise.all(c).then(()=>{}):void 0;return d?.catch(()=>{}),u?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:u}}async function Yb(t){let e=t.matches.filter(r=>r.shouldLoad),n={};return(await Promise.all(e.map(r=>r.resolve()))).forEach((r,s)=>{n[e[s].route.id]=r}),n}async function yk(t){return t.matches.some(e=>e.route.middleware)?iM(t,()=>Yb(t)):Yb(t)}function iM(t,e){return _k(t,e,i=>{if(Lk(i))throw i;return i},Ck,n);function n(i,r,s){if(s)return Promise.resolve(Object.assign(s.value,{[r]:{type:"error",result:i}}));{let{matches:o}=t,c=Math.min(Math.max(o.findIndex(d=>d.route.id===r),0),Math.max(o.findIndex(d=>d.shouldCallHandler()),0)),u=Ma(o,o[c].route.id).route.id;return Promise.resolve({[u]:{type:"error",result:i}})}}}async function _k(t,e,n,i,r){let{matches:s,request:o,params:c,context:u,unstable_pattern:d}=t,h=s.flatMap(m=>m.route.middleware?m.route.middleware.map(v=>[m.route.id,v]):[]);return await rM({request:o,params:c,context:u,unstable_pattern:d},h,e,n,i,r)}async function rM(t,e,n,i,r,s,o=0){let{request:c}=t;if(c.signal.aborted)throw c.signal.reason??new Error(`Request aborted: ${c.method} ${c.url}`);let u=e[o];if(!u)return await n();let[d,h]=u,p,m=async()=>{if(p)throw new Error("You may only call `next()` once per middleware");try{return p={value:await rM(t,e,n,i,r,s,o+1)},p.value}catch(v){return p={value:await s(v,d,p)},p.value}};try{let v=await h(t,m),_=v!=null?i(v):void 0;return r(_)?_:p?_??p.value:(p={value:await m()},p.value)}catch(v){return await s(v,d,p)}}function sM(t,e,n,i,r){let s=nM({key:"middleware",route:i.route,manifest:e,mapRouteProperties:t}),o=vk(i.route,Si(n.method)?"action":"loader",e,t,r);return{middleware:s,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function $g(t,e,n,i,r,s,o,c,u=null,d){let h=!1,p=sM(t,e,n,r,s);return{...r,_lazyPromises:p,shouldLoad:c,shouldRevalidateArgs:u,shouldCallHandler(m){return h=!0,u?typeof d=="boolean"?iu(r,{...u,defaultShouldRevalidate:d}):typeof m=="boolean"?iu(r,{...u,defaultShouldRevalidate:m}):iu(r,u):c},resolve(m){let{lazy:v,loader:_,middleware:w}=r.route,y=h||c||m&&!Si(n.method)&&(v||_),b=w&&w.length>0&&!_&&!v;return y&&(Si(n.method)||!b)?bk({request:n,unstable_pattern:i,match:r,lazyHandlerPromise:p?.handler,lazyRoutePromise:p?.route,handlerOverride:m,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function Dl(t,e,n,i,r,s,o,c=null){return i.map(u=>u.route.id!==r.route.id?{...u,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:sM(t,e,n,u,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:$g(t,e,n,Eu(i),u,s,o,!0,c))}async function xk(t,e,n,i,r,s){n.some(d=>d._lazyPromises?.middleware)&&await Promise.all(n.map(d=>d._lazyPromises?.middleware));let o={request:e,unstable_pattern:Eu(n),params:n[0].params,context:r,matches:n},u=await t({...o,fetcherKey:i,runClientMiddleware:d=>{let h=o;return iM(h,()=>d({...h,fetcherKey:i,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(d=>[d._lazyPromises?.handler,d._lazyPromises?.route]))}catch{}return u}async function bk({request:t,unstable_pattern:e,match:n,lazyHandlerPromise:i,lazyRoutePromise:r,handlerOverride:s,scopedContext:o}){let c,u,d=Si(t.method),h=d?"action":"loader",p=m=>{let v,_=new Promise((b,T)=>v=T);u=()=>v(),t.signal.addEventListener("abort",u);let w=b=>typeof m!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${n.route.id}]`)):m({request:t,unstable_pattern:e,params:n.params,context:o},...b!==void 0?[b]:[]),y=(async()=>{try{return{type:"data",result:await(s?s(T=>w(T)):w())}}catch(b){return{type:"error",result:b}}})();return Promise.race([y,_])};try{let m=d?n.route.action:n.route.loader;if(i||r)if(m){let v,[_]=await Promise.all([p(m).catch(w=>{v=w}),i,r]);if(v!==void 0)throw v;c=_}else{await i;let v=d?n.route.action:n.route.loader;if(v)[c]=await Promise.all([p(v),r]);else if(h==="action"){let _=new URL(t.url),w=_.pathname+_.search;throw cr(405,{method:t.method,pathname:w,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(m)c=await p(m);else{let v=new URL(t.url),_=v.pathname+v.search;throw cr(404,{pathname:_})}}catch(m){return{type:"error",result:m}}finally{u&&t.signal.removeEventListener("abort",u)}return c}async function Sk(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function wk(t){let{result:e,type:n}=t;if(Hv(e)){let i;try{i=await Sk(e)}catch(r){return{type:"error",error:r}}return n==="error"?{type:"error",error:new wu(e.status,e.statusText,i),statusCode:e.status,headers:e.headers}:{type:"data",data:i,statusCode:e.status,headers:e.headers}}return n==="error"?tS(e)?e.data instanceof Error?{type:"error",error:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:Ak(e),statusCode:hu(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:hu(e)?e.status:void 0}:tS(e)?{type:"data",data:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"data",data:e}}function Ek(t,e,n,i,r){let s=t.headers.get("Location");if(Qt(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Bv(s)){let o=i.slice(0,i.findIndex(c=>c.route.id===n)+1);s=Wg(new URL(e.url),o,r,s),t.headers.set("Location",s)}return t}function Kb(t,e,n,i){let r=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(Bv(t)){let s=t,o=s.startsWith("//")?new URL(e.protocol+s):new URL(s);if(r.includes(o.protocol))throw new Error("Invalid redirect location");let c=mr(o.pathname,n)!=null;if(o.origin===e.origin&&c)return o.pathname+o.search+o.hash}try{let s=i.createURL(t);if(r.includes(s.protocol))throw new Error("Invalid redirect location")}catch{}return t}function wl(t,e,n,i){let r=t.createURL(aM(e)).toString(),s={signal:n};if(i&&Si(i.formMethod)){let{formMethod:o,formEncType:c}=i;s.method=o.toUpperCase(),c==="application/json"?(s.headers=new Headers({"Content-Type":c}),s.body=JSON.stringify(i.json)):c==="text/plain"?s.body=i.text:c==="application/x-www-form-urlencoded"&&i.formData?s.body=Xg(i.formData):s.body=i.formData}return new Request(r,s)}function Xg(t){let e=new URLSearchParams;for(let[n,i]of t.entries())e.append(n,typeof i=="string"?i:i.name);return e}function Zb(t){let e=new FormData;for(let[n,i]of t.entries())e.append(n,i);return e}function Mk(t,e,n,i=!1,r=!1){let s={},o=null,c,u=!1,d={},h=n&&Ji(n[1])?n[1].error:void 0;return t.forEach(p=>{if(!(p.route.id in e))return;let m=p.route.id,v=e[m];if(Qt(!uo(v),"Cannot handle redirect results in processLoaderData"),Ji(v)){let _=v.error;if(h!==void 0&&(_=h,h=void 0),o=o||{},r)o[m]=_;else{let w=Ma(t,m);o[w.route.id]==null&&(o[w.route.id]=_)}i||(s[m]=QE),u||(u=!0,c=hu(v.error)?v.error.status:500),v.headers&&(d[m]=v.headers)}else s[m]=v.data,v.statusCode&&v.statusCode!==200&&!u&&(c=v.statusCode),v.headers&&(d[m]=v.headers)}),h!==void 0&&n&&(o={[n[0]]:h},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:o,statusCode:c||200,loaderHeaders:d}}function Jb(t,e,n,i,r,s){let{loaderData:o,errors:c}=Mk(e,n,i);return r.filter(u=>!u.matches||u.matches.some(d=>d.shouldLoad)).forEach(u=>{let{key:d,match:h,controller:p}=u;if(p&&p.signal.aborted)return;let m=s[d];if(Qt(m,"Did not find corresponding fetcher result"),Ji(m)){let v=Ma(t.matches,h?.route.id);c&&c[v.route.id]||(c={...c,[v.route.id]:m.error}),t.fetchers.delete(d)}else if(uo(m))Qt(!1,"Unhandled fetcher revalidation redirect");else{let v=Ls(m.data);t.fetchers.set(d,v)}}),{loaderData:o,errors:c}}function Qb(t,e,n,i){let r=Object.entries(e).filter(([,s])=>s!==QE).reduce((s,[o,c])=>(s[o]=c,s),{});for(let s of n){let o=s.route.id;if(!e.hasOwnProperty(o)&&t.hasOwnProperty(o)&&s.route.loader&&(r[o]=t[o]),i&&i.hasOwnProperty(o))break}return r}function eS(t){return t?Ji(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Ma(t,e){return(e?t.slice(0,t.findIndex(i=>i.route.id===e)+1):[...t]).reverse().find(i=>i.route.hasErrorBoundary===!0)||t[0]}function Vd(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function cr(t,{pathname:e,routeId:n,method:i,type:r,message:s}={}){let o="Unknown Server Error",c="Unknown @remix-run/router error";return t===400?(o="Bad Request",i&&e&&n?c=`You made a ${i} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:r==="invalid-body"&&(c="Unable to encode submission body")):t===403?(o="Forbidden",c=`Route "${n}" does not match URL "${e}"`):t===404?(o="Not Found",c=`No route matches URL "${e}"`):t===405&&(o="Method Not Allowed",i&&e&&n?c=`You made a ${i.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:i&&(c=`Invalid request method "${i.toUpperCase()}"`)),new wu(t||500,o,new Error(c),!0)}function Hd(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[i,r]=e[n];if(uo(r))return{key:i,result:r}}}function aM(t){let e=typeof t=="string"?js(t):t;return ss({...e,hash:""})}function Tk(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function Ak(t){return new wu(t.init?.status??500,t.init?.statusText??"Internal Server Error",t.data)}function Ck(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&Pk(n))}function Pk(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function Rk(t){return Hv(t.result)&&ZE.has(t.result.status)}function Ji(t){return t.type==="error"}function uo(t){return(t&&t.type)==="redirect"}function tS(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Hv(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function kk(t){return ZE.has(t)}function Lk(t){return Hv(t)&&kk(t.status)&&t.headers.has("Location")}function Dk(t){return ck.has(t.toUpperCase())}function Si(t){return ok.has(t.toUpperCase())}function Gv(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function Tf(t,e){let n=typeof e=="string"?js(e).search:e.search;if(t[t.length-1].route.index&&Gv(n||""))return t[t.length-1];let i=$E(t);return i[i.length-1]}function nS(t){let{formMethod:e,formAction:n,formEncType:i,text:r,formData:s,json:o}=t;if(!(!e||!n||!i)){if(r!=null)return{formMethod:e,formAction:n,formEncType:i,formData:void 0,json:void 0,text:r};if(s!=null)return{formMethod:e,formAction:n,formEncType:i,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:i,formData:void 0,json:o,text:void 0}}}function Rm(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Nk(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Fc(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Ik(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function Ls(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Uk(t,e){try{let n=t.sessionStorage.getItem(JE);if(n){let i=JSON.parse(n);for(let[r,s]of Object.entries(i||{}))s&&Array.isArray(s)&&e.set(r,new Set(s||[]))}}catch{}}function Fk(t,e){if(e.size>0){let n={};for(let[i,r]of e)n[i]=[...r];try{t.sessionStorage.setItem(JE,JSON.stringify(n))}catch(i){jn(!1,`Failed to save applied view transitions in sessionStorage (${i}).`)}}}function iS(){let t,e,n=new Promise((i,r)=>{t=async s=>{i(s);try{await n}catch{}},e=async s=>{r(s);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var Po=L.createContext(null);Po.displayName="DataRouter";var Mu=L.createContext(null);Mu.displayName="DataRouterState";var oM=L.createContext(!1);function Ok(){return L.useContext(oM)}var jv=L.createContext({isTransitioning:!1});jv.displayName="ViewTransition";var lM=L.createContext(new Map);lM.displayName="Fetchers";var Bk=L.createContext(null);Bk.displayName="Await";var gr=L.createContext(null);gr.displayName="Navigation";var Ch=L.createContext(null);Ch.displayName="Location";var Ws=L.createContext({outlet:null,matches:[],isDataRoute:!1});Ws.displayName="Route";var Wv=L.createContext(null);Wv.displayName="RouteError";var cM="REACT_ROUTER_ERROR",zk="REDIRECT",Vk="ROUTE_ERROR_RESPONSE";function Hk(t){if(t.startsWith(`${cM}:${zk}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function Gk(t){if(t.startsWith(`${cM}:${Vk}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new wu(e.status,e.statusText,e.data)}catch{}}function jk(t,{relative:e}={}){Qt(Tu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=L.useContext(gr),{hash:r,pathname:s,search:o}=Cu(t,{relative:e}),c=s;return n!=="/"&&(c=s==="/"?n:Br([n,s])),i.createHref({pathname:c,search:o,hash:r})}function Tu(){return L.useContext(Ch)!=null}function vr(){return Qt(Tu(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Ch).location}var uM="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function dM(t){L.useContext(gr).static||L.useLayoutEffect(t)}function Au(){let{isDataRoute:t}=L.useContext(Ws);return t?iL():Wk()}function Wk(){Qt(Tu(),"useNavigate() may be used only in the context of a <Router> component.");let t=L.useContext(Po),{basename:e,navigator:n}=L.useContext(gr),{matches:i}=L.useContext(Ws),{pathname:r}=vr(),s=JSON.stringify(zv(i)),o=L.useRef(!1);return dM(()=>{o.current=!0}),L.useCallback((u,d={})=>{if(jn(o.current,uM),!o.current)return;if(typeof u=="number"){n.go(u);return}let h=Ah(u,JSON.parse(s),r,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Br([e,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[e,n,s,r,t])}L.createContext(null);function Cu(t,{relative:e}={}){let{matches:n}=L.useContext(Ws),{pathname:i}=vr(),r=JSON.stringify(zv(n));return L.useMemo(()=>Ah(t,JSON.parse(r),i,e==="path"),[t,r,i,e])}function $k(t,e,n){Qt(Tu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=L.useContext(gr),{matches:r}=L.useContext(Ws),s=r[r.length-1],o=s?s.params:{},c=s?s.pathname:"/",u=s?s.pathnameBase:"/",d=s&&s.route;{let y=d&&d.path||"";hM(c,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
9
|
+
`+E.stack}return{value:a,source:l,stack:x,digest:null}}function $p(a,l,f){return{value:a,source:null,stack:f??null,digest:l??null}}function Xp(a,l){try{console.error(l.value)}catch(f){setTimeout(function(){throw f})}}var WR=typeof WeakMap=="function"?WeakMap:Map;function Ix(a,l,f){f=ws(-1,f),f.tag=3,f.payload={element:null};var g=l.value;return f.callback=function(){Td||(Td=!0,lm=g),Xp(a,l)},f}function Ux(a,l,f){f=ws(-1,f),f.tag=3;var g=a.type.getDerivedStateFromError;if(typeof g=="function"){var x=l.value;f.payload=function(){return g(x)},f.callback=function(){Xp(a,l)}}var E=a.stateNode;return E!==null&&typeof E.componentDidCatch=="function"&&(f.callback=function(){Xp(a,l),typeof g!="function"&&(la===null?la=new Set([this]):la.add(this));var D=l.stack;this.componentDidCatch(l.value,{componentStack:D!==null?D:""})}),f}function Fx(a,l,f){var g=a.pingCache;if(g===null){g=a.pingCache=new WR;var x=new Set;g.set(l,x)}else x=g.get(l),x===void 0&&(x=new Set,g.set(l,x));x.has(f)||(x.add(f),a=s2.bind(null,a,l,f),l.then(a,a))}function Ox(a){do{var l;if((l=a.tag===13)&&(l=a.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return a;a=a.return}while(a!==null);return null}function Bx(a,l,f,g,x){return(a.mode&1)===0?(a===l?a.flags|=65536:(a.flags|=128,f.flags|=131072,f.flags&=-52805,f.tag===1&&(f.alternate===null?f.tag=17:(l=ws(-1,1),l.tag=2,aa(f,l,1))),f.lanes|=1),a):(a.flags|=65536,a.lanes=x,a)}var $R=M.ReactCurrentOwner,Oi=!1;function Ti(a,l,f,g){l.child=a===null?sx(l,null,f,g):Yo(l,a.child,f,g)}function zx(a,l,f,g,x){f=f.render;var E=l.ref;return Zo(l,x),g=Op(a,l,f,g,E,x),f=Bp(),a!==null&&!Oi?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~x,Es(a,l,x)):(Dn&&f&&bp(l),l.flags|=1,Ti(a,l,g,x),l.child)}function Vx(a,l,f,g,x){if(a===null){var E=f.type;return typeof E=="function"&&!mm(E)&&E.defaultProps===void 0&&f.compare===null&&f.defaultProps===void 0?(l.tag=15,l.type=E,Hx(a,l,E,g,x)):(a=Ld(f.type,null,g,l,l.mode,x),a.ref=l.ref,a.return=l,l.child=a)}if(E=a.child,(a.lanes&x)===0){var D=E.memoizedProps;if(f=f.compare,f=f!==null?f:pc,f(D,g)&&a.ref===l.ref)return Es(a,l,x)}return l.flags|=1,a=fa(E,g),a.ref=l.ref,a.return=l,l.child=a}function Hx(a,l,f,g,x){if(a!==null){var E=a.memoizedProps;if(pc(E,g)&&a.ref===l.ref)if(Oi=!1,l.pendingProps=g=E,(a.lanes&x)!==0)(a.flags&131072)!==0&&(Oi=!0);else return l.lanes=a.lanes,Es(a,l,x)}return qp(a,l,f,g,x)}function Gx(a,l,f){var g=l.pendingProps,x=g.children,E=a!==null?a.memoizedState:null;if(g.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Cn(tl,qi),qi|=f;else{if((f&1073741824)===0)return a=E!==null?E.baseLanes|f:f,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:a,cachePool:null,transitions:null},l.updateQueue=null,Cn(tl,qi),qi|=a,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=E!==null?E.baseLanes:f,Cn(tl,qi),qi|=g}else E!==null?(g=E.baseLanes|f,l.memoizedState=null):g=f,Cn(tl,qi),qi|=g;return Ti(a,l,x,f),l.child}function jx(a,l){var f=l.ref;(a===null&&f!==null||a!==null&&a.ref!==f)&&(l.flags|=512,l.flags|=2097152)}function qp(a,l,f,g,x){var E=Fi(f)?za:gi.current;return E=Wo(l,E),Zo(l,x),f=Op(a,l,f,g,E,x),g=Bp(),a!==null&&!Oi?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~x,Es(a,l,x)):(Dn&&g&&bp(l),l.flags|=1,Ti(a,l,f,x),l.child)}function Wx(a,l,f,g,x){if(Fi(f)){var E=!0;id(l)}else E=!1;if(Zo(l,x),l.stateNode===null)bd(a,l),Dx(l,f,g),Wp(l,f,g,x),g=!0;else if(a===null){var D=l.stateNode,$=l.memoizedProps;D.props=$;var te=D.context,ge=f.contextType;typeof ge=="object"&&ge!==null?ge=rr(ge):(ge=Fi(f)?za:gi.current,ge=Wo(l,ge));var Ce=f.getDerivedStateFromProps,De=typeof Ce=="function"||typeof D.getSnapshotBeforeUpdate=="function";De||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||($!==g||te!==ge)&&Nx(l,D,g,ge),sa=!1;var Ae=l.memoizedState;D.state=Ae,fd(l,g,D,x),te=l.memoizedState,$!==g||Ae!==te||Ui.current||sa?(typeof Ce=="function"&&(jp(l,f,Ce,g),te=l.memoizedState),($=sa||Lx(l,f,$,g,Ae,te,ge))?(De||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(l.flags|=4194308)):(typeof D.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=g,l.memoizedState=te),D.props=g,D.state=te,D.context=ge,g=$):(typeof D.componentDidMount=="function"&&(l.flags|=4194308),g=!1)}else{D=l.stateNode,ox(a,l),$=l.memoizedProps,ge=l.type===l.elementType?$:Tr(l.type,$),D.props=ge,De=l.pendingProps,Ae=D.context,te=f.contextType,typeof te=="object"&&te!==null?te=rr(te):(te=Fi(f)?za:gi.current,te=Wo(l,te));var nt=f.getDerivedStateFromProps;(Ce=typeof nt=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||($!==De||Ae!==te)&&Nx(l,D,g,te),sa=!1,Ae=l.memoizedState,D.state=Ae,fd(l,g,D,x);var ut=l.memoizedState;$!==De||Ae!==ut||Ui.current||sa?(typeof nt=="function"&&(jp(l,f,nt,g),ut=l.memoizedState),(ge=sa||Lx(l,f,ge,g,Ae,ut,te)||!1)?(Ce||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(g,ut,te),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(g,ut,te)),typeof D.componentDidUpdate=="function"&&(l.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof D.componentDidUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=1024),l.memoizedProps=g,l.memoizedState=ut),D.props=g,D.state=ut,D.context=te,g=ge):(typeof D.componentDidUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||$===a.memoizedProps&&Ae===a.memoizedState||(l.flags|=1024),g=!1)}return Yp(a,l,f,g,E,x)}function Yp(a,l,f,g,x,E){jx(a,l);var D=(l.flags&128)!==0;if(!g&&!D)return x&&K_(l,f,!1),Es(a,l,E);g=l.stateNode,$R.current=l;var $=D&&typeof f.getDerivedStateFromError!="function"?null:g.render();return l.flags|=1,a!==null&&D?(l.child=Yo(l,a.child,null,E),l.child=Yo(l,null,$,E)):Ti(a,l,$,E),l.memoizedState=g.state,x&&K_(l,f,!0),l.child}function $x(a){var l=a.stateNode;l.pendingContext?q_(a,l.pendingContext,l.pendingContext!==l.context):l.context&&q_(a,l.context,!1),Lp(a,l.containerInfo)}function Xx(a,l,f,g,x){return qo(),Mp(x),l.flags|=256,Ti(a,l,f,g),l.child}var Kp={dehydrated:null,treeContext:null,retryLane:0};function Zp(a){return{baseLanes:a,cachePool:null,transitions:null}}function qx(a,l,f){var g=l.pendingProps,x=Fn.current,E=!1,D=(l.flags&128)!==0,$;if(($=D)||($=a!==null&&a.memoizedState===null?!1:(x&2)!==0),$?(E=!0,l.flags&=-129):(a===null||a.memoizedState!==null)&&(x|=1),Cn(Fn,x&1),a===null)return Ep(l),a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((l.mode&1)===0?l.lanes=1:a.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(D=g.children,a=g.fallback,E?(g=l.mode,E=l.child,D={mode:"hidden",children:D},(g&1)===0&&E!==null?(E.childLanes=0,E.pendingProps=D):E=Dd(D,g,0,null),a=Ka(a,g,f,null),E.return=l,a.return=l,E.sibling=a,l.child=E,l.child.memoizedState=Zp(f),l.memoizedState=Kp,a):Jp(l,D));if(x=a.memoizedState,x!==null&&($=x.dehydrated,$!==null))return XR(a,l,D,g,$,x,f);if(E){E=g.fallback,D=l.mode,x=a.child,$=x.sibling;var te={mode:"hidden",children:g.children};return(D&1)===0&&l.child!==x?(g=l.child,g.childLanes=0,g.pendingProps=te,l.deletions=null):(g=fa(x,te),g.subtreeFlags=x.subtreeFlags&14680064),$!==null?E=fa($,E):(E=Ka(E,D,f,null),E.flags|=2),E.return=l,g.return=l,g.sibling=E,l.child=g,g=E,E=l.child,D=a.child.memoizedState,D=D===null?Zp(f):{baseLanes:D.baseLanes|f,cachePool:null,transitions:D.transitions},E.memoizedState=D,E.childLanes=a.childLanes&~f,l.memoizedState=Kp,g}return E=a.child,a=E.sibling,g=fa(E,{mode:"visible",children:g.children}),(l.mode&1)===0&&(g.lanes=f),g.return=l,g.sibling=null,a!==null&&(f=l.deletions,f===null?(l.deletions=[a],l.flags|=16):f.push(a)),l.child=g,l.memoizedState=null,g}function Jp(a,l){return l=Dd({mode:"visible",children:l},a.mode,0,null),l.return=a,a.child=l}function xd(a,l,f,g){return g!==null&&Mp(g),Yo(l,a.child,null,f),a=Jp(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function XR(a,l,f,g,x,E,D){if(f)return l.flags&256?(l.flags&=-257,g=$p(Error(n(422))),xd(a,l,D,g)):l.memoizedState!==null?(l.child=a.child,l.flags|=128,null):(E=g.fallback,x=l.mode,g=Dd({mode:"visible",children:g.children},x,0,null),E=Ka(E,x,D,null),E.flags|=2,g.return=l,E.return=l,g.sibling=E,l.child=g,(l.mode&1)!==0&&Yo(l,a.child,null,D),l.child.memoizedState=Zp(D),l.memoizedState=Kp,E);if((l.mode&1)===0)return xd(a,l,D,null);if(x.data==="$!"){if(g=x.nextSibling&&x.nextSibling.dataset,g)var $=g.dgst;return g=$,E=Error(n(419)),g=$p(E,g,void 0),xd(a,l,D,g)}if($=(D&a.childLanes)!==0,Oi||$){if(g=ai,g!==null){switch(D&-D){case 4:x=2;break;case 16:x=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:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(g.suspendedLanes|D))!==0?0:x,x!==0&&x!==E.retryLane&&(E.retryLane=x,Ss(a,x),Pr(g,a,x,-1))}return pm(),g=$p(Error(n(421))),xd(a,l,D,g)}return x.data==="$?"?(l.flags|=128,l.child=a.child,l=a2.bind(null,a),x._reactRetry=l,null):(a=E.treeContext,Xi=ta(x.nextSibling),$i=l,Dn=!0,Mr=null,a!==null&&(nr[ir++]=xs,nr[ir++]=bs,nr[ir++]=Va,xs=a.id,bs=a.overflow,Va=l),l=Jp(l,g.children),l.flags|=4096,l)}function Yx(a,l,f){a.lanes|=l;var g=a.alternate;g!==null&&(g.lanes|=l),Pp(a.return,l,f)}function Qp(a,l,f,g,x){var E=a.memoizedState;E===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:g,tail:f,tailMode:x}:(E.isBackwards=l,E.rendering=null,E.renderingStartTime=0,E.last=g,E.tail=f,E.tailMode=x)}function Kx(a,l,f){var g=l.pendingProps,x=g.revealOrder,E=g.tail;if(Ti(a,l,g.children,f),g=Fn.current,(g&2)!==0)g=g&1|2,l.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Yx(a,f,l);else if(a.tag===19)Yx(a,f,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}g&=1}if(Cn(Fn,g),(l.mode&1)===0)l.memoizedState=null;else switch(x){case"forwards":for(f=l.child,x=null;f!==null;)a=f.alternate,a!==null&&hd(a)===null&&(x=f),f=f.sibling;f=x,f===null?(x=l.child,l.child=null):(x=f.sibling,f.sibling=null),Qp(l,!1,x,f,E);break;case"backwards":for(f=null,x=l.child,l.child=null;x!==null;){if(a=x.alternate,a!==null&&hd(a)===null){l.child=x;break}a=x.sibling,x.sibling=f,f=x,x=a}Qp(l,!0,f,null,E);break;case"together":Qp(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function bd(a,l){(l.mode&1)===0&&a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2)}function Es(a,l,f){if(a!==null&&(l.dependencies=a.dependencies),$a|=l.lanes,(f&l.childLanes)===0)return null;if(a!==null&&l.child!==a.child)throw Error(n(153));if(l.child!==null){for(a=l.child,f=fa(a,a.pendingProps),l.child=f,f.return=l;a.sibling!==null;)a=a.sibling,f=f.sibling=fa(a,a.pendingProps),f.return=l;f.sibling=null}return l.child}function qR(a,l,f){switch(l.tag){case 3:$x(l),qo();break;case 5:ux(l);break;case 1:Fi(l.type)&&id(l);break;case 4:Lp(l,l.stateNode.containerInfo);break;case 10:var g=l.type._context,x=l.memoizedProps.value;Cn(cd,g._currentValue),g._currentValue=x;break;case 13:if(g=l.memoizedState,g!==null)return g.dehydrated!==null?(Cn(Fn,Fn.current&1),l.flags|=128,null):(f&l.child.childLanes)!==0?qx(a,l,f):(Cn(Fn,Fn.current&1),a=Es(a,l,f),a!==null?a.sibling:null);Cn(Fn,Fn.current&1);break;case 19:if(g=(f&l.childLanes)!==0,(a.flags&128)!==0){if(g)return Kx(a,l,f);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Cn(Fn,Fn.current),g)break;return null;case 22:case 23:return l.lanes=0,Gx(a,l,f)}return Es(a,l,f)}var Zx,em,Jx,Qx;Zx=function(a,l){for(var f=l.child;f!==null;){if(f.tag===5||f.tag===6)a.appendChild(f.stateNode);else if(f.tag!==4&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===l)break;for(;f.sibling===null;){if(f.return===null||f.return===l)return;f=f.return}f.sibling.return=f.return,f=f.sibling}},em=function(){},Jx=function(a,l,f,g){var x=a.memoizedProps;if(x!==g){a=l.stateNode,ja(Gr.current);var E=null;switch(f){case"input":x=Ft(a,x),g=Ft(a,g),E=[];break;case"select":x=Z({},x,{value:void 0}),g=Z({},g,{value:void 0}),E=[];break;case"textarea":x=it(a,x),g=it(a,g),E=[];break;default:typeof x.onClick!="function"&&typeof g.onClick=="function"&&(a.onclick=ed)}rt(f,g);var D;f=null;for(ge in x)if(!g.hasOwnProperty(ge)&&x.hasOwnProperty(ge)&&x[ge]!=null)if(ge==="style"){var $=x[ge];for(D in $)$.hasOwnProperty(D)&&(f||(f={}),f[D]="")}else ge!=="dangerouslySetInnerHTML"&&ge!=="children"&&ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&ge!=="autoFocus"&&(r.hasOwnProperty(ge)?E||(E=[]):(E=E||[]).push(ge,null));for(ge in g){var te=g[ge];if($=x?.[ge],g.hasOwnProperty(ge)&&te!==$&&(te!=null||$!=null))if(ge==="style")if($){for(D in $)!$.hasOwnProperty(D)||te&&te.hasOwnProperty(D)||(f||(f={}),f[D]="");for(D in te)te.hasOwnProperty(D)&&$[D]!==te[D]&&(f||(f={}),f[D]=te[D])}else f||(E||(E=[]),E.push(ge,f)),f=te;else ge==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,$=$?$.__html:void 0,te!=null&&$!==te&&(E=E||[]).push(ge,te)):ge==="children"?typeof te!="string"&&typeof te!="number"||(E=E||[]).push(ge,""+te):ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&(r.hasOwnProperty(ge)?(te!=null&&ge==="onScroll"&&Pn("scroll",a),E||$===te||(E=[])):(E=E||[]).push(ge,te))}f&&(E=E||[]).push("style",f);var ge=E;(l.updateQueue=ge)&&(l.flags|=4)}},Qx=function(a,l,f,g){f!==g&&(l.flags|=4)};function Pc(a,l){if(!Dn)switch(a.tailMode){case"hidden":l=a.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var g=null;f!==null;)f.alternate!==null&&(g=f),f=f.sibling;g===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:g.sibling=null}}function yi(a){var l=a.alternate!==null&&a.alternate.child===a.child,f=0,g=0;if(l)for(var x=a.child;x!==null;)f|=x.lanes|x.childLanes,g|=x.subtreeFlags&14680064,g|=x.flags&14680064,x.return=a,x=x.sibling;else for(x=a.child;x!==null;)f|=x.lanes|x.childLanes,g|=x.subtreeFlags,g|=x.flags,x.return=a,x=x.sibling;return a.subtreeFlags|=g,a.childLanes=f,l}function YR(a,l,f){var g=l.pendingProps;switch(Sp(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yi(l),null;case 1:return Fi(l.type)&&nd(),yi(l),null;case 3:return g=l.stateNode,Jo(),Rn(Ui),Rn(gi),Ip(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(a===null||a.child===null)&&(od(l)?l.flags|=4:a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Mr!==null&&(dm(Mr),Mr=null))),em(a,l),yi(l),null;case 5:Dp(l);var x=ja(Ec.current);if(f=l.type,a!==null&&l.stateNode!=null)Jx(a,l,f,g,x),a.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!g){if(l.stateNode===null)throw Error(n(166));return yi(l),null}if(a=ja(Gr.current),od(l)){g=l.stateNode,f=l.type;var E=l.memoizedProps;switch(g[Hr]=l,g[_c]=E,a=(l.mode&1)!==0,f){case"dialog":Pn("cancel",g),Pn("close",g);break;case"iframe":case"object":case"embed":Pn("load",g);break;case"video":case"audio":for(x=0;x<gc.length;x++)Pn(gc[x],g);break;case"source":Pn("error",g);break;case"img":case"image":case"link":Pn("error",g),Pn("load",g);break;case"details":Pn("toggle",g);break;case"input":nn(g,E),Pn("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!E.multiple},Pn("invalid",g);break;case"textarea":B(g,E),Pn("invalid",g)}rt(f,E),x=null;for(var D in E)if(E.hasOwnProperty(D)){var $=E[D];D==="children"?typeof $=="string"?g.textContent!==$&&(E.suppressHydrationWarning!==!0&&Qu(g.textContent,$,a),x=["children",$]):typeof $=="number"&&g.textContent!==""+$&&(E.suppressHydrationWarning!==!0&&Qu(g.textContent,$,a),x=["children",""+$]):r.hasOwnProperty(D)&&$!=null&&D==="onScroll"&&Pn("scroll",g)}switch(f){case"input":xt(g),ee(g,E,!0);break;case"textarea":xt(g),se(g);break;case"select":case"option":break;default:typeof E.onClick=="function"&&(g.onclick=ed)}g=x,l.updateQueue=g,g!==null&&(l.flags|=4)}else{D=x.nodeType===9?x:x.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=xe(f)),a==="http://www.w3.org/1999/xhtml"?f==="script"?(a=D.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof g.is=="string"?a=D.createElement(f,{is:g.is}):(a=D.createElement(f),f==="select"&&(D=a,g.multiple?D.multiple=!0:g.size&&(D.size=g.size))):a=D.createElementNS(a,f),a[Hr]=l,a[_c]=g,Zx(a,l,!1,!1),l.stateNode=a;e:{switch(D=$e(f,g),f){case"dialog":Pn("cancel",a),Pn("close",a),x=g;break;case"iframe":case"object":case"embed":Pn("load",a),x=g;break;case"video":case"audio":for(x=0;x<gc.length;x++)Pn(gc[x],a);x=g;break;case"source":Pn("error",a),x=g;break;case"img":case"image":case"link":Pn("error",a),Pn("load",a),x=g;break;case"details":Pn("toggle",a),x=g;break;case"input":nn(a,g),x=Ft(a,g),Pn("invalid",a);break;case"option":x=g;break;case"select":a._wrapperState={wasMultiple:!!g.multiple},x=Z({},g,{value:void 0}),Pn("invalid",a);break;case"textarea":B(a,g),x=it(a,g),Pn("invalid",a);break;default:x=g}rt(f,x),$=x;for(E in $)if($.hasOwnProperty(E)){var te=$[E];E==="style"?Oe(a,te):E==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&Ke(a,te)):E==="children"?typeof te=="string"?(f!=="textarea"||te!=="")&&ke(a,te):typeof te=="number"&&ke(a,""+te):E!=="suppressContentEditableWarning"&&E!=="suppressHydrationWarning"&&E!=="autoFocus"&&(r.hasOwnProperty(E)?te!=null&&E==="onScroll"&&Pn("scroll",a):te!=null&&A(a,E,te,D))}switch(f){case"input":xt(a),ee(a,g,!1);break;case"textarea":xt(a),se(a);break;case"option":g.value!=null&&a.setAttribute("value",""+be(g.value));break;case"select":a.multiple=!!g.multiple,E=g.value,E!=null?Lt(a,!!g.multiple,E,!1):g.defaultValue!=null&&Lt(a,!!g.multiple,g.defaultValue,!0);break;default:typeof x.onClick=="function"&&(a.onclick=ed)}switch(f){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return yi(l),null;case 6:if(a&&l.stateNode!=null)Qx(a,l,a.memoizedProps,g);else{if(typeof g!="string"&&l.stateNode===null)throw Error(n(166));if(f=ja(Ec.current),ja(Gr.current),od(l)){if(g=l.stateNode,f=l.memoizedProps,g[Hr]=l,(E=g.nodeValue!==f)&&(a=$i,a!==null))switch(a.tag){case 3:Qu(g.nodeValue,f,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&Qu(g.nodeValue,f,(a.mode&1)!==0)}E&&(l.flags|=4)}else g=(f.nodeType===9?f:f.ownerDocument).createTextNode(g),g[Hr]=l,l.stateNode=g}return yi(l),null;case 13:if(Rn(Fn),g=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Dn&&Xi!==null&&(l.mode&1)!==0&&(l.flags&128)===0)nx(),qo(),l.flags|=98560,E=!1;else if(E=od(l),g!==null&&g.dehydrated!==null){if(a===null){if(!E)throw Error(n(318));if(E=l.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(n(317));E[Hr]=l}else qo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;yi(l),E=!1}else Mr!==null&&(dm(Mr),Mr=null),E=!0;if(!E)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=f,l):(g=g!==null,g!==(a!==null&&a.memoizedState!==null)&&g&&(l.child.flags|=8192,(l.mode&1)!==0&&(a===null||(Fn.current&1)!==0?Qn===0&&(Qn=3):pm())),l.updateQueue!==null&&(l.flags|=4),yi(l),null);case 4:return Jo(),em(a,l),a===null&&vc(l.stateNode.containerInfo),yi(l),null;case 10:return Cp(l.type._context),yi(l),null;case 17:return Fi(l.type)&&nd(),yi(l),null;case 19:if(Rn(Fn),E=l.memoizedState,E===null)return yi(l),null;if(g=(l.flags&128)!==0,D=E.rendering,D===null)if(g)Pc(E,!1);else{if(Qn!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(D=hd(a),D!==null){for(l.flags|=128,Pc(E,!1),g=D.updateQueue,g!==null&&(l.updateQueue=g,l.flags|=4),l.subtreeFlags=0,g=f,f=l.child;f!==null;)E=f,a=g,E.flags&=14680066,D=E.alternate,D===null?(E.childLanes=0,E.lanes=a,E.child=null,E.subtreeFlags=0,E.memoizedProps=null,E.memoizedState=null,E.updateQueue=null,E.dependencies=null,E.stateNode=null):(E.childLanes=D.childLanes,E.lanes=D.lanes,E.child=D.child,E.subtreeFlags=0,E.deletions=null,E.memoizedProps=D.memoizedProps,E.memoizedState=D.memoizedState,E.updateQueue=D.updateQueue,E.type=D.type,a=D.dependencies,E.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),f=f.sibling;return Cn(Fn,Fn.current&1|2),l.child}a=a.sibling}E.tail!==null&&N()>nl&&(l.flags|=128,g=!0,Pc(E,!1),l.lanes=4194304)}else{if(!g)if(a=hd(D),a!==null){if(l.flags|=128,g=!0,f=a.updateQueue,f!==null&&(l.updateQueue=f,l.flags|=4),Pc(E,!0),E.tail===null&&E.tailMode==="hidden"&&!D.alternate&&!Dn)return yi(l),null}else 2*N()-E.renderingStartTime>nl&&f!==1073741824&&(l.flags|=128,g=!0,Pc(E,!1),l.lanes=4194304);E.isBackwards?(D.sibling=l.child,l.child=D):(f=E.last,f!==null?f.sibling=D:l.child=D,E.last=D)}return E.tail!==null?(l=E.tail,E.rendering=l,E.tail=l.sibling,E.renderingStartTime=N(),l.sibling=null,f=Fn.current,Cn(Fn,g?f&1|2:f&1),l):(yi(l),null);case 22:case 23:return hm(),g=l.memoizedState!==null,a!==null&&a.memoizedState!==null!==g&&(l.flags|=8192),g&&(l.mode&1)!==0?(qi&1073741824)!==0&&(yi(l),l.subtreeFlags&6&&(l.flags|=8192)):yi(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function KR(a,l){switch(Sp(l),l.tag){case 1:return Fi(l.type)&&nd(),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return Jo(),Rn(Ui),Rn(gi),Ip(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 5:return Dp(l),null;case 13:if(Rn(Fn),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(n(340));qo()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Rn(Fn),null;case 4:return Jo(),null;case 10:return Cp(l.type._context),null;case 22:case 23:return hm(),null;case 24:return null;default:return null}}var Sd=!1,_i=!1,ZR=typeof WeakSet=="function"?WeakSet:Set,at=null;function el(a,l){var f=a.ref;if(f!==null)if(typeof f=="function")try{f(null)}catch(g){Bn(a,l,g)}else f.current=null}function tm(a,l,f){try{f()}catch(g){Bn(a,l,g)}}var eb=!1;function JR(a,l){if(hp=Hu,a=L_(),sp(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var x=g.anchorOffset,E=g.focusNode;g=g.focusOffset;try{f.nodeType,E.nodeType}catch{f=null;break e}var D=0,$=-1,te=-1,ge=0,Ce=0,De=a,Ae=null;t:for(;;){for(var nt;De!==f||x!==0&&De.nodeType!==3||($=D+x),De!==E||g!==0&&De.nodeType!==3||(te=D+g),De.nodeType===3&&(D+=De.nodeValue.length),(nt=De.firstChild)!==null;)Ae=De,De=nt;for(;;){if(De===a)break t;if(Ae===f&&++ge===x&&($=D),Ae===E&&++Ce===g&&(te=D),(nt=De.nextSibling)!==null)break;De=Ae,Ae=De.parentNode}De=nt}f=$===-1||te===-1?null:{start:$,end:te}}else f=null}f=f||{start:0,end:0}}else f=null;for(pp={focusedElem:a,selectionRange:f},Hu=!1,at=l;at!==null;)if(l=at,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,at=a;else for(;at!==null;){l=at;try{var ut=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(ut!==null){var gt=ut.memoizedProps,Gn=ut.memoizedState,ue=l.stateNode,ae=ue.getSnapshotBeforeUpdate(l.elementType===l.type?gt:Tr(l.type,gt),Gn);ue.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var fe=l.stateNode.containerInfo;fe.nodeType===1?fe.textContent="":fe.nodeType===9&&fe.documentElement&&fe.removeChild(fe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Be){Bn(l,l.return,Be)}if(a=l.sibling,a!==null){a.return=l.return,at=a;break}at=l.return}return ut=eb,eb=!1,ut}function Rc(a,l,f){var g=l.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var x=g=g.next;do{if((x.tag&a)===a){var E=x.destroy;x.destroy=void 0,E!==void 0&&tm(l,f,E)}x=x.next}while(x!==g)}}function wd(a,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var f=l=l.next;do{if((f.tag&a)===a){var g=f.create;f.destroy=g()}f=f.next}while(f!==l)}}function nm(a){var l=a.ref;if(l!==null){var f=a.stateNode;a.tag,a=f,typeof l=="function"?l(a):l.current=a}}function tb(a){var l=a.alternate;l!==null&&(a.alternate=null,tb(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&(delete l[Hr],delete l[_c],delete l[yp],delete l[NR],delete l[IR])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function nb(a){return a.tag===5||a.tag===3||a.tag===4}function ib(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||nb(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function im(a,l,f){var g=a.tag;if(g===5||g===6)a=a.stateNode,l?f.nodeType===8?f.parentNode.insertBefore(a,l):f.insertBefore(a,l):(f.nodeType===8?(l=f.parentNode,l.insertBefore(a,f)):(l=f,l.appendChild(a)),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=ed));else if(g!==4&&(a=a.child,a!==null))for(im(a,l,f),a=a.sibling;a!==null;)im(a,l,f),a=a.sibling}function rm(a,l,f){var g=a.tag;if(g===5||g===6)a=a.stateNode,l?f.insertBefore(a,l):f.appendChild(a);else if(g!==4&&(a=a.child,a!==null))for(rm(a,l,f),a=a.sibling;a!==null;)rm(a,l,f),a=a.sibling}var di=null,Ar=!1;function oa(a,l,f){for(f=f.child;f!==null;)rb(a,l,f),f=f.sibling}function rb(a,l,f){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(Ge,f)}catch{}switch(f.tag){case 5:_i||el(f,l);case 6:var g=di,x=Ar;di=null,oa(a,l,f),di=g,Ar=x,di!==null&&(Ar?(a=di,f=f.stateNode,a.nodeType===8?a.parentNode.removeChild(f):a.removeChild(f)):di.removeChild(f.stateNode));break;case 18:di!==null&&(Ar?(a=di,f=f.stateNode,a.nodeType===8?vp(a.parentNode,f):a.nodeType===1&&vp(a,f),lc(a)):vp(di,f.stateNode));break;case 4:g=di,x=Ar,di=f.stateNode.containerInfo,Ar=!0,oa(a,l,f),di=g,Ar=x;break;case 0:case 11:case 14:case 15:if(!_i&&(g=f.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){x=g=g.next;do{var E=x,D=E.destroy;E=E.tag,D!==void 0&&((E&2)!==0||(E&4)!==0)&&tm(f,l,D),x=x.next}while(x!==g)}oa(a,l,f);break;case 1:if(!_i&&(el(f,l),g=f.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=f.memoizedProps,g.state=f.memoizedState,g.componentWillUnmount()}catch($){Bn(f,l,$)}oa(a,l,f);break;case 21:oa(a,l,f);break;case 22:f.mode&1?(_i=(g=_i)||f.memoizedState!==null,oa(a,l,f),_i=g):oa(a,l,f);break;default:oa(a,l,f)}}function sb(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var f=a.stateNode;f===null&&(f=a.stateNode=new ZR),l.forEach(function(g){var x=o2.bind(null,a,g);f.has(g)||(f.add(g),g.then(x,x))})}}function Cr(a,l){var f=l.deletions;if(f!==null)for(var g=0;g<f.length;g++){var x=f[g];try{var E=a,D=l,$=D;e:for(;$!==null;){switch($.tag){case 5:di=$.stateNode,Ar=!1;break e;case 3:di=$.stateNode.containerInfo,Ar=!0;break e;case 4:di=$.stateNode.containerInfo,Ar=!0;break e}$=$.return}if(di===null)throw Error(n(160));rb(E,D,x),di=null,Ar=!1;var te=x.alternate;te!==null&&(te.return=null),x.return=null}catch(ge){Bn(x,l,ge)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)ab(l,a),l=l.sibling}function ab(a,l){var f=a.alternate,g=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(Cr(l,a),Wr(a),g&4){try{Rc(3,a,a.return),wd(3,a)}catch(gt){Bn(a,a.return,gt)}try{Rc(5,a,a.return)}catch(gt){Bn(a,a.return,gt)}}break;case 1:Cr(l,a),Wr(a),g&512&&f!==null&&el(f,f.return);break;case 5:if(Cr(l,a),Wr(a),g&512&&f!==null&&el(f,f.return),a.flags&32){var x=a.stateNode;try{ke(x,"")}catch(gt){Bn(a,a.return,gt)}}if(g&4&&(x=a.stateNode,x!=null)){var E=a.memoizedProps,D=f!==null?f.memoizedProps:E,$=a.type,te=a.updateQueue;if(a.updateQueue=null,te!==null)try{$==="input"&&E.type==="radio"&&E.name!=null&&Dt(x,E),$e($,D);var ge=$e($,E);for(D=0;D<te.length;D+=2){var Ce=te[D],De=te[D+1];Ce==="style"?Oe(x,De):Ce==="dangerouslySetInnerHTML"?Ke(x,De):Ce==="children"?ke(x,De):A(x,Ce,De,ge)}switch($){case"input":an(x,E);break;case"textarea":R(x,E);break;case"select":var Ae=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!E.multiple;var nt=E.value;nt!=null?Lt(x,!!E.multiple,nt,!1):Ae!==!!E.multiple&&(E.defaultValue!=null?Lt(x,!!E.multiple,E.defaultValue,!0):Lt(x,!!E.multiple,E.multiple?[]:"",!1))}x[_c]=E}catch(gt){Bn(a,a.return,gt)}}break;case 6:if(Cr(l,a),Wr(a),g&4){if(a.stateNode===null)throw Error(n(162));x=a.stateNode,E=a.memoizedProps;try{x.nodeValue=E}catch(gt){Bn(a,a.return,gt)}}break;case 3:if(Cr(l,a),Wr(a),g&4&&f!==null&&f.memoizedState.isDehydrated)try{lc(l.containerInfo)}catch(gt){Bn(a,a.return,gt)}break;case 4:Cr(l,a),Wr(a);break;case 13:Cr(l,a),Wr(a),x=a.child,x.flags&8192&&(E=x.memoizedState!==null,x.stateNode.isHidden=E,!E||x.alternate!==null&&x.alternate.memoizedState!==null||(om=N())),g&4&&sb(a);break;case 22:if(Ce=f!==null&&f.memoizedState!==null,a.mode&1?(_i=(ge=_i)||Ce,Cr(l,a),_i=ge):Cr(l,a),Wr(a),g&8192){if(ge=a.memoizedState!==null,(a.stateNode.isHidden=ge)&&!Ce&&(a.mode&1)!==0)for(at=a,Ce=a.child;Ce!==null;){for(De=at=Ce;at!==null;){switch(Ae=at,nt=Ae.child,Ae.tag){case 0:case 11:case 14:case 15:Rc(4,Ae,Ae.return);break;case 1:el(Ae,Ae.return);var ut=Ae.stateNode;if(typeof ut.componentWillUnmount=="function"){g=Ae,f=Ae.return;try{l=g,ut.props=l.memoizedProps,ut.state=l.memoizedState,ut.componentWillUnmount()}catch(gt){Bn(g,f,gt)}}break;case 5:el(Ae,Ae.return);break;case 22:if(Ae.memoizedState!==null){cb(De);continue}}nt!==null?(nt.return=Ae,at=nt):cb(De)}Ce=Ce.sibling}e:for(Ce=null,De=a;;){if(De.tag===5){if(Ce===null){Ce=De;try{x=De.stateNode,ge?(E=x.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none"):($=De.stateNode,te=De.memoizedProps.style,D=te!=null&&te.hasOwnProperty("display")?te.display:null,$.style.display=Pe("display",D))}catch(gt){Bn(a,a.return,gt)}}}else if(De.tag===6){if(Ce===null)try{De.stateNode.nodeValue=ge?"":De.memoizedProps}catch(gt){Bn(a,a.return,gt)}}else if((De.tag!==22&&De.tag!==23||De.memoizedState===null||De===a)&&De.child!==null){De.child.return=De,De=De.child;continue}if(De===a)break e;for(;De.sibling===null;){if(De.return===null||De.return===a)break e;Ce===De&&(Ce=null),De=De.return}Ce===De&&(Ce=null),De.sibling.return=De.return,De=De.sibling}}break;case 19:Cr(l,a),Wr(a),g&4&&sb(a);break;case 21:break;default:Cr(l,a),Wr(a)}}function Wr(a){var l=a.flags;if(l&2){try{e:{for(var f=a.return;f!==null;){if(nb(f)){var g=f;break e}f=f.return}throw Error(n(160))}switch(g.tag){case 5:var x=g.stateNode;g.flags&32&&(ke(x,""),g.flags&=-33);var E=ib(a);rm(a,E,x);break;case 3:case 4:var D=g.stateNode.containerInfo,$=ib(a);im(a,$,D);break;default:throw Error(n(161))}}catch(te){Bn(a,a.return,te)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function QR(a,l,f){at=a,ob(a)}function ob(a,l,f){for(var g=(a.mode&1)!==0;at!==null;){var x=at,E=x.child;if(x.tag===22&&g){var D=x.memoizedState!==null||Sd;if(!D){var $=x.alternate,te=$!==null&&$.memoizedState!==null||_i;$=Sd;var ge=_i;if(Sd=D,(_i=te)&&!ge)for(at=x;at!==null;)D=at,te=D.child,D.tag===22&&D.memoizedState!==null?ub(x):te!==null?(te.return=D,at=te):ub(x);for(;E!==null;)at=E,ob(E),E=E.sibling;at=x,Sd=$,_i=ge}lb(a)}else(x.subtreeFlags&8772)!==0&&E!==null?(E.return=x,at=E):lb(a)}}function lb(a){for(;at!==null;){var l=at;if((l.flags&8772)!==0){var f=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:_i||wd(5,l);break;case 1:var g=l.stateNode;if(l.flags&4&&!_i)if(f===null)g.componentDidMount();else{var x=l.elementType===l.type?f.memoizedProps:Tr(l.type,f.memoizedProps);g.componentDidUpdate(x,f.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var E=l.updateQueue;E!==null&&cx(l,E,g);break;case 3:var D=l.updateQueue;if(D!==null){if(f=null,l.child!==null)switch(l.child.tag){case 5:f=l.child.stateNode;break;case 1:f=l.child.stateNode}cx(l,D,f)}break;case 5:var $=l.stateNode;if(f===null&&l.flags&4){f=$;var te=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&f.focus();break;case"img":te.src&&(f.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var ge=l.alternate;if(ge!==null){var Ce=ge.memoizedState;if(Ce!==null){var De=Ce.dehydrated;De!==null&&lc(De)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}_i||l.flags&512&&nm(l)}catch(Ae){Bn(l,l.return,Ae)}}if(l===a){at=null;break}if(f=l.sibling,f!==null){f.return=l.return,at=f;break}at=l.return}}function cb(a){for(;at!==null;){var l=at;if(l===a){at=null;break}var f=l.sibling;if(f!==null){f.return=l.return,at=f;break}at=l.return}}function ub(a){for(;at!==null;){var l=at;try{switch(l.tag){case 0:case 11:case 15:var f=l.return;try{wd(4,l)}catch(te){Bn(l,f,te)}break;case 1:var g=l.stateNode;if(typeof g.componentDidMount=="function"){var x=l.return;try{g.componentDidMount()}catch(te){Bn(l,x,te)}}var E=l.return;try{nm(l)}catch(te){Bn(l,E,te)}break;case 5:var D=l.return;try{nm(l)}catch(te){Bn(l,D,te)}}}catch(te){Bn(l,l.return,te)}if(l===a){at=null;break}var $=l.sibling;if($!==null){$.return=l.return,at=$;break}at=l.return}}var e2=Math.ceil,Ed=M.ReactCurrentDispatcher,sm=M.ReactCurrentOwner,ar=M.ReactCurrentBatchConfig,dn=0,ai=null,Wn=null,fi=0,qi=0,tl=na(0),Qn=0,kc=null,$a=0,Md=0,am=0,Lc=null,Bi=null,om=0,nl=1/0,Ms=null,Td=!1,lm=null,la=null,Ad=!1,ca=null,Cd=0,Dc=0,cm=null,Pd=-1,Rd=0;function Ai(){return(dn&6)!==0?N():Pd!==-1?Pd:Pd=N()}function ua(a){return(a.mode&1)===0?1:(dn&2)!==0&&fi!==0?fi&-fi:FR.transition!==null?(Rd===0&&(Rd=Ni()),Rd):(a=Ot,a!==0||(a=window.event,a=a===void 0?16:f_(a.type)),a)}function Pr(a,l,f,g){if(50<Dc)throw Dc=0,cm=null,Error(n(185));ji(a,f,g),((dn&2)===0||a!==ai)&&(a===ai&&((dn&2)===0&&(Md|=f),Qn===4&&da(a,fi)),zi(a,g),f===1&&dn===0&&(l.mode&1)===0&&(nl=N()+500,rd&&ra()))}function zi(a,l){var f=a.callbackNode;Mi(a,l);var g=Un(a,a===ai?fi:0);if(g===0)f!==null&&In(f),a.callbackNode=null,a.callbackPriority=0;else if(l=g&-g,a.callbackPriority!==l){if(f!=null&&In(f),l===1)a.tag===0?UR(fb.bind(null,a)):Z_(fb.bind(null,a)),LR(function(){(dn&6)===0&&ra()}),f=null;else{switch(wr(g)){case 1:f=pe;break;case 4:f=de;break;case 16:f=ce;break;case 536870912:f=qe;break;default:f=ce}f=xb(f,db.bind(null,a))}a.callbackPriority=l,a.callbackNode=f}}function db(a,l){if(Pd=-1,Rd=0,(dn&6)!==0)throw Error(n(327));var f=a.callbackNode;if(il()&&a.callbackNode!==f)return null;var g=Un(a,a===ai?fi:0);if(g===0)return null;if((g&30)!==0||(g&a.expiredLanes)!==0||l)l=kd(a,g);else{l=g;var x=dn;dn|=2;var E=pb();(ai!==a||fi!==l)&&(Ms=null,nl=N()+500,qa(a,l));do try{i2();break}catch($){hb(a,$)}while(!0);Ap(),Ed.current=E,dn=x,Wn!==null?l=0:(ai=null,fi=0,l=Qn)}if(l!==0){if(l===2&&(x=rn(a),x!==0&&(g=x,l=um(a,x))),l===1)throw f=kc,qa(a,0),da(a,g),zi(a,N()),f;if(l===6)da(a,g);else{if(x=a.current.alternate,(g&30)===0&&!t2(x)&&(l=kd(a,g),l===2&&(E=rn(a),E!==0&&(g=E,l=um(a,E))),l===1))throw f=kc,qa(a,0),da(a,g),zi(a,N()),f;switch(a.finishedWork=x,a.finishedLanes=g,l){case 0:case 1:throw Error(n(345));case 2:Ya(a,Bi,Ms);break;case 3:if(da(a,g),(g&130023424)===g&&(l=om+500-N(),10<l)){if(Un(a,0)!==0)break;if(x=a.suspendedLanes,(x&g)!==g){Ai(),a.pingedLanes|=a.suspendedLanes&x;break}a.timeoutHandle=gp(Ya.bind(null,a,Bi,Ms),l);break}Ya(a,Bi,Ms);break;case 4:if(da(a,g),(g&4194240)===g)break;for(l=a.eventTimes,x=-1;0<g;){var D=31-Ve(g);E=1<<D,D=l[D],D>x&&(x=D),g&=~E}if(g=x,g=N()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*e2(g/1960))-g,10<g){a.timeoutHandle=gp(Ya.bind(null,a,Bi,Ms),g);break}Ya(a,Bi,Ms);break;case 5:Ya(a,Bi,Ms);break;default:throw Error(n(329))}}}return zi(a,N()),a.callbackNode===f?db.bind(null,a):null}function um(a,l){var f=Lc;return a.current.memoizedState.isDehydrated&&(qa(a,l).flags|=256),a=kd(a,l),a!==2&&(l=Bi,Bi=f,l!==null&&dm(l)),a}function dm(a){Bi===null?Bi=a:Bi.push.apply(Bi,a)}function t2(a){for(var l=a;;){if(l.flags&16384){var f=l.updateQueue;if(f!==null&&(f=f.stores,f!==null))for(var g=0;g<f.length;g++){var x=f[g],E=x.getSnapshot;x=x.value;try{if(!Er(E(),x))return!1}catch{return!1}}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function da(a,l){for(l&=~am,l&=~Md,a.suspendedLanes|=l,a.pingedLanes&=~l,a=a.expirationTimes;0<l;){var f=31-Ve(l),g=1<<f;a[f]=-1,l&=~g}}function fb(a){if((dn&6)!==0)throw Error(n(327));il();var l=Un(a,0);if((l&1)===0)return zi(a,N()),null;var f=kd(a,l);if(a.tag!==0&&f===2){var g=rn(a);g!==0&&(l=g,f=um(a,g))}if(f===1)throw f=kc,qa(a,0),da(a,l),zi(a,N()),f;if(f===6)throw Error(n(345));return a.finishedWork=a.current.alternate,a.finishedLanes=l,Ya(a,Bi,Ms),zi(a,N()),null}function fm(a,l){var f=dn;dn|=1;try{return a(l)}finally{dn=f,dn===0&&(nl=N()+500,rd&&ra())}}function Xa(a){ca!==null&&ca.tag===0&&(dn&6)===0&&il();var l=dn;dn|=1;var f=ar.transition,g=Ot;try{if(ar.transition=null,Ot=1,a)return a()}finally{Ot=g,ar.transition=f,dn=l,(dn&6)===0&&ra()}}function hm(){qi=tl.current,Rn(tl)}function qa(a,l){a.finishedWork=null,a.finishedLanes=0;var f=a.timeoutHandle;if(f!==-1&&(a.timeoutHandle=-1,kR(f)),Wn!==null)for(f=Wn.return;f!==null;){var g=f;switch(Sp(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&nd();break;case 3:Jo(),Rn(Ui),Rn(gi),Ip();break;case 5:Dp(g);break;case 4:Jo();break;case 13:Rn(Fn);break;case 19:Rn(Fn);break;case 10:Cp(g.type._context);break;case 22:case 23:hm()}f=f.return}if(ai=a,Wn=a=fa(a.current,null),fi=qi=l,Qn=0,kc=null,am=Md=$a=0,Bi=Lc=null,Ga!==null){for(l=0;l<Ga.length;l++)if(f=Ga[l],g=f.interleaved,g!==null){f.interleaved=null;var x=g.next,E=f.pending;if(E!==null){var D=E.next;E.next=x,g.next=D}f.pending=g}Ga=null}return a}function hb(a,l){do{var f=Wn;try{if(Ap(),pd.current=yd,md){for(var g=On.memoizedState;g!==null;){var x=g.queue;x!==null&&(x.pending=null),g=g.next}md=!1}if(Wa=0,si=Jn=On=null,Mc=!1,Tc=0,sm.current=null,f===null||f.return===null){Qn=1,kc=l,Wn=null;break}e:{var E=a,D=f.return,$=f,te=l;if(l=fi,$.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var ge=te,Ce=$,De=Ce.tag;if((Ce.mode&1)===0&&(De===0||De===11||De===15)){var Ae=Ce.alternate;Ae?(Ce.updateQueue=Ae.updateQueue,Ce.memoizedState=Ae.memoizedState,Ce.lanes=Ae.lanes):(Ce.updateQueue=null,Ce.memoizedState=null)}var nt=Ox(D);if(nt!==null){nt.flags&=-257,Bx(nt,D,$,E,l),nt.mode&1&&Fx(E,ge,l),l=nt,te=ge;var ut=l.updateQueue;if(ut===null){var gt=new Set;gt.add(te),l.updateQueue=gt}else ut.add(te);break e}else{if((l&1)===0){Fx(E,ge,l),pm();break e}te=Error(n(426))}}else if(Dn&&$.mode&1){var Gn=Ox(D);if(Gn!==null){(Gn.flags&65536)===0&&(Gn.flags|=256),Bx(Gn,D,$,E,l),Mp(Qo(te,$));break e}}E=te=Qo(te,$),Qn!==4&&(Qn=2),Lc===null?Lc=[E]:Lc.push(E),E=D;do{switch(E.tag){case 3:E.flags|=65536,l&=-l,E.lanes|=l;var ue=Ix(E,te,l);lx(E,ue);break e;case 1:$=te;var ae=E.type,fe=E.stateNode;if((E.flags&128)===0&&(typeof ae.getDerivedStateFromError=="function"||fe!==null&&typeof fe.componentDidCatch=="function"&&(la===null||!la.has(fe)))){E.flags|=65536,l&=-l,E.lanes|=l;var Be=Ux(E,$,l);lx(E,Be);break e}}E=E.return}while(E!==null)}gb(f)}catch(St){l=St,Wn===f&&f!==null&&(Wn=f=f.return);continue}break}while(!0)}function pb(){var a=Ed.current;return Ed.current=yd,a===null?yd:a}function pm(){(Qn===0||Qn===3||Qn===2)&&(Qn=4),ai===null||($a&268435455)===0&&(Md&268435455)===0||da(ai,fi)}function kd(a,l){var f=dn;dn|=2;var g=pb();(ai!==a||fi!==l)&&(Ms=null,qa(a,l));do try{n2();break}catch(x){hb(a,x)}while(!0);if(Ap(),dn=f,Ed.current=g,Wn!==null)throw Error(n(261));return ai=null,fi=0,Qn}function n2(){for(;Wn!==null;)mb(Wn)}function i2(){for(;Wn!==null&&!Zn();)mb(Wn)}function mb(a){var l=_b(a.alternate,a,qi);a.memoizedProps=a.pendingProps,l===null?gb(a):Wn=l,sm.current=null}function gb(a){var l=a;do{var f=l.alternate;if(a=l.return,(l.flags&32768)===0){if(f=YR(f,l,qi),f!==null){Wn=f;return}}else{if(f=KR(f,l),f!==null){f.flags&=32767,Wn=f;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{Qn=6,Wn=null;return}}if(l=l.sibling,l!==null){Wn=l;return}Wn=l=a}while(l!==null);Qn===0&&(Qn=5)}function Ya(a,l,f){var g=Ot,x=ar.transition;try{ar.transition=null,Ot=1,r2(a,l,f,g)}finally{ar.transition=x,Ot=g}return null}function r2(a,l,f,g){do il();while(ca!==null);if((dn&6)!==0)throw Error(n(327));f=a.finishedWork;var x=a.finishedLanes;if(f===null)return null;if(a.finishedWork=null,a.finishedLanes=0,f===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0;var E=f.lanes|f.childLanes;if(qs(a,E),a===ai&&(Wn=ai=null,fi=0),(f.subtreeFlags&2064)===0&&(f.flags&2064)===0||Ad||(Ad=!0,xb(ce,function(){return il(),null})),E=(f.flags&15990)!==0,(f.subtreeFlags&15990)!==0||E){E=ar.transition,ar.transition=null;var D=Ot;Ot=1;var $=dn;dn|=4,sm.current=null,JR(a,f),ab(f,a),ER(pp),Hu=!!hp,pp=hp=null,a.current=f,QR(f),gn(),dn=$,Ot=D,ar.transition=E}else a.current=f;if(Ad&&(Ad=!1,ca=a,Cd=x),E=a.pendingLanes,E===0&&(la=null),ct(f.stateNode),zi(a,N()),l!==null)for(g=a.onRecoverableError,f=0;f<l.length;f++)x=l[f],g(x.value,{componentStack:x.stack,digest:x.digest});if(Td)throw Td=!1,a=lm,lm=null,a;return(Cd&1)!==0&&a.tag!==0&&il(),E=a.pendingLanes,(E&1)!==0?a===cm?Dc++:(Dc=0,cm=a):Dc=0,ra(),null}function il(){if(ca!==null){var a=wr(Cd),l=ar.transition,f=Ot;try{if(ar.transition=null,Ot=16>a?16:a,ca===null)var g=!1;else{if(a=ca,ca=null,Cd=0,(dn&6)!==0)throw Error(n(331));var x=dn;for(dn|=4,at=a.current;at!==null;){var E=at,D=E.child;if((at.flags&16)!==0){var $=E.deletions;if($!==null){for(var te=0;te<$.length;te++){var ge=$[te];for(at=ge;at!==null;){var Ce=at;switch(Ce.tag){case 0:case 11:case 15:Rc(8,Ce,E)}var De=Ce.child;if(De!==null)De.return=Ce,at=De;else for(;at!==null;){Ce=at;var Ae=Ce.sibling,nt=Ce.return;if(tb(Ce),Ce===ge){at=null;break}if(Ae!==null){Ae.return=nt,at=Ae;break}at=nt}}}var ut=E.alternate;if(ut!==null){var gt=ut.child;if(gt!==null){ut.child=null;do{var Gn=gt.sibling;gt.sibling=null,gt=Gn}while(gt!==null)}}at=E}}if((E.subtreeFlags&2064)!==0&&D!==null)D.return=E,at=D;else e:for(;at!==null;){if(E=at,(E.flags&2048)!==0)switch(E.tag){case 0:case 11:case 15:Rc(9,E,E.return)}var ue=E.sibling;if(ue!==null){ue.return=E.return,at=ue;break e}at=E.return}}var ae=a.current;for(at=ae;at!==null;){D=at;var fe=D.child;if((D.subtreeFlags&2064)!==0&&fe!==null)fe.return=D,at=fe;else e:for(D=ae;at!==null;){if($=at,($.flags&2048)!==0)try{switch($.tag){case 0:case 11:case 15:wd(9,$)}}catch(St){Bn($,$.return,St)}if($===D){at=null;break e}var Be=$.sibling;if(Be!==null){Be.return=$.return,at=Be;break e}at=$.return}}if(dn=x,ra(),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(Ge,a)}catch{}g=!0}return g}finally{Ot=f,ar.transition=l}}return!1}function vb(a,l,f){l=Qo(f,l),l=Ix(a,l,1),a=aa(a,l,1),l=Ai(),a!==null&&(ji(a,1,l),zi(a,l))}function Bn(a,l,f){if(a.tag===3)vb(a,a,f);else for(;l!==null;){if(l.tag===3){vb(l,a,f);break}else if(l.tag===1){var g=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(la===null||!la.has(g))){a=Qo(f,a),a=Ux(l,a,1),l=aa(l,a,1),a=Ai(),l!==null&&(ji(l,1,a),zi(l,a));break}}l=l.return}}function s2(a,l,f){var g=a.pingCache;g!==null&&g.delete(l),l=Ai(),a.pingedLanes|=a.suspendedLanes&f,ai===a&&(fi&f)===f&&(Qn===4||Qn===3&&(fi&130023424)===fi&&500>N()-om?qa(a,0):am|=f),zi(a,l)}function yb(a,l){l===0&&((a.mode&1)===0?l=1:(l=vn,vn<<=1,(vn&130023424)===0&&(vn=4194304)));var f=Ai();a=Ss(a,l),a!==null&&(ji(a,l,f),zi(a,f))}function a2(a){var l=a.memoizedState,f=0;l!==null&&(f=l.retryLane),yb(a,f)}function o2(a,l){var f=0;switch(a.tag){case 13:var g=a.stateNode,x=a.memoizedState;x!==null&&(f=x.retryLane);break;case 19:g=a.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(l),yb(a,f)}var _b;_b=function(a,l,f){if(a!==null)if(a.memoizedProps!==l.pendingProps||Ui.current)Oi=!0;else{if((a.lanes&f)===0&&(l.flags&128)===0)return Oi=!1,qR(a,l,f);Oi=(a.flags&131072)!==0}else Oi=!1,Dn&&(l.flags&1048576)!==0&&J_(l,ad,l.index);switch(l.lanes=0,l.tag){case 2:var g=l.type;bd(a,l),a=l.pendingProps;var x=Wo(l,gi.current);Zo(l,f),x=Op(null,l,g,a,x,f);var E=Bp();return l.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Fi(g)?(E=!0,id(l)):E=!1,l.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,kp(l),x.updater=_d,l.stateNode=x,x._reactInternals=l,Wp(l,g,a,f),l=Yp(null,l,g,!0,E,f)):(l.tag=0,Dn&&E&&bp(l),Ti(null,l,x,f),l=l.child),l;case 16:g=l.elementType;e:{switch(bd(a,l),a=l.pendingProps,x=g._init,g=x(g._payload),l.type=g,x=l.tag=c2(g),a=Tr(g,a),x){case 0:l=qp(null,l,g,a,f);break e;case 1:l=Wx(null,l,g,a,f);break e;case 11:l=zx(null,l,g,a,f);break e;case 14:l=Vx(null,l,g,Tr(g.type,a),f);break e}throw Error(n(306,g,""))}return l;case 0:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),qp(a,l,g,x,f);case 1:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),Wx(a,l,g,x,f);case 3:e:{if($x(l),a===null)throw Error(n(387));g=l.pendingProps,E=l.memoizedState,x=E.element,ox(a,l),fd(l,g,null,f);var D=l.memoizedState;if(g=D.element,E.isDehydrated)if(E={element:g,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},l.updateQueue.baseState=E,l.memoizedState=E,l.flags&256){x=Qo(Error(n(423)),l),l=Xx(a,l,g,f,x);break e}else if(g!==x){x=Qo(Error(n(424)),l),l=Xx(a,l,g,f,x);break e}else for(Xi=ta(l.stateNode.containerInfo.firstChild),$i=l,Dn=!0,Mr=null,f=sx(l,null,g,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(qo(),g===x){l=Es(a,l,f);break e}Ti(a,l,g,f)}l=l.child}return l;case 5:return ux(l),a===null&&Ep(l),g=l.type,x=l.pendingProps,E=a!==null?a.memoizedProps:null,D=x.children,mp(g,x)?D=null:E!==null&&mp(g,E)&&(l.flags|=32),jx(a,l),Ti(a,l,D,f),l.child;case 6:return a===null&&Ep(l),null;case 13:return qx(a,l,f);case 4:return Lp(l,l.stateNode.containerInfo),g=l.pendingProps,a===null?l.child=Yo(l,null,g,f):Ti(a,l,g,f),l.child;case 11:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),zx(a,l,g,x,f);case 7:return Ti(a,l,l.pendingProps,f),l.child;case 8:return Ti(a,l,l.pendingProps.children,f),l.child;case 12:return Ti(a,l,l.pendingProps.children,f),l.child;case 10:e:{if(g=l.type._context,x=l.pendingProps,E=l.memoizedProps,D=x.value,Cn(cd,g._currentValue),g._currentValue=D,E!==null)if(Er(E.value,D)){if(E.children===x.children&&!Ui.current){l=Es(a,l,f);break e}}else for(E=l.child,E!==null&&(E.return=l);E!==null;){var $=E.dependencies;if($!==null){D=E.child;for(var te=$.firstContext;te!==null;){if(te.context===g){if(E.tag===1){te=ws(-1,f&-f),te.tag=2;var ge=E.updateQueue;if(ge!==null){ge=ge.shared;var Ce=ge.pending;Ce===null?te.next=te:(te.next=Ce.next,Ce.next=te),ge.pending=te}}E.lanes|=f,te=E.alternate,te!==null&&(te.lanes|=f),Pp(E.return,f,l),$.lanes|=f;break}te=te.next}}else if(E.tag===10)D=E.type===l.type?null:E.child;else if(E.tag===18){if(D=E.return,D===null)throw Error(n(341));D.lanes|=f,$=D.alternate,$!==null&&($.lanes|=f),Pp(D,f,l),D=E.sibling}else D=E.child;if(D!==null)D.return=E;else for(D=E;D!==null;){if(D===l){D=null;break}if(E=D.sibling,E!==null){E.return=D.return,D=E;break}D=D.return}E=D}Ti(a,l,x.children,f),l=l.child}return l;case 9:return x=l.type,g=l.pendingProps.children,Zo(l,f),x=rr(x),g=g(x),l.flags|=1,Ti(a,l,g,f),l.child;case 14:return g=l.type,x=Tr(g,l.pendingProps),x=Tr(g.type,x),Vx(a,l,g,x,f);case 15:return Hx(a,l,l.type,l.pendingProps,f);case 17:return g=l.type,x=l.pendingProps,x=l.elementType===g?x:Tr(g,x),bd(a,l),l.tag=1,Fi(g)?(a=!0,id(l)):a=!1,Zo(l,f),Dx(l,g,x),Wp(l,g,x,f),Yp(null,l,g,!0,a,f);case 19:return Kx(a,l,f);case 22:return Gx(a,l,f)}throw Error(n(156,l.tag))};function xb(a,l){return En(a,l)}function l2(a,l,f,g){this.tag=a,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function or(a,l,f,g){return new l2(a,l,f,g)}function mm(a){return a=a.prototype,!(!a||!a.isReactComponent)}function c2(a){if(typeof a=="function")return mm(a)?1:0;if(a!=null){if(a=a.$$typeof,a===G)return 11;if(a===X)return 14}return 2}function fa(a,l){var f=a.alternate;return f===null?(f=or(a.tag,l,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=l,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&14680064,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,l=a.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f}function Ld(a,l,f,g,x,E){var D=2;if(g=a,typeof a=="function")mm(a)&&(D=1);else if(typeof a=="string")D=5;else e:switch(a){case U:return Ka(f.children,x,E,l);case S:D=8,x|=8;break;case P:return a=or(12,f,l,x|2),a.elementType=P,a.lanes=E,a;case J:return a=or(13,f,l,x),a.elementType=J,a.lanes=E,a;case H:return a=or(19,f,l,x),a.elementType=H,a.lanes=E,a;case Q:return Dd(f,x,E,l);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case V:D=10;break e;case O:D=9;break e;case G:D=11;break e;case X:D=14;break e;case K:D=16,g=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return l=or(D,f,l,x),l.elementType=a,l.type=g,l.lanes=E,l}function Ka(a,l,f,g){return a=or(7,a,g,l),a.lanes=f,a}function Dd(a,l,f,g){return a=or(22,a,g,l),a.elementType=Q,a.lanes=f,a.stateNode={isHidden:!1},a}function gm(a,l,f){return a=or(6,a,null,l),a.lanes=f,a}function vm(a,l,f){return l=or(4,a.children!==null?a.children:[],a.key,l),l.lanes=f,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}function u2(a,l,f,g,x){this.tag=l,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ii(0),this.expirationTimes=Ii(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ii(0),this.identifierPrefix=g,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function ym(a,l,f,g,x,E,D,$,te){return a=new u2(a,l,f,$,te),l===1?(l=1,E===!0&&(l|=8)):l=0,E=or(3,null,null,l),a.current=E,E.stateNode=a,E.memoizedState={element:g,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null},kp(E),a}function d2(a,l,f){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:k,key:g==null?null:""+g,children:a,containerInfo:l,implementation:f}}function bb(a){if(!a)return ia;a=a._reactInternals;e:{if(Qe(a)!==a||a.tag!==1)throw Error(n(170));var l=a;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Fi(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(a.tag===1){var f=a.type;if(Fi(f))return Y_(a,f,l)}return l}function Sb(a,l,f,g,x,E,D,$,te){return a=ym(f,g,!0,a,x,E,D,$,te),a.context=bb(null),f=a.current,g=Ai(),x=ua(f),E=ws(g,x),E.callback=l??null,aa(f,E,x),a.current.lanes=x,ji(a,x,g),zi(a,g),a}function Nd(a,l,f,g){var x=l.current,E=Ai(),D=ua(x);return f=bb(f),l.context===null?l.context=f:l.pendingContext=f,l=ws(E,D),l.payload={element:a},g=g===void 0?null:g,g!==null&&(l.callback=g),a=aa(x,l,D),a!==null&&(Pr(a,x,D,E),dd(a,x,D)),D}function Id(a){return a=a.current,a.child?(a.child.tag===5,a.child.stateNode):null}function wb(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<l?f:l}}function _m(a,l){wb(a,l),(a=a.alternate)&&wb(a,l)}function f2(){return null}var Eb=typeof reportError=="function"?reportError:function(a){console.error(a)};function xm(a){this._internalRoot=a}Ud.prototype.render=xm.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(n(409));Nd(a,l,null,null)},Ud.prototype.unmount=xm.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;Xa(function(){Nd(null,a,null,null)}),l[ys]=null}};function Ud(a){this._internalRoot=a}Ud.prototype.unstable_scheduleHydration=function(a){if(a){var l=ic();a={blockedOn:null,target:a,priority:l};for(var f=0;f<Js.length&&l!==0&&l<Js[f].priority;f++);Js.splice(f,0,a),f===0&&u_(a)}};function bm(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function Fd(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function Mb(){}function h2(a,l,f,g,x){if(x){if(typeof g=="function"){var E=g;g=function(){var ge=Id(D);E.call(ge)}}var D=Sb(l,g,a,0,null,!1,!1,"",Mb);return a._reactRootContainer=D,a[ys]=D.current,vc(a.nodeType===8?a.parentNode:a),Xa(),D}for(;x=a.lastChild;)a.removeChild(x);if(typeof g=="function"){var $=g;g=function(){var ge=Id(te);$.call(ge)}}var te=ym(a,0,!1,null,null,!1,!1,"",Mb);return a._reactRootContainer=te,a[ys]=te.current,vc(a.nodeType===8?a.parentNode:a),Xa(function(){Nd(l,te,f,g)}),te}function Od(a,l,f,g,x){var E=f._reactRootContainer;if(E){var D=E;if(typeof x=="function"){var $=x;x=function(){var te=Id(D);$.call(te)}}Nd(l,D,a,x)}else D=h2(f,l,a,x,g);return Id(D)}Hn=function(a){switch(a.tag){case 3:var l=a.stateNode;if(l.current.memoizedState.isDehydrated){var f=tn(l.pendingLanes);f!==0&&(xn(l,f|1),zi(l,N()),(dn&6)===0&&(nl=N()+500,ra()))}break;case 13:Xa(function(){var g=Ss(a,1);if(g!==null){var x=Ai();Pr(g,a,1,x)}}),_m(a,1)}},tr=function(a){if(a.tag===13){var l=Ss(a,134217728);if(l!==null){var f=Ai();Pr(l,a,134217728,f)}_m(a,134217728)}},vs=function(a){if(a.tag===13){var l=ua(a),f=Ss(a,l);if(f!==null){var g=Ai();Pr(f,a,l,g)}_m(a,l)}},ic=function(){return Ot},l_=function(a,l){var f=Ot;try{return Ot=a,l()}finally{Ot=f}},ze=function(a,l,f){switch(l){case"input":if(an(a,f),l=f.name,f.type==="radio"&&l!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<f.length;l++){var g=f[l];if(g!==a&&g.form===a.form){var x=td(g);if(!x)throw Error(n(90));pn(g),an(g,x)}}}break;case"textarea":R(a,f);break;case"select":l=f.value,l!=null&&Lt(a,!!f.multiple,l,!1)}},Nt=fm,mn=Xa;var p2={usingClientEntryPoint:!1,Events:[xc,Go,td,_e,st,fm]},Nc={findFiberByHostInstance:Ba,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},m2={bundleType:Nc.bundleType,version:Nc.version,rendererPackageName:Nc.rendererPackageName,rendererConfig:Nc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){return a=un(a),a===null?null:a.stateNode},findFiberByHostInstance:Nc.findFiberByHostInstance||f2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bd.isDisabled&&Bd.supportsFiber)try{Ge=Bd.inject(m2),We=Bd}catch{}}return Vi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=p2,Vi.createPortal=function(a,l){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bm(l))throw Error(n(200));return d2(a,l,null,f)},Vi.createRoot=function(a,l){if(!bm(a))throw Error(n(299));var f=!1,g="",x=Eb;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onRecoverableError!==void 0&&(x=l.onRecoverableError)),l=ym(a,1,!1,null,null,f,!1,g,x),a[ys]=l.current,vc(a.nodeType===8?a.parentNode:a),new xm(l)},Vi.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=un(l),a=a===null?null:a.stateNode,a},Vi.flushSync=function(a){return Xa(a)},Vi.hydrate=function(a,l,f){if(!Fd(l))throw Error(n(200));return Od(null,a,l,!0,f)},Vi.hydrateRoot=function(a,l,f){if(!bm(a))throw Error(n(405));var g=f!=null&&f.hydratedSources||null,x=!1,E="",D=Eb;if(f!=null&&(f.unstable_strictMode===!0&&(x=!0),f.identifierPrefix!==void 0&&(E=f.identifierPrefix),f.onRecoverableError!==void 0&&(D=f.onRecoverableError)),l=Sb(l,null,a,1,f??null,x,!1,E,D),a[ys]=l.current,vc(a),g)for(a=0;a<g.length;a++)f=g[a],x=f._getVersion,x=x(f._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[f,x]:l.mutableSourceEagerHydrationData.push(f,x);return new Ud(l)},Vi.render=function(a,l,f){if(!Fd(l))throw Error(n(200));return Od(null,a,l,!1,f)},Vi.unmountComponentAtNode=function(a){if(!Fd(a))throw Error(n(40));return a._reactRootContainer?(Xa(function(){Od(null,null,a,!1,function(){a._reactRootContainer=null,a[ys]=null})}),!0):!1},Vi.unstable_batchedUpdates=fm,Vi.unstable_renderSubtreeIntoContainer=function(a,l,f,g){if(!Fd(f))throw Error(n(200));if(a==null||a._reactInternals===void 0)throw Error(n(38));return Od(a,l,f,!1,g)},Vi.version="18.3.1-next-f1338f8080-20240426",Vi}var Db;function zE(){if(Db)return Em.exports;Db=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Em.exports=E2(),Em.exports}var Nb;function M2(){if(Nb)return zd;Nb=1;var t=zE();return zd.createRoot=t.createRoot,zd.hydrateRoot=t.hydrateRoot,zd}var T2=M2();var VE=t=>{throw TypeError(t)},A2=(t,e,n)=>e.has(t)||VE("Cannot "+n),Am=(t,e,n)=>(A2(t,e,"read from private field"),n?n.call(t):e.get(t)),C2=(t,e,n)=>e.has(t)?VE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ib="popstate";function Ub(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function P2(t={}){function e(i,r){let s=r.state?.masked,{pathname:o,search:c,hash:u}=s||i.location;return du("",{pathname:o,search:c,hash:u},r.state&&r.state.usr||null,r.state&&r.state.key||"default",s?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:ss(r)}return k2(e,n,null,t)}function Qt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function jn(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function R2(){return Math.random().toString(36).substring(2,10)}function Fb(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function du(t,e,n=null,i,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?js(e):e,state:n,key:e&&e.key||i||R2(),unstable_mask:r}}function ss({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function js(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let i=t.indexOf("?");i>=0&&(e.search=t.substring(i),t=t.substring(0,i)),t&&(e.pathname=t)}return e}function k2(t,e,n,i={}){let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,c="POP",u=null,d=h();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function h(){return(o.state||{idx:null}).idx}function p(){c="POP";let y=h(),b=y==null?null:y-d;d=y,u&&u({action:c,location:w.location,delta:b})}function m(y,b){c="PUSH";let T=Ub(y)?y:du(w.location,y,b);d=h()+1;let A=Fb(T,d),M=w.createHref(T.unstable_mask||T);try{o.pushState(A,"",M)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;r.location.assign(M)}s&&u&&u({action:c,location:w.location,delta:1})}function v(y,b){c="REPLACE";let T=Ub(y)?y:du(w.location,y,b);d=h();let A=Fb(T,d),M=w.createHref(T.unstable_mask||T);o.replaceState(A,"",M),s&&u&&u({action:c,location:w.location,delta:0})}function _(y){return HE(y)}let w={get action(){return c},get location(){return t(r,o)},listen(y){if(u)throw new Error("A history only accepts one active listener");return r.addEventListener(Ib,p),u=y,()=>{r.removeEventListener(Ib,p),u=null}},createHref(y){return e(r,y)},createURL:_,encodeLocation(y){let b=_(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:m,replace:v,go(y){return o.go(y)}};return w}function HE(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Qt(n,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:ss(t);return i=i.replace(/ $/,"%20"),!e&&i.startsWith("//")&&(i=n+i),new URL(i,n)}var Kc,Ob=class{constructor(t){if(C2(this,Kc,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(Am(this,Kc).has(t))return Am(this,Kc).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){Am(this,Kc).set(t,e)}};Kc=new WeakMap;var L2=new Set(["lazy","caseSensitive","path","id","index","children"]);function D2(t){return L2.has(t)}var N2=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function I2(t){return N2.has(t)}function U2(t){return t.index===!0}function fu(t,e,n=[],i={},r=!1){return t.map((s,o)=>{let c=[...n,String(o)],u=typeof s.id=="string"?s.id:c.join("-");if(Qt(s.index!==!0||!s.children,"Cannot specify children on an index route"),Qt(r||!i[u],`Found a route id collision on id "${u}". Route id's must be globally unique within Data Router usages`),U2(s)){let d={...s,id:u};return i[u]=Bb(d,e(d)),d}else{let d={...s,id:u,children:void 0};return i[u]=Bb(d,e(d)),s.children&&(d.children=fu(s.children,e,c,i,r)),d}})}function Bb(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function Ea(t,e,n="/"){return Zc(t,e,n,!1)}function Zc(t,e,n,i){let r=typeof e=="string"?js(e):e,s=mr(r.pathname||"/",n);if(s==null)return null;let o=GE(t);O2(o);let c=null;for(let u=0;c==null&&u<o.length;++u){let d=Y2(s);c=X2(o[u],d,i)}return c}function F2(t,e){let{route:n,pathname:i,params:r}=t;return{id:n.id,pathname:i,params:r,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function GE(t,e=[],n=[],i="",r=!1){let s=(o,c,u=r,d)=>{let h={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(i)&&u)return;Qt(h.relativePath.startsWith(i),`Absolute route path "${h.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(i.length)}let p=Br([i,h.relativePath]),m=n.concat(h);o.children&&o.children.length>0&&(Qt(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),GE(o.children,e,m,p,u)),!(o.path==null&&!o.index)&&e.push({path:p,score:W2(p,o.index),routesMeta:m})};return t.forEach((o,c)=>{if(o.path===""||!o.path?.includes("?"))s(o,c);else for(let u of jE(o.path))s(o,c,!0,u)}),e}function jE(t){let e=t.split("/");if(e.length===0)return[];let[n,...i]=e,r=n.endsWith("?"),s=n.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let o=jE(i.join("/")),c=[];return c.push(...o.map(u=>u===""?s:[s,u].join("/"))),r&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function O2(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:$2(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var B2=/^:[\w-]+$/,z2=3,V2=2,H2=1,G2=10,j2=-2,zb=t=>t==="*";function W2(t,e){let n=t.split("/"),i=n.length;return n.some(zb)&&(i+=j2),e&&(i+=V2),n.filter(r=>!zb(r)).reduce((r,s)=>r+(B2.test(s)?z2:s===""?H2:G2),i)}function $2(t,e){return t.length===e.length&&t.slice(0,-1).every((i,r)=>i===e[r])?t[t.length-1]-e[e.length-1]:0}function X2(t,e,n=!1){let{routesMeta:i}=t,r={},s="/",o=[];for(let c=0;c<i.length;++c){let u=i[c],d=c===i.length-1,h=s==="/"?e:e.slice(s.length)||"/",p=Kf({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},h),m=u.route;if(!p&&d&&n&&!i[i.length-1].route.index&&(p=Kf({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!p)return null;Object.assign(r,p.params),o.push({params:r,pathname:Br([s,p.pathname]),pathnameBase:J2(Br([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=Br([s,p.pathnameBase]))}return o}function Kf(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,i]=q2(t.path,t.caseSensitive,t.end),r=e.match(n);if(!r)return null;let s=r[0],o=s.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:i.reduce((d,{paramName:h,isOptional:p},m)=>{if(h==="*"){let _=c[m]||"";o=s.slice(0,s.length-_.length).replace(/(.)\/+$/,"$1")}const v=c[m];return p&&!v?d[h]=void 0:d[h]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:t}}function q2(t,e=!1,n=!0){jn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let i=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u,d,h)=>{if(i.push({paramName:c,isOptional:u!=null}),u){let p=h.charAt(d+o.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(i.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function Y2(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return jn(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function mr(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,i=t.charAt(n);return i&&i!=="/"?null:t.slice(n)||"/"}function K2({basename:t,pathname:e}){return e==="/"?t:Br([t,e])}var WE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Bv=t=>WE.test(t);function Z2(t,e="/"){let{pathname:n,search:i="",hash:r=""}=typeof t=="string"?js(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=Vb(n.substring(1),"/"):s=Vb(n,e)):s=e,{pathname:s,search:Q2(i),hash:ek(r)}}function Vb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Cm(t,e,n,i){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function $E(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function zv(t){let e=$E(t);return e.map((n,i)=>i===e.length-1?n.pathname:n.pathnameBase)}function Ah(t,e,n,i=!1){let r;typeof t=="string"?r=js(t):(r={...t},Qt(!r.pathname||!r.pathname.includes("?"),Cm("?","pathname","search",r)),Qt(!r.pathname||!r.pathname.includes("#"),Cm("#","pathname","hash",r)),Qt(!r.search||!r.search.includes("#"),Cm("#","search","hash",r)));let s=t===""||r.pathname==="",o=s?"/":r.pathname,c;if(o==null)c=n;else{let p=e.length-1;if(!i&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),p-=1;r.pathname=m.join("/")}c=p>=0?e[p]:"/"}let u=Z2(r,c),d=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(d||h)&&(u.pathname+="/"),u}var Br=t=>t.join("/").replace(/\/\/+/g,"/"),J2=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Q2=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ek=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,wu=class{constructor(t,e,n,i=!1){this.status=t,this.statusText=e||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function hu(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Eu(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var XE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qE(t,e){let n=t;if(typeof n!="string"||!WE.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(XE)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),c=mr(o.pathname,e);o.origin===s.origin&&c!=null?n=c+o.search+o.hash:r=!0}catch{jn(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}var Pa=Symbol("Uninstrumented");function tk(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(r=>r({id:e.id,index:e.index,path:e.path,instrument(s){let o=Object.keys(n);for(let c of o)s[c]&&n[c].push(s[c])}}));let i={};if(typeof e.lazy=="function"&&n.lazy.length>0){let r=Cl(n.lazy,e.lazy,()=>{});r&&(i.lazy=r)}if(typeof e.lazy=="object"){let r=e.lazy;["middleware","loader","action"].forEach(s=>{let o=r[s],c=n[`lazy.${s}`];if(typeof o=="function"&&c.length>0){let u=Cl(c,o,()=>{});u&&(i.lazy=Object.assign(i.lazy||{},{[s]:u}))}})}return["loader","action"].forEach(r=>{let s=e[r];if(typeof s=="function"&&n[r].length>0){let o=s[Pa]??s,c=Cl(n[r],o,(...u)=>Hb(u[0]));c&&(r==="loader"&&o.hydrate===!0&&(c.hydrate=!0),c[Pa]=o,i[r]=c)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(i.middleware=e.middleware.map(r=>{let s=r[Pa]??r,o=Cl(n.middleware,s,(...c)=>Hb(c[0]));return o?(o[Pa]=s,o):r})),i}function nk(t,e){let n={navigate:[],fetch:[]};if(e.forEach(i=>i({instrument(r){let s=Object.keys(r);for(let o of s)r[o]&&n[o].push(r[o])}})),n.navigate.length>0){let i=t.navigate[Pa]??t.navigate,r=Cl(n.navigate,i,(...s)=>{let[o,c]=s;return{to:typeof o=="number"||typeof o=="string"?o:o?ss(o):".",...Gb(t,c??{})}});r&&(r[Pa]=i,t.navigate=r)}if(n.fetch.length>0){let i=t.fetch[Pa]??t.fetch,r=Cl(n.fetch,i,(...s)=>{let[o,,c,u]=s;return{href:c??".",fetcherKey:o,...Gb(t,u??{})}});r&&(r[Pa]=i,t.fetch=r)}return t}function Cl(t,e,n){return t.length===0?null:async(...i)=>{let r=await YE(t,n(...i),()=>e(...i),t.length-1);if(r.type==="error")throw r.value;return r.value}}async function YE(t,e,n,i){let r=t[i],s;if(r){let o,c=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=YE(t,e,n,i-1),s=await o,Qt(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await r(c,e)}catch(u){console.error("An instrumentation function threw an error:",u)}o||await c(),await o}else try{s={type:"success",value:await n()}}catch(o){s={type:"error",value:o}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Hb(t){let{request:e,context:n,params:i,unstable_pattern:r}=t;return{request:ik(e),params:{...i},unstable_pattern:r,context:rk(n)}}function Gb(t,e){return{currentUrl:ss(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function ik(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function rk(t){if(ak(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var sk=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ak(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===sk}var KE=["POST","PUT","PATCH","DELETE"],ok=new Set(KE),lk=["GET",...KE],ck=new Set(lk),ZE=new Set([301,302,303,307,308]),uk=new Set([307,308]),Pm={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},dk={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Uc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},fk=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),JE="remix-router-transitions",QE=Symbol("ResetLoaderData");function hk(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";Qt(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i=t.hydrationRouteProperties||[],r=t.mapRouteProperties||fk,s=r;if(t.unstable_instrumentations){let Y=t.unstable_instrumentations;s=le=>({...r(le),...tk(Y.map(he=>he.route).filter(Boolean),le)})}let o={},c=fu(t.routes,s,void 0,o),u,d=t.basename||"/";d.startsWith("/")||(d=`/${d}`);let h=t.dataStrategy||yk,p={...t.future},m=null,v=new Set,_=null,w=null,y=null,b=t.hydrationData!=null,T=Ea(c,t.history.location,d),A=!1,M=null,I,k;if(T==null&&!t.patchRoutesOnNavigation){let Y=cr(404,{pathname:t.history.location.pathname}),{matches:le,route:he}=Vd(c);I=!0,k=!I,T=le,M={[he.id]:Y}}else if(T&&!t.hydrationData&&Kt(T,c,t.history.location.pathname).active&&(T=null),T)if(T.some(Y=>Y.route.lazy))I=!1,k=!I;else if(!T.some(Y=>Vv(Y.route)))I=!0,k=!I;else{let Y=t.hydrationData?t.hydrationData.loaderData:null,le=t.hydrationData?t.hydrationData.errors:null,he=T;if(le){let Me=T.findIndex(Ie=>le[Ie.route.id]!==void 0);he=he.slice(0,Me+1)}k=!1,I=he.every(Me=>{let Ie=eM(Me.route,Y,le);return k=k||Ie.renderFallback,!Ie.shouldLoad})}else{I=!1,k=!I,T=[];let Y=Kt(null,c,t.history.location.pathname);Y.active&&Y.matches&&(A=!0,T=Y.matches)}let U,S={historyAction:t.history.action,location:t.history.location,matches:T,initialized:I,renderFallback:k,navigation:Pm,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||M,fetchers:new Map,blockers:new Map},P="POP",V=null,O=!1,G,J=!1,H=new Map,X=null,K=!1,Q=!1,W=new Set,q=new Map,Z=0,z=-1,ie=new Map,we=new Set,He=new Map,Se=new Map,ne=new Set,ye=new Map,be,Ne=null;function et(){if(m=t.history.listen(({action:Y,location:le,delta:he})=>{if(be){be(),be=void 0;return}jn(ye.size===0||he!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Me=Xe({currentLocation:S.location,nextLocation:le,historyAction:Y});if(Me&&he!=null){let Ie=new Promise(vt=>{be=vt});t.history.go(he*-1),Le(Me,{state:"blocked",location:le,proceed(){Le(Me,{state:"proceeding",proceed:void 0,reset:void 0,location:le}),Ie.then(()=>t.history.go(he))},reset(){let vt=new Map(S.blockers);vt.set(Me,Uc),ht({blockers:vt})}}),V?.resolve(),V=null;return}return an(Y,le)}),n){Uk(e,H);let Y=()=>Fk(e,H);e.addEventListener("pagehide",Y),X=()=>e.removeEventListener("pagehide",Y)}return S.initialized||an("POP",S.location,{initialHydration:!0}),U}function xt(){m&&m(),X&&X(),v.clear(),G&&G.abort(),S.fetchers.forEach((Y,le)=>Pe(le)),S.blockers.forEach((Y,le)=>ze(le))}function pn(Y){return v.add(Y),()=>v.delete(Y)}function ht(Y,le={}){Y.matches&&(Y.matches=Y.matches.map(Ie=>{let vt=o[Ie.route.id],tt=Ie.route;return tt.element!==vt.element||tt.errorElement!==vt.errorElement||tt.hydrateFallbackElement!==vt.hydrateFallbackElement?{...Ie,route:vt}:Ie})),S={...S,...Y};let he=[],Me=[];S.fetchers.forEach((Ie,vt)=>{Ie.state==="idle"&&(ne.has(vt)?he.push(vt):Me.push(vt))}),ne.forEach(Ie=>{!S.fetchers.has(Ie)&&!q.has(Ie)&&he.push(Ie)}),[...v].forEach(Ie=>Ie(S,{deletedFetchers:he,newErrors:Y.errors??null,viewTransitionOpts:le.viewTransitionOpts,flushSync:le.flushSync===!0})),he.forEach(Ie=>Pe(Ie)),Me.forEach(Ie=>S.fetchers.delete(Ie))}function Ft(Y,le,{flushSync:he}={}){let Me=S.actionData!=null&&S.navigation.formMethod!=null&&Si(S.navigation.formMethod)&&S.navigation.state==="loading"&&Y.state?._isRedirect!==!0,Ie;le.actionData?Object.keys(le.actionData).length>0?Ie=le.actionData:Ie=null:Me?Ie=S.actionData:Ie=null;let vt=le.loaderData?Qb(S.loaderData,le.loaderData,le.matches||[],le.errors):S.loaderData,tt=S.blockers;tt.size>0&&(tt=new Map(tt),tt.forEach((Tt,bt)=>tt.set(bt,Uc)));let yt=K?!1:mn(Y,le.matches||S.matches),Qe=O===!0||S.navigation.formMethod!=null&&Si(S.navigation.formMethod)&&Y.state?._isRedirect!==!0;u&&(c=u,u=void 0),K||P==="POP"||(P==="PUSH"?t.history.push(Y,Y.state):P==="REPLACE"&&t.history.replace(Y,Y.state));let Et;if(P==="POP"){let Tt=H.get(S.location.pathname);Tt&&Tt.has(Y.pathname)?Et={currentLocation:S.location,nextLocation:Y}:H.has(Y.pathname)&&(Et={currentLocation:Y,nextLocation:S.location})}else if(J){let Tt=H.get(S.location.pathname);Tt?Tt.add(Y.pathname):(Tt=new Set([Y.pathname]),H.set(S.location.pathname,Tt)),Et={currentLocation:S.location,nextLocation:Y}}ht({...le,actionData:Ie,loaderData:vt,historyAction:P,location:Y,initialized:!0,renderFallback:!1,navigation:Pm,revalidation:"idle",restoreScrollPosition:yt,preventScrollReset:Qe,blockers:tt},{viewTransitionOpts:Et,flushSync:he===!0}),P="POP",O=!1,J=!1,K=!1,Q=!1,V?.resolve(),V=null,Ne?.resolve(),Ne=null}async function nn(Y,le){if(V?.resolve(),V=null,typeof Y=="number"){V||(V=iS());let En=V.promise;return t.history.go(Y),En}let he=Wg(S.location,S.matches,d,Y,le?.fromRouteId,le?.relative),{path:Me,submission:Ie,error:vt}=jb(!1,he,le),tt;le?.unstable_mask&&(tt={pathname:"",search:"",hash:"",...typeof le.unstable_mask=="string"?js(le.unstable_mask):{...S.location.unstable_mask,...le.unstable_mask}});let yt=S.location,Qe=du(yt,Me,le&&le.state,void 0,tt);Qe={...Qe,...t.history.encodeLocation(Qe)};let Et=le&&le.replace!=null?le.replace:void 0,Tt="PUSH";Et===!0?Tt="REPLACE":Et===!1||Ie!=null&&Si(Ie.formMethod)&&Ie.formAction===S.location.pathname+S.location.search&&(Tt="REPLACE");let bt=le&&"preventScrollReset"in le?le.preventScrollReset===!0:void 0,un=(le&&le.flushSync)===!0,en=Xe({currentLocation:yt,nextLocation:Qe,historyAction:Tt});if(en){Le(en,{state:"blocked",location:Qe,proceed(){Le(en,{state:"proceeding",proceed:void 0,reset:void 0,location:Qe}),nn(Y,le)},reset(){let En=new Map(S.blockers);En.set(en,Uc),ht({blockers:En})}});return}await an(Tt,Qe,{submission:Ie,pendingError:vt,preventScrollReset:bt,replace:le&&le.replace,enableViewTransition:le&&le.viewTransition,flushSync:un,callSiteDefaultShouldRevalidate:le&&le.unstable_defaultShouldRevalidate})}function Dt(){Ne||(Ne=iS()),ve(),ht({revalidation:"loading"});let Y=Ne.promise;return S.navigation.state==="submitting"?Y:S.navigation.state==="idle"?(an(S.historyAction,S.location,{startUninterruptedRevalidation:!0}),Y):(an(P||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation,enableViewTransition:J===!0}),Y)}async function an(Y,le,he){G&&G.abort(),G=null,P=Y,K=(he&&he.startUninterruptedRevalidation)===!0,Nt(S.location,S.matches),O=(he&&he.preventScrollReset)===!0,J=(he&&he.enableViewTransition)===!0;let Me=u||c,Ie=he&&he.overrideNavigation,vt=he?.initialHydration&&S.matches&&S.matches.length>0&&!A?S.matches:Ea(Me,le,d),tt=(he&&he.flushSync)===!0;if(vt&&S.initialized&&!Q&&Tk(S.location,le)&&!(he&&he.submission&&Si(he.submission.formMethod))){Ft(le,{matches:vt},{flushSync:tt});return}let yt=Kt(vt,Me,le.pathname);if(yt.active&&yt.matches&&(vt=yt.matches),!vt){let{error:In,notFoundMatches:Zn,route:gn}=Re(le.pathname);Ft(le,{matches:Zn,loaderData:{},errors:{[gn.id]:In}},{flushSync:tt});return}G=new AbortController;let Qe=wl(t.history,le,G.signal,he&&he.submission),Et=t.getContext?await t.getContext():new Ob,Tt;if(he&&he.pendingError)Tt=[Ma(vt).route.id,{type:"error",error:he.pendingError}];else if(he&&he.submission&&Si(he.submission.formMethod)){let In=await ee(Qe,le,he.submission,vt,Et,yt.active,he&&he.initialHydration===!0,{replace:he.replace,flushSync:tt});if(In.shortCircuited)return;if(In.pendingActionResult){let[Zn,gn]=In.pendingActionResult;if(Ji(gn)&&hu(gn.error)&&gn.error.status===404){G=null,Ft(le,{matches:In.matches,loaderData:{},errors:{[Zn]:gn.error}});return}}vt=In.matches||vt,Tt=In.pendingActionResult,Ie=Rm(le,he.submission),tt=!1,yt.active=!1,Qe=wl(t.history,Qe.url,Qe.signal)}let{shortCircuited:bt,matches:un,loaderData:en,errors:En}=await Sn(Qe,le,vt,Et,yt.active,Ie,he&&he.submission,he&&he.fetcherSubmission,he&&he.replace,he&&he.initialHydration===!0,tt,Tt,he&&he.callSiteDefaultShouldRevalidate);bt||(G=null,Ft(le,{matches:un||vt,...eS(Tt),loaderData:en,errors:En}))}async function ee(Y,le,he,Me,Ie,vt,tt,yt={}){ve();let Qe=Nk(le,he);if(ht({navigation:Qe},{flushSync:yt.flushSync===!0}),vt){let bt=await ui(Me,le.pathname,Y.signal);if(bt.type==="aborted")return{shortCircuited:!0};if(bt.type==="error"){if(bt.partialMatches.length===0){let{matches:en,route:En}=Vd(c);return{matches:en,pendingActionResult:[En.id,{type:"error",error:bt.error}]}}let un=Ma(bt.partialMatches).route.id;return{matches:bt.partialMatches,pendingActionResult:[un,{type:"error",error:bt.error}]}}else if(bt.matches)Me=bt.matches;else{let{notFoundMatches:un,error:en,route:En}=Re(le.pathname);return{matches:un,pendingActionResult:[En.id,{type:"error",error:en}]}}}let Et,Tt=Tf(Me,le);if(!Tt.route.action&&!Tt.route.lazy)Et={type:"error",error:cr(405,{method:Y.method,pathname:le.pathname,routeId:Tt.route.id})};else{let bt=Dl(s,o,Y,Me,Tt,tt?[]:i,Ie),un=await xe(Y,bt,Ie,null);if(Et=un[Tt.route.id],!Et){for(let en of Me)if(un[en.route.id]){Et=un[en.route.id];break}}if(Y.signal.aborted)return{shortCircuited:!0}}if(uo(Et)){let bt;return yt&&yt.replace!=null?bt=yt.replace:bt=Kb(Et.response.headers.get("Location"),new URL(Y.url),d,t.history)===S.location.pathname+S.location.search,await se(Y,Et,!0,{submission:he,replace:bt}),{shortCircuited:!0}}if(Ji(Et)){let bt=Ma(Me,Tt.route.id);return(yt&&yt.replace)!==!0&&(P="PUSH"),{matches:Me,pendingActionResult:[bt.route.id,Et,Tt.route.id]}}return{matches:Me,pendingActionResult:[Tt.route.id,Et]}}async function Sn(Y,le,he,Me,Ie,vt,tt,yt,Qe,Et,Tt,bt,un){let en=vt||Rm(le,tt),En=tt||yt||nS(en),In=!K&&!Et;if(Ie){if(In){let Mt=At(bt);ht({navigation:en,...Mt!==void 0?{actionData:Mt}:{}},{flushSync:Tt})}let Ve=await ui(he,le.pathname,Y.signal);if(Ve.type==="aborted")return{shortCircuited:!0};if(Ve.type==="error"){if(Ve.partialMatches.length===0){let{matches:lt,route:Zt}=Vd(c);return{matches:lt,loaderData:{},errors:{[Zt.id]:Ve.error}}}let Mt=Ma(Ve.partialMatches).route.id;return{matches:Ve.partialMatches,loaderData:{},errors:{[Mt]:Ve.error}}}else if(Ve.matches)he=Ve.matches;else{let{error:Mt,notFoundMatches:lt,route:Zt}=Re(le.pathname);return{matches:lt,loaderData:{},errors:{[Zt.id]:Mt}}}}let Zn=u||c,{dsMatches:gn,revalidatingFetchers:N}=Wb(Y,Me,s,o,t.history,S,he,En,le,Et?[]:i,Et===!0,Q,W,ne,He,we,Zn,d,t.patchRoutesOnNavigation!=null,bt,un);if(z=++Z,!t.dataStrategy&&!gn.some(Ve=>Ve.shouldLoad)&&!gn.some(Ve=>Ve.route.middleware&&Ve.route.middleware.length>0)&&N.length===0){let Ve=$e();return Ft(le,{matches:he,loaderData:{},errors:bt&&Ji(bt[1])?{[bt[0]]:bt[1].error}:null,...eS(bt),...Ve?{fetchers:new Map(S.fetchers)}:{}},{flushSync:Tt}),{shortCircuited:!0}}if(In){let Ve={};if(!Ie){Ve.navigation=en;let Mt=At(bt);Mt!==void 0&&(Ve.actionData=Mt)}N.length>0&&(Ve.fetchers=Lt(N)),ht(Ve,{flushSync:Tt})}N.forEach(Ve=>{Ze(Ve.key),Ve.controller&&q.set(Ve.key,Ve.controller)});let oe=()=>N.forEach(Ve=>Ze(Ve.key));G&&G.signal.addEventListener("abort",oe);let{loaderResults:pe,fetcherResults:de}=await Ee(gn,N,Y,Me);if(Y.signal.aborted)return{shortCircuited:!0};G&&G.signal.removeEventListener("abort",oe),N.forEach(Ve=>q.delete(Ve.key));let ce=Hd(pe);if(ce)return await se(Y,ce.result,!0,{replace:Qe}),{shortCircuited:!0};if(ce=Hd(de),ce)return we.add(ce.key),await se(Y,ce.result,!0,{replace:Qe}),{shortCircuited:!0};let{loaderData:je,errors:qe}=Jb(S,he,pe,bt,N,de);Et&&S.errors&&(qe={...S.errors,...qe});let Ge=$e(),We=Ht(z),ct=Ge||We||N.length>0;return{matches:he,loaderData:je,errors:qe,...ct?{fetchers:new Map(S.fetchers)}:{}}}function At(Y){if(Y&&!Ji(Y[1]))return{[Y[0]]:Y[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function Lt(Y){return Y.forEach(le=>{let he=S.fetchers.get(le.key),Me=Fc(void 0,he?he.data:void 0);S.fetchers.set(le.key,Me)}),new Map(S.fetchers)}async function it(Y,le,he,Me){Ze(Y);let Ie=(Me&&Me.flushSync)===!0,vt=u||c,tt=Wg(S.location,S.matches,d,he,le,Me?.relative),yt=Ea(vt,tt,d),Qe=Kt(yt,vt,tt);if(Qe.active&&Qe.matches&&(yt=Qe.matches),!yt){ke(Y,le,cr(404,{pathname:tt}),{flushSync:Ie});return}let{path:Et,submission:Tt,error:bt}=jb(!0,tt,Me);if(bt){ke(Y,le,bt,{flushSync:Ie});return}let un=t.getContext?await t.getContext():new Ob,en=(Me&&Me.preventScrollReset)===!0;if(Tt&&Si(Tt.formMethod)){await B(Y,le,Et,yt,un,Qe.active,Ie,en,Tt,Me&&Me.unstable_defaultShouldRevalidate);return}He.set(Y,{routeId:le,path:Et}),await R(Y,le,Et,yt,un,Qe.active,Ie,en,Tt)}async function B(Y,le,he,Me,Ie,vt,tt,yt,Qe,Et){ve(),He.delete(Y);let Tt=S.fetchers.get(Y);Ke(Y,Ik(Qe,Tt),{flushSync:tt});let bt=new AbortController,un=wl(t.history,he,bt.signal,Qe);if(vt){let It=await ui(Me,new URL(un.url).pathname,un.signal,Y);if(It.type==="aborted")return;if(It.type==="error"){ke(Y,le,It.error,{flushSync:tt});return}else if(It.matches)Me=It.matches;else{ke(Y,le,cr(404,{pathname:he}),{flushSync:tt});return}}let en=Tf(Me,he);if(!en.route.action&&!en.route.lazy){let It=cr(405,{method:Qe.formMethod,pathname:he,routeId:le});ke(Y,le,It,{flushSync:tt});return}q.set(Y,bt);let En=Z,In=Dl(s,o,un,Me,en,i,Ie),Zn=await xe(un,In,Ie,Y),gn=Zn[en.route.id];if(!gn){for(let It of In)if(Zn[It.route.id]){gn=Zn[It.route.id];break}}if(un.signal.aborted){q.get(Y)===bt&&q.delete(Y);return}if(ne.has(Y)){if(uo(gn)||Ji(gn)){Ke(Y,Ls(void 0));return}}else{if(uo(gn))if(q.delete(Y),z>En){Ke(Y,Ls(void 0));return}else return we.add(Y),Ke(Y,Fc(Qe)),se(un,gn,!1,{fetcherSubmission:Qe,preventScrollReset:yt});if(Ji(gn)){ke(Y,le,gn.error);return}}let N=S.navigation.location||S.location,oe=wl(t.history,N,bt.signal),pe=u||c,de=S.navigation.state!=="idle"?Ea(pe,S.navigation.location,d):S.matches;Qt(de,"Didn't find any matches after fetcher action");let ce=++Z;ie.set(Y,ce);let je=Fc(Qe,gn.data);S.fetchers.set(Y,je);let{dsMatches:qe,revalidatingFetchers:Ge}=Wb(oe,Ie,s,o,t.history,S,de,Qe,N,i,!1,Q,W,ne,He,we,pe,d,t.patchRoutesOnNavigation!=null,[en.route.id,gn],Et);Ge.filter(It=>It.key!==Y).forEach(It=>{let vn=It.key,tn=S.fetchers.get(vn),Un=Fc(void 0,tn?tn.data:void 0);S.fetchers.set(vn,Un),Ze(vn),It.controller&&q.set(vn,It.controller)}),ht({fetchers:new Map(S.fetchers)});let We=()=>Ge.forEach(It=>Ze(It.key));bt.signal.addEventListener("abort",We);let{loaderResults:ct,fetcherResults:Ve}=await Ee(qe,Ge,oe,Ie);if(bt.signal.aborted)return;if(bt.signal.removeEventListener("abort",We),ie.delete(Y),q.delete(Y),Ge.forEach(It=>q.delete(It.key)),S.fetchers.has(Y)){let It=Ls(gn.data);S.fetchers.set(Y,It)}let Mt=Hd(ct);if(Mt)return se(oe,Mt.result,!1,{preventScrollReset:yt});if(Mt=Hd(Ve),Mt)return we.add(Mt.key),se(oe,Mt.result,!1,{preventScrollReset:yt});let{loaderData:lt,errors:Zt}=Jb(S,de,ct,void 0,Ge,Ve);Ht(ce),S.navigation.state==="loading"&&ce>z?(Qt(P,"Expected pending action"),G&&G.abort(),Ft(S.navigation.location,{matches:de,loaderData:lt,errors:Zt,fetchers:new Map(S.fetchers)})):(ht({errors:Zt,loaderData:Qb(S.loaderData,lt,de,Zt),fetchers:new Map(S.fetchers)}),Q=!1)}async function R(Y,le,he,Me,Ie,vt,tt,yt,Qe){let Et=S.fetchers.get(Y);Ke(Y,Fc(Qe,Et?Et.data:void 0),{flushSync:tt});let Tt=new AbortController,bt=wl(t.history,he,Tt.signal);if(vt){let gn=await ui(Me,new URL(bt.url).pathname,bt.signal,Y);if(gn.type==="aborted")return;if(gn.type==="error"){ke(Y,le,gn.error,{flushSync:tt});return}else if(gn.matches)Me=gn.matches;else{ke(Y,le,cr(404,{pathname:he}),{flushSync:tt});return}}let un=Tf(Me,he);q.set(Y,Tt);let en=Z,En=Dl(s,o,bt,Me,un,i,Ie),Zn=(await xe(bt,En,Ie,Y))[un.route.id];if(q.get(Y)===Tt&&q.delete(Y),!bt.signal.aborted){if(ne.has(Y)){Ke(Y,Ls(void 0));return}if(uo(Zn))if(z>en){Ke(Y,Ls(void 0));return}else{we.add(Y),await se(bt,Zn,!1,{preventScrollReset:yt});return}if(Ji(Zn)){ke(Y,le,Zn.error);return}Ke(Y,Ls(Zn.data))}}async function se(Y,le,he,{submission:Me,fetcherSubmission:Ie,preventScrollReset:vt,replace:tt}={}){he||(V?.resolve(),V=null),le.response.headers.has("X-Remix-Revalidate")&&(Q=!0);let yt=le.response.headers.get("Location");Qt(yt,"Expected a Location header on the redirect Response"),yt=Kb(yt,new URL(Y.url),d,t.history);let Qe=du(S.location,yt,{_isRedirect:!0});if(n){let En=!1;if(le.response.headers.has("X-Remix-Reload-Document"))En=!0;else if(Bv(yt)){const In=HE(yt,!0);En=In.origin!==e.location.origin||mr(In.pathname,d)==null}if(En){tt?e.location.replace(yt):e.location.assign(yt);return}}G=null;let Et=tt===!0||le.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Tt,formAction:bt,formEncType:un}=S.navigation;!Me&&!Ie&&Tt&&bt&&un&&(Me=nS(S.navigation));let en=Me||Ie;if(uk.has(le.response.status)&&en&&Si(en.formMethod))await an(Et,Qe,{submission:{...en,formAction:yt},preventScrollReset:vt||O,enableViewTransition:he?J:void 0});else{let En=Rm(Qe,Me);await an(Et,Qe,{overrideNavigation:En,fetcherSubmission:Ie,preventScrollReset:vt||O,enableViewTransition:he?J:void 0})}}async function xe(Y,le,he,Me){let Ie,vt={};try{Ie=await xk(h,Y,le,Me,he,!1)}catch(tt){return le.filter(yt=>yt.shouldLoad).forEach(yt=>{vt[yt.route.id]={type:"error",error:tt}}),vt}if(Y.signal.aborted)return vt;if(!Si(Y.method))for(let tt of le){if(Ie[tt.route.id]?.type==="error")break;!Ie.hasOwnProperty(tt.route.id)&&!S.loaderData.hasOwnProperty(tt.route.id)&&(!S.errors||!S.errors.hasOwnProperty(tt.route.id))&&tt.shouldCallHandler()&&(Ie[tt.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${tt.route.id}`)})}for(let[tt,yt]of Object.entries(Ie))if(Rk(yt)){let Qe=yt.result;vt[tt]={type:"redirect",response:Ek(Qe,Y,tt,le,d)}}else vt[tt]=await wk(yt);return vt}async function Ee(Y,le,he,Me){let Ie=xe(he,Y,Me,null),vt=Promise.all(le.map(async Qe=>{if(Qe.matches&&Qe.match&&Qe.request&&Qe.controller){let Tt=(await xe(Qe.request,Qe.matches,Me,Qe.key))[Qe.match.route.id];return{[Qe.key]:Tt}}else return Promise.resolve({[Qe.key]:{type:"error",error:cr(404,{pathname:Qe.path})}})})),tt=await Ie,yt=(await vt).reduce((Qe,Et)=>Object.assign(Qe,Et),{});return{loaderResults:tt,fetcherResults:yt}}function ve(){Q=!0,He.forEach((Y,le)=>{q.has(le)&&W.add(le),Ze(le)})}function Ke(Y,le,he={}){S.fetchers.set(Y,le),ht({fetchers:new Map(S.fetchers)},{flushSync:(he&&he.flushSync)===!0})}function ke(Y,le,he,Me={}){let Ie=Ma(S.matches,le);Pe(Y),ht({errors:{[Ie.route.id]:he},fetchers:new Map(S.fetchers)},{flushSync:(Me&&Me.flushSync)===!0})}function pt(Y){return Se.set(Y,(Se.get(Y)||0)+1),ne.has(Y)&&ne.delete(Y),S.fetchers.get(Y)||dk}function Pt(Y,le){Ze(Y,le?.reason),Ke(Y,Ls(null))}function Pe(Y){let le=S.fetchers.get(Y);q.has(Y)&&!(le&&le.state==="loading"&&ie.has(Y))&&Ze(Y),He.delete(Y),ie.delete(Y),we.delete(Y),ne.delete(Y),W.delete(Y),S.fetchers.delete(Y)}function Oe(Y){let le=(Se.get(Y)||0)-1;le<=0?(Se.delete(Y),ne.add(Y)):Se.set(Y,le),ht({fetchers:new Map(S.fetchers)})}function Ze(Y,le){let he=q.get(Y);he&&(he.abort(le),q.delete(Y))}function rt(Y){for(let le of Y){let he=pt(le),Me=Ls(he.data);S.fetchers.set(le,Me)}}function $e(){let Y=[],le=!1;for(let he of we){let Me=S.fetchers.get(he);Qt(Me,`Expected fetcher: ${he}`),Me.state==="loading"&&(we.delete(he),Y.push(he),le=!0)}return rt(Y),le}function Ht(Y){let le=[];for(let[he,Me]of ie)if(Me<Y){let Ie=S.fetchers.get(he);Qt(Ie,`Expected fetcher: ${he}`),Ie.state==="loading"&&(Ze(he),ie.delete(he),le.push(he))}return rt(le),le.length>0}function re(Y,le){let he=S.blockers.get(Y)||Uc;return ye.get(Y)!==le&&ye.set(Y,le),he}function ze(Y){S.blockers.delete(Y),ye.delete(Y)}function Le(Y,le){let he=S.blockers.get(Y)||Uc;Qt(he.state==="unblocked"&&le.state==="blocked"||he.state==="blocked"&&le.state==="blocked"||he.state==="blocked"&&le.state==="proceeding"||he.state==="blocked"&&le.state==="unblocked"||he.state==="proceeding"&&le.state==="unblocked",`Invalid blocker state transition: ${he.state} -> ${le.state}`);let Me=new Map(S.blockers);Me.set(Y,le),ht({blockers:Me})}function Xe({currentLocation:Y,nextLocation:le,historyAction:he}){if(ye.size===0)return;ye.size>1&&jn(!1,"A router only supports one blocker at a time");let Me=Array.from(ye.entries()),[Ie,vt]=Me[Me.length-1],tt=S.blockers.get(Ie);if(!(tt&&tt.state==="proceeding")&&vt({currentLocation:Y,nextLocation:le,historyAction:he}))return Ie}function Re(Y){let le=cr(404,{pathname:Y}),he=u||c,{matches:Me,route:Ie}=Vd(he);return{notFoundMatches:Me,route:Ie,error:le}}function _e(Y,le,he){if(_=Y,y=le,w=he||null,!b&&S.navigation===Pm){b=!0;let Me=mn(S.location,S.matches);Me!=null&&ht({restoreScrollPosition:Me})}return()=>{_=null,y=null,w=null}}function st(Y,le){return w&&w(Y,le.map(Me=>F2(Me,S.loaderData)))||Y.key}function Nt(Y,le){if(_&&y){let he=st(Y,le);_[he]=y()}}function mn(Y,le){if(_){let he=st(Y,le),Me=_[he];if(typeof Me=="number")return Me}return null}function Kt(Y,le,he){if(t.patchRoutesOnNavigation)if(Y){if(Object.keys(Y[0].params).length>0)return{active:!0,matches:Zc(le,he,d,!0)}}else return{active:!0,matches:Zc(le,he,d,!0)||[]};return{active:!1,matches:null}}async function ui(Y,le,he,Me){if(!t.patchRoutesOnNavigation)return{type:"success",matches:Y};let Ie=Y;for(;;){let vt=u==null,tt=u||c,yt=o;try{await t.patchRoutesOnNavigation({signal:he,path:le,matches:Ie,fetcherKey:Me,patch:(Tt,bt)=>{he.aborted||$b(Tt,bt,tt,yt,s,!1)}})}catch(Tt){return{type:"error",error:Tt,partialMatches:Ie}}finally{vt&&!he.aborted&&(c=[...c])}if(he.aborted)return{type:"aborted"};let Qe=Ea(tt,le,d),Et=null;if(Qe){if(Object.keys(Qe[0].params).length===0)return{type:"success",matches:Qe};if(Et=Zc(tt,le,d,!0),!(Et&&Ie.length<Et.length&&ri(Ie,Et.slice(0,Ie.length))))return{type:"success",matches:Qe}}if(Et||(Et=Zc(tt,le,d,!0)),!Et||ri(Ie,Et))return{type:"success",matches:null};Ie=Et}}function ri(Y,le){return Y.length===le.length&&Y.every((he,Me)=>he.route.id===le[Me].route.id)}function Xs(Y){o={},u=fu(Y,s,void 0,o)}function Sr(Y,le,he=!1){let Me=u==null;$b(Y,le,u||c,o,s,he),Me&&(c=[...c],ht({}))}return U={get basename(){return d},get future(){return p},get state(){return S},get routes(){return c},get window(){return e},initialize:et,subscribe:pn,enableScrollRestoration:_e,navigate:nn,fetch:it,revalidate:Dt,createHref:Y=>t.history.createHref(Y),encodeLocation:Y=>t.history.encodeLocation(Y),getFetcher:pt,resetFetcher:Pt,deleteFetcher:Oe,dispose:xt,getBlocker:re,deleteBlocker:ze,patchRoutes:Sr,_internalFetchControllers:q,_internalSetRoutes:Xs,_internalSetStateDoNotUseOrYouWillBreakYourApp(Y){ht(Y)}},t.unstable_instrumentations&&(U=nk(U,t.unstable_instrumentations.map(Y=>Y.router).filter(Boolean))),U}function pk(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Wg(t,e,n,i,r,s){let o,c;if(r){o=[];for(let d of e)if(o.push(d),d.route.id===r){c=d;break}}else o=e,c=e[e.length-1];let u=Ah(i||".",zv(o),mr(t.pathname,n)||t.pathname,s==="path");if(i==null&&(u.search=t.search,u.hash=t.hash),(i==null||i===""||i===".")&&c){let d=Gv(u.search);if(c.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let h=new URLSearchParams(u.search),p=h.getAll("index");h.delete("index"),p.filter(v=>v).forEach(v=>h.append("index",v));let m=h.toString();u.search=m?`?${m}`:""}}return n!=="/"&&(u.pathname=K2({basename:n,pathname:u.pathname})),ss(u)}function jb(t,e,n){if(!n||!pk(n))return{path:e};if(n.formMethod&&!Dk(n.formMethod))return{path:e,error:cr(405,{method:n.formMethod})};let i=()=>({path:e,error:cr(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),o=aM(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Si(s))return i();let p=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((m,[v,_])=>`${m}${v}=${_}
|
|
10
|
+
`,""):String(n.body);return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:p}}}else if(n.formEncType==="application/json"){if(!Si(s))return i();try{let p=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:p,text:void 0}}}catch{return i()}}}Qt(typeof FormData=="function","FormData is not available in this environment");let c,u;if(n.formData)c=Xg(n.formData),u=n.formData;else if(n.body instanceof FormData)c=Xg(n.body),u=n.body;else if(n.body instanceof URLSearchParams)c=n.body,u=Zb(c);else if(n.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(n.body),u=Zb(c)}catch{return i()}let d={formMethod:s,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(Si(d.formMethod))return{path:e,submission:d};let h=js(e);return t&&h.search&&Gv(h.search)&&c.append("index",""),h.search=`?${c}`,{path:ss(h),submission:d}}function Wb(t,e,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y,b,T,A,M){let I=A?Ji(A[1])?A[1].error:A[1].data:void 0,k=r.createURL(s.location),U=r.createURL(u),S;if(h&&s.errors){let X=Object.keys(s.errors)[0];S=o.findIndex(K=>K.route.id===X)}else if(A&&Ji(A[1])){let X=A[0];S=o.findIndex(K=>K.route.id===X)-1}let P=A?A[1].statusCode:void 0,V=P&&P>=400,O={currentUrl:k,currentParams:s.matches[0]?.params||{},nextUrl:U,nextParams:o[0].params,...c,actionResult:I,actionStatus:P},G=Eu(o),J=o.map((X,K)=>{let{route:Q}=X,W=null;if(S!=null&&K>S)W=!1;else if(Q.lazy)W=!0;else if(!Vv(Q))W=!1;else if(h){let{shouldLoad:ie}=eM(Q,s.loaderData,s.errors);W=ie}else mk(s.loaderData,s.matches[K],X)&&(W=!0);if(W!==null)return $g(n,i,t,G,X,d,e,W);let q=!1;typeof M=="boolean"?q=M:V?q=!1:(p||k.pathname+k.search===U.pathname+U.search||k.search!==U.search||gk(s.matches[K],X))&&(q=!0);let Z={...O,defaultShouldRevalidate:q},z=iu(X,Z);return $g(n,i,t,G,X,d,e,z,Z,M)}),H=[];return _.forEach((X,K)=>{if(h||!o.some(He=>He.route.id===X.routeId)||v.has(K))return;let Q=s.fetchers.get(K),W=Q&&Q.state!=="idle"&&Q.data===void 0,q=Ea(y,X.path,b);if(!q){if(T&&W)return;H.push({key:K,routeId:X.routeId,path:X.path,matches:null,match:null,request:null,controller:null});return}if(w.has(K))return;let Z=Tf(q,X.path),z=new AbortController,ie=wl(r,X.path,z.signal),we=null;if(m.has(K))m.delete(K),we=Dl(n,i,ie,q,Z,d,e);else if(W)p&&(we=Dl(n,i,ie,q,Z,d,e));else{let He;typeof M=="boolean"?He=M:V?He=!1:He=p;let Se={...O,defaultShouldRevalidate:He};iu(Z,Se)&&(we=Dl(n,i,ie,q,Z,d,e,Se))}we&&H.push({key:K,routeId:X.routeId,path:X.path,matches:we,match:Z,request:ie,controller:z})}),{dsMatches:J,revalidatingFetchers:H}}function Vv(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function eM(t,e,n){if(t.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Vv(t))return{shouldLoad:!1,renderFallback:!1};let i=e!=null&&t.id in e,r=n!=null&&n[t.id]!==void 0;if(!i&&r)return{shouldLoad:!1,renderFallback:!1};if(typeof t.loader=="function"&&t.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!i};let s=!i&&!r;return{shouldLoad:s,renderFallback:s}}function mk(t,e,n){let i=!e||n.route.id!==e.route.id,r=!t.hasOwnProperty(n.route.id);return i||r}function gk(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function iu(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function $b(t,e,n,i,r,s){let o;if(t){let d=i[t];Qt(d,`No route found to patch children into: routeId = ${t}`),d.children||(d.children=[]),o=d.children}else o=n;let c=[],u=[];if(e.forEach(d=>{let h=o.find(p=>tM(d,p));h?u.push({existingRoute:h,newRoute:d}):c.push(d)}),c.length>0){let d=fu(c,r,[t||"_","patch",String(o?.length||"0")],i);o.push(...d)}if(s&&u.length>0)for(let d=0;d<u.length;d++){let{existingRoute:h,newRoute:p}=u[d],m=h,[v]=fu([p],r,[],{},!0);Object.assign(m,{element:v.element?v.element:m.element,errorElement:v.errorElement?v.errorElement:m.errorElement,hydrateFallbackElement:v.hydrateFallbackElement?v.hydrateFallbackElement:m.hydrateFallbackElement})}}function tM(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children?.every((n,i)=>e.children?.some(r=>tM(n,r)))??!1:!1}var Xb=new WeakMap,nM=({key:t,route:e,manifest:n,mapRouteProperties:i})=>{let r=n[e.id];if(Qt(r,"No route found in manifest"),!r.lazy||typeof r.lazy!="object")return;let s=r.lazy[t];if(!s)return;let o=Xb.get(r);o||(o={},Xb.set(r,o));let c=o[t];if(c)return c;let u=(async()=>{let d=D2(t),p=r[t]!==void 0&&t!=="hasErrorBoundary";if(d)jn(!d,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(p)jn(!1,`Route "${r.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let m=await s();m!=null&&(Object.assign(r,{[t]:m}),Object.assign(r,i(r)))}typeof r.lazy=="object"&&(r.lazy[t]=void 0,Object.values(r.lazy).every(m=>m===void 0)&&(r.lazy=void 0))})();return o[t]=u,u},qb=new WeakMap;function vk(t,e,n,i,r){let s=n[t.id];if(Qt(s,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let h=qb.get(s);if(h)return{lazyRoutePromise:h,lazyHandlerPromise:h};let p=(async()=>{Qt(typeof t.lazy=="function","No lazy route function found");let m=await t.lazy(),v={};for(let _ in m){let w=m[_];if(w===void 0)continue;let y=I2(_),T=s[_]!==void 0&&_!=="hasErrorBoundary";y?jn(!y,"Route property "+_+" is not a supported property to be returned from a lazy route function. This property will be ignored."):T?jn(!T,`Route "${s.id}" has a static property "${_}" defined but its lazy function is also returning a value for this property. The lazy route property "${_}" will be ignored.`):v[_]=w}Object.assign(s,v),Object.assign(s,{...i(s),lazy:void 0})})();return qb.set(s,p),p.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:p}}let o=Object.keys(t.lazy),c=[],u;for(let h of o){if(r&&r.includes(h))continue;let p=nM({key:h,route:t,manifest:n,mapRouteProperties:i});p&&(c.push(p),h===e&&(u=p))}let d=c.length>0?Promise.all(c).then(()=>{}):void 0;return d?.catch(()=>{}),u?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:u}}async function Yb(t){let e=t.matches.filter(r=>r.shouldLoad),n={};return(await Promise.all(e.map(r=>r.resolve()))).forEach((r,s)=>{n[e[s].route.id]=r}),n}async function yk(t){return t.matches.some(e=>e.route.middleware)?iM(t,()=>Yb(t)):Yb(t)}function iM(t,e){return _k(t,e,i=>{if(Lk(i))throw i;return i},Ck,n);function n(i,r,s){if(s)return Promise.resolve(Object.assign(s.value,{[r]:{type:"error",result:i}}));{let{matches:o}=t,c=Math.min(Math.max(o.findIndex(d=>d.route.id===r),0),Math.max(o.findIndex(d=>d.shouldCallHandler()),0)),u=Ma(o,o[c].route.id).route.id;return Promise.resolve({[u]:{type:"error",result:i}})}}}async function _k(t,e,n,i,r){let{matches:s,request:o,params:c,context:u,unstable_pattern:d}=t,h=s.flatMap(m=>m.route.middleware?m.route.middleware.map(v=>[m.route.id,v]):[]);return await rM({request:o,params:c,context:u,unstable_pattern:d},h,e,n,i,r)}async function rM(t,e,n,i,r,s,o=0){let{request:c}=t;if(c.signal.aborted)throw c.signal.reason??new Error(`Request aborted: ${c.method} ${c.url}`);let u=e[o];if(!u)return await n();let[d,h]=u,p,m=async()=>{if(p)throw new Error("You may only call `next()` once per middleware");try{return p={value:await rM(t,e,n,i,r,s,o+1)},p.value}catch(v){return p={value:await s(v,d,p)},p.value}};try{let v=await h(t,m),_=v!=null?i(v):void 0;return r(_)?_:p?_??p.value:(p={value:await m()},p.value)}catch(v){return await s(v,d,p)}}function sM(t,e,n,i,r){let s=nM({key:"middleware",route:i.route,manifest:e,mapRouteProperties:t}),o=vk(i.route,Si(n.method)?"action":"loader",e,t,r);return{middleware:s,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function $g(t,e,n,i,r,s,o,c,u=null,d){let h=!1,p=sM(t,e,n,r,s);return{...r,_lazyPromises:p,shouldLoad:c,shouldRevalidateArgs:u,shouldCallHandler(m){return h=!0,u?typeof d=="boolean"?iu(r,{...u,defaultShouldRevalidate:d}):typeof m=="boolean"?iu(r,{...u,defaultShouldRevalidate:m}):iu(r,u):c},resolve(m){let{lazy:v,loader:_,middleware:w}=r.route,y=h||c||m&&!Si(n.method)&&(v||_),b=w&&w.length>0&&!_&&!v;return y&&(Si(n.method)||!b)?bk({request:n,unstable_pattern:i,match:r,lazyHandlerPromise:p?.handler,lazyRoutePromise:p?.route,handlerOverride:m,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function Dl(t,e,n,i,r,s,o,c=null){return i.map(u=>u.route.id!==r.route.id?{...u,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:sM(t,e,n,u,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:$g(t,e,n,Eu(i),u,s,o,!0,c))}async function xk(t,e,n,i,r,s){n.some(d=>d._lazyPromises?.middleware)&&await Promise.all(n.map(d=>d._lazyPromises?.middleware));let o={request:e,unstable_pattern:Eu(n),params:n[0].params,context:r,matches:n},u=await t({...o,fetcherKey:i,runClientMiddleware:d=>{let h=o;return iM(h,()=>d({...h,fetcherKey:i,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(d=>[d._lazyPromises?.handler,d._lazyPromises?.route]))}catch{}return u}async function bk({request:t,unstable_pattern:e,match:n,lazyHandlerPromise:i,lazyRoutePromise:r,handlerOverride:s,scopedContext:o}){let c,u,d=Si(t.method),h=d?"action":"loader",p=m=>{let v,_=new Promise((b,T)=>v=T);u=()=>v(),t.signal.addEventListener("abort",u);let w=b=>typeof m!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${n.route.id}]`)):m({request:t,unstable_pattern:e,params:n.params,context:o},...b!==void 0?[b]:[]),y=(async()=>{try{return{type:"data",result:await(s?s(T=>w(T)):w())}}catch(b){return{type:"error",result:b}}})();return Promise.race([y,_])};try{let m=d?n.route.action:n.route.loader;if(i||r)if(m){let v,[_]=await Promise.all([p(m).catch(w=>{v=w}),i,r]);if(v!==void 0)throw v;c=_}else{await i;let v=d?n.route.action:n.route.loader;if(v)[c]=await Promise.all([p(v),r]);else if(h==="action"){let _=new URL(t.url),w=_.pathname+_.search;throw cr(405,{method:t.method,pathname:w,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(m)c=await p(m);else{let v=new URL(t.url),_=v.pathname+v.search;throw cr(404,{pathname:_})}}catch(m){return{type:"error",result:m}}finally{u&&t.signal.removeEventListener("abort",u)}return c}async function Sk(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function wk(t){let{result:e,type:n}=t;if(Hv(e)){let i;try{i=await Sk(e)}catch(r){return{type:"error",error:r}}return n==="error"?{type:"error",error:new wu(e.status,e.statusText,i),statusCode:e.status,headers:e.headers}:{type:"data",data:i,statusCode:e.status,headers:e.headers}}return n==="error"?tS(e)?e.data instanceof Error?{type:"error",error:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:Ak(e),statusCode:hu(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:hu(e)?e.status:void 0}:tS(e)?{type:"data",data:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"data",data:e}}function Ek(t,e,n,i,r){let s=t.headers.get("Location");if(Qt(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Bv(s)){let o=i.slice(0,i.findIndex(c=>c.route.id===n)+1);s=Wg(new URL(e.url),o,r,s),t.headers.set("Location",s)}return t}function Kb(t,e,n,i){let r=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(Bv(t)){let s=t,o=s.startsWith("//")?new URL(e.protocol+s):new URL(s);if(r.includes(o.protocol))throw new Error("Invalid redirect location");let c=mr(o.pathname,n)!=null;if(o.origin===e.origin&&c)return o.pathname+o.search+o.hash}try{let s=i.createURL(t);if(r.includes(s.protocol))throw new Error("Invalid redirect location")}catch{}return t}function wl(t,e,n,i){let r=t.createURL(aM(e)).toString(),s={signal:n};if(i&&Si(i.formMethod)){let{formMethod:o,formEncType:c}=i;s.method=o.toUpperCase(),c==="application/json"?(s.headers=new Headers({"Content-Type":c}),s.body=JSON.stringify(i.json)):c==="text/plain"?s.body=i.text:c==="application/x-www-form-urlencoded"&&i.formData?s.body=Xg(i.formData):s.body=i.formData}return new Request(r,s)}function Xg(t){let e=new URLSearchParams;for(let[n,i]of t.entries())e.append(n,typeof i=="string"?i:i.name);return e}function Zb(t){let e=new FormData;for(let[n,i]of t.entries())e.append(n,i);return e}function Mk(t,e,n,i=!1,r=!1){let s={},o=null,c,u=!1,d={},h=n&&Ji(n[1])?n[1].error:void 0;return t.forEach(p=>{if(!(p.route.id in e))return;let m=p.route.id,v=e[m];if(Qt(!uo(v),"Cannot handle redirect results in processLoaderData"),Ji(v)){let _=v.error;if(h!==void 0&&(_=h,h=void 0),o=o||{},r)o[m]=_;else{let w=Ma(t,m);o[w.route.id]==null&&(o[w.route.id]=_)}i||(s[m]=QE),u||(u=!0,c=hu(v.error)?v.error.status:500),v.headers&&(d[m]=v.headers)}else s[m]=v.data,v.statusCode&&v.statusCode!==200&&!u&&(c=v.statusCode),v.headers&&(d[m]=v.headers)}),h!==void 0&&n&&(o={[n[0]]:h},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:o,statusCode:c||200,loaderHeaders:d}}function Jb(t,e,n,i,r,s){let{loaderData:o,errors:c}=Mk(e,n,i);return r.filter(u=>!u.matches||u.matches.some(d=>d.shouldLoad)).forEach(u=>{let{key:d,match:h,controller:p}=u;if(p&&p.signal.aborted)return;let m=s[d];if(Qt(m,"Did not find corresponding fetcher result"),Ji(m)){let v=Ma(t.matches,h?.route.id);c&&c[v.route.id]||(c={...c,[v.route.id]:m.error}),t.fetchers.delete(d)}else if(uo(m))Qt(!1,"Unhandled fetcher revalidation redirect");else{let v=Ls(m.data);t.fetchers.set(d,v)}}),{loaderData:o,errors:c}}function Qb(t,e,n,i){let r=Object.entries(e).filter(([,s])=>s!==QE).reduce((s,[o,c])=>(s[o]=c,s),{});for(let s of n){let o=s.route.id;if(!e.hasOwnProperty(o)&&t.hasOwnProperty(o)&&s.route.loader&&(r[o]=t[o]),i&&i.hasOwnProperty(o))break}return r}function eS(t){return t?Ji(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Ma(t,e){return(e?t.slice(0,t.findIndex(i=>i.route.id===e)+1):[...t]).reverse().find(i=>i.route.hasErrorBoundary===!0)||t[0]}function Vd(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function cr(t,{pathname:e,routeId:n,method:i,type:r,message:s}={}){let o="Unknown Server Error",c="Unknown @remix-run/router error";return t===400?(o="Bad Request",i&&e&&n?c=`You made a ${i} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:r==="invalid-body"&&(c="Unable to encode submission body")):t===403?(o="Forbidden",c=`Route "${n}" does not match URL "${e}"`):t===404?(o="Not Found",c=`No route matches URL "${e}"`):t===405&&(o="Method Not Allowed",i&&e&&n?c=`You made a ${i.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:i&&(c=`Invalid request method "${i.toUpperCase()}"`)),new wu(t||500,o,new Error(c),!0)}function Hd(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[i,r]=e[n];if(uo(r))return{key:i,result:r}}}function aM(t){let e=typeof t=="string"?js(t):t;return ss({...e,hash:""})}function Tk(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function Ak(t){return new wu(t.init?.status??500,t.init?.statusText??"Internal Server Error",t.data)}function Ck(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&Pk(n))}function Pk(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function Rk(t){return Hv(t.result)&&ZE.has(t.result.status)}function Ji(t){return t.type==="error"}function uo(t){return(t&&t.type)==="redirect"}function tS(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Hv(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function kk(t){return ZE.has(t)}function Lk(t){return Hv(t)&&kk(t.status)&&t.headers.has("Location")}function Dk(t){return ck.has(t.toUpperCase())}function Si(t){return ok.has(t.toUpperCase())}function Gv(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function Tf(t,e){let n=typeof e=="string"?js(e).search:e.search;if(t[t.length-1].route.index&&Gv(n||""))return t[t.length-1];let i=$E(t);return i[i.length-1]}function nS(t){let{formMethod:e,formAction:n,formEncType:i,text:r,formData:s,json:o}=t;if(!(!e||!n||!i)){if(r!=null)return{formMethod:e,formAction:n,formEncType:i,formData:void 0,json:void 0,text:r};if(s!=null)return{formMethod:e,formAction:n,formEncType:i,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:i,formData:void 0,json:o,text:void 0}}}function Rm(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Nk(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Fc(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Ik(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function Ls(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Uk(t,e){try{let n=t.sessionStorage.getItem(JE);if(n){let i=JSON.parse(n);for(let[r,s]of Object.entries(i||{}))s&&Array.isArray(s)&&e.set(r,new Set(s||[]))}}catch{}}function Fk(t,e){if(e.size>0){let n={};for(let[i,r]of e)n[i]=[...r];try{t.sessionStorage.setItem(JE,JSON.stringify(n))}catch(i){jn(!1,`Failed to save applied view transitions in sessionStorage (${i}).`)}}}function iS(){let t,e,n=new Promise((i,r)=>{t=async s=>{i(s);try{await n}catch{}},e=async s=>{r(s);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var Po=L.createContext(null);Po.displayName="DataRouter";var Mu=L.createContext(null);Mu.displayName="DataRouterState";var oM=L.createContext(!1);function Ok(){return L.useContext(oM)}var jv=L.createContext({isTransitioning:!1});jv.displayName="ViewTransition";var lM=L.createContext(new Map);lM.displayName="Fetchers";var Bk=L.createContext(null);Bk.displayName="Await";var gr=L.createContext(null);gr.displayName="Navigation";var Ch=L.createContext(null);Ch.displayName="Location";var Ws=L.createContext({outlet:null,matches:[],isDataRoute:!1});Ws.displayName="Route";var Wv=L.createContext(null);Wv.displayName="RouteError";var cM="REACT_ROUTER_ERROR",zk="REDIRECT",Vk="ROUTE_ERROR_RESPONSE";function Hk(t){if(t.startsWith(`${cM}:${zk}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function Gk(t){if(t.startsWith(`${cM}:${Vk}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new wu(e.status,e.statusText,e.data)}catch{}}function jk(t,{relative:e}={}){Qt(Tu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=L.useContext(gr),{hash:r,pathname:s,search:o}=Cu(t,{relative:e}),c=s;return n!=="/"&&(c=s==="/"?n:Br([n,s])),i.createHref({pathname:c,search:o,hash:r})}function Tu(){return L.useContext(Ch)!=null}function vr(){return Qt(Tu(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Ch).location}var uM="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function dM(t){L.useContext(gr).static||L.useLayoutEffect(t)}function Au(){let{isDataRoute:t}=L.useContext(Ws);return t?iL():Wk()}function Wk(){Qt(Tu(),"useNavigate() may be used only in the context of a <Router> component.");let t=L.useContext(Po),{basename:e,navigator:n}=L.useContext(gr),{matches:i}=L.useContext(Ws),{pathname:r}=vr(),s=JSON.stringify(zv(i)),o=L.useRef(!1);return dM(()=>{o.current=!0}),L.useCallback((u,d={})=>{if(jn(o.current,uM),!o.current)return;if(typeof u=="number"){n.go(u);return}let h=Ah(u,JSON.parse(s),r,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Br([e,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[e,n,s,r,t])}L.createContext(null);function Cu(t,{relative:e}={}){let{matches:n}=L.useContext(Ws),{pathname:i}=vr(),r=JSON.stringify(zv(n));return L.useMemo(()=>Ah(t,JSON.parse(r),i,e==="path"),[t,r,i,e])}function $k(t,e,n){Qt(Tu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=L.useContext(gr),{matches:r}=L.useContext(Ws),s=r[r.length-1],o=s?s.params:{},c=s?s.pathname:"/",u=s?s.pathnameBase:"/",d=s&&s.route;{let y=d&&d.path||"";hM(c,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
11
11
|
|
|
12
12
|
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let h=vr(),p;p=h;let m=p.pathname||"/",v=m;if(u!=="/"){let y=u.replace(/^\//,"").split("/");v="/"+m.replace(/^\//,"").split("/").slice(y.length).join("/")}let _=Ea(t,{pathname:v});return jn(d||_!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),jn(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),Zk(_&&_.map(y=>Object.assign({},y,{params:Object.assign({},o,y.params),pathname:Br([u,i.encodeLocation?i.encodeLocation(y.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?u:Br([u,i.encodeLocation?i.encodeLocation(y.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),r,n)}function Xk(){let t=nL(),e=hu(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:s},"ErrorBoundary")," or"," ",L.createElement("code",{style:s},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),n?L.createElement("pre",{style:r},n):null,o)}var qk=L.createElement(Xk,null),fM=class extends L.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=Gk(t.digest);n&&(t=n)}let e=t!==void 0?L.createElement(Ws.Provider,{value:this.props.routeContext},L.createElement(Wv.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?L.createElement(Yk,{error:t},e):e}};fM.contextType=oM;var km=new WeakMap;function Yk({children:t,error:e}){let{basename:n}=L.useContext(gr);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let i=Hk(e.digest);if(i){let r=km.get(e);if(r)throw r;let s=qE(i.location,n);if(XE&&!km.get(e))if(s.isExternal||i.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:i.replace}));throw km.set(e,o),o}return L.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function Kk({routeContext:t,match:e,children:n}){let i=L.useContext(Po);return i&&i.static&&i.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=e.route.id),L.createElement(Ws.Provider,{value:t},n)}function Zk(t,e=[],n){let i=n?.state;if(t==null){if(!i)return null;if(i.errors)t=i.matches;else if(e.length===0&&!i.initialized&&i.matches.length>0)t=i.matches;else return null}let r=t,s=i?.errors;if(s!=null){let h=r.findIndex(p=>p.route.id&&s?.[p.route.id]!==void 0);Qt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),r=r.slice(0,Math.min(r.length,h+1))}let o=!1,c=-1;if(n&&i){o=i.renderFallback;for(let h=0;h<r.length;h++){let p=r[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=h),p.route.id){let{loaderData:m,errors:v}=i,_=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!v||v[p.route.id]===void 0);if(p.route.lazy||_){n.isStatic&&(o=!0),c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}}let u=n?.onError,d=i&&u?(h,p)=>{u(h,{location:i.location,params:i.matches?.[0]?.params??{},unstable_pattern:Eu(i.matches),errorInfo:p})}:void 0;return r.reduceRight((h,p,m)=>{let v,_=!1,w=null,y=null;i&&(v=s&&p.route.id?s[p.route.id]:void 0,w=p.route.errorElement||qk,o&&(c<0&&m===0?(hM("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,y=null):c===m&&(_=!0,y=p.route.hydrateFallbackElement||null)));let b=e.concat(r.slice(0,m+1)),T=()=>{let A;return v?A=w:_?A=y:p.route.Component?A=L.createElement(p.route.Component,null):p.route.element?A=p.route.element:A=h,L.createElement(Kk,{match:p,routeContext:{outlet:h,matches:b,isDataRoute:i!=null},children:A})};return i&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?L.createElement(fM,{location:i.location,revalidation:i.revalidation,component:w,error:v,children:T(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:d}):T()},null)}function $v(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Jk(t){let e=L.useContext(Po);return Qt(e,$v(t)),e}function Qk(t){let e=L.useContext(Mu);return Qt(e,$v(t)),e}function eL(t){let e=L.useContext(Ws);return Qt(e,$v(t)),e}function Xv(t){let e=eL(t),n=e.matches[e.matches.length-1];return Qt(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function tL(){return Xv("useRouteId")}function nL(){let t=L.useContext(Wv),e=Qk("useRouteError"),n=Xv("useRouteError");return t!==void 0?t:e.errors?.[n]}function iL(){let{router:t}=Jk("useNavigate"),e=Xv("useNavigate"),n=L.useRef(!1);return dM(()=>{n.current=!0}),L.useCallback(async(r,s={})=>{jn(n.current,uM),n.current&&(typeof r=="number"?await t.navigate(r):await t.navigate(r,{fromRouteId:e,...s}))},[t,e])}var rS={};function hM(t,e,n){!e&&!rS[t]&&(rS[t]=!0,jn(!1,n))}var sS={};function aS(t,e){!t&&!sS[e]&&(sS[e]=!0,console.warn(e))}var rL="useOptimistic",oS=BE[rL],sL=()=>{};function aL(t){return oS?oS(t):[t,sL]}function oL(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&jn(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:L.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&jn(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:L.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&jn(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:L.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var lL=["HydrateFallback","hydrateFallbackElement"],cL=class{constructor(){this.status="pending",this.promise=new Promise((t,e)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",e(n))}})}};function uL({router:t,flushSync:e,onError:n,unstable_useTransitions:i}){i=Ok()||i;let[s,o]=L.useState(t.state),[c,u]=aL(s),[d,h]=L.useState(),[p,m]=L.useState({isTransitioning:!1}),[v,_]=L.useState(),[w,y]=L.useState(),[b,T]=L.useState(),A=L.useRef(new Map),M=L.useCallback((S,{deletedFetchers:P,newErrors:V,flushSync:O,viewTransitionOpts:G})=>{V&&n&&Object.values(V).forEach(H=>n(H,{location:S.location,params:S.matches[0]?.params??{},unstable_pattern:Eu(S.matches)})),S.fetchers.forEach((H,X)=>{H.data!==void 0&&A.current.set(X,H.data)}),P.forEach(H=>A.current.delete(H)),aS(O===!1||e!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let J=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(aS(G==null||J,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!G||!J){e&&O?e(()=>o(S)):i===!1?o(S):L.startTransition(()=>{i===!0&&u(H=>lS(H,S)),o(S)});return}if(e&&O){e(()=>{w&&(v?.resolve(),w.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:G.currentLocation,nextLocation:G.nextLocation})});let H=t.window.document.startViewTransition(()=>{e(()=>o(S))});H.finished.finally(()=>{e(()=>{_(void 0),y(void 0),h(void 0),m({isTransitioning:!1})})}),e(()=>y(H));return}w?(v?.resolve(),w.skipTransition(),T({state:S,currentLocation:G.currentLocation,nextLocation:G.nextLocation})):(h(S),m({isTransitioning:!0,flushSync:!1,currentLocation:G.currentLocation,nextLocation:G.nextLocation}))},[t.window,e,w,v,i,u,n]);L.useLayoutEffect(()=>t.subscribe(M),[t,M]),L.useEffect(()=>{p.isTransitioning&&!p.flushSync&&_(new cL)},[p]),L.useEffect(()=>{if(v&&d&&t.window){let S=d,P=v.promise,V=t.window.document.startViewTransition(async()=>{i===!1?o(S):L.startTransition(()=>{i===!0&&u(O=>lS(O,S)),o(S)}),await P});V.finished.finally(()=>{_(void 0),y(void 0),h(void 0),m({isTransitioning:!1})}),y(V)}},[d,v,t.window,i,u]),L.useEffect(()=>{v&&d&&c.location.key===d.location.key&&v.resolve()},[v,w,c.location,d]),L.useEffect(()=>{!p.isTransitioning&&b&&(h(b.state),m({isTransitioning:!0,flushSync:!1,currentLocation:b.currentLocation,nextLocation:b.nextLocation}),T(void 0))},[p.isTransitioning,b]);let I=L.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:S=>t.navigate(S),push:(S,P,V)=>t.navigate(S,{state:P,preventScrollReset:V?.preventScrollReset}),replace:(S,P,V)=>t.navigate(S,{replace:!0,state:P,preventScrollReset:V?.preventScrollReset})}),[t]),k=t.basename||"/",U=L.useMemo(()=>({router:t,navigator:I,static:!1,basename:k,onError:n}),[t,I,k,n]);return L.createElement(L.Fragment,null,L.createElement(Po.Provider,{value:U},L.createElement(Mu.Provider,{value:c},L.createElement(lM.Provider,{value:A.current},L.createElement(jv.Provider,{value:p},L.createElement(hL,{basename:k,location:c.location,navigationType:c.historyAction,navigator:I,unstable_useTransitions:i},L.createElement(dL,{routes:t.routes,future:t.future,state:c,isStatic:!1,onError:n})))))),null)}function lS(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var dL=L.memo(fL);function fL({routes:t,future:e,state:n,isStatic:i,onError:r}){return $k(t,void 0,{state:n,isStatic:i,onError:r})}function hL({basename:t="/",children:e=null,location:n,navigationType:i="POP",navigator:r,static:s=!1,unstable_useTransitions:o}){Qt(!Tu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=t.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:c,navigator:r,static:s,unstable_useTransitions:o,future:{}}),[c,r,s,o]);typeof n=="string"&&(n=js(n));let{pathname:d="/",search:h="",hash:p="",state:m=null,key:v="default",unstable_mask:_}=n,w=L.useMemo(()=>{let y=mr(d,c);return y==null?null:{location:{pathname:y,search:h,hash:p,state:m,key:v,unstable_mask:_},navigationType:i}},[c,d,h,p,m,v,i,_]);return jn(w!=null,`<Router basename="${c}"> is not able to match the URL "${d}${h}${p}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:L.createElement(gr.Provider,{value:u},L.createElement(Ch.Provider,{children:e,value:w}))}var Af="get",Cf="application/x-www-form-urlencoded";function Ph(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function pL(t){return Ph(t)&&t.tagName.toLowerCase()==="button"}function mL(t){return Ph(t)&&t.tagName.toLowerCase()==="form"}function gL(t){return Ph(t)&&t.tagName.toLowerCase()==="input"}function vL(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yL(t,e){return t.button===0&&(!e||e==="_self")&&!vL(t)}function qg(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let i=t[n];return e.concat(Array.isArray(i)?i.map(r=>[n,r]):[[n,i]])},[]))}function _L(t,e){let n=qg(t);return e&&e.forEach((i,r)=>{n.has(r)||e.getAll(r).forEach(s=>{n.append(r,s)})}),n}var Gd=null;function xL(){if(Gd===null)try{new FormData(document.createElement("form"),0),Gd=!1}catch{Gd=!0}return Gd}var bL=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Lm(t){return t!=null&&!bL.has(t)?(jn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cf}"`),null):t}function SL(t,e){let n,i,r,s,o;if(mL(t)){let c=t.getAttribute("action");i=c?mr(c,e):null,n=t.getAttribute("method")||Af,r=Lm(t.getAttribute("enctype"))||Cf,s=new FormData(t)}else if(pL(t)||gL(t)&&(t.type==="submit"||t.type==="image")){let c=t.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=t.getAttribute("formaction")||c.getAttribute("action");if(i=u?mr(u,e):null,n=t.getAttribute("formmethod")||c.getAttribute("method")||Af,r=Lm(t.getAttribute("formenctype"))||Lm(c.getAttribute("enctype"))||Cf,s=new FormData(c,t),!xL()){let{name:d,type:h,value:p}=t;if(h==="image"){let m=d?`${d}.`:"";s.append(`${m}x`,"0"),s.append(`${m}y`,"0")}else d&&s.append(d,p)}}else{if(Ph(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Af,i=null,r=Cf,o=t}return s&&r==="text/plain"&&(o=s,s=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function qv(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function wL(t,e,n,i){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:e&&mr(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function EL(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ML(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function TL(t,e,n){let i=await Promise.all(t.map(async r=>{let s=e.routes[r.route.id];if(s){let o=await EL(s,n);return o.links?o.links():[]}return[]}));return RL(i.flat(1).filter(ML).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function cS(t,e,n,i,r,s){let o=(u,d)=>n[d]?u.route.id!==n[d].route.id:!0,c=(u,d)=>n[d].pathname!==u.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==u.params["*"];return s==="assets"?e.filter((u,d)=>o(u,d)||c(u,d)):s==="data"?e.filter((u,d)=>{let h=i.routes[u.route.id];if(!h||!h.hasLoader)return!1;if(o(u,d)||c(u,d))return!0;if(u.route.shouldRevalidate){let p=u.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function AL(t,e,{includeHydrateFallback:n}={}){return CL(t.map(i=>{let r=e.routes[i.route.id];if(!r)return[];let s=[r.module];return r.clientActionModule&&(s=s.concat(r.clientActionModule)),r.clientLoaderModule&&(s=s.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(s=s.concat(r.hydrateFallbackModule)),r.imports&&(s=s.concat(r.imports)),s}).flat(1))}function CL(t){return[...new Set(t)]}function PL(t){let e={},n=Object.keys(t).sort();for(let i of n)e[i]=t[i];return e}function RL(t,e){let n=new Set;return new Set(e),t.reduce((i,r)=>{let s=JSON.stringify(PL(r));return n.has(s)||(n.add(s),i.push({key:s,link:r})),i},[])}function pM(){let t=L.useContext(Po);return qv(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function kL(){let t=L.useContext(Mu);return qv(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Yv=L.createContext(void 0);Yv.displayName="FrameworkContext";function mM(){let t=L.useContext(Yv);return qv(t,"You must render this element inside a <HydratedRouter> element"),t}function LL(t,e){let n=L.useContext(Yv),[i,r]=L.useState(!1),[s,o]=L.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:d,onMouseLeave:h,onTouchStart:p}=e,m=L.useRef(null);L.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let w=b=>{b.forEach(T=>{o(T.isIntersecting)})},y=new IntersectionObserver(w,{threshold:.5});return m.current&&y.observe(m.current),()=>{y.disconnect()}}},[t]),L.useEffect(()=>{if(i){let w=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(w)}}},[i]);let v=()=>{r(!0)},_=()=>{r(!1),o(!1)};return n?t!=="intent"?[s,m,{}]:[s,m,{onFocus:Oc(c,v),onBlur:Oc(u,_),onMouseEnter:Oc(d,v),onMouseLeave:Oc(h,_),onTouchStart:Oc(p,v)}]:[!1,m,{}]}function Oc(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function DL({page:t,...e}){let{router:n}=pM(),i=L.useMemo(()=>Ea(n.routes,t,n.basename),[n.routes,t,n.basename]);return i?L.createElement(IL,{page:t,matches:i,...e}):null}function NL(t){let{manifest:e,routeModules:n}=mM(),[i,r]=L.useState([]);return L.useEffect(()=>{let s=!1;return TL(t,e,n).then(o=>{s||r(o)}),()=>{s=!0}},[t,e,n]),i}function IL({page:t,matches:e,...n}){let i=vr(),{future:r,manifest:s,routeModules:o}=mM(),{basename:c}=pM(),{loaderData:u,matches:d}=kL(),h=L.useMemo(()=>cS(t,e,d,s,i,"data"),[t,e,d,s,i]),p=L.useMemo(()=>cS(t,e,d,s,i,"assets"),[t,e,d,s,i]),m=L.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let w=new Set,y=!1;if(e.forEach(T=>{let A=s.routes[T.route.id];!A||!A.hasLoader||(!h.some(M=>M.route.id===T.route.id)&&T.route.id in u&&o[T.route.id]?.shouldRevalidate||A.hasClientLoader?y=!0:w.add(T.route.id))}),w.size===0)return[];let b=wL(t,c,r.unstable_trailingSlashAwareDataRequests,"data");return y&&w.size>0&&b.searchParams.set("_routes",e.filter(T=>w.has(T.route.id)).map(T=>T.route.id).join(",")),[b.pathname+b.search]},[c,r.unstable_trailingSlashAwareDataRequests,u,i,s,h,e,t,o]),v=L.useMemo(()=>AL(p,s),[p,s]),_=NL(p);return L.createElement(L.Fragment,null,m.map(w=>L.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),v.map(w=>L.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),_.map(({key:w,link:y})=>L.createElement("link",{key:w,nonce:n.nonce,...y,crossOrigin:y.crossOrigin??n.crossOrigin})))}function UL(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var FL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{FL&&(window.__reactRouterVersion="7.13.1")}catch{}function OL(t,e){return hk({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:P2({window:e?.window}),hydrationData:BL(),routes:t,mapRouteProperties:oL,hydrationRouteProperties:lL,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function BL(){let t=window?.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:zL(t.errors)}),t}function zL(t){if(!t)return null;let e=Object.entries(t),n={};for(let[i,r]of e)if(r&&r.__type==="RouteErrorResponse")n[i]=new wu(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type==="Error"){if(r.__subType){let s=window[r.__subType];if(typeof s=="function")try{let o=new s(r.message);o.stack="",n[i]=o}catch{}}if(n[i]==null){let s=new Error(r.message);s.stack="",n[i]=s}}else n[i]=r;return n}var gM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Us=L.forwardRef(function({onClick:e,discover:n="render",prefetch:i="none",relative:r,reloadDocument:s,replace:o,unstable_mask:c,state:u,target:d,to:h,preventScrollReset:p,viewTransition:m,unstable_defaultShouldRevalidate:v,..._},w){let{basename:y,navigator:b,unstable_useTransitions:T}=L.useContext(gr),A=typeof h=="string"&&gM.test(h),M=qE(h,y);h=M.to;let I=jk(h,{relative:r}),k=vr(),U=null;if(c){let X=Ah(c,[],k.unstable_mask?k.unstable_mask.pathname:"/",!0);y!=="/"&&(X.pathname=X.pathname==="/"?y:Br([y,X.pathname])),U=b.createHref(X)}let[S,P,V]=LL(i,_),O=jL(h,{replace:o,unstable_mask:c,state:u,target:d,preventScrollReset:p,relative:r,viewTransition:m,unstable_defaultShouldRevalidate:v,unstable_useTransitions:T});function G(X){e&&e(X),X.defaultPrevented||O(X)}let J=!(M.isExternal||s),H=L.createElement("a",{..._,...V,href:(J?U:void 0)||M.absoluteURL||I,onClick:J?G:e,ref:UL(w,P),target:d,"data-discover":!A&&n==="render"?"true":void 0});return S&&!A?L.createElement(L.Fragment,null,H,L.createElement(DL,{page:I})):H});Us.displayName="Link";var VL=L.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:i="",end:r=!1,style:s,to:o,viewTransition:c,children:u,...d},h){let p=Cu(o,{relative:d.relative}),m=vr(),v=L.useContext(Mu),{navigator:_,basename:w}=L.useContext(gr),y=v!=null&&KL(p)&&c===!0,b=_.encodeLocation?_.encodeLocation(p).pathname:p.pathname,T=m.pathname,A=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(T=T.toLowerCase(),A=A?A.toLowerCase():null,b=b.toLowerCase()),A&&w&&(A=mr(A,w)||A);const M=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let I=T===b||!r&&T.startsWith(b)&&T.charAt(M)==="/",k=A!=null&&(A===b||!r&&A.startsWith(b)&&A.charAt(b.length)==="/"),U={isActive:I,isPending:k,isTransitioning:y},S=I?e:void 0,P;typeof i=="function"?P=i(U):P=[i,I?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let V=typeof s=="function"?s(U):s;return L.createElement(Us,{...d,"aria-current":S,className:P,ref:h,style:V,to:o,viewTransition:c},typeof u=="function"?u(U):u)});VL.displayName="NavLink";var HL=L.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:i,replace:r,state:s,method:o=Af,action:c,onSubmit:u,relative:d,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:m,...v},_)=>{let{unstable_useTransitions:w}=L.useContext(gr),y=qL(),b=YL(c,{relative:d}),T=o.toLowerCase()==="get"?"get":"post",A=typeof c=="string"&&gM.test(c),M=I=>{if(u&&u(I),I.defaultPrevented)return;I.preventDefault();let k=I.nativeEvent.submitter,U=k?.getAttribute("formmethod")||o,S=()=>y(k||I.currentTarget,{fetcherKey:e,method:U,navigate:n,replace:r,state:s,relative:d,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:m});w&&n!==!1?L.startTransition(()=>S()):S()};return L.createElement("form",{ref:_,method:T,action:b,onSubmit:i?u:M,...v,"data-discover":!A&&t==="render"?"true":void 0})});HL.displayName="Form";function GL(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vM(t){let e=L.useContext(Po);return Qt(e,GL(t)),e}function jL(t,{target:e,replace:n,unstable_mask:i,state:r,preventScrollReset:s,relative:o,viewTransition:c,unstable_defaultShouldRevalidate:u,unstable_useTransitions:d}={}){let h=Au(),p=vr(),m=Cu(t,{relative:o});return L.useCallback(v=>{if(yL(v,e)){v.preventDefault();let _=n!==void 0?n:ss(p)===ss(m),w=()=>h(t,{replace:_,unstable_mask:i,state:r,preventScrollReset:s,relative:o,viewTransition:c,unstable_defaultShouldRevalidate:u});d?L.startTransition(()=>w()):w()}},[p,h,m,n,i,r,e,t,s,o,c,u,d])}function WL(t){jn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=L.useRef(qg(t)),n=L.useRef(!1),i=vr(),r=L.useMemo(()=>_L(i.search,n.current?null:e.current),[i.search]),s=Au(),o=L.useCallback((c,u)=>{const d=qg(typeof c=="function"?c(new URLSearchParams(r)):c);n.current=!0,s("?"+d,u)},[s,r]);return[r,o]}var $L=0,XL=()=>`__${String(++$L)}__`;function qL(){let{router:t}=vM("useSubmit"),{basename:e}=L.useContext(gr),n=tL(),i=t.fetch,r=t.navigate;return L.useCallback(async(s,o={})=>{let{action:c,method:u,encType:d,formData:h,body:p}=SL(s,e);if(o.navigate===!1){let m=o.fetcherKey||XL();await i(m,n,o.action||c,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:p,formMethod:o.method||u,formEncType:o.encType||d,flushSync:o.flushSync})}else await r(o.action||c,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:p,formMethod:o.method||u,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[i,r,e,n])}function YL(t,{relative:e}={}){let{basename:n}=L.useContext(gr),i=L.useContext(Ws);Qt(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),s={...Cu(t||".",{relative:e})},o=vr();if(t==null){s.search=o.search;let c=new URLSearchParams(s.search),u=c.getAll("index");if(u.some(h=>h==="")){c.delete("index"),u.filter(p=>p).forEach(p=>c.append("index",p));let h=c.toString();s.search=h?`?${h}`:""}}return(!t||t===".")&&r.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Br([n,s.pathname])),ss(s)}function KL(t,{relative:e}={}){let n=L.useContext(jv);Qt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=vM("useViewTransitionState"),r=Cu(t,{relative:e});if(!n.isTransitioning)return!1;let s=mr(n.currentLocation.pathname,i)||n.currentLocation.pathname,o=mr(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Kf(r.pathname,o)!=null||Kf(r.pathname,s)!=null}var ZL=zE();function JL(t){return L.createElement(uL,{flushSync:ZL.flushSync,...t})}var hn;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const s={};for(const o of r)s[o]=o;return s},t.getValidEnumValues=r=>{const s=t.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),o={};for(const c of s)o[c]=r[c];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(s){return r[s]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const s=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},t.find=(r,s)=>{for(const o of r)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=i,t.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(hn||(hn={}));var uS;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(uS||(uS={}));const ot=hn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wa=t=>{switch(typeof t){case"undefined":return ot.undefined;case"string":return ot.string;case"number":return Number.isNaN(t)?ot.nan:ot.number;case"boolean":return ot.boolean;case"function":return ot.function;case"bigint":return ot.bigint;case"symbol":return ot.symbol;case"object":return Array.isArray(t)?ot.array:t===null?ot.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ot.promise:typeof Map<"u"&&t instanceof Map?ot.map:typeof Set<"u"&&t instanceof Set?ot.set:typeof Date<"u"&&t instanceof Date?ot.date:ot.object;default:return ot.unknown}},Ue=hn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Vs extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},i={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)i._errors.push(n(o));else{let c=i,u=0;for(;u<o.path.length;){const d=o.path[u];u===o.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(o))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return r(this),i}static assert(e){if(!(e instanceof Vs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,hn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},i=[];for(const r of this.issues)if(r.path.length>0){const s=r.path[0];n[s]=n[s]||[],n[s].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Vs.create=t=>new Vs(t);const Yg=(t,e)=>{let n;switch(t.code){case Ue.invalid_type:t.received===ot.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,hn.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:n=`Unrecognized key(s) in object: ${hn.joinValues(t.keys,", ")}`;break;case Ue.invalid_union:n="Invalid input";break;case Ue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${hn.joinValues(t.options)}`;break;case Ue.invalid_enum_value:n=`Invalid enum value. Expected ${hn.joinValues(t.options)}, received '${t.received}'`;break;case Ue.invalid_arguments:n="Invalid function arguments";break;case Ue.invalid_return_type:n="Invalid function return type";break;case Ue.invalid_date:n="Invalid date";break;case Ue.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:hn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ue.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Ue.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Ue.custom:n="Invalid input";break;case Ue.invalid_intersection_types:n="Intersection results could not be merged";break;case Ue.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ue.not_finite:n="Number must be finite";break;default:n=e.defaultError,hn.assertNever(t)}return{message:n}};let QL=Yg;function eD(){return QL}const tD=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,s=[...n,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let c="";const u=i.filter(d=>!!d).slice().reverse();for(const d of u)c=d(o,{data:e,defaultError:c}).message;return{...r,path:s,message:c}};function Je(t,e){const n=eD(),i=tD({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Yg?void 0:Yg].filter(r=>!!r)});t.common.issues.push(i)}class Di{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const r of n){if(r.status==="aborted")return zt;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const r of n){const s=await r.key,o=await r.value;i.push({key:s,value:o})}return Di.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return zt;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(i[s.value]=o.value)}return{status:e.value,value:i}}}const zt=Object.freeze({status:"aborted"}),Jc=t=>({status:"dirty",value:t}),yr=t=>({status:"valid",value:t}),dS=t=>t.status==="aborted",fS=t=>t.status==="dirty",Fl=t=>t.status==="valid",Zf=t=>typeof Promise<"u"&&t instanceof Promise;var wt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(wt||(wt={}));class as{constructor(e,n,i,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const hS=(t,e)=>{if(Fl(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Vs(t.common.issues);return this._error=n,this._error}}};function $t(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:r}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,c)=>{const{message:u}=t;return o.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??i??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},description:r}}class sn{get description(){return this._def.description}_getType(e){return wa(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:wa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Di,ctx:{common:e.parent.common,data:e.data,parsedType:wa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Zf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){const i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wa(e)},r=this._parseSync({data:e,path:i.path,parent:i});return hS(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wa(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Fl(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Fl(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wa(e)},r=this._parse({data:e,path:i.path,parent:i}),s=await(Zf(r)?r:Promise.resolve(r));return hS(i,s)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,s)=>{const o=e(r),c=()=>s.addIssue({code:Ue.custom,...i(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,n){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(e){return new Eo({schema:this,typeName:Vt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Fs.create(this,this._def)}nullable(){return Mo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ts.create(this)}promise(){return ih.create(this,this._def)}or(e){return Qf.create([this,e],this._def)}and(e){return eh.create(this,e,this._def)}transform(e){return new Eo({...$t(this._def),schema:this,typeName:Vt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new rh({...$t(this._def),innerType:this,defaultValue:n,typeName:Vt.ZodDefault})}brand(){return new bM({typeName:Vt.ZodBranded,type:this,...$t(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new sh({...$t(this._def),innerType:this,catchValue:n,typeName:Vt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Zv.create(this,e)}readonly(){return ah.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nD=/^c[^\s-]{8,}$/i,iD=/^[0-9a-z]+$/,rD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sD=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,aD=/^[a-z0-9_-]{21}$/i,oD=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lD=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Dm;const dD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,hD=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,pD=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yM="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",vD=new RegExp(`^${yM}$`);function _M(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function yD(t){return new RegExp(`^${_M(t)}$`)}function _D(t){let e=`${yM}T${_M(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function xD(t,e){return!!((e==="v4"||!e)&&dD.test(t)||(e==="v6"||!e)&&hD.test(t))}function bD(t,e){if(!oD.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function SD(t,e){return!!((e==="v4"||!e)&&fD.test(t)||(e==="v6"||!e)&&pD.test(t))}class Jr extends sn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ot.string){const s=this._getOrReturnCtx(e);return Je(s,{code:Ue.invalid_type,expected:ot.string,received:s.parsedType}),zt}const i=new Di;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,c=e.data.length<s.value;(o||c)&&(r=this._getOrReturnCtx(e,r),o?Je(r,{code:Ue.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&Je(r,{code:Ue.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")cD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"email",code:Ue.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")Dm||(Dm=new RegExp(uD,"u")),Dm.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"emoji",code:Ue.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")sD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"uuid",code:Ue.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")aD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"nanoid",code:Ue.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")nD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"cuid",code:Ue.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")iD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"cuid2",code:Ue.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")rD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"ulid",code:Ue.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Je(r,{validation:"url",code:Ue.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"regex",code:Ue.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?_D(s).test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?vD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?yD(s).test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?lD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"duration",code:Ue.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?xD(e.data,s.version)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"ip",code:Ue.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?bD(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"jwt",code:Ue.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?SD(e.data,s.version)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"cidr",code:Ue.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?mD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"base64",code:Ue.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?gD.test(e.data)||(r=this._getOrReturnCtx(e,r),Je(r,{validation:"base64url",code:Ue.invalid_string,message:s.message}),i.dirty()):hn.assertNever(s);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:Ue.invalid_string,...wt.errToObj(i)})}_addCheck(e){return new Jr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...wt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...wt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...wt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...wt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...wt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...wt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...wt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...wt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...wt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...wt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...wt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...wt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...wt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...wt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...wt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...wt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...wt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...wt.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...wt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...wt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...wt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...wt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...wt.errToObj(n)})}nonempty(e){return this.min(1,wt.errToObj(e))}trim(){return new Jr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Jr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Jr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Jr.create=t=>new Jr({checks:[],typeName:Vt.ZodString,coerce:t?.coerce??!1,...$t(t)});function wD(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(t.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return s%o/10**r}class xo extends sn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ot.number){const s=this._getOrReturnCtx(e);return Je(s,{code:Ue.invalid_type,expected:ot.number,received:s.parsedType}),zt}let i;const r=new Di;for(const s of this._def.checks)s.kind==="int"?hn.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?wD(e.data,s.value)!==0&&(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.not_finite,message:s.message}),r.dirty()):hn.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,wt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,wt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,wt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,wt.toString(n))}setLimit(e,n,i,r){return new xo({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:wt.toString(r)}]})}_addCheck(e){return new xo({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:wt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:wt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:wt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:wt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:wt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:wt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&hn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(n)&&Number.isFinite(e)}}xo.create=t=>new xo({checks:[],typeName:Vt.ZodNumber,coerce:t?.coerce||!1,...$t(t)});class bo extends sn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ot.bigint)return this._getInvalidInput(e);let i;const r=new Di;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):hn.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:ot.bigint,received:n.parsedType}),zt}gte(e,n){return this.setLimit("min",e,!0,wt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,wt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,wt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,wt.toString(n))}setLimit(e,n,i,r){return new bo({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:wt.toString(r)}]})}_addCheck(e){return new bo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:wt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}bo.create=t=>new bo({checks:[],typeName:Vt.ZodBigInt,coerce:t?.coerce??!1,...$t(t)});class Jf extends sn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ot.boolean){const i=this._getOrReturnCtx(e);return Je(i,{code:Ue.invalid_type,expected:ot.boolean,received:i.parsedType}),zt}return yr(e.data)}}Jf.create=t=>new Jf({typeName:Vt.ZodBoolean,coerce:t?.coerce||!1,...$t(t)});class Ol extends sn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ot.date){const s=this._getOrReturnCtx(e);return Je(s,{code:Ue.invalid_type,expected:ot.date,received:s.parsedType}),zt}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Je(s,{code:Ue.invalid_date}),zt}const i=new Di;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):hn.assertNever(s);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ol({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:wt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:wt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ol.create=t=>new Ol({checks:[],coerce:t?.coerce||!1,typeName:Vt.ZodDate,...$t(t)});class pS extends sn{_parse(e){if(this._getType(e)!==ot.symbol){const i=this._getOrReturnCtx(e);return Je(i,{code:Ue.invalid_type,expected:ot.symbol,received:i.parsedType}),zt}return yr(e.data)}}pS.create=t=>new pS({typeName:Vt.ZodSymbol,...$t(t)});class Kg extends sn{_parse(e){if(this._getType(e)!==ot.undefined){const i=this._getOrReturnCtx(e);return Je(i,{code:Ue.invalid_type,expected:ot.undefined,received:i.parsedType}),zt}return yr(e.data)}}Kg.create=t=>new Kg({typeName:Vt.ZodUndefined,...$t(t)});class Zg extends sn{_parse(e){if(this._getType(e)!==ot.null){const i=this._getOrReturnCtx(e);return Je(i,{code:Ue.invalid_type,expected:ot.null,received:i.parsedType}),zt}return yr(e.data)}}Zg.create=t=>new Zg({typeName:Vt.ZodNull,...$t(t)});class mS extends sn{constructor(){super(...arguments),this._any=!0}_parse(e){return yr(e.data)}}mS.create=t=>new mS({typeName:Vt.ZodAny,...$t(t)});class Jg extends sn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yr(e.data)}}Jg.create=t=>new Jg({typeName:Vt.ZodUnknown,...$t(t)});class Da extends sn{_parse(e){const n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:ot.never,received:n.parsedType}),zt}}Da.create=t=>new Da({typeName:Vt.ZodNever,...$t(t)});class gS extends sn{_parse(e){if(this._getType(e)!==ot.undefined){const i=this._getOrReturnCtx(e);return Je(i,{code:Ue.invalid_type,expected:ot.void,received:i.parsedType}),zt}return yr(e.data)}}gS.create=t=>new gS({typeName:Vt.ZodVoid,...$t(t)});class ts extends sn{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==ot.array)return Je(n,{code:Ue.invalid_type,expected:ot.array,received:n.parsedType}),zt;if(r.exactLength!==null){const o=n.data.length>r.exactLength.value,c=n.data.length<r.exactLength.value;(o||c)&&(Je(n,{code:o?Ue.too_big:Ue.too_small,minimum:c?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(Je(n,{code:Ue.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(Je(n,{code:Ue.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>r.type._parseAsync(new as(n,o,n.path,c)))).then(o=>Di.mergeArray(i,o));const s=[...n.data].map((o,c)=>r.type._parseSync(new as(n,o,n.path,c)));return Di.mergeArray(i,s)}get element(){return this._def.type}min(e,n){return new ts({...this._def,minLength:{value:e,message:wt.toString(n)}})}max(e,n){return new ts({...this._def,maxLength:{value:e,message:wt.toString(n)}})}length(e,n){return new ts({...this._def,exactLength:{value:e,message:wt.toString(n)}})}nonempty(e){return this.min(1,e)}}ts.create=(t,e)=>new ts({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Vt.ZodArray,...$t(e)});function El(t){if(t instanceof Xn){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=Fs.create(El(i))}return new Xn({...t._def,shape:()=>e})}else return t instanceof ts?new ts({...t._def,type:El(t.element)}):t instanceof Fs?Fs.create(El(t.unwrap())):t instanceof Mo?Mo.create(El(t.unwrap())):t instanceof So?So.create(t.items.map(e=>El(e))):t}class Xn extends sn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=hn.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ot.object){const d=this._getOrReturnCtx(e);return Je(d,{code:Ue.invalid_type,expected:ot.object,received:d.parsedType}),zt}const{status:i,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof Da&&this._def.unknownKeys==="strip"))for(const d in r.data)o.includes(d)||c.push(d);const u=[];for(const d of o){const h=s[d],p=r.data[d];u.push({key:{status:"valid",value:d},value:h._parse(new as(r,p,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof Da){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of c)u.push({key:{status:"valid",value:h},value:{status:"valid",value:r.data[h]}});else if(d==="strict")c.length>0&&(Je(r,{code:Ue.unrecognized_keys,keys:c}),i.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of c){const p=r.data[h];u.push({key:{status:"valid",value:h},value:d._parse(new as(r,p,r.path,h)),alwaysSet:h in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of u){const p=await h.key,m=await h.value;d.push({key:p,value:m,alwaysSet:h.alwaysSet})}return d}).then(d=>Di.mergeObjectSync(i,d)):Di.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(e){return wt.errToObj,new Xn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{const r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:wt.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Xn({...this._def,unknownKeys:"strip"})}passthrough(){return new Xn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Xn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Xn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Vt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Xn({...this._def,catchall:e})}pick(e){const n={};for(const i of hn.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new Xn({...this._def,shape:()=>n})}omit(e){const n={};for(const i of hn.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new Xn({...this._def,shape:()=>n})}deepPartial(){return El(this)}partial(e){const n={};for(const i of hn.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}return new Xn({...this._def,shape:()=>n})}required(e){const n={};for(const i of hn.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof Fs;)s=s._def.innerType;n[i]=s}return new Xn({...this._def,shape:()=>n})}keyof(){return xM(hn.objectKeys(this.shape))}}Xn.create=(t,e)=>new Xn({shape:()=>t,unknownKeys:"strip",catchall:Da.create(),typeName:Vt.ZodObject,...$t(e)});Xn.strictCreate=(t,e)=>new Xn({shape:()=>t,unknownKeys:"strict",catchall:Da.create(),typeName:Vt.ZodObject,...$t(e)});Xn.lazycreate=(t,e)=>new Xn({shape:t,unknownKeys:"strip",catchall:Da.create(),typeName:Vt.ZodObject,...$t(e)});class Qf extends sn{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const o=s.map(c=>new Vs(c.ctx.common.issues));return Je(n,{code:Ue.invalid_union,unionErrors:o}),zt}if(n.common.async)return Promise.all(i.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(r);{let s;const o=[];for(const u of i){const d={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=o.map(u=>new Vs(u));return Je(n,{code:Ue.invalid_union,unionErrors:c}),zt}}get options(){return this._def.options}}Qf.create=(t,e)=>new Qf({options:t,typeName:Vt.ZodUnion,...$t(e)});const Ds=t=>t instanceof e0?Ds(t.schema):t instanceof Eo?Ds(t.innerType()):t instanceof nh?[t.value]:t instanceof wo?t.options:t instanceof t0?hn.objectValues(t.enum):t instanceof rh?Ds(t._def.innerType):t instanceof Kg?[void 0]:t instanceof Zg?[null]:t instanceof Fs?[void 0,...Ds(t.unwrap())]:t instanceof Mo?[null,...Ds(t.unwrap())]:t instanceof bM||t instanceof ah?Ds(t.unwrap()):t instanceof sh?Ds(t._def.innerType):[];class Kv extends sn{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ot.object)return Je(n,{code:Ue.invalid_type,expected:ot.object,received:n.parsedType}),zt;const i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(Je(n,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),zt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const r=new Map;for(const s of n){const o=Ds(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of o){if(r.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);r.set(c,s)}}return new Kv({typeName:Vt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...$t(i)})}}function Qg(t,e){const n=wa(t),i=wa(e);if(t===e)return{valid:!0,data:t};if(n===ot.object&&i===ot.object){const r=hn.objectKeys(e),s=hn.objectKeys(t).filter(c=>r.indexOf(c)!==-1),o={...t,...e};for(const c of s){const u=Qg(t[c],e[c]);if(!u.valid)return{valid:!1};o[c]=u.data}return{valid:!0,data:o}}else if(n===ot.array&&i===ot.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let s=0;s<t.length;s++){const o=t[s],c=e[s],u=Qg(o,c);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return n===ot.date&&i===ot.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class eh extends sn{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(s,o)=>{if(dS(s)||dS(o))return zt;const c=Qg(s.value,o.value);return c.valid?((fS(s)||fS(o))&&n.dirty(),{status:n.value,value:c.data}):(Je(i,{code:Ue.invalid_intersection_types}),zt)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}eh.create=(t,e,n)=>new eh({left:t,right:e,typeName:Vt.ZodIntersection,...$t(n)});class So extends sn{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ot.array)return Je(i,{code:Ue.invalid_type,expected:ot.array,received:i.parsedType}),zt;if(i.data.length<this._def.items.length)return Je(i,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),zt;!this._def.rest&&i.data.length>this._def.items.length&&(Je(i,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...i.data].map((o,c)=>{const u=this._def.items[c]||this._def.rest;return u?u._parse(new as(i,o,i.path,c)):null}).filter(o=>!!o);return i.common.async?Promise.all(s).then(o=>Di.mergeArray(n,o)):Di.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new So({...this._def,rest:e})}}So.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new So({items:t,typeName:Vt.ZodTuple,rest:null,...$t(e)})};class th extends sn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ot.object)return Je(i,{code:Ue.invalid_type,expected:ot.object,received:i.parsedType}),zt;const r=[],s=this._def.keyType,o=this._def.valueType;for(const c in i.data)r.push({key:s._parse(new as(i,c,i.path,c)),value:o._parse(new as(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?Di.mergeObjectAsync(n,r):Di.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof sn?new th({keyType:e,valueType:n,typeName:Vt.ZodRecord,...$t(i)}):new th({keyType:Jr.create(),valueType:e,typeName:Vt.ZodRecord,...$t(n)})}}class vS extends sn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ot.map)return Je(i,{code:Ue.invalid_type,expected:ot.map,received:i.parsedType}),zt;const r=this._def.keyType,s=this._def.valueType,o=[...i.data.entries()].map(([c,u],d)=>({key:r._parse(new as(i,c,i.path,[d,"key"])),value:s._parse(new as(i,u,i.path,[d,"value"]))}));if(i.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of o){const d=await u.key,h=await u.value;if(d.status==="aborted"||h.status==="aborted")return zt;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(d.value,h.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const u of o){const d=u.key,h=u.value;if(d.status==="aborted"||h.status==="aborted")return zt;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(d.value,h.value)}return{status:n.value,value:c}}}}vS.create=(t,e,n)=>new vS({valueType:e,keyType:t,typeName:Vt.ZodMap,...$t(n)});class pu extends sn{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ot.set)return Je(i,{code:Ue.invalid_type,expected:ot.set,received:i.parsedType}),zt;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(Je(i,{code:Ue.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(Je(i,{code:Ue.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const s=this._def.valueType;function o(u){const d=new Set;for(const h of u){if(h.status==="aborted")return zt;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}const c=[...i.data.values()].map((u,d)=>s._parse(new as(i,u,i.path,d)));return i.common.async?Promise.all(c).then(u=>o(u)):o(c)}min(e,n){return new pu({...this._def,minSize:{value:e,message:wt.toString(n)}})}max(e,n){return new pu({...this._def,maxSize:{value:e,message:wt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}pu.create=(t,e)=>new pu({valueType:t,minSize:null,maxSize:null,typeName:Vt.ZodSet,...$t(e)});class e0 extends sn{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}e0.create=(t,e)=>new e0({getter:t,typeName:Vt.ZodLazy,...$t(e)});class nh extends sn{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Je(n,{received:n.data,code:Ue.invalid_literal,expected:this._def.value}),zt}return{status:"valid",value:e.data}}get value(){return this._def.value}}nh.create=(t,e)=>new nh({value:t,typeName:Vt.ZodLiteral,...$t(e)});function xM(t,e){return new wo({values:t,typeName:Vt.ZodEnum,...$t(e)})}class wo extends sn{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return Je(n,{expected:hn.joinValues(i),received:n.parsedType,code:Ue.invalid_type}),zt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),i=this._def.values;return Je(n,{received:n.data,code:Ue.invalid_enum_value,options:i}),zt}return yr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return wo.create(e,{...this._def,...n})}exclude(e,n=this._def){return wo.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}wo.create=xM;class t0 extends sn{_parse(e){const n=hn.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ot.string&&i.parsedType!==ot.number){const r=hn.objectValues(n);return Je(i,{expected:hn.joinValues(r),received:i.parsedType,code:Ue.invalid_type}),zt}if(this._cache||(this._cache=new Set(hn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=hn.objectValues(n);return Je(i,{received:i.data,code:Ue.invalid_enum_value,options:r}),zt}return yr(e.data)}get enum(){return this._def.values}}t0.create=(t,e)=>new t0({values:t,typeName:Vt.ZodNativeEnum,...$t(e)});class ih extends sn{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ot.promise&&n.common.async===!1)return Je(n,{code:Ue.invalid_type,expected:ot.promise,received:n.parsedType}),zt;const i=n.parsedType===ot.promise?n.data:Promise.resolve(n.data);return yr(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ih.create=(t,e)=>new ih({type:t,typeName:Vt.ZodPromise,...$t(e)});class Eo extends sn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Vt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{Je(i,o),o.fatal?n.abort():n.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){const o=r.transform(i.data,s);if(i.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return zt;const u=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return u.status==="aborted"?zt:u.status==="dirty"||n.value==="dirty"?Jc(u.value):u});{if(n.value==="aborted")return zt;const c=this._def.schema._parseSync({data:o,path:i.path,parent:i});return c.status==="aborted"?zt:c.status==="dirty"||n.value==="dirty"?Jc(c.value):c}}if(r.type==="refinement"){const o=c=>{const u=r.refinement(c,s);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(i.common.async===!1){const c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?zt:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?zt:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(r.type==="transform")if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Fl(o))return zt;const c=r.transform(o.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>Fl(o)?Promise.resolve(r.transform(o.value,s)).then(c=>({status:n.value,value:c})):zt);hn.assertNever(r)}}Eo.create=(t,e,n)=>new Eo({schema:t,typeName:Vt.ZodEffects,effect:e,...$t(n)});Eo.createWithPreprocess=(t,e,n)=>new Eo({schema:e,effect:{type:"preprocess",transform:t},typeName:Vt.ZodEffects,...$t(n)});class Fs extends sn{_parse(e){return this._getType(e)===ot.undefined?yr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fs.create=(t,e)=>new Fs({innerType:t,typeName:Vt.ZodOptional,...$t(e)});class Mo extends sn{_parse(e){return this._getType(e)===ot.null?yr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mo.create=(t,e)=>new Mo({innerType:t,typeName:Vt.ZodNullable,...$t(e)});class rh extends sn{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===ot.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}rh.create=(t,e)=>new rh({innerType:t,typeName:Vt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...$t(e)});class sh extends sn{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Zf(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Vs(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Vs(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}sh.create=(t,e)=>new sh({innerType:t,typeName:Vt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...$t(e)});class yS extends sn{_parse(e){if(this._getType(e)!==ot.nan){const i=this._getOrReturnCtx(e);return Je(i,{code:Ue.invalid_type,expected:ot.nan,received:i.parsedType}),zt}return{status:"valid",value:e.data}}}yS.create=t=>new yS({typeName:Vt.ZodNaN,...$t(t)});class bM extends sn{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class Zv extends sn{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?zt:s.status==="dirty"?(n.dirty(),Jc(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?zt:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,n){return new Zv({in:e,out:n,typeName:Vt.ZodPipeline})}}class ah extends sn{_parse(e){const n=this._def.innerType._parse(e),i=r=>(Fl(r)&&(r.value=Object.freeze(r.value)),r);return Zf(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}ah.create=(t,e)=>new ah({innerType:t,typeName:Vt.ZodReadonly,...$t(e)});var Vt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Vt||(Vt={}));const C=Jr.create,Te=xo.create;bo.create;const Ut=Jf.create,Jv=Ol.create,Ei=Jg.create;Da.create;const Fe=ts.create,j=Xn.create,_r=Qf.create,SM=Kv.create;eh.create;So.create;const Nn=th.create,Yt=nh.create,cn=wo.create;ih.create;Fs.create;Mo.create;const n0={string:(t=>Jr.create({...t,coerce:!0})),number:(t=>xo.create({...t,coerce:!0})),boolean:(t=>Jf.create({...t,coerce:!0})),bigint:(t=>bo.create({...t,coerce:!0})),date:(t=>Ol.create({...t,coerce:!0}))};var qr;(function(t){t.STRING="string",t.DATE="date",t.DATETIME="datetime",t.INTEGER="integer",t.FLOAT="float",t.BOOLEAN="boolean",t.UUID="uuid",t.JSON="json"})(qr||(qr={}));const ED=cn(["CASCADE","RESTRICT","NO ACTION"]),MD=cn(["CASCADE","SET NULL","SET DEFAULT","RESTRICT","NO ACTION"]),TD=cn([qr.STRING,qr.DATE,qr.DATETIME,qr.INTEGER,qr.FLOAT,qr.BOOLEAN,qr.UUID,qr.JSON]),wM=j({referenceTable:C().min(1,"Target table cannot be empty"),referenceColumn:C().min(1,"Target column cannot be empty"),onDelete:MD,onUpdate:ED}),EM=j({columnName:C().min(1,"Column name cannot be empty").max(64,"Column name must be less than 64 characters"),type:_r([TD,C()]),defaultValue:C().optional(),isPrimaryKey:Ut().optional(),isNullable:Ut(),isUnique:Ut(),foreignKey:wM.optional()}),MM=j({tableName:C().min(1,"Table name cannot be empty").max(64,"Table name must be less than 64 characters"),columns:Fe(EM).min(1,"At least one column is required"),recordCount:Te().optional(),createdAt:C().optional(),updatedAt:C().optional()}),AD=j({functionName:C(),functionDef:C(),kind:C()}),CD=j({tableName:C(),indexName:C(),indexDef:C(),isUnique:Ut().nullable(),isPrimary:Ut().nullable()}),PD=j({tableName:C(),policyName:C(),cmd:C(),roles:Fe(C()),qual:C().nullable(),withCheck:C().nullable()}),RD=j({tableName:C(),triggerName:C(),actionTiming:C(),eventManipulation:C(),actionOrientation:C(),actionCondition:C().nullable(),actionStatement:C()});MM.pick({tableName:!0,columns:!0}).extend({rlsEnabled:Ut().default(!0)});MM.pick({tableName:!0,columns:!0}).extend({message:C(),autoFields:Fe(C()),nextActions:C()});j({addColumns:Fe(EM.omit({foreignKey:!0})).optional(),dropColumns:Fe(C()).optional(),updateColumns:Fe(j({columnName:C(),defaultValue:C().optional(),newColumnName:C().min(1,"New column name cannot be empty").max(64,"New column name must be less than 64 characters").optional()})).optional(),addForeignKeys:Fe(j({columnName:C().min(1,"Column name is required for adding foreign key"),foreignKey:wM})).optional(),dropForeignKeys:Fe(C()).optional(),renameTable:j({newTableName:C().min(1,"New table name cannot be empty").max(64,"New table name must be less than 64 characters")}).optional()});j({message:C(),tableName:C(),operations:Fe(C())});j({message:C(),tableName:C(),nextActions:C()});j({query:C().min(1,"Query is required"),params:Fe(Ei()).optional()});j({rows:Fe(Nn(C(),Ei())),rowCount:Te().nullable(),fields:Fe(j({name:C(),dataTypeID:Te()})).optional()});j({tables:Fe(C()).optional(),format:cn(["sql","json"]).default("sql"),includeData:Ut().default(!0),includeFunctions:Ut().default(!1),includeSequences:Ut().default(!1),includeViews:Ut().default(!1),rowLimit:Te().int().positive().max(1e4).default(1e3)});const kD=j({timestamp:C(),tables:Nn(C(),j({schema:Fe(j({columnName:C(),dataType:C(),characterMaximumLength:Te().nullable(),isNullable:C(),columnDefault:C().nullable()})),indexes:Fe(j({indexname:C(),indexdef:C(),isUnique:Ut().nullable(),isPrimary:Ut().nullable()})),foreignKeys:Fe(j({constraintName:C(),columnName:C(),foreignTableName:C(),foreignColumnName:C(),deleteRule:C().nullable(),updateRule:C().nullable()})),rlsEnabled:Ut().optional(),policies:Fe(j({policyname:C(),cmd:C(),roles:Fe(C()),qual:C().nullable(),withCheck:C().nullable()})),triggers:Fe(j({triggerName:C(),actionTiming:C(),eventManipulation:C(),actionOrientation:C(),actionCondition:C().nullable(),actionStatement:C(),newTable:C().nullable(),oldTable:C().nullable()})),rows:Fe(Nn(C(),Ei())).optional(),recordCount:Te().optional()})),functions:Fe(j({functionName:C(),functionDef:C(),kind:C()})),sequences:Fe(j({sequenceName:C(),startValue:C(),increment:C(),minValue:C().nullable(),maxValue:C().nullable(),cycle:C()})),views:Fe(j({viewName:C(),definition:C()}))});j({format:cn(["sql","json"]),data:_r([C(),kD]),timestamp:C()});j({truncate:_r([Ut(),C().transform(t=>{if(t==="true")return!0;if(t==="false")return!1;throw new Error("Invalid boolean string")})]).default(!1)});j({success:Ut(),message:C(),filename:C(),tables:Fe(C()),rowsImported:Te(),fileSize:Te()});j({table:C().min(1,"Table name is required"),upsertKey:C().optional()});j({success:Ut(),message:C(),table:C(),rowsAffected:Te(),totalRecords:Te(),filename:C()});j({functions:Fe(AD)});j({indexes:Fe(CD)});j({policies:Fe(PD)});j({triggers:Fe(RD)});const LD=j({id:C(),key:C(),isActive:Ut(),isReserved:Ut(),lastUsedAt:C().nullable(),expiresAt:C().nullable(),createdAt:C(),updatedAt:C()});j({secrets:Fe(LD)});j({key:C(),value:C()});j({key:C().regex(/^[A-Z0-9_]+$/,"Use uppercase letters, numbers, and underscores only"),value:C().min(1,"Value is required")});j({success:Yt(!0),message:C(),id:C()});j({success:Yt(!0),message:C()});j({success:Yt(!0),message:C()});const DD=j({key:C(),bucket:C(),size:Te(),mimeType:C().optional(),uploadedAt:C(),url:C()}),ND=j({name:C(),public:Ut(),createdAt:C()});j({id:C().uuid(),maxFileSizeMb:Te().int().positive(),createdAt:C(),updatedAt:C()});j({bucketName:C().min(1,"Bucket name cannot be empty"),isPublic:Ut().default(!0)});j({isPublic:Ut()});j({objects:Fe(DD),pagination:j({offset:Te(),limit:Te(),total:Te()})});j({filename:C().min(1,"Filename cannot be empty"),contentType:C().optional(),size:Te().optional()});j({method:cn(["presigned","direct"]),uploadUrl:C(),fields:Nn(C()).optional(),key:C(),confirmRequired:Ut(),confirmUrl:C().optional(),expiresAt:Jv().optional()});j({expiresIn:Te().optional().default(3600)});j({method:cn(["presigned","direct"]),url:C(),expiresAt:Jv().optional(),headers:Nn(C()).optional()});j({size:Te(),contentType:C().optional(),etag:C().optional()});j({maxFileSizeMb:Te().int().min(1,"Must be at least 1 MB").max(200,"Must be at most 200 MB")});const Rh=C().uuid("Invalid user ID format"),os=C().email("Invalid email format").toLowerCase().trim(),Qv=C(),ID=C().min(1,"Name is required").max(100,"Name must be less than 100 characters").trim(),UD=cn(["anon","authenticated","project_admin"]),_S=cn(["code","link"]),TM=j({name:C().optional(),avatar_url:C().url().optional()}).passthrough(),ql=j({id:Rh,email:os,emailVerified:Ut(),providers:Fe(C()).optional(),createdAt:C(),updatedAt:C(),profile:TM.nullable(),metadata:Nn(Ei()).nullable()}),kh=cn(["google","github","discord","linkedin","facebook","instagram","tiktok","apple","x","spotify","microsoft"]);j({provider:kh,redirectUri:C().url().optional()});const ey=j({id:C().uuid(),provider:kh,clientId:C().optional(),scopes:Fe(C()).optional(),redirectUri:C().optional(),useSharedKey:Ut(),createdAt:C(),updatedAt:C()}),FD=/^(?:(?:https?:\/\/)(?:(?:\*\.)?[^\s/:?#]+|\[[0-9A-Fa-f:.]+\])(?::\d+)?(?:\/[^\s]*)?|(?!(?:https?|javascript|data|file|vbscript):)[a-zA-Z][a-zA-Z0-9+.-]*:(?:\/\/[^\s/]+(?:\/[^\s]*)?|\/[^\s]*))$/i,AM=j({id:C().uuid(),requireEmailVerification:Ut(),passwordMinLength:Te().min(4).max(128),requireNumber:Ut(),requireLowercase:Ut(),requireUppercase:Ut(),requireSpecialChar:Ut(),verifyEmailMethod:_S,resetPasswordMethod:_S,allowedRedirectUrls:Fe(C().regex(FD,{message:"Invalid URL or wildcard URL"})).optional().nullable(),createdAt:C(),updatedAt:C()});j({sub:Rh,email:os,role:UD,iat:Te().optional(),exp:Te().optional()});const CM=C().min(1).max(64).regex(/^[a-z0-9_-]+$/,"Key must contain only lowercase letters, numbers, hyphens, and underscores"),ty=j({id:C().uuid(),key:CM,name:C().min(1),discoveryEndpoint:C().url(),clientId:C().min(1),createdAt:C(),updatedAt:C()}),OD=j({limit:C().optional(),offset:C().optional()});j({email:os,password:Qv,name:ID.optional(),redirectTo:C().url().optional()});j({email:os,password:Qv});j({refreshToken:C().min(1,"refreshToken is required")});j({code:C()});OD.extend({search:C().optional()}).optional();j({userIds:Fe(Rh).min(1,"At least one user ID is required")});j({profile:Nn(Ei())});j({email:os,redirectTo:C().url().optional()});j({email:os,otp:C().regex(/^\d{6}$/,"OTP code must be a 6-digit numeric code")});j({email:os,redirectTo:C().url().optional()});j({email:os,code:C().regex(/^\d{6}$/,"Reset password code must be a 6-digit numeric code")});j({newPassword:Qv,otp:C().min(1,"OTP/token is required")});j({user:ql.optional(),accessToken:C().nullable(),requireEmailVerification:Ut().optional(),csrfToken:C().nullable().optional(),refreshToken:C().optional()});j({user:ql,accessToken:C(),csrfToken:C().nullable().optional(),refreshToken:C().optional()});j({user:ql,accessToken:C(),csrfToken:C().nullable().optional(),refreshToken:C().optional()});j({accessToken:C(),user:ql,csrfToken:C().optional(),refreshToken:C().optional()});j({token:C(),expiresAt:C().datetime()});j({message:C()});j({user:ql});j({id:Rh,profile:TM.nullable()});j({data:Fe(ql),pagination:j({offset:Te(),limit:Te(),total:Te()})});j({message:C(),deletedCount:Te().int().nonnegative()});j({authUrl:C().url()});ey.omit({id:!0,createdAt:!0,updatedAt:!0}).extend({clientSecret:C().optional()});ey.omit({id:!0,provider:!0,createdAt:!0,updatedAt:!0}).extend({clientSecret:C().optional()}).partial();const PM=/^[A-Za-z0-9._~-]+$/;j({redirect_uri:C().url().optional(),code_challenge:C().min(43,"Code challenge must be at least 43 characters").max(128,"Code challenge must be at most 128 characters").regex(PM,"Code challenge must be base64url encoded")});j({code:C().min(1,"Exchange code is required"),code_verifier:C().min(43,"Code verifier must be at least 43 characters").max(128,"Code verifier must be at most 128 characters").regex(PM,"Code verifier must be base64url encoded")});j({data:Fe(ey),count:Te()});AM.omit({id:!0,createdAt:!0,updatedAt:!0}).partial();const BD=j({oAuthProviders:Fe(kh),customOAuthProviders:Fe(CM),...AM.omit({id:!0,updatedAt:!0,createdAt:!0,allowedRedirectUrls:!0}).shape});j({error:C(),message:C(),statusCode:Te().int(),nextActions:C().optional()});ty.omit({id:!0,createdAt:!0,updatedAt:!0}).extend({clientSecret:C().min(1,"Client secret is required")});ty.omit({id:!0,key:!0,createdAt:!0,updatedAt:!0}).extend({clientSecret:C().min(1).optional()}).partial();j({data:Fe(ty),count:Te()});const RM=cn(["system","user"]),kM=j({id:C().uuid(),pattern:C().min(1),description:C().nullable(),webhookUrls:Fe(C().url()).nullable(),enabled:Ut(),createdAt:C().datetime(),updatedAt:C().datetime()}),zD=j({id:C().uuid(),eventName:C().min(1),channelId:C().uuid().nullable(),channelName:C().min(1),payload:Nn(C(),Ei()),senderType:RM,senderId:C().uuid().nullable(),wsAudienceCount:Te().int().min(0),whAudienceCount:Te().int().min(0),whDeliveredCount:Te().int().min(0),createdAt:C().datetime()}),VD=j({retentionDays:Te().int().positive().nullable()});j({channel:C().min(1)});j({channel:C().min(1)});j({channel:C().min(1),event:C().min(1),payload:Nn(C(),Ei())});SM("ok",[j({ok:Yt(!0),channel:C().min(1)}),j({ok:Yt(!1),channel:C().min(1),error:j({code:C().min(1),message:C().min(1)})})]);j({channel:C().optional(),code:C().min(1),message:C().min(1)});j({messageId:C().uuid(),channel:C().min(1),eventName:C().min(1),payload:Nn(C(),Ei())});const HD=j({channel:C().optional(),messageId:C().uuid(),senderType:RM,senderId:C().uuid().optional(),timestamp:C().datetime()});j({meta:HD}).passthrough();j({pattern:C().min(1,"Channel pattern is required"),description:C().optional(),webhookUrls:Fe(C().url()).optional(),enabled:Ut().optional().default(!0)});j({pattern:C().min(1).optional(),description:C().optional(),webhookUrls:Fe(C().url()).optional(),enabled:Ut().optional()});Fe(kM);j({message:C()});j({channelId:C().uuid().optional(),eventName:C().optional(),limit:n0.number().int().min(1).max(1e3).optional().default(100),offset:n0.number().int().min(0).optional().default(0)});Fe(zD);j({channelId:C().uuid().optional(),since:n0.date().optional()});j({totalMessages:Te().int().min(0),whDeliveryRate:Te().min(0).max(1),topEvents:Fe(j({eventName:C(),count:Te().int().min(0)})),retentionDays:VD.shape.retentionDays});const xS=j({policyName:C(),tableName:C(),command:C(),roles:Fe(C()),using:C().nullable(),withCheck:C().nullable()}),GD=j({subscribe:j({policies:Fe(xS)}),publish:j({policies:Fe(xS)})}),jD=BD,WD=j({tables:Fe(j({tableName:C(),recordCount:Te()})),totalSizeInGB:Te(),hint:C().optional()}),$D=ND.extend({objectCount:Te().optional()}),XD=j({buckets:Fe($D),totalSizeInGB:Te()}),qD=j({slug:C(),name:C(),description:C().nullable(),status:C()}),YD=j({models:Fe(j({inputModality:Fe(C()),outputModality:Fe(C()),modelId:C()}))}),KD=j({channels:Fe(kM),permissions:GD});j({auth:jD,database:WD,storage:XD,aiIntegration:YD.optional(),functions:Fe(qD),realtime:KD.optional(),version:C().optional()});const ZD=j({host:C(),port:Te(),database:C(),user:C(),password:C(),sslmode:C()});j({connectionURL:C(),parameters:ZD});j({databasePassword:C()});j({apiKey:C()});j({projectId:C().nullable()});const Bl=cn(["text","image","audio"]),JD=j({inputModality:Fe(Bl).min(1),outputModality:Fe(Bl).min(1),provider:C(),modelId:C(),systemPrompt:C().optional()}),LM=JD.extend({id:C().uuid()});LM.extend({usageStats:j({totalInputTokens:Te(),totalOutputTokens:Te(),totalTokens:Te(),totalImageCount:Te(),totalRequests:Te()}).optional()});const QD=j({configId:C().uuid(),inputTokens:Te().int().optional(),outputTokens:Te().int().optional(),imageCount:Te().int().optional(),imageResolution:C().optional()}),e3=QD.extend({id:C().uuid(),createdAt:Jv(),modelId:C().nullable().optional(),model:C().nullable(),provider:C().nullable(),inputModality:Fe(Bl).nullable(),outputModality:Fe(Bl).nullable()});j({totalInputTokens:Te(),totalOutputTokens:Te(),totalTokens:Te(),totalImageCount:Te(),totalRequests:Te()});const t3=j({type:Yt("text"),text:C()}),n3=j({type:Yt("image_url"),image_url:j({url:C(),detail:cn(["auto","low","high"]).optional()})}),i3=j({type:Yt("input_audio"),input_audio:j({data:C(),format:cn(["wav","mp3","aiff","aac","ogg","flac","m4a"])})}),r3=j({type:Yt("file"),file:j({filename:C(),file_data:C()})}),s3=_r([t3,n3,i3,r3]),a3=j({name:C(),description:C().optional(),parameters:Nn(Ei()).optional()}),o3=j({type:Yt("function"),function:a3}),l3=_r([cn(["auto","none","required"]),j({type:Yt("function"),function:j({name:C()})})]),DM=j({id:C(),type:Yt("function"),function:j({name:C(),arguments:C()})}),c3=j({role:cn(["user","assistant","system","tool"]),content:_r([C(),Fe(s3)]).nullable(),images:Fe(j({url:C()})).optional(),tool_calls:Fe(DM).optional(),tool_call_id:C().optional()}),u3=j({enabled:Ut(),engine:cn(["native","exa"]).optional(),maxResults:Te().min(1).max(10).optional(),searchPrompt:C().optional()}),d3=j({enabled:Ut(),pdf:j({engine:cn(["pdf-text","mistral-ocr","native"]).optional()}).optional()});j({model:C(),messages:Fe(c3),temperature:Te().min(0).max(2).optional(),maxTokens:Te().positive().optional(),topP:Te().min(0).max(1).optional(),stream:Ut().optional(),webSearch:u3.optional(),fileParser:d3.optional(),thinking:Ut().optional(),tools:Fe(o3).optional(),toolChoice:l3.optional(),parallelToolCalls:Ut().optional()});const f3=j({type:Yt("url_citation"),urlCitation:j({url:C(),title:C().optional(),content:C().optional(),startIndex:Te().optional(),endIndex:Te().optional()})}),h3=j({type:Yt("file"),file:j({filename:C(),parsedContent:C().optional(),metadata:Nn(Ei()).optional()})}),p3=_r([f3,h3]);j({text:C(),tool_calls:Fe(DM).optional(),annotations:Fe(p3).optional(),metadata:j({model:C(),usage:j({promptTokens:Te().optional(),completionTokens:Te().optional(),totalTokens:Te().optional()}).optional()}).optional()});j({model:C(),input:_r([C(),Fe(C())]),encoding_format:cn(["float","base64"]).optional(),dimensions:Te().int().min(0).optional()});const m3=j({object:Yt("embedding"),embedding:_r([Fe(Te()),C()]),index:Te()});j({object:Yt("list"),data:Fe(m3),metadata:j({model:C(),usage:j({promptTokens:Te().optional(),totalTokens:Te().optional()}).optional()}).optional()});j({model:C(),prompt:C(),images:Fe(j({url:C()})).optional()});j({text:C().optional(),images:Fe(j({type:Yt("imageUrl"),imageUrl:C()})),metadata:j({model:C(),usage:j({promptTokens:Te().optional(),completionTokens:Te().optional(),totalTokens:Te().optional()}).optional()}).optional()});j({id:C(),inputModality:Fe(Bl).min(1),outputModality:Fe(Bl).min(1),provider:C(),modelId:C(),inputPrice:Te().min(0).optional(),outputPrice:Te().min(0).optional()});LM.omit({id:!0});j({systemPrompt:C().nullable()});j({records:Fe(e3),total:Te()});j({startDate:C().datetime().optional(),endDate:C().datetime().optional(),limit:C().regex(/^\d+$/).default("50"),offset:C().regex(/^\d+$/).default("0")});j({configId:C().uuid().optional(),startDate:C().datetime().optional(),endDate:C().datetime().optional()});const g3=cn(["byok","cloud","env","unconfigured"]);j({keySource:g3,hasByokKey:Ut(),maskedKey:C().optional()});j({apiKey:C().min(1,"API key is required")});const NM=j({id:C(),actor:C(),action:C(),module:C(),details:Nn(Ei()).nullable(),ipAddress:C().nullable(),createdAt:C(),updatedAt:C()});j({id:C(),name:C(),token:C()});const v3=j({id:C(),eventMessage:C(),timestamp:C(),body:Nn(C(),Ei()),source:C().optional()});j({source:C(),count:Te(),lastActivity:C()});const y3=j({level:C(),message:C()});j({deploymentId:C(),status:cn(["pending","success","failed"]),logs:Fe(y3),createdAt:C()});j({limit:Te().default(100),offset:Te().default(0),actor:C().optional(),action:C().optional(),module:C().optional(),startDate:C().optional(),endDate:C().optional()});j({data:Fe(NM),pagination:j({limit:Te(),offset:Te(),total:Te()})});j({days:Te().default(7)});j({totalLogs:Te(),uniqueActors:Te(),uniqueModules:Te(),actionsByModule:Nn(Te()),recentActivity:Fe(NM)});j({daysToKeep:Te().default(90)});j({message:C(),deleted:Te()});j({logs:Fe(v3),total:Te()});const IM=j({id:C(),slug:C(),name:C(),description:C().nullable(),code:C(),status:cn(["draft","active","error"]),createdAt:C(),updatedAt:C(),deployedAt:C().nullable()});j({name:C().min(1,"Name is required"),slug:C().regex(/^[a-zA-Z0-9_-]+$/,"Invalid slug format - must be alphanumeric with hyphens or underscores only").optional(),code:C().min(1),description:C().optional(),status:cn(["draft","active"]).optional().default("active")});j({name:C().optional(),code:C().optional(),description:C().optional(),status:cn(["draft","active"]).optional()});j({functions:Fe(IM),runtime:j({status:cn(["running","unavailable"])}),deploymentUrl:C().nullable().optional()});const _3=j({id:C(),status:cn(["success","failed"]),url:C().nullable(),buildLogs:Fe(C()).optional()});j({success:Ut(),function:IM,deployment:_3.nullable().optional()});const x3=j({type:Yt("APP_ROUTE_CHANGE"),path:C()}),b3=j({type:Yt("AUTH_SUCCESS")}),S3=j({type:Yt("AUTH_ERROR"),message:C()}),w3=j({type:Yt("MCP_CONNECTION_STATUS"),connected:Ut(),toolName:C(),timestamp:_r([Te(),C()])}),E3=j({type:Yt("SHOW_ONBOARDING_OVERLAY")}),M3=j({type:Yt("SHOW_SETTINGS_OVERLAY")}),T3=j({type:Yt("ONBOARDING_SUCCESS")}),A3=j({type:Yt("NAVIGATE_TO_USAGE")}),C3=j({type:Yt("SHOW_CONTACT_MODAL")}),P3=j({type:Yt("SHOW_CONNECT_OVERLAY")}),R3=j({type:Yt("SHOW_PLAN_MODAL")}),k3=j({type:Yt("AUTHORIZATION_CODE"),code:C()}),L3=j({type:Yt("ROUTE_CHANGE"),path:C()}),D3=j({type:Yt("REQUEST_PROJECT_INFO")}),N3=j({type:Yt("PROJECT_INFO"),name:C(),instanceType:C(),region:C(),latestVersion:C().optional()}),I3=j({type:Yt("REQUEST_INSTANCE_INFO")}),U3=j({type:Yt("INSTANCE_INFO"),currentInstanceType:C(),planName:C(),computeCredits:Te(),currentOrgComputeCost:Te(),instanceTypes:Fe(j({id:C(),name:C(),cpu:C(),ram:C(),pricePerHour:Te(),pricePerMonth:Te()})),projects:Fe(j({name:C(),instanceType:C(),monthlyCost:Te(),isCurrent:Ut(),status:C()}))}),F3=j({type:Yt("REQUEST_INSTANCE_TYPE_CHANGE"),instanceType:C()}),O3=j({type:Yt("INSTANCE_TYPE_CHANGE_RESULT"),success:Ut(),instanceType:C().optional(),error:C().optional()});SM("type",[x3,b3,S3,w3,E3,M3,T3,A3,C3,P3,R3,k3,L3,D3,N3,I3,U3,F3,O3]);cn(["db","storage","functions","auth","ai","realtime"]).describe(`
|
|
13
13
|
SDK feature categories:
|
|
@@ -39,7 +39,7 @@ Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}
|
|
|
39
39
|
`))}logResponse(t,e,n,i,r){if(!this.enabled)return;const s=[`← ${t} ${e} ${n} (${i}ms)`],o=DS(ru(r));if(o){const c=o.length>1e3?o.slice(0,1e3)+"... [truncated]":o;s.push(` Body: ${c}`)}n>=400?this.error(s.join(`
|
|
40
40
|
`)):this.log(s.join(`
|
|
41
41
|
`))}},ly="insforge_csrf_token";function nT(){if(typeof document>"u")return null;const t=document.cookie.split(";").find(e=>e.trim().startsWith(`${ly}=`));return t&&t.split("=")[1]||null}function iT(t){if(typeof document>"u")return;const e=10080*60,n=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${ly}=${encodeURIComponent(t)}; path=/; max-age=${e}; SameSite=Lax${n}`}function rT(){if(typeof document>"u")return;const t=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${ly}=; path=/; max-age=0; SameSite=Lax${t}`}var sT=class{constructor(){this.accessToken=null,this.user=null,this.onTokenChange=null}saveSession(t){const e=t.accessToken!==this.accessToken;this.accessToken=t.accessToken,this.user=t.user,e&&this.onTokenChange&&this.onTokenChange()}getSession(){return!this.accessToken||!this.user?null:{accessToken:this.accessToken,user:this.user}}getAccessToken(){return this.accessToken}setAccessToken(t){const e=t!==this.accessToken;this.accessToken=t,e&&this.onTokenChange&&this.onTokenChange()}getUser(){return this.user}setUser(t){this.user=t}clearSession(){const t=this.accessToken!==null;this.accessToken=null,this.user=null,t&&this.onTokenChange&&this.onTokenChange()}},aI=new Set([500,502,503,504]),oI=new Set(["GET","HEAD","PUT","DELETE","OPTIONS"]),lI=class{constructor(t,e,n){if(this.userToken=null,this.autoRefreshToken=!0,this.isRefreshing=!1,this.refreshPromise=null,this.refreshToken=null,this.baseUrl=t.baseUrl||"http://localhost:7130",this.autoRefreshToken=t.autoRefreshToken??!0,this.fetch=t.fetch||(globalThis.fetch?globalThis.fetch.bind(globalThis):void 0),this.anonKey=t.anonKey,this.defaultHeaders={...t.headers},this.tokenManager=e??new sT,this.logger=n||new tT(!1),this.timeout=t.timeout??3e4,this.retryCount=t.retryCount??3,this.retryDelay=t.retryDelay??500,!this.fetch)throw new Error("Fetch is not available. Please provide a fetch implementation in the config.")}buildUrl(t,e){const n=new URL(t,this.baseUrl);return e&&Object.entries(e).forEach(([i,r])=>{if(i==="select"){let s=r.replace(/\s+/g," ").trim();s=s.replace(/\s*\(\s*/g,"(").replace(/\s*\)\s*/g,")").replace(/\(\s+/g,"(").replace(/\s+\)/g,")").replace(/,\s+(?=[^()]*\))/g,","),n.searchParams.append(i,s)}else n.searchParams.append(i,r)}),n.toString()}isRetryableStatus(t){return aI.has(t)}computeRetryDelay(t){const n=this.retryDelay*Math.pow(2,t-1)*(.85+Math.random()*.3);return Math.round(n)}async handleRequest(t,e,n={}){const{params:i,headers:r={},body:s,signal:o,...c}=n,u=this.buildUrl(e,i),d=Date.now(),p=oI.has(t.toUpperCase())||n.idempotent===!0?this.retryCount:0,m={...this.defaultHeaders},v=this.userToken||this.anonKey;v&&(m.Authorization=`Bearer ${v}`);let _;s!==void 0&&(typeof FormData<"u"&&s instanceof FormData?_=s:(t!=="GET"&&(m["Content-Type"]="application/json;charset=UTF-8"),_=JSON.stringify(s))),r instanceof Headers?r.forEach((y,b)=>{m[b]=y}):Array.isArray(r)?r.forEach(([y,b])=>{m[y]=b}):Object.assign(m,r),this.logger.logRequest(t,u,m,_);let w;for(let y=0;y<=p;y++){if(y>0){const A=this.computeRetryDelay(y);if(this.logger.warn(`Retry ${y}/${p} for ${t} ${u} in ${A}ms`),o?.aborted)throw o.reason;await new Promise((M,I)=>{const k=()=>{clearTimeout(U),I(o.reason)},U=setTimeout(()=>{o&&o.removeEventListener("abort",k),M()},A);o&&o.addEventListener("abort",k,{once:!0})})}let b,T;if((this.timeout>0||o)&&(b=new AbortController,this.timeout>0&&(T=setTimeout(()=>b.abort(),this.timeout)),o))if(o.aborted)b.abort(o.reason);else{const A=()=>b.abort(o.reason);o.addEventListener("abort",A,{once:!0}),b.signal.addEventListener("abort",()=>{o.removeEventListener("abort",A)},{once:!0})}try{const A=await this.fetch(u,{method:t,headers:m,body:_,...c,...b?{signal:b.signal}:{}});if(this.isRetryableStatus(A.status)&&y<p){T!==void 0&&clearTimeout(T),await A.body?.cancel(),w=new jt(`Server error: ${A.status} ${A.statusText}`,A.status,"SERVER_ERROR");continue}if(A.status===204){T!==void 0&&clearTimeout(T);return}let M;const I=A.headers.get("content-type");try{I?.includes("json")?M=await A.json():M=await A.text()}catch(k){throw T!==void 0&&clearTimeout(T),new jt(`Failed to parse response body: ${k?.message||"Unknown error"}`,A.status,A.ok?"PARSE_ERROR":"REQUEST_FAILED")}if(T!==void 0&&clearTimeout(T),!A.ok){if(this.logger.logResponse(t,u,A.status,Date.now()-d,M),M&&typeof M=="object"&&"error"in M){!M.statusCode&&!M.status&&(M.statusCode=A.status);const k=jt.fromApiError(M);throw Object.keys(M).forEach(U=>{U!=="error"&&U!=="message"&&U!=="statusCode"&&(k[U]=M[U])}),k}throw new jt(`Request failed: ${A.statusText}`,A.status,"REQUEST_FAILED")}return this.logger.logResponse(t,u,A.status,Date.now()-d,M),M}catch(A){if(T!==void 0&&clearTimeout(T),A?.name==="AbortError")throw b&&b.signal.aborted&&this.timeout>0&&!o?.aborted?new jt(`Request timed out after ${this.timeout}ms`,408,"REQUEST_TIMEOUT"):A;if(A instanceof jt)throw A;if(y<p){w=A;continue}throw new jt(`Network request failed: ${A?.message||"Unknown error"}`,0,"NETWORK_ERROR")}}throw w||new jt("Request failed after all retry attempts",0,"NETWORK_ERROR")}async request(t,e,n={}){try{return await this.handleRequest(t,e,{...n})}catch(i){if(i instanceof jt&&i.statusCode===401&&i.error==="INVALID_TOKEN"&&this.autoRefreshToken)try{const r=await this.handleTokenRefresh();return this.setAuthToken(r.accessToken),this.tokenManager.saveSession(r),r.csrfToken&&iT(r.csrfToken),r.refreshToken&&this.setRefreshToken(r.refreshToken),await this.handleRequest(t,e,{...n})}catch(r){throw this.tokenManager.clearSession(),this.userToken=null,this.refreshToken=null,rT(),r}throw i}}get(t,e){return this.request("GET",t,e)}post(t,e,n){return this.request("POST",t,{...n,body:e})}put(t,e,n){return this.request("PUT",t,{...n,body:e})}patch(t,e,n){return this.request("PATCH",t,{...n,body:e})}delete(t,e){return this.request("DELETE",t,e)}setAuthToken(t){this.userToken=t}setRefreshToken(t){this.refreshToken=t}getHeaders(){const t={...this.defaultHeaders},e=this.userToken||this.anonKey;return e&&(t.Authorization=`Bearer ${e}`),t}async handleTokenRefresh(){return this.isRefreshing?this.refreshPromise:(this.isRefreshing=!0,this.refreshPromise=(async()=>{try{const t=nT(),e=this.refreshToken?{refreshToken:this.refreshToken}:void 0;return await this.handleRequest("POST","/api/auth/sessions/current",{body:e,headers:t?{"X-CSRF-Token":t}:{},credentials:"include"})}finally{this.isRefreshing=!1,this.refreshPromise=null}})(),this.refreshPromise)}},c0="insforge_pkce_verifier";function aT(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function cI(){const t=new Uint8Array(32);return crypto.getRandomValues(t),aT(t)}async function uI(t){const n=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",n);return aT(new Uint8Array(i))}function dI(t){typeof sessionStorage<"u"&&sessionStorage.setItem(c0,t)}function fI(){if(typeof sessionStorage>"u")return null;const t=sessionStorage.getItem(c0);return t&&sessionStorage.removeItem(c0),t}function Yi(t,e){return t instanceof jt?{data:null,error:t}:{data:null,error:new jt(t instanceof Error?t.message:e,500,"UNEXPECTED_ERROR")}}function NS(...t){if(typeof window>"u")return;const e=new URL(window.location.href);t.forEach(n=>e.searchParams.delete(n)),window.history.replaceState({},document.title,e.toString())}var hI=class{constructor(t,e,n={}){this.http=t,this.tokenManager=e,this.options=n,this.authCallbackHandled=this.detectAuthCallback()}isServerMode(){return!!this.options.isServerMode}saveSessionFromResponse(t){if(!t.accessToken||!t.user)return!1;const e={accessToken:t.accessToken,user:t.user};return!this.isServerMode()&&t.csrfToken&&iT(t.csrfToken),this.isServerMode()||this.tokenManager.saveSession(e),this.http.setAuthToken(t.accessToken),this.http.setRefreshToken(t.refreshToken??null),!0}async detectAuthCallback(){if(!(this.isServerMode()||typeof window>"u"))try{const t=new URLSearchParams(window.location.search),e=t.get("error");if(e){NS("error"),console.debug("OAuth callback error:",e);return}const n=t.get("insforge_code");if(n){NS("insforge_code");const{error:i}=await this.exchangeOAuthCode(n);i&&console.debug("OAuth code exchange failed:",i.message);return}}catch(t){console.debug("OAuth callback detection skipped:",t)}}async signUp(t){try{const e=await this.http.post(this.isServerMode()?"/api/auth/users?client_type=mobile":"/api/auth/users",t,{credentials:"include"});return e.accessToken&&e.user&&this.saveSessionFromResponse(e),e.refreshToken&&this.http.setRefreshToken(e.refreshToken),{data:e,error:null}}catch(e){return Yi(e,"An unexpected error occurred during sign up")}}async signInWithPassword(t){try{const e=await this.http.post(this.isServerMode()?"/api/auth/sessions?client_type=mobile":"/api/auth/sessions",t,{credentials:"include"});return this.saveSessionFromResponse(e),e.refreshToken&&this.http.setRefreshToken(e.refreshToken),{data:e,error:null}}catch(e){return Yi(e,"An unexpected error occurred during sign in")}}async signOut(){try{try{await this.http.post(this.isServerMode()?"/api/auth/logout?client_type=mobile":"/api/auth/logout",void 0,{credentials:"include"})}catch{}return this.tokenManager.clearSession(),this.http.setAuthToken(null),this.http.setRefreshToken(null),this.isServerMode()||rT(),{error:null}}catch{return{error:new jt("Failed to sign out",500,"SIGNOUT_ERROR")}}}async signInWithOAuth(t){try{const{provider:e,redirectTo:n,skipBrowserRedirect:i}=t,r=encodeURIComponent(e.toLowerCase()),s=cI(),o=await uI(s);dI(s);const c={code_challenge:o};n&&(c.redirect_uri=n);const d=kh.options.includes(r)?`/api/auth/oauth/${r}`:`/api/auth/oauth/custom/${r}`,h=await this.http.get(d,{params:c});return!this.isServerMode()&&typeof window<"u"&&!i?(window.location.href=h.authUrl,{data:{},error:null}):{data:{url:h.authUrl,provider:r,codeVerifier:s},error:null}}catch(e){return e instanceof jt?{data:{},error:e}:{data:{},error:new jt("An unexpected error occurred during OAuth initialization",500,"UNEXPECTED_ERROR")}}}async exchangeOAuthCode(t,e){try{const n=e??fI();if(!n)return{data:null,error:new jt("PKCE code verifier not found. Ensure signInWithOAuth was called in the same browser session.",400,"PKCE_VERIFIER_MISSING")};const i={code:t,code_verifier:n},r=await this.http.post(this.isServerMode()?"/api/auth/oauth/exchange?client_type=mobile":"/api/auth/oauth/exchange",i,{credentials:"include"});return this.saveSessionFromResponse(r),{data:r,error:null}}catch(n){return Yi(n,"An unexpected error occurred during OAuth code exchange")}}async signInWithIdToken(t){try{const{provider:e,token:n}=t,i=await this.http.post("/api/auth/id-token?client_type=mobile",{provider:e,token:n},{credentials:"include"});return this.saveSessionFromResponse(i),i.refreshToken&&this.http.setRefreshToken(i.refreshToken),{data:i,error:null}}catch(e){return Yi(e,"An unexpected error occurred during ID token sign in")}}async refreshSession(t){try{if(this.isServerMode()&&!t?.refreshToken)return{data:null,error:new jt("refreshToken is required when refreshing session in server mode",400,"REFRESH_TOKEN_REQUIRED")};const e=this.isServerMode()?null:nT(),n=await this.http.post(this.isServerMode()?"/api/auth/refresh?client_type=mobile":"/api/auth/refresh",this.isServerMode()?{refresh_token:t?.refreshToken}:void 0,{headers:e?{"X-CSRF-Token":e}:{},credentials:"include"});return n.accessToken&&this.saveSessionFromResponse(n),{data:n,error:null}}catch(e){return Yi(e,"An unexpected error occurred during session refresh")}}async getCurrentUser(){await this.authCallbackHandled;try{if(this.isServerMode()){const e=this.tokenManager.getAccessToken();return e?(this.http.setAuthToken(e),{data:{user:(await this.http.get("/api/auth/sessions/current")).user??null},error:null}):{data:{user:null},error:null}}const t=this.tokenManager.getSession();if(t)return this.http.setAuthToken(t.accessToken),{data:{user:t.user},error:null};if(typeof window<"u"){const{data:e,error:n}=await this.refreshSession();if(n)return{data:{user:null},error:n};if(e?.accessToken)return{data:{user:e.user??null},error:null}}return{data:{user:null},error:null}}catch(t){return t instanceof jt?{data:{user:null},error:t}:{data:{user:null},error:new jt("An unexpected error occurred while getting user",500,"UNEXPECTED_ERROR")}}}async getProfile(t){try{return{data:await this.http.get(`/api/auth/profiles/${t}`),error:null}}catch(e){return Yi(e,"An unexpected error occurred while fetching user profile")}}async setProfile(t){try{const e=await this.http.patch("/api/auth/profiles/current",{profile:t}),n=this.tokenManager.getUser();return!this.isServerMode()&&n&&e.profile!==void 0&&this.tokenManager.setUser({...n,profile:e.profile}),{data:e,error:null}}catch(e){return Yi(e,"An unexpected error occurred while updating user profile")}}async resendVerificationEmail(t){try{return{data:await this.http.post("/api/auth/email/send-verification",t),error:null}}catch(e){return Yi(e,"An unexpected error occurred while sending verification email")}}async verifyEmail(t){try{const e=await this.http.post(this.isServerMode()?"/api/auth/email/verify?client_type=mobile":"/api/auth/email/verify",t,{credentials:"include"});return this.saveSessionFromResponse(e),e.refreshToken&&this.http.setRefreshToken(e.refreshToken),{data:e,error:null}}catch(e){return Yi(e,"An unexpected error occurred while verifying email")}}async sendResetPasswordEmail(t){try{return{data:await this.http.post("/api/auth/email/send-reset-password",t),error:null}}catch(e){return Yi(e,"An unexpected error occurred while sending password reset email")}}async exchangeResetPasswordToken(t){try{return{data:await this.http.post("/api/auth/email/exchange-reset-password-token",t),error:null}}catch(e){return Yi(e,"An unexpected error occurred while verifying reset code")}}async resetPassword(t){try{return{data:await this.http.post("/api/auth/email/reset-password",t),error:null}}catch(e){return Yi(e,"An unexpected error occurred while resetting password")}}async getPublicAuthConfig(){try{return{data:await this.http.get("/api/auth/public-config"),error:null}}catch(t){return Yi(t,"An unexpected error occurred while fetching auth configuration")}}};function pI(t,e){return async(n,i)=>{const r=typeof n=="string"?n:n.toString(),s=new URL(r),o=s.pathname.slice(1),c=o.match(/^rpc\/(.+)$/),u=c?`/api/database/rpc/${c[1]}`:`/api/database/records/${o}`,d=`${t.baseUrl}${u}${s.search}`,h=e.getAccessToken(),p=t.getHeaders(),m=h||p.Authorization?.replace("Bearer ",""),v=new Headers(i?.headers);return m&&!v.has("Authorization")&&v.set("Authorization",`Bearer ${m}`),await fetch(d,{...i,headers:v})}}var mI=class{constructor(t,e){this.postgrest=new cN("http://dummy",{fetch:pI(t,e),headers:{}})}from(t){return this.postgrest.from(t)}rpc(t,e,n){return this.postgrest.rpc(t,e,n)}},gI=class{constructor(t,e){this.bucketName=t,this.http=e}async upload(t,e){try{const n=await this.http.post(`/api/storage/buckets/${this.bucketName}/upload-strategy`,{filename:t,contentType:e.type||"application/octet-stream",size:e.size});if(n.method==="presigned")return await this.uploadWithPresignedUrl(n,e);if(n.method==="direct"){const i=new FormData;return i.append("file",e),{data:await this.http.request("PUT",`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}`,{body:i,headers:{}}),error:null}}throw new jt(`Unsupported upload method: ${n.method}`,500,"STORAGE_ERROR")}catch(n){return{data:null,error:n instanceof jt?n:new jt("Upload failed",500,"STORAGE_ERROR")}}}async uploadAuto(t){try{const e=t instanceof File?t.name:"file",n=await this.http.post(`/api/storage/buckets/${this.bucketName}/upload-strategy`,{filename:e,contentType:t.type||"application/octet-stream",size:t.size});if(n.method==="presigned")return await this.uploadWithPresignedUrl(n,t);if(n.method==="direct"){const i=new FormData;return i.append("file",t),{data:await this.http.request("POST",`/api/storage/buckets/${this.bucketName}/objects`,{body:i,headers:{}}),error:null}}throw new jt(`Unsupported upload method: ${n.method}`,500,"STORAGE_ERROR")}catch(e){return{data:null,error:e instanceof jt?e:new jt("Upload failed",500,"STORAGE_ERROR")}}}async uploadWithPresignedUrl(t,e){try{const n=new FormData;t.fields&&Object.entries(t.fields).forEach(([r,s])=>{n.append(r,s)}),n.append("file",e);const i=await fetch(t.uploadUrl,{method:"POST",body:n});if(!i.ok)throw new jt(`Upload to storage failed: ${i.statusText}`,i.status,"STORAGE_ERROR");return t.confirmRequired&&t.confirmUrl?{data:await this.http.post(t.confirmUrl,{size:e.size,contentType:e.type||"application/octet-stream"}),error:null}:{data:{key:t.key,bucket:this.bucketName,size:e.size,mimeType:e.type||"application/octet-stream",uploadedAt:new Date().toISOString(),url:this.getPublicUrl(t.key)},error:null}}catch(n){throw n instanceof jt?n:new jt("Presigned upload failed",500,"STORAGE_ERROR")}}async download(t){try{const e=await this.http.post(`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}/download-strategy`,{expiresIn:3600}),n=e.url,i={};e.method==="direct"&&Object.assign(i,this.http.getHeaders());const r=await fetch(n,{method:"GET",headers:i});if(!r.ok)try{const o=await r.json();throw jt.fromApiError(o)}catch{throw new jt(`Download failed: ${r.statusText}`,r.status,"STORAGE_ERROR")}return{data:await r.blob(),error:null}}catch(e){return{data:null,error:e instanceof jt?e:new jt("Download failed",500,"STORAGE_ERROR")}}}getPublicUrl(t){return`${this.http.baseUrl}/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}`}async list(t){try{const e={};return t?.prefix&&(e.prefix=t.prefix),t?.search&&(e.search=t.search),t?.limit&&(e.limit=t.limit.toString()),t?.offset&&(e.offset=t.offset.toString()),{data:await this.http.get(`/api/storage/buckets/${this.bucketName}/objects`,{params:e}),error:null}}catch(e){return{data:null,error:e instanceof jt?e:new jt("List failed",500,"STORAGE_ERROR")}}}async remove(t){try{return{data:await this.http.delete(`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}`),error:null}}catch(e){return{data:null,error:e instanceof jt?e:new jt("Delete failed",500,"STORAGE_ERROR")}}}},vI=class{constructor(t){this.http=t}from(t){return new gI(t,this.http)}},yI=class{constructor(t){this.http=t,this.chat=new _I(t),this.images=new SI(t),this.embeddings=new bI(t)}},_I=class{constructor(t){this.completions=new xI(t)}},xI=class{constructor(t){this.http=t}async create(t){const e={model:t.model,messages:t.messages,temperature:t.temperature,maxTokens:t.maxTokens,topP:t.topP,stream:t.stream,webSearch:t.webSearch,fileParser:t.fileParser,thinking:t.thinking,tools:t.tools,toolChoice:t.toolChoice,parallelToolCalls:t.parallelToolCalls};if(t.stream){const r=this.http.getHeaders();r["Content-Type"]="application/json";const s=await this.http.fetch(`${this.http.baseUrl}/api/ai/chat/completion`,{method:"POST",headers:r,body:JSON.stringify(e)});if(!s.ok){const o=await s.json();throw new Error(o.error||"Stream request failed")}return this.parseSSEStream(s,t.model)}const n=await this.http.post("/api/ai/chat/completion",e),i=n.text||"";return{id:`chatcmpl-${Date.now()}`,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:n.metadata?.model,choices:[{index:0,message:{role:"assistant",content:i,...n.tool_calls?.length&&{tool_calls:n.tool_calls},...n.annotations?.length&&{annotations:n.annotations}},finish_reason:n.tool_calls?.length?"tool_calls":"stop"}],usage:n.metadata?.usage||{prompt_tokens:0,completion_tokens:0,total_tokens:0}}}async*parseSSEStream(t,e){const n=t.body.getReader(),i=new TextDecoder;let r="";try{for(;;){const{done:s,value:o}=await n.read();if(s)break;r+=i.decode(o,{stream:!0});const c=r.split(`
|
|
42
|
-
`);r=c.pop()||"";for(const u of c)if(u.startsWith("data: ")){const d=u.slice(6).trim();if(d)try{const h=JSON.parse(d);if((h.chunk||h.content)&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{content:h.chunk||h.content},finish_reason:null}]}),h.tool_calls?.length&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{tool_calls:h.tool_calls},finish_reason:"tool_calls"}]}),h.done){n.releaseLock();return}}catch{console.warn("Failed to parse SSE data:",d)}}}}finally{n.releaseLock()}}},bI=class{constructor(t){this.http=t}async create(t){const e=await this.http.post("/api/ai/embeddings",t);return{object:e.object,data:e.data,model:e.metadata?.model,usage:e.metadata?.usage?{prompt_tokens:e.metadata.usage.promptTokens||0,total_tokens:e.metadata.usage.totalTokens||0}:{prompt_tokens:0,total_tokens:0}}}},SI=class{constructor(t){this.http=t}async generate(t){const e=await this.http.post("/api/ai/image/generation",t);let n=[];return e.images&&e.images.length>0?n=e.images.map(i=>({b64_json:i.imageUrl.replace(/^data:image\/\w+;base64,/,""),content:e.text})):e.text&&(n=[{content:e.text}]),{created:Math.floor(Date.now()/1e3),data:n,...e.metadata?.usage&&{usage:{total_tokens:e.metadata.usage.totalTokens||0,input_tokens:e.metadata.usage.promptTokens||0,output_tokens:e.metadata.usage.completionTokens||0}}}}},wI=class oT{constructor(e,n){this.http=e,this.functionsUrl=n||oT.deriveSubhostingUrl(e.baseUrl)}static deriveSubhostingUrl(e){try{const{hostname:n}=new URL(e);return n.endsWith(".insforge.app")?`https://${n.split(".")[0]}.functions.insforge.app`:void 0}catch{return}}async invoke(e,n={}){const{method:i="POST",body:r,headers:s={}}=n;if(this.functionsUrl)try{return{data:await this.http.request(i,`${this.functionsUrl}/${e}`,{body:r,headers:s}),error:null}}catch(o){if(o instanceof Error&&o.name==="AbortError")throw o;if(!(o instanceof jt&&o.statusCode===404))return{data:null,error:o instanceof jt?o:new jt(o instanceof Error?o.message:"Function invocation failed",500,"FUNCTION_ERROR")}}try{const o=`/functions/${e}`;return{data:await this.http.request(i,o,{body:r,headers:s}),error:null}}catch(o){if(o instanceof Error&&o.name==="AbortError")throw o;return{data:null,error:o instanceof jt?o:new jt(o instanceof Error?o.message:"Function invocation failed",500,"FUNCTION_ERROR")}}}},IS=1e4,EI=class{constructor(t,e,n){this.socket=null,this.connectPromise=null,this.subscribedChannels=new Set,this.eventListeners=new Map,this.baseUrl=t,this.tokenManager=e,this.anonKey=n,this.tokenManager.onTokenChange=()=>this.onTokenChange()}notifyListeners(t,e){const n=this.eventListeners.get(t);if(n)for(const i of n)try{i(e)}catch(r){console.error(`Error in ${t} callback:`,r)}}connect(){return this.socket?.connected?Promise.resolve():this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((t,e)=>{const n=this.tokenManager.getAccessToken()??this.anonKey;this.socket=Df(this.baseUrl,{transports:["websocket"],auth:n?{token:n}:void 0});let i=!0,r=null;const s=()=>{r&&(clearTimeout(r),r=null)};r=setTimeout(()=>{i&&(i=!1,this.connectPromise=null,this.socket?.disconnect(),this.socket=null,e(new Error(`Connection timeout after ${IS}ms`)))},IS),this.socket.on("connect",()=>{s();for(const o of this.subscribedChannels)this.socket.emit("realtime:subscribe",{channel:o});this.notifyListeners("connect"),i&&(i=!1,this.connectPromise=null,t())}),this.socket.on("connect_error",o=>{s(),this.notifyListeners("connect_error",o),i&&(i=!1,this.connectPromise=null,e(o))}),this.socket.on("disconnect",o=>{this.notifyListeners("disconnect",o)}),this.socket.on("realtime:error",o=>{this.notifyListeners("error",o)}),this.socket.onAny((o,c)=>{o!=="realtime:error"&&this.notifyListeners(o,c)})}),this.connectPromise)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null),this.subscribedChannels.clear()}onTokenChange(){const t=this.tokenManager.getAccessToken()??this.anonKey;this.socket&&(this.socket.auth=t?{token:t}:{}),this.socket&&(this.socket.connected||this.connectPromise)&&(this.socket.disconnect(),this.socket.connect())}get isConnected(){return this.socket?.connected??!1}get connectionState(){return this.socket?this.socket.connected?"connected":"connecting":"disconnected"}get socketId(){return this.socket?.id}async subscribe(t){if(this.subscribedChannels.has(t))return{ok:!0,channel:t};if(!this.socket?.connected)try{await this.connect()}catch(e){const n=e instanceof Error?e.message:"Connection failed";return{ok:!1,channel:t,error:{code:"CONNECTION_FAILED",message:n}}}return new Promise(e=>{this.socket.emit("realtime:subscribe",{channel:t},n=>{n.ok&&this.subscribedChannels.add(t),e(n)})})}unsubscribe(t){this.subscribedChannels.delete(t),this.socket?.connected&&this.socket.emit("realtime:unsubscribe",{channel:t})}async publish(t,e,n){if(!this.socket?.connected)throw new Error("Not connected to realtime server. Call connect() first.");this.socket.emit("realtime:publish",{channel:t,event:e,payload:n})}on(t,e){this.eventListeners.has(t)||this.eventListeners.set(t,new Set),this.eventListeners.get(t).add(e)}off(t,e){const n=this.eventListeners.get(t);n&&(n.delete(e),n.size===0&&this.eventListeners.delete(t))}once(t,e){const n=i=>{this.off(t,n),e(i)};this.on(t,n)}getSubscribedChannels(){return Array.from(this.subscribedChannels)}},MI=class{constructor(t){this.http=t}async send(t){try{return{data:await this.http.post("/api/email/send-raw",t),error:null}}catch(e){if(e instanceof Error&&e.name==="AbortError")throw e;return{data:null,error:e instanceof jt?e:new jt(e instanceof Error?e.message:"Email send failed",500,"EMAIL_ERROR")}}}},TI=class{constructor(t={}){const e=new tT(t.debug);this.tokenManager=new sT,this.http=new lI(t,this.tokenManager,e),t.edgeFunctionToken&&(this.http.setAuthToken(t.edgeFunctionToken),this.tokenManager.setAccessToken(t.edgeFunctionToken)),this.auth=new hI(this.http,this.tokenManager,{isServerMode:t.isServerMode??!1}),this.database=new mI(this.http,this.tokenManager),this.storage=new vI(this.http),this.ai=new yI(this.http),this.functions=new wI(this.http,t.functionsUrl),this.realtime=new EI(this.http.baseUrl,this.tokenManager,t.anonKey),this.emails=new MI(this.http)}getHttpClient(){return this.http}};function AI(t){return new TI(t)}const cy={VITE_INSFORGE_ANON_KEY:"ik_9f35735991b684f7cf57fa00bb4d0487",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function Ro(){const t=typeof import.meta<"u"?cy:void 0;return(t?.VITE_INSFORGE_BASE_URL||t?.VITE_TOKENTRACKER_BACKEND_BASE_URL||"").trim()}function lT(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return window.location.origin;const e=typeof import.meta<"u"?cy:void 0;return(e?.VITE_INSFORGE_BASE_URL||e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||"").trim()}function Nh(){const t=typeof import.meta<"u"?cy:void 0;return(t?.VITE_INSFORGE_ANON_KEY||t?.VITE_TOKENTRACKER_BACKEND_ANON_KEY||"").trim()}function u0(){return!!lT()}let Om=null;function CI(){return u0()?(Om||(Om=AI({baseUrl:lT(),anonKey:Nh()||void 0,autoRefreshToken:!0})),Om):null}const cT="tokentracker_cloud_sync_enabled",uy="tokentracker_cloud_device_session_v1",dy="tokentracker_cloud_last_sync_ts";function PI(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"}function RI(){try{const t=localStorage.getItem(cT);return t===null||t===""?!1:t==="1"||t==="true"}catch{return!1}}function q$(t){try{localStorage.setItem(cT,t?"1":"0")}catch{}}function uT(){try{const t=localStorage.getItem(uy);if(!t)return null;const e=JSON.parse(t);if(typeof e?.token=="string"&&e.token&&typeof e.deviceId=="string")return e}catch{}return null}function dT(t){try{localStorage.setItem(uy,JSON.stringify(t))}catch{}}function kI(){try{localStorage.removeItem(uy),localStorage.removeItem(dy)}catch{}}function LI(){try{const t=Number(localStorage.getItem(dy));return Number.isFinite(t)?t:0}catch{return 0}}function fT(t){try{localStorage.setItem(dy,String(t))}catch{}}function Ta(t){if(typeof t!="string")return null;const e=t.trim();return e.length>0?e:null}function DI(t){const e=Ta(t);if(!e)return null;const n=e.split(".");if(n.length<2)return null;const i=n[1];try{const r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),s=typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("utf8"),c=JSON.parse(s)?.exp;return typeof c!="number"||!Number.isFinite(c)||c<=0?null:Math.floor(c*1e3)}catch{return null}}function NI(t){const e=Ta(t);if(!e)return!1;const n=e.split(".");if(n.length!==3)return!1;try{for(let i=0;i<2;i++){const r=n[i];if(!/^[A-Za-z0-9_-]+$/.test(r))return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=typeof atob=="function"?atob(s):Buffer.from(s,"base64").toString("utf8");i===1&&JSON.parse(o)}return!0}catch{return!1}}function II(t,e=3e4){const n=DI(t);return n?n<=Date.now()+Math.max(0,Number(e)||0):!1}async function UI(t){if(!t)return null;if(typeof t=="string")return Ta(t);if(typeof t=="function")try{const e=await t();return Ta(e)}catch{return null}if(typeof t=="object"){if(typeof t.getAccessToken=="function"){try{const e=await t.getAccessToken(),n=Ta(e);if(n)return n}catch{}return Ta(t.accessToken)}return null}return Ta(t)}async function Y$(t,e={}){const n=Math.max(1,Math.min(12,Math.floor(Number(e.maxAttempts)||8))),i=Math.max(20,Math.floor(Number(e.baseDelayMs)||50));for(let r=0;r<n;r++){const s=await UI(t);if(s)return s;r<n-1&&await new Promise(o=>setTimeout(o,i*(r+1)))}return null}function K$(t){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")||typeof t=="function"||t&&typeof t=="object"&&typeof t.getAccessToken=="function"?!0:!!Ta(t)}function Z$(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function J$(t=new Date){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return 0;const n=e.getTimezoneOffset();return Number.isFinite(n)?-n:0}function hT(t){if(!Number.isFinite(t)||t===0)return"UTC";const e=t>=0?"+":"-",n=Math.abs(t),i=String(Math.floor(n/60)).padStart(2,"0"),r=String(n%60).padStart(2,"0");return`UTC${e}${i}:${r}`}function Q$({timeZone:t,offsetMinutes:e}={}){const n=hT(e);return t&&t!=="UTC"?`${t} (${n})`:n}function eX({timeZone:t,offsetMinutes:e}={}){return Number.isFinite(e)?hT(e):t||"UTC"}function tX({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const i=n instanceof Date?n:new Date(n);if(!Number.isFinite(i.getTime()))return"";if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const o=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((h,p)=>(p.type&&p.value&&(h[p.type]=p.value),h),{}),c=o.year,u=o.month,d=o.day;if(c&&u&&d)return`${c}-${u}-${d}`}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(i.getTime()+e*6e4);return OI(r)}return BI(i)}function FI({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const i=n instanceof Date?n:new Date(n);if(!Number.isFinite(i.getTime()))return null;if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const o=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((h,p)=>(p.type&&p.value&&(h[p.type]=p.value),h),{}),c=Number(o.year),u=Number(o.month),d=Number(o.day);if(Number.isFinite(c)&&Number.isFinite(u)&&Number.isFinite(d))return{year:c,month:u,day:d}}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(i.getTime()+e*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate()}}return{year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()}}function nX({timeZone:t,offsetMinutes:e}={}){return t?`tz:${t}`:typeof e=="number"&&Number.isFinite(e)?`offset:${Math.trunc(e)}`:"utc"}function OI(t){const e=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),i=String(t.getUTCDate()).padStart(2,"0");return`${e}-${n}-${i}`}function BI(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${i}`}function kn(t){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())).toISOString().slice(0,10)}function ps(t){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return"";const n=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${n}-${i}-${r}`}function zI(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const i=Number(n[0]),r=Number(n[1])-1,s=Number(n[2]);if(!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(s))return null;const o=new Date(Date.UTC(i,r,s));return Number.isFinite(o.getTime())&&kn(o)===e?o:null}function VI(t){if(!t)return"";const e=t.year,n=String(t.month).padStart(2,"0"),i=String(t.day).padStart(2,"0");return!e||!n||!i?"":`${e}-${n}-${i}`}function HI(t,{timeZone:e,offsetMinutes:n,now:i}={}){const r=i instanceof Date&&Number.isFinite(i.getTime())?i:new Date,s=FI({timeZone:e,offsetMinutes:n,date:r});if(!s){const u=ps(new Date);return{from:u,to:u}}const o=VI(s),c=zI(o);if(!c)return{from:o,to:o};if(t==="day")return{from:o,to:o};if(t==="week"){const u=new Date(c),h=(u.getUTCDay()+6)%7;u.setUTCDate(u.getUTCDate()-h);const p=new Date(u);return p.setUTCDate(p.getUTCDate()+6),{from:kn(u),to:kn(p)}}if(t==="month"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),1)),d=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()+1,0));return{from:kn(u),to:kn(d)}}if(t==="total"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()-23,1));return{from:kn(u),to:o}}return HI("week")}function iX(t){if(t==null)return"-";try{if(typeof t=="bigint")return new Intl.NumberFormat().format(t);if(typeof t=="number")return new Intl.NumberFormat().format(t);const e=String(t).trim();return/^[0-9]+$/.test(e)?new Intl.NumberFormat().format(BigInt(e)):e}catch{return String(t)}}function rX(t,{thousandSuffix:e="K",millionSuffix:n="M",billionSuffix:i="B",decimals:r=1}={}){const s=Number(String(t));if(!Number.isFinite(s))return"-";const o=s<0?"-":"",c=Math.abs(s),u=Math.max(0,Math.min(6,Math.floor(r)));if(c<1e3)return`${o}${String(c)}`;const d=(v,_)=>{const w=v.toFixed(u),y=Number(w).toString();return`${o}${y}${_}`},h=(v,_,w)=>{const y=v.toFixed(u),b=Number(y);return w&&b>=1e3?d(b/1e3,w):`${o}${b.toString()}${_}`};if(c>=1e9)return d(c/1e9,i);if(c>=1e6)return h(c/1e6,n,i);const p=c/1e3,m=Number(p.toFixed(u));return m>=1e3?d(m/1e3,n):d(m,e)}function pT(t){const e=Number(String(t));return Number.isFinite(e)?e:null}function sX(t,{decimals:e=2}={}){if(t==null)return"-";const n=String(t).trim();if(!n)return"-";const i=n.match(/^(-?\d+)(?:\.(\d+))?$/);if(!i)return n;const r=i[1],s=i[2]||"";let o=r;try{o=new Intl.NumberFormat().format(BigInt(r))}catch{o=r}const c=Math.max(0,Math.min(6,Math.floor(e))),u=c?s.slice(0,c).padEnd(c,"0"):"",d=r.startsWith("-")?"-":"",h=c?`${o.replace("-","")}.${u}`:o.replace("-","");return`${d}$${h}`}function oh(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),i=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,i,r));return Number.isFinite(s.getTime())&&kn(s)===t.trim()?s:null}function fo(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function GI(t,e){const n=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return Math.floor(n/864e5)}function Bm(t,e){if(!Array.isArray(t)||t.length===0)return 0;const n=t.length,i=(n-1)*e,r=Math.floor(i),s=i-r,o=t[r]??t[n-1],c=t[Math.min(n-1,r+1)]??t[n-1];return Math.round(o+(c-o)*s)}function jI(t){return t<=0?0:t>=4?4:t}function mT({weeks:t=52,now:e,weekStartsOn:n="sun"}={}){const i=e instanceof Date&&Number.isFinite(e.getTime())?e:new Date,r=ps(i),s=oh(r)||new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),o=n==="mon"?1:0,c=s.getUTCDay(),u=fo(s,-((c-o+7)%7)),d=fo(u,-7*(Math.max(1,t)-1));return{from:kn(d),to:r}}function WI({dailyRows:t,weeks:e=52,to:n,weekStartsOn:i="sun"}={}){const r=oh(n)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:s}=mT({weeks:e,now:r,weekStartsOn:i}),o=oh(s)||fo(r,-(e*7-1)),c=(()=>{const M=(o.getUTCDay()-(i==="mon"?1:0)+7)%7;return fo(o,-M)})(),u=new Map;for(const T of Array.isArray(t)?t:[]){const A=typeof T?.day=="string"?T.day:null;if(!A)continue;const M=pT(T?.billable_total_tokens??T?.total_tokens)??0;u.set(A,Math.max(0,M))}const d=GI(c,r)+1,h=Math.ceil(d/7),p=[];for(let T=0;T<d;T++){const A=fo(c,T),M=kn(A),I=u.get(M)??0;I>0&&p.push(I)}p.sort((T,A)=>T-A);const m=Bm(p,.5),v=Bm(p,.75),_=Bm(p,.9);function w(T){return!T||T<=0?0:T<=m?1:T<=v?2:T<=_?3:4}const y=[];for(let T=0;T<h;T++){const A=[];for(let M=0;M<7;M++){const I=T*7+M,k=fo(c,I);if(k.getTime()>r.getTime()){A.push(null);continue}const U=kn(k),S=u.get(U)??0;A.push({day:U,value:S,level:jI(w(S))})}y.push(A)}const b=y.length>e?y.slice(y.length-e):y;return{from:s,to:kn(r),weeks:b,thresholds:{t1:m,t2:v,t3:_}}}function $I({dailyRows:t,to:e}={}){const n=oh(e)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),i=new Map;for(const s of Array.isArray(t)?t:[]){const o=typeof s?.day=="string"?s.day:null;if(!o)continue;const c=pT(s?.billable_total_tokens??s?.total_tokens)??0;i.set(o,Math.max(0,c))}let r=0;for(let s=0;s<370;s++){const o=kn(fo(n,-s));if((i.get(o)??0)>0){r+=1;continue}break}return r}const Ih={},gT="tokentracker",XI=["victorgpt/tokentracker","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],US=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function xr(){if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock")||"").toLowerCase();if(e==="0"||e==="false"||e==="off"||e==="no")return!1;if(e==="1"||e==="true"||e==="on"||e==="yes")return!0}if(typeof import.meta<"u"&&Ih){const t="".toLowerCase();if(t==="1"||t==="true")return!0}return!1}function qI(){if(typeof import.meta<"u"&&Ih){const t="".trim();if(t)return t;const e="".trim();if(e)return e}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_now")||"").trim();if(e)return e;const n=String(t.get("mock_today")||"").trim();if(n)return n}return""}function YI(t){if(!t)return null;const e=String(t).trim();if(!e)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[i,r,s]=e.split("-").map(Number);if(!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(s))return null;const o=new Date(i,r-1,s,12,0,0);return Number.isFinite(o.getTime())?o:null}const n=new Date(e);return Number.isFinite(n.getTime())?n:null}function aX(){return xr()?YI(qI()):null}function KI(){if(typeof import.meta<"u"&&Ih){const t="".trim();if(t)return t}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_seed")||"").trim();if(e)return e}return gT}function ZI(){if(typeof import.meta<"u"&&Ih){const t="".trim(),e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_missing")||"").trim(),n=Number(e);if(Number.isFinite(n)&&n>0)return Math.floor(n)}return 0}function Pu(t){return(t==null?KI():String(t)).trim()||gT}function Ru(t){let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function ki(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),i=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,i,r));return Number.isFinite(s.getTime())&&kn(s)===t.trim()?s:null}function mu(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function vT(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+e,1))}function JI(t){return`${t.getUTCFullYear()}-${String(t.getUTCMonth()+1).padStart(2,"0")}`}function Vl({from:t,to:e,seed:n}){const i=ki(ps(new Date))||new Date,r=ki(t)||i,s=ki(e)||r,o=[],c=Pu(n),u=Math.floor((Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())-Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()))/864e5)+1;for(let d=0;d<u;d+=1){const h=mu(r,d),p=kn(h),m=Ru(`${c}:${p}`),v=m%1e3/1e3,_=.6+.4*Math.sin(d/6*Math.PI*.5),w=h.getUTCDay()===0||h.getUTCDay()===6?.65:1,y=18e3+Math.round(12e3*v),b=Math.max(0,Math.round(y*_*w)),T=Math.round(b*.46),A=Math.round(b*.34),M=Math.round(b*.14),I=Math.max(0,b-T-A-M);o.push({day:p,total_tokens:b,billable_total_tokens:b,input_tokens:T,output_tokens:A,cached_input_tokens:M,reasoning_output_tokens:I,conversation_count:1+m%5})}return o}function QI({day:t,seed:e}){const n=ki(t)||ki(ps(new Date))||new Date,i=kn(n),r=Pu(e),s=Array.from({length:48},(c,u)=>{const d=Math.floor(u/2),h=u%2===0?0:30,m=Ru(`${r}:${i}:${d}:${h}`)%1e3/1e3,v=(d+h/60)/24,_=.4+.6*Math.sin(v*Math.PI*2),w=900+Math.round(700*m),y=Math.max(0,Math.round(w*_)),b=Math.round(y*.46),T=Math.round(y*.34),A=Math.round(y*.14),M=Math.max(0,y-b-T-A);return{hour:`${i}T${String(d).padStart(2,"0")}:${String(h).padStart(2,"0")}:00`,total_tokens:y,billable_total_tokens:y,input_tokens:b,output_tokens:T,cached_input_tokens:A,reasoning_output_tokens:M}}),o=Math.max(0,Math.min(48,ZI()));if(o>0){const c=Date.now(),u=s.map((p,m)=>{const v=Date.parse(p.hour);return Number.isFinite(v)&&v<=c?{index:m,ts:v}:null}).filter(Boolean),d=Math.max(0,u.length-o),h=u.slice(d);for(const p of h){const m=s[p.index];m&&(s[p.index]={...m,missing:!0})}}return s}function eU({months:t=24,to:e,seed:n}){const i=ki(e)||ki(ps(new Date))||new Date,r=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),s=Pu(n),o=[];for(let c=t-1;c>=0;c-=1){const u=vT(r,-c),d=JI(u),p=Ru(`${s}:${d}`)%1e3/1e3,m=.7+.3*Math.sin(o.length/6*Math.PI*.5),v=36e4+Math.round(2e5*p),_=Math.max(0,Math.round(v*m)),w=Math.round(_*.46),y=Math.round(_*.34),b=Math.round(_*.14),T=Math.max(0,_-w-y-b);o.push({month:d,total_tokens:_,billable_total_tokens:_,input_tokens:w,output_tokens:y,cached_input_tokens:b,reasoning_output_tokens:T})}return o}function fy(t){return t.reduce((e,n)=>(e.total_tokens+=Number(n.total_tokens||0),e.billable_total_tokens+=Number(n.billable_total_tokens||n.total_tokens||0),e.input_tokens+=Number(n.input_tokens||0),e.output_tokens+=Number(n.output_tokens||0),e.cached_input_tokens+=Number(n.cached_input_tokens||0),e.reasoning_output_tokens+=Number(n.reasoning_output_tokens||0),e.conversation_count+=Number(n.conversation_count||0),e),{total_tokens:0,billable_total_tokens:0,input_tokens:0,output_tokens:0,cached_input_tokens:0,reasoning_output_tokens:0,conversation_count:0})}function tU(t,e=1.75){const n=Number(t||0);return!Number.isFinite(n)||n<=0?"0.000000":(n*e/1e6).toFixed(6)}function FS(t,e){const n=Number.isFinite(e)?e:0;return{total_tokens:Math.max(0,Math.round(t.total_tokens*n)),billable_total_tokens:Math.max(0,Math.round((t.billable_total_tokens??t.total_tokens)*n)),input_tokens:Math.max(0,Math.round(t.input_tokens*n)),output_tokens:Math.max(0,Math.round(t.output_tokens*n)),cached_input_tokens:Math.max(0,Math.round(t.cached_input_tokens*n)),reasoning_output_tokens:Math.max(0,Math.round(t.reasoning_output_tokens*n))}}function d0(t){return{...t,total_cost_usd:tU(t.total_tokens)}}function nU({from:t,to:e,seed:n}={}){const i=Vl({from:t,to:e,seed:n});return{from:t,to:e,data:i}}function iU({day:t,seed:e}={}){const n=ki(t)||new Date,i=kn(n),r=QI({day:i,seed:e});return{day:i,data:r}}function rU({months:t=24,to:e,seed:n}={}){const i=ki(e)||ki(ps(new Date))||new Date,r=kn(i),s=eU({months:t,to:r,seed:n}),o=vT(new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),-(t-1));return{from:kn(o),to:r,months:t,data:s}}function sU({from:t,to:e,seed:n,rolling:i=!0}={}){const r=Vl({from:t,to:e,seed:n}),s=fy(r),o=d0(s),c=i?aU({to:e,seed:n}):null;return{from:t,to:e,days:r.length,totals:o,...c?{rolling:c}:{}}}function aU({to:t,seed:e}={}){const n=ki(t)||ki(ps(new Date))||new Date,i=kn(n),r=kn(mu(n,-6)),s=kn(mu(n,-29)),o=Vl({from:r,to:i,seed:e}),c=Vl({from:s,to:i,seed:e});return{last_7d:OS({rows:o,from:r,to:i}),last_30d:OS({rows:c,from:s,to:i})}}function OS({rows:t,from:e,to:n}={}){const i=fy(t||[]),r=(t||[]).filter(o=>Number(o.billable_total_tokens??o.total_tokens)>0).length,s=r>0?Math.floor(i.billable_total_tokens/r):0;return{from:e,to:n,totals:{billable_total_tokens:i.billable_total_tokens,conversation_count:i.conversation_count},active_days:r,avg_per_active_day:s}}function oU({seed:t,limit:e=3}={}){const n=Pu(t),i=XI.map((r,s)=>{const c=12e4+Ru(`${n}:${r}`)%9e5,u=s%4*4200,d=Math.max(0,c+u),h=Math.max(0,Math.round(d*.96));return{project_key:r,project_ref:`https://github.com/${r}`,total_tokens:String(d),billable_total_tokens:String(h)}}).sort((r,s)=>Number(s.billable_total_tokens)-Number(r.billable_total_tokens)).slice(0,Math.max(1,Math.min(10,Math.floor(Number(e)||3))));return{generated_at:new Date().toISOString(),entries:i}}function lU(t){const e=ki(ps(new Date))||new Date,n=String(t).trim().toLowerCase()||"week";if(n==="total")return{from:"1970-01-01",to:"9999-12-31"};if(n==="month"){const o=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),c=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0));return{from:kn(o),to:kn(c)}}const i=e.getUTCDay(),r=kn(mu(e,-i)),s=kn(mu(e,-i+6));return{from:r,to:s}}function yT({seed:t,period:e,metric:n,limit:i=20,offset:r=0}={}){const s=Pu(t),o=Math.max(1,Math.min(100,Math.floor(Number(i)||20))),c=Math.max(0,Math.min(1e4,Math.floor(Number(r)||0))),u=String(n||"all").trim().toLowerCase()||"all",d=String(e||"week").trim().toLowerCase()||"week",h=d==="month"||d==="total"||d==="week"?d:"week",{from:p,to:m}=lU(h),v=250,_=v>0?Math.ceil(v/o):0,w=Math.floor(c/o)+1,y=Array.from({length:v},(U,S)=>{const P=S+1,V=`00000000-0000-0000-0000-${String(P).padStart(12,"0")}`,O=US[P%US.length],J=18e4+Ru(`${s}:${O}:${P}`)%9e5,H=Math.max(0,J+P*1200),X=Math.floor(H*.28),K=Math.floor(H*.18),Q=Math.floor(H*.1),W=Math.floor(H*.1),q=Math.floor(H*.08),Z=Math.floor(H*.03),z=Math.floor(H*.02),ie=Math.floor(H*.04),Ee=Math.max(0,H-X-K-Q-W-q-Z-z-ie),ze=P%7!==0;return{id:P,user_id:V,is_public:ze,is_me:!1,display_name:ze?O:"Anonymous",avatar_url:null,gpt_tokens:X,claude_tokens:K,gemini_tokens:Q,cursor_tokens:W,opencode_tokens:q,openclaw_tokens:Ee,hermes_tokens:Z,kiro_tokens:z,copilot_tokens:ie,other_tokens:0,total_tokens:H}}),b=Math.max(0,Math.min(v-1,Math.floor(v*.8)));y[b]&&(y[b].is_me=!0);const T=u==="gpt"||u==="codex"?"gpt_tokens":u==="claude"?"claude_tokens":u==="gemini"?"gemini_tokens":u==="cursor"?"cursor_tokens":u==="opencode"?"opencode_tokens":u==="openclaw"?"openclaw_tokens":u==="hermes"?"hermes_tokens":u==="kiro"?"kiro_tokens":u==="copilot"?"copilot_tokens":"total_tokens",A=y.slice().sort((U,S)=>Number(S[T])-Number(U[T])||U.id-S.id).map((U,S)=>({user_id:U.is_public?U.user_id:null,rank:S+1,is_me:!!U.is_me,display_name:U.display_name,avatar_url:U.avatar_url,gpt_tokens:String(U.gpt_tokens),claude_tokens:String(U.claude_tokens),gemini_tokens:String(U.gemini_tokens),cursor_tokens:String(U.cursor_tokens),opencode_tokens:String(U.opencode_tokens),openclaw_tokens:String(U.openclaw_tokens),hermes_tokens:String(U.hermes_tokens??0),kiro_tokens:String(U.kiro_tokens??0),copilot_tokens:String(U.copilot_tokens??0),other_tokens:String(U.other_tokens??0),total_tokens:String(U.total_tokens),is_public:!!U.is_public})),M=A.find(U=>U?.is_me)||null,I=M?{rank:M.rank,gpt_tokens:M.gpt_tokens,claude_tokens:M.claude_tokens,gemini_tokens:M.gemini_tokens,cursor_tokens:M.cursor_tokens,opencode_tokens:M.opencode_tokens,openclaw_tokens:M.openclaw_tokens,hermes_tokens:M.hermes_tokens,kiro_tokens:M.kiro_tokens,copilot_tokens:M.copilot_tokens,other_tokens:M.other_tokens,total_tokens:M.total_tokens}:{rank:null,gpt_tokens:"0",claude_tokens:"0",gemini_tokens:"0",cursor_tokens:"0",opencode_tokens:"0",openclaw_tokens:"0",hermes_tokens:"0",kiro_tokens:"0",copilot_tokens:"0",other_tokens:"0",total_tokens:"0"},k=A.slice(c,c+o);return{period:h,metric:u,from:p,to:m,generated_at:new Date().toISOString(),page:w,limit:o,offset:c,total_entries:v,total_pages:_,entries:k,me:I}}function cU({weeks:t=52,to:e,weekStartsOn:n="sun",seed:i}={}){const r=mT({weeks:t,now:ki(e)||ki(ps(new Date))||new Date,weekStartsOn:n}),s=Vl({from:r.from,to:r.to,seed:i});return{...WI({dailyRows:s,weeks:t,to:r.to,weekStartsOn:n}),week_starts_on:n,active_days:s.filter(c=>Number(c.billable_total_tokens??c.total_tokens)>0).length,streak_days:$I({dailyRows:s,to:r.to})}}function uU({from:t,to:e,seed:n}={}){const i=Vl({from:t,to:e,seed:n}),r=fy(i),o=[{source:"codex",weight:.7,models:[{model:"gpt-5.2-codex",model_id:"gpt-5.2-codex",weight:.2},{model:"unknown",model_id:"unknown",weight:.8}]},{source:"claude",weight:.2,models:[{model:"claude-3.5",model_id:"claude-3.5",weight:.3},{model:"unknown",model_id:"unknown",weight:.7}]},{source:"every-code",weight:.1,models:[{model:"unknown",model_id:"unknown",weight:1}]}].map(c=>{const u=FS(r,c.weight),d=c.models.map(h=>{const p=FS(u,h.weight);return{model:h.model,model_id:h.model_id||h.model,totals:d0(p)}});return{source:c.source,totals:d0(u),models:d}});return{from:t,to:e,days:i.length,sources:o,pricing:{model:"mock",pricing_mode:"add",source:"mock",effective_from:ps(new Date),rates_per_million_usd:{input:"1.750000",cached_input:"0.175000",output:"14.000000",reasoning_output:"14.000000"}}}}const ms={usageSummary:"tokentracker-usage-summary",usageDaily:"tokentracker-usage-daily",usageHourly:"tokentracker-usage-hourly",usageMonthly:"tokentracker-usage-monthly",usageHeatmap:"tokentracker-usage-heatmap",usageModelBreakdown:"tokentracker-usage-model-breakdown",projectUsageSummary:"tokentracker-project-usage-summary",userStatus:"tokentracker-user-status",localSync:"tokentracker-local-sync",usageLimits:"tokentracker-usage-limits"};async function $s(t,e,n){const i=new URL(`/functions/${t}`,window.location.origin);if(e)for(const[s,o]of Object.entries(e))o!=null&&o!==""&&i.searchParams.set(s,String(o));const r=await fetch(i.toString(),{headers:{Accept:"application/json"},cache:"no-store",...n});if(!r.ok){const s=new Error(`Request failed with HTTP ${r.status}`);throw s.status=r.status,s}return r.json()}function ko({timeZone:t,tzOffsetMinutes:e}={}){const n={},i=typeof t=="string"?t.trim():"";return i&&(n.tz=i),Number.isFinite(e)&&(n.tz_offset_minutes=String(Math.trunc(e))),n}function Lo({source:t,model:e}={}){const n={},i=typeof t=="string"?t.trim().toLowerCase():"";i&&(n.source=i);const r=typeof e=="string"?e.trim():"";return r&&(n.model=r),n}async function oX({from:t,to:e,source:n,model:i,timeZone:r,tzOffsetMinutes:s,rolling:o=!1,accessToken:c}={}){if(xr())return sU({from:t,to:e,seed:c,rolling:o});const u=ko({timeZone:r,tzOffsetMinutes:s}),d=Lo({source:n,model:i}),h=o?{rolling:"1"}:{};return $s(ms.usageSummary,{from:t,to:e,...d,...u,...h})}async function lX({from:t,to:e,source:n,limit:i,timeZone:r,tzOffsetMinutes:s,accessToken:o}={}){if(xr())return oU({seed:o,limit:i});const c=ko({timeZone:r,tzOffsetMinutes:s}),d={...Lo({source:n}),...c};return t&&(d.from=t),e&&(d.to=e),i!=null&&(d.limit=String(i)),$s(ms.projectUsageSummary,d)}async function ku(t,e={}){const n=Ro();if(!n)throw new Error("InsForge base URL not configured");const i=n.replace(/\/$/,""),r=new URL(`${i}/functions/${t}`);if(e.params)for(const[u,d]of Object.entries(e.params))d!=null&&d!==""&&r.searchParams.set(u,String(d));const s={Accept:"application/json","Content-Type":"application/json"},o=Nh();o&&(s.apikey=o),e.accessToken&&NI(e.accessToken)&&(s.Authorization=`Bearer ${e.accessToken}`);const c=await fetch(r.toString(),{method:e.method||"GET",headers:s,...e.body!=null?{body:JSON.stringify(e.body)}:{}});if(!c.ok){const u=new Error(`Request failed with HTTP ${c.status}`);throw u.status=c.status,u}return c.json()}async function cX({accessToken:t,userId:e,period:n,metric:i,limit:r,offset:s}={}){return xr()?yT({seed:t||e,period:n,metric:i,limit:r,offset:s}):ku("tokentracker-leaderboard",{params:{period:n,limit:r,offset:s,user_id:e}})}async function BS({accessToken:t}={}){return ku("tokentracker-public-visibility",{accessToken:t,method:"GET"})}async function uX({accessToken:t,enabled:e,anonymous:n,display_name:i}={}){const r={};return e!==void 0&&(r.enabled=!!e),n!==void 0&&(r.anonymous=!!n),i!==void 0&&(r.display_name=String(i)),ku("tokentracker-public-visibility",{accessToken:t,method:"POST",body:r})}async function dX({accessToken:t,period:e}={}){return ku("tokentracker-leaderboard-refresh",{accessToken:t,method:"POST",body:e?{period:e}:{}})}async function fX({accessToken:t,userId:e,period:n}={}){if(xr()){const i=yT({seed:t,period:n,metric:"all",limit:250,offset:0}),s=(Array.isArray(i?.entries)?i.entries:[]).find(o=>o?.user_id===e)||null;return{period:i?.period??"week",from:i?.from??null,to:i?.to??null,generated_at:i?.generated_at??new Date().toISOString(),entry:s}}return ku("tokentracker-leaderboard-profile",{accessToken:t,params:{user_id:e,period:n}})}async function hX(t={}){if(xr()){const e=new Date().toISOString();return{user_id:"local-user",created_at:e,pro:{active:!1,sources:[],expires_at:null,partial:!1,as_of:e},subscriptions:{partial:!1,as_of:e,items:[]},install:{partial:!1,as_of:e,has_active_device_token:!1,has_active_device:!1,active_device_tokens:0,active_devices:0,latest_token_activity_at:null,latest_device_seen_at:null}}}return $s(ms.userStatus)}async function pX({signal:t}={}){const e=await fetch(`/functions/${ms.localSync}`,{method:"POST",headers:{Accept:"application/json"},cache:"no-store",signal:t}),n=await e.json().catch(()=>({ok:!1,error:`Local sync request failed with HTTP ${e.status}`}));if(!e.ok||n?.ok===!1){const i=n?.error||n?.message||`Local sync request failed with HTTP ${e.status}`,r=new Error(i);throw r.status=e.status,r}return n}async function mX({from:t,to:e,source:n,timeZone:i,tzOffsetMinutes:r,accessToken:s}={}){if(xr())return uU({from:t,to:e,seed:s});const o=ko({timeZone:i,tzOffsetMinutes:r}),c=Lo({source:n});return $s(ms.usageModelBreakdown,{from:t,to:e,...c,...o})}async function gX({from:t,to:e,source:n,model:i,timeZone:r,tzOffsetMinutes:s,accessToken:o}={}){if(xr())return nU({from:t,to:e,seed:o});const c=ko({timeZone:r,tzOffsetMinutes:s}),u=Lo({source:n,model:i});return $s(ms.usageDaily,{from:t,to:e,...u,...c})}async function vX({day:t,source:e,model:n,timeZone:i,tzOffsetMinutes:r,accessToken:s}={}){if(xr())return iU({day:t,seed:s});const o=ko({timeZone:i,tzOffsetMinutes:r}),c=Lo({source:e,model:n}),u=t?{day:t,...c,...o}:{...c,...o};return $s(ms.usageHourly,u)}async function yX({months:t,to:e,source:n,model:i,timeZone:r,tzOffsetMinutes:s,accessToken:o}={}){if(xr())return rU({months:t,to:e,seed:o});const c=ko({timeZone:r,tzOffsetMinutes:s}),u=Lo({source:n,model:i});return $s(ms.usageMonthly,{...t?{months:String(t)}:{},...e?{to:e}:{},...u,...c})}async function _X(t={}){const e=t?.refresh?{refresh:"1"}:void 0;return $s(ms.usageLimits,e)}async function xX({weeks:t,to:e,weekStartsOn:n,source:i,model:r,timeZone:s,tzOffsetMinutes:o,accessToken:c}={}){if(xr())return cU({weeks:t,to:e,weekStartsOn:n,seed:c});const u=ko({timeZone:s,tzOffsetMinutes:o}),d=Lo({source:i,model:r});return $s(ms.usageHeatmap,{weeks:String(t),to:e,week_starts_on:n,...d,...u})}const _T=L.createContext(null);function dU(t){if(!t||typeof t!="object")return"";const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=e.full_name||e.name||n.name||e.user_name||e.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function zS(t){if(!t||typeof t!="object")return null;const e=t,n=e.session&&typeof e.session=="object"?e.session:null,i=typeof e.accessToken=="string"&&e.accessToken||typeof e.access_token=="string"&&e.access_token||n&&typeof n.accessToken=="string"&&n.accessToken||n&&typeof n.access_token=="string"&&n.access_token||null;return i&&i.length>0?i:null}async function zm(t,e={}){if(!t)return null;const n=Math.max(0,Math.floor(Number(e.skewMs)||6e4)),i=t.tokenManager,r=()=>i?.getAccessToken?.()??i?.getSession?.()?.accessToken??null;let s=r();if(!s||II(s,n)){const{data:o}=await t.auth.refreshSession();if(s=r()??zS(o)??null,!s&&typeof t.auth.getCurrentUser=="function")try{await t.auth.getCurrentUser(),s=r()??zS(o)??null}catch{}}return s||null}function fU({children:t}){const[e,n]=L.useState(null),[i,r]=L.useState(null),[s,o]=L.useState(!0);L.useEffect(()=>{if(!u0()){n(null),r(null),o(!1);return}n(CI())},[]),L.useEffect(()=>{if(!e)return;let k=!0;return o(!0),(async()=>{try{let{data:U,error:S}=await e.auth.getCurrentUser();if(!k)return;if(!S&&!U?.user){if(await new Promise(V=>setTimeout(V,150)),!k)return;const P=await e.auth.getCurrentUser();U=P.data,S=P.error}if(S){r(null);return}r(U?.user??null)}catch{k&&r(null)}finally{k&&o(!1)}})(),()=>{k=!1}},[e]);const c=L.useCallback(async()=>{if(e)try{let{data:k,error:U}=await e.auth.getCurrentUser();if(!U&&!k?.user){await new Promise(P=>setTimeout(P,150));const S=await e.auth.getCurrentUser();k=S.data,U=S.error}if(U){r(null);return}r(k?.user??null)}catch{r(null)}},[e]),u=L.useCallback(async(k,U)=>{if(!e)return{error:new Error("InsForge client not configured")};const S=typeof window<"u"&&window.webkit?.messageHandlers?.nativeOAuth;if(S){const O=typeof U=="string"&&U.trim()?U.trim():`${window.location.origin}/auth/callback`,G=await e.auth.signInWithOAuth({provider:k,redirectTo:O,skipBrowserRedirect:!0});if(G.data?.url){try{await fetch("/api/auth-bridge/verifier",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({native:!0})})}catch{}S.postMessage(G.data.url)}return G}const P=typeof U=="string"&&U.trim()?U.trim():typeof window<"u"?`${window.location.origin}/dashboard`:void 0;return await e.auth.signInWithOAuth({provider:k,redirectTo:P})},[e]),d=L.useCallback(async k=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:S}=await e.auth.signInWithPassword(k);return U?.user&&r(U.user),{data:U,error:S}},[e]),h=L.useCallback(async k=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:S}=await e.auth.signUp(k);return U?.user&&U?.accessToken&&r(U.user),{data:U,error:S}},[e]),p=L.useCallback(async()=>e?e.auth.getPublicAuthConfig():{data:null,error:new Error("InsForge client not configured")},[e]),m=L.useCallback(async()=>{e&&(await e.auth.signOut(),kI(),r(null))},[e]),v=L.useCallback(async()=>zm(e),[e]),[_,w]=L.useState(null),[y,b]=L.useState(!1),T=L.useMemo(()=>dU(i),[i]);L.useEffect(()=>{if(!i||!e){w(null),b(!1);return}let k=!0;return(async()=>{try{const U=await zm(e);if(!k||!U){k&&b(!0);return}const S=await BS({accessToken:U});k&&S?.display_name&&w(S.display_name)}catch{}k&&b(!0)})(),()=>{k=!1}},[i,e]);const A=y?_||T:"",M=L.useCallback(async()=>{if(e)try{const k=await zm(e);if(!k)return;const U=await BS({accessToken:k});U?.display_name&&w(U.display_name)}catch{}},[e]),I=L.useMemo(()=>!u0()||!e?{enabled:!1,client:null,user:null,signedIn:!1,loading:!1,displayName:"",refreshUser:async()=>{},refreshDisplayName:async()=>{},signInWithOAuth:async()=>({error:new Error("InsForge not configured")}),signInWithPassword:async()=>({data:null,error:new Error("InsForge not configured")}),signUp:async()=>({data:null,error:new Error("InsForge not configured")}),getPublicAuthConfig:async()=>({data:null,error:new Error("InsForge not configured")}),signOut:async()=>{},getAccessToken:async()=>null}:{enabled:!0,client:e,user:i,signedIn:!!i,loading:s,displayName:A,refreshUser:c,refreshDisplayName:M,signInWithOAuth:u,signInWithPassword:d,signUp:h,getPublicAuthConfig:p,signOut:m,getAccessToken:v},[e,i,s,A,c,M,u,d,h,p,m,v]);return F.jsx(_T.Provider,{value:I,children:t})}function Do(){return L.useContext(_T)}const hU="modulepreload",pU=function(t){return"/"+t},VS={},No=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=o?.nonce||o?.getAttribute("nonce");r=u(n.map(d=>{if(d=pU(d),d in VS)return;VS[d]=!0;const h=d.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":hU,h||(m.as="script"),m.crossOrigin="",m.href=d,c&&m.setAttribute("nonce",c),document.head.appendChild(m),h)return new Promise((v,_)=>{m.addEventListener("load",v),m.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return r.then(o=>{for(const c of o||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};var lh={},mU=()=>{window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)})},gU="@vercel/analytics",vU="2.0.1";function xT(){return typeof window<"u"}function bT(){try{const t="production"}catch{}return"production"}function yU(t="auto"){if(t==="auto"){window.vam=bT();return}window.vam=t}function _U(){return(xT()?window.vam:bT())||"production"}function hy(){return _U()==="development"}function xU(t){return t.scriptSrc?Pl(t.scriptSrc):hy()?"https://va.vercel-scripts.com/v1/script.debug.js":t.basePath?Pl(`${t.basePath}/insights/script.js`):"/_vercel/insights/script.js"}function bU(t,e){var n;let i=t;if(e)try{i={...(n=JSON.parse(e))==null?void 0:n.analytics,...t}}catch{}yU(i.mode);const r={sdkn:gU+(i.framework?`/${i.framework}`:""),sdkv:vU};return i.disableAutoTrack&&(r.disableAutoTrack="1"),i.viewEndpoint&&(r.viewEndpoint=Pl(i.viewEndpoint)),i.eventEndpoint&&(r.eventEndpoint=Pl(i.eventEndpoint)),i.sessionEndpoint&&(r.sessionEndpoint=Pl(i.sessionEndpoint)),hy()&&i.debug===!1&&(r.debug="false"),i.dsn&&(r.dsn=i.dsn),i.endpoint?r.endpoint=i.endpoint:i.basePath&&(r.endpoint=Pl(`${i.basePath}/insights`)),{beforeSend:i.beforeSend,src:xU(i),dataset:r}}function Pl(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?t:`/${t}`}function SU(t={debug:!0},e){var n;if(!xT())return;const{beforeSend:i,src:r,dataset:s}=bU(t,e);if(mU(),i&&((n=window.va)==null||n.call(window,"beforeSend",i)),document.head.querySelector(`script[src*="${r}"]`))return;const o=document.createElement("script");o.src=r;for(const[c,u]of Object.entries(s))o.dataset[c]=u;o.defer=!0,o.onerror=()=>{const c=hy()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${r}. ${c}`)},document.head.appendChild(o)}function wU({route:t,path:e}){var n;(n=window.va)==null||n.call(window,"pageview",{route:t,path:e})}function EU(){if(!(typeof process>"u"||typeof lh>"u"))return lh.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function MU(){if(!(typeof process>"u"||typeof lh>"u"))return lh.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function TU(t){return L.useEffect(()=>{var e;t.beforeSend&&((e=window.va)==null||e.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]),L.useEffect(()=>{SU({framework:t.framework||"react",basePath:t.basePath??EU(),...t.route!==void 0&&{disableAutoTrack:!0},...t},t.configString??MU())},[]),L.useEffect(()=>{t.route&&t.path&&wU({route:t.route,path:t.path})},[t.route,t.path]),null}var ch={},AU=()=>{window.si||(window.si=function(...e){window.siq=window.siq||[],window.siq.push(e)})},CU="@vercel/speed-insights",PU="2.0.0";function RU(){return typeof window<"u"}function kU(){try{const t="production"}catch{}return"production"}function ST(){return kU()==="development"}function LU(t){return t.scriptSrc?uh(t.scriptSrc):ST()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":t.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.js":t.basePath?uh(`${t.basePath}/speed-insights/script.js`):"/_vercel/speed-insights/script.js"}function DU(t,e){var n;let i=t;if(e)try{i={...(n=JSON.parse(e))==null?void 0:n.speedInsights,...t}}catch{}const r={sdkn:CU+(i.framework?`/${i.framework}`:""),sdkv:PU};return i.sampleRate&&(r.sampleRate=i.sampleRate.toString()),i.route&&(r.route=i.route),ST()&&i.debug===!1&&(r.debug="false"),i.dsn&&(r.dsn=i.dsn),i.endpoint?r.endpoint=uh(i.endpoint):i.basePath&&(r.endpoint=uh(`${i.basePath}/speed-insights/vitals`)),{src:LU(i),beforeSend:i.beforeSend,dataset:r}}function uh(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?t:`/${t}`}function NU(t={},e){var n;if(!RU()||t.route===null)return null;AU();const{beforeSend:i,src:r,dataset:s}=DU(t,e);if(document.head.querySelector(`script[src*="${r}"]`))return null;i&&((n=window.si)==null||n.call(window,"beforeSend",i));const o=document.createElement("script");o.src=r,o.defer=!0;for(const[c,u]of Object.entries(s))o.dataset[c]=u;return o.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${r}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(o),{setRoute:c=>{o.dataset.route=c??void 0}}}function IU(){if(!(typeof process>"u"||typeof ch>"u"))return ch.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function UU(){if(!(typeof process>"u"||typeof ch>"u"))return ch.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function FU(t){L.useEffect(()=>{var n;t.beforeSend&&((n=window.si)==null||n.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]);const e=L.useRef(null);return L.useEffect(()=>{if(!e.current){const n=NU({framework:t.framework??"react",basePath:t.basePath??IU(),...t},t.configString??UU());n&&(e.current=n.setRoute)}},[t]),L.useEffect(()=>{e.current&&t.route&&e.current(t.route)},[t.route]),null}function Uh(){return typeof window<"u"}function py(t){return wT(t)?(t.nodeName||"").toLowerCase():"#document"}function Kl(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function OU(t){var e;return(e=(wT(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function wT(t){return Uh()?t instanceof Node||t instanceof Kl(t).Node:!1}function ET(t){return Uh()?t instanceof Element||t instanceof Kl(t).Element:!1}function my(t){return Uh()?t instanceof HTMLElement||t instanceof Kl(t).HTMLElement:!1}function HS(t){return!Uh()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Kl(t).ShadowRoot}function MT(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=AT(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&r!=="inline"&&r!=="contents"}function bX(t){return/^(table|td|th)$/.test(py(t))}function BU(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const zU=/transform|translate|scale|rotate|perspective|filter/,VU=/paint|layout|strict|content/,Za=t=>!!t&&t!=="none";let Vm;function HU(t){const e=ET(t)?AT(t):t;return Za(e.transform)||Za(e.translate)||Za(e.scale)||Za(e.rotate)||Za(e.perspective)||!GU()&&(Za(e.backdropFilter)||Za(e.filter))||zU.test(e.willChange||"")||VU.test(e.contain||"")}function SX(t){let e=f0(t);for(;my(e)&&!TT(e);){if(HU(e))return e;if(BU(e))return null;e=f0(e)}return null}function GU(){return Vm==null&&(Vm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Vm}function TT(t){return/^(html|body|#document)$/.test(py(t))}function AT(t){return Kl(t).getComputedStyle(t)}function wX(t){return ET(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function f0(t){if(py(t)==="html")return t;const e=t.assignedSlot||t.parentNode||HS(t)&&t.host||OU(t);return HS(e)?e.host:e}function CT(t){const e=f0(t);return TT(e)?t.ownerDocument?t.ownerDocument.body:t.body:my(e)&&MT(e)?e:CT(e)}function GS(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=CT(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),o=Kl(r);if(s){const c=jU(o);return e.concat(o,o.visualViewport||[],MT(r)?r:[],c&&n?GS(c):[])}else return e.concat(r,GS(r,[],n))}function jU(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const jS={};function gy(t,e){const n=L.useRef(jS);return n.current===jS&&(n.current=t(e)),n}const Hm=BE[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],WU=Hm&&Hm!==L.useLayoutEffect?Hm:t=>t();function WS(t){const e=gy($U).current;return e.next=t,WU(e.effect),e.trampoline}function $U(){const t={next:void 0,callback:XU,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function XU(){}const qU=()=>{},YU=typeof document<"u"?L.useLayoutEffect:qU;function h0(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}const su={};function PT(t,e,n,i,r){let s={...p0(t,su)};return e&&(s=Nf(s,e)),n&&(s=Nf(s,n)),i&&(s=Nf(s,i)),s}function KU(t){if(t.length===0)return su;if(t.length===1)return p0(t[0],su);let e={...p0(t[0],su)};for(let n=1;n<t.length;n+=1)e=Nf(e,t[n]);return e}function Nf(t,e){return RT(e)?e(t):ZU(t,e)}function ZU(t,e){if(!e)return t;for(const n in e){const i=e[n];switch(n){case"style":{t[n]=h0(t.style,i);break}case"className":{t[n]=kT(t.className,i);break}default:JU(n,i)?t[n]=QU(t[n],i):t[n]=i}}return t}function JU(t,e){const n=t.charCodeAt(0),i=t.charCodeAt(1),r=t.charCodeAt(2);return n===111&&i===110&&r>=65&&r<=90&&(typeof e=="function"||typeof e>"u")}function RT(t){return typeof t=="function"}function p0(t,e){return RT(t)?t(e):t??su}function QU(t,e){return e?t?n=>{if(eF(n)){const r=n;m0(r);const s=e(r);return r.baseUIHandlerPrevented||t?.(r),s}const i=e(n);return t?.(n),i}:e:t}function m0(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function kT(t,e){return e?t?e+" "+t:e:t}function eF(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function LT(t,...e){const n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",t.toString()),e.forEach(i=>n.searchParams.append("args[]",i)),`Base UI error #${t}; visit ${n} for the full message.`}const tF=L.createContext(void 0);function nF(t=!1){const e=L.useContext(tF);if(e===void 0&&!t)throw new Error(LT(16));return e}function iF(t){const{focusableWhenDisabled:e,disabled:n,composite:i=!1,tabIndex:r=0,isNativeButton:s}=t,o=i&&e!==!1,c=i&&e===!1;return{props:L.useMemo(()=>{const d={onKeyDown(h){n&&e&&h.key!=="Tab"&&h.preventDefault()}};return i||(d.tabIndex=r,!s&&n&&(d.tabIndex=e?r:-1)),(s&&(e||o)||!s&&n)&&(d["aria-disabled"]=n),s&&(!e||c)&&(d.disabled=n),d},[i,n,e,o,c,s,r])}}function rF(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:i=0,native:r=!0}=t,s=L.useRef(null),o=nF(!0)!==void 0,c=WS(()=>{const m=s.current;return!!(m?.tagName==="A"&&m?.href)}),{props:u}=iF({focusableWhenDisabled:n,disabled:e,composite:o,tabIndex:i,isNativeButton:r}),d=L.useCallback(()=>{const m=s.current;sF(m)&&o&&e&&u.disabled===void 0&&m.disabled&&(m.disabled=!1)},[e,u.disabled,o]);YU(d,[d]);const h=L.useCallback((m={})=>{const{onClick:v,onMouseDown:_,onKeyUp:w,onKeyDown:y,onPointerDown:b,...T}=m;return PT({type:r?"button":void 0,onClick(M){if(e){M.preventDefault();return}v?.(M)},onMouseDown(M){e||_?.(M)},onKeyDown(M){if(e||(m0(M),y?.(M)),M.baseUIHandlerPrevented)return;const I=M.target===M.currentTarget&&!r&&!c()&&!e,k=M.key==="Enter",U=M.key===" ";I&&((U||k)&&M.preventDefault(),k&&v?.(M))},onKeyUp(M){e||(m0(M),w?.(M)),!M.baseUIHandlerPrevented&&M.target===M.currentTarget&&!r&&!e&&M.key===" "&&v?.(M)},onPointerDown(M){if(e){M.preventDefault();return}b?.(M)}},r?void 0:{role:"button"},u,T)},[e,u,r,c]),p=WS(m=>{s.current=m,d()});return{getButtonProps:h,buttonRef:p}}function sF(t){return my(t)&&t.tagName==="BUTTON"}function $S(t,e,n,i){const r=gy(DT).current;return oF(r,t,e,n,i)&&NT(r,[t,e,n,i]),r.callback}function aF(t){const e=gy(DT).current;return lF(e,t)&&NT(e,t),e.callback}function DT(){return{callback:null,cleanup:null,refs:[]}}function oF(t,e,n,i,r){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==i||t.refs[3]!==r}function lF(t,e){return t.refs.length!==e.length||t.refs.some((n,i)=>n!==e[i])}function NT(t,e){if(t.refs=e,e.every(n=>n==null)){t.callback=null;return}t.callback=n=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),n!=null){const i=Array(e.length).fill(null);for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const o=s(n);typeof o=="function"&&(i[r]=o);break}case"object":{s.current=n;break}}}t.cleanup=()=>{for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const o=i[r];typeof o=="function"?o():s(null);break}case"object":{s.current=null;break}}}}}}}const cF=parseInt(L.version,10);function uF(t){return cF>=t}function XS(t){if(!L.isValidElement(t))return null;const e=t,n=e.props;return(uF(19)?n?.ref:e.ref)??null}function dF(t,e){const n={};for(const i in t){const r=t[i];if(e?.hasOwnProperty(i)){const s=e[i](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${i.toLowerCase()}`]="":r&&(n[`data-${i.toLowerCase()}`]=r.toString())}return n}function fF(t,e){return typeof t=="function"?t(e):t}function hF(t,e){return typeof t=="function"?t(e):t}function EX(){}const Ml=Object.freeze({});function pF(t,e,n={}){const i=e.render,r=mF(e,n);if(n.enabled===!1)return null;const s=n.state??Ml;return gF(t,i,r,s)}function mF(t,e={}){const{className:n,style:i,render:r}=t,{state:s=Ml,ref:o,props:c,stateAttributesMapping:u,enabled:d=!0}=e,h=d?fF(n,s):void 0,p=d?hF(i,s):void 0,m=d?dF(s,u):Ml,v=d?h0(m,Array.isArray(c)?KU(c):c)??Ml:Ml;return typeof document<"u"&&(d?Array.isArray(o)?v.ref=aF([v.ref,XS(r),...o]):v.ref=$S(v.ref,XS(r),o):$S(null,null)),d?(h!==void 0&&(v.className=kT(v.className,h)),p!==void 0&&(v.style=h0(v.style,p)),v):Ml}function gF(t,e,n,i){if(e){if(typeof e=="function")return e(n,i);const r=PT(n,e.props);return r.ref=n.ref,L.cloneElement(e,r)}if(t&&typeof t=="string")return vF(t,n);throw new Error(LT(8))}function vF(t,e){return t==="button"?L.createElement("button",{type:"button",...e,key:e.key}):t==="img"?L.createElement("img",{alt:"",...e,key:e.key}):L.createElement(t,e)}const yF=L.forwardRef(function(e,n){const{render:i,className:r,disabled:s=!1,focusableWhenDisabled:o=!1,nativeButton:c=!0,...u}=e,{getButtonProps:d,buttonRef:h}=rF({disabled:s,focusableWhenDisabled:o,native:c}),p=L.useMemo(()=>({disabled:s}),[s]);return pF("button",e,{state:p,ref:[n,h],props:[u,d]})}),_F=`key,module,page,component,slot,text,notes,status
|
|
42
|
+
`);r=c.pop()||"";for(const u of c)if(u.startsWith("data: ")){const d=u.slice(6).trim();if(d)try{const h=JSON.parse(d);if((h.chunk||h.content)&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{content:h.chunk||h.content},finish_reason:null}]}),h.tool_calls?.length&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{tool_calls:h.tool_calls},finish_reason:"tool_calls"}]}),h.done){n.releaseLock();return}}catch{console.warn("Failed to parse SSE data:",d)}}}}finally{n.releaseLock()}}},bI=class{constructor(t){this.http=t}async create(t){const e=await this.http.post("/api/ai/embeddings",t);return{object:e.object,data:e.data,model:e.metadata?.model,usage:e.metadata?.usage?{prompt_tokens:e.metadata.usage.promptTokens||0,total_tokens:e.metadata.usage.totalTokens||0}:{prompt_tokens:0,total_tokens:0}}}},SI=class{constructor(t){this.http=t}async generate(t){const e=await this.http.post("/api/ai/image/generation",t);let n=[];return e.images&&e.images.length>0?n=e.images.map(i=>({b64_json:i.imageUrl.replace(/^data:image\/\w+;base64,/,""),content:e.text})):e.text&&(n=[{content:e.text}]),{created:Math.floor(Date.now()/1e3),data:n,...e.metadata?.usage&&{usage:{total_tokens:e.metadata.usage.totalTokens||0,input_tokens:e.metadata.usage.promptTokens||0,output_tokens:e.metadata.usage.completionTokens||0}}}}},wI=class oT{constructor(e,n){this.http=e,this.functionsUrl=n||oT.deriveSubhostingUrl(e.baseUrl)}static deriveSubhostingUrl(e){try{const{hostname:n}=new URL(e);return n.endsWith(".insforge.app")?`https://${n.split(".")[0]}.functions.insforge.app`:void 0}catch{return}}async invoke(e,n={}){const{method:i="POST",body:r,headers:s={}}=n;if(this.functionsUrl)try{return{data:await this.http.request(i,`${this.functionsUrl}/${e}`,{body:r,headers:s}),error:null}}catch(o){if(o instanceof Error&&o.name==="AbortError")throw o;if(!(o instanceof jt&&o.statusCode===404))return{data:null,error:o instanceof jt?o:new jt(o instanceof Error?o.message:"Function invocation failed",500,"FUNCTION_ERROR")}}try{const o=`/functions/${e}`;return{data:await this.http.request(i,o,{body:r,headers:s}),error:null}}catch(o){if(o instanceof Error&&o.name==="AbortError")throw o;return{data:null,error:o instanceof jt?o:new jt(o instanceof Error?o.message:"Function invocation failed",500,"FUNCTION_ERROR")}}}},IS=1e4,EI=class{constructor(t,e,n){this.socket=null,this.connectPromise=null,this.subscribedChannels=new Set,this.eventListeners=new Map,this.baseUrl=t,this.tokenManager=e,this.anonKey=n,this.tokenManager.onTokenChange=()=>this.onTokenChange()}notifyListeners(t,e){const n=this.eventListeners.get(t);if(n)for(const i of n)try{i(e)}catch(r){console.error(`Error in ${t} callback:`,r)}}connect(){return this.socket?.connected?Promise.resolve():this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((t,e)=>{const n=this.tokenManager.getAccessToken()??this.anonKey;this.socket=Df(this.baseUrl,{transports:["websocket"],auth:n?{token:n}:void 0});let i=!0,r=null;const s=()=>{r&&(clearTimeout(r),r=null)};r=setTimeout(()=>{i&&(i=!1,this.connectPromise=null,this.socket?.disconnect(),this.socket=null,e(new Error(`Connection timeout after ${IS}ms`)))},IS),this.socket.on("connect",()=>{s();for(const o of this.subscribedChannels)this.socket.emit("realtime:subscribe",{channel:o});this.notifyListeners("connect"),i&&(i=!1,this.connectPromise=null,t())}),this.socket.on("connect_error",o=>{s(),this.notifyListeners("connect_error",o),i&&(i=!1,this.connectPromise=null,e(o))}),this.socket.on("disconnect",o=>{this.notifyListeners("disconnect",o)}),this.socket.on("realtime:error",o=>{this.notifyListeners("error",o)}),this.socket.onAny((o,c)=>{o!=="realtime:error"&&this.notifyListeners(o,c)})}),this.connectPromise)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null),this.subscribedChannels.clear()}onTokenChange(){const t=this.tokenManager.getAccessToken()??this.anonKey;this.socket&&(this.socket.auth=t?{token:t}:{}),this.socket&&(this.socket.connected||this.connectPromise)&&(this.socket.disconnect(),this.socket.connect())}get isConnected(){return this.socket?.connected??!1}get connectionState(){return this.socket?this.socket.connected?"connected":"connecting":"disconnected"}get socketId(){return this.socket?.id}async subscribe(t){if(this.subscribedChannels.has(t))return{ok:!0,channel:t};if(!this.socket?.connected)try{await this.connect()}catch(e){const n=e instanceof Error?e.message:"Connection failed";return{ok:!1,channel:t,error:{code:"CONNECTION_FAILED",message:n}}}return new Promise(e=>{this.socket.emit("realtime:subscribe",{channel:t},n=>{n.ok&&this.subscribedChannels.add(t),e(n)})})}unsubscribe(t){this.subscribedChannels.delete(t),this.socket?.connected&&this.socket.emit("realtime:unsubscribe",{channel:t})}async publish(t,e,n){if(!this.socket?.connected)throw new Error("Not connected to realtime server. Call connect() first.");this.socket.emit("realtime:publish",{channel:t,event:e,payload:n})}on(t,e){this.eventListeners.has(t)||this.eventListeners.set(t,new Set),this.eventListeners.get(t).add(e)}off(t,e){const n=this.eventListeners.get(t);n&&(n.delete(e),n.size===0&&this.eventListeners.delete(t))}once(t,e){const n=i=>{this.off(t,n),e(i)};this.on(t,n)}getSubscribedChannels(){return Array.from(this.subscribedChannels)}},MI=class{constructor(t){this.http=t}async send(t){try{return{data:await this.http.post("/api/email/send-raw",t),error:null}}catch(e){if(e instanceof Error&&e.name==="AbortError")throw e;return{data:null,error:e instanceof jt?e:new jt(e instanceof Error?e.message:"Email send failed",500,"EMAIL_ERROR")}}}},TI=class{constructor(t={}){const e=new tT(t.debug);this.tokenManager=new sT,this.http=new lI(t,this.tokenManager,e),t.edgeFunctionToken&&(this.http.setAuthToken(t.edgeFunctionToken),this.tokenManager.setAccessToken(t.edgeFunctionToken)),this.auth=new hI(this.http,this.tokenManager,{isServerMode:t.isServerMode??!1}),this.database=new mI(this.http,this.tokenManager),this.storage=new vI(this.http),this.ai=new yI(this.http),this.functions=new wI(this.http,t.functionsUrl),this.realtime=new EI(this.http.baseUrl,this.tokenManager,t.anonKey),this.emails=new MI(this.http)}getHttpClient(){return this.http}};function AI(t){return new TI(t)}const cy={VITE_INSFORGE_ANON_KEY:"ik_9f35735991b684f7cf57fa00bb4d0487",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function Ro(){const t=typeof import.meta<"u"?cy:void 0;return(t?.VITE_INSFORGE_BASE_URL||t?.VITE_TOKENTRACKER_BACKEND_BASE_URL||"").trim()}function lT(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return window.location.origin;const e=typeof import.meta<"u"?cy:void 0;return(e?.VITE_INSFORGE_BASE_URL||e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||"").trim()}function Nh(){const t=typeof import.meta<"u"?cy:void 0;return(t?.VITE_INSFORGE_ANON_KEY||t?.VITE_TOKENTRACKER_BACKEND_ANON_KEY||"").trim()}function u0(){return!!lT()}let Om=null;function CI(){return u0()?(Om||(Om=AI({baseUrl:lT(),anonKey:Nh()||void 0,autoRefreshToken:!0})),Om):null}const cT="tokentracker_cloud_sync_enabled",uy="tokentracker_cloud_device_session_v1",dy="tokentracker_cloud_last_sync_ts";function PI(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"}function RI(){try{const t=localStorage.getItem(cT);return t===null||t===""?!1:t==="1"||t==="true"}catch{return!1}}function q$(t){try{localStorage.setItem(cT,t?"1":"0")}catch{}}function uT(){try{const t=localStorage.getItem(uy);if(!t)return null;const e=JSON.parse(t);if(typeof e?.token=="string"&&e.token&&typeof e.deviceId=="string")return e}catch{}return null}function dT(t){try{localStorage.setItem(uy,JSON.stringify(t))}catch{}}function kI(){try{localStorage.removeItem(uy),localStorage.removeItem(dy)}catch{}}function LI(){try{const t=Number(localStorage.getItem(dy));return Number.isFinite(t)?t:0}catch{return 0}}function fT(t){try{localStorage.setItem(dy,String(t))}catch{}}function Ta(t){if(typeof t!="string")return null;const e=t.trim();return e.length>0?e:null}function DI(t){const e=Ta(t);if(!e)return null;const n=e.split(".");if(n.length<2)return null;const i=n[1];try{const r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),s=typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("utf8"),c=JSON.parse(s)?.exp;return typeof c!="number"||!Number.isFinite(c)||c<=0?null:Math.floor(c*1e3)}catch{return null}}function NI(t){const e=Ta(t);if(!e)return!1;const n=e.split(".");if(n.length!==3)return!1;try{for(let i=0;i<2;i++){const r=n[i];if(!/^[A-Za-z0-9_-]+$/.test(r))return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=typeof atob=="function"?atob(s):Buffer.from(s,"base64").toString("utf8");i===1&&JSON.parse(o)}return!0}catch{return!1}}function II(t,e=3e4){const n=DI(t);return n?n<=Date.now()+Math.max(0,Number(e)||0):!1}async function UI(t){if(!t)return null;if(typeof t=="string")return Ta(t);if(typeof t=="function")try{const e=await t();return Ta(e)}catch{return null}if(typeof t=="object"){if(typeof t.getAccessToken=="function"){try{const e=await t.getAccessToken(),n=Ta(e);if(n)return n}catch{}return Ta(t.accessToken)}return null}return Ta(t)}async function Y$(t,e={}){const n=Math.max(1,Math.min(12,Math.floor(Number(e.maxAttempts)||8))),i=Math.max(20,Math.floor(Number(e.baseDelayMs)||50));for(let r=0;r<n;r++){const s=await UI(t);if(s)return s;r<n-1&&await new Promise(o=>setTimeout(o,i*(r+1)))}return null}function K$(t){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")||typeof t=="function"||t&&typeof t=="object"&&typeof t.getAccessToken=="function"?!0:!!Ta(t)}function Z$(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function J$(t=new Date){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return 0;const n=e.getTimezoneOffset();return Number.isFinite(n)?-n:0}function hT(t){if(!Number.isFinite(t)||t===0)return"UTC";const e=t>=0?"+":"-",n=Math.abs(t),i=String(Math.floor(n/60)).padStart(2,"0"),r=String(n%60).padStart(2,"0");return`UTC${e}${i}:${r}`}function Q$({timeZone:t,offsetMinutes:e}={}){const n=hT(e);return t&&t!=="UTC"?`${t} (${n})`:n}function eX({timeZone:t,offsetMinutes:e}={}){return Number.isFinite(e)?hT(e):t||"UTC"}function tX({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const i=n instanceof Date?n:new Date(n);if(!Number.isFinite(i.getTime()))return"";if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const o=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((h,p)=>(p.type&&p.value&&(h[p.type]=p.value),h),{}),c=o.year,u=o.month,d=o.day;if(c&&u&&d)return`${c}-${u}-${d}`}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(i.getTime()+e*6e4);return OI(r)}return BI(i)}function FI({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const i=n instanceof Date?n:new Date(n);if(!Number.isFinite(i.getTime()))return null;if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const o=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((h,p)=>(p.type&&p.value&&(h[p.type]=p.value),h),{}),c=Number(o.year),u=Number(o.month),d=Number(o.day);if(Number.isFinite(c)&&Number.isFinite(u)&&Number.isFinite(d))return{year:c,month:u,day:d}}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(i.getTime()+e*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate()}}return{year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()}}function nX({timeZone:t,offsetMinutes:e}={}){return t?`tz:${t}`:typeof e=="number"&&Number.isFinite(e)?`offset:${Math.trunc(e)}`:"utc"}function OI(t){const e=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),i=String(t.getUTCDate()).padStart(2,"0");return`${e}-${n}-${i}`}function BI(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${i}`}function kn(t){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())).toISOString().slice(0,10)}function ps(t){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return"";const n=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${n}-${i}-${r}`}function zI(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const i=Number(n[0]),r=Number(n[1])-1,s=Number(n[2]);if(!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(s))return null;const o=new Date(Date.UTC(i,r,s));return Number.isFinite(o.getTime())&&kn(o)===e?o:null}function VI(t){if(!t)return"";const e=t.year,n=String(t.month).padStart(2,"0"),i=String(t.day).padStart(2,"0");return!e||!n||!i?"":`${e}-${n}-${i}`}function HI(t,{timeZone:e,offsetMinutes:n,now:i}={}){const r=i instanceof Date&&Number.isFinite(i.getTime())?i:new Date,s=FI({timeZone:e,offsetMinutes:n,date:r});if(!s){const u=ps(new Date);return{from:u,to:u}}const o=VI(s),c=zI(o);if(!c)return{from:o,to:o};if(t==="day")return{from:o,to:o};if(t==="week"){const u=new Date(c),h=(u.getUTCDay()+6)%7;u.setUTCDate(u.getUTCDate()-h);const p=new Date(u);return p.setUTCDate(p.getUTCDate()+6),{from:kn(u),to:kn(p)}}if(t==="month"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),1)),d=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()+1,0));return{from:kn(u),to:kn(d)}}if(t==="total"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()-23,1));return{from:kn(u),to:o}}return HI("week")}function iX(t){if(t==null)return"-";try{if(typeof t=="bigint")return new Intl.NumberFormat().format(t);if(typeof t=="number")return new Intl.NumberFormat().format(t);const e=String(t).trim();return/^[0-9]+$/.test(e)?new Intl.NumberFormat().format(BigInt(e)):e}catch{return String(t)}}function rX(t,{thousandSuffix:e="K",millionSuffix:n="M",billionSuffix:i="B",decimals:r=1}={}){const s=Number(String(t));if(!Number.isFinite(s))return"-";const o=s<0?"-":"",c=Math.abs(s),u=Math.max(0,Math.min(6,Math.floor(r)));if(c<1e3)return`${o}${String(c)}`;const d=(v,_)=>{const w=v.toFixed(u),y=Number(w).toString();return`${o}${y}${_}`},h=(v,_,w)=>{const y=v.toFixed(u),b=Number(y);return w&&b>=1e3?d(b/1e3,w):`${o}${b.toString()}${_}`};if(c>=1e9)return d(c/1e9,i);if(c>=1e6)return h(c/1e6,n,i);const p=c/1e3,m=Number(p.toFixed(u));return m>=1e3?d(m/1e3,n):d(m,e)}function pT(t){const e=Number(String(t));return Number.isFinite(e)?e:null}function sX(t,{decimals:e=2}={}){if(t==null)return"-";const n=String(t).trim();if(!n)return"-";const i=n.match(/^(-?\d+)(?:\.(\d+))?$/);if(!i)return n;const r=i[1],s=i[2]||"";let o=r;try{o=new Intl.NumberFormat().format(BigInt(r))}catch{o=r}const c=Math.max(0,Math.min(6,Math.floor(e))),u=c?s.slice(0,c).padEnd(c,"0"):"",d=r.startsWith("-")?"-":"",h=c?`${o.replace("-","")}.${u}`:o.replace("-","");return`${d}$${h}`}function oh(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),i=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,i,r));return Number.isFinite(s.getTime())&&kn(s)===t.trim()?s:null}function fo(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function GI(t,e){const n=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return Math.floor(n/864e5)}function Bm(t,e){if(!Array.isArray(t)||t.length===0)return 0;const n=t.length,i=(n-1)*e,r=Math.floor(i),s=i-r,o=t[r]??t[n-1],c=t[Math.min(n-1,r+1)]??t[n-1];return Math.round(o+(c-o)*s)}function jI(t){return t<=0?0:t>=4?4:t}function mT({weeks:t=52,now:e,weekStartsOn:n="sun"}={}){const i=e instanceof Date&&Number.isFinite(e.getTime())?e:new Date,r=ps(i),s=oh(r)||new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),o=n==="mon"?1:0,c=s.getUTCDay(),u=fo(s,-((c-o+7)%7)),d=fo(u,-7*(Math.max(1,t)-1));return{from:kn(d),to:r}}function WI({dailyRows:t,weeks:e=52,to:n,weekStartsOn:i="sun"}={}){const r=oh(n)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:s}=mT({weeks:e,now:r,weekStartsOn:i}),o=oh(s)||fo(r,-(e*7-1)),c=(()=>{const M=(o.getUTCDay()-(i==="mon"?1:0)+7)%7;return fo(o,-M)})(),u=new Map;for(const T of Array.isArray(t)?t:[]){const A=typeof T?.day=="string"?T.day:null;if(!A)continue;const M=pT(T?.billable_total_tokens??T?.total_tokens)??0;u.set(A,Math.max(0,M))}const d=GI(c,r)+1,h=Math.ceil(d/7),p=[];for(let T=0;T<d;T++){const A=fo(c,T),M=kn(A),I=u.get(M)??0;I>0&&p.push(I)}p.sort((T,A)=>T-A);const m=Bm(p,.5),v=Bm(p,.75),_=Bm(p,.9);function w(T){return!T||T<=0?0:T<=m?1:T<=v?2:T<=_?3:4}const y=[];for(let T=0;T<h;T++){const A=[];for(let M=0;M<7;M++){const I=T*7+M,k=fo(c,I);if(k.getTime()>r.getTime()){A.push(null);continue}const U=kn(k),S=u.get(U)??0;A.push({day:U,value:S,level:jI(w(S))})}y.push(A)}const b=y.length>e?y.slice(y.length-e):y;return{from:s,to:kn(r),weeks:b,thresholds:{t1:m,t2:v,t3:_}}}function $I({dailyRows:t,to:e}={}){const n=oh(e)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),i=new Map;for(const s of Array.isArray(t)?t:[]){const o=typeof s?.day=="string"?s.day:null;if(!o)continue;const c=pT(s?.billable_total_tokens??s?.total_tokens)??0;i.set(o,Math.max(0,c))}let r=0;for(let s=0;s<370;s++){const o=kn(fo(n,-s));if((i.get(o)??0)>0){r+=1;continue}break}return r}const Ih={},gT="tokentracker",XI=["victorgpt/tokentracker","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],US=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function xr(){if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock")||"").toLowerCase();if(e==="0"||e==="false"||e==="off"||e==="no")return!1;if(e==="1"||e==="true"||e==="on"||e==="yes")return!0}if(typeof import.meta<"u"&&Ih){const t="".toLowerCase();if(t==="1"||t==="true")return!0}return!1}function qI(){if(typeof import.meta<"u"&&Ih){const t="".trim();if(t)return t;const e="".trim();if(e)return e}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_now")||"").trim();if(e)return e;const n=String(t.get("mock_today")||"").trim();if(n)return n}return""}function YI(t){if(!t)return null;const e=String(t).trim();if(!e)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[i,r,s]=e.split("-").map(Number);if(!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(s))return null;const o=new Date(i,r-1,s,12,0,0);return Number.isFinite(o.getTime())?o:null}const n=new Date(e);return Number.isFinite(n.getTime())?n:null}function aX(){return xr()?YI(qI()):null}function KI(){if(typeof import.meta<"u"&&Ih){const t="".trim();if(t)return t}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_seed")||"").trim();if(e)return e}return gT}function ZI(){if(typeof import.meta<"u"&&Ih){const t="".trim(),e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_missing")||"").trim(),n=Number(e);if(Number.isFinite(n)&&n>0)return Math.floor(n)}return 0}function Pu(t){return(t==null?KI():String(t)).trim()||gT}function Ru(t){let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function ki(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),i=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,i,r));return Number.isFinite(s.getTime())&&kn(s)===t.trim()?s:null}function mu(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function vT(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+e,1))}function JI(t){return`${t.getUTCFullYear()}-${String(t.getUTCMonth()+1).padStart(2,"0")}`}function Vl({from:t,to:e,seed:n}){const i=ki(ps(new Date))||new Date,r=ki(t)||i,s=ki(e)||r,o=[],c=Pu(n),u=Math.floor((Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())-Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()))/864e5)+1;for(let d=0;d<u;d+=1){const h=mu(r,d),p=kn(h),m=Ru(`${c}:${p}`),v=m%1e3/1e3,_=.6+.4*Math.sin(d/6*Math.PI*.5),w=h.getUTCDay()===0||h.getUTCDay()===6?.65:1,y=18e3+Math.round(12e3*v),b=Math.max(0,Math.round(y*_*w)),T=Math.round(b*.46),A=Math.round(b*.34),M=Math.round(b*.14),I=Math.max(0,b-T-A-M);o.push({day:p,total_tokens:b,billable_total_tokens:b,input_tokens:T,output_tokens:A,cached_input_tokens:M,reasoning_output_tokens:I,conversation_count:1+m%5})}return o}function QI({day:t,seed:e}){const n=ki(t)||ki(ps(new Date))||new Date,i=kn(n),r=Pu(e),s=Array.from({length:48},(c,u)=>{const d=Math.floor(u/2),h=u%2===0?0:30,m=Ru(`${r}:${i}:${d}:${h}`)%1e3/1e3,v=(d+h/60)/24,_=.4+.6*Math.sin(v*Math.PI*2),w=900+Math.round(700*m),y=Math.max(0,Math.round(w*_)),b=Math.round(y*.46),T=Math.round(y*.34),A=Math.round(y*.14),M=Math.max(0,y-b-T-A);return{hour:`${i}T${String(d).padStart(2,"0")}:${String(h).padStart(2,"0")}:00`,total_tokens:y,billable_total_tokens:y,input_tokens:b,output_tokens:T,cached_input_tokens:A,reasoning_output_tokens:M}}),o=Math.max(0,Math.min(48,ZI()));if(o>0){const c=Date.now(),u=s.map((p,m)=>{const v=Date.parse(p.hour);return Number.isFinite(v)&&v<=c?{index:m,ts:v}:null}).filter(Boolean),d=Math.max(0,u.length-o),h=u.slice(d);for(const p of h){const m=s[p.index];m&&(s[p.index]={...m,missing:!0})}}return s}function eU({months:t=24,to:e,seed:n}){const i=ki(e)||ki(ps(new Date))||new Date,r=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),s=Pu(n),o=[];for(let c=t-1;c>=0;c-=1){const u=vT(r,-c),d=JI(u),p=Ru(`${s}:${d}`)%1e3/1e3,m=.7+.3*Math.sin(o.length/6*Math.PI*.5),v=36e4+Math.round(2e5*p),_=Math.max(0,Math.round(v*m)),w=Math.round(_*.46),y=Math.round(_*.34),b=Math.round(_*.14),T=Math.max(0,_-w-y-b);o.push({month:d,total_tokens:_,billable_total_tokens:_,input_tokens:w,output_tokens:y,cached_input_tokens:b,reasoning_output_tokens:T})}return o}function fy(t){return t.reduce((e,n)=>(e.total_tokens+=Number(n.total_tokens||0),e.billable_total_tokens+=Number(n.billable_total_tokens||n.total_tokens||0),e.input_tokens+=Number(n.input_tokens||0),e.output_tokens+=Number(n.output_tokens||0),e.cached_input_tokens+=Number(n.cached_input_tokens||0),e.reasoning_output_tokens+=Number(n.reasoning_output_tokens||0),e.conversation_count+=Number(n.conversation_count||0),e),{total_tokens:0,billable_total_tokens:0,input_tokens:0,output_tokens:0,cached_input_tokens:0,reasoning_output_tokens:0,conversation_count:0})}function tU(t,e=1.75){const n=Number(t||0);return!Number.isFinite(n)||n<=0?"0.000000":(n*e/1e6).toFixed(6)}function FS(t,e){const n=Number.isFinite(e)?e:0;return{total_tokens:Math.max(0,Math.round(t.total_tokens*n)),billable_total_tokens:Math.max(0,Math.round((t.billable_total_tokens??t.total_tokens)*n)),input_tokens:Math.max(0,Math.round(t.input_tokens*n)),output_tokens:Math.max(0,Math.round(t.output_tokens*n)),cached_input_tokens:Math.max(0,Math.round(t.cached_input_tokens*n)),reasoning_output_tokens:Math.max(0,Math.round(t.reasoning_output_tokens*n))}}function d0(t){return{...t,total_cost_usd:tU(t.total_tokens)}}function nU({from:t,to:e,seed:n}={}){const i=Vl({from:t,to:e,seed:n});return{from:t,to:e,data:i}}function iU({day:t,seed:e}={}){const n=ki(t)||new Date,i=kn(n),r=QI({day:i,seed:e});return{day:i,data:r}}function rU({months:t=24,to:e,seed:n}={}){const i=ki(e)||ki(ps(new Date))||new Date,r=kn(i),s=eU({months:t,to:r,seed:n}),o=vT(new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),-(t-1));return{from:kn(o),to:r,months:t,data:s}}function sU({from:t,to:e,seed:n,rolling:i=!0}={}){const r=Vl({from:t,to:e,seed:n}),s=fy(r),o=d0(s),c=i?aU({to:e,seed:n}):null;return{from:t,to:e,days:r.length,totals:o,...c?{rolling:c}:{}}}function aU({to:t,seed:e}={}){const n=ki(t)||ki(ps(new Date))||new Date,i=kn(n),r=kn(mu(n,-6)),s=kn(mu(n,-29)),o=Vl({from:r,to:i,seed:e}),c=Vl({from:s,to:i,seed:e});return{last_7d:OS({rows:o,from:r,to:i}),last_30d:OS({rows:c,from:s,to:i})}}function OS({rows:t,from:e,to:n}={}){const i=fy(t||[]),r=(t||[]).filter(o=>Number(o.billable_total_tokens??o.total_tokens)>0).length,s=r>0?Math.floor(i.billable_total_tokens/r):0;return{from:e,to:n,totals:{billable_total_tokens:i.billable_total_tokens,conversation_count:i.conversation_count},active_days:r,avg_per_active_day:s}}function oU({seed:t,limit:e=3}={}){const n=Pu(t),i=XI.map((r,s)=>{const c=12e4+Ru(`${n}:${r}`)%9e5,u=s%4*4200,d=Math.max(0,c+u),h=Math.max(0,Math.round(d*.96));return{project_key:r,project_ref:`https://github.com/${r}`,total_tokens:String(d),billable_total_tokens:String(h)}}).sort((r,s)=>Number(s.billable_total_tokens)-Number(r.billable_total_tokens)).slice(0,Math.max(1,Math.min(10,Math.floor(Number(e)||3))));return{generated_at:new Date().toISOString(),entries:i}}function lU(t){const e=ki(ps(new Date))||new Date,n=String(t).trim().toLowerCase()||"week";if(n==="total")return{from:"1970-01-01",to:"9999-12-31"};if(n==="month"){const o=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),c=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0));return{from:kn(o),to:kn(c)}}const i=e.getUTCDay(),r=kn(mu(e,-i)),s=kn(mu(e,-i+6));return{from:r,to:s}}function yT({seed:t,period:e,metric:n,limit:i=20,offset:r=0}={}){const s=Pu(t),o=Math.max(1,Math.min(100,Math.floor(Number(i)||20))),c=Math.max(0,Math.min(1e4,Math.floor(Number(r)||0))),u=String(n||"all").trim().toLowerCase()||"all",d=String(e||"week").trim().toLowerCase()||"week",h=d==="month"||d==="total"||d==="week"?d:"week",{from:p,to:m}=lU(h),v=250,_=v>0?Math.ceil(v/o):0,w=Math.floor(c/o)+1,y=Array.from({length:v},(U,S)=>{const P=S+1,V=`00000000-0000-0000-0000-${String(P).padStart(12,"0")}`,O=US[P%US.length],J=18e4+Ru(`${s}:${O}:${P}`)%9e5,H=Math.max(0,J+P*1200),X=Math.floor(H*.28),K=Math.floor(H*.18),Q=Math.floor(H*.1),W=Math.floor(H*.1),q=Math.floor(H*.08),Z=Math.floor(H*.03),z=Math.floor(H*.02),ie=Math.floor(H*.04),we=Math.floor(H*.03),He=Math.max(0,H-X-K-Q-W-q-Z-z-ie-we),Se=P%7!==0;return{id:P,user_id:V,is_public:Se,is_me:!1,display_name:Se?O:"Anonymous",avatar_url:null,gpt_tokens:X,claude_tokens:K,gemini_tokens:Q,cursor_tokens:W,opencode_tokens:q,openclaw_tokens:He,hermes_tokens:Z,kiro_tokens:z,copilot_tokens:ie,kimi_tokens:we,other_tokens:0,total_tokens:H}}),b=Math.max(0,Math.min(v-1,Math.floor(v*.8)));y[b]&&(y[b].is_me=!0);const T=u==="gpt"||u==="codex"?"gpt_tokens":u==="claude"?"claude_tokens":u==="gemini"?"gemini_tokens":u==="cursor"?"cursor_tokens":u==="opencode"?"opencode_tokens":u==="openclaw"?"openclaw_tokens":u==="hermes"?"hermes_tokens":u==="kiro"?"kiro_tokens":u==="copilot"?"copilot_tokens":u==="kimi"?"kimi_tokens":"total_tokens",A=y.slice().sort((U,S)=>Number(S[T])-Number(U[T])||U.id-S.id).map((U,S)=>({user_id:U.is_public?U.user_id:null,rank:S+1,is_me:!!U.is_me,display_name:U.display_name,avatar_url:U.avatar_url,gpt_tokens:String(U.gpt_tokens),claude_tokens:String(U.claude_tokens),gemini_tokens:String(U.gemini_tokens),cursor_tokens:String(U.cursor_tokens),opencode_tokens:String(U.opencode_tokens),openclaw_tokens:String(U.openclaw_tokens),hermes_tokens:String(U.hermes_tokens??0),kiro_tokens:String(U.kiro_tokens??0),copilot_tokens:String(U.copilot_tokens??0),kimi_tokens:String(U.kimi_tokens??0),other_tokens:String(U.other_tokens??0),total_tokens:String(U.total_tokens),is_public:!!U.is_public})),M=A.find(U=>U?.is_me)||null,I=M?{rank:M.rank,gpt_tokens:M.gpt_tokens,claude_tokens:M.claude_tokens,gemini_tokens:M.gemini_tokens,cursor_tokens:M.cursor_tokens,opencode_tokens:M.opencode_tokens,openclaw_tokens:M.openclaw_tokens,hermes_tokens:M.hermes_tokens,kiro_tokens:M.kiro_tokens,copilot_tokens:M.copilot_tokens,kimi_tokens:M.kimi_tokens,other_tokens:M.other_tokens,total_tokens:M.total_tokens}:{rank:null,gpt_tokens:"0",claude_tokens:"0",gemini_tokens:"0",cursor_tokens:"0",opencode_tokens:"0",openclaw_tokens:"0",hermes_tokens:"0",kiro_tokens:"0",copilot_tokens:"0",kimi_tokens:"0",other_tokens:"0",total_tokens:"0"},k=A.slice(c,c+o);return{period:h,metric:u,from:p,to:m,generated_at:new Date().toISOString(),page:w,limit:o,offset:c,total_entries:v,total_pages:_,entries:k,me:I}}function cU({weeks:t=52,to:e,weekStartsOn:n="sun",seed:i}={}){const r=mT({weeks:t,now:ki(e)||ki(ps(new Date))||new Date,weekStartsOn:n}),s=Vl({from:r.from,to:r.to,seed:i});return{...WI({dailyRows:s,weeks:t,to:r.to,weekStartsOn:n}),week_starts_on:n,active_days:s.filter(c=>Number(c.billable_total_tokens??c.total_tokens)>0).length,streak_days:$I({dailyRows:s,to:r.to})}}function uU({from:t,to:e,seed:n}={}){const i=Vl({from:t,to:e,seed:n}),r=fy(i),o=[{source:"codex",weight:.7,models:[{model:"gpt-5.2-codex",model_id:"gpt-5.2-codex",weight:.2},{model:"unknown",model_id:"unknown",weight:.8}]},{source:"claude",weight:.2,models:[{model:"claude-3.5",model_id:"claude-3.5",weight:.3},{model:"unknown",model_id:"unknown",weight:.7}]},{source:"every-code",weight:.1,models:[{model:"unknown",model_id:"unknown",weight:1}]}].map(c=>{const u=FS(r,c.weight),d=c.models.map(h=>{const p=FS(u,h.weight);return{model:h.model,model_id:h.model_id||h.model,totals:d0(p)}});return{source:c.source,totals:d0(u),models:d}});return{from:t,to:e,days:i.length,sources:o,pricing:{model:"mock",pricing_mode:"add",source:"mock",effective_from:ps(new Date),rates_per_million_usd:{input:"1.750000",cached_input:"0.175000",output:"14.000000",reasoning_output:"14.000000"}}}}const ms={usageSummary:"tokentracker-usage-summary",usageDaily:"tokentracker-usage-daily",usageHourly:"tokentracker-usage-hourly",usageMonthly:"tokentracker-usage-monthly",usageHeatmap:"tokentracker-usage-heatmap",usageModelBreakdown:"tokentracker-usage-model-breakdown",projectUsageSummary:"tokentracker-project-usage-summary",userStatus:"tokentracker-user-status",localSync:"tokentracker-local-sync",usageLimits:"tokentracker-usage-limits"};async function $s(t,e,n){const i=new URL(`/functions/${t}`,window.location.origin);if(e)for(const[s,o]of Object.entries(e))o!=null&&o!==""&&i.searchParams.set(s,String(o));const r=await fetch(i.toString(),{headers:{Accept:"application/json"},cache:"no-store",...n});if(!r.ok){const s=new Error(`Request failed with HTTP ${r.status}`);throw s.status=r.status,s}return r.json()}function ko({timeZone:t,tzOffsetMinutes:e}={}){const n={},i=typeof t=="string"?t.trim():"";return i&&(n.tz=i),Number.isFinite(e)&&(n.tz_offset_minutes=String(Math.trunc(e))),n}function Lo({source:t,model:e}={}){const n={},i=typeof t=="string"?t.trim().toLowerCase():"";i&&(n.source=i);const r=typeof e=="string"?e.trim():"";return r&&(n.model=r),n}async function oX({from:t,to:e,source:n,model:i,timeZone:r,tzOffsetMinutes:s,rolling:o=!1,accessToken:c}={}){if(xr())return sU({from:t,to:e,seed:c,rolling:o});const u=ko({timeZone:r,tzOffsetMinutes:s}),d=Lo({source:n,model:i}),h=o?{rolling:"1"}:{};return $s(ms.usageSummary,{from:t,to:e,...d,...u,...h})}async function lX({from:t,to:e,source:n,limit:i,timeZone:r,tzOffsetMinutes:s,accessToken:o}={}){if(xr())return oU({seed:o,limit:i});const c=ko({timeZone:r,tzOffsetMinutes:s}),d={...Lo({source:n}),...c};return t&&(d.from=t),e&&(d.to=e),i!=null&&(d.limit=String(i)),$s(ms.projectUsageSummary,d)}async function ku(t,e={}){const n=Ro();if(!n)throw new Error("InsForge base URL not configured");const i=n.replace(/\/$/,""),r=new URL(`${i}/functions/${t}`);if(e.params)for(const[u,d]of Object.entries(e.params))d!=null&&d!==""&&r.searchParams.set(u,String(d));const s={Accept:"application/json","Content-Type":"application/json"},o=Nh();o&&(s.apikey=o),e.accessToken&&NI(e.accessToken)&&(s.Authorization=`Bearer ${e.accessToken}`);const c=await fetch(r.toString(),{method:e.method||"GET",headers:s,...e.body!=null?{body:JSON.stringify(e.body)}:{}});if(!c.ok){const u=new Error(`Request failed with HTTP ${c.status}`);throw u.status=c.status,u}return c.json()}async function cX({accessToken:t,userId:e,period:n,metric:i,limit:r,offset:s}={}){return xr()?yT({seed:t||e,period:n,metric:i,limit:r,offset:s}):ku("tokentracker-leaderboard",{params:{period:n,limit:r,offset:s,user_id:e}})}async function BS({accessToken:t}={}){return ku("tokentracker-public-visibility",{accessToken:t,method:"GET"})}async function uX({accessToken:t,enabled:e,anonymous:n,display_name:i}={}){const r={};return e!==void 0&&(r.enabled=!!e),n!==void 0&&(r.anonymous=!!n),i!==void 0&&(r.display_name=String(i)),ku("tokentracker-public-visibility",{accessToken:t,method:"POST",body:r})}async function dX({accessToken:t,period:e}={}){return ku("tokentracker-leaderboard-refresh",{accessToken:t,method:"POST",body:e?{period:e}:{}})}async function fX({accessToken:t,userId:e,period:n}={}){if(xr()){const i=yT({seed:t,period:n,metric:"all",limit:250,offset:0}),s=(Array.isArray(i?.entries)?i.entries:[]).find(o=>o?.user_id===e)||null;return{period:i?.period??"week",from:i?.from??null,to:i?.to??null,generated_at:i?.generated_at??new Date().toISOString(),entry:s}}return ku("tokentracker-leaderboard-profile",{accessToken:t,params:{user_id:e,period:n}})}async function hX(t={}){if(xr()){const e=new Date().toISOString();return{user_id:"local-user",created_at:e,pro:{active:!1,sources:[],expires_at:null,partial:!1,as_of:e},subscriptions:{partial:!1,as_of:e,items:[]},install:{partial:!1,as_of:e,has_active_device_token:!1,has_active_device:!1,active_device_tokens:0,active_devices:0,latest_token_activity_at:null,latest_device_seen_at:null}}}return $s(ms.userStatus)}async function pX({signal:t}={}){const e=await fetch(`/functions/${ms.localSync}`,{method:"POST",headers:{Accept:"application/json"},cache:"no-store",signal:t}),n=await e.json().catch(()=>({ok:!1,error:`Local sync request failed with HTTP ${e.status}`}));if(!e.ok||n?.ok===!1){const i=n?.error||n?.message||`Local sync request failed with HTTP ${e.status}`,r=new Error(i);throw r.status=e.status,r}return n}async function mX({from:t,to:e,source:n,timeZone:i,tzOffsetMinutes:r,accessToken:s}={}){if(xr())return uU({from:t,to:e,seed:s});const o=ko({timeZone:i,tzOffsetMinutes:r}),c=Lo({source:n});return $s(ms.usageModelBreakdown,{from:t,to:e,...c,...o})}async function gX({from:t,to:e,source:n,model:i,timeZone:r,tzOffsetMinutes:s,accessToken:o}={}){if(xr())return nU({from:t,to:e,seed:o});const c=ko({timeZone:r,tzOffsetMinutes:s}),u=Lo({source:n,model:i});return $s(ms.usageDaily,{from:t,to:e,...u,...c})}async function vX({day:t,source:e,model:n,timeZone:i,tzOffsetMinutes:r,accessToken:s}={}){if(xr())return iU({day:t,seed:s});const o=ko({timeZone:i,tzOffsetMinutes:r}),c=Lo({source:e,model:n}),u=t?{day:t,...c,...o}:{...c,...o};return $s(ms.usageHourly,u)}async function yX({months:t,to:e,source:n,model:i,timeZone:r,tzOffsetMinutes:s,accessToken:o}={}){if(xr())return rU({months:t,to:e,seed:o});const c=ko({timeZone:r,tzOffsetMinutes:s}),u=Lo({source:n,model:i});return $s(ms.usageMonthly,{...t?{months:String(t)}:{},...e?{to:e}:{},...u,...c})}async function _X(t={}){const e=t?.refresh?{refresh:"1"}:void 0;return $s(ms.usageLimits,e)}async function xX({weeks:t,to:e,weekStartsOn:n,source:i,model:r,timeZone:s,tzOffsetMinutes:o,accessToken:c}={}){if(xr())return cU({weeks:t,to:e,weekStartsOn:n,seed:c});const u=ko({timeZone:s,tzOffsetMinutes:o}),d=Lo({source:i,model:r});return $s(ms.usageHeatmap,{weeks:String(t),to:e,week_starts_on:n,...d,...u})}const _T=L.createContext(null);function dU(t){if(!t||typeof t!="object")return"";const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=e.full_name||e.name||n.name||e.user_name||e.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function zS(t){if(!t||typeof t!="object")return null;const e=t,n=e.session&&typeof e.session=="object"?e.session:null,i=typeof e.accessToken=="string"&&e.accessToken||typeof e.access_token=="string"&&e.access_token||n&&typeof n.accessToken=="string"&&n.accessToken||n&&typeof n.access_token=="string"&&n.access_token||null;return i&&i.length>0?i:null}async function zm(t,e={}){if(!t)return null;const n=Math.max(0,Math.floor(Number(e.skewMs)||6e4)),i=t.tokenManager,r=()=>i?.getAccessToken?.()??i?.getSession?.()?.accessToken??null;let s=r();if(!s||II(s,n)){const{data:o}=await t.auth.refreshSession();if(s=r()??zS(o)??null,!s&&typeof t.auth.getCurrentUser=="function")try{await t.auth.getCurrentUser(),s=r()??zS(o)??null}catch{}}return s||null}function fU({children:t}){const[e,n]=L.useState(null),[i,r]=L.useState(null),[s,o]=L.useState(!0);L.useEffect(()=>{if(!u0()){n(null),r(null),o(!1);return}n(CI())},[]),L.useEffect(()=>{if(!e)return;let k=!0;return o(!0),(async()=>{try{let{data:U,error:S}=await e.auth.getCurrentUser();if(!k)return;if(!S&&!U?.user){if(await new Promise(V=>setTimeout(V,150)),!k)return;const P=await e.auth.getCurrentUser();U=P.data,S=P.error}if(S){r(null);return}r(U?.user??null)}catch{k&&r(null)}finally{k&&o(!1)}})(),()=>{k=!1}},[e]);const c=L.useCallback(async()=>{if(e)try{let{data:k,error:U}=await e.auth.getCurrentUser();if(!U&&!k?.user){await new Promise(P=>setTimeout(P,150));const S=await e.auth.getCurrentUser();k=S.data,U=S.error}if(U){r(null);return}r(k?.user??null)}catch{r(null)}},[e]),u=L.useCallback(async(k,U)=>{if(!e)return{error:new Error("InsForge client not configured")};const S=typeof window<"u"&&window.webkit?.messageHandlers?.nativeOAuth;if(S){const O=typeof U=="string"&&U.trim()?U.trim():`${window.location.origin}/auth/callback`,G=await e.auth.signInWithOAuth({provider:k,redirectTo:O,skipBrowserRedirect:!0});if(G.data?.url){try{await fetch("/api/auth-bridge/verifier",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({native:!0})})}catch{}S.postMessage(G.data.url)}return G}const P=typeof U=="string"&&U.trim()?U.trim():typeof window<"u"?`${window.location.origin}/dashboard`:void 0;return await e.auth.signInWithOAuth({provider:k,redirectTo:P})},[e]),d=L.useCallback(async k=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:S}=await e.auth.signInWithPassword(k);return U?.user&&r(U.user),{data:U,error:S}},[e]),h=L.useCallback(async k=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:S}=await e.auth.signUp(k);return U?.user&&U?.accessToken&&r(U.user),{data:U,error:S}},[e]),p=L.useCallback(async()=>e?e.auth.getPublicAuthConfig():{data:null,error:new Error("InsForge client not configured")},[e]),m=L.useCallback(async()=>{e&&(await e.auth.signOut(),kI(),r(null))},[e]),v=L.useCallback(async()=>zm(e),[e]),[_,w]=L.useState(null),[y,b]=L.useState(!1),T=L.useMemo(()=>dU(i),[i]);L.useEffect(()=>{if(!i||!e){w(null),b(!1);return}let k=!0;return(async()=>{try{const U=await zm(e);if(!k||!U){k&&b(!0);return}const S=await BS({accessToken:U});k&&S?.display_name&&w(S.display_name)}catch{}k&&b(!0)})(),()=>{k=!1}},[i,e]);const A=y?_||T:"",M=L.useCallback(async()=>{if(e)try{const k=await zm(e);if(!k)return;const U=await BS({accessToken:k});U?.display_name&&w(U.display_name)}catch{}},[e]),I=L.useMemo(()=>!u0()||!e?{enabled:!1,client:null,user:null,signedIn:!1,loading:!1,displayName:"",refreshUser:async()=>{},refreshDisplayName:async()=>{},signInWithOAuth:async()=>({error:new Error("InsForge not configured")}),signInWithPassword:async()=>({data:null,error:new Error("InsForge not configured")}),signUp:async()=>({data:null,error:new Error("InsForge not configured")}),getPublicAuthConfig:async()=>({data:null,error:new Error("InsForge not configured")}),signOut:async()=>{},getAccessToken:async()=>null}:{enabled:!0,client:e,user:i,signedIn:!!i,loading:s,displayName:A,refreshUser:c,refreshDisplayName:M,signInWithOAuth:u,signInWithPassword:d,signUp:h,getPublicAuthConfig:p,signOut:m,getAccessToken:v},[e,i,s,A,c,M,u,d,h,p,m,v]);return F.jsx(_T.Provider,{value:I,children:t})}function Do(){return L.useContext(_T)}const hU="modulepreload",pU=function(t){return"/"+t},VS={},No=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=o?.nonce||o?.getAttribute("nonce");r=u(n.map(d=>{if(d=pU(d),d in VS)return;VS[d]=!0;const h=d.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":hU,h||(m.as="script"),m.crossOrigin="",m.href=d,c&&m.setAttribute("nonce",c),document.head.appendChild(m),h)return new Promise((v,_)=>{m.addEventListener("load",v),m.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return r.then(o=>{for(const c of o||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};var lh={},mU=()=>{window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)})},gU="@vercel/analytics",vU="2.0.1";function xT(){return typeof window<"u"}function bT(){try{const t="production"}catch{}return"production"}function yU(t="auto"){if(t==="auto"){window.vam=bT();return}window.vam=t}function _U(){return(xT()?window.vam:bT())||"production"}function hy(){return _U()==="development"}function xU(t){return t.scriptSrc?Pl(t.scriptSrc):hy()?"https://va.vercel-scripts.com/v1/script.debug.js":t.basePath?Pl(`${t.basePath}/insights/script.js`):"/_vercel/insights/script.js"}function bU(t,e){var n;let i=t;if(e)try{i={...(n=JSON.parse(e))==null?void 0:n.analytics,...t}}catch{}yU(i.mode);const r={sdkn:gU+(i.framework?`/${i.framework}`:""),sdkv:vU};return i.disableAutoTrack&&(r.disableAutoTrack="1"),i.viewEndpoint&&(r.viewEndpoint=Pl(i.viewEndpoint)),i.eventEndpoint&&(r.eventEndpoint=Pl(i.eventEndpoint)),i.sessionEndpoint&&(r.sessionEndpoint=Pl(i.sessionEndpoint)),hy()&&i.debug===!1&&(r.debug="false"),i.dsn&&(r.dsn=i.dsn),i.endpoint?r.endpoint=i.endpoint:i.basePath&&(r.endpoint=Pl(`${i.basePath}/insights`)),{beforeSend:i.beforeSend,src:xU(i),dataset:r}}function Pl(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?t:`/${t}`}function SU(t={debug:!0},e){var n;if(!xT())return;const{beforeSend:i,src:r,dataset:s}=bU(t,e);if(mU(),i&&((n=window.va)==null||n.call(window,"beforeSend",i)),document.head.querySelector(`script[src*="${r}"]`))return;const o=document.createElement("script");o.src=r;for(const[c,u]of Object.entries(s))o.dataset[c]=u;o.defer=!0,o.onerror=()=>{const c=hy()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${r}. ${c}`)},document.head.appendChild(o)}function wU({route:t,path:e}){var n;(n=window.va)==null||n.call(window,"pageview",{route:t,path:e})}function EU(){if(!(typeof process>"u"||typeof lh>"u"))return lh.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function MU(){if(!(typeof process>"u"||typeof lh>"u"))return lh.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function TU(t){return L.useEffect(()=>{var e;t.beforeSend&&((e=window.va)==null||e.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]),L.useEffect(()=>{SU({framework:t.framework||"react",basePath:t.basePath??EU(),...t.route!==void 0&&{disableAutoTrack:!0},...t},t.configString??MU())},[]),L.useEffect(()=>{t.route&&t.path&&wU({route:t.route,path:t.path})},[t.route,t.path]),null}var ch={},AU=()=>{window.si||(window.si=function(...e){window.siq=window.siq||[],window.siq.push(e)})},CU="@vercel/speed-insights",PU="2.0.0";function RU(){return typeof window<"u"}function kU(){try{const t="production"}catch{}return"production"}function ST(){return kU()==="development"}function LU(t){return t.scriptSrc?uh(t.scriptSrc):ST()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":t.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.js":t.basePath?uh(`${t.basePath}/speed-insights/script.js`):"/_vercel/speed-insights/script.js"}function DU(t,e){var n;let i=t;if(e)try{i={...(n=JSON.parse(e))==null?void 0:n.speedInsights,...t}}catch{}const r={sdkn:CU+(i.framework?`/${i.framework}`:""),sdkv:PU};return i.sampleRate&&(r.sampleRate=i.sampleRate.toString()),i.route&&(r.route=i.route),ST()&&i.debug===!1&&(r.debug="false"),i.dsn&&(r.dsn=i.dsn),i.endpoint?r.endpoint=uh(i.endpoint):i.basePath&&(r.endpoint=uh(`${i.basePath}/speed-insights/vitals`)),{src:LU(i),beforeSend:i.beforeSend,dataset:r}}function uh(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?t:`/${t}`}function NU(t={},e){var n;if(!RU()||t.route===null)return null;AU();const{beforeSend:i,src:r,dataset:s}=DU(t,e);if(document.head.querySelector(`script[src*="${r}"]`))return null;i&&((n=window.si)==null||n.call(window,"beforeSend",i));const o=document.createElement("script");o.src=r,o.defer=!0;for(const[c,u]of Object.entries(s))o.dataset[c]=u;return o.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${r}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(o),{setRoute:c=>{o.dataset.route=c??void 0}}}function IU(){if(!(typeof process>"u"||typeof ch>"u"))return ch.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function UU(){if(!(typeof process>"u"||typeof ch>"u"))return ch.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function FU(t){L.useEffect(()=>{var n;t.beforeSend&&((n=window.si)==null||n.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]);const e=L.useRef(null);return L.useEffect(()=>{if(!e.current){const n=NU({framework:t.framework??"react",basePath:t.basePath??IU(),...t},t.configString??UU());n&&(e.current=n.setRoute)}},[t]),L.useEffect(()=>{e.current&&t.route&&e.current(t.route)},[t.route]),null}function Uh(){return typeof window<"u"}function py(t){return wT(t)?(t.nodeName||"").toLowerCase():"#document"}function Kl(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function OU(t){var e;return(e=(wT(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function wT(t){return Uh()?t instanceof Node||t instanceof Kl(t).Node:!1}function ET(t){return Uh()?t instanceof Element||t instanceof Kl(t).Element:!1}function my(t){return Uh()?t instanceof HTMLElement||t instanceof Kl(t).HTMLElement:!1}function HS(t){return!Uh()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Kl(t).ShadowRoot}function MT(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=AT(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&r!=="inline"&&r!=="contents"}function bX(t){return/^(table|td|th)$/.test(py(t))}function BU(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const zU=/transform|translate|scale|rotate|perspective|filter/,VU=/paint|layout|strict|content/,Za=t=>!!t&&t!=="none";let Vm;function HU(t){const e=ET(t)?AT(t):t;return Za(e.transform)||Za(e.translate)||Za(e.scale)||Za(e.rotate)||Za(e.perspective)||!GU()&&(Za(e.backdropFilter)||Za(e.filter))||zU.test(e.willChange||"")||VU.test(e.contain||"")}function SX(t){let e=f0(t);for(;my(e)&&!TT(e);){if(HU(e))return e;if(BU(e))return null;e=f0(e)}return null}function GU(){return Vm==null&&(Vm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Vm}function TT(t){return/^(html|body|#document)$/.test(py(t))}function AT(t){return Kl(t).getComputedStyle(t)}function wX(t){return ET(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function f0(t){if(py(t)==="html")return t;const e=t.assignedSlot||t.parentNode||HS(t)&&t.host||OU(t);return HS(e)?e.host:e}function CT(t){const e=f0(t);return TT(e)?t.ownerDocument?t.ownerDocument.body:t.body:my(e)&&MT(e)?e:CT(e)}function GS(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=CT(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),o=Kl(r);if(s){const c=jU(o);return e.concat(o,o.visualViewport||[],MT(r)?r:[],c&&n?GS(c):[])}else return e.concat(r,GS(r,[],n))}function jU(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const jS={};function gy(t,e){const n=L.useRef(jS);return n.current===jS&&(n.current=t(e)),n}const Hm=BE[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],WU=Hm&&Hm!==L.useLayoutEffect?Hm:t=>t();function WS(t){const e=gy($U).current;return e.next=t,WU(e.effect),e.trampoline}function $U(){const t={next:void 0,callback:XU,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function XU(){}const qU=()=>{},YU=typeof document<"u"?L.useLayoutEffect:qU;function h0(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}const su={};function PT(t,e,n,i,r){let s={...p0(t,su)};return e&&(s=Nf(s,e)),n&&(s=Nf(s,n)),i&&(s=Nf(s,i)),s}function KU(t){if(t.length===0)return su;if(t.length===1)return p0(t[0],su);let e={...p0(t[0],su)};for(let n=1;n<t.length;n+=1)e=Nf(e,t[n]);return e}function Nf(t,e){return RT(e)?e(t):ZU(t,e)}function ZU(t,e){if(!e)return t;for(const n in e){const i=e[n];switch(n){case"style":{t[n]=h0(t.style,i);break}case"className":{t[n]=kT(t.className,i);break}default:JU(n,i)?t[n]=QU(t[n],i):t[n]=i}}return t}function JU(t,e){const n=t.charCodeAt(0),i=t.charCodeAt(1),r=t.charCodeAt(2);return n===111&&i===110&&r>=65&&r<=90&&(typeof e=="function"||typeof e>"u")}function RT(t){return typeof t=="function"}function p0(t,e){return RT(t)?t(e):t??su}function QU(t,e){return e?t?n=>{if(eF(n)){const r=n;m0(r);const s=e(r);return r.baseUIHandlerPrevented||t?.(r),s}const i=e(n);return t?.(n),i}:e:t}function m0(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function kT(t,e){return e?t?e+" "+t:e:t}function eF(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function LT(t,...e){const n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",t.toString()),e.forEach(i=>n.searchParams.append("args[]",i)),`Base UI error #${t}; visit ${n} for the full message.`}const tF=L.createContext(void 0);function nF(t=!1){const e=L.useContext(tF);if(e===void 0&&!t)throw new Error(LT(16));return e}function iF(t){const{focusableWhenDisabled:e,disabled:n,composite:i=!1,tabIndex:r=0,isNativeButton:s}=t,o=i&&e!==!1,c=i&&e===!1;return{props:L.useMemo(()=>{const d={onKeyDown(h){n&&e&&h.key!=="Tab"&&h.preventDefault()}};return i||(d.tabIndex=r,!s&&n&&(d.tabIndex=e?r:-1)),(s&&(e||o)||!s&&n)&&(d["aria-disabled"]=n),s&&(!e||c)&&(d.disabled=n),d},[i,n,e,o,c,s,r])}}function rF(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:i=0,native:r=!0}=t,s=L.useRef(null),o=nF(!0)!==void 0,c=WS(()=>{const m=s.current;return!!(m?.tagName==="A"&&m?.href)}),{props:u}=iF({focusableWhenDisabled:n,disabled:e,composite:o,tabIndex:i,isNativeButton:r}),d=L.useCallback(()=>{const m=s.current;sF(m)&&o&&e&&u.disabled===void 0&&m.disabled&&(m.disabled=!1)},[e,u.disabled,o]);YU(d,[d]);const h=L.useCallback((m={})=>{const{onClick:v,onMouseDown:_,onKeyUp:w,onKeyDown:y,onPointerDown:b,...T}=m;return PT({type:r?"button":void 0,onClick(M){if(e){M.preventDefault();return}v?.(M)},onMouseDown(M){e||_?.(M)},onKeyDown(M){if(e||(m0(M),y?.(M)),M.baseUIHandlerPrevented)return;const I=M.target===M.currentTarget&&!r&&!c()&&!e,k=M.key==="Enter",U=M.key===" ";I&&((U||k)&&M.preventDefault(),k&&v?.(M))},onKeyUp(M){e||(m0(M),w?.(M)),!M.baseUIHandlerPrevented&&M.target===M.currentTarget&&!r&&!e&&M.key===" "&&v?.(M)},onPointerDown(M){if(e){M.preventDefault();return}b?.(M)}},r?void 0:{role:"button"},u,T)},[e,u,r,c]),p=WS(m=>{s.current=m,d()});return{getButtonProps:h,buttonRef:p}}function sF(t){return my(t)&&t.tagName==="BUTTON"}function $S(t,e,n,i){const r=gy(DT).current;return oF(r,t,e,n,i)&&NT(r,[t,e,n,i]),r.callback}function aF(t){const e=gy(DT).current;return lF(e,t)&&NT(e,t),e.callback}function DT(){return{callback:null,cleanup:null,refs:[]}}function oF(t,e,n,i,r){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==i||t.refs[3]!==r}function lF(t,e){return t.refs.length!==e.length||t.refs.some((n,i)=>n!==e[i])}function NT(t,e){if(t.refs=e,e.every(n=>n==null)){t.callback=null;return}t.callback=n=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),n!=null){const i=Array(e.length).fill(null);for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const o=s(n);typeof o=="function"&&(i[r]=o);break}case"object":{s.current=n;break}}}t.cleanup=()=>{for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const o=i[r];typeof o=="function"?o():s(null);break}case"object":{s.current=null;break}}}}}}}const cF=parseInt(L.version,10);function uF(t){return cF>=t}function XS(t){if(!L.isValidElement(t))return null;const e=t,n=e.props;return(uF(19)?n?.ref:e.ref)??null}function dF(t,e){const n={};for(const i in t){const r=t[i];if(e?.hasOwnProperty(i)){const s=e[i](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${i.toLowerCase()}`]="":r&&(n[`data-${i.toLowerCase()}`]=r.toString())}return n}function fF(t,e){return typeof t=="function"?t(e):t}function hF(t,e){return typeof t=="function"?t(e):t}function EX(){}const Ml=Object.freeze({});function pF(t,e,n={}){const i=e.render,r=mF(e,n);if(n.enabled===!1)return null;const s=n.state??Ml;return gF(t,i,r,s)}function mF(t,e={}){const{className:n,style:i,render:r}=t,{state:s=Ml,ref:o,props:c,stateAttributesMapping:u,enabled:d=!0}=e,h=d?fF(n,s):void 0,p=d?hF(i,s):void 0,m=d?dF(s,u):Ml,v=d?h0(m,Array.isArray(c)?KU(c):c)??Ml:Ml;return typeof document<"u"&&(d?Array.isArray(o)?v.ref=aF([v.ref,XS(r),...o]):v.ref=$S(v.ref,XS(r),o):$S(null,null)),d?(h!==void 0&&(v.className=kT(v.className,h)),p!==void 0&&(v.style=h0(v.style,p)),v):Ml}function gF(t,e,n,i){if(e){if(typeof e=="function")return e(n,i);const r=PT(n,e.props);return r.ref=n.ref,L.cloneElement(e,r)}if(t&&typeof t=="string")return vF(t,n);throw new Error(LT(8))}function vF(t,e){return t==="button"?L.createElement("button",{type:"button",...e,key:e.key}):t==="img"?L.createElement("img",{alt:"",...e,key:e.key}):L.createElement(t,e)}const yF=L.forwardRef(function(e,n){const{render:i,className:r,disabled:s=!1,focusableWhenDisabled:o=!1,nativeButton:c=!0,...u}=e,{getButtonProps:d,buttonRef:h}=rF({disabled:s,focusableWhenDisabled:o,native:c}),p=L.useMemo(()=>({disabled:s}),[s]);return pF("button",e,{state:p,ref:[n,h],props:[u,d]})}),_F=`key,module,page,component,slot,text,notes,status
|
|
43
43
|
header.auth.sign_in_aria,shared,*,InsforgeUserHeaderControls,sign_in_aria,"Sign in",,active
|
|
44
44
|
header.auth.user_fallback,shared,*,InsforgeUserHeaderControls,user_fallback,"User",,active
|
|
45
45
|
header.cloud_sync.label,shared,*,InsforgeUserHeaderControls,cloud_sync_label,"Sync local usage to cloud",,active
|
|
@@ -432,6 +432,7 @@ leaderboard.column.openclaw,dashboard,LeaderboardPage,LeaderboardPage,column_ope
|
|
|
432
432
|
leaderboard.column.hermes,dashboard,LeaderboardPage,LeaderboardPage,column_hermes,"Hermes",,active
|
|
433
433
|
leaderboard.column.kiro,dashboard,LeaderboardPage,LeaderboardPage,column_kiro,"Kiro",,active
|
|
434
434
|
leaderboard.column.copilot,dashboard,LeaderboardPage,LeaderboardPage,column_copilot,"GitHub Copilot",,active
|
|
435
|
+
leaderboard.column.kimi,dashboard,LeaderboardPage,LeaderboardPage,column_kimi,"Kimi Code",,active
|
|
435
436
|
limits.copilot.otelHint.title,dashboard,LimitsPage,LimitsPage,otel_hint_title,"Track Copilot token usage",,active
|
|
436
437
|
limits.copilot.otelHint.body,dashboard,LimitsPage,LimitsPage,otel_hint_body,"Limits load via your GitHub OAuth token. To also record per-token usage, enable Copilot's OpenTelemetry export and add these lines to your shell profile (~/.zshrc or ~/.bashrc):",,active
|
|
437
438
|
limits.copilot.otelHint.copy,dashboard,LimitsPage,LimitsPage,otel_hint_copy,"Copy",,active
|
|
@@ -607,7 +608,7 @@ share.toast.working,share,DashboardPage,ShareModal,toast_working,"Generating…"
|
|
|
607
608
|
${T}px !important;
|
|
608
609
|
${A}px !important;
|
|
609
610
|
}
|
|
610
|
-
`),()=>{c.current?.removeAttribute("data-motion-pop-id"),I.contains(M)&&I.removeChild(M)}},[e]),F.jsx(x5,{isPresent:e,childRef:c,sizeRef:u,pop:s,children:s===!1?t:L.cloneElement(t,{ref:p})})}const S5=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:o,anchorX:c,anchorY:u,root:d})=>{const h=yy(w5),p=L.useId();let m=!0,v=L.useMemo(()=>(m=!1,{id:p,initial:e,isPresent:n,custom:r,onExitComplete:_=>{h.set(_,!0);for(const w of h.values())if(!w)return;i&&i()},register:_=>(h.set(_,!1),()=>h.delete(_))}),[n,h,i]);return s&&m&&(v={...v}),L.useMemo(()=>{h.forEach((_,w)=>h.set(w,!1))},[n]),L.useEffect(()=>{!n&&!h.size&&i&&i()},[n]),t=F.jsx(b5,{pop:o==="popLayout",isPresent:n,anchorX:c,anchorY:u,root:d,children:t}),F.jsx(Fh.Provider,{value:v,children:t})};function w5(){return new Map}function pC(t=!0){const e=L.useContext(Fh);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=e,s=L.useId();L.useEffect(()=>{if(t)return r(s)},[t]);const o=L.useCallback(()=>t&&i&&i(s),[s,i,t]);return!n&&i?[!1,o]:[!0]}const Kd=t=>t.key||"";function Qw(t){const e=[];return L.Children.forEach(t,n=>{L.isValidElement(n)&&e.push(n)}),e}const E5=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:o=!1,anchorX:c="left",anchorY:u="top",root:d})=>{const[h,p]=pC(o),m=L.useMemo(()=>Qw(t),[t]),v=o&&!h?[]:m.map(Kd),_=L.useRef(!0),w=L.useRef(m),y=yy(()=>new Map),b=L.useRef(new Set),[T,A]=L.useState(m),[M,I]=L.useState(m);VT(()=>{_.current=!1,w.current=m;for(let S=0;S<M.length;S++){const P=Kd(M[S]);v.includes(P)?(y.delete(P),b.current.delete(P)):y.get(P)!==!0&&y.set(P,!1)}},[M,v.length,v.join("-")]);const k=[];if(m!==T){let S=[...m];for(let P=0;P<M.length;P++){const V=M[P],O=Kd(V);v.includes(O)||(S.splice(P,0,V),k.push(V))}return s==="wait"&&k.length&&(S=k),I(Qw(S)),A(m),null}const{forceRender:U}=L.useContext(vy);return F.jsx(F.Fragment,{children:M.map(S=>{const P=Kd(S),V=o&&!h?!1:m===M||v.includes(P),O=()=>{if(b.current.has(P))return;if(y.has(P))b.current.add(P),y.set(P,!0);else return;let G=!0;y.forEach(J=>{J||(G=!1)}),G&&(U?.(),I(w.current),o&&p?.(),i&&i())};return F.jsx(S5,{isPresent:V,initial:!_.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:d,onExitComplete:V?void 0:O,anchorX:c,anchorY:u,children:S},P)})})},mC=L.createContext({strict:!1}),e1={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let t1=!1;function M5(){if(t1)return;const t={};for(const e in e1)t[e]={isEnabled:n=>e1[e].some(i=>!!n[i])};jA(t),t1=!0}function gC(){return M5(),l4()}function T5(t){const e=gC();for(const n in t)e[n]={...e[n],...t[n]};jA(e)}const A5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function xh(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||A5.has(t)}let vC=t=>!xh(t);function C5(t){typeof t=="function"&&(vC=e=>e.startsWith("on")?!xh(e):t(e))}try{C5(require("@emotion/is-prop-valid").default)}catch{}function P5(t,e,n){const i={};for(const r in t)r==="values"&&typeof t.values=="object"||pi(t[r])||(vC(r)||n===!0&&xh(r)||!e&&!xh(r)||t.draggable&&r.startsWith("onDrag"))&&(i[r]=t[r]);return i}const Vh=L.createContext({});function R5(t,e){if(zh(t)){const{initial:n,animate:i}=t;return{initial:n===!1||yu(n)?n:void 0,animate:yu(i)?i:void 0}}return t.inherit!==!1?e:{}}function k5(t){const{initial:e,animate:n}=R5(t,L.useContext(Vh));return L.useMemo(()=>({initial:e,animate:n}),[n1(e),n1(n)])}function n1(t){return Array.isArray(t)?t.join(" "):t}const Wy=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function yC(t,e,n){for(const i in e)!pi(e[i])&&!ZA(i,n)&&(t[i]=e[i])}function L5({transformTemplate:t},e){return L.useMemo(()=>{const n=Wy();return Hy(n,e,t),Object.assign({},n.vars,n.style)},[e])}function D5(t,e){const n=t.style||{},i={};return yC(i,n,t),Object.assign(i,L5(t,e)),i}function N5(t,e){const n={},i=D5(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const _C=()=>({...Wy(),attrs:{}});function I5(t,e,n,i){const r=L.useMemo(()=>{const s=_C();return JA(s,e,eC(i),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};yC(s,t.style,t),r.style={...s,...r.style}}return r}const U5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function $y(t){return typeof t!="string"||t.includes("-")?!1:!!(U5.indexOf(t)>-1||/[A-Z]/u.test(t))}function F5(t,e,n,{latestValues:i},r,s=!1,o){const u=(o??$y(t)?I5:N5)(e,i,r,t),d=P5(e,typeof t=="string",s),h=t!==L.Fragment?{...d,...u,ref:n}:{},{children:p}=e,m=L.useMemo(()=>pi(p)?p.get():p,[p]);return L.createElement(t,{...h,children:m})}function O5({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,r){return{latestValues:B5(n,i,r,t),renderState:e()}}function B5(t,e,n,i){const r={},s=i(t,{});for(const m in s)r[m]=Hf(s[m]);let{initial:o,animate:c}=t;const u=zh(t),d=HA(t);e&&d&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),c===void 0&&(c=e.animate));let h=n?n.initial===!1:!1;h=h||o===!1;const p=h?c:o;if(p&&typeof p!="boolean"&&!Bh(p)){const m=Array.isArray(p)?p:[p];for(let v=0;v<m.length;v++){const _=Dy(t,m[v]);if(_){const{transitionEnd:w,transition:y,...b}=_;for(const T in b){let A=b[T];if(Array.isArray(A)){const M=h?A.length-1:0;A=A[M]}A!==null&&(r[T]=A)}for(const T in w)r[T]=w[T]}}}return r}const xC=t=>(e,n)=>{const i=L.useContext(Vh),r=L.useContext(Fh),s=()=>O5(t,e,i,r);return n?s():yy(s)},z5=xC({scrapeMotionValuesFromProps:Gy,createRenderState:Wy}),V5=xC({scrapeMotionValuesFromProps:tC,createRenderState:_C}),H5=Symbol.for("motionComponentSymbol");function G5(t,e,n){const i=L.useRef(n);L.useInsertionEffect(()=>{i.current=n});const r=L.useRef(null);return L.useCallback(s=>{s&&t.onMount?.(s);const o=i.current;if(typeof o=="function")if(s){const c=o(s);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):o(s);else o&&(o.current=s);e&&(s?e.mount(s):e.unmount())},[e])}const bC=L.createContext({});function Tl(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function j5(t,e,n,i,r,s){const{visualElement:o}=L.useContext(Vh),c=L.useContext(mC),u=L.useContext(Fh),d=L.useContext(jy),h=d.reducedMotion,p=d.skipAnimations,m=L.useRef(null),v=L.useRef(!1);i=i||c.renderer,!m.current&&i&&(m.current=i(t,{visualState:e,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:h,skipAnimations:p,isSVG:s}),v.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const _=m.current,w=L.useContext(bC);_&&!_.projection&&r&&(_.type==="html"||_.type==="svg")&&W5(m.current,n,r,w);const y=L.useRef(!1);L.useInsertionEffect(()=>{_&&y.current&&_.update(n,u)});const b=n[PA],T=L.useRef(!!b&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return VT(()=>{v.current=!0,_&&(y.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),_.scheduleRenderMicrotask(),T.current&&_.animationState&&_.animationState.animateChanges())}),L.useEffect(()=>{_&&(!T.current&&_.animationState&&_.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),T.current=!1),_.enteringChildren=void 0)}),_}function W5(t,e,n,i){const{layoutId:r,layout:s,drag:o,dragConstraints:c,layoutScroll:u,layoutRoot:d,layoutAnchor:h,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:SC(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||c&&Tl(c),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,crossfade:p,layoutScroll:u,layoutRoot:d,layoutAnchor:h})}function SC(t){if(t)return t.options.allowProjection!==!1?t.projection:SC(t.parent)}function tg(t,{forwardMotionProps:e=!1,type:n}={},i,r){i&&T5(i);const s=n?n==="svg":$y(t),o=s?V5:z5;function c(d,h){let p;const m={...L.useContext(jy),...d,layoutId:$5(d)},{isStatic:v}=m,_=k5(d),w=o(d,v);if(!v&&typeof window<"u"){X5();const y=q5(m);p=y.MeasureLayout,_.visualElement=j5(t,w,m,r,y.ProjectionNode,s)}return F.jsxs(Vh.Provider,{value:_,children:[p&&_.visualElement?F.jsx(p,{visualElement:_.visualElement,...m}):null,F5(t,d,G5(w,_.visualElement,h),w,v,e,s)]})}c.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=L.forwardRef(c);return u[H5]=t,u}function $5({layoutId:t}){const e=L.useContext(vy).id;return e&&t!==void 0?e+"-"+t:t}function X5(t,e){L.useContext(mC).strict}function q5(t){const e=gC(),{drag:n,layout:i}=e;if(!n&&!i)return{};const r={...n,...i};return{MeasureLayout:n?.isEnabled(t)||i?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Y5(t,e){if(typeof Proxy>"u")return tg;const n=new Map,i=(s,o)=>tg(s,o,t,e),r=(s,o)=>i(s,o);return new Proxy(r,{get:(s,o)=>o==="create"?i:(n.has(o)||n.set(o,tg(o,void 0,t,e)),n.get(o))})}const K5=(t,e)=>e.isSVG??$y(t)?new M4(e):new _4(e,{allowProjection:t!==L.Fragment});class Z5 extends Fa{constructor(e){super(e),e.animationState||(e.animationState=R4(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Bh(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let J5=0;class Q5 extends Fa{constructor(){super(...arguments),this.id=J5++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;if(e&&i===!1){if(this.isExitComplete){const{initial:s,custom:o}=this.node.getProps();if(typeof s=="string"){const c=yo(this.node,s,o);if(c){const{transition:u,transitionEnd:d,...h}=c;for(const p in h)this.node.getValue(p)?.jump(h[p])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const ez={animation:{Feature:Z5},exit:{Feature:Q5}};function Uu(t){return{point:{x:t.pageX,y:t.pageY}}}const tz=t=>e=>Fy(e)&&t(e,Uu(e));function cu(t,e,n,i){return _u(t,e,tz(n),i)}const wC=({current:t})=>t?t.ownerDocument.defaultView:null,i1=(t,e)=>Math.abs(t-e);function nz(t,e){const n=i1(t.x,e.x),i=i1(t.y,e.y);return Math.sqrt(n**2+i**2)}const r1=new Set(["auto","scroll"]);class EC{constructor(e,n,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3,element:c}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Zd(this.lastRawMoveEventInfo,this.transformPagePoint));const v=ng(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,w=nz(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!w)return;const{point:y}=v,{timestamp:b}=hi;this.history.push({...y,timestamp:b});const{onStart:T,onMove:A}=this.handlers;_||(T&&T(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,v)},this.handlePointerMove=(v,_)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=_,this.lastMoveEventInfo=Zd(_,this.transformPagePoint),An.update(this.updatePoint,!0)},this.handlePointerUp=(v,_)=>{this.end();const{onEnd:w,onSessionEnd:y,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=ng(v.type==="pointercancel"?this.lastMoveEventInfo:Zd(_,this.transformPagePoint),this.history);this.startEvent&&w&&w(v,T),y&&y(v,T)},!Fy(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=r||window;const u=Uu(e),d=Zd(u,this.transformPagePoint),{point:h}=d,{timestamp:p}=hi;this.history=[{...h,timestamp:p}];const{onSessionStart:m}=n;m&&m(e,ng(d,this.history)),this.removeListeners=Du(cu(this.contextWindow,"pointermove",this.handlePointerMove),cu(this.contextWindow,"pointerup",this.handlePointerUp),cu(this.contextWindow,"pointercancel",this.handlePointerUp)),c&&this.startScrollTracking(c)}startScrollTracking(e){let n=e.parentElement;for(;n;){const i=getComputedStyle(n);(r1.has(i.overflowX)||r1.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const i=e===window,r=i?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:r.x-n.x,y:r.y-n.y};s.x===0&&s.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,r),An.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ia(this.updatePoint)}}function Zd(t,e){return e?{point:e(t.point)}:t}function s1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ng({point:t},e){return{point:t,delta:s1(t,MC(e)),offset:s1(t,iz(e)),velocity:rz(e,.1)}}function iz(t){return t[0]}function MC(t){return t[t.length-1]}function rz(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const r=MC(t);for(;n>=0&&(i=t[n],!(r.timestamp-i.timestamp>Qi(e)));)n--;if(!i)return{x:0,y:0};i===t[0]&&t.length>2&&r.timestamp-i.timestamp>Qi(e)*2&&(i=t[1]);const s=hr(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function sz(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Ln(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Ln(n,t,i.max):Math.min(t,n)),t}function a1(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function az(t,{top:e,left:n,bottom:i,right:r}){return{x:a1(t.x,n,r),y:a1(t.y,e,i)}}function o1(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function oz(t,e){return{x:o1(t.x,e.x),y:o1(t.y,e.y)}}function lz(t,e){let n=.5;const i=Ri(t),r=Ri(e);return r>i?n=gu(e.min,e.max-i,t.min):i>r&&(n=gu(t.min,t.max-r,e.min)),cs(0,1,n)}function cz(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const B0=.35;function uz(t=B0){return t===!1?t=0:t===!0&&(t=B0),{x:l1(t,"left","right"),y:l1(t,"top","bottom")}}function l1(t,e,n){return{min:c1(t,e),max:c1(t,n)}}function c1(t,e){return typeof t=="number"?t:t[e]||0}const dz=new WeakMap;class fz{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ti(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=p=>{n&&this.snapToCursor(Uu(p).point),this.stopAnimation()},o=(p,m)=>{const{drag:v,dragPropagation:_,onDragStart:w}=this.getProps();if(v&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=BB(v),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Yr(b=>{let T=this.getAxisMotionValue(b).get()||0;if(ns.test(T)){const{projection:A}=this.visualElement;if(A&&A.layout){const M=A.layout.layoutBox[b];M&&(T=Ri(M)*(parseFloat(T)/100))}}this.originPoint[b]=T}),w&&An.update(()=>w(p,m),!1,!0),k0(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},c=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m;const{dragPropagation:v,dragDirectionLock:_,onDirectionLock:w,onDrag:y}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:b}=m;if(_&&this.currentDirection===null){this.currentDirection=pz(b),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),y&&An.update(()=>y(p,m),!1,!0)},u=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m,this.stop(p,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new EC(e,{onSessionStart:s,onStart:o,onMove:c,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:i,contextWindow:wC(this.visualElement),element:this.visualElement.current})}stop(e,n){const i=e||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!i)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:c}=this.getProps();c&&An.postRender(()=>c(i,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,i){const{drag:r}=this.getProps();if(!i||!Jd(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=sz(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Tl(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=az(i.layoutBox,e):this.constraints=!1,this.elastic=uz(n),r!==this.constraints&&!Tl(e)&&i&&this.constraints&&!this.hasMutatedConstraints&&Yr(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=cz(i.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Tl(e))return!1;const i=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=h4(i,r.root,this.visualElement.getTransformPagePoint());let o=oz(r.layout.layoutBox,s);if(n){const c=n(u4(o));this.hasMutatedConstraints=!!c,c&&(o=$A(c))}return o}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=Yr(h=>{if(!Jd(h,n,this.currentDirection))return;let p=u&&u[h]||{};(o===!0||o===h)&&(p={min:0,max:0});const m=r?200:1e6,v=r?40:1e7,_={type:"inertia",velocity:i?e[h]:0,bounceStiffness:m,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(h,_)});return Promise.all(d).then(c)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return k0(this.visualElement,e),i.start(Ly(e,i,0,n,this.visualElement,!1))}stopAnimation(){Yr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Yr(n=>{const{drag:i}=this.getProps();if(!Jd(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:c}=r.layout.layoutBox[n],u=s.get()||0;s.set(e[n]-Ln(o,c,.5)+u)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Tl(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Yr(o=>{const c=this.getAxisMotionValue(o);if(c&&this.constraints!==!1){const u=c.get();r[o]=lz({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),Yr(o=>{if(!Jd(o,e,null))return;const c=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];c.set(Ln(u,d,r[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;dz.set(this.visualElement,this);const e=this.visualElement.current,n=cu(e,"pointerdown",d=>{const{drag:h,dragListener:p=!0}=this.getProps(),m=d.target,v=m!==e&&WB(m);h&&p&&!v&&this.start(d)});let i;const r=()=>{const{dragConstraints:d}=this.getProps();Tl(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),i||(i=hz(e,d.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),An.read(r);const c=_u(window,"resize",()=>this.scalePositionWithinConstraints()),u=s.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:h})=>{this.isDragging&&h&&(Yr(p=>{const m=this.getAxisMotionValue(p);m&&(this.originPoint[p]+=d[p].translate,m.set(m.get()+d[p].translate))}),this.visualElement.render())}));return()=>{c(),n(),o(),u&&u(),i&&i()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=B0,dragMomentum:c=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:c}}}function u1(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function hz(t,e,n){const i=vw(t,u1(n)),r=vw(e,u1(n));return()=>{i(),r()}}function Jd(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function pz(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class mz extends Fa{constructor(e){super(e),this.removeGroupControls=pr,this.removeListeners=pr,this.controls=new fz(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||pr}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ig=t=>(e,n)=>{t&&An.update(()=>t(e,n),!1,!0)};class gz extends Fa{constructor(){super(...arguments),this.removePointerDownListener=pr}onPointerDown(e){this.session=new EC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:wC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:ig(e),onStart:ig(n),onMove:ig(i),onEnd:(s,o)=>{delete this.session,r&&An.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=cu(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let rg=!1;class vz extends L.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),rg&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Gf.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,{projection:o}=i;return o&&(o.isPresent=s,e.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),rg=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==s?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||An.postRender(()=>{const c=o.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:i}=e;i&&(i.options.layoutAnchor=n,i.root.didUpdate(),Uy.postRender(()=>{!i.currentAnimation&&i.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=e;rg=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function TC(t){const[e,n]=pC(),i=L.useContext(vy);return F.jsx(vz,{...t,layoutGroup:i,switchLayoutGroup:L.useContext(bC),isPresent:e,safeToRemove:n})}const yz={pan:{Feature:gz},drag:{Feature:mz,ProjectionNode:hC,MeasureLayout:TC}};function d1(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&An.postRender(()=>s(e,Uu(e)))}class _z extends Fa{mount(){const{current:e}=this.node;e&&(this.unmount=VB(e,(n,i)=>(d1(this.node,i,"Start"),r=>d1(this.node,r,"End"))))}unmount(){}}class xz extends Fa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Du(_u(this.node.current,"focus",()=>this.onFocus()),_u(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function f1(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&An.postRender(()=>s(e,Uu(e)))}class bz extends Fa{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=XB(e,(r,s)=>(f1(this.node,s,"Start"),(o,{success:c})=>f1(this.node,o,c?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const z0=new WeakMap,sg=new WeakMap,Sz=t=>{const e=z0.get(t.target);e&&e(t)},wz=t=>{t.forEach(Sz)};function Ez({root:t,...e}){const n=t||document;sg.has(n)||sg.set(n,{});const i=sg.get(n),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(wz,{root:t,...e})),i[r]}function Mz(t,e,n){const i=Ez(e);return z0.set(t,n),i.observe(t),()=>{z0.delete(t),i.unobserve(t)}}const Tz={some:0,all:1};class Az extends Fa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=e,o={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:Tz[r]},c=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,s&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),m=d?h:p;m&&m(u)};this.stopObserver=Mz(this.node.current,o,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Cz(e,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function Cz({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Pz={inView:{Feature:Az},tap:{Feature:bz},focus:{Feature:xz},hover:{Feature:_z}},Rz={layout:{ProjectionNode:hC,MeasureLayout:TC}},kz={...ez,...Pz,...yz,...Rz},Il=Y5(kz,K5);function Lz(){!Vy.current&&GA();const[t]=L.useState(gh.current);return t}const AC=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim();const Dz=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Nz=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase());const h1=t=>{const e=Nz(t);return e.charAt(0).toUpperCase()+e.slice(1)};var ag={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Iz=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},Uz=L.createContext({}),Fz=()=>L.useContext(Uz),Oz=L.forwardRef(({color:t,size:e,strokeWidth:n,absoluteStrokeWidth:i,className:r="",children:s,iconNode:o,...c},u)=>{const{size:d=24,strokeWidth:h=2,absoluteStrokeWidth:p=!1,color:m="currentColor",className:v=""}=Fz()??{},_=i??p?Number(n??h)*24/Number(e??d):n??h;return L.createElement("svg",{ref:u,...ag,width:e??d??ag.width,height:e??d??ag.height,stroke:t??m,strokeWidth:_,className:AC("lucide",v,r),...!s&&!Iz(c)&&{"aria-hidden":"true"},...c},[...o.map(([w,y])=>L.createElement(w,y)),...Array.isArray(s)?s:[s]])});const br=(t,e)=>{const n=L.forwardRef(({className:i,...r},s)=>L.createElement(Oz,{ref:s,iconNode:e,className:AC(`lucide-${Dz(h1(t))}`,`lucide-${t}`,i),...r}));return n.displayName=h1(t),n};const Bz=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],zz=br("chart-column",Bz);const Vz=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Hz=br("gauge",Vz);const Gz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],jz=br("globe",Gz);const Wz=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],$z=br("layout-grid",Wz);const Xz=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],qz=br("mail",Xz);const Yz=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Kz=br("menu",Yz);const Zz=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Jz=br("monitor",Zz);const Qz=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],CC=br("moon",Qz);const eV=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],tV=br("settings",eV);const nV=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],PC=br("sun",nV);const iV=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],rV=br("trophy",iV);const sV=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],RC=br("x",sV);function kC(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=kC(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function aV(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=kC(t))&&(i&&(i+=" "),i+=e);return i}const oV=(t,e)=>{const n=new Array(t.length+e.length);for(let i=0;i<t.length;i++)n[i]=t[i];for(let i=0;i<e.length;i++)n[t.length+i]=e[i];return n},lV=(t,e)=>({classGroupId:t,validator:e}),LC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),bh="-",p1=[],cV="arbitrary..",uV=t=>{const e=fV(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return dV(o);const c=o.split(bh),u=c[0]===""&&c.length>1?1:0;return DC(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=i[o],d=n[o];return u?d?oV(d,u):u:d||p1}return n[o]||p1}}},DC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const r=t[e],s=n.nextPart.get(r);if(s){const d=DC(t,e+1,s);if(d)return d}const o=n.validators;if(o===null)return;const c=e===0?t.join(bh):t.slice(e).join(bh),u=o.length;for(let d=0;d<u;d++){const h=o[d];if(h.validator(c))return h.classGroupId}},dV=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),i=e.slice(0,n);return i?cV+i:void 0})(),fV=t=>{const{theme:e,classGroups:n}=t;return hV(n,e)},hV=(t,e)=>{const n=LC();for(const i in t){const r=t[i];Xy(r,n,i,e)}return n},Xy=(t,e,n,i)=>{const r=t.length;for(let s=0;s<r;s++){const o=t[s];pV(o,e,n,i)}},pV=(t,e,n,i)=>{if(typeof t=="string"){mV(t,e,n);return}if(typeof t=="function"){gV(t,e,n,i);return}vV(t,e,n,i)},mV=(t,e,n)=>{const i=t===""?e:NC(e,t);i.classGroupId=n},gV=(t,e,n,i)=>{if(yV(t)){Xy(t(i),e,n,i);return}e.validators===null&&(e.validators=[]),e.validators.push(lV(n,t))},vV=(t,e,n,i)=>{const r=Object.entries(t),s=r.length;for(let o=0;o<s;o++){const[c,u]=r[o];Xy(u,NC(e,c),n,i)}},NC=(t,e)=>{let n=t;const i=e.split(bh),r=i.length;for(let s=0;s<r;s++){const o=i[s];let c=n.nextPart.get(o);c||(c=LC(),n.nextPart.set(o,c)),n=c}return n},yV=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,_V=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),i=Object.create(null);const r=(s,o)=>{n[s]=o,e++,e>t&&(e=0,i=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=i[s])!==void 0)return r(s,o),o},set(s,o){s in n?n[s]=o:r(s,o)}}},V0="!",m1=":",xV=[],g1=(t,e,n,i,r)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:i,isExternal:r}),bV=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=r=>{const s=[];let o=0,c=0,u=0,d;const h=r.length;for(let w=0;w<h;w++){const y=r[w];if(o===0&&c===0){if(y===m1){s.push(r.slice(u,w)),u=w+1;continue}if(y==="/"){d=w;continue}}y==="["?o++:y==="]"?o--:y==="("?c++:y===")"&&c--}const p=s.length===0?r:r.slice(u);let m=p,v=!1;p.endsWith(V0)?(m=p.slice(0,-1),v=!0):p.startsWith(V0)&&(m=p.slice(1),v=!0);const _=d&&d>u?d-u:void 0;return g1(s,v,m,_)};if(e){const r=e+m1,s=i;i=o=>o.startsWith(r)?s(o.slice(r.length)):g1(xV,!1,o,void 0,!0)}if(n){const r=i;i=s=>n({className:s,parseClassName:r})}return i},SV=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,i)=>{e.set(n,1e6+i)}),n=>{const i=[];let r=[];for(let s=0;s<n.length;s++){const o=n[s],c=o[0]==="[",u=e.has(o);c||u?(r.length>0&&(r.sort(),i.push(...r),r=[]),i.push(o)):r.push(o)}return r.length>0&&(r.sort(),i.push(...r)),i}},wV=t=>({cache:_V(t.cacheSize),parseClassName:bV(t),sortModifiers:SV(t),...uV(t)}),EV=/\s+/,MV=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:s}=e,o=[],c=t.trim().split(EV);let u="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:p,modifiers:m,hasImportantModifier:v,baseClassName:_,maybePostfixModifierPosition:w}=n(h);if(p){u=h+(u.length>0?" "+u:u);continue}let y=!!w,b=i(y?_.substring(0,w):_);if(!b){if(!y){u=h+(u.length>0?" "+u:u);continue}if(b=i(_),!b){u=h+(u.length>0?" "+u:u);continue}y=!1}const T=m.length===0?"":m.length===1?m[0]:s(m).join(":"),A=v?T+V0:T,M=A+b;if(o.indexOf(M)>-1)continue;o.push(M);const I=r(b,y);for(let k=0;k<I.length;++k){const U=I[k];o.push(A+U)}u=h+(u.length>0?" "+u:u)}return u},TV=(...t)=>{let e=0,n,i,r="";for(;e<t.length;)(n=t[e++])&&(i=IC(n))&&(r&&(r+=" "),r+=i);return r},IC=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=IC(t[i]))&&(n&&(n+=" "),n+=e);return n},AV=(t,...e)=>{let n,i,r,s;const o=u=>{const d=e.reduce((h,p)=>p(h),t());return n=wV(d),i=n.cache.get,r=n.cache.set,s=c,c(u)},c=u=>{const d=i(u);if(d)return d;const h=MV(u,n);return r(u,h),h};return s=o,(...u)=>s(TV(...u))},CV=[],ei=t=>{const e=n=>n[t]||CV;return e.isThemeGetter=!0,e},UC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,FC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PV=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,RV=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kV=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,LV=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DV=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NV=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pa=t=>PV.test(t),qt=t=>!!t&&!Number.isNaN(Number(t)),ma=t=>!!t&&Number.isInteger(Number(t)),og=t=>t.endsWith("%")&&qt(t.slice(0,-1)),Ts=t=>RV.test(t),OC=()=>!0,IV=t=>kV.test(t)&&!LV.test(t),qy=()=>!1,UV=t=>DV.test(t),FV=t=>NV.test(t),OV=t=>!dt(t)&&!mt(t),BV=t=>Oa(t,VC,qy),dt=t=>UC.test(t),Qa=t=>Oa(t,HC,IV),v1=t=>Oa(t,XV,qt),zV=t=>Oa(t,jC,OC),VV=t=>Oa(t,GC,qy),y1=t=>Oa(t,BC,qy),HV=t=>Oa(t,zC,FV),Qd=t=>Oa(t,WC,UV),mt=t=>FC.test(t),Vc=t=>Io(t,HC),GV=t=>Io(t,GC),_1=t=>Io(t,BC),jV=t=>Io(t,VC),WV=t=>Io(t,zC),ef=t=>Io(t,WC,!0),$V=t=>Io(t,jC,!0),Oa=(t,e,n)=>{const i=UC.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},Io=(t,e,n=!1)=>{const i=FC.exec(t);return i?i[1]?e(i[1]):n:!1},BC=t=>t==="position"||t==="percentage",zC=t=>t==="image"||t==="url",VC=t=>t==="length"||t==="size"||t==="bg-size",HC=t=>t==="length",XV=t=>t==="number",GC=t=>t==="family-name",jC=t=>t==="number"||t==="weight",WC=t=>t==="shadow",qV=()=>{const t=ei("color"),e=ei("font"),n=ei("text"),i=ei("font-weight"),r=ei("tracking"),s=ei("leading"),o=ei("breakpoint"),c=ei("container"),u=ei("spacing"),d=ei("radius"),h=ei("shadow"),p=ei("inset-shadow"),m=ei("text-shadow"),v=ei("drop-shadow"),_=ei("blur"),w=ei("perspective"),y=ei("aspect"),b=ei("ease"),T=ei("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...M(),mt,dt],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],S=()=>[mt,dt,u],P=()=>[pa,"full","auto",...S()],V=()=>[ma,"none","subgrid",mt,dt],O=()=>["auto",{span:["full",ma,mt,dt]},ma,mt,dt],G=()=>[ma,"auto",mt,dt],J=()=>["auto","min","max","fr",mt,dt],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...S()],Q=()=>[pa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],W=()=>[pa,"screen","full","dvw","lvw","svw","min","max","fit",...S()],q=()=>[pa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],Z=()=>[t,mt,dt],z=()=>[...M(),_1,y1,{position:[mt,dt]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ee=()=>["auto","cover","contain",jV,BV,{size:[mt,dt]}],ze=()=>[og,Vc,Qa],Se=()=>["","none","full",d,mt,dt],ne=()=>["",qt,Vc,Qa],ye=()=>["solid","dashed","dotted","double"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ne=()=>[qt,og,_1,y1],et=()=>["","none",_,mt,dt],xt=()=>["none",qt,mt,dt],pn=()=>["none",qt,mt,dt],ht=()=>[qt,mt,dt],Ft=()=>[pa,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ts],breakpoint:[Ts],color:[OC],container:[Ts],"drop-shadow":[Ts],ease:["in","out","in-out"],font:[OV],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ts],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ts],shadow:[Ts],spacing:["px",qt],text:[Ts],"text-shadow":[Ts],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pa,dt,mt,y]}],container:["container"],columns:[{columns:[qt,dt,mt,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[ma,"auto",mt,dt]}],basis:[{basis:[pa,"full","auto",c,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qt,pa,"auto","initial","none",dt]}],grow:[{grow:["",qt,mt,dt]}],shrink:[{shrink:["",qt,mt,dt]}],order:[{order:[ma,"first","last","none",mt,dt]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Vc,Qa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,$V,zV]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",og,dt]}],"font-family":[{font:[GV,VV,e]}],"font-features":[{"font-features":[dt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,mt,dt]}],"line-clamp":[{"line-clamp":[qt,"none",mt,v1]}],leading:[{leading:[s,...S()]}],"list-image":[{"list-image":["none",mt,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",mt,dt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[qt,"from-font","auto",mt,Qa]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[qt,"auto",mt,dt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt,dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mt,dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:Ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ma,mt,dt],radial:["",mt,dt],conic:[ma,mt,dt]},WV,HV]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:ze()}],"gradient-via-pos":[{via:ze()}],"gradient-to-pos":[{to:ze()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:Se()}],"rounded-s":[{"rounded-s":Se()}],"rounded-e":[{"rounded-e":Se()}],"rounded-t":[{"rounded-t":Se()}],"rounded-r":[{"rounded-r":Se()}],"rounded-b":[{"rounded-b":Se()}],"rounded-l":[{"rounded-l":Se()}],"rounded-ss":[{"rounded-ss":Se()}],"rounded-se":[{"rounded-se":Se()}],"rounded-ee":[{"rounded-ee":Se()}],"rounded-es":[{"rounded-es":Se()}],"rounded-tl":[{"rounded-tl":Se()}],"rounded-tr":[{"rounded-tr":Se()}],"rounded-br":[{"rounded-br":Se()}],"rounded-bl":[{"rounded-bl":Se()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ye(),"hidden","none"]}],"divide-style":[{divide:[...ye(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qt,mt,dt]}],"outline-w":[{outline:["",qt,Vc,Qa]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",h,ef,Qd]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",p,ef,Qd]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[qt,Qa]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",m,ef,Qd]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[qt,mt,dt]}],"mix-blend":[{"mix-blend":[...be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ne()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":Ne()}],"mask-image-t-to-pos":[{"mask-t-to":Ne()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":Ne()}],"mask-image-r-to-pos":[{"mask-r-to":Ne()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":Ne()}],"mask-image-b-to-pos":[{"mask-b-to":Ne()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":Ne()}],"mask-image-l-to-pos":[{"mask-l-to":Ne()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":Ne()}],"mask-image-x-to-pos":[{"mask-x-to":Ne()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":Ne()}],"mask-image-y-to-pos":[{"mask-y-to":Ne()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[mt,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ne()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[qt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ne()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:Ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",mt,dt]}],filter:[{filter:["","none",mt,dt]}],blur:[{blur:et()}],brightness:[{brightness:[qt,mt,dt]}],contrast:[{contrast:[qt,mt,dt]}],"drop-shadow":[{"drop-shadow":["","none",v,ef,Qd]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",qt,mt,dt]}],"hue-rotate":[{"hue-rotate":[qt,mt,dt]}],invert:[{invert:["",qt,mt,dt]}],saturate:[{saturate:[qt,mt,dt]}],sepia:[{sepia:["",qt,mt,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",mt,dt]}],"backdrop-blur":[{"backdrop-blur":et()}],"backdrop-brightness":[{"backdrop-brightness":[qt,mt,dt]}],"backdrop-contrast":[{"backdrop-contrast":[qt,mt,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qt,mt,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qt,mt,dt]}],"backdrop-invert":[{"backdrop-invert":["",qt,mt,dt]}],"backdrop-opacity":[{"backdrop-opacity":[qt,mt,dt]}],"backdrop-saturate":[{"backdrop-saturate":[qt,mt,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",qt,mt,dt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",mt,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qt,"initial",mt,dt]}],ease:[{ease:["linear","initial",b,mt,dt]}],delay:[{delay:[qt,mt,dt]}],animate:[{animate:["none",T,mt,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,mt,dt]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:xt()}],"rotate-x":[{"rotate-x":xt()}],"rotate-y":[{"rotate-y":xt()}],"rotate-z":[{"rotate-z":xt()}],scale:[{scale:pn()}],"scale-x":[{"scale-x":pn()}],"scale-y":[{"scale-y":pn()}],"scale-z":[{"scale-z":pn()}],"scale-3d":["scale-3d"],skew:[{skew:ht()}],"skew-x":[{"skew-x":ht()}],"skew-y":[{"skew-y":ht()}],transform:[{transform:[mt,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ft()}],"translate-x":[{"translate-x":Ft()}],"translate-y":[{"translate-y":Ft()}],"translate-z":[{"translate-z":Ft()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",mt,dt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",mt,dt]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[qt,Vc,Qa,v1]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},YV=AV(qV);function Mn(...t){return YV(aV(t))}const KV=F.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[F.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),F.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),F.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),F.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),ZV=F.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:F.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),JV={google:KV,github:ZV},QV={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function eH(t){return QV[t]||String(t||"").replace(/-/g," ")}function tH(){const{isOpen:t,closeLoginModal:e}=zT(),{enabled:n,signedIn:i,refreshUser:r,signInWithPassword:s,signUp:o,signInWithOAuth:c,getPublicAuthConfig:u}=Do(),[d,h]=L.useState("signin"),[p,m]=L.useState(""),[v,_]=L.useState(""),[w,y]=L.useState(""),[b,T]=L.useState(!1),[A,M]=L.useState(null),[I,k]=L.useState(null),[U,S]=L.useState(!1),[P,V]=L.useState(!0),[O,G]=L.useState([]),[J,H]=L.useState(8);L.useEffect(()=>{t&&(M(null),k(null),h("signin"),m(""),_(""),y(""),S(!1))},[t]),L.useEffect(()=>{if(!t||!n){V(!1);return}let W=!0;return(async()=>{const{data:q,error:Z}=await u();if(W){if(Z||!q)G(["google","github"]);else{const z=Array.isArray(q.oAuthProviders)?q.oAuthProviders:[],ie=Array.isArray(q.customOAuthProviders)?q.customOAuthProviders:[];G([...z,...ie]),typeof q.passwordMinLength=="number"&&q.passwordMinLength>0&&H(q.passwordMinLength)}V(!1)}})(),()=>{W=!1}},[t,n,u]),L.useEffect(()=>{t&&i&&e()},[t,i,e]);const X=L.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),K=L.useCallback(async W=>{M(null),T(!0);try{const{error:q}=await c(W,X);q&&M(q.message||String(q))}finally{T(!1)}},[c,X]),Q=L.useCallback(async W=>{W.preventDefault(),M(null),T(!0);try{if(d==="signup"){const{data:Z,error:z}=await o({email:p.trim(),password:v,name:w.trim()||void 0});if(z){M(z.message||String(z));return}if(Z?.requireEmailVerification){k("Check your email for a verification link."),h("signin");return}await r();return}const{error:q}=await s({email:p.trim(),password:v});if(q){M(q.message||String(q));return}await r()}finally{T(!1)}},[d,p,v,w,o,s,r]);return L.useEffect(()=>{if(!t)return;const W=q=>{q.key==="Escape"&&e()};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[t,e]),n?F.jsx(E5,{children:t&&F.jsxs(Il.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[F.jsx(Il.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60 ",onClick:e,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),F.jsxs(Il.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 p-6 shadow-2xl",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:W=>W.stopPropagation(),children:[F.jsx("button",{type:"button",onClick:e,className:"absolute right-4 top-4 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:F.jsx(RC,{className:"h-5 w-5"})}),F.jsxs("div",{className:"text-center mb-6",children:[F.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[F.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),F.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white",children:"Token Tracker"})]}),F.jsx("p",{className:"text-sm text-oai-gray-500",children:"Sign in to join the leaderboard"})]}),I&&F.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:I}),A&&F.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",role:"alert",children:A}),F.jsx("div",{className:"space-y-2.5 mb-5",children:P?F.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900 animate-pulse"}):O.map(W=>F.jsxs("button",{type:"button",disabled:b,onClick:()=>K(W),className:Mn("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[JV[W]||null,"Continue with ",eH(W)]},W))}),U?F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"relative mb-5",children:[F.jsx("div",{className:"absolute inset-0 flex items-center",children:F.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),F.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:F.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:"email"})})]}),F.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[F.jsx("button",{type:"button",className:Mn("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",d==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{h("signin"),M(null)},children:"Sign In"}),F.jsx("button",{type:"button",className:Mn("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",d==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{h("signup"),M(null)},children:"Sign Up"})]}),F.jsxs("form",{onSubmit:Q,className:"space-y-3",children:[d==="signup"&&F.jsxs("div",{children:[F.jsx("label",{htmlFor:"modal-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:"Name"}),F.jsx("input",{id:"modal-name",type:"text",autoComplete:"name",value:w,onChange:W=>y(W.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:"Optional"})]}),F.jsxs("div",{children:[F.jsx("label",{htmlFor:"modal-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:"Email"}),F.jsx("input",{id:"modal-email",type:"email",autoComplete:"email",required:!0,value:p,onChange:W=>m(W.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),F.jsxs("div",{children:[F.jsx("label",{htmlFor:"modal-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:"Password"}),F.jsx("input",{id:"modal-password",type:"password",autoComplete:d==="signup"?"new-password":"current-password",required:!0,minLength:d==="signup"?J:void 0,value:v,onChange:W=>_(W.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),d==="signup"&&F.jsxs("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:["At least ",J," characters"]})]}),F.jsx("button",{type:"submit",disabled:b,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:d==="signup"?"Create Account":"Sign In"})]})]}):F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"relative mb-5",children:[F.jsx("div",{className:"absolute inset-0 flex items-center",children:F.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),F.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:F.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:"or"})})]}),F.jsxs("button",{type:"button",onClick:()=>S(!0),className:Mn("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[F.jsx(qz,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),"Continue with Email"]})]})]})]})}):null}const nH={VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function iH(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return"";const e=typeof import.meta<"u"?nH:void 0;return(e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||e?.VITE_INSFORGE_BASE_URL||"").trim()}function kX(){return Ro()}function $C(t=""){if(typeof t!="string"||t.length===0)return!1;const e=new URLSearchParams(t),n=String(e.get("screenshot")||"").toLowerCase();return n==="1"||n==="true"}const rH=300*1e3;function Yy(t){return typeof t=="string"&&/^https?:\/\//i.test(t.trim())}async function XC(t){const e=Ro();if(!Yy(e)||!t)return;const n=e.replace(/\/$/,""),i=Nh(),r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};i&&(r.apikey=i);try{await fetch(`${n}/functions/tokentracker-leaderboard-refresh`,{method:"POST",headers:r,body:JSON.stringify({period:"week"})})}catch{}}async function qC(t){const e=Ro();if(!Yy(e)||!t)return null;const n=e.replace(/\/$/,""),i=Nh(),r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};i&&(r.apikey=i);const s=typeof navigator<"u"&&typeof navigator.platform=="string"?navigator.platform:"web",o=await fetch(`${n}/functions/tokentracker-device-token-issue`,{method:"POST",headers:r,body:JSON.stringify({device_name:"Token Tracker (dashboard)",platform:s})});if(!o.ok)return null;const c=await o.json().catch(()=>null),u=typeof c?.token=="string"?c.token:null,d=typeof c?.device_id=="string"?c.device_id:null;return!u||!d?null:{token:u,deviceId:d,issuedAt:typeof c?.created_at=="string"?c.created_at:new Date().toISOString()}}async function YC(t){const{deviceToken:e,insforgeBaseUrl:n}=t,i={deviceToken:e},r=n||Ro();Yy(r)&&(i.insforgeBaseUrl=r.trim());const s=await fetch("/functions/tokentracker-local-sync",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(i)}),o=await s.json().catch(()=>({}));if(!s.ok){const c=typeof o.error=="string"?o.error:`HTTP ${s.status}`;throw new Error(c)}return o}async function sH(t){const e=LI();if(Date.now()-e<rH)return;const n=await t();if(!n)return;let i=uT();if(!i){const r=await qC(n);if(!r)return;dT(r),i=r}await YC({deviceToken:i.token,insforgeBaseUrl:Ro()}),fT(Date.now()),await XC(n)}async function LX(t){const e=await t();if(!e)return;let n=uT();if(!n){const i=await qC(e);if(!i)return;dT(i),n=i}await YC({deviceToken:n.token,insforgeBaseUrl:Ro()}),fT(Date.now()),await XC(e)}function aH(t){const e=t.replace(/\/+$/,"")||"/";return e==="/share"||e==="/share.html"||e.startsWith("/share/")}function oH(t){const e=t.replace(/\/+$/,"")||"/";return e==="/login"||e==="/landing"||aH(e)?!1:e==="/"||e==="/dashboard"||e.startsWith("/leaderboard")}function lH(){const t=vr(),e=Do(),n=L.useRef(!1);L.useEffect(()=>{if(!PI()||!oH(t.pathname||"/")||!e.enabled||!e.signedIn||e.loading||!RI())return;let i=!1;const r=window.setTimeout(()=>{(async()=>{if(!(i||n.current)){n.current=!0;try{await sH(()=>e.getAccessToken())}catch(s){console.warn("[tokentracker] cloud usage sync:",s)}finally{n.current=!1}}})()},2500);return()=>{i=!0,window.clearTimeout(r)}},[t.pathname,e.enabled,e.signedIn,e.loading,e.getAccessToken])}function KC(){return typeof navigator>"u"?null:navigator.clipboard||null}function cH(){return typeof window>"u"?null:window.ClipboardItem||null}async function uH(t,{clipboard:e}={}){const n=e??KC();if(!n||typeof n.writeText!="function")return!1;try{return await n.writeText(t),!0}catch{return!1}}async function DX(t,{clipboard:e}={}){const n=e??KC(),i=cH();if(!t||!n||typeof n.write!="function"||!i)return!1;try{const r=t.type||"image/png",s=t.type&&t.type!==r?t.slice(0,t.size,r):t.type?t:t.slice(0,t.size,r),o=new i({[r]:s});return await n.write([o]),!0}catch{return!1}}function dH(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"}function fH(){return dH()?"/":"/dashboard"}function ZC({prefersReducedMotion:t,screenshotCapture:e}){return!(e||t)}function hH({repo:t="mm7894215/TokenTracker"}){const[e,n]=L.useState(null);return L.useEffect(()=>{if(typeof window>"u")return;const i=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,r=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));ZC({prefersReducedMotion:i,screenshotCapture:r})&&fetch(`https://api.github.com/repos/${t}`).then(s=>s.json()).then(s=>{s&&typeof s.stargazers_count=="number"&&n(s.stargazers_count)}).catch(()=>{})},[t]),F.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[F.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:F.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),F.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:"Star"}),e!==null&&F.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:e})]})}function pH(t){if(!t||typeof t!="object")return null;const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=e.avatar_url||e.picture||n.avatar_url||t.avatar_url;return typeof i=="string"&&i.trim()?i.trim():null}function x1(t){const e=String(t||"").trim();if(!e)return"?";const n=e.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function H0({className:t,variant:e="header",collapsed:n=!1,onAfterAction:i}){const r=e==="sidebar",{enabled:s,loading:o,signedIn:c,user:u,displayName:d}=Do(),{openLoginModal:h}=zT(),p=Au(),m=L.useMemo(()=>pH(u),[u]);if(!s)return null;if(o)return F.jsx("div",{className:Mn("h-9 w-9 shrink-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 animate-pulse",t),"aria-hidden":!0});if(!c)return r?F.jsxs("button",{type:"button",onClick:()=>{h(),i?.()},className:Mn("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 min-w-0",n?"h-8 w-8 justify-center px-0":"w-full",t),"aria-label":Ct("header.auth.sign_in_aria"),title:n?"Sign In":void 0,children:[F.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:F.jsx("img",{src:"/app-icon.png",alt:"",width:18,height:18,className:"h-[18px] w-[18px] rounded"})}),!n&&F.jsx("span",{className:"truncate flex-1 text-left",children:"Sign in"})]}):F.jsx("button",{type:"button",onClick:h,className:Mn("shrink-0 inline-flex h-9 items-center justify-center gap-1.5 rounded-full px-5 text-sm font-medium transition-colors duration-200 ease-out shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",t),"aria-label":Ct("header.auth.sign_in_aria"),children:"Sign In"});const v=()=>{p("/settings"),i?.()};return F.jsx("div",{className:Mn(r?"relative flex w-full shrink-0 items-center":"relative flex shrink-0 items-center",t),children:F.jsxs("button",{type:"button",onClick:v,className:Mn(r?Mn("flex w-full items-center gap-2 rounded-md px-2 py-1.5 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 transition-colors min-w-0",n&&"justify-center px-0 py-0 h-9 w-9"):"flex items-center gap-2 rounded-full pl-1 pr-2 py-1 border border-transparent hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900/80 hover:border-oai-gray-200 dark:hover:border-oai-gray-800 transition-colors"),"aria-label":Ct("header.auth.open_settings"),title:r&&n?d:void 0,children:[r?F.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:m?F.jsx("img",{src:m,alt:"",width:20,height:20,className:"h-5 w-5 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700",referrerPolicy:"no-referrer"}):F.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600 text-[9px] font-semibold text-white ring-1 ring-oai-brand-500/50",children:x1(d)})}):m?F.jsx("img",{src:m,alt:"",width:32,height:32,className:"h-8 w-8 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700 shrink-0",referrerPolicy:"no-referrer"}):F.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600 text-xs font-semibold text-white ring-1 ring-oai-brand-500/50",children:x1(d)}),r?!n&&F.jsx("span",{className:"truncate text-[13px] font-medium text-oai-gray-900 dark:text-oai-gray-200 flex-1 text-left min-w-0",children:d}):F.jsx("span",{className:"hidden sm:inline truncate text-sm font-medium text-oai-gray-900 dark:text-oai-gray-200 max-w-[120px]",children:d})]})})}const Ky="183",mH=0,b1=1,gH=2,jf=1,vH=2,tu=3,Ua=0,Gi=1,Ns=2,Os=0,_o=1,S1=2,w1=3,E1=4,yH=5,lo=100,_H=101,xH=102,bH=103,SH=104,wH=200,EH=201,MH=202,TH=203,G0=204,j0=205,AH=206,CH=207,PH=208,RH=209,kH=210,LH=211,DH=212,NH=213,IH=214,W0=0,$0=1,X0=2,jl=3,q0=4,Y0=5,K0=6,Z0=7,JC=0,UH=1,FH=2,is=0,QC=1,eP=2,tP=3,nP=4,iP=5,rP=6,sP=7,aP=300,To=301,Wl=302,lg=303,cg=304,Hh=306,J0=1e3,Is=1001,Q0=1002,mi=1003,OH=1004,tf=1005,wi=1006,ug=1007,mo=1008,fr=1009,oP=1010,lP=1011,xu=1012,Zy=1013,us=1014,Qr=1015,Hs=1016,Jy=1017,Qy=1018,bu=1020,cP=35902,uP=35899,dP=1021,fP=1022,Fr=1023,Gs=1026,go=1027,hP=1028,e_=1029,$l=1030,t_=1031,n_=1033,Wf=33776,$f=33777,Xf=33778,qf=33779,ev=35840,tv=35841,nv=35842,iv=35843,rv=36196,sv=37492,av=37496,ov=37488,lv=37489,cv=37490,uv=37491,dv=37808,fv=37809,hv=37810,pv=37811,mv=37812,gv=37813,vv=37814,yv=37815,_v=37816,xv=37817,bv=37818,Sv=37819,wv=37820,Ev=37821,Mv=36492,Tv=36494,Av=36495,Cv=36283,Pv=36284,Rv=36285,kv=36286,BH=3200,zH=0,VH=1,Ca="",ur="srgb",Ao="srgb-linear",Sh="linear",wn="srgb",cl=7680,M1=519,HH=512,GH=513,jH=514,i_=515,WH=516,$H=517,r_=518,XH=519,T1=35044,A1="300 es",es=2e3,wh=2001;function qH(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Eh(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function YH(){const t=Eh("canvas");return t.style.display="block",t}const C1={};function P1(...t){const e="THREE."+t.shift();console.log(e,...t)}function pP(t){const e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=t[1];n&&n.isStackTrace?t[0]+=" "+n.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function Gt(...t){t=pP(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function _n(...t){t=pP(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function Mh(...t){const e=t.join(" ");e in C1||(C1[e]=!0,Gt(...t))}function KH(t,e,n){return new Promise(function(i,r){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}const ZH={[W0]:$0,[X0]:K0,[q0]:Z0,[jl]:Y0,[$0]:W0,[K0]:X0,[Z0]:q0,[Y0]:jl};class ec{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const xi=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],dg=Math.PI/180,Lv=180/Math.PI;function Fu(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(xi[t&255]+xi[t>>8&255]+xi[t>>16&255]+xi[t>>24&255]+"-"+xi[e&255]+xi[e>>8&255]+"-"+xi[e>>16&15|64]+xi[e>>24&255]+"-"+xi[n&63|128]+xi[n>>8&255]+"-"+xi[n>>16&255]+xi[n>>24&255]+xi[i&255]+xi[i>>8&255]+xi[i>>16&255]+xi[i>>24&255]).toLowerCase()}function ln(t,e,n){return Math.max(e,Math.min(n,t))}function JH(t,e){return(t%e+e)%e}function fg(t,e,n){return(1-n)*t+n*e}function Hc(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Hi(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}class bn{constructor(e=0,n=0){bn.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+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,n){return this.x=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(i,e,n))}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 n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ln(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),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 tc{constructor(e=0,n=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}static slerpFlat(e,n,i,r,s,o,c){let u=i[r+0],d=i[r+1],h=i[r+2],p=i[r+3],m=s[o+0],v=s[o+1],_=s[o+2],w=s[o+3];if(p!==w||u!==m||d!==v||h!==_){let y=u*m+d*v+h*_+p*w;y<0&&(m=-m,v=-v,_=-_,w=-w,y=-y);let b=1-c;if(y<.9995){const T=Math.acos(y),A=Math.sin(T);b=Math.sin(b*T)/A,c=Math.sin(c*T)/A,u=u*b+m*c,d=d*b+v*c,h=h*b+_*c,p=p*b+w*c}else{u=u*b+m*c,d=d*b+v*c,h=h*b+_*c,p=p*b+w*c;const T=1/Math.sqrt(u*u+d*d+h*h+p*p);u*=T,d*=T,h*=T,p*=T}}e[n]=u,e[n+1]=d,e[n+2]=h,e[n+3]=p}static multiplyQuaternionsFlat(e,n,i,r,s,o){const c=i[r],u=i[r+1],d=i[r+2],h=i[r+3],p=s[o],m=s[o+1],v=s[o+2],_=s[o+3];return e[n]=c*_+h*p+u*v-d*m,e[n+1]=u*_+h*m+d*p-c*v,e[n+2]=d*_+h*v+c*m-u*p,e[n+3]=h*_-c*p-u*m-d*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,r){return this._x=e,this._y=n,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,n=!0){const i=e._x,r=e._y,s=e._z,o=e._order,c=Math.cos,u=Math.sin,d=c(i/2),h=c(r/2),p=c(s/2),m=u(i/2),v=u(r/2),_=u(s/2);switch(o){case"XYZ":this._x=m*h*p+d*v*_,this._y=d*v*p-m*h*_,this._z=d*h*_+m*v*p,this._w=d*h*p-m*v*_;break;case"YXZ":this._x=m*h*p+d*v*_,this._y=d*v*p-m*h*_,this._z=d*h*_-m*v*p,this._w=d*h*p+m*v*_;break;case"ZXY":this._x=m*h*p-d*v*_,this._y=d*v*p+m*h*_,this._z=d*h*_+m*v*p,this._w=d*h*p-m*v*_;break;case"ZYX":this._x=m*h*p-d*v*_,this._y=d*v*p+m*h*_,this._z=d*h*_-m*v*p,this._w=d*h*p+m*v*_;break;case"YZX":this._x=m*h*p+d*v*_,this._y=d*v*p+m*h*_,this._z=d*h*_-m*v*p,this._w=d*h*p-m*v*_;break;case"XZY":this._x=m*h*p-d*v*_,this._y=d*v*p-m*h*_,this._z=d*h*_+m*v*p,this._w=d*h*p+m*v*_;break;default:Gt("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/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 n=e.elements,i=n[0],r=n[4],s=n[8],o=n[1],c=n[5],u=n[9],d=n[2],h=n[6],p=n[10],m=i+c+p;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(h-u)*v,this._y=(s-d)*v,this._z=(o-r)*v}else if(i>c&&i>p){const v=2*Math.sqrt(1+i-c-p);this._w=(h-u)/v,this._x=.25*v,this._y=(r+o)/v,this._z=(s+d)/v}else if(c>p){const v=2*Math.sqrt(1+c-i-p);this._w=(s-d)/v,this._x=(r+o)/v,this._y=.25*v,this._z=(u+h)/v}else{const v=2*Math.sqrt(1+p-i-c);this._w=(o-r)/v,this._x=(s+d)/v,this._y=(u+h)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ln(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/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,n){const i=e._x,r=e._y,s=e._z,o=e._w,c=n._x,u=n._y,d=n._z,h=n._w;return this._x=i*h+o*c+r*d-s*u,this._y=r*h+o*u+s*c-i*d,this._z=s*h+o*d+i*u-r*c,this._w=o*h-i*c-r*u-s*d,this._onChangeCallback(),this}slerp(e,n){let i=e._x,r=e._y,s=e._z,o=e._w,c=this.dot(e);c<0&&(i=-i,r=-r,s=-s,o=-o,c=-c);let u=1-n;if(c<.9995){const d=Math.acos(c),h=Math.sin(d);u=Math.sin(u*d)/h,n=Math.sin(n*d)/h,this._x=this._x*u+i*n,this._y=this._y*u+r*n,this._z=this._z*u+s*n,this._w=this._w*u+o*n,this._onChangeCallback()}else this._x=this._x*u+i*n,this._y=this._y*u+r*n,this._z=this._z*u+s*n,this._w=this._w*u+o*n,this.normalize();return this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class me{constructor(e=0,n=0,i=0){me.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(R1.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(R1.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6]*r,this.y=s[1]*n+s[4]*i+s[7]*r,this.z=s[2]*n+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*n+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*n+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*n+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*n+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,s=e.x,o=e.y,c=e.z,u=e.w,d=2*(o*r-c*i),h=2*(c*n-s*r),p=2*(s*i-o*n);return this.x=n+u*d+o*p-c*h,this.y=i+u*h+c*d-s*p,this.z=r+u*p+s*h-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r,this.y=s[1]*n+s[5]*i+s[9]*r,this.z=s[2]*n+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,n){return this.x=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this.z=ln(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this.z=ln(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(i,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,s=e.z,o=n.x,c=n.y,u=n.z;return this.x=r*u-s*c,this.y=s*o-i*u,this.z=i*c-r*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return hg.copy(this).projectOnVector(e),this.sub(hg)}reflect(e){return this.sub(hg.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ln(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+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,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const hg=new me,R1=new tc;class Wt{constructor(e,n,i,r,s,o,c,u,d){Wt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,o,c,u,d)}set(e,n,i,r,s,o,c,u,d){const h=this.elements;return h[0]=e,h[1]=r,h[2]=c,h[3]=n,h[4]=s,h[5]=u,h[6]=i,h[7]=o,h[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],c=i[3],u=i[6],d=i[1],h=i[4],p=i[7],m=i[2],v=i[5],_=i[8],w=r[0],y=r[3],b=r[6],T=r[1],A=r[4],M=r[7],I=r[2],k=r[5],U=r[8];return s[0]=o*w+c*T+u*I,s[3]=o*y+c*A+u*k,s[6]=o*b+c*M+u*U,s[1]=d*w+h*T+p*I,s[4]=d*y+h*A+p*k,s[7]=d*b+h*M+p*U,s[2]=m*w+v*T+_*I,s[5]=m*y+v*A+_*k,s[8]=m*b+v*M+_*U,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],c=e[5],u=e[6],d=e[7],h=e[8];return n*o*h-n*c*d-i*s*h+i*c*u+r*s*d-r*o*u}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],c=e[5],u=e[6],d=e[7],h=e[8],p=h*o-c*d,m=c*u-h*s,v=d*s-o*u,_=n*p+i*m+r*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/_;return e[0]=p*w,e[1]=(r*d-h*i)*w,e[2]=(c*i-r*o)*w,e[3]=m*w,e[4]=(h*n-r*u)*w,e[5]=(r*s-c*n)*w,e[6]=v*w,e[7]=(i*u-d*n)*w,e[8]=(o*n-i*s)*w,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,s,o,c){const u=Math.cos(s),d=Math.sin(s);return this.set(i*u,i*d,-i*(u*o+d*c)+o+e,-r*d,r*u,-r*(-d*o+u*c)+c+n,0,0,1),this}scale(e,n){return this.premultiply(pg.makeScale(e,n)),this}rotate(e){return this.premultiply(pg.makeRotation(-e)),this}translate(e,n){return this.premultiply(pg.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const pg=new Wt,k1=new Wt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),L1=new Wt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function QH(){const t={enabled:!0,workingColorSpace:Ao,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===wn&&(r.r=Bs(r.r),r.g=Bs(r.g),r.b=Bs(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===wn&&(r.r=Ul(r.r),r.g=Ul(r.g),r.b=Ul(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Ca?Sh:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Mh("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Mh("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ao]:{primaries:e,whitePoint:i,transfer:Sh,toXYZ:k1,fromXYZ:L1,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:ur},outputColorSpaceConfig:{drawingBufferColorSpace:ur}},[ur]:{primaries:e,whitePoint:i,transfer:wn,toXYZ:k1,fromXYZ:L1,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:ur}}}),t}const fn=QH();function Bs(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Ul(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let ul;class e6{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{ul===void 0&&(ul=Eh("canvas")),ul.width=e.width,ul.height=e.height;const r=ul.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=ul}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Eh("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Bs(s[o]/255)*255;return i.putImageData(r,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(Bs(n[i]/255)*255):n[i]=Bs(n[i]);return{data:n,width:e.width,height:e.height}}else return Gt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let t6=0;class s_{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:t6++}),this.uuid=Fu(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?e.set(n.displayHeight,n.displayWidth,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,c=r.length;o<c;o++)r[o].isDataTexture?s.push(mg(r[o].image)):s.push(mg(r[o]))}else s=mg(r);i.url=s}return n||(e.images[this.uuid]=i),i}}function mg(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?e6.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Gt("Texture: Unable to serialize Texture."),{})}let n6=0;const gg=new me;class Li extends ec{constructor(e=Li.DEFAULT_IMAGE,n=Li.DEFAULT_MAPPING,i=Is,r=Is,s=wi,o=mo,c=Fr,u=fr,d=Li.DEFAULT_ANISOTROPY,h=Ca){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:n6++}),this.uuid=Fu(),this.name="",this.source=new s_(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=d,this.format=c,this.internalFormat=null,this.type=u,this.offset=new bn(0,0),this.repeat=new bn(1,1),this.center=new bn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Wt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(gg).x}get height(){return this.source.getSize(gg).y}get depth(){return this.source.getSize(gg).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const i=e[n];if(i===void 0){Gt(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Gt(`Texture.setValues(): property '${n}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==aP)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case J0:e.x=e.x-Math.floor(e.x);break;case Is:e.x=e.x<0?0:1;break;case Q0: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 J0:e.y=e.y-Math.floor(e.y);break;case Is:e.y=e.y<0?0:1;break;case Q0:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Li.DEFAULT_IMAGE=null;Li.DEFAULT_MAPPING=aP;Li.DEFAULT_ANISOTROPY=1;class Vn{constructor(e=0,n=0,i=0,r=1){Vn.prototype.isVector4=!0,this.x=e,this.y=n,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,n,i,r){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*n+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*n+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*n+o[7]*i+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,s;const u=e.elements,d=u[0],h=u[4],p=u[8],m=u[1],v=u[5],_=u[9],w=u[2],y=u[6],b=u[10];if(Math.abs(h-m)<.01&&Math.abs(p-w)<.01&&Math.abs(_-y)<.01){if(Math.abs(h+m)<.1&&Math.abs(p+w)<.1&&Math.abs(_+y)<.1&&Math.abs(d+v+b-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const A=(d+1)/2,M=(v+1)/2,I=(b+1)/2,k=(h+m)/4,U=(p+w)/4,S=(_+y)/4;return A>M&&A>I?A<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(A),r=k/i,s=U/i):M>I?M<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),i=k/r,s=S/r):I<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(I),i=U/s,r=S/s),this.set(i,r,s,n),this}let T=Math.sqrt((y-_)*(y-_)+(p-w)*(p-w)+(m-h)*(m-h));return Math.abs(T)<.001&&(T=1),this.x=(y-_)/T,this.y=(p-w)/T,this.z=(m-h)/T,this.w=Math.acos((d+v+b-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this.z=ln(this.z,e.z,n.z),this.w=ln(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this.z=ln(this.z,e,n),this.w=ln(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(i,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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 i6 extends ec{constructor(e=1,n=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:wi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth,this.scissor=new Vn(0,0,e,n),this.scissorTest=!1,this.viewport=new Vn(0,0,e,n),this.textures=[];const r={width:e,height:n,depth:i.depth},s=new Li(r),o=i.count;for(let c=0;c<o;c++)this.textures[c]=s.clone(),this.textures[c].isRenderTargetTexture=!0,this.textures[c].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const n={minFilter:wi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=n,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const r=Object.assign({},e.textures[n].image);this.textures[n].source=new s_(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class rs extends i6{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class mP extends Li{constructor(e=null,n=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=mi,this.minFilter=mi,this.wrapR=Is,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class r6 extends Li{constructor(e=null,n=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=mi,this.minFilter=mi,this.wrapR=Is,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Kn{constructor(e,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y){Kn.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,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y)}set(e,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y){const b=this.elements;return b[0]=e,b[4]=n,b[8]=i,b[12]=r,b[1]=s,b[5]=o,b[9]=c,b[13]=u,b[2]=d,b[6]=h,b[10]=p,b[14]=m,b[3]=v,b[7]=_,b[11]=w,b[15]=y,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 Kn().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return this.determinant()===0?(e.set(1,0,0),n.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const n=this.elements,i=e.elements,r=1/dl.setFromMatrixColumn(e,0).length(),s=1/dl.setFromMatrixColumn(e,1).length(),o=1/dl.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*s,n[5]=i[5]*s,n[6]=i[6]*s,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),c=Math.sin(i),u=Math.cos(r),d=Math.sin(r),h=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const m=o*h,v=o*p,_=c*h,w=c*p;n[0]=u*h,n[4]=-u*p,n[8]=d,n[1]=v+_*d,n[5]=m-w*d,n[9]=-c*u,n[2]=w-m*d,n[6]=_+v*d,n[10]=o*u}else if(e.order==="YXZ"){const m=u*h,v=u*p,_=d*h,w=d*p;n[0]=m+w*c,n[4]=_*c-v,n[8]=o*d,n[1]=o*p,n[5]=o*h,n[9]=-c,n[2]=v*c-_,n[6]=w+m*c,n[10]=o*u}else if(e.order==="ZXY"){const m=u*h,v=u*p,_=d*h,w=d*p;n[0]=m-w*c,n[4]=-o*p,n[8]=_+v*c,n[1]=v+_*c,n[5]=o*h,n[9]=w-m*c,n[2]=-o*d,n[6]=c,n[10]=o*u}else if(e.order==="ZYX"){const m=o*h,v=o*p,_=c*h,w=c*p;n[0]=u*h,n[4]=_*d-v,n[8]=m*d+w,n[1]=u*p,n[5]=w*d+m,n[9]=v*d-_,n[2]=-d,n[6]=c*u,n[10]=o*u}else if(e.order==="YZX"){const m=o*u,v=o*d,_=c*u,w=c*d;n[0]=u*h,n[4]=w-m*p,n[8]=_*p+v,n[1]=p,n[5]=o*h,n[9]=-c*h,n[2]=-d*h,n[6]=v*p+_,n[10]=m-w*p}else if(e.order==="XZY"){const m=o*u,v=o*d,_=c*u,w=c*d;n[0]=u*h,n[4]=-p,n[8]=d*h,n[1]=m*p+w,n[5]=o*h,n[9]=v*p-_,n[2]=_*p-v,n[6]=c*h,n[10]=w*p+m}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(s6,e,a6)}lookAt(e,n,i){const r=this.elements;return Ki.subVectors(e,n),Ki.lengthSq()===0&&(Ki.z=1),Ki.normalize(),ga.crossVectors(i,Ki),ga.lengthSq()===0&&(Math.abs(i.z)===1?Ki.x+=1e-4:Ki.z+=1e-4,Ki.normalize(),ga.crossVectors(i,Ki)),ga.normalize(),nf.crossVectors(Ki,ga),r[0]=ga.x,r[4]=nf.x,r[8]=Ki.x,r[1]=ga.y,r[5]=nf.y,r[9]=Ki.y,r[2]=ga.z,r[6]=nf.z,r[10]=Ki.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],c=i[4],u=i[8],d=i[12],h=i[1],p=i[5],m=i[9],v=i[13],_=i[2],w=i[6],y=i[10],b=i[14],T=i[3],A=i[7],M=i[11],I=i[15],k=r[0],U=r[4],S=r[8],P=r[12],V=r[1],O=r[5],G=r[9],J=r[13],H=r[2],X=r[6],K=r[10],Q=r[14],W=r[3],q=r[7],Z=r[11],z=r[15];return s[0]=o*k+c*V+u*H+d*W,s[4]=o*U+c*O+u*X+d*q,s[8]=o*S+c*G+u*K+d*Z,s[12]=o*P+c*J+u*Q+d*z,s[1]=h*k+p*V+m*H+v*W,s[5]=h*U+p*O+m*X+v*q,s[9]=h*S+p*G+m*K+v*Z,s[13]=h*P+p*J+m*Q+v*z,s[2]=_*k+w*V+y*H+b*W,s[6]=_*U+w*O+y*X+b*q,s[10]=_*S+w*G+y*K+b*Z,s[14]=_*P+w*J+y*Q+b*z,s[3]=T*k+A*V+M*H+I*W,s[7]=T*U+A*O+M*X+I*q,s[11]=T*S+A*G+M*K+I*Z,s[15]=T*P+A*J+M*Q+I*z,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],s=e[12],o=e[1],c=e[5],u=e[9],d=e[13],h=e[2],p=e[6],m=e[10],v=e[14],_=e[3],w=e[7],y=e[11],b=e[15],T=u*v-d*m,A=c*v-d*p,M=c*m-u*p,I=o*v-d*h,k=o*m-u*h,U=o*p-c*h;return n*(w*T-y*A+b*M)-i*(_*T-y*I+b*k)+r*(_*A-w*I+b*U)-s*(_*M-w*k+y*U)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,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]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],c=e[5],u=e[6],d=e[7],h=e[8],p=e[9],m=e[10],v=e[11],_=e[12],w=e[13],y=e[14],b=e[15],T=n*c-i*o,A=n*u-r*o,M=n*d-s*o,I=i*u-r*c,k=i*d-s*c,U=r*d-s*u,S=h*w-p*_,P=h*y-m*_,V=h*b-v*_,O=p*y-m*w,G=p*b-v*w,J=m*b-v*y,H=T*J-A*G+M*O+I*V-k*P+U*S;if(H===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const X=1/H;return e[0]=(c*J-u*G+d*O)*X,e[1]=(r*G-i*J-s*O)*X,e[2]=(w*U-y*k+b*I)*X,e[3]=(m*k-p*U-v*I)*X,e[4]=(u*V-o*J-d*P)*X,e[5]=(n*J-r*V+s*P)*X,e[6]=(y*M-_*U-b*A)*X,e[7]=(h*U-m*M+v*A)*X,e[8]=(o*G-c*V+d*S)*X,e[9]=(i*V-n*G-s*S)*X,e[10]=(_*k-w*M+b*T)*X,e[11]=(p*M-h*k-v*T)*X,e[12]=(c*P-o*O-u*S)*X,e[13]=(n*O-i*P+r*S)*X,e[14]=(w*A-_*I-y*T)*X,e[15]=(h*I-p*A+m*T)*X,this}scale(e){const n=this.elements,i=e.x,r=e.y,s=e.z;return n[0]*=i,n[4]*=r,n[8]*=s,n[1]*=i,n[5]*=r,n[9]*=s,n[2]*=i,n[6]*=r,n[10]*=s,n[3]*=i,n[7]*=r,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=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(n,i,r))}makeTranslation(e,n,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,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),s=1-i,o=e.x,c=e.y,u=e.z,d=s*o,h=s*c;return this.set(d*o+i,d*c-r*u,d*u+r*c,0,d*c+r*u,h*c+i,h*u-r*o,0,d*u-r*c,h*u+r*o,s*u*u+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,n,r,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,s=n._x,o=n._y,c=n._z,u=n._w,d=s+s,h=o+o,p=c+c,m=s*d,v=s*h,_=s*p,w=o*h,y=o*p,b=c*p,T=u*d,A=u*h,M=u*p,I=i.x,k=i.y,U=i.z;return r[0]=(1-(w+b))*I,r[1]=(v+M)*I,r[2]=(_-A)*I,r[3]=0,r[4]=(v-M)*k,r[5]=(1-(m+b))*k,r[6]=(y+T)*k,r[7]=0,r[8]=(_+A)*U,r[9]=(y-T)*U,r[10]=(1-(m+w))*U,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),n.identity(),this;let o=dl.set(r[0],r[1],r[2]).length();const c=dl.set(r[4],r[5],r[6]).length(),u=dl.set(r[8],r[9],r[10]).length();s<0&&(o=-o),kr.copy(this);const d=1/o,h=1/c,p=1/u;return kr.elements[0]*=d,kr.elements[1]*=d,kr.elements[2]*=d,kr.elements[4]*=h,kr.elements[5]*=h,kr.elements[6]*=h,kr.elements[8]*=p,kr.elements[9]*=p,kr.elements[10]*=p,n.setFromRotationMatrix(kr),i.x=o,i.y=c,i.z=u,this}makePerspective(e,n,i,r,s,o,c=es,u=!1){const d=this.elements,h=2*s/(n-e),p=2*s/(i-r),m=(n+e)/(n-e),v=(i+r)/(i-r);let _,w;if(u)_=s/(o-s),w=o*s/(o-s);else if(c===es)_=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(c===wh)_=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return d[0]=h,d[4]=0,d[8]=m,d[12]=0,d[1]=0,d[5]=p,d[9]=v,d[13]=0,d[2]=0,d[6]=0,d[10]=_,d[14]=w,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,n,i,r,s,o,c=es,u=!1){const d=this.elements,h=2/(n-e),p=2/(i-r),m=-(n+e)/(n-e),v=-(i+r)/(i-r);let _,w;if(u)_=1/(o-s),w=o/(o-s);else if(c===es)_=-2/(o-s),w=-(o+s)/(o-s);else if(c===wh)_=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return d[0]=h,d[4]=0,d[8]=0,d[12]=m,d[1]=0,d[5]=p,d[9]=0,d[13]=v,d[2]=0,d[6]=0,d[10]=_,d[14]=w,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const dl=new me,kr=new Kn,s6=new me(0,0,0),a6=new me(1,1,1),ga=new me,nf=new me,Ki=new me,D1=new Kn,N1=new tc;let Co=class gP{constructor(e=0,n=0,i=0,r=gP.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,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,n,i,r=this._order){return this._x=e,this._y=n,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,n=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],c=r[8],u=r[1],d=r[5],h=r[9],p=r[2],m=r[6],v=r[10];switch(n){case"XYZ":this._y=Math.asin(ln(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,v),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ln(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(c,v),this._z=Math.atan2(u,d)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(ln(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,v),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-ln(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,v),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(ln(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-h,d),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(c,v));break;case"XZY":this._z=Math.asin(-ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,d),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-h,v),this._y=0);break;default:Gt("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return D1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(D1,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return N1.setFromEuler(this),this.setFromQuaternion(N1,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}};Co.DEFAULT_ORDER="XYZ";class vP{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let o6=0;const I1=new me,fl=new tc,As=new Kn,rf=new me,Gc=new me,l6=new me,c6=new tc,U1=new me(1,0,0),F1=new me(0,1,0),O1=new me(0,0,1),B1={type:"added"},u6={type:"removed"},hl={type:"childadded",child:null},vg={type:"childremoved",child:null};class er extends ec{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:o6++}),this.uuid=Fu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=er.DEFAULT_UP.clone();const e=new me,n=new Co,i=new tc,r=new me(1,1,1);function s(){i.setFromEuler(n,!1)}function o(){n.setFromQuaternion(i,void 0,!1)}n._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Kn},normalMatrix:{value:new Wt}}),this.matrix=new Kn,this.matrixWorld=new Kn,this.matrixAutoUpdate=er.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=er.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new vP,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return fl.setFromAxisAngle(e,n),this.quaternion.multiply(fl),this}rotateOnWorldAxis(e,n){return fl.setFromAxisAngle(e,n),this.quaternion.premultiply(fl),this}rotateX(e){return this.rotateOnAxis(U1,e)}rotateY(e){return this.rotateOnAxis(F1,e)}rotateZ(e){return this.rotateOnAxis(O1,e)}translateOnAxis(e,n){return I1.copy(e).applyQuaternion(this.quaternion),this.position.add(I1.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(U1,e)}translateY(e){return this.translateOnAxis(F1,e)}translateZ(e){return this.translateOnAxis(O1,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(As.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?rf.copy(e):rf.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Gc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?As.lookAt(Gc,rf,this.up):As.lookAt(rf,Gc,this.up),this.quaternion.setFromRotationMatrix(As),r&&(As.extractRotation(r.matrixWorld),fl.setFromRotationMatrix(As),this.quaternion.premultiply(fl.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(_n("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(B1),hl.child=e,this.dispatchEvent(hl),hl.child=null):_n("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(u6),vg.child=e,this.dispatchEvent(vg),vg.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),As.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),As.multiply(e.parent.matrixWorld)),e.applyMatrix4(As),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(B1),hl.child=e,this.dispatchEvent(hl),hl.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gc,e,l6),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gc,c6,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const n=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=n-s[0]*n-s[4]*i-s[8]*r,s[13]+=i-s[1]*n-s[5]*i-s[9]*r,s[14]+=r-s[2]*n-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(c=>({...c})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let d=0,h=u.length;d<h;d++){const p=u[d];s(e.shapes,p)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,d=this.material.length;u<d;u++)c.push(s(e.materials,this.material[u]));r.material=c}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let c=0;c<this.children.length;c++)r.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];r.animations.push(s(e.animations,u))}}if(n){const c=o(e.geometries),u=o(e.materials),d=o(e.textures),h=o(e.images),p=o(e.shapes),m=o(e.skeletons),v=o(e.animations),_=o(e.nodes);c.length>0&&(i.geometries=c),u.length>0&&(i.materials=u),d.length>0&&(i.textures=d),h.length>0&&(i.images=h),p.length>0&&(i.shapes=p),m.length>0&&(i.skeletons=m),v.length>0&&(i.animations=v),_.length>0&&(i.nodes=_)}return i.object=r,i;function o(c){const u=[];for(const d in c){const h=c[d];delete h.metadata,u.push(h)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}er.DEFAULT_UP=new me(0,1,0);er.DEFAULT_MATRIX_AUTO_UPDATE=!0;er.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class sf extends er{constructor(){super(),this.isGroup=!0,this.type="Group"}}const d6={type:"move"};class yg{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new sf,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 sf,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new me,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new me),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new sf,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new me,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new me),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,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,n,i){let r=null,s=null,o=null;const c=this._targetRay,u=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const w of e.hand.values()){const y=n.getJointPose(w,i),b=this._getHandJoint(d,w);y!==null&&(b.matrix.fromArray(y.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=y.radius),b.visible=y!==null}const h=d.joints["index-finger-tip"],p=d.joints["thumb-tip"],m=h.position.distanceTo(p.position),v=.02,_=.005;d.inputState.pinching&&m>v+_?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&m<=v-_&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,i),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(d6)))}return c!==null&&(c.visible=r!==null),u!==null&&(u.visible=s!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new sf;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}const yP={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},af={h:0,s:0,l:0};function _g(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class Tn{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===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,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=ur){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,fn.colorSpaceToWorking(this,n),this}setRGB(e,n,i,r=fn.workingColorSpace){return this.r=e,this.g=n,this.b=i,fn.colorSpaceToWorking(this,r),this}setHSL(e,n,i,r=fn.workingColorSpace){if(e=JH(e,1),n=ln(n,0,1),i=ln(i,0,1),n===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+n):i+n-i*n,o=2*i-s;this.r=_g(o,s,e+1/3),this.g=_g(o,s,e),this.b=_g(o,s,e-1/3)}return fn.colorSpaceToWorking(this,r),this}setStyle(e,n=ur){function i(s){s!==void 0&&parseFloat(s)<1&&Gt("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],c=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))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,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))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,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:Gt("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,n);if(o===6)return this.setHex(parseInt(s,16),n);Gt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=ur){const i=yP[e.toLowerCase()];return i!==void 0?this.setHex(i,n):Gt("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=Bs(e.r),this.g=Bs(e.g),this.b=Bs(e.b),this}copyLinearToSRGB(e){return this.r=Ul(e.r),this.g=Ul(e.g),this.b=Ul(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ur){return fn.workingToColorSpace(bi.copy(this),e),Math.round(ln(bi.r*255,0,255))*65536+Math.round(ln(bi.g*255,0,255))*256+Math.round(ln(bi.b*255,0,255))}getHexString(e=ur){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=fn.workingColorSpace){fn.workingToColorSpace(bi.copy(this),n);const i=bi.r,r=bi.g,s=bi.b,o=Math.max(i,r,s),c=Math.min(i,r,s);let u,d;const h=(c+o)/2;if(c===o)u=0,d=0;else{const p=o-c;switch(d=h<=.5?p/(o+c):p/(2-o-c),o){case i:u=(r-s)/p+(r<s?6:0);break;case r:u=(s-i)/p+2;break;case s:u=(i-r)/p+4;break}u/=6}return e.h=u,e.s=d,e.l=h,e}getRGB(e,n=fn.workingColorSpace){return fn.workingToColorSpace(bi.copy(this),n),e.r=bi.r,e.g=bi.g,e.b=bi.b,e}getStyle(e=ur){fn.workingToColorSpace(bi.copy(this),e);const n=bi.r,i=bi.g,r=bi.b;return e!==ur?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,n,i){return this.getHSL(va),this.setHSL(va.h+e,va.s+n,va.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(va),e.getHSL(af);const i=fg(va.h,af.h,n),r=fg(va.s,af.s,n),s=fg(va.l,af.l,n);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*n+s[3]*i+s[6]*r,this.g=s[1]*n+s[4]*i+s[7]*r,this.b=s[2]*n+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const bi=new Tn;Tn.NAMES=yP;class f6 extends er{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Co,this.environmentIntensity=1,this.environmentRotation=new Co,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const Lr=new me,Cs=new me,xg=new me,Ps=new me,pl=new me,ml=new me,z1=new me,bg=new me,Sg=new me,wg=new me,Eg=new Vn,Mg=new Vn,Tg=new Vn;let jc=class Al{constructor(e=new me,n=new me,i=new me){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),Lr.subVectors(e,n),r.cross(Lr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,n,i,r,s){Lr.subVectors(r,n),Cs.subVectors(i,n),xg.subVectors(e,n);const o=Lr.dot(Lr),c=Lr.dot(Cs),u=Lr.dot(xg),d=Cs.dot(Cs),h=Cs.dot(xg),p=o*d-c*c;if(p===0)return s.set(0,0,0),null;const m=1/p,v=(d*u-c*h)*m,_=(o*h-c*u)*m;return s.set(1-v-_,_,v)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Ps)===null?!1:Ps.x>=0&&Ps.y>=0&&Ps.x+Ps.y<=1}static getInterpolation(e,n,i,r,s,o,c,u){return this.getBarycoord(e,n,i,r,Ps)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,Ps.x),u.addScaledVector(o,Ps.y),u.addScaledVector(c,Ps.z),u)}static getInterpolatedAttribute(e,n,i,r,s,o){return Eg.setScalar(0),Mg.setScalar(0),Tg.setScalar(0),Eg.fromBufferAttribute(e,n),Mg.fromBufferAttribute(e,i),Tg.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(Eg,s.x),o.addScaledVector(Mg,s.y),o.addScaledVector(Tg,s.z),o}static isFrontFacing(e,n,i,r){return Lr.subVectors(i,n),Cs.subVectors(e,n),Lr.cross(Cs).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,i,r){return this.a.fromBufferAttribute(e,n),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 Lr.subVectors(this.c,this.b),Cs.subVectors(this.a,this.b),Lr.cross(Cs).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Al.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Al.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,s){return Al.getInterpolation(e,this.a,this.b,this.c,n,i,r,s)}containsPoint(e){return Al.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Al.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,r=this.b,s=this.c;let o,c;pl.subVectors(r,i),ml.subVectors(s,i),bg.subVectors(e,i);const u=pl.dot(bg),d=ml.dot(bg);if(u<=0&&d<=0)return n.copy(i);Sg.subVectors(e,r);const h=pl.dot(Sg),p=ml.dot(Sg);if(h>=0&&p<=h)return n.copy(r);const m=u*p-h*d;if(m<=0&&u>=0&&h<=0)return o=u/(u-h),n.copy(i).addScaledVector(pl,o);wg.subVectors(e,s);const v=pl.dot(wg),_=ml.dot(wg);if(_>=0&&v<=_)return n.copy(s);const w=v*d-u*_;if(w<=0&&d>=0&&_<=0)return c=d/(d-_),n.copy(i).addScaledVector(ml,c);const y=h*_-v*p;if(y<=0&&p-h>=0&&v-_>=0)return z1.subVectors(s,r),c=(p-h)/(p-h+(v-_)),n.copy(r).addScaledVector(z1,c);const b=1/(y+w+m);return o=w*b,c=m*b,n.copy(i).addScaledVector(pl,o).addScaledVector(ml,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};class Ou{constructor(e=new me(1/0,1/0,1/0),n=new me(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Dr.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Dr.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Dr.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,c=s.count;o<c;o++)e.isMesh===!0?e.getVertexPosition(o,Dr):Dr.fromBufferAttribute(s,o),Dr.applyMatrix4(e.matrixWorld),this.expandByPoint(Dr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),of.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),of.copy(i.boundingBox)),of.applyMatrix4(e.matrixWorld),this.union(of)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Dr),Dr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Wc),lf.subVectors(this.max,Wc),gl.subVectors(e.a,Wc),vl.subVectors(e.b,Wc),yl.subVectors(e.c,Wc),ya.subVectors(vl,gl),_a.subVectors(yl,vl),eo.subVectors(gl,yl);let n=[0,-ya.z,ya.y,0,-_a.z,_a.y,0,-eo.z,eo.y,ya.z,0,-ya.x,_a.z,0,-_a.x,eo.z,0,-eo.x,-ya.y,ya.x,0,-_a.y,_a.x,0,-eo.y,eo.x,0];return!Ag(n,gl,vl,yl,lf)||(n=[1,0,0,0,1,0,0,0,1],!Ag(n,gl,vl,yl,lf))?!1:(cf.crossVectors(ya,_a),n=[cf.x,cf.y,cf.z],Ag(n,gl,vl,yl,lf))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Dr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Dr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Rs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Rs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Rs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Rs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Rs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Rs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Rs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Rs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Rs),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Rs=[new me,new me,new me,new me,new me,new me,new me,new me],Dr=new me,of=new Ou,gl=new me,vl=new me,yl=new me,ya=new me,_a=new me,eo=new me,Wc=new me,lf=new me,cf=new me,to=new me;function Ag(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){to.fromArray(t,s);const c=r.x*Math.abs(to.x)+r.y*Math.abs(to.y)+r.z*Math.abs(to.z),u=e.dot(to),d=n.dot(to),h=i.dot(to);if(Math.max(-Math.max(u,d,h),Math.min(u,d,h))>c)return!1}return!0}const $n=new me,uf=new bn;let h6=0;class Vr{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:h6++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=T1,this.updateRanges=[],this.gpuType=Qr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=n.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)uf.fromBufferAttribute(this,n),uf.applyMatrix3(e),this.setXY(n,uf.x,uf.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.applyMatrix3(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.applyMatrix4(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.applyNormalMatrix(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.transformDirection(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Hc(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Hi(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Hc(n,this.array)),n}setX(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Hc(n,this.array)),n}setY(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Hc(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Hc(n,this.array)),n}setW(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Hi(n,this.array),i=Hi(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,r){return e*=this.itemSize,this.normalized&&(n=Hi(n,this.array),i=Hi(i,this.array),r=Hi(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,n,i,r,s){return e*=this.itemSize,this.normalized&&(n=Hi(n,this.array),i=Hi(i,this.array),r=Hi(r,this.array),s=Hi(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==T1&&(e.usage=this.usage),e}}class _P extends Vr{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class xP extends Vr{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class zs extends Vr{constructor(e,n,i){super(new Float32Array(e),n,i)}}const p6=new Ou,$c=new me,Cg=new me;class a_{constructor(e=new me,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):p6.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;$c.subVectors(e,this.center);const n=$c.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector($c,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):(Cg.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint($c.copy(e.center).add(Cg)),this.expandByPoint($c.copy(e.center).sub(Cg))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let m6=0;const lr=new Kn,Pg=new er,_l=new me,Zi=new Ou,Xc=new Ou,ci=new me;class gs extends ec{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:m6++}),this.uuid=Fu(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(qH(e)?xP:_P)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new Wt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return lr.makeRotationFromQuaternion(e),this.applyMatrix4(lr),this}rotateX(e){return lr.makeRotationX(e),this.applyMatrix4(lr),this}rotateY(e){return lr.makeRotationY(e),this.applyMatrix4(lr),this}rotateZ(e){return lr.makeRotationZ(e),this.applyMatrix4(lr),this}translate(e,n,i){return lr.makeTranslation(e,n,i),this.applyMatrix4(lr),this}scale(e,n,i){return lr.makeScale(e,n,i),this.applyMatrix4(lr),this}lookAt(e){return Pg.lookAt(e),Pg.updateMatrix(),this.applyMatrix4(Pg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_l).negate(),this.translate(_l.x,_l.y,_l.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new zs(i,3))}else{const i=Math.min(e.length,n.count);for(let r=0;r<i;r++){const s=e[r];n.setXYZ(r,s.x,s.y,s.z||0)}e.length>n.count&&Gt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ou);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){_n("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new me(-1/0,-1/0,-1/0),new me(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,r=n.length;i<r;i++){const s=n[i];Zi.setFromBufferAttribute(s),this.morphTargetsRelative?(ci.addVectors(this.boundingBox.min,Zi.min),this.boundingBox.expandByPoint(ci),ci.addVectors(this.boundingBox.max,Zi.max),this.boundingBox.expandByPoint(ci)):(this.boundingBox.expandByPoint(Zi.min),this.boundingBox.expandByPoint(Zi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&_n('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new a_);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){_n("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new me,1/0);return}if(e){const i=this.boundingSphere.center;if(Zi.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const c=n[s];Xc.setFromBufferAttribute(c),this.morphTargetsRelative?(ci.addVectors(Zi.min,Xc.min),Zi.expandByPoint(ci),ci.addVectors(Zi.max,Xc.max),Zi.expandByPoint(ci)):(Zi.expandByPoint(Xc.min),Zi.expandByPoint(Xc.max))}Zi.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)ci.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(ci));if(n)for(let s=0,o=n.length;s<o;s++){const c=n[s],u=this.morphTargetsRelative;for(let d=0,h=c.count;d<h;d++)ci.fromBufferAttribute(c,d),u&&(_l.fromBufferAttribute(e,d),ci.add(_l)),r=Math.max(r,i.distanceToSquared(ci))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&_n('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){_n("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,r=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Vr(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),c=[],u=[];for(let S=0;S<i.count;S++)c[S]=new me,u[S]=new me;const d=new me,h=new me,p=new me,m=new bn,v=new bn,_=new bn,w=new me,y=new me;function b(S,P,V){d.fromBufferAttribute(i,S),h.fromBufferAttribute(i,P),p.fromBufferAttribute(i,V),m.fromBufferAttribute(s,S),v.fromBufferAttribute(s,P),_.fromBufferAttribute(s,V),h.sub(d),p.sub(d),v.sub(m),_.sub(m);const O=1/(v.x*_.y-_.x*v.y);isFinite(O)&&(w.copy(h).multiplyScalar(_.y).addScaledVector(p,-v.y).multiplyScalar(O),y.copy(p).multiplyScalar(v.x).addScaledVector(h,-_.x).multiplyScalar(O),c[S].add(w),c[P].add(w),c[V].add(w),u[S].add(y),u[P].add(y),u[V].add(y))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let S=0,P=T.length;S<P;++S){const V=T[S],O=V.start,G=V.count;for(let J=O,H=O+G;J<H;J+=3)b(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const A=new me,M=new me,I=new me,k=new me;function U(S){I.fromBufferAttribute(r,S),k.copy(I);const P=c[S];A.copy(P),A.sub(I.multiplyScalar(I.dot(P))).normalize(),M.crossVectors(k,P);const O=M.dot(u[S])<0?-1:1;o.setXYZW(S,A.x,A.y,A.z,O)}for(let S=0,P=T.length;S<P;++S){const V=T[S],O=V.start,G=V.count;for(let J=O,H=O+G;J<H;J+=3)U(e.getX(J+0)),U(e.getX(J+1)),U(e.getX(J+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Vr(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let m=0,v=i.count;m<v;m++)i.setXYZ(m,0,0,0);const r=new me,s=new me,o=new me,c=new me,u=new me,d=new me,h=new me,p=new me;if(e)for(let m=0,v=e.count;m<v;m+=3){const _=e.getX(m+0),w=e.getX(m+1),y=e.getX(m+2);r.fromBufferAttribute(n,_),s.fromBufferAttribute(n,w),o.fromBufferAttribute(n,y),h.subVectors(o,s),p.subVectors(r,s),h.cross(p),c.fromBufferAttribute(i,_),u.fromBufferAttribute(i,w),d.fromBufferAttribute(i,y),c.add(h),u.add(h),d.add(h),i.setXYZ(_,c.x,c.y,c.z),i.setXYZ(w,u.x,u.y,u.z),i.setXYZ(y,d.x,d.y,d.z)}else for(let m=0,v=n.count;m<v;m+=3)r.fromBufferAttribute(n,m+0),s.fromBufferAttribute(n,m+1),o.fromBufferAttribute(n,m+2),h.subVectors(o,s),p.subVectors(r,s),h.cross(p),i.setXYZ(m+0,h.x,h.y,h.z),i.setXYZ(m+1,h.x,h.y,h.z),i.setXYZ(m+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)ci.fromBufferAttribute(e,n),ci.normalize(),e.setXYZ(n,ci.x,ci.y,ci.z)}toNonIndexed(){function e(c,u){const d=c.array,h=c.itemSize,p=c.normalized,m=new d.constructor(u.length*h);let v=0,_=0;for(let w=0,y=u.length;w<y;w++){c.isInterleavedBufferAttribute?v=u[w]*c.data.stride+c.offset:v=u[w]*h;for(let b=0;b<h;b++)m[_++]=d[v++]}return new Vr(m,h,p)}if(this.index===null)return Gt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new gs,i=this.index.array,r=this.attributes;for(const c in r){const u=r[c],d=e(u,i);n.setAttribute(c,d)}const s=this.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,p=d.length;h<p;h++){const m=d[h],v=e(m,i);u.push(v)}n.morphAttributes[c]=u}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let c=0,u=o.length;c<u;c++){const d=o[c];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const d in u)u[d]!==void 0&&(e[d]=u[d]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const u in i){const d=i[u];e.data.attributes[u]=d.toJSON(e.data)}const r={};let s=!1;for(const u in this.morphAttributes){const d=this.morphAttributes[u],h=[];for(let p=0,m=d.length;p<m;p++){const v=d[p];h.push(v.toJSON(e.data))}h.length>0&&(r[u]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const d in r){const h=r[d];this.setAttribute(d,h.clone(n))}const s=e.morphAttributes;for(const d in s){const h=[],p=s[d];for(let m=0,v=p.length;m<v;m++)h.push(p[m].clone(n));this.morphAttributes[d]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,h=o.length;d<h;d++){const p=o[d];this.addGroup(p.start,p.count,p.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let g6=0;class Gh extends ec{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:g6++}),this.uuid=Fu(),this.name="",this.type="Material",this.blending=_o,this.side=Ua,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=G0,this.blendDst=j0,this.blendEquation=lo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Tn(0,0,0),this.blendAlpha=0,this.depthFunc=jl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=M1,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=cl,this.stencilZFail=cl,this.stencilZPass=cl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){Gt(`Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Gt(`Material: '${n}' 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[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==_o&&(i.blending=this.blending),this.side!==Ua&&(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!==G0&&(i.blendSrc=this.blendSrc),this.blendDst!==j0&&(i.blendDst=this.blendDst),this.blendEquation!==lo&&(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!==jl&&(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!==M1&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==cl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==cl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==cl&&(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.allowOverride===!1&&(i.allowOverride=!1),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 c in s){const u=s[c];delete u.metadata,o.push(u)}return o}if(n){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 n=e.clippingPlanes;let i=null;if(n!==null){const r=n.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=n[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.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const ks=new me,Rg=new me,df=new me,xa=new me,kg=new me,ff=new me,Lg=new me;class v6{constructor(e=new me,n=new me(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,ks)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=ks.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(ks.copy(this.origin).addScaledVector(this.direction,n),ks.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){Rg.copy(e).add(n).multiplyScalar(.5),df.copy(n).sub(e).normalize(),xa.copy(this.origin).sub(Rg);const s=e.distanceTo(n)*.5,o=-this.direction.dot(df),c=xa.dot(this.direction),u=-xa.dot(df),d=xa.lengthSq(),h=Math.abs(1-o*o);let p,m,v,_;if(h>0)if(p=o*u-c,m=o*c-u,_=s*h,p>=0)if(m>=-_)if(m<=_){const w=1/h;p*=w,m*=w,v=p*(p+o*m+2*c)+m*(o*p+m+2*u)+d}else m=s,p=Math.max(0,-(o*m+c)),v=-p*p+m*(m+2*u)+d;else m=-s,p=Math.max(0,-(o*m+c)),v=-p*p+m*(m+2*u)+d;else m<=-_?(p=Math.max(0,-(-o*s+c)),m=p>0?-s:Math.min(Math.max(-s,-u),s),v=-p*p+m*(m+2*u)+d):m<=_?(p=0,m=Math.min(Math.max(-s,-u),s),v=m*(m+2*u)+d):(p=Math.max(0,-(o*s+c)),m=p>0?s:Math.min(Math.max(-s,-u),s),v=-p*p+m*(m+2*u)+d);else m=o>0?-s:s,p=Math.max(0,-(o*m+c)),v=-p*p+m*(m+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,p),r&&r.copy(Rg).addScaledVector(df,m),v}intersectSphere(e,n){ks.subVectors(e.center,this.origin);const i=ks.dot(this.direction),r=ks.dot(ks)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),c=i-o,u=i+o;return u<0?null:c<0?this.at(u,n):this.at(c,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,s,o,c,u;const d=1/this.direction.x,h=1/this.direction.y,p=1/this.direction.z,m=this.origin;return d>=0?(i=(e.min.x-m.x)*d,r=(e.max.x-m.x)*d):(i=(e.max.x-m.x)*d,r=(e.min.x-m.x)*d),h>=0?(s=(e.min.y-m.y)*h,o=(e.max.y-m.y)*h):(s=(e.max.y-m.y)*h,o=(e.min.y-m.y)*h),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),p>=0?(c=(e.min.z-m.z)*p,u=(e.max.z-m.z)*p):(c=(e.max.z-m.z)*p,u=(e.min.z-m.z)*p),i>u||c>r)||((c>i||i!==i)&&(i=c),(u<r||r!==r)&&(r=u),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,ks)!==null}intersectTriangle(e,n,i,r,s){kg.subVectors(n,e),ff.subVectors(i,e),Lg.crossVectors(kg,ff);let o=this.direction.dot(Lg),c;if(o>0){if(r)return null;c=1}else if(o<0)c=-1,o=-o;else return null;xa.subVectors(this.origin,e);const u=c*this.direction.dot(ff.crossVectors(xa,ff));if(u<0)return null;const d=c*this.direction.dot(kg.cross(xa));if(d<0||u+d>o)return null;const h=-c*xa.dot(Lg);return h<0?null:this.at(h/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class bP extends Gh{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Tn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Co,this.combine=JC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const V1=new Kn,no=new v6,hf=new a_,H1=new me,pf=new me,mf=new me,gf=new me,Dg=new me,vf=new me,G1=new me,yf=new me;let ds=class extends er{constructor(e=new gs,n=new bP){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const c=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const c=this.morphTargetInfluences;if(s&&c){vf.set(0,0,0);for(let u=0,d=s.length;u<d;u++){const h=c[u],p=s[u];h!==0&&(Dg.fromBufferAttribute(p,e),o?vf.addScaledVector(Dg,h):vf.addScaledVector(Dg.sub(n),h))}n.add(vf)}return n}raycast(e,n){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),hf.copy(i.boundingSphere),hf.applyMatrix4(s),no.copy(e.ray).recast(e.near),!(hf.containsPoint(no.origin)===!1&&(no.intersectSphere(hf,H1)===null||no.origin.distanceToSquared(H1)>(e.far-e.near)**2))&&(V1.copy(s).invert(),no.copy(e.ray).applyMatrix4(V1),!(i.boundingBox!==null&&no.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,no)))}_computeIntersections(e,n,i){let r;const s=this.geometry,o=this.material,c=s.index,u=s.attributes.position,d=s.attributes.uv,h=s.attributes.uv1,p=s.attributes.normal,m=s.groups,v=s.drawRange;if(c!==null)if(Array.isArray(o))for(let _=0,w=m.length;_<w;_++){const y=m[_],b=o[y.materialIndex],T=Math.max(y.start,v.start),A=Math.min(c.count,Math.min(y.start+y.count,v.start+v.count));for(let M=T,I=A;M<I;M+=3){const k=c.getX(M),U=c.getX(M+1),S=c.getX(M+2);r=_f(this,b,e,i,d,h,p,k,U,S),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=y.materialIndex,n.push(r))}}else{const _=Math.max(0,v.start),w=Math.min(c.count,v.start+v.count);for(let y=_,b=w;y<b;y+=3){const T=c.getX(y),A=c.getX(y+1),M=c.getX(y+2);r=_f(this,o,e,i,d,h,p,T,A,M),r&&(r.faceIndex=Math.floor(y/3),n.push(r))}}else if(u!==void 0)if(Array.isArray(o))for(let _=0,w=m.length;_<w;_++){const y=m[_],b=o[y.materialIndex],T=Math.max(y.start,v.start),A=Math.min(u.count,Math.min(y.start+y.count,v.start+v.count));for(let M=T,I=A;M<I;M+=3){const k=M,U=M+1,S=M+2;r=_f(this,b,e,i,d,h,p,k,U,S),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=y.materialIndex,n.push(r))}}else{const _=Math.max(0,v.start),w=Math.min(u.count,v.start+v.count);for(let y=_,b=w;y<b;y+=3){const T=y,A=y+1,M=y+2;r=_f(this,o,e,i,d,h,p,T,A,M),r&&(r.faceIndex=Math.floor(y/3),n.push(r))}}}};function y6(t,e,n,i,r,s,o,c){let u;if(e.side===Gi?u=i.intersectTriangle(o,s,r,!0,c):u=i.intersectTriangle(r,s,o,e.side===Ua,c),u===null)return null;yf.copy(c),yf.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(yf);return d<n.near||d>n.far?null:{distance:d,point:yf.clone(),object:t}}function _f(t,e,n,i,r,s,o,c,u,d){t.getVertexPosition(c,pf),t.getVertexPosition(u,mf),t.getVertexPosition(d,gf);const h=y6(t,e,n,i,pf,mf,gf,G1);if(h){const p=new me;jc.getBarycoord(G1,pf,mf,gf,p),r&&(h.uv=jc.getInterpolatedAttribute(r,c,u,d,p,new bn)),s&&(h.uv1=jc.getInterpolatedAttribute(s,c,u,d,p,new bn)),o&&(h.normal=jc.getInterpolatedAttribute(o,c,u,d,p,new me),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const m={a:c,b:u,c:d,normal:new me,materialIndex:0};jc.getNormal(pf,mf,gf,m.normal),h.face=m,h.barycoord=p}return h}class _6 extends Li{constructor(e=null,n=1,i=1,r,s,o,c,u,d=mi,h=mi,p,m){super(null,o,c,u,d,h,r,s,p,m),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ng=new me,x6=new me,b6=new Wt;class oo{constructor(e=new me(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=Ng.subVectors(i,n).cross(x6.subVectors(e,n)).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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(Ng),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:n.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>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,n){const i=n||b6.getNormalMatrix(e),r=this.coplanarPoint(Ng).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const io=new a_,S6=new bn(.5,.5),xf=new me;class SP{constructor(e=new oo,n=new oo,i=new oo,r=new oo,s=new oo,o=new oo){this.planes=[e,n,i,r,s,o]}set(e,n,i,r,s,o){const c=this.planes;return c[0].copy(e),c[1].copy(n),c[2].copy(i),c[3].copy(r),c[4].copy(s),c[5].copy(o),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=es,i=!1){const r=this.planes,s=e.elements,o=s[0],c=s[1],u=s[2],d=s[3],h=s[4],p=s[5],m=s[6],v=s[7],_=s[8],w=s[9],y=s[10],b=s[11],T=s[12],A=s[13],M=s[14],I=s[15];if(r[0].setComponents(d-o,v-h,b-_,I-T).normalize(),r[1].setComponents(d+o,v+h,b+_,I+T).normalize(),r[2].setComponents(d+c,v+p,b+w,I+A).normalize(),r[3].setComponents(d-c,v-p,b-w,I-A).normalize(),i)r[4].setComponents(u,m,y,M).normalize(),r[5].setComponents(d-u,v-m,b-y,I-M).normalize();else if(r[4].setComponents(d-u,v-m,b-y,I-M).normalize(),n===es)r[5].setComponents(d+u,v+m,b+y,I+M).normalize();else if(n===wh)r[5].setComponents(u,m,y,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),io.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),io.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(io)}intersectsSprite(e){io.center.set(0,0,0);const n=S6.distanceTo(e.center);return io.radius=.7071067811865476+n,io.applyMatrix4(e.matrixWorld),this.intersectsSphere(io)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const r=n[i];if(xf.x=r.normal.x>0?e.max.x:e.min.x,xf.y=r.normal.y>0?e.max.y:e.min.y,xf.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(xf)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class wP extends Li{constructor(e=[],n=To,i,r,s,o,c,u,d,h){super(e,n,i,r,s,o,c,u,d,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Su extends Li{constructor(e,n,i=us,r,s,o,c=mi,u=mi,d,h=Gs,p=1){if(h!==Gs&&h!==go)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:n,depth:p};super(m,r,s,o,c,u,h,i,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new s_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class w6 extends Su{constructor(e,n=us,i=To,r,s,o=mi,c=mi,u,d=Gs){const h={width:e,height:e,depth:1},p=[h,h,h,h,h,h];super(e,e,n,i,r,s,o,c,u,d),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class EP extends Li{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Bu extends gs{constructor(e=1,n=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const c=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const u=[],d=[],h=[],p=[];let m=0,v=0;_("z","y","x",-1,-1,i,n,e,o,s,0),_("z","y","x",1,-1,i,n,-e,o,s,1),_("x","z","y",1,1,e,i,n,r,o,2),_("x","z","y",1,-1,e,i,-n,r,o,3),_("x","y","z",1,-1,e,n,i,r,s,4),_("x","y","z",-1,-1,e,n,-i,r,s,5),this.setIndex(u),this.setAttribute("position",new zs(d,3)),this.setAttribute("normal",new zs(h,3)),this.setAttribute("uv",new zs(p,2));function _(w,y,b,T,A,M,I,k,U,S,P){const V=M/U,O=I/S,G=M/2,J=I/2,H=k/2,X=U+1,K=S+1;let Q=0,W=0;const q=new me;for(let Z=0;Z<K;Z++){const z=Z*O-J;for(let ie=0;ie<X;ie++){const Ee=ie*V-G;q[w]=Ee*T,q[y]=z*A,q[b]=H,d.push(q.x,q.y,q.z),q[w]=0,q[y]=0,q[b]=k>0?1:-1,h.push(q.x,q.y,q.z),p.push(ie/U),p.push(1-Z/S),Q+=1}}for(let Z=0;Z<S;Z++)for(let z=0;z<U;z++){const ie=m+z+X*Z,Ee=m+z+X*(Z+1),ze=m+(z+1)+X*(Z+1),Se=m+(z+1)+X*Z;u.push(ie,Ee,Se),u.push(Ee,ze,Se),W+=6}c.addGroup(v,W,P),v+=W,m+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bu(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class jh extends gs{constructor(e=1,n=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:r};const s=e/2,o=n/2,c=Math.floor(i),u=Math.floor(r),d=c+1,h=u+1,p=e/c,m=n/u,v=[],_=[],w=[],y=[];for(let b=0;b<h;b++){const T=b*m-o;for(let A=0;A<d;A++){const M=A*p-s;_.push(M,-T,0),w.push(0,0,1),y.push(A/c),y.push(1-b/u)}}for(let b=0;b<u;b++)for(let T=0;T<c;T++){const A=T+d*b,M=T+d*(b+1),I=T+1+d*(b+1),k=T+1+d*b;v.push(A,M,k),v.push(M,I,k)}this.setIndex(v),this.setAttribute("position",new zs(_,3)),this.setAttribute("normal",new zs(w,3)),this.setAttribute("uv",new zs(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jh(e.width,e.height,e.widthSegments,e.heightSegments)}}function Xl(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(Gt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Ci(t){const e={};for(let n=0;n<t.length;n++){const i=Xl(t[n]);for(const r in i)e[r]=i[r]}return e}function E6(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function MP(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:fn.workingColorSpace}const M6={clone:Xl,merge:Ci};var T6=`void main() {
|
|
611
|
+
`),()=>{c.current?.removeAttribute("data-motion-pop-id"),I.contains(M)&&I.removeChild(M)}},[e]),F.jsx(x5,{isPresent:e,childRef:c,sizeRef:u,pop:s,children:s===!1?t:L.cloneElement(t,{ref:p})})}const S5=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:o,anchorX:c,anchorY:u,root:d})=>{const h=yy(w5),p=L.useId();let m=!0,v=L.useMemo(()=>(m=!1,{id:p,initial:e,isPresent:n,custom:r,onExitComplete:_=>{h.set(_,!0);for(const w of h.values())if(!w)return;i&&i()},register:_=>(h.set(_,!1),()=>h.delete(_))}),[n,h,i]);return s&&m&&(v={...v}),L.useMemo(()=>{h.forEach((_,w)=>h.set(w,!1))},[n]),L.useEffect(()=>{!n&&!h.size&&i&&i()},[n]),t=F.jsx(b5,{pop:o==="popLayout",isPresent:n,anchorX:c,anchorY:u,root:d,children:t}),F.jsx(Fh.Provider,{value:v,children:t})};function w5(){return new Map}function pC(t=!0){const e=L.useContext(Fh);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=e,s=L.useId();L.useEffect(()=>{if(t)return r(s)},[t]);const o=L.useCallback(()=>t&&i&&i(s),[s,i,t]);return!n&&i?[!1,o]:[!0]}const Kd=t=>t.key||"";function Qw(t){const e=[];return L.Children.forEach(t,n=>{L.isValidElement(n)&&e.push(n)}),e}const E5=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:o=!1,anchorX:c="left",anchorY:u="top",root:d})=>{const[h,p]=pC(o),m=L.useMemo(()=>Qw(t),[t]),v=o&&!h?[]:m.map(Kd),_=L.useRef(!0),w=L.useRef(m),y=yy(()=>new Map),b=L.useRef(new Set),[T,A]=L.useState(m),[M,I]=L.useState(m);VT(()=>{_.current=!1,w.current=m;for(let S=0;S<M.length;S++){const P=Kd(M[S]);v.includes(P)?(y.delete(P),b.current.delete(P)):y.get(P)!==!0&&y.set(P,!1)}},[M,v.length,v.join("-")]);const k=[];if(m!==T){let S=[...m];for(let P=0;P<M.length;P++){const V=M[P],O=Kd(V);v.includes(O)||(S.splice(P,0,V),k.push(V))}return s==="wait"&&k.length&&(S=k),I(Qw(S)),A(m),null}const{forceRender:U}=L.useContext(vy);return F.jsx(F.Fragment,{children:M.map(S=>{const P=Kd(S),V=o&&!h?!1:m===M||v.includes(P),O=()=>{if(b.current.has(P))return;if(y.has(P))b.current.add(P),y.set(P,!0);else return;let G=!0;y.forEach(J=>{J||(G=!1)}),G&&(U?.(),I(w.current),o&&p?.(),i&&i())};return F.jsx(S5,{isPresent:V,initial:!_.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:d,onExitComplete:V?void 0:O,anchorX:c,anchorY:u,children:S},P)})})},mC=L.createContext({strict:!1}),e1={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let t1=!1;function M5(){if(t1)return;const t={};for(const e in e1)t[e]={isEnabled:n=>e1[e].some(i=>!!n[i])};jA(t),t1=!0}function gC(){return M5(),l4()}function T5(t){const e=gC();for(const n in t)e[n]={...e[n],...t[n]};jA(e)}const A5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function xh(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||A5.has(t)}let vC=t=>!xh(t);function C5(t){typeof t=="function"&&(vC=e=>e.startsWith("on")?!xh(e):t(e))}try{C5(require("@emotion/is-prop-valid").default)}catch{}function P5(t,e,n){const i={};for(const r in t)r==="values"&&typeof t.values=="object"||pi(t[r])||(vC(r)||n===!0&&xh(r)||!e&&!xh(r)||t.draggable&&r.startsWith("onDrag"))&&(i[r]=t[r]);return i}const Vh=L.createContext({});function R5(t,e){if(zh(t)){const{initial:n,animate:i}=t;return{initial:n===!1||yu(n)?n:void 0,animate:yu(i)?i:void 0}}return t.inherit!==!1?e:{}}function k5(t){const{initial:e,animate:n}=R5(t,L.useContext(Vh));return L.useMemo(()=>({initial:e,animate:n}),[n1(e),n1(n)])}function n1(t){return Array.isArray(t)?t.join(" "):t}const Wy=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function yC(t,e,n){for(const i in e)!pi(e[i])&&!ZA(i,n)&&(t[i]=e[i])}function L5({transformTemplate:t},e){return L.useMemo(()=>{const n=Wy();return Hy(n,e,t),Object.assign({},n.vars,n.style)},[e])}function D5(t,e){const n=t.style||{},i={};return yC(i,n,t),Object.assign(i,L5(t,e)),i}function N5(t,e){const n={},i=D5(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const _C=()=>({...Wy(),attrs:{}});function I5(t,e,n,i){const r=L.useMemo(()=>{const s=_C();return JA(s,e,eC(i),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};yC(s,t.style,t),r.style={...s,...r.style}}return r}const U5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function $y(t){return typeof t!="string"||t.includes("-")?!1:!!(U5.indexOf(t)>-1||/[A-Z]/u.test(t))}function F5(t,e,n,{latestValues:i},r,s=!1,o){const u=(o??$y(t)?I5:N5)(e,i,r,t),d=P5(e,typeof t=="string",s),h=t!==L.Fragment?{...d,...u,ref:n}:{},{children:p}=e,m=L.useMemo(()=>pi(p)?p.get():p,[p]);return L.createElement(t,{...h,children:m})}function O5({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,r){return{latestValues:B5(n,i,r,t),renderState:e()}}function B5(t,e,n,i){const r={},s=i(t,{});for(const m in s)r[m]=Hf(s[m]);let{initial:o,animate:c}=t;const u=zh(t),d=HA(t);e&&d&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),c===void 0&&(c=e.animate));let h=n?n.initial===!1:!1;h=h||o===!1;const p=h?c:o;if(p&&typeof p!="boolean"&&!Bh(p)){const m=Array.isArray(p)?p:[p];for(let v=0;v<m.length;v++){const _=Dy(t,m[v]);if(_){const{transitionEnd:w,transition:y,...b}=_;for(const T in b){let A=b[T];if(Array.isArray(A)){const M=h?A.length-1:0;A=A[M]}A!==null&&(r[T]=A)}for(const T in w)r[T]=w[T]}}}return r}const xC=t=>(e,n)=>{const i=L.useContext(Vh),r=L.useContext(Fh),s=()=>O5(t,e,i,r);return n?s():yy(s)},z5=xC({scrapeMotionValuesFromProps:Gy,createRenderState:Wy}),V5=xC({scrapeMotionValuesFromProps:tC,createRenderState:_C}),H5=Symbol.for("motionComponentSymbol");function G5(t,e,n){const i=L.useRef(n);L.useInsertionEffect(()=>{i.current=n});const r=L.useRef(null);return L.useCallback(s=>{s&&t.onMount?.(s);const o=i.current;if(typeof o=="function")if(s){const c=o(s);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):o(s);else o&&(o.current=s);e&&(s?e.mount(s):e.unmount())},[e])}const bC=L.createContext({});function Tl(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function j5(t,e,n,i,r,s){const{visualElement:o}=L.useContext(Vh),c=L.useContext(mC),u=L.useContext(Fh),d=L.useContext(jy),h=d.reducedMotion,p=d.skipAnimations,m=L.useRef(null),v=L.useRef(!1);i=i||c.renderer,!m.current&&i&&(m.current=i(t,{visualState:e,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:h,skipAnimations:p,isSVG:s}),v.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const _=m.current,w=L.useContext(bC);_&&!_.projection&&r&&(_.type==="html"||_.type==="svg")&&W5(m.current,n,r,w);const y=L.useRef(!1);L.useInsertionEffect(()=>{_&&y.current&&_.update(n,u)});const b=n[PA],T=L.useRef(!!b&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return VT(()=>{v.current=!0,_&&(y.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),_.scheduleRenderMicrotask(),T.current&&_.animationState&&_.animationState.animateChanges())}),L.useEffect(()=>{_&&(!T.current&&_.animationState&&_.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),T.current=!1),_.enteringChildren=void 0)}),_}function W5(t,e,n,i){const{layoutId:r,layout:s,drag:o,dragConstraints:c,layoutScroll:u,layoutRoot:d,layoutAnchor:h,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:SC(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||c&&Tl(c),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,crossfade:p,layoutScroll:u,layoutRoot:d,layoutAnchor:h})}function SC(t){if(t)return t.options.allowProjection!==!1?t.projection:SC(t.parent)}function tg(t,{forwardMotionProps:e=!1,type:n}={},i,r){i&&T5(i);const s=n?n==="svg":$y(t),o=s?V5:z5;function c(d,h){let p;const m={...L.useContext(jy),...d,layoutId:$5(d)},{isStatic:v}=m,_=k5(d),w=o(d,v);if(!v&&typeof window<"u"){X5();const y=q5(m);p=y.MeasureLayout,_.visualElement=j5(t,w,m,r,y.ProjectionNode,s)}return F.jsxs(Vh.Provider,{value:_,children:[p&&_.visualElement?F.jsx(p,{visualElement:_.visualElement,...m}):null,F5(t,d,G5(w,_.visualElement,h),w,v,e,s)]})}c.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=L.forwardRef(c);return u[H5]=t,u}function $5({layoutId:t}){const e=L.useContext(vy).id;return e&&t!==void 0?e+"-"+t:t}function X5(t,e){L.useContext(mC).strict}function q5(t){const e=gC(),{drag:n,layout:i}=e;if(!n&&!i)return{};const r={...n,...i};return{MeasureLayout:n?.isEnabled(t)||i?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Y5(t,e){if(typeof Proxy>"u")return tg;const n=new Map,i=(s,o)=>tg(s,o,t,e),r=(s,o)=>i(s,o);return new Proxy(r,{get:(s,o)=>o==="create"?i:(n.has(o)||n.set(o,tg(o,void 0,t,e)),n.get(o))})}const K5=(t,e)=>e.isSVG??$y(t)?new M4(e):new _4(e,{allowProjection:t!==L.Fragment});class Z5 extends Fa{constructor(e){super(e),e.animationState||(e.animationState=R4(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Bh(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let J5=0;class Q5 extends Fa{constructor(){super(...arguments),this.id=J5++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;if(e&&i===!1){if(this.isExitComplete){const{initial:s,custom:o}=this.node.getProps();if(typeof s=="string"){const c=yo(this.node,s,o);if(c){const{transition:u,transitionEnd:d,...h}=c;for(const p in h)this.node.getValue(p)?.jump(h[p])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const ez={animation:{Feature:Z5},exit:{Feature:Q5}};function Uu(t){return{point:{x:t.pageX,y:t.pageY}}}const tz=t=>e=>Fy(e)&&t(e,Uu(e));function cu(t,e,n,i){return _u(t,e,tz(n),i)}const wC=({current:t})=>t?t.ownerDocument.defaultView:null,i1=(t,e)=>Math.abs(t-e);function nz(t,e){const n=i1(t.x,e.x),i=i1(t.y,e.y);return Math.sqrt(n**2+i**2)}const r1=new Set(["auto","scroll"]);class EC{constructor(e,n,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3,element:c}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Zd(this.lastRawMoveEventInfo,this.transformPagePoint));const v=ng(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,w=nz(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!w)return;const{point:y}=v,{timestamp:b}=hi;this.history.push({...y,timestamp:b});const{onStart:T,onMove:A}=this.handlers;_||(T&&T(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,v)},this.handlePointerMove=(v,_)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=_,this.lastMoveEventInfo=Zd(_,this.transformPagePoint),An.update(this.updatePoint,!0)},this.handlePointerUp=(v,_)=>{this.end();const{onEnd:w,onSessionEnd:y,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=ng(v.type==="pointercancel"?this.lastMoveEventInfo:Zd(_,this.transformPagePoint),this.history);this.startEvent&&w&&w(v,T),y&&y(v,T)},!Fy(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=r||window;const u=Uu(e),d=Zd(u,this.transformPagePoint),{point:h}=d,{timestamp:p}=hi;this.history=[{...h,timestamp:p}];const{onSessionStart:m}=n;m&&m(e,ng(d,this.history)),this.removeListeners=Du(cu(this.contextWindow,"pointermove",this.handlePointerMove),cu(this.contextWindow,"pointerup",this.handlePointerUp),cu(this.contextWindow,"pointercancel",this.handlePointerUp)),c&&this.startScrollTracking(c)}startScrollTracking(e){let n=e.parentElement;for(;n;){const i=getComputedStyle(n);(r1.has(i.overflowX)||r1.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const i=e===window,r=i?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:r.x-n.x,y:r.y-n.y};s.x===0&&s.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,r),An.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ia(this.updatePoint)}}function Zd(t,e){return e?{point:e(t.point)}:t}function s1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ng({point:t},e){return{point:t,delta:s1(t,MC(e)),offset:s1(t,iz(e)),velocity:rz(e,.1)}}function iz(t){return t[0]}function MC(t){return t[t.length-1]}function rz(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const r=MC(t);for(;n>=0&&(i=t[n],!(r.timestamp-i.timestamp>Qi(e)));)n--;if(!i)return{x:0,y:0};i===t[0]&&t.length>2&&r.timestamp-i.timestamp>Qi(e)*2&&(i=t[1]);const s=hr(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function sz(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Ln(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Ln(n,t,i.max):Math.min(t,n)),t}function a1(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function az(t,{top:e,left:n,bottom:i,right:r}){return{x:a1(t.x,n,r),y:a1(t.y,e,i)}}function o1(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function oz(t,e){return{x:o1(t.x,e.x),y:o1(t.y,e.y)}}function lz(t,e){let n=.5;const i=Ri(t),r=Ri(e);return r>i?n=gu(e.min,e.max-i,t.min):i>r&&(n=gu(t.min,t.max-r,e.min)),cs(0,1,n)}function cz(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const B0=.35;function uz(t=B0){return t===!1?t=0:t===!0&&(t=B0),{x:l1(t,"left","right"),y:l1(t,"top","bottom")}}function l1(t,e,n){return{min:c1(t,e),max:c1(t,n)}}function c1(t,e){return typeof t=="number"?t:t[e]||0}const dz=new WeakMap;class fz{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ti(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=p=>{n&&this.snapToCursor(Uu(p).point),this.stopAnimation()},o=(p,m)=>{const{drag:v,dragPropagation:_,onDragStart:w}=this.getProps();if(v&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=BB(v),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Yr(b=>{let T=this.getAxisMotionValue(b).get()||0;if(ns.test(T)){const{projection:A}=this.visualElement;if(A&&A.layout){const M=A.layout.layoutBox[b];M&&(T=Ri(M)*(parseFloat(T)/100))}}this.originPoint[b]=T}),w&&An.update(()=>w(p,m),!1,!0),k0(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},c=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m;const{dragPropagation:v,dragDirectionLock:_,onDirectionLock:w,onDrag:y}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:b}=m;if(_&&this.currentDirection===null){this.currentDirection=pz(b),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),y&&An.update(()=>y(p,m),!1,!0)},u=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m,this.stop(p,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new EC(e,{onSessionStart:s,onStart:o,onMove:c,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:i,contextWindow:wC(this.visualElement),element:this.visualElement.current})}stop(e,n){const i=e||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!i)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:c}=this.getProps();c&&An.postRender(()=>c(i,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,i){const{drag:r}=this.getProps();if(!i||!Jd(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=sz(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Tl(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=az(i.layoutBox,e):this.constraints=!1,this.elastic=uz(n),r!==this.constraints&&!Tl(e)&&i&&this.constraints&&!this.hasMutatedConstraints&&Yr(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=cz(i.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Tl(e))return!1;const i=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=h4(i,r.root,this.visualElement.getTransformPagePoint());let o=oz(r.layout.layoutBox,s);if(n){const c=n(u4(o));this.hasMutatedConstraints=!!c,c&&(o=$A(c))}return o}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=Yr(h=>{if(!Jd(h,n,this.currentDirection))return;let p=u&&u[h]||{};(o===!0||o===h)&&(p={min:0,max:0});const m=r?200:1e6,v=r?40:1e7,_={type:"inertia",velocity:i?e[h]:0,bounceStiffness:m,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(h,_)});return Promise.all(d).then(c)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return k0(this.visualElement,e),i.start(Ly(e,i,0,n,this.visualElement,!1))}stopAnimation(){Yr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Yr(n=>{const{drag:i}=this.getProps();if(!Jd(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:c}=r.layout.layoutBox[n],u=s.get()||0;s.set(e[n]-Ln(o,c,.5)+u)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Tl(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Yr(o=>{const c=this.getAxisMotionValue(o);if(c&&this.constraints!==!1){const u=c.get();r[o]=lz({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),Yr(o=>{if(!Jd(o,e,null))return;const c=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];c.set(Ln(u,d,r[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;dz.set(this.visualElement,this);const e=this.visualElement.current,n=cu(e,"pointerdown",d=>{const{drag:h,dragListener:p=!0}=this.getProps(),m=d.target,v=m!==e&&WB(m);h&&p&&!v&&this.start(d)});let i;const r=()=>{const{dragConstraints:d}=this.getProps();Tl(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),i||(i=hz(e,d.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),An.read(r);const c=_u(window,"resize",()=>this.scalePositionWithinConstraints()),u=s.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:h})=>{this.isDragging&&h&&(Yr(p=>{const m=this.getAxisMotionValue(p);m&&(this.originPoint[p]+=d[p].translate,m.set(m.get()+d[p].translate))}),this.visualElement.render())}));return()=>{c(),n(),o(),u&&u(),i&&i()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=B0,dragMomentum:c=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:c}}}function u1(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function hz(t,e,n){const i=vw(t,u1(n)),r=vw(e,u1(n));return()=>{i(),r()}}function Jd(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function pz(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class mz extends Fa{constructor(e){super(e),this.removeGroupControls=pr,this.removeListeners=pr,this.controls=new fz(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||pr}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ig=t=>(e,n)=>{t&&An.update(()=>t(e,n),!1,!0)};class gz extends Fa{constructor(){super(...arguments),this.removePointerDownListener=pr}onPointerDown(e){this.session=new EC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:wC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:ig(e),onStart:ig(n),onMove:ig(i),onEnd:(s,o)=>{delete this.session,r&&An.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=cu(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let rg=!1;class vz extends L.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),rg&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Gf.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,{projection:o}=i;return o&&(o.isPresent=s,e.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),rg=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==s?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||An.postRender(()=>{const c=o.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:i}=e;i&&(i.options.layoutAnchor=n,i.root.didUpdate(),Uy.postRender(()=>{!i.currentAnimation&&i.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=e;rg=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function TC(t){const[e,n]=pC(),i=L.useContext(vy);return F.jsx(vz,{...t,layoutGroup:i,switchLayoutGroup:L.useContext(bC),isPresent:e,safeToRemove:n})}const yz={pan:{Feature:gz},drag:{Feature:mz,ProjectionNode:hC,MeasureLayout:TC}};function d1(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&An.postRender(()=>s(e,Uu(e)))}class _z extends Fa{mount(){const{current:e}=this.node;e&&(this.unmount=VB(e,(n,i)=>(d1(this.node,i,"Start"),r=>d1(this.node,r,"End"))))}unmount(){}}class xz extends Fa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Du(_u(this.node.current,"focus",()=>this.onFocus()),_u(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function f1(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&An.postRender(()=>s(e,Uu(e)))}class bz extends Fa{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=XB(e,(r,s)=>(f1(this.node,s,"Start"),(o,{success:c})=>f1(this.node,o,c?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const z0=new WeakMap,sg=new WeakMap,Sz=t=>{const e=z0.get(t.target);e&&e(t)},wz=t=>{t.forEach(Sz)};function Ez({root:t,...e}){const n=t||document;sg.has(n)||sg.set(n,{});const i=sg.get(n),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(wz,{root:t,...e})),i[r]}function Mz(t,e,n){const i=Ez(e);return z0.set(t,n),i.observe(t),()=>{z0.delete(t),i.unobserve(t)}}const Tz={some:0,all:1};class Az extends Fa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=e,o={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:Tz[r]},c=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,s&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),m=d?h:p;m&&m(u)};this.stopObserver=Mz(this.node.current,o,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Cz(e,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function Cz({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Pz={inView:{Feature:Az},tap:{Feature:bz},focus:{Feature:xz},hover:{Feature:_z}},Rz={layout:{ProjectionNode:hC,MeasureLayout:TC}},kz={...ez,...Pz,...yz,...Rz},Il=Y5(kz,K5);function Lz(){!Vy.current&&GA();const[t]=L.useState(gh.current);return t}const AC=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim();const Dz=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Nz=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase());const h1=t=>{const e=Nz(t);return e.charAt(0).toUpperCase()+e.slice(1)};var ag={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Iz=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},Uz=L.createContext({}),Fz=()=>L.useContext(Uz),Oz=L.forwardRef(({color:t,size:e,strokeWidth:n,absoluteStrokeWidth:i,className:r="",children:s,iconNode:o,...c},u)=>{const{size:d=24,strokeWidth:h=2,absoluteStrokeWidth:p=!1,color:m="currentColor",className:v=""}=Fz()??{},_=i??p?Number(n??h)*24/Number(e??d):n??h;return L.createElement("svg",{ref:u,...ag,width:e??d??ag.width,height:e??d??ag.height,stroke:t??m,strokeWidth:_,className:AC("lucide",v,r),...!s&&!Iz(c)&&{"aria-hidden":"true"},...c},[...o.map(([w,y])=>L.createElement(w,y)),...Array.isArray(s)?s:[s]])});const br=(t,e)=>{const n=L.forwardRef(({className:i,...r},s)=>L.createElement(Oz,{ref:s,iconNode:e,className:AC(`lucide-${Dz(h1(t))}`,`lucide-${t}`,i),...r}));return n.displayName=h1(t),n};const Bz=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],zz=br("chart-column",Bz);const Vz=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Hz=br("gauge",Vz);const Gz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],jz=br("globe",Gz);const Wz=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],$z=br("layout-grid",Wz);const Xz=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],qz=br("mail",Xz);const Yz=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Kz=br("menu",Yz);const Zz=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Jz=br("monitor",Zz);const Qz=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],CC=br("moon",Qz);const eV=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],tV=br("settings",eV);const nV=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],PC=br("sun",nV);const iV=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],rV=br("trophy",iV);const sV=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],RC=br("x",sV);function kC(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=kC(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function aV(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=kC(t))&&(i&&(i+=" "),i+=e);return i}const oV=(t,e)=>{const n=new Array(t.length+e.length);for(let i=0;i<t.length;i++)n[i]=t[i];for(let i=0;i<e.length;i++)n[t.length+i]=e[i];return n},lV=(t,e)=>({classGroupId:t,validator:e}),LC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),bh="-",p1=[],cV="arbitrary..",uV=t=>{const e=fV(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return dV(o);const c=o.split(bh),u=c[0]===""&&c.length>1?1:0;return DC(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=i[o],d=n[o];return u?d?oV(d,u):u:d||p1}return n[o]||p1}}},DC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const r=t[e],s=n.nextPart.get(r);if(s){const d=DC(t,e+1,s);if(d)return d}const o=n.validators;if(o===null)return;const c=e===0?t.join(bh):t.slice(e).join(bh),u=o.length;for(let d=0;d<u;d++){const h=o[d];if(h.validator(c))return h.classGroupId}},dV=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),i=e.slice(0,n);return i?cV+i:void 0})(),fV=t=>{const{theme:e,classGroups:n}=t;return hV(n,e)},hV=(t,e)=>{const n=LC();for(const i in t){const r=t[i];Xy(r,n,i,e)}return n},Xy=(t,e,n,i)=>{const r=t.length;for(let s=0;s<r;s++){const o=t[s];pV(o,e,n,i)}},pV=(t,e,n,i)=>{if(typeof t=="string"){mV(t,e,n);return}if(typeof t=="function"){gV(t,e,n,i);return}vV(t,e,n,i)},mV=(t,e,n)=>{const i=t===""?e:NC(e,t);i.classGroupId=n},gV=(t,e,n,i)=>{if(yV(t)){Xy(t(i),e,n,i);return}e.validators===null&&(e.validators=[]),e.validators.push(lV(n,t))},vV=(t,e,n,i)=>{const r=Object.entries(t),s=r.length;for(let o=0;o<s;o++){const[c,u]=r[o];Xy(u,NC(e,c),n,i)}},NC=(t,e)=>{let n=t;const i=e.split(bh),r=i.length;for(let s=0;s<r;s++){const o=i[s];let c=n.nextPart.get(o);c||(c=LC(),n.nextPart.set(o,c)),n=c}return n},yV=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,_V=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),i=Object.create(null);const r=(s,o)=>{n[s]=o,e++,e>t&&(e=0,i=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=i[s])!==void 0)return r(s,o),o},set(s,o){s in n?n[s]=o:r(s,o)}}},V0="!",m1=":",xV=[],g1=(t,e,n,i,r)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:i,isExternal:r}),bV=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=r=>{const s=[];let o=0,c=0,u=0,d;const h=r.length;for(let w=0;w<h;w++){const y=r[w];if(o===0&&c===0){if(y===m1){s.push(r.slice(u,w)),u=w+1;continue}if(y==="/"){d=w;continue}}y==="["?o++:y==="]"?o--:y==="("?c++:y===")"&&c--}const p=s.length===0?r:r.slice(u);let m=p,v=!1;p.endsWith(V0)?(m=p.slice(0,-1),v=!0):p.startsWith(V0)&&(m=p.slice(1),v=!0);const _=d&&d>u?d-u:void 0;return g1(s,v,m,_)};if(e){const r=e+m1,s=i;i=o=>o.startsWith(r)?s(o.slice(r.length)):g1(xV,!1,o,void 0,!0)}if(n){const r=i;i=s=>n({className:s,parseClassName:r})}return i},SV=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,i)=>{e.set(n,1e6+i)}),n=>{const i=[];let r=[];for(let s=0;s<n.length;s++){const o=n[s],c=o[0]==="[",u=e.has(o);c||u?(r.length>0&&(r.sort(),i.push(...r),r=[]),i.push(o)):r.push(o)}return r.length>0&&(r.sort(),i.push(...r)),i}},wV=t=>({cache:_V(t.cacheSize),parseClassName:bV(t),sortModifiers:SV(t),...uV(t)}),EV=/\s+/,MV=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:s}=e,o=[],c=t.trim().split(EV);let u="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:p,modifiers:m,hasImportantModifier:v,baseClassName:_,maybePostfixModifierPosition:w}=n(h);if(p){u=h+(u.length>0?" "+u:u);continue}let y=!!w,b=i(y?_.substring(0,w):_);if(!b){if(!y){u=h+(u.length>0?" "+u:u);continue}if(b=i(_),!b){u=h+(u.length>0?" "+u:u);continue}y=!1}const T=m.length===0?"":m.length===1?m[0]:s(m).join(":"),A=v?T+V0:T,M=A+b;if(o.indexOf(M)>-1)continue;o.push(M);const I=r(b,y);for(let k=0;k<I.length;++k){const U=I[k];o.push(A+U)}u=h+(u.length>0?" "+u:u)}return u},TV=(...t)=>{let e=0,n,i,r="";for(;e<t.length;)(n=t[e++])&&(i=IC(n))&&(r&&(r+=" "),r+=i);return r},IC=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=IC(t[i]))&&(n&&(n+=" "),n+=e);return n},AV=(t,...e)=>{let n,i,r,s;const o=u=>{const d=e.reduce((h,p)=>p(h),t());return n=wV(d),i=n.cache.get,r=n.cache.set,s=c,c(u)},c=u=>{const d=i(u);if(d)return d;const h=MV(u,n);return r(u,h),h};return s=o,(...u)=>s(TV(...u))},CV=[],ei=t=>{const e=n=>n[t]||CV;return e.isThemeGetter=!0,e},UC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,FC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PV=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,RV=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kV=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,LV=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DV=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NV=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pa=t=>PV.test(t),qt=t=>!!t&&!Number.isNaN(Number(t)),ma=t=>!!t&&Number.isInteger(Number(t)),og=t=>t.endsWith("%")&&qt(t.slice(0,-1)),Ts=t=>RV.test(t),OC=()=>!0,IV=t=>kV.test(t)&&!LV.test(t),qy=()=>!1,UV=t=>DV.test(t),FV=t=>NV.test(t),OV=t=>!dt(t)&&!mt(t),BV=t=>Oa(t,VC,qy),dt=t=>UC.test(t),Qa=t=>Oa(t,HC,IV),v1=t=>Oa(t,XV,qt),zV=t=>Oa(t,jC,OC),VV=t=>Oa(t,GC,qy),y1=t=>Oa(t,BC,qy),HV=t=>Oa(t,zC,FV),Qd=t=>Oa(t,WC,UV),mt=t=>FC.test(t),Vc=t=>Io(t,HC),GV=t=>Io(t,GC),_1=t=>Io(t,BC),jV=t=>Io(t,VC),WV=t=>Io(t,zC),ef=t=>Io(t,WC,!0),$V=t=>Io(t,jC,!0),Oa=(t,e,n)=>{const i=UC.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},Io=(t,e,n=!1)=>{const i=FC.exec(t);return i?i[1]?e(i[1]):n:!1},BC=t=>t==="position"||t==="percentage",zC=t=>t==="image"||t==="url",VC=t=>t==="length"||t==="size"||t==="bg-size",HC=t=>t==="length",XV=t=>t==="number",GC=t=>t==="family-name",jC=t=>t==="number"||t==="weight",WC=t=>t==="shadow",qV=()=>{const t=ei("color"),e=ei("font"),n=ei("text"),i=ei("font-weight"),r=ei("tracking"),s=ei("leading"),o=ei("breakpoint"),c=ei("container"),u=ei("spacing"),d=ei("radius"),h=ei("shadow"),p=ei("inset-shadow"),m=ei("text-shadow"),v=ei("drop-shadow"),_=ei("blur"),w=ei("perspective"),y=ei("aspect"),b=ei("ease"),T=ei("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...M(),mt,dt],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],S=()=>[mt,dt,u],P=()=>[pa,"full","auto",...S()],V=()=>[ma,"none","subgrid",mt,dt],O=()=>["auto",{span:["full",ma,mt,dt]},ma,mt,dt],G=()=>[ma,"auto",mt,dt],J=()=>["auto","min","max","fr",mt,dt],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...S()],Q=()=>[pa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],W=()=>[pa,"screen","full","dvw","lvw","svw","min","max","fit",...S()],q=()=>[pa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],Z=()=>[t,mt,dt],z=()=>[...M(),_1,y1,{position:[mt,dt]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],we=()=>["auto","cover","contain",jV,BV,{size:[mt,dt]}],He=()=>[og,Vc,Qa],Se=()=>["","none","full",d,mt,dt],ne=()=>["",qt,Vc,Qa],ye=()=>["solid","dashed","dotted","double"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ne=()=>[qt,og,_1,y1],et=()=>["","none",_,mt,dt],xt=()=>["none",qt,mt,dt],pn=()=>["none",qt,mt,dt],ht=()=>[qt,mt,dt],Ft=()=>[pa,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ts],breakpoint:[Ts],color:[OC],container:[Ts],"drop-shadow":[Ts],ease:["in","out","in-out"],font:[OV],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ts],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ts],shadow:[Ts],spacing:["px",qt],text:[Ts],"text-shadow":[Ts],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pa,dt,mt,y]}],container:["container"],columns:[{columns:[qt,dt,mt,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[ma,"auto",mt,dt]}],basis:[{basis:[pa,"full","auto",c,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qt,pa,"auto","initial","none",dt]}],grow:[{grow:["",qt,mt,dt]}],shrink:[{shrink:["",qt,mt,dt]}],order:[{order:[ma,"first","last","none",mt,dt]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Vc,Qa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,$V,zV]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",og,dt]}],"font-family":[{font:[GV,VV,e]}],"font-features":[{"font-features":[dt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,mt,dt]}],"line-clamp":[{"line-clamp":[qt,"none",mt,v1]}],leading:[{leading:[s,...S()]}],"list-image":[{"list-image":["none",mt,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",mt,dt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[qt,"from-font","auto",mt,Qa]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[qt,"auto",mt,dt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt,dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mt,dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:we()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ma,mt,dt],radial:["",mt,dt],conic:[ma,mt,dt]},WV,HV]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:He()}],"gradient-via-pos":[{via:He()}],"gradient-to-pos":[{to:He()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:Se()}],"rounded-s":[{"rounded-s":Se()}],"rounded-e":[{"rounded-e":Se()}],"rounded-t":[{"rounded-t":Se()}],"rounded-r":[{"rounded-r":Se()}],"rounded-b":[{"rounded-b":Se()}],"rounded-l":[{"rounded-l":Se()}],"rounded-ss":[{"rounded-ss":Se()}],"rounded-se":[{"rounded-se":Se()}],"rounded-ee":[{"rounded-ee":Se()}],"rounded-es":[{"rounded-es":Se()}],"rounded-tl":[{"rounded-tl":Se()}],"rounded-tr":[{"rounded-tr":Se()}],"rounded-br":[{"rounded-br":Se()}],"rounded-bl":[{"rounded-bl":Se()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ye(),"hidden","none"]}],"divide-style":[{divide:[...ye(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qt,mt,dt]}],"outline-w":[{outline:["",qt,Vc,Qa]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",h,ef,Qd]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",p,ef,Qd]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[qt,Qa]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",m,ef,Qd]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[qt,mt,dt]}],"mix-blend":[{"mix-blend":[...be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ne()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":Ne()}],"mask-image-t-to-pos":[{"mask-t-to":Ne()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":Ne()}],"mask-image-r-to-pos":[{"mask-r-to":Ne()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":Ne()}],"mask-image-b-to-pos":[{"mask-b-to":Ne()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":Ne()}],"mask-image-l-to-pos":[{"mask-l-to":Ne()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":Ne()}],"mask-image-x-to-pos":[{"mask-x-to":Ne()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":Ne()}],"mask-image-y-to-pos":[{"mask-y-to":Ne()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[mt,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ne()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[qt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ne()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:we()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",mt,dt]}],filter:[{filter:["","none",mt,dt]}],blur:[{blur:et()}],brightness:[{brightness:[qt,mt,dt]}],contrast:[{contrast:[qt,mt,dt]}],"drop-shadow":[{"drop-shadow":["","none",v,ef,Qd]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",qt,mt,dt]}],"hue-rotate":[{"hue-rotate":[qt,mt,dt]}],invert:[{invert:["",qt,mt,dt]}],saturate:[{saturate:[qt,mt,dt]}],sepia:[{sepia:["",qt,mt,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",mt,dt]}],"backdrop-blur":[{"backdrop-blur":et()}],"backdrop-brightness":[{"backdrop-brightness":[qt,mt,dt]}],"backdrop-contrast":[{"backdrop-contrast":[qt,mt,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qt,mt,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qt,mt,dt]}],"backdrop-invert":[{"backdrop-invert":["",qt,mt,dt]}],"backdrop-opacity":[{"backdrop-opacity":[qt,mt,dt]}],"backdrop-saturate":[{"backdrop-saturate":[qt,mt,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",qt,mt,dt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",mt,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qt,"initial",mt,dt]}],ease:[{ease:["linear","initial",b,mt,dt]}],delay:[{delay:[qt,mt,dt]}],animate:[{animate:["none",T,mt,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,mt,dt]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:xt()}],"rotate-x":[{"rotate-x":xt()}],"rotate-y":[{"rotate-y":xt()}],"rotate-z":[{"rotate-z":xt()}],scale:[{scale:pn()}],"scale-x":[{"scale-x":pn()}],"scale-y":[{"scale-y":pn()}],"scale-z":[{"scale-z":pn()}],"scale-3d":["scale-3d"],skew:[{skew:ht()}],"skew-x":[{"skew-x":ht()}],"skew-y":[{"skew-y":ht()}],transform:[{transform:[mt,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ft()}],"translate-x":[{"translate-x":Ft()}],"translate-y":[{"translate-y":Ft()}],"translate-z":[{"translate-z":Ft()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",mt,dt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",mt,dt]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[qt,Vc,Qa,v1]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},YV=AV(qV);function Mn(...t){return YV(aV(t))}const KV=F.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[F.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),F.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),F.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),F.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),ZV=F.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:F.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),JV={google:KV,github:ZV},QV={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function eH(t){return QV[t]||String(t||"").replace(/-/g," ")}function tH(){const{isOpen:t,closeLoginModal:e}=zT(),{enabled:n,signedIn:i,refreshUser:r,signInWithPassword:s,signUp:o,signInWithOAuth:c,getPublicAuthConfig:u}=Do(),[d,h]=L.useState("signin"),[p,m]=L.useState(""),[v,_]=L.useState(""),[w,y]=L.useState(""),[b,T]=L.useState(!1),[A,M]=L.useState(null),[I,k]=L.useState(null),[U,S]=L.useState(!1),[P,V]=L.useState(!0),[O,G]=L.useState([]),[J,H]=L.useState(8);L.useEffect(()=>{t&&(M(null),k(null),h("signin"),m(""),_(""),y(""),S(!1))},[t]),L.useEffect(()=>{if(!t||!n){V(!1);return}let W=!0;return(async()=>{const{data:q,error:Z}=await u();if(W){if(Z||!q)G(["google","github"]);else{const z=Array.isArray(q.oAuthProviders)?q.oAuthProviders:[],ie=Array.isArray(q.customOAuthProviders)?q.customOAuthProviders:[];G([...z,...ie]),typeof q.passwordMinLength=="number"&&q.passwordMinLength>0&&H(q.passwordMinLength)}V(!1)}})(),()=>{W=!1}},[t,n,u]),L.useEffect(()=>{t&&i&&e()},[t,i,e]);const X=L.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),K=L.useCallback(async W=>{M(null),T(!0);try{const{error:q}=await c(W,X);q&&M(q.message||String(q))}finally{T(!1)}},[c,X]),Q=L.useCallback(async W=>{W.preventDefault(),M(null),T(!0);try{if(d==="signup"){const{data:Z,error:z}=await o({email:p.trim(),password:v,name:w.trim()||void 0});if(z){M(z.message||String(z));return}if(Z?.requireEmailVerification){k("Check your email for a verification link."),h("signin");return}await r();return}const{error:q}=await s({email:p.trim(),password:v});if(q){M(q.message||String(q));return}await r()}finally{T(!1)}},[d,p,v,w,o,s,r]);return L.useEffect(()=>{if(!t)return;const W=q=>{q.key==="Escape"&&e()};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[t,e]),n?F.jsx(E5,{children:t&&F.jsxs(Il.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[F.jsx(Il.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60 ",onClick:e,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),F.jsxs(Il.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 p-6 shadow-2xl",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:W=>W.stopPropagation(),children:[F.jsx("button",{type:"button",onClick:e,className:"absolute right-4 top-4 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:F.jsx(RC,{className:"h-5 w-5"})}),F.jsxs("div",{className:"text-center mb-6",children:[F.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[F.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),F.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white",children:"Token Tracker"})]}),F.jsx("p",{className:"text-sm text-oai-gray-500",children:"Sign in to join the leaderboard"})]}),I&&F.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:I}),A&&F.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",role:"alert",children:A}),F.jsx("div",{className:"space-y-2.5 mb-5",children:P?F.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900 animate-pulse"}):O.map(W=>F.jsxs("button",{type:"button",disabled:b,onClick:()=>K(W),className:Mn("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[JV[W]||null,"Continue with ",eH(W)]},W))}),U?F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"relative mb-5",children:[F.jsx("div",{className:"absolute inset-0 flex items-center",children:F.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),F.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:F.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:"email"})})]}),F.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[F.jsx("button",{type:"button",className:Mn("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",d==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{h("signin"),M(null)},children:"Sign In"}),F.jsx("button",{type:"button",className:Mn("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",d==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{h("signup"),M(null)},children:"Sign Up"})]}),F.jsxs("form",{onSubmit:Q,className:"space-y-3",children:[d==="signup"&&F.jsxs("div",{children:[F.jsx("label",{htmlFor:"modal-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:"Name"}),F.jsx("input",{id:"modal-name",type:"text",autoComplete:"name",value:w,onChange:W=>y(W.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:"Optional"})]}),F.jsxs("div",{children:[F.jsx("label",{htmlFor:"modal-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:"Email"}),F.jsx("input",{id:"modal-email",type:"email",autoComplete:"email",required:!0,value:p,onChange:W=>m(W.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),F.jsxs("div",{children:[F.jsx("label",{htmlFor:"modal-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:"Password"}),F.jsx("input",{id:"modal-password",type:"password",autoComplete:d==="signup"?"new-password":"current-password",required:!0,minLength:d==="signup"?J:void 0,value:v,onChange:W=>_(W.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),d==="signup"&&F.jsxs("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:["At least ",J," characters"]})]}),F.jsx("button",{type:"submit",disabled:b,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:d==="signup"?"Create Account":"Sign In"})]})]}):F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"relative mb-5",children:[F.jsx("div",{className:"absolute inset-0 flex items-center",children:F.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),F.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:F.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:"or"})})]}),F.jsxs("button",{type:"button",onClick:()=>S(!0),className:Mn("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[F.jsx(qz,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),"Continue with Email"]})]})]})]})}):null}const nH={VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function iH(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return"";const e=typeof import.meta<"u"?nH:void 0;return(e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||e?.VITE_INSFORGE_BASE_URL||"").trim()}function kX(){return Ro()}function $C(t=""){if(typeof t!="string"||t.length===0)return!1;const e=new URLSearchParams(t),n=String(e.get("screenshot")||"").toLowerCase();return n==="1"||n==="true"}const rH=300*1e3;function Yy(t){return typeof t=="string"&&/^https?:\/\//i.test(t.trim())}async function XC(t){const e=Ro();if(!Yy(e)||!t)return;const n=e.replace(/\/$/,""),i=Nh(),r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};i&&(r.apikey=i);try{await fetch(`${n}/functions/tokentracker-leaderboard-refresh`,{method:"POST",headers:r,body:JSON.stringify({period:"week"})})}catch{}}async function qC(t){const e=Ro();if(!Yy(e)||!t)return null;const n=e.replace(/\/$/,""),i=Nh(),r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};i&&(r.apikey=i);const s=typeof navigator<"u"&&typeof navigator.platform=="string"?navigator.platform:"web",o=await fetch(`${n}/functions/tokentracker-device-token-issue`,{method:"POST",headers:r,body:JSON.stringify({device_name:"Token Tracker (dashboard)",platform:s})});if(!o.ok)return null;const c=await o.json().catch(()=>null),u=typeof c?.token=="string"?c.token:null,d=typeof c?.device_id=="string"?c.device_id:null;return!u||!d?null:{token:u,deviceId:d,issuedAt:typeof c?.created_at=="string"?c.created_at:new Date().toISOString()}}async function YC(t){const{deviceToken:e,insforgeBaseUrl:n}=t,i={deviceToken:e},r=n||Ro();Yy(r)&&(i.insforgeBaseUrl=r.trim());const s=await fetch("/functions/tokentracker-local-sync",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(i)}),o=await s.json().catch(()=>({}));if(!s.ok){const c=typeof o.error=="string"?o.error:`HTTP ${s.status}`;throw new Error(c)}return o}async function sH(t){const e=LI();if(Date.now()-e<rH)return;const n=await t();if(!n)return;let i=uT();if(!i){const r=await qC(n);if(!r)return;dT(r),i=r}await YC({deviceToken:i.token,insforgeBaseUrl:Ro()}),fT(Date.now()),await XC(n)}async function LX(t){const e=await t();if(!e)return;let n=uT();if(!n){const i=await qC(e);if(!i)return;dT(i),n=i}await YC({deviceToken:n.token,insforgeBaseUrl:Ro()}),fT(Date.now()),await XC(e)}function aH(t){const e=t.replace(/\/+$/,"")||"/";return e==="/share"||e==="/share.html"||e.startsWith("/share/")}function oH(t){const e=t.replace(/\/+$/,"")||"/";return e==="/login"||e==="/landing"||aH(e)?!1:e==="/"||e==="/dashboard"||e.startsWith("/leaderboard")}function lH(){const t=vr(),e=Do(),n=L.useRef(!1);L.useEffect(()=>{if(!PI()||!oH(t.pathname||"/")||!e.enabled||!e.signedIn||e.loading||!RI())return;let i=!1;const r=window.setTimeout(()=>{(async()=>{if(!(i||n.current)){n.current=!0;try{await sH(()=>e.getAccessToken())}catch(s){console.warn("[tokentracker] cloud usage sync:",s)}finally{n.current=!1}}})()},2500);return()=>{i=!0,window.clearTimeout(r)}},[t.pathname,e.enabled,e.signedIn,e.loading,e.getAccessToken])}function KC(){return typeof navigator>"u"?null:navigator.clipboard||null}function cH(){return typeof window>"u"?null:window.ClipboardItem||null}async function uH(t,{clipboard:e}={}){const n=e??KC();if(!n||typeof n.writeText!="function")return!1;try{return await n.writeText(t),!0}catch{return!1}}async function DX(t,{clipboard:e}={}){const n=e??KC(),i=cH();if(!t||!n||typeof n.write!="function"||!i)return!1;try{const r=t.type||"image/png",s=t.type&&t.type!==r?t.slice(0,t.size,r):t.type?t:t.slice(0,t.size,r),o=new i({[r]:s});return await n.write([o]),!0}catch{return!1}}function dH(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"}function fH(){return dH()?"/":"/dashboard"}function ZC({prefersReducedMotion:t,screenshotCapture:e}){return!(e||t)}function hH({repo:t="mm7894215/TokenTracker"}){const[e,n]=L.useState(null);return L.useEffect(()=>{if(typeof window>"u")return;const i=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,r=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));ZC({prefersReducedMotion:i,screenshotCapture:r})&&fetch(`https://api.github.com/repos/${t}`).then(s=>s.json()).then(s=>{s&&typeof s.stargazers_count=="number"&&n(s.stargazers_count)}).catch(()=>{})},[t]),F.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[F.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:F.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),F.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:"Star"}),e!==null&&F.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:e})]})}function pH(t){if(!t||typeof t!="object")return null;const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=e.avatar_url||e.picture||n.avatar_url||t.avatar_url;return typeof i=="string"&&i.trim()?i.trim():null}function x1(t){const e=String(t||"").trim();if(!e)return"?";const n=e.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function H0({className:t,variant:e="header",collapsed:n=!1,onAfterAction:i}){const r=e==="sidebar",{enabled:s,loading:o,signedIn:c,user:u,displayName:d}=Do(),{openLoginModal:h}=zT(),p=Au(),m=L.useMemo(()=>pH(u),[u]);if(!s)return null;if(o)return F.jsx("div",{className:Mn("h-9 w-9 shrink-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 animate-pulse",t),"aria-hidden":!0});if(!c)return r?F.jsxs("button",{type:"button",onClick:()=>{h(),i?.()},className:Mn("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 min-w-0",n?"h-8 w-8 justify-center px-0":"w-full",t),"aria-label":Ct("header.auth.sign_in_aria"),title:n?"Sign In":void 0,children:[F.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:F.jsx("img",{src:"/app-icon.png",alt:"",width:18,height:18,className:"h-[18px] w-[18px] rounded"})}),!n&&F.jsx("span",{className:"truncate flex-1 text-left",children:"Sign in"})]}):F.jsx("button",{type:"button",onClick:h,className:Mn("shrink-0 inline-flex h-9 items-center justify-center gap-1.5 rounded-full px-5 text-sm font-medium transition-colors duration-200 ease-out shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",t),"aria-label":Ct("header.auth.sign_in_aria"),children:"Sign In"});const v=()=>{p("/settings"),i?.()};return F.jsx("div",{className:Mn(r?"relative flex w-full shrink-0 items-center":"relative flex shrink-0 items-center",t),children:F.jsxs("button",{type:"button",onClick:v,className:Mn(r?Mn("flex w-full items-center gap-2 rounded-md px-2 py-1.5 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 transition-colors min-w-0",n&&"justify-center px-0 py-0 h-9 w-9"):"flex items-center gap-2 rounded-full pl-1 pr-2 py-1 border border-transparent hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900/80 hover:border-oai-gray-200 dark:hover:border-oai-gray-800 transition-colors"),"aria-label":Ct("header.auth.open_settings"),title:r&&n?d:void 0,children:[r?F.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:m?F.jsx("img",{src:m,alt:"",width:20,height:20,className:"h-5 w-5 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700",referrerPolicy:"no-referrer"}):F.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600 text-[9px] font-semibold text-white ring-1 ring-oai-brand-500/50",children:x1(d)})}):m?F.jsx("img",{src:m,alt:"",width:32,height:32,className:"h-8 w-8 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700 shrink-0",referrerPolicy:"no-referrer"}):F.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600 text-xs font-semibold text-white ring-1 ring-oai-brand-500/50",children:x1(d)}),r?!n&&F.jsx("span",{className:"truncate text-[13px] font-medium text-oai-gray-900 dark:text-oai-gray-200 flex-1 text-left min-w-0",children:d}):F.jsx("span",{className:"hidden sm:inline truncate text-sm font-medium text-oai-gray-900 dark:text-oai-gray-200 max-w-[120px]",children:d})]})})}const Ky="183",mH=0,b1=1,gH=2,jf=1,vH=2,tu=3,Ua=0,Gi=1,Ns=2,Os=0,_o=1,S1=2,w1=3,E1=4,yH=5,lo=100,_H=101,xH=102,bH=103,SH=104,wH=200,EH=201,MH=202,TH=203,G0=204,j0=205,AH=206,CH=207,PH=208,RH=209,kH=210,LH=211,DH=212,NH=213,IH=214,W0=0,$0=1,X0=2,jl=3,q0=4,Y0=5,K0=6,Z0=7,JC=0,UH=1,FH=2,is=0,QC=1,eP=2,tP=3,nP=4,iP=5,rP=6,sP=7,aP=300,To=301,Wl=302,lg=303,cg=304,Hh=306,J0=1e3,Is=1001,Q0=1002,mi=1003,OH=1004,tf=1005,wi=1006,ug=1007,mo=1008,fr=1009,oP=1010,lP=1011,xu=1012,Zy=1013,us=1014,Qr=1015,Hs=1016,Jy=1017,Qy=1018,bu=1020,cP=35902,uP=35899,dP=1021,fP=1022,Fr=1023,Gs=1026,go=1027,hP=1028,e_=1029,$l=1030,t_=1031,n_=1033,Wf=33776,$f=33777,Xf=33778,qf=33779,ev=35840,tv=35841,nv=35842,iv=35843,rv=36196,sv=37492,av=37496,ov=37488,lv=37489,cv=37490,uv=37491,dv=37808,fv=37809,hv=37810,pv=37811,mv=37812,gv=37813,vv=37814,yv=37815,_v=37816,xv=37817,bv=37818,Sv=37819,wv=37820,Ev=37821,Mv=36492,Tv=36494,Av=36495,Cv=36283,Pv=36284,Rv=36285,kv=36286,BH=3200,zH=0,VH=1,Ca="",ur="srgb",Ao="srgb-linear",Sh="linear",wn="srgb",cl=7680,M1=519,HH=512,GH=513,jH=514,i_=515,WH=516,$H=517,r_=518,XH=519,T1=35044,A1="300 es",es=2e3,wh=2001;function qH(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Eh(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function YH(){const t=Eh("canvas");return t.style.display="block",t}const C1={};function P1(...t){const e="THREE."+t.shift();console.log(e,...t)}function pP(t){const e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=t[1];n&&n.isStackTrace?t[0]+=" "+n.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function Gt(...t){t=pP(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function _n(...t){t=pP(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function Mh(...t){const e=t.join(" ");e in C1||(C1[e]=!0,Gt(...t))}function KH(t,e,n){return new Promise(function(i,r){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}const ZH={[W0]:$0,[X0]:K0,[q0]:Z0,[jl]:Y0,[$0]:W0,[K0]:X0,[Z0]:q0,[Y0]:jl};class ec{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const xi=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],dg=Math.PI/180,Lv=180/Math.PI;function Fu(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(xi[t&255]+xi[t>>8&255]+xi[t>>16&255]+xi[t>>24&255]+"-"+xi[e&255]+xi[e>>8&255]+"-"+xi[e>>16&15|64]+xi[e>>24&255]+"-"+xi[n&63|128]+xi[n>>8&255]+"-"+xi[n>>16&255]+xi[n>>24&255]+xi[i&255]+xi[i>>8&255]+xi[i>>16&255]+xi[i>>24&255]).toLowerCase()}function ln(t,e,n){return Math.max(e,Math.min(n,t))}function JH(t,e){return(t%e+e)%e}function fg(t,e,n){return(1-n)*t+n*e}function Hc(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Hi(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}class bn{constructor(e=0,n=0){bn.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+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,n){return this.x=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(i,e,n))}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 n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ln(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),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 tc{constructor(e=0,n=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}static slerpFlat(e,n,i,r,s,o,c){let u=i[r+0],d=i[r+1],h=i[r+2],p=i[r+3],m=s[o+0],v=s[o+1],_=s[o+2],w=s[o+3];if(p!==w||u!==m||d!==v||h!==_){let y=u*m+d*v+h*_+p*w;y<0&&(m=-m,v=-v,_=-_,w=-w,y=-y);let b=1-c;if(y<.9995){const T=Math.acos(y),A=Math.sin(T);b=Math.sin(b*T)/A,c=Math.sin(c*T)/A,u=u*b+m*c,d=d*b+v*c,h=h*b+_*c,p=p*b+w*c}else{u=u*b+m*c,d=d*b+v*c,h=h*b+_*c,p=p*b+w*c;const T=1/Math.sqrt(u*u+d*d+h*h+p*p);u*=T,d*=T,h*=T,p*=T}}e[n]=u,e[n+1]=d,e[n+2]=h,e[n+3]=p}static multiplyQuaternionsFlat(e,n,i,r,s,o){const c=i[r],u=i[r+1],d=i[r+2],h=i[r+3],p=s[o],m=s[o+1],v=s[o+2],_=s[o+3];return e[n]=c*_+h*p+u*v-d*m,e[n+1]=u*_+h*m+d*p-c*v,e[n+2]=d*_+h*v+c*m-u*p,e[n+3]=h*_-c*p-u*m-d*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,r){return this._x=e,this._y=n,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,n=!0){const i=e._x,r=e._y,s=e._z,o=e._order,c=Math.cos,u=Math.sin,d=c(i/2),h=c(r/2),p=c(s/2),m=u(i/2),v=u(r/2),_=u(s/2);switch(o){case"XYZ":this._x=m*h*p+d*v*_,this._y=d*v*p-m*h*_,this._z=d*h*_+m*v*p,this._w=d*h*p-m*v*_;break;case"YXZ":this._x=m*h*p+d*v*_,this._y=d*v*p-m*h*_,this._z=d*h*_-m*v*p,this._w=d*h*p+m*v*_;break;case"ZXY":this._x=m*h*p-d*v*_,this._y=d*v*p+m*h*_,this._z=d*h*_+m*v*p,this._w=d*h*p-m*v*_;break;case"ZYX":this._x=m*h*p-d*v*_,this._y=d*v*p+m*h*_,this._z=d*h*_-m*v*p,this._w=d*h*p+m*v*_;break;case"YZX":this._x=m*h*p+d*v*_,this._y=d*v*p+m*h*_,this._z=d*h*_-m*v*p,this._w=d*h*p-m*v*_;break;case"XZY":this._x=m*h*p-d*v*_,this._y=d*v*p-m*h*_,this._z=d*h*_+m*v*p,this._w=d*h*p+m*v*_;break;default:Gt("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/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 n=e.elements,i=n[0],r=n[4],s=n[8],o=n[1],c=n[5],u=n[9],d=n[2],h=n[6],p=n[10],m=i+c+p;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(h-u)*v,this._y=(s-d)*v,this._z=(o-r)*v}else if(i>c&&i>p){const v=2*Math.sqrt(1+i-c-p);this._w=(h-u)/v,this._x=.25*v,this._y=(r+o)/v,this._z=(s+d)/v}else if(c>p){const v=2*Math.sqrt(1+c-i-p);this._w=(s-d)/v,this._x=(r+o)/v,this._y=.25*v,this._z=(u+h)/v}else{const v=2*Math.sqrt(1+p-i-c);this._w=(o-r)/v,this._x=(s+d)/v,this._y=(u+h)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ln(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/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,n){const i=e._x,r=e._y,s=e._z,o=e._w,c=n._x,u=n._y,d=n._z,h=n._w;return this._x=i*h+o*c+r*d-s*u,this._y=r*h+o*u+s*c-i*d,this._z=s*h+o*d+i*u-r*c,this._w=o*h-i*c-r*u-s*d,this._onChangeCallback(),this}slerp(e,n){let i=e._x,r=e._y,s=e._z,o=e._w,c=this.dot(e);c<0&&(i=-i,r=-r,s=-s,o=-o,c=-c);let u=1-n;if(c<.9995){const d=Math.acos(c),h=Math.sin(d);u=Math.sin(u*d)/h,n=Math.sin(n*d)/h,this._x=this._x*u+i*n,this._y=this._y*u+r*n,this._z=this._z*u+s*n,this._w=this._w*u+o*n,this._onChangeCallback()}else this._x=this._x*u+i*n,this._y=this._y*u+r*n,this._z=this._z*u+s*n,this._w=this._w*u+o*n,this.normalize();return this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class me{constructor(e=0,n=0,i=0){me.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(R1.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(R1.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6]*r,this.y=s[1]*n+s[4]*i+s[7]*r,this.z=s[2]*n+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*n+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*n+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*n+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*n+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,s=e.x,o=e.y,c=e.z,u=e.w,d=2*(o*r-c*i),h=2*(c*n-s*r),p=2*(s*i-o*n);return this.x=n+u*d+o*p-c*h,this.y=i+u*h+c*d-s*p,this.z=r+u*p+s*h-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r,this.y=s[1]*n+s[5]*i+s[9]*r,this.z=s[2]*n+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,n){return this.x=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this.z=ln(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this.z=ln(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(i,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,s=e.z,o=n.x,c=n.y,u=n.z;return this.x=r*u-s*c,this.y=s*o-i*u,this.z=i*c-r*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return hg.copy(this).projectOnVector(e),this.sub(hg)}reflect(e){return this.sub(hg.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ln(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+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,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const hg=new me,R1=new tc;class Wt{constructor(e,n,i,r,s,o,c,u,d){Wt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,o,c,u,d)}set(e,n,i,r,s,o,c,u,d){const h=this.elements;return h[0]=e,h[1]=r,h[2]=c,h[3]=n,h[4]=s,h[5]=u,h[6]=i,h[7]=o,h[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],c=i[3],u=i[6],d=i[1],h=i[4],p=i[7],m=i[2],v=i[5],_=i[8],w=r[0],y=r[3],b=r[6],T=r[1],A=r[4],M=r[7],I=r[2],k=r[5],U=r[8];return s[0]=o*w+c*T+u*I,s[3]=o*y+c*A+u*k,s[6]=o*b+c*M+u*U,s[1]=d*w+h*T+p*I,s[4]=d*y+h*A+p*k,s[7]=d*b+h*M+p*U,s[2]=m*w+v*T+_*I,s[5]=m*y+v*A+_*k,s[8]=m*b+v*M+_*U,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],c=e[5],u=e[6],d=e[7],h=e[8];return n*o*h-n*c*d-i*s*h+i*c*u+r*s*d-r*o*u}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],c=e[5],u=e[6],d=e[7],h=e[8],p=h*o-c*d,m=c*u-h*s,v=d*s-o*u,_=n*p+i*m+r*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/_;return e[0]=p*w,e[1]=(r*d-h*i)*w,e[2]=(c*i-r*o)*w,e[3]=m*w,e[4]=(h*n-r*u)*w,e[5]=(r*s-c*n)*w,e[6]=v*w,e[7]=(i*u-d*n)*w,e[8]=(o*n-i*s)*w,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,s,o,c){const u=Math.cos(s),d=Math.sin(s);return this.set(i*u,i*d,-i*(u*o+d*c)+o+e,-r*d,r*u,-r*(-d*o+u*c)+c+n,0,0,1),this}scale(e,n){return this.premultiply(pg.makeScale(e,n)),this}rotate(e){return this.premultiply(pg.makeRotation(-e)),this}translate(e,n){return this.premultiply(pg.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const pg=new Wt,k1=new Wt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),L1=new Wt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function QH(){const t={enabled:!0,workingColorSpace:Ao,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===wn&&(r.r=Bs(r.r),r.g=Bs(r.g),r.b=Bs(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===wn&&(r.r=Ul(r.r),r.g=Ul(r.g),r.b=Ul(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Ca?Sh:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Mh("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Mh("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ao]:{primaries:e,whitePoint:i,transfer:Sh,toXYZ:k1,fromXYZ:L1,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:ur},outputColorSpaceConfig:{drawingBufferColorSpace:ur}},[ur]:{primaries:e,whitePoint:i,transfer:wn,toXYZ:k1,fromXYZ:L1,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:ur}}}),t}const fn=QH();function Bs(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Ul(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let ul;class e6{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{ul===void 0&&(ul=Eh("canvas")),ul.width=e.width,ul.height=e.height;const r=ul.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=ul}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Eh("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Bs(s[o]/255)*255;return i.putImageData(r,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(Bs(n[i]/255)*255):n[i]=Bs(n[i]);return{data:n,width:e.width,height:e.height}}else return Gt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let t6=0;class s_{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:t6++}),this.uuid=Fu(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?e.set(n.displayHeight,n.displayWidth,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,c=r.length;o<c;o++)r[o].isDataTexture?s.push(mg(r[o].image)):s.push(mg(r[o]))}else s=mg(r);i.url=s}return n||(e.images[this.uuid]=i),i}}function mg(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?e6.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Gt("Texture: Unable to serialize Texture."),{})}let n6=0;const gg=new me;class Li extends ec{constructor(e=Li.DEFAULT_IMAGE,n=Li.DEFAULT_MAPPING,i=Is,r=Is,s=wi,o=mo,c=Fr,u=fr,d=Li.DEFAULT_ANISOTROPY,h=Ca){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:n6++}),this.uuid=Fu(),this.name="",this.source=new s_(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=d,this.format=c,this.internalFormat=null,this.type=u,this.offset=new bn(0,0),this.repeat=new bn(1,1),this.center=new bn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Wt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(gg).x}get height(){return this.source.getSize(gg).y}get depth(){return this.source.getSize(gg).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const i=e[n];if(i===void 0){Gt(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Gt(`Texture.setValues(): property '${n}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==aP)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case J0:e.x=e.x-Math.floor(e.x);break;case Is:e.x=e.x<0?0:1;break;case Q0: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 J0:e.y=e.y-Math.floor(e.y);break;case Is:e.y=e.y<0?0:1;break;case Q0:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Li.DEFAULT_IMAGE=null;Li.DEFAULT_MAPPING=aP;Li.DEFAULT_ANISOTROPY=1;class Vn{constructor(e=0,n=0,i=0,r=1){Vn.prototype.isVector4=!0,this.x=e,this.y=n,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,n,i,r){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*n+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*n+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*n+o[7]*i+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,s;const u=e.elements,d=u[0],h=u[4],p=u[8],m=u[1],v=u[5],_=u[9],w=u[2],y=u[6],b=u[10];if(Math.abs(h-m)<.01&&Math.abs(p-w)<.01&&Math.abs(_-y)<.01){if(Math.abs(h+m)<.1&&Math.abs(p+w)<.1&&Math.abs(_+y)<.1&&Math.abs(d+v+b-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const A=(d+1)/2,M=(v+1)/2,I=(b+1)/2,k=(h+m)/4,U=(p+w)/4,S=(_+y)/4;return A>M&&A>I?A<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(A),r=k/i,s=U/i):M>I?M<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),i=k/r,s=S/r):I<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(I),i=U/s,r=S/s),this.set(i,r,s,n),this}let T=Math.sqrt((y-_)*(y-_)+(p-w)*(p-w)+(m-h)*(m-h));return Math.abs(T)<.001&&(T=1),this.x=(y-_)/T,this.y=(p-w)/T,this.z=(m-h)/T,this.w=Math.acos((d+v+b-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this.z=ln(this.z,e.z,n.z),this.w=ln(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this.z=ln(this.z,e,n),this.w=ln(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(i,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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 i6 extends ec{constructor(e=1,n=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:wi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth,this.scissor=new Vn(0,0,e,n),this.scissorTest=!1,this.viewport=new Vn(0,0,e,n),this.textures=[];const r={width:e,height:n,depth:i.depth},s=new Li(r),o=i.count;for(let c=0;c<o;c++)this.textures[c]=s.clone(),this.textures[c].isRenderTargetTexture=!0,this.textures[c].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const n={minFilter:wi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=n,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const r=Object.assign({},e.textures[n].image);this.textures[n].source=new s_(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class rs extends i6{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class mP extends Li{constructor(e=null,n=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=mi,this.minFilter=mi,this.wrapR=Is,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class r6 extends Li{constructor(e=null,n=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=mi,this.minFilter=mi,this.wrapR=Is,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Kn{constructor(e,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y){Kn.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,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y)}set(e,n,i,r,s,o,c,u,d,h,p,m,v,_,w,y){const b=this.elements;return b[0]=e,b[4]=n,b[8]=i,b[12]=r,b[1]=s,b[5]=o,b[9]=c,b[13]=u,b[2]=d,b[6]=h,b[10]=p,b[14]=m,b[3]=v,b[7]=_,b[11]=w,b[15]=y,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 Kn().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return this.determinant()===0?(e.set(1,0,0),n.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const n=this.elements,i=e.elements,r=1/dl.setFromMatrixColumn(e,0).length(),s=1/dl.setFromMatrixColumn(e,1).length(),o=1/dl.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*s,n[5]=i[5]*s,n[6]=i[6]*s,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),c=Math.sin(i),u=Math.cos(r),d=Math.sin(r),h=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const m=o*h,v=o*p,_=c*h,w=c*p;n[0]=u*h,n[4]=-u*p,n[8]=d,n[1]=v+_*d,n[5]=m-w*d,n[9]=-c*u,n[2]=w-m*d,n[6]=_+v*d,n[10]=o*u}else if(e.order==="YXZ"){const m=u*h,v=u*p,_=d*h,w=d*p;n[0]=m+w*c,n[4]=_*c-v,n[8]=o*d,n[1]=o*p,n[5]=o*h,n[9]=-c,n[2]=v*c-_,n[6]=w+m*c,n[10]=o*u}else if(e.order==="ZXY"){const m=u*h,v=u*p,_=d*h,w=d*p;n[0]=m-w*c,n[4]=-o*p,n[8]=_+v*c,n[1]=v+_*c,n[5]=o*h,n[9]=w-m*c,n[2]=-o*d,n[6]=c,n[10]=o*u}else if(e.order==="ZYX"){const m=o*h,v=o*p,_=c*h,w=c*p;n[0]=u*h,n[4]=_*d-v,n[8]=m*d+w,n[1]=u*p,n[5]=w*d+m,n[9]=v*d-_,n[2]=-d,n[6]=c*u,n[10]=o*u}else if(e.order==="YZX"){const m=o*u,v=o*d,_=c*u,w=c*d;n[0]=u*h,n[4]=w-m*p,n[8]=_*p+v,n[1]=p,n[5]=o*h,n[9]=-c*h,n[2]=-d*h,n[6]=v*p+_,n[10]=m-w*p}else if(e.order==="XZY"){const m=o*u,v=o*d,_=c*u,w=c*d;n[0]=u*h,n[4]=-p,n[8]=d*h,n[1]=m*p+w,n[5]=o*h,n[9]=v*p-_,n[2]=_*p-v,n[6]=c*h,n[10]=w*p+m}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(s6,e,a6)}lookAt(e,n,i){const r=this.elements;return Ki.subVectors(e,n),Ki.lengthSq()===0&&(Ki.z=1),Ki.normalize(),ga.crossVectors(i,Ki),ga.lengthSq()===0&&(Math.abs(i.z)===1?Ki.x+=1e-4:Ki.z+=1e-4,Ki.normalize(),ga.crossVectors(i,Ki)),ga.normalize(),nf.crossVectors(Ki,ga),r[0]=ga.x,r[4]=nf.x,r[8]=Ki.x,r[1]=ga.y,r[5]=nf.y,r[9]=Ki.y,r[2]=ga.z,r[6]=nf.z,r[10]=Ki.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],c=i[4],u=i[8],d=i[12],h=i[1],p=i[5],m=i[9],v=i[13],_=i[2],w=i[6],y=i[10],b=i[14],T=i[3],A=i[7],M=i[11],I=i[15],k=r[0],U=r[4],S=r[8],P=r[12],V=r[1],O=r[5],G=r[9],J=r[13],H=r[2],X=r[6],K=r[10],Q=r[14],W=r[3],q=r[7],Z=r[11],z=r[15];return s[0]=o*k+c*V+u*H+d*W,s[4]=o*U+c*O+u*X+d*q,s[8]=o*S+c*G+u*K+d*Z,s[12]=o*P+c*J+u*Q+d*z,s[1]=h*k+p*V+m*H+v*W,s[5]=h*U+p*O+m*X+v*q,s[9]=h*S+p*G+m*K+v*Z,s[13]=h*P+p*J+m*Q+v*z,s[2]=_*k+w*V+y*H+b*W,s[6]=_*U+w*O+y*X+b*q,s[10]=_*S+w*G+y*K+b*Z,s[14]=_*P+w*J+y*Q+b*z,s[3]=T*k+A*V+M*H+I*W,s[7]=T*U+A*O+M*X+I*q,s[11]=T*S+A*G+M*K+I*Z,s[15]=T*P+A*J+M*Q+I*z,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],s=e[12],o=e[1],c=e[5],u=e[9],d=e[13],h=e[2],p=e[6],m=e[10],v=e[14],_=e[3],w=e[7],y=e[11],b=e[15],T=u*v-d*m,A=c*v-d*p,M=c*m-u*p,I=o*v-d*h,k=o*m-u*h,U=o*p-c*h;return n*(w*T-y*A+b*M)-i*(_*T-y*I+b*k)+r*(_*A-w*I+b*U)-s*(_*M-w*k+y*U)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,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]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],c=e[5],u=e[6],d=e[7],h=e[8],p=e[9],m=e[10],v=e[11],_=e[12],w=e[13],y=e[14],b=e[15],T=n*c-i*o,A=n*u-r*o,M=n*d-s*o,I=i*u-r*c,k=i*d-s*c,U=r*d-s*u,S=h*w-p*_,P=h*y-m*_,V=h*b-v*_,O=p*y-m*w,G=p*b-v*w,J=m*b-v*y,H=T*J-A*G+M*O+I*V-k*P+U*S;if(H===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const X=1/H;return e[0]=(c*J-u*G+d*O)*X,e[1]=(r*G-i*J-s*O)*X,e[2]=(w*U-y*k+b*I)*X,e[3]=(m*k-p*U-v*I)*X,e[4]=(u*V-o*J-d*P)*X,e[5]=(n*J-r*V+s*P)*X,e[6]=(y*M-_*U-b*A)*X,e[7]=(h*U-m*M+v*A)*X,e[8]=(o*G-c*V+d*S)*X,e[9]=(i*V-n*G-s*S)*X,e[10]=(_*k-w*M+b*T)*X,e[11]=(p*M-h*k-v*T)*X,e[12]=(c*P-o*O-u*S)*X,e[13]=(n*O-i*P+r*S)*X,e[14]=(w*A-_*I-y*T)*X,e[15]=(h*I-p*A+m*T)*X,this}scale(e){const n=this.elements,i=e.x,r=e.y,s=e.z;return n[0]*=i,n[4]*=r,n[8]*=s,n[1]*=i,n[5]*=r,n[9]*=s,n[2]*=i,n[6]*=r,n[10]*=s,n[3]*=i,n[7]*=r,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=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(n,i,r))}makeTranslation(e,n,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,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),s=1-i,o=e.x,c=e.y,u=e.z,d=s*o,h=s*c;return this.set(d*o+i,d*c-r*u,d*u+r*c,0,d*c+r*u,h*c+i,h*u-r*o,0,d*u-r*c,h*u+r*o,s*u*u+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,n,r,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,s=n._x,o=n._y,c=n._z,u=n._w,d=s+s,h=o+o,p=c+c,m=s*d,v=s*h,_=s*p,w=o*h,y=o*p,b=c*p,T=u*d,A=u*h,M=u*p,I=i.x,k=i.y,U=i.z;return r[0]=(1-(w+b))*I,r[1]=(v+M)*I,r[2]=(_-A)*I,r[3]=0,r[4]=(v-M)*k,r[5]=(1-(m+b))*k,r[6]=(y+T)*k,r[7]=0,r[8]=(_+A)*U,r[9]=(y-T)*U,r[10]=(1-(m+w))*U,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),n.identity(),this;let o=dl.set(r[0],r[1],r[2]).length();const c=dl.set(r[4],r[5],r[6]).length(),u=dl.set(r[8],r[9],r[10]).length();s<0&&(o=-o),kr.copy(this);const d=1/o,h=1/c,p=1/u;return kr.elements[0]*=d,kr.elements[1]*=d,kr.elements[2]*=d,kr.elements[4]*=h,kr.elements[5]*=h,kr.elements[6]*=h,kr.elements[8]*=p,kr.elements[9]*=p,kr.elements[10]*=p,n.setFromRotationMatrix(kr),i.x=o,i.y=c,i.z=u,this}makePerspective(e,n,i,r,s,o,c=es,u=!1){const d=this.elements,h=2*s/(n-e),p=2*s/(i-r),m=(n+e)/(n-e),v=(i+r)/(i-r);let _,w;if(u)_=s/(o-s),w=o*s/(o-s);else if(c===es)_=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(c===wh)_=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return d[0]=h,d[4]=0,d[8]=m,d[12]=0,d[1]=0,d[5]=p,d[9]=v,d[13]=0,d[2]=0,d[6]=0,d[10]=_,d[14]=w,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,n,i,r,s,o,c=es,u=!1){const d=this.elements,h=2/(n-e),p=2/(i-r),m=-(n+e)/(n-e),v=-(i+r)/(i-r);let _,w;if(u)_=1/(o-s),w=o/(o-s);else if(c===es)_=-2/(o-s),w=-(o+s)/(o-s);else if(c===wh)_=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return d[0]=h,d[4]=0,d[8]=0,d[12]=m,d[1]=0,d[5]=p,d[9]=0,d[13]=v,d[2]=0,d[6]=0,d[10]=_,d[14]=w,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const dl=new me,kr=new Kn,s6=new me(0,0,0),a6=new me(1,1,1),ga=new me,nf=new me,Ki=new me,D1=new Kn,N1=new tc;let Co=class gP{constructor(e=0,n=0,i=0,r=gP.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,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,n,i,r=this._order){return this._x=e,this._y=n,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,n=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],c=r[8],u=r[1],d=r[5],h=r[9],p=r[2],m=r[6],v=r[10];switch(n){case"XYZ":this._y=Math.asin(ln(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,v),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ln(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(c,v),this._z=Math.atan2(u,d)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(ln(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,v),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-ln(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,v),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(ln(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-h,d),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(c,v));break;case"XZY":this._z=Math.asin(-ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,d),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-h,v),this._y=0);break;default:Gt("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return D1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(D1,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return N1.setFromEuler(this),this.setFromQuaternion(N1,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}};Co.DEFAULT_ORDER="XYZ";class vP{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let o6=0;const I1=new me,fl=new tc,As=new Kn,rf=new me,Gc=new me,l6=new me,c6=new tc,U1=new me(1,0,0),F1=new me(0,1,0),O1=new me(0,0,1),B1={type:"added"},u6={type:"removed"},hl={type:"childadded",child:null},vg={type:"childremoved",child:null};class er extends ec{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:o6++}),this.uuid=Fu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=er.DEFAULT_UP.clone();const e=new me,n=new Co,i=new tc,r=new me(1,1,1);function s(){i.setFromEuler(n,!1)}function o(){n.setFromQuaternion(i,void 0,!1)}n._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Kn},normalMatrix:{value:new Wt}}),this.matrix=new Kn,this.matrixWorld=new Kn,this.matrixAutoUpdate=er.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=er.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new vP,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return fl.setFromAxisAngle(e,n),this.quaternion.multiply(fl),this}rotateOnWorldAxis(e,n){return fl.setFromAxisAngle(e,n),this.quaternion.premultiply(fl),this}rotateX(e){return this.rotateOnAxis(U1,e)}rotateY(e){return this.rotateOnAxis(F1,e)}rotateZ(e){return this.rotateOnAxis(O1,e)}translateOnAxis(e,n){return I1.copy(e).applyQuaternion(this.quaternion),this.position.add(I1.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(U1,e)}translateY(e){return this.translateOnAxis(F1,e)}translateZ(e){return this.translateOnAxis(O1,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(As.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?rf.copy(e):rf.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Gc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?As.lookAt(Gc,rf,this.up):As.lookAt(rf,Gc,this.up),this.quaternion.setFromRotationMatrix(As),r&&(As.extractRotation(r.matrixWorld),fl.setFromRotationMatrix(As),this.quaternion.premultiply(fl.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(_n("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(B1),hl.child=e,this.dispatchEvent(hl),hl.child=null):_n("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(u6),vg.child=e,this.dispatchEvent(vg),vg.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),As.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),As.multiply(e.parent.matrixWorld)),e.applyMatrix4(As),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(B1),hl.child=e,this.dispatchEvent(hl),hl.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gc,e,l6),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gc,c6,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const n=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=n-s[0]*n-s[4]*i-s[8]*r,s[13]+=i-s[1]*n-s[5]*i-s[9]*r,s[14]+=r-s[2]*n-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(c=>({...c})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let d=0,h=u.length;d<h;d++){const p=u[d];s(e.shapes,p)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,d=this.material.length;u<d;u++)c.push(s(e.materials,this.material[u]));r.material=c}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let c=0;c<this.children.length;c++)r.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];r.animations.push(s(e.animations,u))}}if(n){const c=o(e.geometries),u=o(e.materials),d=o(e.textures),h=o(e.images),p=o(e.shapes),m=o(e.skeletons),v=o(e.animations),_=o(e.nodes);c.length>0&&(i.geometries=c),u.length>0&&(i.materials=u),d.length>0&&(i.textures=d),h.length>0&&(i.images=h),p.length>0&&(i.shapes=p),m.length>0&&(i.skeletons=m),v.length>0&&(i.animations=v),_.length>0&&(i.nodes=_)}return i.object=r,i;function o(c){const u=[];for(const d in c){const h=c[d];delete h.metadata,u.push(h)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}er.DEFAULT_UP=new me(0,1,0);er.DEFAULT_MATRIX_AUTO_UPDATE=!0;er.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class sf extends er{constructor(){super(),this.isGroup=!0,this.type="Group"}}const d6={type:"move"};class yg{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new sf,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 sf,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new me,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new me),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new sf,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new me,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new me),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,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,n,i){let r=null,s=null,o=null;const c=this._targetRay,u=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const w of e.hand.values()){const y=n.getJointPose(w,i),b=this._getHandJoint(d,w);y!==null&&(b.matrix.fromArray(y.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=y.radius),b.visible=y!==null}const h=d.joints["index-finger-tip"],p=d.joints["thumb-tip"],m=h.position.distanceTo(p.position),v=.02,_=.005;d.inputState.pinching&&m>v+_?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&m<=v-_&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,i),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(d6)))}return c!==null&&(c.visible=r!==null),u!==null&&(u.visible=s!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new sf;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}const yP={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},af={h:0,s:0,l:0};function _g(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class Tn{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===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,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=ur){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,fn.colorSpaceToWorking(this,n),this}setRGB(e,n,i,r=fn.workingColorSpace){return this.r=e,this.g=n,this.b=i,fn.colorSpaceToWorking(this,r),this}setHSL(e,n,i,r=fn.workingColorSpace){if(e=JH(e,1),n=ln(n,0,1),i=ln(i,0,1),n===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+n):i+n-i*n,o=2*i-s;this.r=_g(o,s,e+1/3),this.g=_g(o,s,e),this.b=_g(o,s,e-1/3)}return fn.colorSpaceToWorking(this,r),this}setStyle(e,n=ur){function i(s){s!==void 0&&parseFloat(s)<1&&Gt("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],c=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))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,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))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,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:Gt("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,n);if(o===6)return this.setHex(parseInt(s,16),n);Gt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=ur){const i=yP[e.toLowerCase()];return i!==void 0?this.setHex(i,n):Gt("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=Bs(e.r),this.g=Bs(e.g),this.b=Bs(e.b),this}copyLinearToSRGB(e){return this.r=Ul(e.r),this.g=Ul(e.g),this.b=Ul(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ur){return fn.workingToColorSpace(bi.copy(this),e),Math.round(ln(bi.r*255,0,255))*65536+Math.round(ln(bi.g*255,0,255))*256+Math.round(ln(bi.b*255,0,255))}getHexString(e=ur){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=fn.workingColorSpace){fn.workingToColorSpace(bi.copy(this),n);const i=bi.r,r=bi.g,s=bi.b,o=Math.max(i,r,s),c=Math.min(i,r,s);let u,d;const h=(c+o)/2;if(c===o)u=0,d=0;else{const p=o-c;switch(d=h<=.5?p/(o+c):p/(2-o-c),o){case i:u=(r-s)/p+(r<s?6:0);break;case r:u=(s-i)/p+2;break;case s:u=(i-r)/p+4;break}u/=6}return e.h=u,e.s=d,e.l=h,e}getRGB(e,n=fn.workingColorSpace){return fn.workingToColorSpace(bi.copy(this),n),e.r=bi.r,e.g=bi.g,e.b=bi.b,e}getStyle(e=ur){fn.workingToColorSpace(bi.copy(this),e);const n=bi.r,i=bi.g,r=bi.b;return e!==ur?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,n,i){return this.getHSL(va),this.setHSL(va.h+e,va.s+n,va.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(va),e.getHSL(af);const i=fg(va.h,af.h,n),r=fg(va.s,af.s,n),s=fg(va.l,af.l,n);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*n+s[3]*i+s[6]*r,this.g=s[1]*n+s[4]*i+s[7]*r,this.b=s[2]*n+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const bi=new Tn;Tn.NAMES=yP;class f6 extends er{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Co,this.environmentIntensity=1,this.environmentRotation=new Co,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const Lr=new me,Cs=new me,xg=new me,Ps=new me,pl=new me,ml=new me,z1=new me,bg=new me,Sg=new me,wg=new me,Eg=new Vn,Mg=new Vn,Tg=new Vn;let jc=class Al{constructor(e=new me,n=new me,i=new me){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),Lr.subVectors(e,n),r.cross(Lr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,n,i,r,s){Lr.subVectors(r,n),Cs.subVectors(i,n),xg.subVectors(e,n);const o=Lr.dot(Lr),c=Lr.dot(Cs),u=Lr.dot(xg),d=Cs.dot(Cs),h=Cs.dot(xg),p=o*d-c*c;if(p===0)return s.set(0,0,0),null;const m=1/p,v=(d*u-c*h)*m,_=(o*h-c*u)*m;return s.set(1-v-_,_,v)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Ps)===null?!1:Ps.x>=0&&Ps.y>=0&&Ps.x+Ps.y<=1}static getInterpolation(e,n,i,r,s,o,c,u){return this.getBarycoord(e,n,i,r,Ps)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,Ps.x),u.addScaledVector(o,Ps.y),u.addScaledVector(c,Ps.z),u)}static getInterpolatedAttribute(e,n,i,r,s,o){return Eg.setScalar(0),Mg.setScalar(0),Tg.setScalar(0),Eg.fromBufferAttribute(e,n),Mg.fromBufferAttribute(e,i),Tg.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(Eg,s.x),o.addScaledVector(Mg,s.y),o.addScaledVector(Tg,s.z),o}static isFrontFacing(e,n,i,r){return Lr.subVectors(i,n),Cs.subVectors(e,n),Lr.cross(Cs).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,i,r){return this.a.fromBufferAttribute(e,n),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 Lr.subVectors(this.c,this.b),Cs.subVectors(this.a,this.b),Lr.cross(Cs).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Al.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Al.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,s){return Al.getInterpolation(e,this.a,this.b,this.c,n,i,r,s)}containsPoint(e){return Al.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Al.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,r=this.b,s=this.c;let o,c;pl.subVectors(r,i),ml.subVectors(s,i),bg.subVectors(e,i);const u=pl.dot(bg),d=ml.dot(bg);if(u<=0&&d<=0)return n.copy(i);Sg.subVectors(e,r);const h=pl.dot(Sg),p=ml.dot(Sg);if(h>=0&&p<=h)return n.copy(r);const m=u*p-h*d;if(m<=0&&u>=0&&h<=0)return o=u/(u-h),n.copy(i).addScaledVector(pl,o);wg.subVectors(e,s);const v=pl.dot(wg),_=ml.dot(wg);if(_>=0&&v<=_)return n.copy(s);const w=v*d-u*_;if(w<=0&&d>=0&&_<=0)return c=d/(d-_),n.copy(i).addScaledVector(ml,c);const y=h*_-v*p;if(y<=0&&p-h>=0&&v-_>=0)return z1.subVectors(s,r),c=(p-h)/(p-h+(v-_)),n.copy(r).addScaledVector(z1,c);const b=1/(y+w+m);return o=w*b,c=m*b,n.copy(i).addScaledVector(pl,o).addScaledVector(ml,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};class Ou{constructor(e=new me(1/0,1/0,1/0),n=new me(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Dr.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Dr.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Dr.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,c=s.count;o<c;o++)e.isMesh===!0?e.getVertexPosition(o,Dr):Dr.fromBufferAttribute(s,o),Dr.applyMatrix4(e.matrixWorld),this.expandByPoint(Dr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),of.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),of.copy(i.boundingBox)),of.applyMatrix4(e.matrixWorld),this.union(of)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Dr),Dr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Wc),lf.subVectors(this.max,Wc),gl.subVectors(e.a,Wc),vl.subVectors(e.b,Wc),yl.subVectors(e.c,Wc),ya.subVectors(vl,gl),_a.subVectors(yl,vl),eo.subVectors(gl,yl);let n=[0,-ya.z,ya.y,0,-_a.z,_a.y,0,-eo.z,eo.y,ya.z,0,-ya.x,_a.z,0,-_a.x,eo.z,0,-eo.x,-ya.y,ya.x,0,-_a.y,_a.x,0,-eo.y,eo.x,0];return!Ag(n,gl,vl,yl,lf)||(n=[1,0,0,0,1,0,0,0,1],!Ag(n,gl,vl,yl,lf))?!1:(cf.crossVectors(ya,_a),n=[cf.x,cf.y,cf.z],Ag(n,gl,vl,yl,lf))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Dr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Dr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Rs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Rs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Rs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Rs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Rs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Rs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Rs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Rs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Rs),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Rs=[new me,new me,new me,new me,new me,new me,new me,new me],Dr=new me,of=new Ou,gl=new me,vl=new me,yl=new me,ya=new me,_a=new me,eo=new me,Wc=new me,lf=new me,cf=new me,to=new me;function Ag(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){to.fromArray(t,s);const c=r.x*Math.abs(to.x)+r.y*Math.abs(to.y)+r.z*Math.abs(to.z),u=e.dot(to),d=n.dot(to),h=i.dot(to);if(Math.max(-Math.max(u,d,h),Math.min(u,d,h))>c)return!1}return!0}const $n=new me,uf=new bn;let h6=0;class Vr{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:h6++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=T1,this.updateRanges=[],this.gpuType=Qr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=n.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)uf.fromBufferAttribute(this,n),uf.applyMatrix3(e),this.setXY(n,uf.x,uf.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.applyMatrix3(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.applyMatrix4(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.applyNormalMatrix(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)$n.fromBufferAttribute(this,n),$n.transformDirection(e),this.setXYZ(n,$n.x,$n.y,$n.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Hc(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Hi(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Hc(n,this.array)),n}setX(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Hc(n,this.array)),n}setY(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Hc(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Hc(n,this.array)),n}setW(e,n){return this.normalized&&(n=Hi(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Hi(n,this.array),i=Hi(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,r){return e*=this.itemSize,this.normalized&&(n=Hi(n,this.array),i=Hi(i,this.array),r=Hi(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,n,i,r,s){return e*=this.itemSize,this.normalized&&(n=Hi(n,this.array),i=Hi(i,this.array),r=Hi(r,this.array),s=Hi(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==T1&&(e.usage=this.usage),e}}class _P extends Vr{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class xP extends Vr{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class zs extends Vr{constructor(e,n,i){super(new Float32Array(e),n,i)}}const p6=new Ou,$c=new me,Cg=new me;class a_{constructor(e=new me,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):p6.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;$c.subVectors(e,this.center);const n=$c.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector($c,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):(Cg.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint($c.copy(e.center).add(Cg)),this.expandByPoint($c.copy(e.center).sub(Cg))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let m6=0;const lr=new Kn,Pg=new er,_l=new me,Zi=new Ou,Xc=new Ou,ci=new me;class gs extends ec{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:m6++}),this.uuid=Fu(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(qH(e)?xP:_P)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new Wt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return lr.makeRotationFromQuaternion(e),this.applyMatrix4(lr),this}rotateX(e){return lr.makeRotationX(e),this.applyMatrix4(lr),this}rotateY(e){return lr.makeRotationY(e),this.applyMatrix4(lr),this}rotateZ(e){return lr.makeRotationZ(e),this.applyMatrix4(lr),this}translate(e,n,i){return lr.makeTranslation(e,n,i),this.applyMatrix4(lr),this}scale(e,n,i){return lr.makeScale(e,n,i),this.applyMatrix4(lr),this}lookAt(e){return Pg.lookAt(e),Pg.updateMatrix(),this.applyMatrix4(Pg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_l).negate(),this.translate(_l.x,_l.y,_l.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new zs(i,3))}else{const i=Math.min(e.length,n.count);for(let r=0;r<i;r++){const s=e[r];n.setXYZ(r,s.x,s.y,s.z||0)}e.length>n.count&&Gt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ou);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){_n("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new me(-1/0,-1/0,-1/0),new me(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,r=n.length;i<r;i++){const s=n[i];Zi.setFromBufferAttribute(s),this.morphTargetsRelative?(ci.addVectors(this.boundingBox.min,Zi.min),this.boundingBox.expandByPoint(ci),ci.addVectors(this.boundingBox.max,Zi.max),this.boundingBox.expandByPoint(ci)):(this.boundingBox.expandByPoint(Zi.min),this.boundingBox.expandByPoint(Zi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&_n('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new a_);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){_n("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new me,1/0);return}if(e){const i=this.boundingSphere.center;if(Zi.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const c=n[s];Xc.setFromBufferAttribute(c),this.morphTargetsRelative?(ci.addVectors(Zi.min,Xc.min),Zi.expandByPoint(ci),ci.addVectors(Zi.max,Xc.max),Zi.expandByPoint(ci)):(Zi.expandByPoint(Xc.min),Zi.expandByPoint(Xc.max))}Zi.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)ci.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(ci));if(n)for(let s=0,o=n.length;s<o;s++){const c=n[s],u=this.morphTargetsRelative;for(let d=0,h=c.count;d<h;d++)ci.fromBufferAttribute(c,d),u&&(_l.fromBufferAttribute(e,d),ci.add(_l)),r=Math.max(r,i.distanceToSquared(ci))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&_n('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){_n("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,r=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Vr(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),c=[],u=[];for(let S=0;S<i.count;S++)c[S]=new me,u[S]=new me;const d=new me,h=new me,p=new me,m=new bn,v=new bn,_=new bn,w=new me,y=new me;function b(S,P,V){d.fromBufferAttribute(i,S),h.fromBufferAttribute(i,P),p.fromBufferAttribute(i,V),m.fromBufferAttribute(s,S),v.fromBufferAttribute(s,P),_.fromBufferAttribute(s,V),h.sub(d),p.sub(d),v.sub(m),_.sub(m);const O=1/(v.x*_.y-_.x*v.y);isFinite(O)&&(w.copy(h).multiplyScalar(_.y).addScaledVector(p,-v.y).multiplyScalar(O),y.copy(p).multiplyScalar(v.x).addScaledVector(h,-_.x).multiplyScalar(O),c[S].add(w),c[P].add(w),c[V].add(w),u[S].add(y),u[P].add(y),u[V].add(y))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let S=0,P=T.length;S<P;++S){const V=T[S],O=V.start,G=V.count;for(let J=O,H=O+G;J<H;J+=3)b(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const A=new me,M=new me,I=new me,k=new me;function U(S){I.fromBufferAttribute(r,S),k.copy(I);const P=c[S];A.copy(P),A.sub(I.multiplyScalar(I.dot(P))).normalize(),M.crossVectors(k,P);const O=M.dot(u[S])<0?-1:1;o.setXYZW(S,A.x,A.y,A.z,O)}for(let S=0,P=T.length;S<P;++S){const V=T[S],O=V.start,G=V.count;for(let J=O,H=O+G;J<H;J+=3)U(e.getX(J+0)),U(e.getX(J+1)),U(e.getX(J+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Vr(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let m=0,v=i.count;m<v;m++)i.setXYZ(m,0,0,0);const r=new me,s=new me,o=new me,c=new me,u=new me,d=new me,h=new me,p=new me;if(e)for(let m=0,v=e.count;m<v;m+=3){const _=e.getX(m+0),w=e.getX(m+1),y=e.getX(m+2);r.fromBufferAttribute(n,_),s.fromBufferAttribute(n,w),o.fromBufferAttribute(n,y),h.subVectors(o,s),p.subVectors(r,s),h.cross(p),c.fromBufferAttribute(i,_),u.fromBufferAttribute(i,w),d.fromBufferAttribute(i,y),c.add(h),u.add(h),d.add(h),i.setXYZ(_,c.x,c.y,c.z),i.setXYZ(w,u.x,u.y,u.z),i.setXYZ(y,d.x,d.y,d.z)}else for(let m=0,v=n.count;m<v;m+=3)r.fromBufferAttribute(n,m+0),s.fromBufferAttribute(n,m+1),o.fromBufferAttribute(n,m+2),h.subVectors(o,s),p.subVectors(r,s),h.cross(p),i.setXYZ(m+0,h.x,h.y,h.z),i.setXYZ(m+1,h.x,h.y,h.z),i.setXYZ(m+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)ci.fromBufferAttribute(e,n),ci.normalize(),e.setXYZ(n,ci.x,ci.y,ci.z)}toNonIndexed(){function e(c,u){const d=c.array,h=c.itemSize,p=c.normalized,m=new d.constructor(u.length*h);let v=0,_=0;for(let w=0,y=u.length;w<y;w++){c.isInterleavedBufferAttribute?v=u[w]*c.data.stride+c.offset:v=u[w]*h;for(let b=0;b<h;b++)m[_++]=d[v++]}return new Vr(m,h,p)}if(this.index===null)return Gt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new gs,i=this.index.array,r=this.attributes;for(const c in r){const u=r[c],d=e(u,i);n.setAttribute(c,d)}const s=this.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,p=d.length;h<p;h++){const m=d[h],v=e(m,i);u.push(v)}n.morphAttributes[c]=u}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let c=0,u=o.length;c<u;c++){const d=o[c];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const d in u)u[d]!==void 0&&(e[d]=u[d]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const u in i){const d=i[u];e.data.attributes[u]=d.toJSON(e.data)}const r={};let s=!1;for(const u in this.morphAttributes){const d=this.morphAttributes[u],h=[];for(let p=0,m=d.length;p<m;p++){const v=d[p];h.push(v.toJSON(e.data))}h.length>0&&(r[u]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const d in r){const h=r[d];this.setAttribute(d,h.clone(n))}const s=e.morphAttributes;for(const d in s){const h=[],p=s[d];for(let m=0,v=p.length;m<v;m++)h.push(p[m].clone(n));this.morphAttributes[d]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,h=o.length;d<h;d++){const p=o[d];this.addGroup(p.start,p.count,p.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let g6=0;class Gh extends ec{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:g6++}),this.uuid=Fu(),this.name="",this.type="Material",this.blending=_o,this.side=Ua,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=G0,this.blendDst=j0,this.blendEquation=lo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Tn(0,0,0),this.blendAlpha=0,this.depthFunc=jl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=M1,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=cl,this.stencilZFail=cl,this.stencilZPass=cl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){Gt(`Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Gt(`Material: '${n}' 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[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==_o&&(i.blending=this.blending),this.side!==Ua&&(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!==G0&&(i.blendSrc=this.blendSrc),this.blendDst!==j0&&(i.blendDst=this.blendDst),this.blendEquation!==lo&&(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!==jl&&(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!==M1&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==cl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==cl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==cl&&(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.allowOverride===!1&&(i.allowOverride=!1),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 c in s){const u=s[c];delete u.metadata,o.push(u)}return o}if(n){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 n=e.clippingPlanes;let i=null;if(n!==null){const r=n.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=n[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.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const ks=new me,Rg=new me,df=new me,xa=new me,kg=new me,ff=new me,Lg=new me;class v6{constructor(e=new me,n=new me(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,ks)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=ks.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(ks.copy(this.origin).addScaledVector(this.direction,n),ks.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){Rg.copy(e).add(n).multiplyScalar(.5),df.copy(n).sub(e).normalize(),xa.copy(this.origin).sub(Rg);const s=e.distanceTo(n)*.5,o=-this.direction.dot(df),c=xa.dot(this.direction),u=-xa.dot(df),d=xa.lengthSq(),h=Math.abs(1-o*o);let p,m,v,_;if(h>0)if(p=o*u-c,m=o*c-u,_=s*h,p>=0)if(m>=-_)if(m<=_){const w=1/h;p*=w,m*=w,v=p*(p+o*m+2*c)+m*(o*p+m+2*u)+d}else m=s,p=Math.max(0,-(o*m+c)),v=-p*p+m*(m+2*u)+d;else m=-s,p=Math.max(0,-(o*m+c)),v=-p*p+m*(m+2*u)+d;else m<=-_?(p=Math.max(0,-(-o*s+c)),m=p>0?-s:Math.min(Math.max(-s,-u),s),v=-p*p+m*(m+2*u)+d):m<=_?(p=0,m=Math.min(Math.max(-s,-u),s),v=m*(m+2*u)+d):(p=Math.max(0,-(o*s+c)),m=p>0?s:Math.min(Math.max(-s,-u),s),v=-p*p+m*(m+2*u)+d);else m=o>0?-s:s,p=Math.max(0,-(o*m+c)),v=-p*p+m*(m+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,p),r&&r.copy(Rg).addScaledVector(df,m),v}intersectSphere(e,n){ks.subVectors(e.center,this.origin);const i=ks.dot(this.direction),r=ks.dot(ks)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),c=i-o,u=i+o;return u<0?null:c<0?this.at(u,n):this.at(c,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,s,o,c,u;const d=1/this.direction.x,h=1/this.direction.y,p=1/this.direction.z,m=this.origin;return d>=0?(i=(e.min.x-m.x)*d,r=(e.max.x-m.x)*d):(i=(e.max.x-m.x)*d,r=(e.min.x-m.x)*d),h>=0?(s=(e.min.y-m.y)*h,o=(e.max.y-m.y)*h):(s=(e.max.y-m.y)*h,o=(e.min.y-m.y)*h),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),p>=0?(c=(e.min.z-m.z)*p,u=(e.max.z-m.z)*p):(c=(e.max.z-m.z)*p,u=(e.min.z-m.z)*p),i>u||c>r)||((c>i||i!==i)&&(i=c),(u<r||r!==r)&&(r=u),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,ks)!==null}intersectTriangle(e,n,i,r,s){kg.subVectors(n,e),ff.subVectors(i,e),Lg.crossVectors(kg,ff);let o=this.direction.dot(Lg),c;if(o>0){if(r)return null;c=1}else if(o<0)c=-1,o=-o;else return null;xa.subVectors(this.origin,e);const u=c*this.direction.dot(ff.crossVectors(xa,ff));if(u<0)return null;const d=c*this.direction.dot(kg.cross(xa));if(d<0||u+d>o)return null;const h=-c*xa.dot(Lg);return h<0?null:this.at(h/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class bP extends Gh{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Tn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Co,this.combine=JC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const V1=new Kn,no=new v6,hf=new a_,H1=new me,pf=new me,mf=new me,gf=new me,Dg=new me,vf=new me,G1=new me,yf=new me;let ds=class extends er{constructor(e=new gs,n=new bP){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const c=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const c=this.morphTargetInfluences;if(s&&c){vf.set(0,0,0);for(let u=0,d=s.length;u<d;u++){const h=c[u],p=s[u];h!==0&&(Dg.fromBufferAttribute(p,e),o?vf.addScaledVector(Dg,h):vf.addScaledVector(Dg.sub(n),h))}n.add(vf)}return n}raycast(e,n){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),hf.copy(i.boundingSphere),hf.applyMatrix4(s),no.copy(e.ray).recast(e.near),!(hf.containsPoint(no.origin)===!1&&(no.intersectSphere(hf,H1)===null||no.origin.distanceToSquared(H1)>(e.far-e.near)**2))&&(V1.copy(s).invert(),no.copy(e.ray).applyMatrix4(V1),!(i.boundingBox!==null&&no.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,no)))}_computeIntersections(e,n,i){let r;const s=this.geometry,o=this.material,c=s.index,u=s.attributes.position,d=s.attributes.uv,h=s.attributes.uv1,p=s.attributes.normal,m=s.groups,v=s.drawRange;if(c!==null)if(Array.isArray(o))for(let _=0,w=m.length;_<w;_++){const y=m[_],b=o[y.materialIndex],T=Math.max(y.start,v.start),A=Math.min(c.count,Math.min(y.start+y.count,v.start+v.count));for(let M=T,I=A;M<I;M+=3){const k=c.getX(M),U=c.getX(M+1),S=c.getX(M+2);r=_f(this,b,e,i,d,h,p,k,U,S),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=y.materialIndex,n.push(r))}}else{const _=Math.max(0,v.start),w=Math.min(c.count,v.start+v.count);for(let y=_,b=w;y<b;y+=3){const T=c.getX(y),A=c.getX(y+1),M=c.getX(y+2);r=_f(this,o,e,i,d,h,p,T,A,M),r&&(r.faceIndex=Math.floor(y/3),n.push(r))}}else if(u!==void 0)if(Array.isArray(o))for(let _=0,w=m.length;_<w;_++){const y=m[_],b=o[y.materialIndex],T=Math.max(y.start,v.start),A=Math.min(u.count,Math.min(y.start+y.count,v.start+v.count));for(let M=T,I=A;M<I;M+=3){const k=M,U=M+1,S=M+2;r=_f(this,b,e,i,d,h,p,k,U,S),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=y.materialIndex,n.push(r))}}else{const _=Math.max(0,v.start),w=Math.min(u.count,v.start+v.count);for(let y=_,b=w;y<b;y+=3){const T=y,A=y+1,M=y+2;r=_f(this,o,e,i,d,h,p,T,A,M),r&&(r.faceIndex=Math.floor(y/3),n.push(r))}}}};function y6(t,e,n,i,r,s,o,c){let u;if(e.side===Gi?u=i.intersectTriangle(o,s,r,!0,c):u=i.intersectTriangle(r,s,o,e.side===Ua,c),u===null)return null;yf.copy(c),yf.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(yf);return d<n.near||d>n.far?null:{distance:d,point:yf.clone(),object:t}}function _f(t,e,n,i,r,s,o,c,u,d){t.getVertexPosition(c,pf),t.getVertexPosition(u,mf),t.getVertexPosition(d,gf);const h=y6(t,e,n,i,pf,mf,gf,G1);if(h){const p=new me;jc.getBarycoord(G1,pf,mf,gf,p),r&&(h.uv=jc.getInterpolatedAttribute(r,c,u,d,p,new bn)),s&&(h.uv1=jc.getInterpolatedAttribute(s,c,u,d,p,new bn)),o&&(h.normal=jc.getInterpolatedAttribute(o,c,u,d,p,new me),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const m={a:c,b:u,c:d,normal:new me,materialIndex:0};jc.getNormal(pf,mf,gf,m.normal),h.face=m,h.barycoord=p}return h}class _6 extends Li{constructor(e=null,n=1,i=1,r,s,o,c,u,d=mi,h=mi,p,m){super(null,o,c,u,d,h,r,s,p,m),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ng=new me,x6=new me,b6=new Wt;class oo{constructor(e=new me(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=Ng.subVectors(i,n).cross(x6.subVectors(e,n)).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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(Ng),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:n.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>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,n){const i=n||b6.getNormalMatrix(e),r=this.coplanarPoint(Ng).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const io=new a_,S6=new bn(.5,.5),xf=new me;class SP{constructor(e=new oo,n=new oo,i=new oo,r=new oo,s=new oo,o=new oo){this.planes=[e,n,i,r,s,o]}set(e,n,i,r,s,o){const c=this.planes;return c[0].copy(e),c[1].copy(n),c[2].copy(i),c[3].copy(r),c[4].copy(s),c[5].copy(o),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=es,i=!1){const r=this.planes,s=e.elements,o=s[0],c=s[1],u=s[2],d=s[3],h=s[4],p=s[5],m=s[6],v=s[7],_=s[8],w=s[9],y=s[10],b=s[11],T=s[12],A=s[13],M=s[14],I=s[15];if(r[0].setComponents(d-o,v-h,b-_,I-T).normalize(),r[1].setComponents(d+o,v+h,b+_,I+T).normalize(),r[2].setComponents(d+c,v+p,b+w,I+A).normalize(),r[3].setComponents(d-c,v-p,b-w,I-A).normalize(),i)r[4].setComponents(u,m,y,M).normalize(),r[5].setComponents(d-u,v-m,b-y,I-M).normalize();else if(r[4].setComponents(d-u,v-m,b-y,I-M).normalize(),n===es)r[5].setComponents(d+u,v+m,b+y,I+M).normalize();else if(n===wh)r[5].setComponents(u,m,y,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),io.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),io.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(io)}intersectsSprite(e){io.center.set(0,0,0);const n=S6.distanceTo(e.center);return io.radius=.7071067811865476+n,io.applyMatrix4(e.matrixWorld),this.intersectsSphere(io)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const r=n[i];if(xf.x=r.normal.x>0?e.max.x:e.min.x,xf.y=r.normal.y>0?e.max.y:e.min.y,xf.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(xf)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class wP extends Li{constructor(e=[],n=To,i,r,s,o,c,u,d,h){super(e,n,i,r,s,o,c,u,d,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Su extends Li{constructor(e,n,i=us,r,s,o,c=mi,u=mi,d,h=Gs,p=1){if(h!==Gs&&h!==go)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:n,depth:p};super(m,r,s,o,c,u,h,i,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new s_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class w6 extends Su{constructor(e,n=us,i=To,r,s,o=mi,c=mi,u,d=Gs){const h={width:e,height:e,depth:1},p=[h,h,h,h,h,h];super(e,e,n,i,r,s,o,c,u,d),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class EP extends Li{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Bu extends gs{constructor(e=1,n=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const c=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const u=[],d=[],h=[],p=[];let m=0,v=0;_("z","y","x",-1,-1,i,n,e,o,s,0),_("z","y","x",1,-1,i,n,-e,o,s,1),_("x","z","y",1,1,e,i,n,r,o,2),_("x","z","y",1,-1,e,i,-n,r,o,3),_("x","y","z",1,-1,e,n,i,r,s,4),_("x","y","z",-1,-1,e,n,-i,r,s,5),this.setIndex(u),this.setAttribute("position",new zs(d,3)),this.setAttribute("normal",new zs(h,3)),this.setAttribute("uv",new zs(p,2));function _(w,y,b,T,A,M,I,k,U,S,P){const V=M/U,O=I/S,G=M/2,J=I/2,H=k/2,X=U+1,K=S+1;let Q=0,W=0;const q=new me;for(let Z=0;Z<K;Z++){const z=Z*O-J;for(let ie=0;ie<X;ie++){const we=ie*V-G;q[w]=we*T,q[y]=z*A,q[b]=H,d.push(q.x,q.y,q.z),q[w]=0,q[y]=0,q[b]=k>0?1:-1,h.push(q.x,q.y,q.z),p.push(ie/U),p.push(1-Z/S),Q+=1}}for(let Z=0;Z<S;Z++)for(let z=0;z<U;z++){const ie=m+z+X*Z,we=m+z+X*(Z+1),He=m+(z+1)+X*(Z+1),Se=m+(z+1)+X*Z;u.push(ie,we,Se),u.push(we,He,Se),W+=6}c.addGroup(v,W,P),v+=W,m+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bu(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class jh extends gs{constructor(e=1,n=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:r};const s=e/2,o=n/2,c=Math.floor(i),u=Math.floor(r),d=c+1,h=u+1,p=e/c,m=n/u,v=[],_=[],w=[],y=[];for(let b=0;b<h;b++){const T=b*m-o;for(let A=0;A<d;A++){const M=A*p-s;_.push(M,-T,0),w.push(0,0,1),y.push(A/c),y.push(1-b/u)}}for(let b=0;b<u;b++)for(let T=0;T<c;T++){const A=T+d*b,M=T+d*(b+1),I=T+1+d*(b+1),k=T+1+d*b;v.push(A,M,k),v.push(M,I,k)}this.setIndex(v),this.setAttribute("position",new zs(_,3)),this.setAttribute("normal",new zs(w,3)),this.setAttribute("uv",new zs(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jh(e.width,e.height,e.widthSegments,e.heightSegments)}}function Xl(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(Gt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Ci(t){const e={};for(let n=0;n<t.length;n++){const i=Xl(t[n]);for(const r in i)e[r]=i[r]}return e}function E6(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function MP(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:fn.workingColorSpace}const M6={clone:Xl,merge:Ci};var T6=`void main() {
|
|
611
612
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
612
613
|
}`,A6=`void main() {
|
|
613
614
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -4218,7 +4219,7 @@ void main() {
|
|
|
4218
4219
|
#include <tonemapping_fragment>
|
|
4219
4220
|
#include <colorspace_fragment>
|
|
4220
4221
|
#include <fog_fragment>
|
|
4221
|
-
}`,Xt={alphahash_fragment:I6,alphahash_pars_fragment:U6,alphamap_fragment:F6,alphamap_pars_fragment:O6,alphatest_fragment:B6,alphatest_pars_fragment:z6,aomap_fragment:V6,aomap_pars_fragment:H6,batching_pars_vertex:G6,batching_vertex:j6,begin_vertex:W6,beginnormal_vertex:$6,bsdfs:X6,iridescence_fragment:q6,bumpmap_pars_fragment:Y6,clipping_planes_fragment:K6,clipping_planes_pars_fragment:Z6,clipping_planes_pars_vertex:J6,clipping_planes_vertex:Q6,color_fragment:e8,color_pars_fragment:t8,color_pars_vertex:n8,color_vertex:i8,common:r8,cube_uv_reflection_fragment:s8,defaultnormal_vertex:a8,displacementmap_pars_vertex:o8,displacementmap_vertex:l8,emissivemap_fragment:c8,emissivemap_pars_fragment:u8,colorspace_fragment:d8,colorspace_pars_fragment:f8,envmap_fragment:h8,envmap_common_pars_fragment:p8,envmap_pars_fragment:m8,envmap_pars_vertex:g8,envmap_physical_pars_fragment:A8,envmap_vertex:v8,fog_vertex:y8,fog_pars_vertex:_8,fog_fragment:x8,fog_pars_fragment:b8,gradientmap_pars_fragment:S8,lightmap_pars_fragment:w8,lights_lambert_fragment:E8,lights_lambert_pars_fragment:M8,lights_pars_begin:T8,lights_toon_fragment:C8,lights_toon_pars_fragment:P8,lights_phong_fragment:R8,lights_phong_pars_fragment:k8,lights_physical_fragment:L8,lights_physical_pars_fragment:D8,lights_fragment_begin:N8,lights_fragment_maps:I8,lights_fragment_end:U8,logdepthbuf_fragment:F8,logdepthbuf_pars_fragment:O8,logdepthbuf_pars_vertex:B8,logdepthbuf_vertex:z8,map_fragment:V8,map_pars_fragment:H8,map_particle_fragment:G8,map_particle_pars_fragment:j8,metalnessmap_fragment:W8,metalnessmap_pars_fragment:$8,morphinstance_vertex:X8,morphcolor_vertex:q8,morphnormal_vertex:Y8,morphtarget_pars_vertex:K8,morphtarget_vertex:Z8,normal_fragment_begin:J8,normal_fragment_maps:Q8,normal_pars_fragment:eG,normal_pars_vertex:tG,normal_vertex:nG,normalmap_pars_fragment:iG,clearcoat_normal_fragment_begin:rG,clearcoat_normal_fragment_maps:sG,clearcoat_pars_fragment:aG,iridescence_pars_fragment:oG,opaque_fragment:lG,packing:cG,premultiplied_alpha_fragment:uG,project_vertex:dG,dithering_fragment:fG,dithering_pars_fragment:hG,roughnessmap_fragment:pG,roughnessmap_pars_fragment:mG,shadowmap_pars_fragment:gG,shadowmap_pars_vertex:vG,shadowmap_vertex:yG,shadowmask_pars_fragment:_G,skinbase_vertex:xG,skinning_pars_vertex:bG,skinning_vertex:SG,skinnormal_vertex:wG,specularmap_fragment:EG,specularmap_pars_fragment:MG,tonemapping_fragment:TG,tonemapping_pars_fragment:AG,transmission_fragment:CG,transmission_pars_fragment:PG,uv_pars_fragment:RG,uv_pars_vertex:kG,uv_vertex:LG,worldpos_vertex:DG,background_vert:NG,background_frag:IG,backgroundCube_vert:UG,backgroundCube_frag:FG,cube_vert:OG,cube_frag:BG,depth_vert:zG,depth_frag:VG,distance_vert:HG,distance_frag:GG,equirect_vert:jG,equirect_frag:WG,linedashed_vert:$G,linedashed_frag:XG,meshbasic_vert:qG,meshbasic_frag:YG,meshlambert_vert:KG,meshlambert_frag:ZG,meshmatcap_vert:JG,meshmatcap_frag:QG,meshnormal_vert:ej,meshnormal_frag:tj,meshphong_vert:nj,meshphong_frag:ij,meshphysical_vert:rj,meshphysical_frag:sj,meshtoon_vert:aj,meshtoon_frag:oj,points_vert:lj,points_frag:cj,shadow_vert:uj,shadow_frag:dj,sprite_vert:fj,sprite_frag:hj},Ye={common:{diffuse:{value:new Tn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Wt},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Wt}},envmap:{envMap:{value:null},envMapRotation:{value:new Wt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Wt},normalScale:{value:new bn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Wt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Tn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},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 Tn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0},uvTransform:{value:new Wt}},sprite:{diffuse:{value:new Tn(16777215)},opacity:{value:1},center:{value:new bn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Wt},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0}}},Zr={basic:{uniforms:Ci([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.fog]),vertexShader:Xt.meshbasic_vert,fragmentShader:Xt.meshbasic_frag},lambert:{uniforms:Ci([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)},envMapIntensity:{value:1}}]),vertexShader:Xt.meshlambert_vert,fragmentShader:Xt.meshlambert_frag},phong:{uniforms:Ci([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)},specular:{value:new Tn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Xt.meshphong_vert,fragmentShader:Xt.meshphong_frag},standard:{uniforms:Ci([Ye.common,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.roughnessmap,Ye.metalnessmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Xt.meshphysical_vert,fragmentShader:Xt.meshphysical_frag},toon:{uniforms:Ci([Ye.common,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.gradientmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)}}]),vertexShader:Xt.meshtoon_vert,fragmentShader:Xt.meshtoon_frag},matcap:{uniforms:Ci([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,{matcap:{value:null}}]),vertexShader:Xt.meshmatcap_vert,fragmentShader:Xt.meshmatcap_frag},points:{uniforms:Ci([Ye.points,Ye.fog]),vertexShader:Xt.points_vert,fragmentShader:Xt.points_frag},dashed:{uniforms:Ci([Ye.common,Ye.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Xt.linedashed_vert,fragmentShader:Xt.linedashed_frag},depth:{uniforms:Ci([Ye.common,Ye.displacementmap]),vertexShader:Xt.depth_vert,fragmentShader:Xt.depth_frag},normal:{uniforms:Ci([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,{opacity:{value:1}}]),vertexShader:Xt.meshnormal_vert,fragmentShader:Xt.meshnormal_frag},sprite:{uniforms:Ci([Ye.sprite,Ye.fog]),vertexShader:Xt.sprite_vert,fragmentShader:Xt.sprite_frag},background:{uniforms:{uvTransform:{value:new Wt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Xt.background_vert,fragmentShader:Xt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Wt}},vertexShader:Xt.backgroundCube_vert,fragmentShader:Xt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Xt.cube_vert,fragmentShader:Xt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Xt.equirect_vert,fragmentShader:Xt.equirect_frag},distance:{uniforms:Ci([Ye.common,Ye.displacementmap,{referencePosition:{value:new me},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Xt.distance_vert,fragmentShader:Xt.distance_frag},shadow:{uniforms:Ci([Ye.lights,Ye.fog,{color:{value:new Tn(0)},opacity:{value:1}}]),vertexShader:Xt.shadow_vert,fragmentShader:Xt.shadow_frag}};Zr.physical={uniforms:Ci([Zr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Wt},clearcoatNormalScale:{value:new bn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Wt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Wt},sheen:{value:0},sheenColor:{value:new Tn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Wt},transmissionSamplerSize:{value:new bn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Wt},attenuationDistance:{value:0},attenuationColor:{value:new Tn(0)},specularColor:{value:new Tn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Wt},anisotropyVector:{value:new bn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Wt}}]),vertexShader:Xt.meshphysical_vert,fragmentShader:Xt.meshphysical_frag};const wf={r:0,b:0,g:0},ro=new Co,pj=new Kn;function mj(t,e,n,i,r,s){const o=new Tn(0);let c=r===!0?0:1,u,d,h=null,p=0,m=null;function v(T){let A=T.isScene===!0?T.background:null;if(A&&A.isTexture){const M=T.backgroundBlurriness>0;A=e.get(A,M)}return A}function _(T){let A=!1;const M=v(T);M===null?y(o,c):M&&M.isColor&&(y(M,1),A=!0);const I=t.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,s):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,s),(t.autoClear||A)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(T,A){const M=v(A);M&&(M.isCubeTexture||M.mapping===Hh)?(d===void 0&&(d=new ds(new Bu(1,1,1),new fs({name:"BackgroundCubeMaterial",uniforms:Xl(Zr.backgroundCube.uniforms),vertexShader:Zr.backgroundCube.vertexShader,fragmentShader:Zr.backgroundCube.fragmentShader,side:Gi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(I,k,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),ro.copy(A.backgroundRotation),ro.x*=-1,ro.y*=-1,ro.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(ro.y*=-1,ro.z*=-1),d.material.uniforms.envMap.value=M,d.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(pj.makeRotationFromEuler(ro)),d.material.toneMapped=fn.getTransfer(M.colorSpace)!==wn,(h!==M||p!==M.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,h=M,p=M.version,m=t.toneMapping),d.layers.enableAll(),T.unshift(d,d.geometry,d.material,0,0,null)):M&&M.isTexture&&(u===void 0&&(u=new ds(new jh(2,2),new fs({name:"BackgroundMaterial",uniforms:Xl(Zr.background.uniforms),vertexShader:Zr.background.vertexShader,fragmentShader:Zr.background.fragmentShader,side:Ua,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(u)),u.material.uniforms.t2D.value=M,u.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,u.material.toneMapped=fn.getTransfer(M.colorSpace)!==wn,M.matrixAutoUpdate===!0&&M.updateMatrix(),u.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||p!==M.version||m!==t.toneMapping)&&(u.material.needsUpdate=!0,h=M,p=M.version,m=t.toneMapping),u.layers.enableAll(),T.unshift(u,u.geometry,u.material,0,0,null))}function y(T,A){T.getRGB(wf,MP(t)),n.buffers.color.setClear(wf.r,wf.g,wf.b,A,s)}function b(){d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0),u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0)}return{getClearColor:function(){return o},setClearColor:function(T,A=1){o.set(T),c=A,y(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(T){c=T,y(o,c)},render:_,addToRenderList:w,dispose:b}}function gj(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=m(null);let s=r,o=!1;function c(O,G,J,H,X){let K=!1;const Q=p(O,H,J,G);s!==Q&&(s=Q,d(s.object)),K=v(O,H,J,X),K&&_(O,H,J,X),X!==null&&e.update(X,t.ELEMENT_ARRAY_BUFFER),(K||o)&&(o=!1,M(O,G,J,H),X!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function u(){return t.createVertexArray()}function d(O){return t.bindVertexArray(O)}function h(O){return t.deleteVertexArray(O)}function p(O,G,J,H){const X=H.wireframe===!0;let K=i[G.id];K===void 0&&(K={},i[G.id]=K);const Q=O.isInstancedMesh===!0?O.id:0;let W=K[Q];W===void 0&&(W={},K[Q]=W);let q=W[J.id];q===void 0&&(q={},W[J.id]=q);let Z=q[X];return Z===void 0&&(Z=m(u()),q[X]=Z),Z}function m(O){const G=[],J=[],H=[];for(let X=0;X<n;X++)G[X]=0,J[X]=0,H[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:J,attributeDivisors:H,object:O,attributes:{},index:null}}function v(O,G,J,H){const X=s.attributes,K=G.attributes;let Q=0;const W=J.getAttributes();for(const q in W)if(W[q].location>=0){const z=X[q];let ie=K[q];if(ie===void 0&&(q==="instanceMatrix"&&O.instanceMatrix&&(ie=O.instanceMatrix),q==="instanceColor"&&O.instanceColor&&(ie=O.instanceColor)),z===void 0||z.attribute!==ie||ie&&z.data!==ie.data)return!0;Q++}return s.attributesNum!==Q||s.index!==H}function _(O,G,J,H){const X={},K=G.attributes;let Q=0;const W=J.getAttributes();for(const q in W)if(W[q].location>=0){let z=K[q];z===void 0&&(q==="instanceMatrix"&&O.instanceMatrix&&(z=O.instanceMatrix),q==="instanceColor"&&O.instanceColor&&(z=O.instanceColor));const ie={};ie.attribute=z,z&&z.data&&(ie.data=z.data),X[q]=ie,Q++}s.attributes=X,s.attributesNum=Q,s.index=H}function w(){const O=s.newAttributes;for(let G=0,J=O.length;G<J;G++)O[G]=0}function y(O){b(O,0)}function b(O,G){const J=s.newAttributes,H=s.enabledAttributes,X=s.attributeDivisors;J[O]=1,H[O]===0&&(t.enableVertexAttribArray(O),H[O]=1),X[O]!==G&&(t.vertexAttribDivisor(O,G),X[O]=G)}function T(){const O=s.newAttributes,G=s.enabledAttributes;for(let J=0,H=G.length;J<H;J++)G[J]!==O[J]&&(t.disableVertexAttribArray(J),G[J]=0)}function A(O,G,J,H,X,K,Q){Q===!0?t.vertexAttribIPointer(O,G,J,X,K):t.vertexAttribPointer(O,G,J,H,X,K)}function M(O,G,J,H){w();const X=H.attributes,K=J.getAttributes(),Q=G.defaultAttributeValues;for(const W in K){const q=K[W];if(q.location>=0){let Z=X[W];if(Z===void 0&&(W==="instanceMatrix"&&O.instanceMatrix&&(Z=O.instanceMatrix),W==="instanceColor"&&O.instanceColor&&(Z=O.instanceColor)),Z!==void 0){const z=Z.normalized,ie=Z.itemSize,Ee=e.get(Z);if(Ee===void 0)continue;const ze=Ee.buffer,Se=Ee.type,ne=Ee.bytesPerElement,ye=Se===t.INT||Se===t.UNSIGNED_INT||Z.gpuType===Zy;if(Z.isInterleavedBufferAttribute){const be=Z.data,Ne=be.stride,et=Z.offset;if(be.isInstancedInterleavedBuffer){for(let xt=0;xt<q.locationSize;xt++)b(q.location+xt,be.meshPerAttribute);O.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let xt=0;xt<q.locationSize;xt++)y(q.location+xt);t.bindBuffer(t.ARRAY_BUFFER,ze);for(let xt=0;xt<q.locationSize;xt++)A(q.location+xt,ie/q.locationSize,Se,z,Ne*ne,(et+ie/q.locationSize*xt)*ne,ye)}else{if(Z.isInstancedBufferAttribute){for(let be=0;be<q.locationSize;be++)b(q.location+be,Z.meshPerAttribute);O.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let be=0;be<q.locationSize;be++)y(q.location+be);t.bindBuffer(t.ARRAY_BUFFER,ze);for(let be=0;be<q.locationSize;be++)A(q.location+be,ie/q.locationSize,Se,z,ie*ne,ie/q.locationSize*be*ne,ye)}}else if(Q!==void 0){const z=Q[W];if(z!==void 0)switch(z.length){case 2:t.vertexAttrib2fv(q.location,z);break;case 3:t.vertexAttrib3fv(q.location,z);break;case 4:t.vertexAttrib4fv(q.location,z);break;default:t.vertexAttrib1fv(q.location,z)}}}}T()}function I(){P();for(const O in i){const G=i[O];for(const J in G){const H=G[J];for(const X in H){const K=H[X];for(const Q in K)h(K[Q].object),delete K[Q];delete H[X]}}delete i[O]}}function k(O){if(i[O.id]===void 0)return;const G=i[O.id];for(const J in G){const H=G[J];for(const X in H){const K=H[X];for(const Q in K)h(K[Q].object),delete K[Q];delete H[X]}}delete i[O.id]}function U(O){for(const G in i){const J=i[G];for(const H in J){const X=J[H];if(X[O.id]===void 0)continue;const K=X[O.id];for(const Q in K)h(K[Q].object),delete K[Q];delete X[O.id]}}}function S(O){for(const G in i){const J=i[G],H=O.isInstancedMesh===!0?O.id:0,X=J[H];if(X!==void 0){for(const K in X){const Q=X[K];for(const W in Q)h(Q[W].object),delete Q[W];delete X[K]}delete J[H],Object.keys(J).length===0&&delete i[G]}}}function P(){V(),o=!0,s!==r&&(s=r,d(s.object))}function V(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:c,reset:P,resetDefaultState:V,dispose:I,releaseStatesOfGeometry:k,releaseStatesOfObject:S,releaseStatesOfProgram:U,initAttributes:w,enableAttribute:y,disableUnusedAttributes:T}}function vj(t,e,n){let i;function r(d){i=d}function s(d,h){t.drawArrays(i,d,h),n.update(h,i,1)}function o(d,h,p){p!==0&&(t.drawArraysInstanced(i,d,h,p),n.update(h,i,p))}function c(d,h,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,d,0,h,0,p);let v=0;for(let _=0;_<p;_++)v+=h[_];n.update(v,i,1)}function u(d,h,p,m){if(p===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let _=0;_<d.length;_++)o(d[_],h[_],m[_]);else{v.multiDrawArraysInstancedWEBGL(i,d,0,h,0,m,0,p);let _=0;for(let w=0;w<p;w++)_+=h[w]*m[w];n.update(_,i,1)}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=c,this.renderMultiDrawInstances=u}function yj(t,e,n,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const U=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(U.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(U){return!(U!==Fr&&i.convert(U)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(U){const S=U===Hs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(U!==fr&&i.convert(U)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&U!==Qr&&!S)}function u(U){if(U==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=n.precision!==void 0?n.precision:"highp";const h=u(d);h!==d&&(Gt("WebGLRenderer:",d,"not supported, using",h,"instead."),d=h);const p=n.logarithmicDepthBuffer===!0,m=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=t.getParameter(t.MAX_TEXTURE_SIZE),y=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),b=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),A=t.getParameter(t.MAX_VARYING_VECTORS),M=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),I=t.getParameter(t.MAX_SAMPLES),k=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:c,precision:d,logarithmicDepthBuffer:p,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:w,maxCubemapSize:y,maxAttributes:b,maxVertexUniforms:T,maxVaryings:A,maxFragmentUniforms:M,maxSamples:I,samples:k}}function _j(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new oo,c=new Wt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(p,m){const v=p.length!==0||m||i!==0||r;return r=m,i=p.length,v},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,m){n=h(p,m,0)},this.setState=function(p,m,v){const _=p.clippingPlanes,w=p.clipIntersection,y=p.clipShadows,b=t.get(p);if(!r||_===null||_.length===0||s&&!y)s?h(null):d();else{const T=s?0:i,A=T*4;let M=b.clippingState||null;u.value=M,M=h(_,m,A,v);for(let I=0;I!==A;++I)M[I]=n[I];b.clippingState=M,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=T}};function d(){u.value!==n&&(u.value=n,u.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(p,m,v,_){const w=p!==null?p.length:0;let y=null;if(w!==0){if(y=u.value,_!==!0||y===null){const b=v+w*4,T=m.matrixWorldInverse;c.getNormalMatrix(T),(y===null||y.length<b)&&(y=new Float32Array(b));for(let A=0,M=v;A!==w;++A,M+=4)o.copy(p[A]).applyMatrix4(T,c),o.normal.toArray(y,M),y[M+3]=o.constant}u.value=y,u.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,y}}const ka=4,X1=[.125,.215,.35,.446,.526,.582],co=20,xj=256,qc=new o_,q1=new Tn;let Ig=null,Ug=0,Fg=0,Og=!1;const bj=new me;class Y1{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,i=.1,r=100,s={}){const{size:o=256,position:c=bj}=s;Ig=this._renderer.getRenderTarget(),Ug=this._renderer.getActiveCubeFace(),Fg=this._renderer.getActiveMipmapLevel(),Og=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,i,r,u,c),n>0&&this._blur(u,0,0,n),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=J1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Z1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Ig,Ug,Fg),this._renderer.xr.enabled=Og,e.scissorTest=!1,Sl(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===To||e.mapping===Wl?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ig=this._renderer.getRenderTarget(),Ug=this._renderer.getActiveCubeFace(),Fg=this._renderer.getActiveMipmapLevel(),Og=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:wi,minFilter:wi,generateMipmaps:!1,type:Hs,format:Fr,colorSpace:Ao,depthBuffer:!1},r=K1(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=K1(e,n,i);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Sj(s)),this._blurMaterial=Ej(s,e,n),this._ggxMaterial=wj(s,e,n)}return r}_compileMaterial(e){const n=new ds(new gs,e);this._renderer.compile(n,qc)}_sceneToCubeUV(e,n,i,r,s){const u=new Ur(90,1,n,i),d=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],p=this._renderer,m=p.autoClear,v=p.toneMapping;p.getClearColor(q1),p.toneMapping=is,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(r),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new ds(new Bu,new bP({name:"PMREM.Background",side:Gi,depthWrite:!1,depthTest:!1})));const w=this._backgroundBox,y=w.material;let b=!1;const T=e.background;T?T.isColor&&(y.color.copy(T),e.background=null,b=!0):(y.color.copy(q1),b=!0);for(let A=0;A<6;A++){const M=A%3;M===0?(u.up.set(0,d[A],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x+h[A],s.y,s.z)):M===1?(u.up.set(0,0,d[A]),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y+h[A],s.z)):(u.up.set(0,d[A],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y,s.z+h[A]));const I=this._cubeSize;Sl(r,M*I,A>2?I:0,I,I),p.setRenderTarget(r),b&&p.render(w,u),p.render(e,u)}p.toneMapping=v,p.autoClear=m,e.background=T}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===To||e.mapping===Wl;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=J1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Z1());const s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const c=s.uniforms;c.envMap.value=e;const u=this._cubeSize;Sl(n,0,0,3*u,2*u),i.setRenderTarget(n),i.render(o,qc)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);n.autoClear=i}_applyGGXFilter(e,n,i){const r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,c=this._lodMeshes[i];c.material=o;const u=o.uniforms,d=i/(this._lodMeshes.length-1),h=n/(this._lodMeshes.length-1),p=Math.sqrt(d*d-h*h),m=0+d*1.25,v=p*m,{_lodMax:_}=this,w=this._sizeLods[i],y=3*w*(i>_-ka?i-_+ka:0),b=4*(this._cubeSize-w);u.envMap.value=e.texture,u.roughness.value=v,u.mipInt.value=_-n,Sl(s,y,b,3*w,2*w),r.setRenderTarget(s),r.render(c,qc),u.envMap.value=s.texture,u.roughness.value=0,u.mipInt.value=_-i,Sl(e,y,b,3*w,2*w),r.setRenderTarget(e),r.render(c,qc)}_blur(e,n,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,n,i,r,s,o,c){const u=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&_n("blur direction must be either latitudinal or longitudinal!");const h=3,p=this._lodMeshes[r];p.material=d;const m=d.uniforms,v=this._sizeLods[i]-1,_=isFinite(s)?Math.PI/(2*v):2*Math.PI/(2*co-1),w=s/_,y=isFinite(s)?1+Math.floor(h*w):co;y>co&&Gt(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${co}`);const b=[];let T=0;for(let U=0;U<co;++U){const S=U/w,P=Math.exp(-S*S/2);b.push(P),U===0?T+=P:U<y&&(T+=2*P)}for(let U=0;U<b.length;U++)b[U]=b[U]/T;m.envMap.value=e.texture,m.samples.value=y,m.weights.value=b,m.latitudinal.value=o==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:A}=this;m.dTheta.value=_,m.mipInt.value=A-i;const M=this._sizeLods[r],I=3*M*(r>A-ka?r-A+ka:0),k=4*(this._cubeSize-M);Sl(n,I,k,3*M,2*M),u.setRenderTarget(n),u.render(p,qc)}}function Sj(t){const e=[],n=[],i=[];let r=t;const s=t-ka+1+X1.length;for(let o=0;o<s;o++){const c=Math.pow(2,r);e.push(c);let u=1/c;o>t-ka?u=X1[o-t+ka-1]:o===0&&(u=0),n.push(u);const d=1/(c-2),h=-d,p=1+d,m=[h,h,p,h,p,p,h,h,p,p,h,p],v=6,_=6,w=3,y=2,b=1,T=new Float32Array(w*_*v),A=new Float32Array(y*_*v),M=new Float32Array(b*_*v);for(let k=0;k<v;k++){const U=k%3*2/3-1,S=k>2?0:-1,P=[U,S,0,U+2/3,S,0,U+2/3,S+1,0,U,S,0,U+2/3,S+1,0,U,S+1,0];T.set(P,w*_*k),A.set(m,y*_*k);const V=[k,k,k,k,k,k];M.set(V,b*_*k)}const I=new gs;I.setAttribute("position",new Vr(T,w)),I.setAttribute("uv",new Vr(A,y)),I.setAttribute("faceIndex",new Vr(M,b)),i.push(new ds(I,null)),r>ka&&r--}return{lodMeshes:i,sizeLods:e,sigmas:n}}function K1(t,e,n){const i=new rs(t,e,n);return i.texture.mapping=Hh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Sl(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function wj(t,e,n){return new fs({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:xj,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Wh(),fragmentShader:`
|
|
4222
|
+
}`,Xt={alphahash_fragment:I6,alphahash_pars_fragment:U6,alphamap_fragment:F6,alphamap_pars_fragment:O6,alphatest_fragment:B6,alphatest_pars_fragment:z6,aomap_fragment:V6,aomap_pars_fragment:H6,batching_pars_vertex:G6,batching_vertex:j6,begin_vertex:W6,beginnormal_vertex:$6,bsdfs:X6,iridescence_fragment:q6,bumpmap_pars_fragment:Y6,clipping_planes_fragment:K6,clipping_planes_pars_fragment:Z6,clipping_planes_pars_vertex:J6,clipping_planes_vertex:Q6,color_fragment:e8,color_pars_fragment:t8,color_pars_vertex:n8,color_vertex:i8,common:r8,cube_uv_reflection_fragment:s8,defaultnormal_vertex:a8,displacementmap_pars_vertex:o8,displacementmap_vertex:l8,emissivemap_fragment:c8,emissivemap_pars_fragment:u8,colorspace_fragment:d8,colorspace_pars_fragment:f8,envmap_fragment:h8,envmap_common_pars_fragment:p8,envmap_pars_fragment:m8,envmap_pars_vertex:g8,envmap_physical_pars_fragment:A8,envmap_vertex:v8,fog_vertex:y8,fog_pars_vertex:_8,fog_fragment:x8,fog_pars_fragment:b8,gradientmap_pars_fragment:S8,lightmap_pars_fragment:w8,lights_lambert_fragment:E8,lights_lambert_pars_fragment:M8,lights_pars_begin:T8,lights_toon_fragment:C8,lights_toon_pars_fragment:P8,lights_phong_fragment:R8,lights_phong_pars_fragment:k8,lights_physical_fragment:L8,lights_physical_pars_fragment:D8,lights_fragment_begin:N8,lights_fragment_maps:I8,lights_fragment_end:U8,logdepthbuf_fragment:F8,logdepthbuf_pars_fragment:O8,logdepthbuf_pars_vertex:B8,logdepthbuf_vertex:z8,map_fragment:V8,map_pars_fragment:H8,map_particle_fragment:G8,map_particle_pars_fragment:j8,metalnessmap_fragment:W8,metalnessmap_pars_fragment:$8,morphinstance_vertex:X8,morphcolor_vertex:q8,morphnormal_vertex:Y8,morphtarget_pars_vertex:K8,morphtarget_vertex:Z8,normal_fragment_begin:J8,normal_fragment_maps:Q8,normal_pars_fragment:eG,normal_pars_vertex:tG,normal_vertex:nG,normalmap_pars_fragment:iG,clearcoat_normal_fragment_begin:rG,clearcoat_normal_fragment_maps:sG,clearcoat_pars_fragment:aG,iridescence_pars_fragment:oG,opaque_fragment:lG,packing:cG,premultiplied_alpha_fragment:uG,project_vertex:dG,dithering_fragment:fG,dithering_pars_fragment:hG,roughnessmap_fragment:pG,roughnessmap_pars_fragment:mG,shadowmap_pars_fragment:gG,shadowmap_pars_vertex:vG,shadowmap_vertex:yG,shadowmask_pars_fragment:_G,skinbase_vertex:xG,skinning_pars_vertex:bG,skinning_vertex:SG,skinnormal_vertex:wG,specularmap_fragment:EG,specularmap_pars_fragment:MG,tonemapping_fragment:TG,tonemapping_pars_fragment:AG,transmission_fragment:CG,transmission_pars_fragment:PG,uv_pars_fragment:RG,uv_pars_vertex:kG,uv_vertex:LG,worldpos_vertex:DG,background_vert:NG,background_frag:IG,backgroundCube_vert:UG,backgroundCube_frag:FG,cube_vert:OG,cube_frag:BG,depth_vert:zG,depth_frag:VG,distance_vert:HG,distance_frag:GG,equirect_vert:jG,equirect_frag:WG,linedashed_vert:$G,linedashed_frag:XG,meshbasic_vert:qG,meshbasic_frag:YG,meshlambert_vert:KG,meshlambert_frag:ZG,meshmatcap_vert:JG,meshmatcap_frag:QG,meshnormal_vert:ej,meshnormal_frag:tj,meshphong_vert:nj,meshphong_frag:ij,meshphysical_vert:rj,meshphysical_frag:sj,meshtoon_vert:aj,meshtoon_frag:oj,points_vert:lj,points_frag:cj,shadow_vert:uj,shadow_frag:dj,sprite_vert:fj,sprite_frag:hj},Ye={common:{diffuse:{value:new Tn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Wt},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Wt}},envmap:{envMap:{value:null},envMapRotation:{value:new Wt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Wt},normalScale:{value:new bn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Wt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Tn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},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 Tn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0},uvTransform:{value:new Wt}},sprite:{diffuse:{value:new Tn(16777215)},opacity:{value:1},center:{value:new bn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Wt},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0}}},Zr={basic:{uniforms:Ci([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.fog]),vertexShader:Xt.meshbasic_vert,fragmentShader:Xt.meshbasic_frag},lambert:{uniforms:Ci([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)},envMapIntensity:{value:1}}]),vertexShader:Xt.meshlambert_vert,fragmentShader:Xt.meshlambert_frag},phong:{uniforms:Ci([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)},specular:{value:new Tn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Xt.meshphong_vert,fragmentShader:Xt.meshphong_frag},standard:{uniforms:Ci([Ye.common,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.roughnessmap,Ye.metalnessmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Xt.meshphysical_vert,fragmentShader:Xt.meshphysical_frag},toon:{uniforms:Ci([Ye.common,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.gradientmap,Ye.fog,Ye.lights,{emissive:{value:new Tn(0)}}]),vertexShader:Xt.meshtoon_vert,fragmentShader:Xt.meshtoon_frag},matcap:{uniforms:Ci([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,{matcap:{value:null}}]),vertexShader:Xt.meshmatcap_vert,fragmentShader:Xt.meshmatcap_frag},points:{uniforms:Ci([Ye.points,Ye.fog]),vertexShader:Xt.points_vert,fragmentShader:Xt.points_frag},dashed:{uniforms:Ci([Ye.common,Ye.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Xt.linedashed_vert,fragmentShader:Xt.linedashed_frag},depth:{uniforms:Ci([Ye.common,Ye.displacementmap]),vertexShader:Xt.depth_vert,fragmentShader:Xt.depth_frag},normal:{uniforms:Ci([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,{opacity:{value:1}}]),vertexShader:Xt.meshnormal_vert,fragmentShader:Xt.meshnormal_frag},sprite:{uniforms:Ci([Ye.sprite,Ye.fog]),vertexShader:Xt.sprite_vert,fragmentShader:Xt.sprite_frag},background:{uniforms:{uvTransform:{value:new Wt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Xt.background_vert,fragmentShader:Xt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Wt}},vertexShader:Xt.backgroundCube_vert,fragmentShader:Xt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Xt.cube_vert,fragmentShader:Xt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Xt.equirect_vert,fragmentShader:Xt.equirect_frag},distance:{uniforms:Ci([Ye.common,Ye.displacementmap,{referencePosition:{value:new me},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Xt.distance_vert,fragmentShader:Xt.distance_frag},shadow:{uniforms:Ci([Ye.lights,Ye.fog,{color:{value:new Tn(0)},opacity:{value:1}}]),vertexShader:Xt.shadow_vert,fragmentShader:Xt.shadow_frag}};Zr.physical={uniforms:Ci([Zr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Wt},clearcoatNormalScale:{value:new bn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Wt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Wt},sheen:{value:0},sheenColor:{value:new Tn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Wt},transmissionSamplerSize:{value:new bn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Wt},attenuationDistance:{value:0},attenuationColor:{value:new Tn(0)},specularColor:{value:new Tn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Wt},anisotropyVector:{value:new bn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Wt}}]),vertexShader:Xt.meshphysical_vert,fragmentShader:Xt.meshphysical_frag};const wf={r:0,b:0,g:0},ro=new Co,pj=new Kn;function mj(t,e,n,i,r,s){const o=new Tn(0);let c=r===!0?0:1,u,d,h=null,p=0,m=null;function v(T){let A=T.isScene===!0?T.background:null;if(A&&A.isTexture){const M=T.backgroundBlurriness>0;A=e.get(A,M)}return A}function _(T){let A=!1;const M=v(T);M===null?y(o,c):M&&M.isColor&&(y(M,1),A=!0);const I=t.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,s):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,s),(t.autoClear||A)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(T,A){const M=v(A);M&&(M.isCubeTexture||M.mapping===Hh)?(d===void 0&&(d=new ds(new Bu(1,1,1),new fs({name:"BackgroundCubeMaterial",uniforms:Xl(Zr.backgroundCube.uniforms),vertexShader:Zr.backgroundCube.vertexShader,fragmentShader:Zr.backgroundCube.fragmentShader,side:Gi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(I,k,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),ro.copy(A.backgroundRotation),ro.x*=-1,ro.y*=-1,ro.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(ro.y*=-1,ro.z*=-1),d.material.uniforms.envMap.value=M,d.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(pj.makeRotationFromEuler(ro)),d.material.toneMapped=fn.getTransfer(M.colorSpace)!==wn,(h!==M||p!==M.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,h=M,p=M.version,m=t.toneMapping),d.layers.enableAll(),T.unshift(d,d.geometry,d.material,0,0,null)):M&&M.isTexture&&(u===void 0&&(u=new ds(new jh(2,2),new fs({name:"BackgroundMaterial",uniforms:Xl(Zr.background.uniforms),vertexShader:Zr.background.vertexShader,fragmentShader:Zr.background.fragmentShader,side:Ua,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(u)),u.material.uniforms.t2D.value=M,u.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,u.material.toneMapped=fn.getTransfer(M.colorSpace)!==wn,M.matrixAutoUpdate===!0&&M.updateMatrix(),u.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||p!==M.version||m!==t.toneMapping)&&(u.material.needsUpdate=!0,h=M,p=M.version,m=t.toneMapping),u.layers.enableAll(),T.unshift(u,u.geometry,u.material,0,0,null))}function y(T,A){T.getRGB(wf,MP(t)),n.buffers.color.setClear(wf.r,wf.g,wf.b,A,s)}function b(){d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0),u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0)}return{getClearColor:function(){return o},setClearColor:function(T,A=1){o.set(T),c=A,y(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(T){c=T,y(o,c)},render:_,addToRenderList:w,dispose:b}}function gj(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=m(null);let s=r,o=!1;function c(O,G,J,H,X){let K=!1;const Q=p(O,H,J,G);s!==Q&&(s=Q,d(s.object)),K=v(O,H,J,X),K&&_(O,H,J,X),X!==null&&e.update(X,t.ELEMENT_ARRAY_BUFFER),(K||o)&&(o=!1,M(O,G,J,H),X!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function u(){return t.createVertexArray()}function d(O){return t.bindVertexArray(O)}function h(O){return t.deleteVertexArray(O)}function p(O,G,J,H){const X=H.wireframe===!0;let K=i[G.id];K===void 0&&(K={},i[G.id]=K);const Q=O.isInstancedMesh===!0?O.id:0;let W=K[Q];W===void 0&&(W={},K[Q]=W);let q=W[J.id];q===void 0&&(q={},W[J.id]=q);let Z=q[X];return Z===void 0&&(Z=m(u()),q[X]=Z),Z}function m(O){const G=[],J=[],H=[];for(let X=0;X<n;X++)G[X]=0,J[X]=0,H[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:J,attributeDivisors:H,object:O,attributes:{},index:null}}function v(O,G,J,H){const X=s.attributes,K=G.attributes;let Q=0;const W=J.getAttributes();for(const q in W)if(W[q].location>=0){const z=X[q];let ie=K[q];if(ie===void 0&&(q==="instanceMatrix"&&O.instanceMatrix&&(ie=O.instanceMatrix),q==="instanceColor"&&O.instanceColor&&(ie=O.instanceColor)),z===void 0||z.attribute!==ie||ie&&z.data!==ie.data)return!0;Q++}return s.attributesNum!==Q||s.index!==H}function _(O,G,J,H){const X={},K=G.attributes;let Q=0;const W=J.getAttributes();for(const q in W)if(W[q].location>=0){let z=K[q];z===void 0&&(q==="instanceMatrix"&&O.instanceMatrix&&(z=O.instanceMatrix),q==="instanceColor"&&O.instanceColor&&(z=O.instanceColor));const ie={};ie.attribute=z,z&&z.data&&(ie.data=z.data),X[q]=ie,Q++}s.attributes=X,s.attributesNum=Q,s.index=H}function w(){const O=s.newAttributes;for(let G=0,J=O.length;G<J;G++)O[G]=0}function y(O){b(O,0)}function b(O,G){const J=s.newAttributes,H=s.enabledAttributes,X=s.attributeDivisors;J[O]=1,H[O]===0&&(t.enableVertexAttribArray(O),H[O]=1),X[O]!==G&&(t.vertexAttribDivisor(O,G),X[O]=G)}function T(){const O=s.newAttributes,G=s.enabledAttributes;for(let J=0,H=G.length;J<H;J++)G[J]!==O[J]&&(t.disableVertexAttribArray(J),G[J]=0)}function A(O,G,J,H,X,K,Q){Q===!0?t.vertexAttribIPointer(O,G,J,X,K):t.vertexAttribPointer(O,G,J,H,X,K)}function M(O,G,J,H){w();const X=H.attributes,K=J.getAttributes(),Q=G.defaultAttributeValues;for(const W in K){const q=K[W];if(q.location>=0){let Z=X[W];if(Z===void 0&&(W==="instanceMatrix"&&O.instanceMatrix&&(Z=O.instanceMatrix),W==="instanceColor"&&O.instanceColor&&(Z=O.instanceColor)),Z!==void 0){const z=Z.normalized,ie=Z.itemSize,we=e.get(Z);if(we===void 0)continue;const He=we.buffer,Se=we.type,ne=we.bytesPerElement,ye=Se===t.INT||Se===t.UNSIGNED_INT||Z.gpuType===Zy;if(Z.isInterleavedBufferAttribute){const be=Z.data,Ne=be.stride,et=Z.offset;if(be.isInstancedInterleavedBuffer){for(let xt=0;xt<q.locationSize;xt++)b(q.location+xt,be.meshPerAttribute);O.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let xt=0;xt<q.locationSize;xt++)y(q.location+xt);t.bindBuffer(t.ARRAY_BUFFER,He);for(let xt=0;xt<q.locationSize;xt++)A(q.location+xt,ie/q.locationSize,Se,z,Ne*ne,(et+ie/q.locationSize*xt)*ne,ye)}else{if(Z.isInstancedBufferAttribute){for(let be=0;be<q.locationSize;be++)b(q.location+be,Z.meshPerAttribute);O.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let be=0;be<q.locationSize;be++)y(q.location+be);t.bindBuffer(t.ARRAY_BUFFER,He);for(let be=0;be<q.locationSize;be++)A(q.location+be,ie/q.locationSize,Se,z,ie*ne,ie/q.locationSize*be*ne,ye)}}else if(Q!==void 0){const z=Q[W];if(z!==void 0)switch(z.length){case 2:t.vertexAttrib2fv(q.location,z);break;case 3:t.vertexAttrib3fv(q.location,z);break;case 4:t.vertexAttrib4fv(q.location,z);break;default:t.vertexAttrib1fv(q.location,z)}}}}T()}function I(){P();for(const O in i){const G=i[O];for(const J in G){const H=G[J];for(const X in H){const K=H[X];for(const Q in K)h(K[Q].object),delete K[Q];delete H[X]}}delete i[O]}}function k(O){if(i[O.id]===void 0)return;const G=i[O.id];for(const J in G){const H=G[J];for(const X in H){const K=H[X];for(const Q in K)h(K[Q].object),delete K[Q];delete H[X]}}delete i[O.id]}function U(O){for(const G in i){const J=i[G];for(const H in J){const X=J[H];if(X[O.id]===void 0)continue;const K=X[O.id];for(const Q in K)h(K[Q].object),delete K[Q];delete X[O.id]}}}function S(O){for(const G in i){const J=i[G],H=O.isInstancedMesh===!0?O.id:0,X=J[H];if(X!==void 0){for(const K in X){const Q=X[K];for(const W in Q)h(Q[W].object),delete Q[W];delete X[K]}delete J[H],Object.keys(J).length===0&&delete i[G]}}}function P(){V(),o=!0,s!==r&&(s=r,d(s.object))}function V(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:c,reset:P,resetDefaultState:V,dispose:I,releaseStatesOfGeometry:k,releaseStatesOfObject:S,releaseStatesOfProgram:U,initAttributes:w,enableAttribute:y,disableUnusedAttributes:T}}function vj(t,e,n){let i;function r(d){i=d}function s(d,h){t.drawArrays(i,d,h),n.update(h,i,1)}function o(d,h,p){p!==0&&(t.drawArraysInstanced(i,d,h,p),n.update(h,i,p))}function c(d,h,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,d,0,h,0,p);let v=0;for(let _=0;_<p;_++)v+=h[_];n.update(v,i,1)}function u(d,h,p,m){if(p===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let _=0;_<d.length;_++)o(d[_],h[_],m[_]);else{v.multiDrawArraysInstancedWEBGL(i,d,0,h,0,m,0,p);let _=0;for(let w=0;w<p;w++)_+=h[w]*m[w];n.update(_,i,1)}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=c,this.renderMultiDrawInstances=u}function yj(t,e,n,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const U=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(U.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(U){return!(U!==Fr&&i.convert(U)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(U){const S=U===Hs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(U!==fr&&i.convert(U)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&U!==Qr&&!S)}function u(U){if(U==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=n.precision!==void 0?n.precision:"highp";const h=u(d);h!==d&&(Gt("WebGLRenderer:",d,"not supported, using",h,"instead."),d=h);const p=n.logarithmicDepthBuffer===!0,m=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=t.getParameter(t.MAX_TEXTURE_SIZE),y=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),b=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),A=t.getParameter(t.MAX_VARYING_VECTORS),M=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),I=t.getParameter(t.MAX_SAMPLES),k=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:c,precision:d,logarithmicDepthBuffer:p,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:w,maxCubemapSize:y,maxAttributes:b,maxVertexUniforms:T,maxVaryings:A,maxFragmentUniforms:M,maxSamples:I,samples:k}}function _j(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new oo,c=new Wt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(p,m){const v=p.length!==0||m||i!==0||r;return r=m,i=p.length,v},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,m){n=h(p,m,0)},this.setState=function(p,m,v){const _=p.clippingPlanes,w=p.clipIntersection,y=p.clipShadows,b=t.get(p);if(!r||_===null||_.length===0||s&&!y)s?h(null):d();else{const T=s?0:i,A=T*4;let M=b.clippingState||null;u.value=M,M=h(_,m,A,v);for(let I=0;I!==A;++I)M[I]=n[I];b.clippingState=M,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=T}};function d(){u.value!==n&&(u.value=n,u.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(p,m,v,_){const w=p!==null?p.length:0;let y=null;if(w!==0){if(y=u.value,_!==!0||y===null){const b=v+w*4,T=m.matrixWorldInverse;c.getNormalMatrix(T),(y===null||y.length<b)&&(y=new Float32Array(b));for(let A=0,M=v;A!==w;++A,M+=4)o.copy(p[A]).applyMatrix4(T,c),o.normal.toArray(y,M),y[M+3]=o.constant}u.value=y,u.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,y}}const ka=4,X1=[.125,.215,.35,.446,.526,.582],co=20,xj=256,qc=new o_,q1=new Tn;let Ig=null,Ug=0,Fg=0,Og=!1;const bj=new me;class Y1{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,i=.1,r=100,s={}){const{size:o=256,position:c=bj}=s;Ig=this._renderer.getRenderTarget(),Ug=this._renderer.getActiveCubeFace(),Fg=this._renderer.getActiveMipmapLevel(),Og=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,i,r,u,c),n>0&&this._blur(u,0,0,n),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=J1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Z1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Ig,Ug,Fg),this._renderer.xr.enabled=Og,e.scissorTest=!1,Sl(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===To||e.mapping===Wl?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ig=this._renderer.getRenderTarget(),Ug=this._renderer.getActiveCubeFace(),Fg=this._renderer.getActiveMipmapLevel(),Og=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:wi,minFilter:wi,generateMipmaps:!1,type:Hs,format:Fr,colorSpace:Ao,depthBuffer:!1},r=K1(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=K1(e,n,i);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Sj(s)),this._blurMaterial=Ej(s,e,n),this._ggxMaterial=wj(s,e,n)}return r}_compileMaterial(e){const n=new ds(new gs,e);this._renderer.compile(n,qc)}_sceneToCubeUV(e,n,i,r,s){const u=new Ur(90,1,n,i),d=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],p=this._renderer,m=p.autoClear,v=p.toneMapping;p.getClearColor(q1),p.toneMapping=is,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(r),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new ds(new Bu,new bP({name:"PMREM.Background",side:Gi,depthWrite:!1,depthTest:!1})));const w=this._backgroundBox,y=w.material;let b=!1;const T=e.background;T?T.isColor&&(y.color.copy(T),e.background=null,b=!0):(y.color.copy(q1),b=!0);for(let A=0;A<6;A++){const M=A%3;M===0?(u.up.set(0,d[A],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x+h[A],s.y,s.z)):M===1?(u.up.set(0,0,d[A]),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y+h[A],s.z)):(u.up.set(0,d[A],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y,s.z+h[A]));const I=this._cubeSize;Sl(r,M*I,A>2?I:0,I,I),p.setRenderTarget(r),b&&p.render(w,u),p.render(e,u)}p.toneMapping=v,p.autoClear=m,e.background=T}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===To||e.mapping===Wl;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=J1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Z1());const s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const c=s.uniforms;c.envMap.value=e;const u=this._cubeSize;Sl(n,0,0,3*u,2*u),i.setRenderTarget(n),i.render(o,qc)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);n.autoClear=i}_applyGGXFilter(e,n,i){const r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,c=this._lodMeshes[i];c.material=o;const u=o.uniforms,d=i/(this._lodMeshes.length-1),h=n/(this._lodMeshes.length-1),p=Math.sqrt(d*d-h*h),m=0+d*1.25,v=p*m,{_lodMax:_}=this,w=this._sizeLods[i],y=3*w*(i>_-ka?i-_+ka:0),b=4*(this._cubeSize-w);u.envMap.value=e.texture,u.roughness.value=v,u.mipInt.value=_-n,Sl(s,y,b,3*w,2*w),r.setRenderTarget(s),r.render(c,qc),u.envMap.value=s.texture,u.roughness.value=0,u.mipInt.value=_-i,Sl(e,y,b,3*w,2*w),r.setRenderTarget(e),r.render(c,qc)}_blur(e,n,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,n,i,r,s,o,c){const u=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&_n("blur direction must be either latitudinal or longitudinal!");const h=3,p=this._lodMeshes[r];p.material=d;const m=d.uniforms,v=this._sizeLods[i]-1,_=isFinite(s)?Math.PI/(2*v):2*Math.PI/(2*co-1),w=s/_,y=isFinite(s)?1+Math.floor(h*w):co;y>co&&Gt(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${co}`);const b=[];let T=0;for(let U=0;U<co;++U){const S=U/w,P=Math.exp(-S*S/2);b.push(P),U===0?T+=P:U<y&&(T+=2*P)}for(let U=0;U<b.length;U++)b[U]=b[U]/T;m.envMap.value=e.texture,m.samples.value=y,m.weights.value=b,m.latitudinal.value=o==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:A}=this;m.dTheta.value=_,m.mipInt.value=A-i;const M=this._sizeLods[r],I=3*M*(r>A-ka?r-A+ka:0),k=4*(this._cubeSize-M);Sl(n,I,k,3*M,2*M),u.setRenderTarget(n),u.render(p,qc)}}function Sj(t){const e=[],n=[],i=[];let r=t;const s=t-ka+1+X1.length;for(let o=0;o<s;o++){const c=Math.pow(2,r);e.push(c);let u=1/c;o>t-ka?u=X1[o-t+ka-1]:o===0&&(u=0),n.push(u);const d=1/(c-2),h=-d,p=1+d,m=[h,h,p,h,p,p,h,h,p,p,h,p],v=6,_=6,w=3,y=2,b=1,T=new Float32Array(w*_*v),A=new Float32Array(y*_*v),M=new Float32Array(b*_*v);for(let k=0;k<v;k++){const U=k%3*2/3-1,S=k>2?0:-1,P=[U,S,0,U+2/3,S,0,U+2/3,S+1,0,U,S,0,U+2/3,S+1,0,U,S+1,0];T.set(P,w*_*k),A.set(m,y*_*k);const V=[k,k,k,k,k,k];M.set(V,b*_*k)}const I=new gs;I.setAttribute("position",new Vr(T,w)),I.setAttribute("uv",new Vr(A,y)),I.setAttribute("faceIndex",new Vr(M,b)),i.push(new ds(I,null)),r>ka&&r--}return{lodMeshes:i,sizeLods:e,sigmas:n}}function K1(t,e,n){const i=new rs(t,e,n);return i.texture.mapping=Hh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Sl(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function wj(t,e,n){return new fs({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:xj,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Wh(),fragmentShader:`
|
|
4222
4223
|
|
|
4223
4224
|
precision highp float;
|
|
4224
4225
|
precision highp int;
|
|
@@ -4604,7 +4605,7 @@ Material Type: `+O.type+`
|
|
|
4604
4605
|
|
|
4605
4606
|
Program Info Log: `+X+`
|
|
4606
4607
|
`+Z+`
|
|
4607
|
-
`+z)}else X!==""?Gt("WebGLProgram: Program Info Log:",X):(K===""||Q==="")&&(q=!1);q&&(O.diagnostics={runnable:W,programLog:X,vertexShader:{log:K,prefix:y},fragmentShader:{log:Q,prefix:b}})}r.deleteShader(I),r.deleteShader(k),S=new Yf(r,w),P=N9(r,w)}let S;this.getUniforms=function(){return S===void 0&&U(this),S};let P;this.getAttributes=function(){return P===void 0&&U(this),P};let V=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=r.getProgramParameter(w,E9)),V},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=M9++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=I,this.fragmentShader=k,this}let K9=0;class Z9{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(n),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 n=this.materialCache.get(e);for(const i of n)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 n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new J9(e),n.set(e,i)),i}}class J9{constructor(e){this.id=K9++,this.code=e,this.usedTimes=0}}function Q9(t,e,n,i,r,s){const o=new vP,c=new Z9,u=new Set,d=[],h=new Map,p=i.logarithmicDepthBuffer;let m=i.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 _(S){return u.add(S),S===0?"uv":`uv${S}`}function w(S,P,V,O,G){const J=O.fog,H=G.geometry,X=S.isMeshStandardMaterial||S.isMeshLambertMaterial||S.isMeshPhongMaterial?O.environment:null,K=S.isMeshStandardMaterial||S.isMeshLambertMaterial&&!S.envMap||S.isMeshPhongMaterial&&!S.envMap,Q=e.get(S.envMap||X,K),W=Q&&Q.mapping===Hh?Q.image.height:null,q=v[S.type];S.precision!==null&&(m=i.getMaxPrecision(S.precision),m!==S.precision&&Gt("WebGLProgram.getParameters:",S.precision,"not supported, using",m,"instead."));const Z=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,z=Z!==void 0?Z.length:0;let ie=0;H.morphAttributes.position!==void 0&&(ie=1),H.morphAttributes.normal!==void 0&&(ie=2),H.morphAttributes.color!==void 0&&(ie=3);let Ee,ze,Se,ne;if(q){const Kt=Zr[q];Ee=Kt.vertexShader,ze=Kt.fragmentShader}else Ee=S.vertexShader,ze=S.fragmentShader,c.update(S),Se=c.getVertexShaderID(S),ne=c.getFragmentShaderID(S);const ye=t.getRenderTarget(),be=t.state.buffers.depth.getReversed(),Ne=G.isInstancedMesh===!0,et=G.isBatchedMesh===!0,xt=!!S.map,pn=!!S.matcap,ht=!!Q,Ft=!!S.aoMap,nn=!!S.lightMap,Dt=!!S.bumpMap,an=!!S.normalMap,ee=!!S.displacementMap,Sn=!!S.emissiveMap,At=!!S.metalnessMap,Lt=!!S.roughnessMap,it=S.anisotropy>0,B=S.clearcoat>0,R=S.dispersion>0,se=S.iridescence>0,xe=S.sheen>0,we=S.transmission>0,ve=it&&!!S.anisotropyMap,Ke=B&&!!S.clearcoatMap,ke=B&&!!S.clearcoatNormalMap,pt=B&&!!S.clearcoatRoughnessMap,Pt=se&&!!S.iridescenceMap,Pe=se&&!!S.iridescenceThicknessMap,Oe=xe&&!!S.sheenColorMap,Ze=xe&&!!S.sheenRoughnessMap,rt=!!S.specularMap,$e=!!S.specularColorMap,Ht=!!S.specularIntensityMap,re=we&&!!S.transmissionMap,Ve=we&&!!S.thicknessMap,Le=!!S.gradientMap,Xe=!!S.alphaMap,Re=S.alphaTest>0,_e=!!S.alphaHash,st=!!S.extensions;let Nt=is;S.toneMapped&&(ye===null||ye.isXRRenderTarget===!0)&&(Nt=t.toneMapping);const mn={shaderID:q,shaderType:S.type,shaderName:S.name,vertexShader:Ee,fragmentShader:ze,defines:S.defines,customVertexShaderID:Se,customFragmentShaderID:ne,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:m,batching:et,batchingColor:et&&G._colorsTexture!==null,instancing:Ne,instancingColor:Ne&&G.instanceColor!==null,instancingMorph:Ne&&G.morphTexture!==null,outputColorSpace:ye===null?t.outputColorSpace:ye.isXRRenderTarget===!0?ye.texture.colorSpace:Ao,alphaToCoverage:!!S.alphaToCoverage,map:xt,matcap:pn,envMap:ht,envMapMode:ht&&Q.mapping,envMapCubeUVHeight:W,aoMap:Ft,lightMap:nn,bumpMap:Dt,normalMap:an,displacementMap:ee,emissiveMap:Sn,normalMapObjectSpace:an&&S.normalMapType===VH,normalMapTangentSpace:an&&S.normalMapType===zH,metalnessMap:At,roughnessMap:Lt,anisotropy:it,anisotropyMap:ve,clearcoat:B,clearcoatMap:Ke,clearcoatNormalMap:ke,clearcoatRoughnessMap:pt,dispersion:R,iridescence:se,iridescenceMap:Pt,iridescenceThicknessMap:Pe,sheen:xe,sheenColorMap:Oe,sheenRoughnessMap:Ze,specularMap:rt,specularColorMap:$e,specularIntensityMap:Ht,transmission:we,transmissionMap:re,thicknessMap:Ve,gradientMap:Le,opaque:S.transparent===!1&&S.blending===_o&&S.alphaToCoverage===!1,alphaMap:Xe,alphaTest:Re,alphaHash:_e,combine:S.combine,mapUv:xt&&_(S.map.channel),aoMapUv:Ft&&_(S.aoMap.channel),lightMapUv:nn&&_(S.lightMap.channel),bumpMapUv:Dt&&_(S.bumpMap.channel),normalMapUv:an&&_(S.normalMap.channel),displacementMapUv:ee&&_(S.displacementMap.channel),emissiveMapUv:Sn&&_(S.emissiveMap.channel),metalnessMapUv:At&&_(S.metalnessMap.channel),roughnessMapUv:Lt&&_(S.roughnessMap.channel),anisotropyMapUv:ve&&_(S.anisotropyMap.channel),clearcoatMapUv:Ke&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:ke&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pt&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:Pt&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:Pe&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:Oe&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:Ze&&_(S.sheenRoughnessMap.channel),specularMapUv:rt&&_(S.specularMap.channel),specularColorMapUv:$e&&_(S.specularColorMap.channel),specularIntensityMapUv:Ht&&_(S.specularIntensityMap.channel),transmissionMapUv:re&&_(S.transmissionMap.channel),thicknessMapUv:Ve&&_(S.thicknessMap.channel),alphaMapUv:Xe&&_(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(an||it),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(xt||Xe),fog:!!J,useFog:S.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:S.wireframe===!1&&(S.flatShading===!0||H.attributes.normal===void 0&&an===!1&&(S.isMeshLambertMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isMeshPhysicalMaterial)),sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:be,skinning:G.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:z,morphTextureStride:ie,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:S.dithering,shadowMapEnabled:t.shadowMap.enabled&&V.length>0,shadowMapType:t.shadowMap.type,toneMapping:Nt,decodeVideoTexture:xt&&S.map.isVideoTexture===!0&&fn.getTransfer(S.map.colorSpace)===wn,decodeVideoTextureEmissive:Sn&&S.emissiveMap.isVideoTexture===!0&&fn.getTransfer(S.emissiveMap.colorSpace)===wn,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Ns,flipSided:S.side===Gi,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:st&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(st&&S.extensions.multiDraw===!0||et)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return mn.vertexUv1s=u.has(1),mn.vertexUv2s=u.has(2),mn.vertexUv3s=u.has(3),u.clear(),mn}function y(S){const P=[];if(S.shaderID?P.push(S.shaderID):(P.push(S.customVertexShaderID),P.push(S.customFragmentShaderID)),S.defines!==void 0)for(const V in S.defines)P.push(V),P.push(S.defines[V]);return S.isRawShaderMaterial===!1&&(b(P,S),T(P,S),P.push(t.outputColorSpace)),P.push(S.customProgramCacheKey),P.join()}function b(S,P){S.push(P.precision),S.push(P.outputColorSpace),S.push(P.envMapMode),S.push(P.envMapCubeUVHeight),S.push(P.mapUv),S.push(P.alphaMapUv),S.push(P.lightMapUv),S.push(P.aoMapUv),S.push(P.bumpMapUv),S.push(P.normalMapUv),S.push(P.displacementMapUv),S.push(P.emissiveMapUv),S.push(P.metalnessMapUv),S.push(P.roughnessMapUv),S.push(P.anisotropyMapUv),S.push(P.clearcoatMapUv),S.push(P.clearcoatNormalMapUv),S.push(P.clearcoatRoughnessMapUv),S.push(P.iridescenceMapUv),S.push(P.iridescenceThicknessMapUv),S.push(P.sheenColorMapUv),S.push(P.sheenRoughnessMapUv),S.push(P.specularMapUv),S.push(P.specularColorMapUv),S.push(P.specularIntensityMapUv),S.push(P.transmissionMapUv),S.push(P.thicknessMapUv),S.push(P.combine),S.push(P.fogExp2),S.push(P.sizeAttenuation),S.push(P.morphTargetsCount),S.push(P.morphAttributeCount),S.push(P.numDirLights),S.push(P.numPointLights),S.push(P.numSpotLights),S.push(P.numSpotLightMaps),S.push(P.numHemiLights),S.push(P.numRectAreaLights),S.push(P.numDirLightShadows),S.push(P.numPointLightShadows),S.push(P.numSpotLightShadows),S.push(P.numSpotLightShadowsWithMaps),S.push(P.numLightProbes),S.push(P.shadowMapType),S.push(P.toneMapping),S.push(P.numClippingPlanes),S.push(P.numClipIntersection),S.push(P.depthPacking)}function T(S,P){o.disableAll(),P.instancing&&o.enable(0),P.instancingColor&&o.enable(1),P.instancingMorph&&o.enable(2),P.matcap&&o.enable(3),P.envMap&&o.enable(4),P.normalMapObjectSpace&&o.enable(5),P.normalMapTangentSpace&&o.enable(6),P.clearcoat&&o.enable(7),P.iridescence&&o.enable(8),P.alphaTest&&o.enable(9),P.vertexColors&&o.enable(10),P.vertexAlphas&&o.enable(11),P.vertexUv1s&&o.enable(12),P.vertexUv2s&&o.enable(13),P.vertexUv3s&&o.enable(14),P.vertexTangents&&o.enable(15),P.anisotropy&&o.enable(16),P.alphaHash&&o.enable(17),P.batching&&o.enable(18),P.dispersion&&o.enable(19),P.batchingColor&&o.enable(20),P.gradientMap&&o.enable(21),S.push(o.mask),o.disableAll(),P.fog&&o.enable(0),P.useFog&&o.enable(1),P.flatShading&&o.enable(2),P.logarithmicDepthBuffer&&o.enable(3),P.reversedDepthBuffer&&o.enable(4),P.skinning&&o.enable(5),P.morphTargets&&o.enable(6),P.morphNormals&&o.enable(7),P.morphColors&&o.enable(8),P.premultipliedAlpha&&o.enable(9),P.shadowMapEnabled&&o.enable(10),P.doubleSided&&o.enable(11),P.flipSided&&o.enable(12),P.useDepthPacking&&o.enable(13),P.dithering&&o.enable(14),P.transmission&&o.enable(15),P.sheen&&o.enable(16),P.opaque&&o.enable(17),P.pointsUvs&&o.enable(18),P.decodeVideoTexture&&o.enable(19),P.decodeVideoTextureEmissive&&o.enable(20),P.alphaToCoverage&&o.enable(21),S.push(o.mask)}function A(S){const P=v[S.type];let V;if(P){const O=Zr[P];V=M6.clone(O.uniforms)}else V=S.uniforms;return V}function M(S,P){let V=h.get(P);return V!==void 0?++V.usedTimes:(V=new Y9(t,P,S,r),d.push(V),h.set(P,V)),V}function I(S){if(--S.usedTimes===0){const P=d.indexOf(S);d[P]=d[d.length-1],d.pop(),h.delete(S.cacheKey),S.destroy()}}function k(S){c.remove(S)}function U(){c.dispose()}return{getParameters:w,getProgramCacheKey:y,getUniforms:A,acquireProgram:M,releaseProgram:I,releaseShaderCache:k,programs:d,dispose:U}}function eW(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let c=t.get(o);return c===void 0&&(c={},t.set(o,c)),c}function i(o){t.delete(o)}function r(o,c,u){t.get(o)[c]=u}function s(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:s}}function tW(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.materialVariant!==e.materialVariant?t.materialVariant-e.materialVariant:t.z!==e.z?t.z-e.z:t.id-e.id}function fE(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function hE(){const t=[];let e=0;const n=[],i=[],r=[];function s(){e=0,n.length=0,i.length=0,r.length=0}function o(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,w,y,b){let T=t[e];return T===void 0?(T={id:m.id,object:m,geometry:v,material:_,materialVariant:o(m),groupOrder:w,renderOrder:m.renderOrder,z:y,group:b},t[e]=T):(T.id=m.id,T.object=m,T.geometry=v,T.material=_,T.materialVariant=o(m),T.groupOrder=w,T.renderOrder=m.renderOrder,T.z=y,T.group=b),e++,T}function u(m,v,_,w,y,b){const T=c(m,v,_,w,y,b);_.transmission>0?i.push(T):_.transparent===!0?r.push(T):n.push(T)}function d(m,v,_,w,y,b){const T=c(m,v,_,w,y,b);_.transmission>0?i.unshift(T):_.transparent===!0?r.unshift(T):n.unshift(T)}function h(m,v){n.length>1&&n.sort(m||tW),i.length>1&&i.sort(v||fE),r.length>1&&r.sort(v||fE)}function p(){for(let m=e,v=t.length;m<v;m++){const _=t[m];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:u,unshift:d,finish:p,sort:h}}function nW(){let t=new WeakMap;function e(i,r){const s=t.get(i);let o;return s===void 0?(o=new hE,t.set(i,[o])):r>=s.length?(o=new hE,s.push(o)):o=s[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function iW(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new me,color:new Tn};break;case"SpotLight":n={position:new me,direction:new me,color:new Tn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new me,color:new Tn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new me,skyColor:new Tn,groundColor:new Tn};break;case"RectAreaLight":n={color:new Tn,position:new me,halfWidth:new me,halfHeight:new me};break}return t[e.id]=n,n}}}function rW(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new bn};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new bn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new bn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let sW=0;function aW(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function oW(t){const e=new iW,n=rW(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new me);const r=new me,s=new Kn,o=new Kn;function c(d){let h=0,p=0,m=0;for(let P=0;P<9;P++)i.probe[P].set(0,0,0);let v=0,_=0,w=0,y=0,b=0,T=0,A=0,M=0,I=0,k=0,U=0;d.sort(aW);for(let P=0,V=d.length;P<V;P++){const O=d[P],G=O.color,J=O.intensity,H=O.distance;let X=null;if(O.shadow&&O.shadow.map&&(O.shadow.map.texture.format===$l?X=O.shadow.map.texture:X=O.shadow.map.depthTexture||O.shadow.map.texture),O.isAmbientLight)h+=G.r*J,p+=G.g*J,m+=G.b*J;else if(O.isLightProbe){for(let K=0;K<9;K++)i.probe[K].addScaledVector(O.sh.coefficients[K],J);U++}else if(O.isDirectionalLight){const K=e.get(O);if(K.color.copy(O.color).multiplyScalar(O.intensity),O.castShadow){const Q=O.shadow,W=n.get(O);W.shadowIntensity=Q.intensity,W.shadowBias=Q.bias,W.shadowNormalBias=Q.normalBias,W.shadowRadius=Q.radius,W.shadowMapSize=Q.mapSize,i.directionalShadow[v]=W,i.directionalShadowMap[v]=X,i.directionalShadowMatrix[v]=O.shadow.matrix,T++}i.directional[v]=K,v++}else if(O.isSpotLight){const K=e.get(O);K.position.setFromMatrixPosition(O.matrixWorld),K.color.copy(G).multiplyScalar(J),K.distance=H,K.coneCos=Math.cos(O.angle),K.penumbraCos=Math.cos(O.angle*(1-O.penumbra)),K.decay=O.decay,i.spot[w]=K;const Q=O.shadow;if(O.map&&(i.spotLightMap[I]=O.map,I++,Q.updateMatrices(O),O.castShadow&&k++),i.spotLightMatrix[w]=Q.matrix,O.castShadow){const W=n.get(O);W.shadowIntensity=Q.intensity,W.shadowBias=Q.bias,W.shadowNormalBias=Q.normalBias,W.shadowRadius=Q.radius,W.shadowMapSize=Q.mapSize,i.spotShadow[w]=W,i.spotShadowMap[w]=X,M++}w++}else if(O.isRectAreaLight){const K=e.get(O);K.color.copy(G).multiplyScalar(J),K.halfWidth.set(O.width*.5,0,0),K.halfHeight.set(0,O.height*.5,0),i.rectArea[y]=K,y++}else if(O.isPointLight){const K=e.get(O);if(K.color.copy(O.color).multiplyScalar(O.intensity),K.distance=O.distance,K.decay=O.decay,O.castShadow){const Q=O.shadow,W=n.get(O);W.shadowIntensity=Q.intensity,W.shadowBias=Q.bias,W.shadowNormalBias=Q.normalBias,W.shadowRadius=Q.radius,W.shadowMapSize=Q.mapSize,W.shadowCameraNear=Q.camera.near,W.shadowCameraFar=Q.camera.far,i.pointShadow[_]=W,i.pointShadowMap[_]=X,i.pointShadowMatrix[_]=O.shadow.matrix,A++}i.point[_]=K,_++}else if(O.isHemisphereLight){const K=e.get(O);K.skyColor.copy(O.color).multiplyScalar(J),K.groundColor.copy(O.groundColor).multiplyScalar(J),i.hemi[b]=K,b++}}y>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ye.LTC_FLOAT_1,i.rectAreaLTC2=Ye.LTC_FLOAT_2):(i.rectAreaLTC1=Ye.LTC_HALF_1,i.rectAreaLTC2=Ye.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=m;const S=i.hash;(S.directionalLength!==v||S.pointLength!==_||S.spotLength!==w||S.rectAreaLength!==y||S.hemiLength!==b||S.numDirectionalShadows!==T||S.numPointShadows!==A||S.numSpotShadows!==M||S.numSpotMaps!==I||S.numLightProbes!==U)&&(i.directional.length=v,i.spot.length=w,i.rectArea.length=y,i.point.length=_,i.hemi.length=b,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=M,i.spotShadowMap.length=M,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=M+I-k,i.spotLightMap.length=I,i.numSpotLightShadowsWithMaps=k,i.numLightProbes=U,S.directionalLength=v,S.pointLength=_,S.spotLength=w,S.rectAreaLength=y,S.hemiLength=b,S.numDirectionalShadows=T,S.numPointShadows=A,S.numSpotShadows=M,S.numSpotMaps=I,S.numLightProbes=U,i.version=sW++)}function u(d,h){let p=0,m=0,v=0,_=0,w=0;const y=h.matrixWorldInverse;for(let b=0,T=d.length;b<T;b++){const A=d[b];if(A.isDirectionalLight){const M=i.directional[p];M.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(y),p++}else if(A.isSpotLight){const M=i.spot[v];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(y),M.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(y),v++}else if(A.isRectAreaLight){const M=i.rectArea[_];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(y),o.identity(),s.copy(A.matrixWorld),s.premultiply(y),o.extractRotation(s),M.halfWidth.set(A.width*.5,0,0),M.halfHeight.set(0,A.height*.5,0),M.halfWidth.applyMatrix4(o),M.halfHeight.applyMatrix4(o),_++}else if(A.isPointLight){const M=i.point[m];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(y),m++}else if(A.isHemisphereLight){const M=i.hemi[w];M.direction.setFromMatrixPosition(A.matrixWorld),M.direction.transformDirection(y),w++}}}return{setup:c,setupView:u,state:i}}function pE(t){const e=new oW(t),n=[],i=[];function r(h){d.camera=h,n.length=0,i.length=0}function s(h){n.push(h)}function o(h){i.push(h)}function c(){e.setup(n)}function u(h){e.setupView(n,h)}const d={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:d,setupLights:c,setupLightsView:u,pushLight:s,pushShadow:o}}function lW(t){let e=new WeakMap;function n(r,s=0){const o=e.get(r);let c;return o===void 0?(c=new pE(t),e.set(r,[c])):s>=o.length?(c=new pE(t),o.push(c)):c=o[s],c}function i(){e=new WeakMap}return{get:n,dispose:i}}const cW=`void main() {
|
|
4608
|
+
`+z)}else X!==""?Gt("WebGLProgram: Program Info Log:",X):(K===""||Q==="")&&(q=!1);q&&(O.diagnostics={runnable:W,programLog:X,vertexShader:{log:K,prefix:y},fragmentShader:{log:Q,prefix:b}})}r.deleteShader(I),r.deleteShader(k),S=new Yf(r,w),P=N9(r,w)}let S;this.getUniforms=function(){return S===void 0&&U(this),S};let P;this.getAttributes=function(){return P===void 0&&U(this),P};let V=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=r.getProgramParameter(w,E9)),V},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=M9++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=I,this.fragmentShader=k,this}let K9=0;class Z9{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(n),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 n=this.materialCache.get(e);for(const i of n)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 n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new J9(e),n.set(e,i)),i}}class J9{constructor(e){this.id=K9++,this.code=e,this.usedTimes=0}}function Q9(t,e,n,i,r,s){const o=new vP,c=new Z9,u=new Set,d=[],h=new Map,p=i.logarithmicDepthBuffer;let m=i.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 _(S){return u.add(S),S===0?"uv":`uv${S}`}function w(S,P,V,O,G){const J=O.fog,H=G.geometry,X=S.isMeshStandardMaterial||S.isMeshLambertMaterial||S.isMeshPhongMaterial?O.environment:null,K=S.isMeshStandardMaterial||S.isMeshLambertMaterial&&!S.envMap||S.isMeshPhongMaterial&&!S.envMap,Q=e.get(S.envMap||X,K),W=Q&&Q.mapping===Hh?Q.image.height:null,q=v[S.type];S.precision!==null&&(m=i.getMaxPrecision(S.precision),m!==S.precision&&Gt("WebGLProgram.getParameters:",S.precision,"not supported, using",m,"instead."));const Z=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,z=Z!==void 0?Z.length:0;let ie=0;H.morphAttributes.position!==void 0&&(ie=1),H.morphAttributes.normal!==void 0&&(ie=2),H.morphAttributes.color!==void 0&&(ie=3);let we,He,Se,ne;if(q){const Kt=Zr[q];we=Kt.vertexShader,He=Kt.fragmentShader}else we=S.vertexShader,He=S.fragmentShader,c.update(S),Se=c.getVertexShaderID(S),ne=c.getFragmentShaderID(S);const ye=t.getRenderTarget(),be=t.state.buffers.depth.getReversed(),Ne=G.isInstancedMesh===!0,et=G.isBatchedMesh===!0,xt=!!S.map,pn=!!S.matcap,ht=!!Q,Ft=!!S.aoMap,nn=!!S.lightMap,Dt=!!S.bumpMap,an=!!S.normalMap,ee=!!S.displacementMap,Sn=!!S.emissiveMap,At=!!S.metalnessMap,Lt=!!S.roughnessMap,it=S.anisotropy>0,B=S.clearcoat>0,R=S.dispersion>0,se=S.iridescence>0,xe=S.sheen>0,Ee=S.transmission>0,ve=it&&!!S.anisotropyMap,Ke=B&&!!S.clearcoatMap,ke=B&&!!S.clearcoatNormalMap,pt=B&&!!S.clearcoatRoughnessMap,Pt=se&&!!S.iridescenceMap,Pe=se&&!!S.iridescenceThicknessMap,Oe=xe&&!!S.sheenColorMap,Ze=xe&&!!S.sheenRoughnessMap,rt=!!S.specularMap,$e=!!S.specularColorMap,Ht=!!S.specularIntensityMap,re=Ee&&!!S.transmissionMap,ze=Ee&&!!S.thicknessMap,Le=!!S.gradientMap,Xe=!!S.alphaMap,Re=S.alphaTest>0,_e=!!S.alphaHash,st=!!S.extensions;let Nt=is;S.toneMapped&&(ye===null||ye.isXRRenderTarget===!0)&&(Nt=t.toneMapping);const mn={shaderID:q,shaderType:S.type,shaderName:S.name,vertexShader:we,fragmentShader:He,defines:S.defines,customVertexShaderID:Se,customFragmentShaderID:ne,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:m,batching:et,batchingColor:et&&G._colorsTexture!==null,instancing:Ne,instancingColor:Ne&&G.instanceColor!==null,instancingMorph:Ne&&G.morphTexture!==null,outputColorSpace:ye===null?t.outputColorSpace:ye.isXRRenderTarget===!0?ye.texture.colorSpace:Ao,alphaToCoverage:!!S.alphaToCoverage,map:xt,matcap:pn,envMap:ht,envMapMode:ht&&Q.mapping,envMapCubeUVHeight:W,aoMap:Ft,lightMap:nn,bumpMap:Dt,normalMap:an,displacementMap:ee,emissiveMap:Sn,normalMapObjectSpace:an&&S.normalMapType===VH,normalMapTangentSpace:an&&S.normalMapType===zH,metalnessMap:At,roughnessMap:Lt,anisotropy:it,anisotropyMap:ve,clearcoat:B,clearcoatMap:Ke,clearcoatNormalMap:ke,clearcoatRoughnessMap:pt,dispersion:R,iridescence:se,iridescenceMap:Pt,iridescenceThicknessMap:Pe,sheen:xe,sheenColorMap:Oe,sheenRoughnessMap:Ze,specularMap:rt,specularColorMap:$e,specularIntensityMap:Ht,transmission:Ee,transmissionMap:re,thicknessMap:ze,gradientMap:Le,opaque:S.transparent===!1&&S.blending===_o&&S.alphaToCoverage===!1,alphaMap:Xe,alphaTest:Re,alphaHash:_e,combine:S.combine,mapUv:xt&&_(S.map.channel),aoMapUv:Ft&&_(S.aoMap.channel),lightMapUv:nn&&_(S.lightMap.channel),bumpMapUv:Dt&&_(S.bumpMap.channel),normalMapUv:an&&_(S.normalMap.channel),displacementMapUv:ee&&_(S.displacementMap.channel),emissiveMapUv:Sn&&_(S.emissiveMap.channel),metalnessMapUv:At&&_(S.metalnessMap.channel),roughnessMapUv:Lt&&_(S.roughnessMap.channel),anisotropyMapUv:ve&&_(S.anisotropyMap.channel),clearcoatMapUv:Ke&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:ke&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pt&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:Pt&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:Pe&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:Oe&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:Ze&&_(S.sheenRoughnessMap.channel),specularMapUv:rt&&_(S.specularMap.channel),specularColorMapUv:$e&&_(S.specularColorMap.channel),specularIntensityMapUv:Ht&&_(S.specularIntensityMap.channel),transmissionMapUv:re&&_(S.transmissionMap.channel),thicknessMapUv:ze&&_(S.thicknessMap.channel),alphaMapUv:Xe&&_(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(an||it),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(xt||Xe),fog:!!J,useFog:S.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:S.wireframe===!1&&(S.flatShading===!0||H.attributes.normal===void 0&&an===!1&&(S.isMeshLambertMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isMeshPhysicalMaterial)),sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:be,skinning:G.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:z,morphTextureStride:ie,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:S.dithering,shadowMapEnabled:t.shadowMap.enabled&&V.length>0,shadowMapType:t.shadowMap.type,toneMapping:Nt,decodeVideoTexture:xt&&S.map.isVideoTexture===!0&&fn.getTransfer(S.map.colorSpace)===wn,decodeVideoTextureEmissive:Sn&&S.emissiveMap.isVideoTexture===!0&&fn.getTransfer(S.emissiveMap.colorSpace)===wn,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Ns,flipSided:S.side===Gi,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:st&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(st&&S.extensions.multiDraw===!0||et)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return mn.vertexUv1s=u.has(1),mn.vertexUv2s=u.has(2),mn.vertexUv3s=u.has(3),u.clear(),mn}function y(S){const P=[];if(S.shaderID?P.push(S.shaderID):(P.push(S.customVertexShaderID),P.push(S.customFragmentShaderID)),S.defines!==void 0)for(const V in S.defines)P.push(V),P.push(S.defines[V]);return S.isRawShaderMaterial===!1&&(b(P,S),T(P,S),P.push(t.outputColorSpace)),P.push(S.customProgramCacheKey),P.join()}function b(S,P){S.push(P.precision),S.push(P.outputColorSpace),S.push(P.envMapMode),S.push(P.envMapCubeUVHeight),S.push(P.mapUv),S.push(P.alphaMapUv),S.push(P.lightMapUv),S.push(P.aoMapUv),S.push(P.bumpMapUv),S.push(P.normalMapUv),S.push(P.displacementMapUv),S.push(P.emissiveMapUv),S.push(P.metalnessMapUv),S.push(P.roughnessMapUv),S.push(P.anisotropyMapUv),S.push(P.clearcoatMapUv),S.push(P.clearcoatNormalMapUv),S.push(P.clearcoatRoughnessMapUv),S.push(P.iridescenceMapUv),S.push(P.iridescenceThicknessMapUv),S.push(P.sheenColorMapUv),S.push(P.sheenRoughnessMapUv),S.push(P.specularMapUv),S.push(P.specularColorMapUv),S.push(P.specularIntensityMapUv),S.push(P.transmissionMapUv),S.push(P.thicknessMapUv),S.push(P.combine),S.push(P.fogExp2),S.push(P.sizeAttenuation),S.push(P.morphTargetsCount),S.push(P.morphAttributeCount),S.push(P.numDirLights),S.push(P.numPointLights),S.push(P.numSpotLights),S.push(P.numSpotLightMaps),S.push(P.numHemiLights),S.push(P.numRectAreaLights),S.push(P.numDirLightShadows),S.push(P.numPointLightShadows),S.push(P.numSpotLightShadows),S.push(P.numSpotLightShadowsWithMaps),S.push(P.numLightProbes),S.push(P.shadowMapType),S.push(P.toneMapping),S.push(P.numClippingPlanes),S.push(P.numClipIntersection),S.push(P.depthPacking)}function T(S,P){o.disableAll(),P.instancing&&o.enable(0),P.instancingColor&&o.enable(1),P.instancingMorph&&o.enable(2),P.matcap&&o.enable(3),P.envMap&&o.enable(4),P.normalMapObjectSpace&&o.enable(5),P.normalMapTangentSpace&&o.enable(6),P.clearcoat&&o.enable(7),P.iridescence&&o.enable(8),P.alphaTest&&o.enable(9),P.vertexColors&&o.enable(10),P.vertexAlphas&&o.enable(11),P.vertexUv1s&&o.enable(12),P.vertexUv2s&&o.enable(13),P.vertexUv3s&&o.enable(14),P.vertexTangents&&o.enable(15),P.anisotropy&&o.enable(16),P.alphaHash&&o.enable(17),P.batching&&o.enable(18),P.dispersion&&o.enable(19),P.batchingColor&&o.enable(20),P.gradientMap&&o.enable(21),S.push(o.mask),o.disableAll(),P.fog&&o.enable(0),P.useFog&&o.enable(1),P.flatShading&&o.enable(2),P.logarithmicDepthBuffer&&o.enable(3),P.reversedDepthBuffer&&o.enable(4),P.skinning&&o.enable(5),P.morphTargets&&o.enable(6),P.morphNormals&&o.enable(7),P.morphColors&&o.enable(8),P.premultipliedAlpha&&o.enable(9),P.shadowMapEnabled&&o.enable(10),P.doubleSided&&o.enable(11),P.flipSided&&o.enable(12),P.useDepthPacking&&o.enable(13),P.dithering&&o.enable(14),P.transmission&&o.enable(15),P.sheen&&o.enable(16),P.opaque&&o.enable(17),P.pointsUvs&&o.enable(18),P.decodeVideoTexture&&o.enable(19),P.decodeVideoTextureEmissive&&o.enable(20),P.alphaToCoverage&&o.enable(21),S.push(o.mask)}function A(S){const P=v[S.type];let V;if(P){const O=Zr[P];V=M6.clone(O.uniforms)}else V=S.uniforms;return V}function M(S,P){let V=h.get(P);return V!==void 0?++V.usedTimes:(V=new Y9(t,P,S,r),d.push(V),h.set(P,V)),V}function I(S){if(--S.usedTimes===0){const P=d.indexOf(S);d[P]=d[d.length-1],d.pop(),h.delete(S.cacheKey),S.destroy()}}function k(S){c.remove(S)}function U(){c.dispose()}return{getParameters:w,getProgramCacheKey:y,getUniforms:A,acquireProgram:M,releaseProgram:I,releaseShaderCache:k,programs:d,dispose:U}}function eW(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let c=t.get(o);return c===void 0&&(c={},t.set(o,c)),c}function i(o){t.delete(o)}function r(o,c,u){t.get(o)[c]=u}function s(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:s}}function tW(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.materialVariant!==e.materialVariant?t.materialVariant-e.materialVariant:t.z!==e.z?t.z-e.z:t.id-e.id}function fE(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function hE(){const t=[];let e=0;const n=[],i=[],r=[];function s(){e=0,n.length=0,i.length=0,r.length=0}function o(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,w,y,b){let T=t[e];return T===void 0?(T={id:m.id,object:m,geometry:v,material:_,materialVariant:o(m),groupOrder:w,renderOrder:m.renderOrder,z:y,group:b},t[e]=T):(T.id=m.id,T.object=m,T.geometry=v,T.material=_,T.materialVariant=o(m),T.groupOrder=w,T.renderOrder=m.renderOrder,T.z=y,T.group=b),e++,T}function u(m,v,_,w,y,b){const T=c(m,v,_,w,y,b);_.transmission>0?i.push(T):_.transparent===!0?r.push(T):n.push(T)}function d(m,v,_,w,y,b){const T=c(m,v,_,w,y,b);_.transmission>0?i.unshift(T):_.transparent===!0?r.unshift(T):n.unshift(T)}function h(m,v){n.length>1&&n.sort(m||tW),i.length>1&&i.sort(v||fE),r.length>1&&r.sort(v||fE)}function p(){for(let m=e,v=t.length;m<v;m++){const _=t[m];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:u,unshift:d,finish:p,sort:h}}function nW(){let t=new WeakMap;function e(i,r){const s=t.get(i);let o;return s===void 0?(o=new hE,t.set(i,[o])):r>=s.length?(o=new hE,s.push(o)):o=s[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function iW(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new me,color:new Tn};break;case"SpotLight":n={position:new me,direction:new me,color:new Tn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new me,color:new Tn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new me,skyColor:new Tn,groundColor:new Tn};break;case"RectAreaLight":n={color:new Tn,position:new me,halfWidth:new me,halfHeight:new me};break}return t[e.id]=n,n}}}function rW(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new bn};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new bn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new bn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let sW=0;function aW(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function oW(t){const e=new iW,n=rW(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new me);const r=new me,s=new Kn,o=new Kn;function c(d){let h=0,p=0,m=0;for(let P=0;P<9;P++)i.probe[P].set(0,0,0);let v=0,_=0,w=0,y=0,b=0,T=0,A=0,M=0,I=0,k=0,U=0;d.sort(aW);for(let P=0,V=d.length;P<V;P++){const O=d[P],G=O.color,J=O.intensity,H=O.distance;let X=null;if(O.shadow&&O.shadow.map&&(O.shadow.map.texture.format===$l?X=O.shadow.map.texture:X=O.shadow.map.depthTexture||O.shadow.map.texture),O.isAmbientLight)h+=G.r*J,p+=G.g*J,m+=G.b*J;else if(O.isLightProbe){for(let K=0;K<9;K++)i.probe[K].addScaledVector(O.sh.coefficients[K],J);U++}else if(O.isDirectionalLight){const K=e.get(O);if(K.color.copy(O.color).multiplyScalar(O.intensity),O.castShadow){const Q=O.shadow,W=n.get(O);W.shadowIntensity=Q.intensity,W.shadowBias=Q.bias,W.shadowNormalBias=Q.normalBias,W.shadowRadius=Q.radius,W.shadowMapSize=Q.mapSize,i.directionalShadow[v]=W,i.directionalShadowMap[v]=X,i.directionalShadowMatrix[v]=O.shadow.matrix,T++}i.directional[v]=K,v++}else if(O.isSpotLight){const K=e.get(O);K.position.setFromMatrixPosition(O.matrixWorld),K.color.copy(G).multiplyScalar(J),K.distance=H,K.coneCos=Math.cos(O.angle),K.penumbraCos=Math.cos(O.angle*(1-O.penumbra)),K.decay=O.decay,i.spot[w]=K;const Q=O.shadow;if(O.map&&(i.spotLightMap[I]=O.map,I++,Q.updateMatrices(O),O.castShadow&&k++),i.spotLightMatrix[w]=Q.matrix,O.castShadow){const W=n.get(O);W.shadowIntensity=Q.intensity,W.shadowBias=Q.bias,W.shadowNormalBias=Q.normalBias,W.shadowRadius=Q.radius,W.shadowMapSize=Q.mapSize,i.spotShadow[w]=W,i.spotShadowMap[w]=X,M++}w++}else if(O.isRectAreaLight){const K=e.get(O);K.color.copy(G).multiplyScalar(J),K.halfWidth.set(O.width*.5,0,0),K.halfHeight.set(0,O.height*.5,0),i.rectArea[y]=K,y++}else if(O.isPointLight){const K=e.get(O);if(K.color.copy(O.color).multiplyScalar(O.intensity),K.distance=O.distance,K.decay=O.decay,O.castShadow){const Q=O.shadow,W=n.get(O);W.shadowIntensity=Q.intensity,W.shadowBias=Q.bias,W.shadowNormalBias=Q.normalBias,W.shadowRadius=Q.radius,W.shadowMapSize=Q.mapSize,W.shadowCameraNear=Q.camera.near,W.shadowCameraFar=Q.camera.far,i.pointShadow[_]=W,i.pointShadowMap[_]=X,i.pointShadowMatrix[_]=O.shadow.matrix,A++}i.point[_]=K,_++}else if(O.isHemisphereLight){const K=e.get(O);K.skyColor.copy(O.color).multiplyScalar(J),K.groundColor.copy(O.groundColor).multiplyScalar(J),i.hemi[b]=K,b++}}y>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ye.LTC_FLOAT_1,i.rectAreaLTC2=Ye.LTC_FLOAT_2):(i.rectAreaLTC1=Ye.LTC_HALF_1,i.rectAreaLTC2=Ye.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=m;const S=i.hash;(S.directionalLength!==v||S.pointLength!==_||S.spotLength!==w||S.rectAreaLength!==y||S.hemiLength!==b||S.numDirectionalShadows!==T||S.numPointShadows!==A||S.numSpotShadows!==M||S.numSpotMaps!==I||S.numLightProbes!==U)&&(i.directional.length=v,i.spot.length=w,i.rectArea.length=y,i.point.length=_,i.hemi.length=b,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=M,i.spotShadowMap.length=M,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=M+I-k,i.spotLightMap.length=I,i.numSpotLightShadowsWithMaps=k,i.numLightProbes=U,S.directionalLength=v,S.pointLength=_,S.spotLength=w,S.rectAreaLength=y,S.hemiLength=b,S.numDirectionalShadows=T,S.numPointShadows=A,S.numSpotShadows=M,S.numSpotMaps=I,S.numLightProbes=U,i.version=sW++)}function u(d,h){let p=0,m=0,v=0,_=0,w=0;const y=h.matrixWorldInverse;for(let b=0,T=d.length;b<T;b++){const A=d[b];if(A.isDirectionalLight){const M=i.directional[p];M.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(y),p++}else if(A.isSpotLight){const M=i.spot[v];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(y),M.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(y),v++}else if(A.isRectAreaLight){const M=i.rectArea[_];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(y),o.identity(),s.copy(A.matrixWorld),s.premultiply(y),o.extractRotation(s),M.halfWidth.set(A.width*.5,0,0),M.halfHeight.set(0,A.height*.5,0),M.halfWidth.applyMatrix4(o),M.halfHeight.applyMatrix4(o),_++}else if(A.isPointLight){const M=i.point[m];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(y),m++}else if(A.isHemisphereLight){const M=i.hemi[w];M.direction.setFromMatrixPosition(A.matrixWorld),M.direction.transformDirection(y),w++}}}return{setup:c,setupView:u,state:i}}function pE(t){const e=new oW(t),n=[],i=[];function r(h){d.camera=h,n.length=0,i.length=0}function s(h){n.push(h)}function o(h){i.push(h)}function c(){e.setup(n)}function u(h){e.setupView(n,h)}const d={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:d,setupLights:c,setupLightsView:u,pushLight:s,pushShadow:o}}function lW(t){let e=new WeakMap;function n(r,s=0){const o=e.get(r);let c;return o===void 0?(c=new pE(t),e.set(r,[c])):s>=o.length?(c=new pE(t),o.push(c)):c=o[s],c}function i(){e=new WeakMap}return{get:n,dispose:i}}const cW=`void main() {
|
|
4608
4609
|
gl_Position = vec4( position, 1.0 );
|
|
4609
4610
|
}`,uW=`uniform sampler2D shadow_pass;
|
|
4610
4611
|
uniform vec2 resolution;
|
|
@@ -4631,7 +4632,7 @@ void main() {
|
|
|
4631
4632
|
squared_mean = squared_mean / samples;
|
|
4632
4633
|
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4633
4634
|
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4634
|
-
}`,dW=[new me(1,0,0),new me(-1,0,0),new me(0,1,0),new me(0,-1,0),new me(0,0,1),new me(0,0,-1)],fW=[new me(0,-1,0),new me(0,-1,0),new me(0,0,1),new me(0,0,-1),new me(0,-1,0),new me(0,-1,0)],mE=new Kn,Yc=new me,zg=new me;function hW(t,e,n){let i=new SP;const r=new bn,s=new bn,o=new Vn,c=new C6,u=new P6,d={},h=n.maxTextureSize,p={[Ua]:Gi,[Gi]:Ua,[Ns]:Ns},m=new fs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new bn},radius:{value:4}},vertexShader:cW,fragmentShader:uW}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new gs;_.setAttribute("position",new Vr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const w=new ds(_,m),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=jf;let b=this.type;this.render=function(k,U,S){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||k.length===0)return;this.type===vH&&(Gt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=jf);const P=t.getRenderTarget(),V=t.getActiveCubeFace(),O=t.getActiveMipmapLevel(),G=t.state;G.setBlending(Os),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const J=b!==this.type;J&&U.traverse(function(H){H.material&&(Array.isArray(H.material)?H.material.forEach(X=>X.needsUpdate=!0):H.material.needsUpdate=!0)});for(let H=0,X=k.length;H<X;H++){const K=k[H],Q=K.shadow;if(Q===void 0){Gt("WebGLShadowMap:",K,"has no shadow.");continue}if(Q.autoUpdate===!1&&Q.needsUpdate===!1)continue;r.copy(Q.mapSize);const W=Q.getFrameExtents();r.multiply(W),s.copy(Q.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/W.x),r.x=s.x*W.x,Q.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/W.y),r.y=s.y*W.y,Q.mapSize.y=s.y));const q=t.state.buffers.depth.getReversed();if(Q.camera._reversedDepth=q,Q.map===null||J===!0){if(Q.map!==null&&(Q.map.depthTexture!==null&&(Q.map.depthTexture.dispose(),Q.map.depthTexture=null),Q.map.dispose()),this.type===tu){if(K.isPointLight){Gt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Q.map=new rs(r.x,r.y,{format:$l,type:Hs,minFilter:wi,magFilter:wi,generateMipmaps:!1}),Q.map.texture.name=K.name+".shadowMap",Q.map.depthTexture=new Su(r.x,r.y,Qr),Q.map.depthTexture.name=K.name+".shadowMapDepth",Q.map.depthTexture.format=Gs,Q.map.depthTexture.compareFunction=null,Q.map.depthTexture.minFilter=mi,Q.map.depthTexture.magFilter=mi}else K.isPointLight?(Q.map=new PP(r.x),Q.map.depthTexture=new w6(r.x,us)):(Q.map=new rs(r.x,r.y),Q.map.depthTexture=new Su(r.x,r.y,us)),Q.map.depthTexture.name=K.name+".shadowMap",Q.map.depthTexture.format=Gs,this.type===jf?(Q.map.depthTexture.compareFunction=q?r_:i_,Q.map.depthTexture.minFilter=wi,Q.map.depthTexture.magFilter=wi):(Q.map.depthTexture.compareFunction=null,Q.map.depthTexture.minFilter=mi,Q.map.depthTexture.magFilter=mi);Q.camera.updateProjectionMatrix()}const Z=Q.map.isWebGLCubeRenderTarget?6:1;for(let z=0;z<Z;z++){if(Q.map.isWebGLCubeRenderTarget)t.setRenderTarget(Q.map,z),t.clear();else{z===0&&(t.setRenderTarget(Q.map),t.clear());const ie=Q.getViewport(z);o.set(s.x*ie.x,s.y*ie.y,s.x*ie.z,s.y*ie.w),G.viewport(o)}if(K.isPointLight){const ie=Q.camera,Ee=Q.matrix,ze=K.distance||ie.far;ze!==ie.far&&(ie.far=ze,ie.updateProjectionMatrix()),Yc.setFromMatrixPosition(K.matrixWorld),ie.position.copy(Yc),zg.copy(ie.position),zg.add(dW[z]),ie.up.copy(fW[z]),ie.lookAt(zg),ie.updateMatrixWorld(),Ee.makeTranslation(-Yc.x,-Yc.y,-Yc.z),mE.multiplyMatrices(ie.projectionMatrix,ie.matrixWorldInverse),Q._frustum.setFromProjectionMatrix(mE,ie.coordinateSystem,ie.reversedDepth)}else Q.updateMatrices(K);i=Q.getFrustum(),M(U,S,Q.camera,K,this.type)}Q.isPointLightShadow!==!0&&this.type===tu&&T(Q,S),Q.needsUpdate=!1}b=this.type,y.needsUpdate=!1,t.setRenderTarget(P,V,O)};function T(k,U){const S=e.update(w);m.defines.VSM_SAMPLES!==k.blurSamples&&(m.defines.VSM_SAMPLES=k.blurSamples,v.defines.VSM_SAMPLES=k.blurSamples,m.needsUpdate=!0,v.needsUpdate=!0),k.mapPass===null&&(k.mapPass=new rs(r.x,r.y,{format:$l,type:Hs})),m.uniforms.shadow_pass.value=k.map.depthTexture,m.uniforms.resolution.value=k.mapSize,m.uniforms.radius.value=k.radius,t.setRenderTarget(k.mapPass),t.clear(),t.renderBufferDirect(U,null,S,m,w,null),v.uniforms.shadow_pass.value=k.mapPass.texture,v.uniforms.resolution.value=k.mapSize,v.uniforms.radius.value=k.radius,t.setRenderTarget(k.map),t.clear(),t.renderBufferDirect(U,null,S,v,w,null)}function A(k,U,S,P){let V=null;const O=S.isPointLight===!0?k.customDistanceMaterial:k.customDepthMaterial;if(O!==void 0)V=O;else if(V=S.isPointLight===!0?u:c,t.localClippingEnabled&&U.clipShadows===!0&&Array.isArray(U.clippingPlanes)&&U.clippingPlanes.length!==0||U.displacementMap&&U.displacementScale!==0||U.alphaMap&&U.alphaTest>0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const G=V.uuid,J=U.uuid;let H=d[G];H===void 0&&(H={},d[G]=H);let X=H[J];X===void 0&&(X=V.clone(),H[J]=X,U.addEventListener("dispose",I)),V=X}if(V.visible=U.visible,V.wireframe=U.wireframe,P===tu?V.side=U.shadowSide!==null?U.shadowSide:U.side:V.side=U.shadowSide!==null?U.shadowSide:p[U.side],V.alphaMap=U.alphaMap,V.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,V.map=U.map,V.clipShadows=U.clipShadows,V.clippingPlanes=U.clippingPlanes,V.clipIntersection=U.clipIntersection,V.displacementMap=U.displacementMap,V.displacementScale=U.displacementScale,V.displacementBias=U.displacementBias,V.wireframeLinewidth=U.wireframeLinewidth,V.linewidth=U.linewidth,S.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const G=t.properties.get(V);G.light=S}return V}function M(k,U,S,P,V){if(k.visible===!1)return;if(k.layers.test(U.layers)&&(k.isMesh||k.isLine||k.isPoints)&&(k.castShadow||k.receiveShadow&&V===tu)&&(!k.frustumCulled||i.intersectsObject(k))){k.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,k.matrixWorld);const J=e.update(k),H=k.material;if(Array.isArray(H)){const X=J.groups;for(let K=0,Q=X.length;K<Q;K++){const W=X[K],q=H[W.materialIndex];if(q&&q.visible){const Z=A(k,q,P,V);k.onBeforeShadow(t,k,U,S,J,Z,W),t.renderBufferDirect(S,null,J,Z,k,W),k.onAfterShadow(t,k,U,S,J,Z,W)}}}else if(H.visible){const X=A(k,H,P,V);k.onBeforeShadow(t,k,U,S,J,X,null),t.renderBufferDirect(S,null,J,X,k,null),k.onAfterShadow(t,k,U,S,J,X,null)}}const G=k.children;for(let J=0,H=G.length;J<H;J++)M(G[J],U,S,P,V)}function I(k){k.target.removeEventListener("dispose",I);for(const S in d){const P=d[S],V=k.target.uuid;V in P&&(P[V].dispose(),delete P[V])}}}function pW(t,e){function n(){let re=!1;const Ve=new Vn;let Le=null;const Xe=new Vn(0,0,0,0);return{setMask:function(Re){Le!==Re&&!re&&(t.colorMask(Re,Re,Re,Re),Le=Re)},setLocked:function(Re){re=Re},setClear:function(Re,_e,st,Nt,mn){mn===!0&&(Re*=Nt,_e*=Nt,st*=Nt),Ve.set(Re,_e,st,Nt),Xe.equals(Ve)===!1&&(t.clearColor(Re,_e,st,Nt),Xe.copy(Ve))},reset:function(){re=!1,Le=null,Xe.set(-1,0,0,0)}}}function i(){let re=!1,Ve=!1,Le=null,Xe=null,Re=null;return{setReversed:function(_e){if(Ve!==_e){const st=e.get("EXT_clip_control");_e?st.clipControlEXT(st.LOWER_LEFT_EXT,st.ZERO_TO_ONE_EXT):st.clipControlEXT(st.LOWER_LEFT_EXT,st.NEGATIVE_ONE_TO_ONE_EXT),Ve=_e;const Nt=Re;Re=null,this.setClear(Nt)}},getReversed:function(){return Ve},setTest:function(_e){_e?ye(t.DEPTH_TEST):be(t.DEPTH_TEST)},setMask:function(_e){Le!==_e&&!re&&(t.depthMask(_e),Le=_e)},setFunc:function(_e){if(Ve&&(_e=ZH[_e]),Xe!==_e){switch(_e){case W0:t.depthFunc(t.NEVER);break;case $0:t.depthFunc(t.ALWAYS);break;case X0:t.depthFunc(t.LESS);break;case jl:t.depthFunc(t.LEQUAL);break;case q0:t.depthFunc(t.EQUAL);break;case Y0:t.depthFunc(t.GEQUAL);break;case K0:t.depthFunc(t.GREATER);break;case Z0:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Xe=_e}},setLocked:function(_e){re=_e},setClear:function(_e){Re!==_e&&(Re=_e,Ve&&(_e=1-_e),t.clearDepth(_e))},reset:function(){re=!1,Le=null,Xe=null,Re=null,Ve=!1}}}function r(){let re=!1,Ve=null,Le=null,Xe=null,Re=null,_e=null,st=null,Nt=null,mn=null;return{setTest:function(Kt){re||(Kt?ye(t.STENCIL_TEST):be(t.STENCIL_TEST))},setMask:function(Kt){Ve!==Kt&&!re&&(t.stencilMask(Kt),Ve=Kt)},setFunc:function(Kt,ui,ri){(Le!==Kt||Xe!==ui||Re!==ri)&&(t.stencilFunc(Kt,ui,ri),Le=Kt,Xe=ui,Re=ri)},setOp:function(Kt,ui,ri){(_e!==Kt||st!==ui||Nt!==ri)&&(t.stencilOp(Kt,ui,ri),_e=Kt,st=ui,Nt=ri)},setLocked:function(Kt){re=Kt},setClear:function(Kt){mn!==Kt&&(t.clearStencil(Kt),mn=Kt)},reset:function(){re=!1,Ve=null,Le=null,Xe=null,Re=null,_e=null,st=null,Nt=null,mn=null}}}const s=new n,o=new i,c=new r,u=new WeakMap,d=new WeakMap;let h={},p={},m=new WeakMap,v=[],_=null,w=!1,y=null,b=null,T=null,A=null,M=null,I=null,k=null,U=new Tn(0,0,0),S=0,P=!1,V=null,O=null,G=null,J=null,H=null;const X=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let K=!1,Q=0;const W=t.getParameter(t.VERSION);W.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(W)[1]),K=Q>=1):W.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),K=Q>=2);let q=null,Z={};const z=t.getParameter(t.SCISSOR_BOX),ie=t.getParameter(t.VIEWPORT),Ee=new Vn().fromArray(z),ze=new Vn().fromArray(ie);function Se(re,Ve,Le,Xe){const Re=new Uint8Array(4),_e=t.createTexture();t.bindTexture(re,_e),t.texParameteri(re,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(re,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let st=0;st<Le;st++)re===t.TEXTURE_3D||re===t.TEXTURE_2D_ARRAY?t.texImage3D(Ve,0,t.RGBA,1,1,Xe,0,t.RGBA,t.UNSIGNED_BYTE,Re):t.texImage2D(Ve+st,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Re);return _e}const ne={};ne[t.TEXTURE_2D]=Se(t.TEXTURE_2D,t.TEXTURE_2D,1),ne[t.TEXTURE_CUBE_MAP]=Se(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),ne[t.TEXTURE_2D_ARRAY]=Se(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),ne[t.TEXTURE_3D]=Se(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),c.setClear(0),ye(t.DEPTH_TEST),o.setFunc(jl),Dt(!1),an(b1),ye(t.CULL_FACE),Ft(Os);function ye(re){h[re]!==!0&&(t.enable(re),h[re]=!0)}function be(re){h[re]!==!1&&(t.disable(re),h[re]=!1)}function Ne(re,Ve){return p[re]!==Ve?(t.bindFramebuffer(re,Ve),p[re]=Ve,re===t.DRAW_FRAMEBUFFER&&(p[t.FRAMEBUFFER]=Ve),re===t.FRAMEBUFFER&&(p[t.DRAW_FRAMEBUFFER]=Ve),!0):!1}function et(re,Ve){let Le=v,Xe=!1;if(re){Le=m.get(Ve),Le===void 0&&(Le=[],m.set(Ve,Le));const Re=re.textures;if(Le.length!==Re.length||Le[0]!==t.COLOR_ATTACHMENT0){for(let _e=0,st=Re.length;_e<st;_e++)Le[_e]=t.COLOR_ATTACHMENT0+_e;Le.length=Re.length,Xe=!0}}else Le[0]!==t.BACK&&(Le[0]=t.BACK,Xe=!0);Xe&&t.drawBuffers(Le)}function xt(re){return _!==re?(t.useProgram(re),_=re,!0):!1}const pn={[lo]:t.FUNC_ADD,[_H]:t.FUNC_SUBTRACT,[xH]:t.FUNC_REVERSE_SUBTRACT};pn[bH]=t.MIN,pn[SH]=t.MAX;const ht={[wH]:t.ZERO,[EH]:t.ONE,[MH]:t.SRC_COLOR,[G0]:t.SRC_ALPHA,[kH]:t.SRC_ALPHA_SATURATE,[PH]:t.DST_COLOR,[AH]:t.DST_ALPHA,[TH]:t.ONE_MINUS_SRC_COLOR,[j0]:t.ONE_MINUS_SRC_ALPHA,[RH]:t.ONE_MINUS_DST_COLOR,[CH]:t.ONE_MINUS_DST_ALPHA,[LH]:t.CONSTANT_COLOR,[DH]:t.ONE_MINUS_CONSTANT_COLOR,[NH]:t.CONSTANT_ALPHA,[IH]:t.ONE_MINUS_CONSTANT_ALPHA};function Ft(re,Ve,Le,Xe,Re,_e,st,Nt,mn,Kt){if(re===Os){w===!0&&(be(t.BLEND),w=!1);return}if(w===!1&&(ye(t.BLEND),w=!0),re!==yH){if(re!==y||Kt!==P){if((b!==lo||M!==lo)&&(t.blendEquation(t.FUNC_ADD),b=lo,M=lo),Kt)switch(re){case _o:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case S1:t.blendFunc(t.ONE,t.ONE);break;case w1:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case E1:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:_n("WebGLState: Invalid blending: ",re);break}else switch(re){case _o:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case S1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case w1:_n("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case E1:_n("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:_n("WebGLState: Invalid blending: ",re);break}T=null,A=null,I=null,k=null,U.set(0,0,0),S=0,y=re,P=Kt}return}Re=Re||Ve,_e=_e||Le,st=st||Xe,(Ve!==b||Re!==M)&&(t.blendEquationSeparate(pn[Ve],pn[Re]),b=Ve,M=Re),(Le!==T||Xe!==A||_e!==I||st!==k)&&(t.blendFuncSeparate(ht[Le],ht[Xe],ht[_e],ht[st]),T=Le,A=Xe,I=_e,k=st),(Nt.equals(U)===!1||mn!==S)&&(t.blendColor(Nt.r,Nt.g,Nt.b,mn),U.copy(Nt),S=mn),y=re,P=!1}function nn(re,Ve){re.side===Ns?be(t.CULL_FACE):ye(t.CULL_FACE);let Le=re.side===Gi;Ve&&(Le=!Le),Dt(Le),re.blending===_o&&re.transparent===!1?Ft(Os):Ft(re.blending,re.blendEquation,re.blendSrc,re.blendDst,re.blendEquationAlpha,re.blendSrcAlpha,re.blendDstAlpha,re.blendColor,re.blendAlpha,re.premultipliedAlpha),o.setFunc(re.depthFunc),o.setTest(re.depthTest),o.setMask(re.depthWrite),s.setMask(re.colorWrite);const Xe=re.stencilWrite;c.setTest(Xe),Xe&&(c.setMask(re.stencilWriteMask),c.setFunc(re.stencilFunc,re.stencilRef,re.stencilFuncMask),c.setOp(re.stencilFail,re.stencilZFail,re.stencilZPass)),Sn(re.polygonOffset,re.polygonOffsetFactor,re.polygonOffsetUnits),re.alphaToCoverage===!0?ye(t.SAMPLE_ALPHA_TO_COVERAGE):be(t.SAMPLE_ALPHA_TO_COVERAGE)}function Dt(re){V!==re&&(re?t.frontFace(t.CW):t.frontFace(t.CCW),V=re)}function an(re){re!==mH?(ye(t.CULL_FACE),re!==O&&(re===b1?t.cullFace(t.BACK):re===gH?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):be(t.CULL_FACE),O=re}function ee(re){re!==G&&(K&&t.lineWidth(re),G=re)}function Sn(re,Ve,Le){re?(ye(t.POLYGON_OFFSET_FILL),(J!==Ve||H!==Le)&&(J=Ve,H=Le,o.getReversed()&&(Ve=-Ve),t.polygonOffset(Ve,Le))):be(t.POLYGON_OFFSET_FILL)}function At(re){re?ye(t.SCISSOR_TEST):be(t.SCISSOR_TEST)}function Lt(re){re===void 0&&(re=t.TEXTURE0+X-1),q!==re&&(t.activeTexture(re),q=re)}function it(re,Ve,Le){Le===void 0&&(q===null?Le=t.TEXTURE0+X-1:Le=q);let Xe=Z[Le];Xe===void 0&&(Xe={type:void 0,texture:void 0},Z[Le]=Xe),(Xe.type!==re||Xe.texture!==Ve)&&(q!==Le&&(t.activeTexture(Le),q=Le),t.bindTexture(re,Ve||ne[re]),Xe.type=re,Xe.texture=Ve)}function B(){const re=Z[q];re!==void 0&&re.type!==void 0&&(t.bindTexture(re.type,null),re.type=void 0,re.texture=void 0)}function R(){try{t.compressedTexImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function se(){try{t.compressedTexImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function xe(){try{t.texSubImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function we(){try{t.texSubImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function ve(){try{t.compressedTexSubImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function Ke(){try{t.compressedTexSubImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function ke(){try{t.texStorage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function pt(){try{t.texStorage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function Pt(){try{t.texImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function Pe(){try{t.texImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function Oe(re){Ee.equals(re)===!1&&(t.scissor(re.x,re.y,re.z,re.w),Ee.copy(re))}function Ze(re){ze.equals(re)===!1&&(t.viewport(re.x,re.y,re.z,re.w),ze.copy(re))}function rt(re,Ve){let Le=d.get(Ve);Le===void 0&&(Le=new WeakMap,d.set(Ve,Le));let Xe=Le.get(re);Xe===void 0&&(Xe=t.getUniformBlockIndex(Ve,re.name),Le.set(re,Xe))}function $e(re,Ve){const Xe=d.get(Ve).get(re);u.get(Ve)!==Xe&&(t.uniformBlockBinding(Ve,Xe,re.__bindingPointIndex),u.set(Ve,Xe))}function Ht(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),o.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),h={},q=null,Z={},p={},m=new WeakMap,v=[],_=null,w=!1,y=null,b=null,T=null,A=null,M=null,I=null,k=null,U=new Tn(0,0,0),S=0,P=!1,V=null,O=null,G=null,J=null,H=null,Ee.set(0,0,t.canvas.width,t.canvas.height),ze.set(0,0,t.canvas.width,t.canvas.height),s.reset(),o.reset(),c.reset()}return{buffers:{color:s,depth:o,stencil:c},enable:ye,disable:be,bindFramebuffer:Ne,drawBuffers:et,useProgram:xt,setBlending:Ft,setMaterial:nn,setFlipSided:Dt,setCullFace:an,setLineWidth:ee,setPolygonOffset:Sn,setScissorTest:At,activeTexture:Lt,bindTexture:it,unbindTexture:B,compressedTexImage2D:R,compressedTexImage3D:se,texImage2D:Pt,texImage3D:Pe,updateUBOMapping:rt,uniformBlockBinding:$e,texStorage2D:ke,texStorage3D:pt,texSubImage2D:xe,texSubImage3D:we,compressedTexSubImage2D:ve,compressedTexSubImage3D:Ke,scissor:Oe,viewport:Ze,reset:Ht}}function mW(t,e,n,i,r,s,o){const c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new bn,h=new WeakMap;let p;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(B,R){return v?new OffscreenCanvas(B,R):Eh("canvas")}function w(B,R,se){let xe=1;const we=it(B);if((we.width>se||we.height>se)&&(xe=se/Math.max(we.width,we.height)),xe<1)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap||typeof VideoFrame<"u"&&B instanceof VideoFrame){const ve=Math.floor(xe*we.width),Ke=Math.floor(xe*we.height);p===void 0&&(p=_(ve,Ke));const ke=R?_(ve,Ke):p;return ke.width=ve,ke.height=Ke,ke.getContext("2d").drawImage(B,0,0,ve,Ke),Gt("WebGLRenderer: Texture has been resized from ("+we.width+"x"+we.height+") to ("+ve+"x"+Ke+")."),ke}else return"data"in B&&Gt("WebGLRenderer: Image in DataTexture is too big ("+we.width+"x"+we.height+")."),B;return B}function y(B){return B.generateMipmaps}function b(B){t.generateMipmap(B)}function T(B){return B.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:B.isWebGL3DRenderTarget?t.TEXTURE_3D:B.isWebGLArrayRenderTarget||B.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(B,R,se,xe,we=!1){if(B!==null){if(t[B]!==void 0)return t[B];Gt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let ve=R;if(R===t.RED&&(se===t.FLOAT&&(ve=t.R32F),se===t.HALF_FLOAT&&(ve=t.R16F),se===t.UNSIGNED_BYTE&&(ve=t.R8)),R===t.RED_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.R8UI),se===t.UNSIGNED_SHORT&&(ve=t.R16UI),se===t.UNSIGNED_INT&&(ve=t.R32UI),se===t.BYTE&&(ve=t.R8I),se===t.SHORT&&(ve=t.R16I),se===t.INT&&(ve=t.R32I)),R===t.RG&&(se===t.FLOAT&&(ve=t.RG32F),se===t.HALF_FLOAT&&(ve=t.RG16F),se===t.UNSIGNED_BYTE&&(ve=t.RG8)),R===t.RG_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.RG8UI),se===t.UNSIGNED_SHORT&&(ve=t.RG16UI),se===t.UNSIGNED_INT&&(ve=t.RG32UI),se===t.BYTE&&(ve=t.RG8I),se===t.SHORT&&(ve=t.RG16I),se===t.INT&&(ve=t.RG32I)),R===t.RGB_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.RGB8UI),se===t.UNSIGNED_SHORT&&(ve=t.RGB16UI),se===t.UNSIGNED_INT&&(ve=t.RGB32UI),se===t.BYTE&&(ve=t.RGB8I),se===t.SHORT&&(ve=t.RGB16I),se===t.INT&&(ve=t.RGB32I)),R===t.RGBA_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.RGBA8UI),se===t.UNSIGNED_SHORT&&(ve=t.RGBA16UI),se===t.UNSIGNED_INT&&(ve=t.RGBA32UI),se===t.BYTE&&(ve=t.RGBA8I),se===t.SHORT&&(ve=t.RGBA16I),se===t.INT&&(ve=t.RGBA32I)),R===t.RGB&&(se===t.UNSIGNED_INT_5_9_9_9_REV&&(ve=t.RGB9_E5),se===t.UNSIGNED_INT_10F_11F_11F_REV&&(ve=t.R11F_G11F_B10F)),R===t.RGBA){const Ke=we?Sh:fn.getTransfer(xe);se===t.FLOAT&&(ve=t.RGBA32F),se===t.HALF_FLOAT&&(ve=t.RGBA16F),se===t.UNSIGNED_BYTE&&(ve=Ke===wn?t.SRGB8_ALPHA8:t.RGBA8),se===t.UNSIGNED_SHORT_4_4_4_4&&(ve=t.RGBA4),se===t.UNSIGNED_SHORT_5_5_5_1&&(ve=t.RGB5_A1)}return(ve===t.R16F||ve===t.R32F||ve===t.RG16F||ve===t.RG32F||ve===t.RGBA16F||ve===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ve}function M(B,R){let se;return B?R===null||R===us||R===bu?se=t.DEPTH24_STENCIL8:R===Qr?se=t.DEPTH32F_STENCIL8:R===xu&&(se=t.DEPTH24_STENCIL8,Gt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):R===null||R===us||R===bu?se=t.DEPTH_COMPONENT24:R===Qr?se=t.DEPTH_COMPONENT32F:R===xu&&(se=t.DEPTH_COMPONENT16),se}function I(B,R){return y(B)===!0||B.isFramebufferTexture&&B.minFilter!==mi&&B.minFilter!==wi?Math.log2(Math.max(R.width,R.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?R.mipmaps.length:1}function k(B){const R=B.target;R.removeEventListener("dispose",k),S(R),R.isVideoTexture&&h.delete(R)}function U(B){const R=B.target;R.removeEventListener("dispose",U),V(R)}function S(B){const R=i.get(B);if(R.__webglInit===void 0)return;const se=B.source,xe=m.get(se);if(xe){const we=xe[R.__cacheKey];we.usedTimes--,we.usedTimes===0&&P(B),Object.keys(xe).length===0&&m.delete(se)}i.remove(B)}function P(B){const R=i.get(B);t.deleteTexture(R.__webglTexture);const se=B.source,xe=m.get(se);delete xe[R.__cacheKey],o.memory.textures--}function V(B){const R=i.get(B);if(B.depthTexture&&(B.depthTexture.dispose(),i.remove(B.depthTexture)),B.isWebGLCubeRenderTarget)for(let xe=0;xe<6;xe++){if(Array.isArray(R.__webglFramebuffer[xe]))for(let we=0;we<R.__webglFramebuffer[xe].length;we++)t.deleteFramebuffer(R.__webglFramebuffer[xe][we]);else t.deleteFramebuffer(R.__webglFramebuffer[xe]);R.__webglDepthbuffer&&t.deleteRenderbuffer(R.__webglDepthbuffer[xe])}else{if(Array.isArray(R.__webglFramebuffer))for(let xe=0;xe<R.__webglFramebuffer.length;xe++)t.deleteFramebuffer(R.__webglFramebuffer[xe]);else t.deleteFramebuffer(R.__webglFramebuffer);if(R.__webglDepthbuffer&&t.deleteRenderbuffer(R.__webglDepthbuffer),R.__webglMultisampledFramebuffer&&t.deleteFramebuffer(R.__webglMultisampledFramebuffer),R.__webglColorRenderbuffer)for(let xe=0;xe<R.__webglColorRenderbuffer.length;xe++)R.__webglColorRenderbuffer[xe]&&t.deleteRenderbuffer(R.__webglColorRenderbuffer[xe]);R.__webglDepthRenderbuffer&&t.deleteRenderbuffer(R.__webglDepthRenderbuffer)}const se=B.textures;for(let xe=0,we=se.length;xe<we;xe++){const ve=i.get(se[xe]);ve.__webglTexture&&(t.deleteTexture(ve.__webglTexture),o.memory.textures--),i.remove(se[xe])}i.remove(B)}let O=0;function G(){O=0}function J(){const B=O;return B>=r.maxTextures&&Gt("WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+r.maxTextures),O+=1,B}function H(B){const R=[];return R.push(B.wrapS),R.push(B.wrapT),R.push(B.wrapR||0),R.push(B.magFilter),R.push(B.minFilter),R.push(B.anisotropy),R.push(B.internalFormat),R.push(B.format),R.push(B.type),R.push(B.generateMipmaps),R.push(B.premultiplyAlpha),R.push(B.flipY),R.push(B.unpackAlignment),R.push(B.colorSpace),R.join()}function X(B,R){const se=i.get(B);if(B.isVideoTexture&&At(B),B.isRenderTargetTexture===!1&&B.isExternalTexture!==!0&&B.version>0&&se.__version!==B.version){const xe=B.image;if(xe===null)Gt("WebGLRenderer: Texture marked for update but no image data found.");else if(xe.complete===!1)Gt("WebGLRenderer: Texture marked for update but image is incomplete");else{ne(se,B,R);return}}else B.isExternalTexture&&(se.__webglTexture=B.sourceTexture?B.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,se.__webglTexture,t.TEXTURE0+R)}function K(B,R){const se=i.get(B);if(B.isRenderTargetTexture===!1&&B.version>0&&se.__version!==B.version){ne(se,B,R);return}else B.isExternalTexture&&(se.__webglTexture=B.sourceTexture?B.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,se.__webglTexture,t.TEXTURE0+R)}function Q(B,R){const se=i.get(B);if(B.isRenderTargetTexture===!1&&B.version>0&&se.__version!==B.version){ne(se,B,R);return}n.bindTexture(t.TEXTURE_3D,se.__webglTexture,t.TEXTURE0+R)}function W(B,R){const se=i.get(B);if(B.isCubeDepthTexture!==!0&&B.version>0&&se.__version!==B.version){ye(se,B,R);return}n.bindTexture(t.TEXTURE_CUBE_MAP,se.__webglTexture,t.TEXTURE0+R)}const q={[J0]:t.REPEAT,[Is]:t.CLAMP_TO_EDGE,[Q0]:t.MIRRORED_REPEAT},Z={[mi]:t.NEAREST,[OH]:t.NEAREST_MIPMAP_NEAREST,[tf]:t.NEAREST_MIPMAP_LINEAR,[wi]:t.LINEAR,[ug]:t.LINEAR_MIPMAP_NEAREST,[mo]:t.LINEAR_MIPMAP_LINEAR},z={[HH]:t.NEVER,[XH]:t.ALWAYS,[GH]:t.LESS,[i_]:t.LEQUAL,[jH]:t.EQUAL,[r_]:t.GEQUAL,[WH]:t.GREATER,[$H]:t.NOTEQUAL};function ie(B,R){if(R.type===Qr&&e.has("OES_texture_float_linear")===!1&&(R.magFilter===wi||R.magFilter===ug||R.magFilter===tf||R.magFilter===mo||R.minFilter===wi||R.minFilter===ug||R.minFilter===tf||R.minFilter===mo)&&Gt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(B,t.TEXTURE_WRAP_S,q[R.wrapS]),t.texParameteri(B,t.TEXTURE_WRAP_T,q[R.wrapT]),(B===t.TEXTURE_3D||B===t.TEXTURE_2D_ARRAY)&&t.texParameteri(B,t.TEXTURE_WRAP_R,q[R.wrapR]),t.texParameteri(B,t.TEXTURE_MAG_FILTER,Z[R.magFilter]),t.texParameteri(B,t.TEXTURE_MIN_FILTER,Z[R.minFilter]),R.compareFunction&&(t.texParameteri(B,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(B,t.TEXTURE_COMPARE_FUNC,z[R.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(R.magFilter===mi||R.minFilter!==tf&&R.minFilter!==mo||R.type===Qr&&e.has("OES_texture_float_linear")===!1)return;if(R.anisotropy>1||i.get(R).__currentAnisotropy){const se=e.get("EXT_texture_filter_anisotropic");t.texParameterf(B,se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,r.getMaxAnisotropy())),i.get(R).__currentAnisotropy=R.anisotropy}}}function Ee(B,R){let se=!1;B.__webglInit===void 0&&(B.__webglInit=!0,R.addEventListener("dispose",k));const xe=R.source;let we=m.get(xe);we===void 0&&(we={},m.set(xe,we));const ve=H(R);if(ve!==B.__cacheKey){we[ve]===void 0&&(we[ve]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,se=!0),we[ve].usedTimes++;const Ke=we[B.__cacheKey];Ke!==void 0&&(we[B.__cacheKey].usedTimes--,Ke.usedTimes===0&&P(R)),B.__cacheKey=ve,B.__webglTexture=we[ve].texture}return se}function ze(B,R,se){return Math.floor(Math.floor(B/se)/R)}function Se(B,R,se,xe){const ve=B.updateRanges;if(ve.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,R.width,R.height,se,xe,R.data);else{ve.sort((Pe,Oe)=>Pe.start-Oe.start);let Ke=0;for(let Pe=1;Pe<ve.length;Pe++){const Oe=ve[Ke],Ze=ve[Pe],rt=Oe.start+Oe.count,$e=ze(Ze.start,R.width,4),Ht=ze(Oe.start,R.width,4);Ze.start<=rt+1&&$e===Ht&&ze(Ze.start+Ze.count-1,R.width,4)===$e?Oe.count=Math.max(Oe.count,Ze.start+Ze.count-Oe.start):(++Ke,ve[Ke]=Ze)}ve.length=Ke+1;const ke=t.getParameter(t.UNPACK_ROW_LENGTH),pt=t.getParameter(t.UNPACK_SKIP_PIXELS),Pt=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,R.width);for(let Pe=0,Oe=ve.length;Pe<Oe;Pe++){const Ze=ve[Pe],rt=Math.floor(Ze.start/4),$e=Math.ceil(Ze.count/4),Ht=rt%R.width,re=Math.floor(rt/R.width),Ve=$e,Le=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,Ht),t.pixelStorei(t.UNPACK_SKIP_ROWS,re),n.texSubImage2D(t.TEXTURE_2D,0,Ht,re,Ve,Le,se,xe,R.data)}B.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,ke),t.pixelStorei(t.UNPACK_SKIP_PIXELS,pt),t.pixelStorei(t.UNPACK_SKIP_ROWS,Pt)}}function ne(B,R,se){let xe=t.TEXTURE_2D;(R.isDataArrayTexture||R.isCompressedArrayTexture)&&(xe=t.TEXTURE_2D_ARRAY),R.isData3DTexture&&(xe=t.TEXTURE_3D);const we=Ee(B,R),ve=R.source;n.bindTexture(xe,B.__webglTexture,t.TEXTURE0+se);const Ke=i.get(ve);if(ve.version!==Ke.__version||we===!0){n.activeTexture(t.TEXTURE0+se);const ke=fn.getPrimaries(fn.workingColorSpace),pt=R.colorSpace===Ca?null:fn.getPrimaries(R.colorSpace),Pt=R.colorSpace===Ca||ke===pt?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,R.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,R.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Pt);let Pe=w(R.image,!1,r.maxTextureSize);Pe=Lt(R,Pe);const Oe=s.convert(R.format,R.colorSpace),Ze=s.convert(R.type);let rt=A(R.internalFormat,Oe,Ze,R.colorSpace,R.isVideoTexture);ie(xe,R);let $e;const Ht=R.mipmaps,re=R.isVideoTexture!==!0,Ve=Ke.__version===void 0||we===!0,Le=ve.dataReady,Xe=I(R,Pe);if(R.isDepthTexture)rt=M(R.format===go,R.type),Ve&&(re?n.texStorage2D(t.TEXTURE_2D,1,rt,Pe.width,Pe.height):n.texImage2D(t.TEXTURE_2D,0,rt,Pe.width,Pe.height,0,Oe,Ze,null));else if(R.isDataTexture)if(Ht.length>0){re&&Ve&&n.texStorage2D(t.TEXTURE_2D,Xe,rt,Ht[0].width,Ht[0].height);for(let Re=0,_e=Ht.length;Re<_e;Re++)$e=Ht[Re],re?Le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,$e.width,$e.height,Oe,Ze,$e.data):n.texImage2D(t.TEXTURE_2D,Re,rt,$e.width,$e.height,0,Oe,Ze,$e.data);R.generateMipmaps=!1}else re?(Ve&&n.texStorage2D(t.TEXTURE_2D,Xe,rt,Pe.width,Pe.height),Le&&Se(R,Pe,Oe,Ze)):n.texImage2D(t.TEXTURE_2D,0,rt,Pe.width,Pe.height,0,Oe,Ze,Pe.data);else if(R.isCompressedTexture)if(R.isCompressedArrayTexture){re&&Ve&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Xe,rt,Ht[0].width,Ht[0].height,Pe.depth);for(let Re=0,_e=Ht.length;Re<_e;Re++)if($e=Ht[Re],R.format!==Fr)if(Oe!==null)if(re){if(Le)if(R.layerUpdates.size>0){const st=$1($e.width,$e.height,R.format,R.type);for(const Nt of R.layerUpdates){const mn=$e.data.subarray(Nt*st/$e.data.BYTES_PER_ELEMENT,(Nt+1)*st/$e.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,Nt,$e.width,$e.height,1,Oe,mn)}R.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,$e.width,$e.height,Pe.depth,Oe,$e.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Re,rt,$e.width,$e.height,Pe.depth,0,$e.data,0,0);else Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else re?Le&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,$e.width,$e.height,Pe.depth,Oe,Ze,$e.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Re,rt,$e.width,$e.height,Pe.depth,0,Oe,Ze,$e.data)}else{re&&Ve&&n.texStorage2D(t.TEXTURE_2D,Xe,rt,Ht[0].width,Ht[0].height);for(let Re=0,_e=Ht.length;Re<_e;Re++)$e=Ht[Re],R.format!==Fr?Oe!==null?re?Le&&n.compressedTexSubImage2D(t.TEXTURE_2D,Re,0,0,$e.width,$e.height,Oe,$e.data):n.compressedTexImage2D(t.TEXTURE_2D,Re,rt,$e.width,$e.height,0,$e.data):Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):re?Le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,$e.width,$e.height,Oe,Ze,$e.data):n.texImage2D(t.TEXTURE_2D,Re,rt,$e.width,$e.height,0,Oe,Ze,$e.data)}else if(R.isDataArrayTexture)if(re){if(Ve&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Xe,rt,Pe.width,Pe.height,Pe.depth),Le)if(R.layerUpdates.size>0){const Re=$1(Pe.width,Pe.height,R.format,R.type);for(const _e of R.layerUpdates){const st=Pe.data.subarray(_e*Re/Pe.data.BYTES_PER_ELEMENT,(_e+1)*Re/Pe.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,_e,Pe.width,Pe.height,1,Oe,Ze,st)}R.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Pe.width,Pe.height,Pe.depth,Oe,Ze,Pe.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,rt,Pe.width,Pe.height,Pe.depth,0,Oe,Ze,Pe.data);else if(R.isData3DTexture)re?(Ve&&n.texStorage3D(t.TEXTURE_3D,Xe,rt,Pe.width,Pe.height,Pe.depth),Le&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Pe.width,Pe.height,Pe.depth,Oe,Ze,Pe.data)):n.texImage3D(t.TEXTURE_3D,0,rt,Pe.width,Pe.height,Pe.depth,0,Oe,Ze,Pe.data);else if(R.isFramebufferTexture){if(Ve)if(re)n.texStorage2D(t.TEXTURE_2D,Xe,rt,Pe.width,Pe.height);else{let Re=Pe.width,_e=Pe.height;for(let st=0;st<Xe;st++)n.texImage2D(t.TEXTURE_2D,st,rt,Re,_e,0,Oe,Ze,null),Re>>=1,_e>>=1}}else if(Ht.length>0){if(re&&Ve){const Re=it(Ht[0]);n.texStorage2D(t.TEXTURE_2D,Xe,rt,Re.width,Re.height)}for(let Re=0,_e=Ht.length;Re<_e;Re++)$e=Ht[Re],re?Le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,Oe,Ze,$e):n.texImage2D(t.TEXTURE_2D,Re,rt,Oe,Ze,$e);R.generateMipmaps=!1}else if(re){if(Ve){const Re=it(Pe);n.texStorage2D(t.TEXTURE_2D,Xe,rt,Re.width,Re.height)}Le&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Oe,Ze,Pe)}else n.texImage2D(t.TEXTURE_2D,0,rt,Oe,Ze,Pe);y(R)&&b(xe),Ke.__version=ve.version,R.onUpdate&&R.onUpdate(R)}B.__version=R.version}function ye(B,R,se){if(R.image.length!==6)return;const xe=Ee(B,R),we=R.source;n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture,t.TEXTURE0+se);const ve=i.get(we);if(we.version!==ve.__version||xe===!0){n.activeTexture(t.TEXTURE0+se);const Ke=fn.getPrimaries(fn.workingColorSpace),ke=R.colorSpace===Ca?null:fn.getPrimaries(R.colorSpace),pt=R.colorSpace===Ca||Ke===ke?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,R.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,R.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,pt);const Pt=R.isCompressedTexture||R.image[0].isCompressedTexture,Pe=R.image[0]&&R.image[0].isDataTexture,Oe=[];for(let _e=0;_e<6;_e++)!Pt&&!Pe?Oe[_e]=w(R.image[_e],!0,r.maxCubemapSize):Oe[_e]=Pe?R.image[_e].image:R.image[_e],Oe[_e]=Lt(R,Oe[_e]);const Ze=Oe[0],rt=s.convert(R.format,R.colorSpace),$e=s.convert(R.type),Ht=A(R.internalFormat,rt,$e,R.colorSpace),re=R.isVideoTexture!==!0,Ve=ve.__version===void 0||xe===!0,Le=we.dataReady;let Xe=I(R,Ze);ie(t.TEXTURE_CUBE_MAP,R);let Re;if(Pt){re&&Ve&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Xe,Ht,Ze.width,Ze.height);for(let _e=0;_e<6;_e++){Re=Oe[_e].mipmaps;for(let st=0;st<Re.length;st++){const Nt=Re[st];R.format!==Fr?rt!==null?re?Le&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,0,0,Nt.width,Nt.height,rt,Nt.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,Ht,Nt.width,Nt.height,0,Nt.data):Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,0,0,Nt.width,Nt.height,rt,$e,Nt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,Ht,Nt.width,Nt.height,0,rt,$e,Nt.data)}}}else{if(Re=R.mipmaps,re&&Ve){Re.length>0&&Xe++;const _e=it(Oe[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Xe,Ht,_e.width,_e.height)}for(let _e=0;_e<6;_e++)if(Pe){re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,0,0,Oe[_e].width,Oe[_e].height,rt,$e,Oe[_e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,Ht,Oe[_e].width,Oe[_e].height,0,rt,$e,Oe[_e].data);for(let st=0;st<Re.length;st++){const mn=Re[st].image[_e].image;re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,0,0,mn.width,mn.height,rt,$e,mn.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,Ht,mn.width,mn.height,0,rt,$e,mn.data)}}else{re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,0,0,rt,$e,Oe[_e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,Ht,rt,$e,Oe[_e]);for(let st=0;st<Re.length;st++){const Nt=Re[st];re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,0,0,rt,$e,Nt.image[_e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,Ht,rt,$e,Nt.image[_e])}}}y(R)&&b(t.TEXTURE_CUBE_MAP),ve.__version=we.version,R.onUpdate&&R.onUpdate(R)}B.__version=R.version}function be(B,R,se,xe,we,ve){const Ke=s.convert(se.format,se.colorSpace),ke=s.convert(se.type),pt=A(se.internalFormat,Ke,ke,se.colorSpace),Pt=i.get(R),Pe=i.get(se);if(Pe.__renderTarget=R,!Pt.__hasExternalTextures){const Oe=Math.max(1,R.width>>ve),Ze=Math.max(1,R.height>>ve);we===t.TEXTURE_3D||we===t.TEXTURE_2D_ARRAY?n.texImage3D(we,ve,pt,Oe,Ze,R.depth,0,Ke,ke,null):n.texImage2D(we,ve,pt,Oe,Ze,0,Ke,ke,null)}n.bindFramebuffer(t.FRAMEBUFFER,B),Sn(R)?c.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,xe,we,Pe.__webglTexture,0,ee(R)):(we===t.TEXTURE_2D||we>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&we<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,xe,we,Pe.__webglTexture,ve),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ne(B,R,se){if(t.bindRenderbuffer(t.RENDERBUFFER,B),R.depthBuffer){const xe=R.depthTexture,we=xe&&xe.isDepthTexture?xe.type:null,ve=M(R.stencilBuffer,we),Ke=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;Sn(R)?c.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ee(R),ve,R.width,R.height):se?t.renderbufferStorageMultisample(t.RENDERBUFFER,ee(R),ve,R.width,R.height):t.renderbufferStorage(t.RENDERBUFFER,ve,R.width,R.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ke,t.RENDERBUFFER,B)}else{const xe=R.textures;for(let we=0;we<xe.length;we++){const ve=xe[we],Ke=s.convert(ve.format,ve.colorSpace),ke=s.convert(ve.type),pt=A(ve.internalFormat,Ke,ke,ve.colorSpace);Sn(R)?c.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ee(R),pt,R.width,R.height):se?t.renderbufferStorageMultisample(t.RENDERBUFFER,ee(R),pt,R.width,R.height):t.renderbufferStorage(t.RENDERBUFFER,pt,R.width,R.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function et(B,R,se){const xe=R.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,B),!(R.depthTexture&&R.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const we=i.get(R.depthTexture);if(we.__renderTarget=R,(!we.__webglTexture||R.depthTexture.image.width!==R.width||R.depthTexture.image.height!==R.height)&&(R.depthTexture.image.width=R.width,R.depthTexture.image.height=R.height,R.depthTexture.needsUpdate=!0),xe){if(we.__webglInit===void 0&&(we.__webglInit=!0,R.depthTexture.addEventListener("dispose",k)),we.__webglTexture===void 0){we.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,we.__webglTexture),ie(t.TEXTURE_CUBE_MAP,R.depthTexture);const Pt=s.convert(R.depthTexture.format),Pe=s.convert(R.depthTexture.type);let Oe;R.depthTexture.format===Gs?Oe=t.DEPTH_COMPONENT24:R.depthTexture.format===go&&(Oe=t.DEPTH24_STENCIL8);for(let Ze=0;Ze<6;Ze++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,Oe,R.width,R.height,0,Pt,Pe,null)}}else X(R.depthTexture,0);const ve=we.__webglTexture,Ke=ee(R),ke=xe?t.TEXTURE_CUBE_MAP_POSITIVE_X+se:t.TEXTURE_2D,pt=R.depthTexture.format===go?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(R.depthTexture.format===Gs)Sn(R)?c.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pt,ke,ve,0,Ke):t.framebufferTexture2D(t.FRAMEBUFFER,pt,ke,ve,0);else if(R.depthTexture.format===go)Sn(R)?c.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pt,ke,ve,0,Ke):t.framebufferTexture2D(t.FRAMEBUFFER,pt,ke,ve,0);else throw new Error("Unknown depthTexture format")}function xt(B){const R=i.get(B),se=B.isWebGLCubeRenderTarget===!0;if(R.__boundDepthTexture!==B.depthTexture){const xe=B.depthTexture;if(R.__depthDisposeCallback&&R.__depthDisposeCallback(),xe){const we=()=>{delete R.__boundDepthTexture,delete R.__depthDisposeCallback,xe.removeEventListener("dispose",we)};xe.addEventListener("dispose",we),R.__depthDisposeCallback=we}R.__boundDepthTexture=xe}if(B.depthTexture&&!R.__autoAllocateDepthBuffer)if(se)for(let xe=0;xe<6;xe++)et(R.__webglFramebuffer[xe],B,xe);else{const xe=B.texture.mipmaps;xe&&xe.length>0?et(R.__webglFramebuffer[0],B,0):et(R.__webglFramebuffer,B,0)}else if(se){R.__webglDepthbuffer=[];for(let xe=0;xe<6;xe++)if(n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer[xe]),R.__webglDepthbuffer[xe]===void 0)R.__webglDepthbuffer[xe]=t.createRenderbuffer(),Ne(R.__webglDepthbuffer[xe],B,!1);else{const we=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=R.__webglDepthbuffer[xe];t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,we,t.RENDERBUFFER,ve)}}else{const xe=B.texture.mipmaps;if(xe&&xe.length>0?n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer),R.__webglDepthbuffer===void 0)R.__webglDepthbuffer=t.createRenderbuffer(),Ne(R.__webglDepthbuffer,B,!1);else{const we=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=R.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,we,t.RENDERBUFFER,ve)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function pn(B,R,se){const xe=i.get(B);R!==void 0&&be(xe.__webglFramebuffer,B,B.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),se!==void 0&&xt(B)}function ht(B){const R=B.texture,se=i.get(B),xe=i.get(R);B.addEventListener("dispose",U);const we=B.textures,ve=B.isWebGLCubeRenderTarget===!0,Ke=we.length>1;if(Ke||(xe.__webglTexture===void 0&&(xe.__webglTexture=t.createTexture()),xe.__version=R.version,o.memory.textures++),ve){se.__webglFramebuffer=[];for(let ke=0;ke<6;ke++)if(R.mipmaps&&R.mipmaps.length>0){se.__webglFramebuffer[ke]=[];for(let pt=0;pt<R.mipmaps.length;pt++)se.__webglFramebuffer[ke][pt]=t.createFramebuffer()}else se.__webglFramebuffer[ke]=t.createFramebuffer()}else{if(R.mipmaps&&R.mipmaps.length>0){se.__webglFramebuffer=[];for(let ke=0;ke<R.mipmaps.length;ke++)se.__webglFramebuffer[ke]=t.createFramebuffer()}else se.__webglFramebuffer=t.createFramebuffer();if(Ke)for(let ke=0,pt=we.length;ke<pt;ke++){const Pt=i.get(we[ke]);Pt.__webglTexture===void 0&&(Pt.__webglTexture=t.createTexture(),o.memory.textures++)}if(B.samples>0&&Sn(B)===!1){se.__webglMultisampledFramebuffer=t.createFramebuffer(),se.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,se.__webglMultisampledFramebuffer);for(let ke=0;ke<we.length;ke++){const pt=we[ke];se.__webglColorRenderbuffer[ke]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,se.__webglColorRenderbuffer[ke]);const Pt=s.convert(pt.format,pt.colorSpace),Pe=s.convert(pt.type),Oe=A(pt.internalFormat,Pt,Pe,pt.colorSpace,B.isXRRenderTarget===!0),Ze=ee(B);t.renderbufferStorageMultisample(t.RENDERBUFFER,Ze,Oe,B.width,B.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ke,t.RENDERBUFFER,se.__webglColorRenderbuffer[ke])}t.bindRenderbuffer(t.RENDERBUFFER,null),B.depthBuffer&&(se.__webglDepthRenderbuffer=t.createRenderbuffer(),Ne(se.__webglDepthRenderbuffer,B,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ve){n.bindTexture(t.TEXTURE_CUBE_MAP,xe.__webglTexture),ie(t.TEXTURE_CUBE_MAP,R);for(let ke=0;ke<6;ke++)if(R.mipmaps&&R.mipmaps.length>0)for(let pt=0;pt<R.mipmaps.length;pt++)be(se.__webglFramebuffer[ke][pt],B,R,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,pt);else be(se.__webglFramebuffer[ke],B,R,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,0);y(R)&&b(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ke){for(let ke=0,pt=we.length;ke<pt;ke++){const Pt=we[ke],Pe=i.get(Pt);let Oe=t.TEXTURE_2D;(B.isWebGL3DRenderTarget||B.isWebGLArrayRenderTarget)&&(Oe=B.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Oe,Pe.__webglTexture),ie(Oe,Pt),be(se.__webglFramebuffer,B,Pt,t.COLOR_ATTACHMENT0+ke,Oe,0),y(Pt)&&b(Oe)}n.unbindTexture()}else{let ke=t.TEXTURE_2D;if((B.isWebGL3DRenderTarget||B.isWebGLArrayRenderTarget)&&(ke=B.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ke,xe.__webglTexture),ie(ke,R),R.mipmaps&&R.mipmaps.length>0)for(let pt=0;pt<R.mipmaps.length;pt++)be(se.__webglFramebuffer[pt],B,R,t.COLOR_ATTACHMENT0,ke,pt);else be(se.__webglFramebuffer,B,R,t.COLOR_ATTACHMENT0,ke,0);y(R)&&b(ke),n.unbindTexture()}B.depthBuffer&&xt(B)}function Ft(B){const R=B.textures;for(let se=0,xe=R.length;se<xe;se++){const we=R[se];if(y(we)){const ve=T(B),Ke=i.get(we).__webglTexture;n.bindTexture(ve,Ke),b(ve),n.unbindTexture()}}}const nn=[],Dt=[];function an(B){if(B.samples>0){if(Sn(B)===!1){const R=B.textures,se=B.width,xe=B.height;let we=t.COLOR_BUFFER_BIT;const ve=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ke=i.get(B),ke=R.length>1;if(ke)for(let Pt=0;Pt<R.length;Pt++)n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer);const pt=B.texture.mipmaps;pt&&pt.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let Pt=0;Pt<R.length;Pt++){if(B.resolveDepthBuffer&&(B.depthBuffer&&(we|=t.DEPTH_BUFFER_BIT),B.stencilBuffer&&B.resolveStencilBuffer&&(we|=t.STENCIL_BUFFER_BIT)),ke){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[Pt]);const Pe=i.get(R[Pt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Pe,0)}t.blitFramebuffer(0,0,se,xe,0,0,se,xe,we,t.NEAREST),u===!0&&(nn.length=0,Dt.length=0,nn.push(t.COLOR_ATTACHMENT0+Pt),B.depthBuffer&&B.resolveDepthBuffer===!1&&(nn.push(ve),Dt.push(ve),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Dt)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,nn))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),ke)for(let Pt=0;Pt<R.length;Pt++){n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[Pt]);const Pe=i.get(R[Pt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.TEXTURE_2D,Pe,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}else if(B.depthBuffer&&B.resolveDepthBuffer===!1&&u){const R=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[R])}}}function ee(B){return Math.min(r.maxSamples,B.samples)}function Sn(B){const R=i.get(B);return B.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&R.__useRenderToTexture!==!1}function At(B){const R=o.render.frame;h.get(B)!==R&&(h.set(B,R),B.update())}function Lt(B,R){const se=B.colorSpace,xe=B.format,we=B.type;return B.isCompressedTexture===!0||B.isVideoTexture===!0||se!==Ao&&se!==Ca&&(fn.getTransfer(se)===wn?(xe!==Fr||we!==fr)&&Gt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):_n("WebGLTextures: Unsupported texture color space:",se)),R}function it(B){return typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement?(d.width=B.naturalWidth||B.width,d.height=B.naturalHeight||B.height):typeof VideoFrame<"u"&&B instanceof VideoFrame?(d.width=B.displayWidth,d.height=B.displayHeight):(d.width=B.width,d.height=B.height),d}this.allocateTextureUnit=J,this.resetTextureUnits=G,this.setTexture2D=X,this.setTexture2DArray=K,this.setTexture3D=Q,this.setTextureCube=W,this.rebindTextures=pn,this.setupRenderTarget=ht,this.updateRenderTargetMipmap=Ft,this.updateMultisampleRenderTarget=an,this.setupDepthRenderbuffer=xt,this.setupFrameBufferTexture=be,this.useMultisampledRTT=Sn,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function gW(t,e){function n(i,r=Ca){let s;const o=fn.getTransfer(r);if(i===fr)return t.UNSIGNED_BYTE;if(i===Jy)return t.UNSIGNED_SHORT_4_4_4_4;if(i===Qy)return t.UNSIGNED_SHORT_5_5_5_1;if(i===cP)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===uP)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===oP)return t.BYTE;if(i===lP)return t.SHORT;if(i===xu)return t.UNSIGNED_SHORT;if(i===Zy)return t.INT;if(i===us)return t.UNSIGNED_INT;if(i===Qr)return t.FLOAT;if(i===Hs)return t.HALF_FLOAT;if(i===dP)return t.ALPHA;if(i===fP)return t.RGB;if(i===Fr)return t.RGBA;if(i===Gs)return t.DEPTH_COMPONENT;if(i===go)return t.DEPTH_STENCIL;if(i===hP)return t.RED;if(i===e_)return t.RED_INTEGER;if(i===$l)return t.RG;if(i===t_)return t.RG_INTEGER;if(i===n_)return t.RGBA_INTEGER;if(i===Wf||i===$f||i===Xf||i===qf)if(o===wn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Wf)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===$f)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Xf)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===qf)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Wf)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===$f)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Xf)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===qf)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===ev||i===tv||i===nv||i===iv)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===ev)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===tv)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===nv)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===iv)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===rv||i===sv||i===av||i===ov||i===lv||i===cv||i===uv)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===rv||i===sv)return o===wn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===av)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===ov)return s.COMPRESSED_R11_EAC;if(i===lv)return s.COMPRESSED_SIGNED_R11_EAC;if(i===cv)return s.COMPRESSED_RG11_EAC;if(i===uv)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===dv||i===fv||i===hv||i===pv||i===mv||i===gv||i===vv||i===yv||i===_v||i===xv||i===bv||i===Sv||i===wv||i===Ev)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===dv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===fv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===hv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===pv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===mv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===gv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===vv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===yv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===_v)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===xv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===bv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Sv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ev)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Mv||i===Tv||i===Av)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Mv)return o===wn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Tv)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Av)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Cv||i===Pv||i===Rv||i===kv)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Cv)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Pv)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Rv)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===kv)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===bu?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const vW=`
|
|
4635
|
+
}`,dW=[new me(1,0,0),new me(-1,0,0),new me(0,1,0),new me(0,-1,0),new me(0,0,1),new me(0,0,-1)],fW=[new me(0,-1,0),new me(0,-1,0),new me(0,0,1),new me(0,0,-1),new me(0,-1,0),new me(0,-1,0)],mE=new Kn,Yc=new me,zg=new me;function hW(t,e,n){let i=new SP;const r=new bn,s=new bn,o=new Vn,c=new C6,u=new P6,d={},h=n.maxTextureSize,p={[Ua]:Gi,[Gi]:Ua,[Ns]:Ns},m=new fs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new bn},radius:{value:4}},vertexShader:cW,fragmentShader:uW}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new gs;_.setAttribute("position",new Vr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const w=new ds(_,m),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=jf;let b=this.type;this.render=function(k,U,S){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||k.length===0)return;this.type===vH&&(Gt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=jf);const P=t.getRenderTarget(),V=t.getActiveCubeFace(),O=t.getActiveMipmapLevel(),G=t.state;G.setBlending(Os),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const J=b!==this.type;J&&U.traverse(function(H){H.material&&(Array.isArray(H.material)?H.material.forEach(X=>X.needsUpdate=!0):H.material.needsUpdate=!0)});for(let H=0,X=k.length;H<X;H++){const K=k[H],Q=K.shadow;if(Q===void 0){Gt("WebGLShadowMap:",K,"has no shadow.");continue}if(Q.autoUpdate===!1&&Q.needsUpdate===!1)continue;r.copy(Q.mapSize);const W=Q.getFrameExtents();r.multiply(W),s.copy(Q.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/W.x),r.x=s.x*W.x,Q.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/W.y),r.y=s.y*W.y,Q.mapSize.y=s.y));const q=t.state.buffers.depth.getReversed();if(Q.camera._reversedDepth=q,Q.map===null||J===!0){if(Q.map!==null&&(Q.map.depthTexture!==null&&(Q.map.depthTexture.dispose(),Q.map.depthTexture=null),Q.map.dispose()),this.type===tu){if(K.isPointLight){Gt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Q.map=new rs(r.x,r.y,{format:$l,type:Hs,minFilter:wi,magFilter:wi,generateMipmaps:!1}),Q.map.texture.name=K.name+".shadowMap",Q.map.depthTexture=new Su(r.x,r.y,Qr),Q.map.depthTexture.name=K.name+".shadowMapDepth",Q.map.depthTexture.format=Gs,Q.map.depthTexture.compareFunction=null,Q.map.depthTexture.minFilter=mi,Q.map.depthTexture.magFilter=mi}else K.isPointLight?(Q.map=new PP(r.x),Q.map.depthTexture=new w6(r.x,us)):(Q.map=new rs(r.x,r.y),Q.map.depthTexture=new Su(r.x,r.y,us)),Q.map.depthTexture.name=K.name+".shadowMap",Q.map.depthTexture.format=Gs,this.type===jf?(Q.map.depthTexture.compareFunction=q?r_:i_,Q.map.depthTexture.minFilter=wi,Q.map.depthTexture.magFilter=wi):(Q.map.depthTexture.compareFunction=null,Q.map.depthTexture.minFilter=mi,Q.map.depthTexture.magFilter=mi);Q.camera.updateProjectionMatrix()}const Z=Q.map.isWebGLCubeRenderTarget?6:1;for(let z=0;z<Z;z++){if(Q.map.isWebGLCubeRenderTarget)t.setRenderTarget(Q.map,z),t.clear();else{z===0&&(t.setRenderTarget(Q.map),t.clear());const ie=Q.getViewport(z);o.set(s.x*ie.x,s.y*ie.y,s.x*ie.z,s.y*ie.w),G.viewport(o)}if(K.isPointLight){const ie=Q.camera,we=Q.matrix,He=K.distance||ie.far;He!==ie.far&&(ie.far=He,ie.updateProjectionMatrix()),Yc.setFromMatrixPosition(K.matrixWorld),ie.position.copy(Yc),zg.copy(ie.position),zg.add(dW[z]),ie.up.copy(fW[z]),ie.lookAt(zg),ie.updateMatrixWorld(),we.makeTranslation(-Yc.x,-Yc.y,-Yc.z),mE.multiplyMatrices(ie.projectionMatrix,ie.matrixWorldInverse),Q._frustum.setFromProjectionMatrix(mE,ie.coordinateSystem,ie.reversedDepth)}else Q.updateMatrices(K);i=Q.getFrustum(),M(U,S,Q.camera,K,this.type)}Q.isPointLightShadow!==!0&&this.type===tu&&T(Q,S),Q.needsUpdate=!1}b=this.type,y.needsUpdate=!1,t.setRenderTarget(P,V,O)};function T(k,U){const S=e.update(w);m.defines.VSM_SAMPLES!==k.blurSamples&&(m.defines.VSM_SAMPLES=k.blurSamples,v.defines.VSM_SAMPLES=k.blurSamples,m.needsUpdate=!0,v.needsUpdate=!0),k.mapPass===null&&(k.mapPass=new rs(r.x,r.y,{format:$l,type:Hs})),m.uniforms.shadow_pass.value=k.map.depthTexture,m.uniforms.resolution.value=k.mapSize,m.uniforms.radius.value=k.radius,t.setRenderTarget(k.mapPass),t.clear(),t.renderBufferDirect(U,null,S,m,w,null),v.uniforms.shadow_pass.value=k.mapPass.texture,v.uniforms.resolution.value=k.mapSize,v.uniforms.radius.value=k.radius,t.setRenderTarget(k.map),t.clear(),t.renderBufferDirect(U,null,S,v,w,null)}function A(k,U,S,P){let V=null;const O=S.isPointLight===!0?k.customDistanceMaterial:k.customDepthMaterial;if(O!==void 0)V=O;else if(V=S.isPointLight===!0?u:c,t.localClippingEnabled&&U.clipShadows===!0&&Array.isArray(U.clippingPlanes)&&U.clippingPlanes.length!==0||U.displacementMap&&U.displacementScale!==0||U.alphaMap&&U.alphaTest>0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const G=V.uuid,J=U.uuid;let H=d[G];H===void 0&&(H={},d[G]=H);let X=H[J];X===void 0&&(X=V.clone(),H[J]=X,U.addEventListener("dispose",I)),V=X}if(V.visible=U.visible,V.wireframe=U.wireframe,P===tu?V.side=U.shadowSide!==null?U.shadowSide:U.side:V.side=U.shadowSide!==null?U.shadowSide:p[U.side],V.alphaMap=U.alphaMap,V.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,V.map=U.map,V.clipShadows=U.clipShadows,V.clippingPlanes=U.clippingPlanes,V.clipIntersection=U.clipIntersection,V.displacementMap=U.displacementMap,V.displacementScale=U.displacementScale,V.displacementBias=U.displacementBias,V.wireframeLinewidth=U.wireframeLinewidth,V.linewidth=U.linewidth,S.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const G=t.properties.get(V);G.light=S}return V}function M(k,U,S,P,V){if(k.visible===!1)return;if(k.layers.test(U.layers)&&(k.isMesh||k.isLine||k.isPoints)&&(k.castShadow||k.receiveShadow&&V===tu)&&(!k.frustumCulled||i.intersectsObject(k))){k.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,k.matrixWorld);const J=e.update(k),H=k.material;if(Array.isArray(H)){const X=J.groups;for(let K=0,Q=X.length;K<Q;K++){const W=X[K],q=H[W.materialIndex];if(q&&q.visible){const Z=A(k,q,P,V);k.onBeforeShadow(t,k,U,S,J,Z,W),t.renderBufferDirect(S,null,J,Z,k,W),k.onAfterShadow(t,k,U,S,J,Z,W)}}}else if(H.visible){const X=A(k,H,P,V);k.onBeforeShadow(t,k,U,S,J,X,null),t.renderBufferDirect(S,null,J,X,k,null),k.onAfterShadow(t,k,U,S,J,X,null)}}const G=k.children;for(let J=0,H=G.length;J<H;J++)M(G[J],U,S,P,V)}function I(k){k.target.removeEventListener("dispose",I);for(const S in d){const P=d[S],V=k.target.uuid;V in P&&(P[V].dispose(),delete P[V])}}}function pW(t,e){function n(){let re=!1;const ze=new Vn;let Le=null;const Xe=new Vn(0,0,0,0);return{setMask:function(Re){Le!==Re&&!re&&(t.colorMask(Re,Re,Re,Re),Le=Re)},setLocked:function(Re){re=Re},setClear:function(Re,_e,st,Nt,mn){mn===!0&&(Re*=Nt,_e*=Nt,st*=Nt),ze.set(Re,_e,st,Nt),Xe.equals(ze)===!1&&(t.clearColor(Re,_e,st,Nt),Xe.copy(ze))},reset:function(){re=!1,Le=null,Xe.set(-1,0,0,0)}}}function i(){let re=!1,ze=!1,Le=null,Xe=null,Re=null;return{setReversed:function(_e){if(ze!==_e){const st=e.get("EXT_clip_control");_e?st.clipControlEXT(st.LOWER_LEFT_EXT,st.ZERO_TO_ONE_EXT):st.clipControlEXT(st.LOWER_LEFT_EXT,st.NEGATIVE_ONE_TO_ONE_EXT),ze=_e;const Nt=Re;Re=null,this.setClear(Nt)}},getReversed:function(){return ze},setTest:function(_e){_e?ye(t.DEPTH_TEST):be(t.DEPTH_TEST)},setMask:function(_e){Le!==_e&&!re&&(t.depthMask(_e),Le=_e)},setFunc:function(_e){if(ze&&(_e=ZH[_e]),Xe!==_e){switch(_e){case W0:t.depthFunc(t.NEVER);break;case $0:t.depthFunc(t.ALWAYS);break;case X0:t.depthFunc(t.LESS);break;case jl:t.depthFunc(t.LEQUAL);break;case q0:t.depthFunc(t.EQUAL);break;case Y0:t.depthFunc(t.GEQUAL);break;case K0:t.depthFunc(t.GREATER);break;case Z0:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Xe=_e}},setLocked:function(_e){re=_e},setClear:function(_e){Re!==_e&&(Re=_e,ze&&(_e=1-_e),t.clearDepth(_e))},reset:function(){re=!1,Le=null,Xe=null,Re=null,ze=!1}}}function r(){let re=!1,ze=null,Le=null,Xe=null,Re=null,_e=null,st=null,Nt=null,mn=null;return{setTest:function(Kt){re||(Kt?ye(t.STENCIL_TEST):be(t.STENCIL_TEST))},setMask:function(Kt){ze!==Kt&&!re&&(t.stencilMask(Kt),ze=Kt)},setFunc:function(Kt,ui,ri){(Le!==Kt||Xe!==ui||Re!==ri)&&(t.stencilFunc(Kt,ui,ri),Le=Kt,Xe=ui,Re=ri)},setOp:function(Kt,ui,ri){(_e!==Kt||st!==ui||Nt!==ri)&&(t.stencilOp(Kt,ui,ri),_e=Kt,st=ui,Nt=ri)},setLocked:function(Kt){re=Kt},setClear:function(Kt){mn!==Kt&&(t.clearStencil(Kt),mn=Kt)},reset:function(){re=!1,ze=null,Le=null,Xe=null,Re=null,_e=null,st=null,Nt=null,mn=null}}}const s=new n,o=new i,c=new r,u=new WeakMap,d=new WeakMap;let h={},p={},m=new WeakMap,v=[],_=null,w=!1,y=null,b=null,T=null,A=null,M=null,I=null,k=null,U=new Tn(0,0,0),S=0,P=!1,V=null,O=null,G=null,J=null,H=null;const X=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let K=!1,Q=0;const W=t.getParameter(t.VERSION);W.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(W)[1]),K=Q>=1):W.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),K=Q>=2);let q=null,Z={};const z=t.getParameter(t.SCISSOR_BOX),ie=t.getParameter(t.VIEWPORT),we=new Vn().fromArray(z),He=new Vn().fromArray(ie);function Se(re,ze,Le,Xe){const Re=new Uint8Array(4),_e=t.createTexture();t.bindTexture(re,_e),t.texParameteri(re,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(re,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let st=0;st<Le;st++)re===t.TEXTURE_3D||re===t.TEXTURE_2D_ARRAY?t.texImage3D(ze,0,t.RGBA,1,1,Xe,0,t.RGBA,t.UNSIGNED_BYTE,Re):t.texImage2D(ze+st,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Re);return _e}const ne={};ne[t.TEXTURE_2D]=Se(t.TEXTURE_2D,t.TEXTURE_2D,1),ne[t.TEXTURE_CUBE_MAP]=Se(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),ne[t.TEXTURE_2D_ARRAY]=Se(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),ne[t.TEXTURE_3D]=Se(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),c.setClear(0),ye(t.DEPTH_TEST),o.setFunc(jl),Dt(!1),an(b1),ye(t.CULL_FACE),Ft(Os);function ye(re){h[re]!==!0&&(t.enable(re),h[re]=!0)}function be(re){h[re]!==!1&&(t.disable(re),h[re]=!1)}function Ne(re,ze){return p[re]!==ze?(t.bindFramebuffer(re,ze),p[re]=ze,re===t.DRAW_FRAMEBUFFER&&(p[t.FRAMEBUFFER]=ze),re===t.FRAMEBUFFER&&(p[t.DRAW_FRAMEBUFFER]=ze),!0):!1}function et(re,ze){let Le=v,Xe=!1;if(re){Le=m.get(ze),Le===void 0&&(Le=[],m.set(ze,Le));const Re=re.textures;if(Le.length!==Re.length||Le[0]!==t.COLOR_ATTACHMENT0){for(let _e=0,st=Re.length;_e<st;_e++)Le[_e]=t.COLOR_ATTACHMENT0+_e;Le.length=Re.length,Xe=!0}}else Le[0]!==t.BACK&&(Le[0]=t.BACK,Xe=!0);Xe&&t.drawBuffers(Le)}function xt(re){return _!==re?(t.useProgram(re),_=re,!0):!1}const pn={[lo]:t.FUNC_ADD,[_H]:t.FUNC_SUBTRACT,[xH]:t.FUNC_REVERSE_SUBTRACT};pn[bH]=t.MIN,pn[SH]=t.MAX;const ht={[wH]:t.ZERO,[EH]:t.ONE,[MH]:t.SRC_COLOR,[G0]:t.SRC_ALPHA,[kH]:t.SRC_ALPHA_SATURATE,[PH]:t.DST_COLOR,[AH]:t.DST_ALPHA,[TH]:t.ONE_MINUS_SRC_COLOR,[j0]:t.ONE_MINUS_SRC_ALPHA,[RH]:t.ONE_MINUS_DST_COLOR,[CH]:t.ONE_MINUS_DST_ALPHA,[LH]:t.CONSTANT_COLOR,[DH]:t.ONE_MINUS_CONSTANT_COLOR,[NH]:t.CONSTANT_ALPHA,[IH]:t.ONE_MINUS_CONSTANT_ALPHA};function Ft(re,ze,Le,Xe,Re,_e,st,Nt,mn,Kt){if(re===Os){w===!0&&(be(t.BLEND),w=!1);return}if(w===!1&&(ye(t.BLEND),w=!0),re!==yH){if(re!==y||Kt!==P){if((b!==lo||M!==lo)&&(t.blendEquation(t.FUNC_ADD),b=lo,M=lo),Kt)switch(re){case _o:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case S1:t.blendFunc(t.ONE,t.ONE);break;case w1:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case E1:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:_n("WebGLState: Invalid blending: ",re);break}else switch(re){case _o:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case S1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case w1:_n("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case E1:_n("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:_n("WebGLState: Invalid blending: ",re);break}T=null,A=null,I=null,k=null,U.set(0,0,0),S=0,y=re,P=Kt}return}Re=Re||ze,_e=_e||Le,st=st||Xe,(ze!==b||Re!==M)&&(t.blendEquationSeparate(pn[ze],pn[Re]),b=ze,M=Re),(Le!==T||Xe!==A||_e!==I||st!==k)&&(t.blendFuncSeparate(ht[Le],ht[Xe],ht[_e],ht[st]),T=Le,A=Xe,I=_e,k=st),(Nt.equals(U)===!1||mn!==S)&&(t.blendColor(Nt.r,Nt.g,Nt.b,mn),U.copy(Nt),S=mn),y=re,P=!1}function nn(re,ze){re.side===Ns?be(t.CULL_FACE):ye(t.CULL_FACE);let Le=re.side===Gi;ze&&(Le=!Le),Dt(Le),re.blending===_o&&re.transparent===!1?Ft(Os):Ft(re.blending,re.blendEquation,re.blendSrc,re.blendDst,re.blendEquationAlpha,re.blendSrcAlpha,re.blendDstAlpha,re.blendColor,re.blendAlpha,re.premultipliedAlpha),o.setFunc(re.depthFunc),o.setTest(re.depthTest),o.setMask(re.depthWrite),s.setMask(re.colorWrite);const Xe=re.stencilWrite;c.setTest(Xe),Xe&&(c.setMask(re.stencilWriteMask),c.setFunc(re.stencilFunc,re.stencilRef,re.stencilFuncMask),c.setOp(re.stencilFail,re.stencilZFail,re.stencilZPass)),Sn(re.polygonOffset,re.polygonOffsetFactor,re.polygonOffsetUnits),re.alphaToCoverage===!0?ye(t.SAMPLE_ALPHA_TO_COVERAGE):be(t.SAMPLE_ALPHA_TO_COVERAGE)}function Dt(re){V!==re&&(re?t.frontFace(t.CW):t.frontFace(t.CCW),V=re)}function an(re){re!==mH?(ye(t.CULL_FACE),re!==O&&(re===b1?t.cullFace(t.BACK):re===gH?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):be(t.CULL_FACE),O=re}function ee(re){re!==G&&(K&&t.lineWidth(re),G=re)}function Sn(re,ze,Le){re?(ye(t.POLYGON_OFFSET_FILL),(J!==ze||H!==Le)&&(J=ze,H=Le,o.getReversed()&&(ze=-ze),t.polygonOffset(ze,Le))):be(t.POLYGON_OFFSET_FILL)}function At(re){re?ye(t.SCISSOR_TEST):be(t.SCISSOR_TEST)}function Lt(re){re===void 0&&(re=t.TEXTURE0+X-1),q!==re&&(t.activeTexture(re),q=re)}function it(re,ze,Le){Le===void 0&&(q===null?Le=t.TEXTURE0+X-1:Le=q);let Xe=Z[Le];Xe===void 0&&(Xe={type:void 0,texture:void 0},Z[Le]=Xe),(Xe.type!==re||Xe.texture!==ze)&&(q!==Le&&(t.activeTexture(Le),q=Le),t.bindTexture(re,ze||ne[re]),Xe.type=re,Xe.texture=ze)}function B(){const re=Z[q];re!==void 0&&re.type!==void 0&&(t.bindTexture(re.type,null),re.type=void 0,re.texture=void 0)}function R(){try{t.compressedTexImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function se(){try{t.compressedTexImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function xe(){try{t.texSubImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function Ee(){try{t.texSubImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function ve(){try{t.compressedTexSubImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function Ke(){try{t.compressedTexSubImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function ke(){try{t.texStorage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function pt(){try{t.texStorage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function Pt(){try{t.texImage2D(...arguments)}catch(re){_n("WebGLState:",re)}}function Pe(){try{t.texImage3D(...arguments)}catch(re){_n("WebGLState:",re)}}function Oe(re){we.equals(re)===!1&&(t.scissor(re.x,re.y,re.z,re.w),we.copy(re))}function Ze(re){He.equals(re)===!1&&(t.viewport(re.x,re.y,re.z,re.w),He.copy(re))}function rt(re,ze){let Le=d.get(ze);Le===void 0&&(Le=new WeakMap,d.set(ze,Le));let Xe=Le.get(re);Xe===void 0&&(Xe=t.getUniformBlockIndex(ze,re.name),Le.set(re,Xe))}function $e(re,ze){const Xe=d.get(ze).get(re);u.get(ze)!==Xe&&(t.uniformBlockBinding(ze,Xe,re.__bindingPointIndex),u.set(ze,Xe))}function Ht(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),o.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),h={},q=null,Z={},p={},m=new WeakMap,v=[],_=null,w=!1,y=null,b=null,T=null,A=null,M=null,I=null,k=null,U=new Tn(0,0,0),S=0,P=!1,V=null,O=null,G=null,J=null,H=null,we.set(0,0,t.canvas.width,t.canvas.height),He.set(0,0,t.canvas.width,t.canvas.height),s.reset(),o.reset(),c.reset()}return{buffers:{color:s,depth:o,stencil:c},enable:ye,disable:be,bindFramebuffer:Ne,drawBuffers:et,useProgram:xt,setBlending:Ft,setMaterial:nn,setFlipSided:Dt,setCullFace:an,setLineWidth:ee,setPolygonOffset:Sn,setScissorTest:At,activeTexture:Lt,bindTexture:it,unbindTexture:B,compressedTexImage2D:R,compressedTexImage3D:se,texImage2D:Pt,texImage3D:Pe,updateUBOMapping:rt,uniformBlockBinding:$e,texStorage2D:ke,texStorage3D:pt,texSubImage2D:xe,texSubImage3D:Ee,compressedTexSubImage2D:ve,compressedTexSubImage3D:Ke,scissor:Oe,viewport:Ze,reset:Ht}}function mW(t,e,n,i,r,s,o){const c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new bn,h=new WeakMap;let p;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(B,R){return v?new OffscreenCanvas(B,R):Eh("canvas")}function w(B,R,se){let xe=1;const Ee=it(B);if((Ee.width>se||Ee.height>se)&&(xe=se/Math.max(Ee.width,Ee.height)),xe<1)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap||typeof VideoFrame<"u"&&B instanceof VideoFrame){const ve=Math.floor(xe*Ee.width),Ke=Math.floor(xe*Ee.height);p===void 0&&(p=_(ve,Ke));const ke=R?_(ve,Ke):p;return ke.width=ve,ke.height=Ke,ke.getContext("2d").drawImage(B,0,0,ve,Ke),Gt("WebGLRenderer: Texture has been resized from ("+Ee.width+"x"+Ee.height+") to ("+ve+"x"+Ke+")."),ke}else return"data"in B&&Gt("WebGLRenderer: Image in DataTexture is too big ("+Ee.width+"x"+Ee.height+")."),B;return B}function y(B){return B.generateMipmaps}function b(B){t.generateMipmap(B)}function T(B){return B.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:B.isWebGL3DRenderTarget?t.TEXTURE_3D:B.isWebGLArrayRenderTarget||B.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(B,R,se,xe,Ee=!1){if(B!==null){if(t[B]!==void 0)return t[B];Gt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let ve=R;if(R===t.RED&&(se===t.FLOAT&&(ve=t.R32F),se===t.HALF_FLOAT&&(ve=t.R16F),se===t.UNSIGNED_BYTE&&(ve=t.R8)),R===t.RED_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.R8UI),se===t.UNSIGNED_SHORT&&(ve=t.R16UI),se===t.UNSIGNED_INT&&(ve=t.R32UI),se===t.BYTE&&(ve=t.R8I),se===t.SHORT&&(ve=t.R16I),se===t.INT&&(ve=t.R32I)),R===t.RG&&(se===t.FLOAT&&(ve=t.RG32F),se===t.HALF_FLOAT&&(ve=t.RG16F),se===t.UNSIGNED_BYTE&&(ve=t.RG8)),R===t.RG_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.RG8UI),se===t.UNSIGNED_SHORT&&(ve=t.RG16UI),se===t.UNSIGNED_INT&&(ve=t.RG32UI),se===t.BYTE&&(ve=t.RG8I),se===t.SHORT&&(ve=t.RG16I),se===t.INT&&(ve=t.RG32I)),R===t.RGB_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.RGB8UI),se===t.UNSIGNED_SHORT&&(ve=t.RGB16UI),se===t.UNSIGNED_INT&&(ve=t.RGB32UI),se===t.BYTE&&(ve=t.RGB8I),se===t.SHORT&&(ve=t.RGB16I),se===t.INT&&(ve=t.RGB32I)),R===t.RGBA_INTEGER&&(se===t.UNSIGNED_BYTE&&(ve=t.RGBA8UI),se===t.UNSIGNED_SHORT&&(ve=t.RGBA16UI),se===t.UNSIGNED_INT&&(ve=t.RGBA32UI),se===t.BYTE&&(ve=t.RGBA8I),se===t.SHORT&&(ve=t.RGBA16I),se===t.INT&&(ve=t.RGBA32I)),R===t.RGB&&(se===t.UNSIGNED_INT_5_9_9_9_REV&&(ve=t.RGB9_E5),se===t.UNSIGNED_INT_10F_11F_11F_REV&&(ve=t.R11F_G11F_B10F)),R===t.RGBA){const Ke=Ee?Sh:fn.getTransfer(xe);se===t.FLOAT&&(ve=t.RGBA32F),se===t.HALF_FLOAT&&(ve=t.RGBA16F),se===t.UNSIGNED_BYTE&&(ve=Ke===wn?t.SRGB8_ALPHA8:t.RGBA8),se===t.UNSIGNED_SHORT_4_4_4_4&&(ve=t.RGBA4),se===t.UNSIGNED_SHORT_5_5_5_1&&(ve=t.RGB5_A1)}return(ve===t.R16F||ve===t.R32F||ve===t.RG16F||ve===t.RG32F||ve===t.RGBA16F||ve===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ve}function M(B,R){let se;return B?R===null||R===us||R===bu?se=t.DEPTH24_STENCIL8:R===Qr?se=t.DEPTH32F_STENCIL8:R===xu&&(se=t.DEPTH24_STENCIL8,Gt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):R===null||R===us||R===bu?se=t.DEPTH_COMPONENT24:R===Qr?se=t.DEPTH_COMPONENT32F:R===xu&&(se=t.DEPTH_COMPONENT16),se}function I(B,R){return y(B)===!0||B.isFramebufferTexture&&B.minFilter!==mi&&B.minFilter!==wi?Math.log2(Math.max(R.width,R.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?R.mipmaps.length:1}function k(B){const R=B.target;R.removeEventListener("dispose",k),S(R),R.isVideoTexture&&h.delete(R)}function U(B){const R=B.target;R.removeEventListener("dispose",U),V(R)}function S(B){const R=i.get(B);if(R.__webglInit===void 0)return;const se=B.source,xe=m.get(se);if(xe){const Ee=xe[R.__cacheKey];Ee.usedTimes--,Ee.usedTimes===0&&P(B),Object.keys(xe).length===0&&m.delete(se)}i.remove(B)}function P(B){const R=i.get(B);t.deleteTexture(R.__webglTexture);const se=B.source,xe=m.get(se);delete xe[R.__cacheKey],o.memory.textures--}function V(B){const R=i.get(B);if(B.depthTexture&&(B.depthTexture.dispose(),i.remove(B.depthTexture)),B.isWebGLCubeRenderTarget)for(let xe=0;xe<6;xe++){if(Array.isArray(R.__webglFramebuffer[xe]))for(let Ee=0;Ee<R.__webglFramebuffer[xe].length;Ee++)t.deleteFramebuffer(R.__webglFramebuffer[xe][Ee]);else t.deleteFramebuffer(R.__webglFramebuffer[xe]);R.__webglDepthbuffer&&t.deleteRenderbuffer(R.__webglDepthbuffer[xe])}else{if(Array.isArray(R.__webglFramebuffer))for(let xe=0;xe<R.__webglFramebuffer.length;xe++)t.deleteFramebuffer(R.__webglFramebuffer[xe]);else t.deleteFramebuffer(R.__webglFramebuffer);if(R.__webglDepthbuffer&&t.deleteRenderbuffer(R.__webglDepthbuffer),R.__webglMultisampledFramebuffer&&t.deleteFramebuffer(R.__webglMultisampledFramebuffer),R.__webglColorRenderbuffer)for(let xe=0;xe<R.__webglColorRenderbuffer.length;xe++)R.__webglColorRenderbuffer[xe]&&t.deleteRenderbuffer(R.__webglColorRenderbuffer[xe]);R.__webglDepthRenderbuffer&&t.deleteRenderbuffer(R.__webglDepthRenderbuffer)}const se=B.textures;for(let xe=0,Ee=se.length;xe<Ee;xe++){const ve=i.get(se[xe]);ve.__webglTexture&&(t.deleteTexture(ve.__webglTexture),o.memory.textures--),i.remove(se[xe])}i.remove(B)}let O=0;function G(){O=0}function J(){const B=O;return B>=r.maxTextures&&Gt("WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+r.maxTextures),O+=1,B}function H(B){const R=[];return R.push(B.wrapS),R.push(B.wrapT),R.push(B.wrapR||0),R.push(B.magFilter),R.push(B.minFilter),R.push(B.anisotropy),R.push(B.internalFormat),R.push(B.format),R.push(B.type),R.push(B.generateMipmaps),R.push(B.premultiplyAlpha),R.push(B.flipY),R.push(B.unpackAlignment),R.push(B.colorSpace),R.join()}function X(B,R){const se=i.get(B);if(B.isVideoTexture&&At(B),B.isRenderTargetTexture===!1&&B.isExternalTexture!==!0&&B.version>0&&se.__version!==B.version){const xe=B.image;if(xe===null)Gt("WebGLRenderer: Texture marked for update but no image data found.");else if(xe.complete===!1)Gt("WebGLRenderer: Texture marked for update but image is incomplete");else{ne(se,B,R);return}}else B.isExternalTexture&&(se.__webglTexture=B.sourceTexture?B.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,se.__webglTexture,t.TEXTURE0+R)}function K(B,R){const se=i.get(B);if(B.isRenderTargetTexture===!1&&B.version>0&&se.__version!==B.version){ne(se,B,R);return}else B.isExternalTexture&&(se.__webglTexture=B.sourceTexture?B.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,se.__webglTexture,t.TEXTURE0+R)}function Q(B,R){const se=i.get(B);if(B.isRenderTargetTexture===!1&&B.version>0&&se.__version!==B.version){ne(se,B,R);return}n.bindTexture(t.TEXTURE_3D,se.__webglTexture,t.TEXTURE0+R)}function W(B,R){const se=i.get(B);if(B.isCubeDepthTexture!==!0&&B.version>0&&se.__version!==B.version){ye(se,B,R);return}n.bindTexture(t.TEXTURE_CUBE_MAP,se.__webglTexture,t.TEXTURE0+R)}const q={[J0]:t.REPEAT,[Is]:t.CLAMP_TO_EDGE,[Q0]:t.MIRRORED_REPEAT},Z={[mi]:t.NEAREST,[OH]:t.NEAREST_MIPMAP_NEAREST,[tf]:t.NEAREST_MIPMAP_LINEAR,[wi]:t.LINEAR,[ug]:t.LINEAR_MIPMAP_NEAREST,[mo]:t.LINEAR_MIPMAP_LINEAR},z={[HH]:t.NEVER,[XH]:t.ALWAYS,[GH]:t.LESS,[i_]:t.LEQUAL,[jH]:t.EQUAL,[r_]:t.GEQUAL,[WH]:t.GREATER,[$H]:t.NOTEQUAL};function ie(B,R){if(R.type===Qr&&e.has("OES_texture_float_linear")===!1&&(R.magFilter===wi||R.magFilter===ug||R.magFilter===tf||R.magFilter===mo||R.minFilter===wi||R.minFilter===ug||R.minFilter===tf||R.minFilter===mo)&&Gt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(B,t.TEXTURE_WRAP_S,q[R.wrapS]),t.texParameteri(B,t.TEXTURE_WRAP_T,q[R.wrapT]),(B===t.TEXTURE_3D||B===t.TEXTURE_2D_ARRAY)&&t.texParameteri(B,t.TEXTURE_WRAP_R,q[R.wrapR]),t.texParameteri(B,t.TEXTURE_MAG_FILTER,Z[R.magFilter]),t.texParameteri(B,t.TEXTURE_MIN_FILTER,Z[R.minFilter]),R.compareFunction&&(t.texParameteri(B,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(B,t.TEXTURE_COMPARE_FUNC,z[R.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(R.magFilter===mi||R.minFilter!==tf&&R.minFilter!==mo||R.type===Qr&&e.has("OES_texture_float_linear")===!1)return;if(R.anisotropy>1||i.get(R).__currentAnisotropy){const se=e.get("EXT_texture_filter_anisotropic");t.texParameterf(B,se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,r.getMaxAnisotropy())),i.get(R).__currentAnisotropy=R.anisotropy}}}function we(B,R){let se=!1;B.__webglInit===void 0&&(B.__webglInit=!0,R.addEventListener("dispose",k));const xe=R.source;let Ee=m.get(xe);Ee===void 0&&(Ee={},m.set(xe,Ee));const ve=H(R);if(ve!==B.__cacheKey){Ee[ve]===void 0&&(Ee[ve]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,se=!0),Ee[ve].usedTimes++;const Ke=Ee[B.__cacheKey];Ke!==void 0&&(Ee[B.__cacheKey].usedTimes--,Ke.usedTimes===0&&P(R)),B.__cacheKey=ve,B.__webglTexture=Ee[ve].texture}return se}function He(B,R,se){return Math.floor(Math.floor(B/se)/R)}function Se(B,R,se,xe){const ve=B.updateRanges;if(ve.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,R.width,R.height,se,xe,R.data);else{ve.sort((Pe,Oe)=>Pe.start-Oe.start);let Ke=0;for(let Pe=1;Pe<ve.length;Pe++){const Oe=ve[Ke],Ze=ve[Pe],rt=Oe.start+Oe.count,$e=He(Ze.start,R.width,4),Ht=He(Oe.start,R.width,4);Ze.start<=rt+1&&$e===Ht&&He(Ze.start+Ze.count-1,R.width,4)===$e?Oe.count=Math.max(Oe.count,Ze.start+Ze.count-Oe.start):(++Ke,ve[Ke]=Ze)}ve.length=Ke+1;const ke=t.getParameter(t.UNPACK_ROW_LENGTH),pt=t.getParameter(t.UNPACK_SKIP_PIXELS),Pt=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,R.width);for(let Pe=0,Oe=ve.length;Pe<Oe;Pe++){const Ze=ve[Pe],rt=Math.floor(Ze.start/4),$e=Math.ceil(Ze.count/4),Ht=rt%R.width,re=Math.floor(rt/R.width),ze=$e,Le=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,Ht),t.pixelStorei(t.UNPACK_SKIP_ROWS,re),n.texSubImage2D(t.TEXTURE_2D,0,Ht,re,ze,Le,se,xe,R.data)}B.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,ke),t.pixelStorei(t.UNPACK_SKIP_PIXELS,pt),t.pixelStorei(t.UNPACK_SKIP_ROWS,Pt)}}function ne(B,R,se){let xe=t.TEXTURE_2D;(R.isDataArrayTexture||R.isCompressedArrayTexture)&&(xe=t.TEXTURE_2D_ARRAY),R.isData3DTexture&&(xe=t.TEXTURE_3D);const Ee=we(B,R),ve=R.source;n.bindTexture(xe,B.__webglTexture,t.TEXTURE0+se);const Ke=i.get(ve);if(ve.version!==Ke.__version||Ee===!0){n.activeTexture(t.TEXTURE0+se);const ke=fn.getPrimaries(fn.workingColorSpace),pt=R.colorSpace===Ca?null:fn.getPrimaries(R.colorSpace),Pt=R.colorSpace===Ca||ke===pt?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,R.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,R.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Pt);let Pe=w(R.image,!1,r.maxTextureSize);Pe=Lt(R,Pe);const Oe=s.convert(R.format,R.colorSpace),Ze=s.convert(R.type);let rt=A(R.internalFormat,Oe,Ze,R.colorSpace,R.isVideoTexture);ie(xe,R);let $e;const Ht=R.mipmaps,re=R.isVideoTexture!==!0,ze=Ke.__version===void 0||Ee===!0,Le=ve.dataReady,Xe=I(R,Pe);if(R.isDepthTexture)rt=M(R.format===go,R.type),ze&&(re?n.texStorage2D(t.TEXTURE_2D,1,rt,Pe.width,Pe.height):n.texImage2D(t.TEXTURE_2D,0,rt,Pe.width,Pe.height,0,Oe,Ze,null));else if(R.isDataTexture)if(Ht.length>0){re&&ze&&n.texStorage2D(t.TEXTURE_2D,Xe,rt,Ht[0].width,Ht[0].height);for(let Re=0,_e=Ht.length;Re<_e;Re++)$e=Ht[Re],re?Le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,$e.width,$e.height,Oe,Ze,$e.data):n.texImage2D(t.TEXTURE_2D,Re,rt,$e.width,$e.height,0,Oe,Ze,$e.data);R.generateMipmaps=!1}else re?(ze&&n.texStorage2D(t.TEXTURE_2D,Xe,rt,Pe.width,Pe.height),Le&&Se(R,Pe,Oe,Ze)):n.texImage2D(t.TEXTURE_2D,0,rt,Pe.width,Pe.height,0,Oe,Ze,Pe.data);else if(R.isCompressedTexture)if(R.isCompressedArrayTexture){re&&ze&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Xe,rt,Ht[0].width,Ht[0].height,Pe.depth);for(let Re=0,_e=Ht.length;Re<_e;Re++)if($e=Ht[Re],R.format!==Fr)if(Oe!==null)if(re){if(Le)if(R.layerUpdates.size>0){const st=$1($e.width,$e.height,R.format,R.type);for(const Nt of R.layerUpdates){const mn=$e.data.subarray(Nt*st/$e.data.BYTES_PER_ELEMENT,(Nt+1)*st/$e.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,Nt,$e.width,$e.height,1,Oe,mn)}R.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,$e.width,$e.height,Pe.depth,Oe,$e.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Re,rt,$e.width,$e.height,Pe.depth,0,$e.data,0,0);else Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else re?Le&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,$e.width,$e.height,Pe.depth,Oe,Ze,$e.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Re,rt,$e.width,$e.height,Pe.depth,0,Oe,Ze,$e.data)}else{re&&ze&&n.texStorage2D(t.TEXTURE_2D,Xe,rt,Ht[0].width,Ht[0].height);for(let Re=0,_e=Ht.length;Re<_e;Re++)$e=Ht[Re],R.format!==Fr?Oe!==null?re?Le&&n.compressedTexSubImage2D(t.TEXTURE_2D,Re,0,0,$e.width,$e.height,Oe,$e.data):n.compressedTexImage2D(t.TEXTURE_2D,Re,rt,$e.width,$e.height,0,$e.data):Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):re?Le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,$e.width,$e.height,Oe,Ze,$e.data):n.texImage2D(t.TEXTURE_2D,Re,rt,$e.width,$e.height,0,Oe,Ze,$e.data)}else if(R.isDataArrayTexture)if(re){if(ze&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Xe,rt,Pe.width,Pe.height,Pe.depth),Le)if(R.layerUpdates.size>0){const Re=$1(Pe.width,Pe.height,R.format,R.type);for(const _e of R.layerUpdates){const st=Pe.data.subarray(_e*Re/Pe.data.BYTES_PER_ELEMENT,(_e+1)*Re/Pe.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,_e,Pe.width,Pe.height,1,Oe,Ze,st)}R.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Pe.width,Pe.height,Pe.depth,Oe,Ze,Pe.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,rt,Pe.width,Pe.height,Pe.depth,0,Oe,Ze,Pe.data);else if(R.isData3DTexture)re?(ze&&n.texStorage3D(t.TEXTURE_3D,Xe,rt,Pe.width,Pe.height,Pe.depth),Le&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Pe.width,Pe.height,Pe.depth,Oe,Ze,Pe.data)):n.texImage3D(t.TEXTURE_3D,0,rt,Pe.width,Pe.height,Pe.depth,0,Oe,Ze,Pe.data);else if(R.isFramebufferTexture){if(ze)if(re)n.texStorage2D(t.TEXTURE_2D,Xe,rt,Pe.width,Pe.height);else{let Re=Pe.width,_e=Pe.height;for(let st=0;st<Xe;st++)n.texImage2D(t.TEXTURE_2D,st,rt,Re,_e,0,Oe,Ze,null),Re>>=1,_e>>=1}}else if(Ht.length>0){if(re&&ze){const Re=it(Ht[0]);n.texStorage2D(t.TEXTURE_2D,Xe,rt,Re.width,Re.height)}for(let Re=0,_e=Ht.length;Re<_e;Re++)$e=Ht[Re],re?Le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,Oe,Ze,$e):n.texImage2D(t.TEXTURE_2D,Re,rt,Oe,Ze,$e);R.generateMipmaps=!1}else if(re){if(ze){const Re=it(Pe);n.texStorage2D(t.TEXTURE_2D,Xe,rt,Re.width,Re.height)}Le&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Oe,Ze,Pe)}else n.texImage2D(t.TEXTURE_2D,0,rt,Oe,Ze,Pe);y(R)&&b(xe),Ke.__version=ve.version,R.onUpdate&&R.onUpdate(R)}B.__version=R.version}function ye(B,R,se){if(R.image.length!==6)return;const xe=we(B,R),Ee=R.source;n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture,t.TEXTURE0+se);const ve=i.get(Ee);if(Ee.version!==ve.__version||xe===!0){n.activeTexture(t.TEXTURE0+se);const Ke=fn.getPrimaries(fn.workingColorSpace),ke=R.colorSpace===Ca?null:fn.getPrimaries(R.colorSpace),pt=R.colorSpace===Ca||Ke===ke?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,R.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,R.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,pt);const Pt=R.isCompressedTexture||R.image[0].isCompressedTexture,Pe=R.image[0]&&R.image[0].isDataTexture,Oe=[];for(let _e=0;_e<6;_e++)!Pt&&!Pe?Oe[_e]=w(R.image[_e],!0,r.maxCubemapSize):Oe[_e]=Pe?R.image[_e].image:R.image[_e],Oe[_e]=Lt(R,Oe[_e]);const Ze=Oe[0],rt=s.convert(R.format,R.colorSpace),$e=s.convert(R.type),Ht=A(R.internalFormat,rt,$e,R.colorSpace),re=R.isVideoTexture!==!0,ze=ve.__version===void 0||xe===!0,Le=Ee.dataReady;let Xe=I(R,Ze);ie(t.TEXTURE_CUBE_MAP,R);let Re;if(Pt){re&&ze&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Xe,Ht,Ze.width,Ze.height);for(let _e=0;_e<6;_e++){Re=Oe[_e].mipmaps;for(let st=0;st<Re.length;st++){const Nt=Re[st];R.format!==Fr?rt!==null?re?Le&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,0,0,Nt.width,Nt.height,rt,Nt.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,Ht,Nt.width,Nt.height,0,Nt.data):Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,0,0,Nt.width,Nt.height,rt,$e,Nt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st,Ht,Nt.width,Nt.height,0,rt,$e,Nt.data)}}}else{if(Re=R.mipmaps,re&&ze){Re.length>0&&Xe++;const _e=it(Oe[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Xe,Ht,_e.width,_e.height)}for(let _e=0;_e<6;_e++)if(Pe){re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,0,0,Oe[_e].width,Oe[_e].height,rt,$e,Oe[_e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,Ht,Oe[_e].width,Oe[_e].height,0,rt,$e,Oe[_e].data);for(let st=0;st<Re.length;st++){const mn=Re[st].image[_e].image;re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,0,0,mn.width,mn.height,rt,$e,mn.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,Ht,mn.width,mn.height,0,rt,$e,mn.data)}}else{re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,0,0,rt,$e,Oe[_e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,Ht,rt,$e,Oe[_e]);for(let st=0;st<Re.length;st++){const Nt=Re[st];re?Le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,0,0,rt,$e,Nt.image[_e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,st+1,Ht,rt,$e,Nt.image[_e])}}}y(R)&&b(t.TEXTURE_CUBE_MAP),ve.__version=Ee.version,R.onUpdate&&R.onUpdate(R)}B.__version=R.version}function be(B,R,se,xe,Ee,ve){const Ke=s.convert(se.format,se.colorSpace),ke=s.convert(se.type),pt=A(se.internalFormat,Ke,ke,se.colorSpace),Pt=i.get(R),Pe=i.get(se);if(Pe.__renderTarget=R,!Pt.__hasExternalTextures){const Oe=Math.max(1,R.width>>ve),Ze=Math.max(1,R.height>>ve);Ee===t.TEXTURE_3D||Ee===t.TEXTURE_2D_ARRAY?n.texImage3D(Ee,ve,pt,Oe,Ze,R.depth,0,Ke,ke,null):n.texImage2D(Ee,ve,pt,Oe,Ze,0,Ke,ke,null)}n.bindFramebuffer(t.FRAMEBUFFER,B),Sn(R)?c.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,xe,Ee,Pe.__webglTexture,0,ee(R)):(Ee===t.TEXTURE_2D||Ee>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Ee<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,xe,Ee,Pe.__webglTexture,ve),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ne(B,R,se){if(t.bindRenderbuffer(t.RENDERBUFFER,B),R.depthBuffer){const xe=R.depthTexture,Ee=xe&&xe.isDepthTexture?xe.type:null,ve=M(R.stencilBuffer,Ee),Ke=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;Sn(R)?c.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ee(R),ve,R.width,R.height):se?t.renderbufferStorageMultisample(t.RENDERBUFFER,ee(R),ve,R.width,R.height):t.renderbufferStorage(t.RENDERBUFFER,ve,R.width,R.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ke,t.RENDERBUFFER,B)}else{const xe=R.textures;for(let Ee=0;Ee<xe.length;Ee++){const ve=xe[Ee],Ke=s.convert(ve.format,ve.colorSpace),ke=s.convert(ve.type),pt=A(ve.internalFormat,Ke,ke,ve.colorSpace);Sn(R)?c.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ee(R),pt,R.width,R.height):se?t.renderbufferStorageMultisample(t.RENDERBUFFER,ee(R),pt,R.width,R.height):t.renderbufferStorage(t.RENDERBUFFER,pt,R.width,R.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function et(B,R,se){const xe=R.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,B),!(R.depthTexture&&R.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Ee=i.get(R.depthTexture);if(Ee.__renderTarget=R,(!Ee.__webglTexture||R.depthTexture.image.width!==R.width||R.depthTexture.image.height!==R.height)&&(R.depthTexture.image.width=R.width,R.depthTexture.image.height=R.height,R.depthTexture.needsUpdate=!0),xe){if(Ee.__webglInit===void 0&&(Ee.__webglInit=!0,R.depthTexture.addEventListener("dispose",k)),Ee.__webglTexture===void 0){Ee.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,Ee.__webglTexture),ie(t.TEXTURE_CUBE_MAP,R.depthTexture);const Pt=s.convert(R.depthTexture.format),Pe=s.convert(R.depthTexture.type);let Oe;R.depthTexture.format===Gs?Oe=t.DEPTH_COMPONENT24:R.depthTexture.format===go&&(Oe=t.DEPTH24_STENCIL8);for(let Ze=0;Ze<6;Ze++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,Oe,R.width,R.height,0,Pt,Pe,null)}}else X(R.depthTexture,0);const ve=Ee.__webglTexture,Ke=ee(R),ke=xe?t.TEXTURE_CUBE_MAP_POSITIVE_X+se:t.TEXTURE_2D,pt=R.depthTexture.format===go?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(R.depthTexture.format===Gs)Sn(R)?c.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pt,ke,ve,0,Ke):t.framebufferTexture2D(t.FRAMEBUFFER,pt,ke,ve,0);else if(R.depthTexture.format===go)Sn(R)?c.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pt,ke,ve,0,Ke):t.framebufferTexture2D(t.FRAMEBUFFER,pt,ke,ve,0);else throw new Error("Unknown depthTexture format")}function xt(B){const R=i.get(B),se=B.isWebGLCubeRenderTarget===!0;if(R.__boundDepthTexture!==B.depthTexture){const xe=B.depthTexture;if(R.__depthDisposeCallback&&R.__depthDisposeCallback(),xe){const Ee=()=>{delete R.__boundDepthTexture,delete R.__depthDisposeCallback,xe.removeEventListener("dispose",Ee)};xe.addEventListener("dispose",Ee),R.__depthDisposeCallback=Ee}R.__boundDepthTexture=xe}if(B.depthTexture&&!R.__autoAllocateDepthBuffer)if(se)for(let xe=0;xe<6;xe++)et(R.__webglFramebuffer[xe],B,xe);else{const xe=B.texture.mipmaps;xe&&xe.length>0?et(R.__webglFramebuffer[0],B,0):et(R.__webglFramebuffer,B,0)}else if(se){R.__webglDepthbuffer=[];for(let xe=0;xe<6;xe++)if(n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer[xe]),R.__webglDepthbuffer[xe]===void 0)R.__webglDepthbuffer[xe]=t.createRenderbuffer(),Ne(R.__webglDepthbuffer[xe],B,!1);else{const Ee=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=R.__webglDepthbuffer[xe];t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ee,t.RENDERBUFFER,ve)}}else{const xe=B.texture.mipmaps;if(xe&&xe.length>0?n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer),R.__webglDepthbuffer===void 0)R.__webglDepthbuffer=t.createRenderbuffer(),Ne(R.__webglDepthbuffer,B,!1);else{const Ee=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=R.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ee,t.RENDERBUFFER,ve)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function pn(B,R,se){const xe=i.get(B);R!==void 0&&be(xe.__webglFramebuffer,B,B.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),se!==void 0&&xt(B)}function ht(B){const R=B.texture,se=i.get(B),xe=i.get(R);B.addEventListener("dispose",U);const Ee=B.textures,ve=B.isWebGLCubeRenderTarget===!0,Ke=Ee.length>1;if(Ke||(xe.__webglTexture===void 0&&(xe.__webglTexture=t.createTexture()),xe.__version=R.version,o.memory.textures++),ve){se.__webglFramebuffer=[];for(let ke=0;ke<6;ke++)if(R.mipmaps&&R.mipmaps.length>0){se.__webglFramebuffer[ke]=[];for(let pt=0;pt<R.mipmaps.length;pt++)se.__webglFramebuffer[ke][pt]=t.createFramebuffer()}else se.__webglFramebuffer[ke]=t.createFramebuffer()}else{if(R.mipmaps&&R.mipmaps.length>0){se.__webglFramebuffer=[];for(let ke=0;ke<R.mipmaps.length;ke++)se.__webglFramebuffer[ke]=t.createFramebuffer()}else se.__webglFramebuffer=t.createFramebuffer();if(Ke)for(let ke=0,pt=Ee.length;ke<pt;ke++){const Pt=i.get(Ee[ke]);Pt.__webglTexture===void 0&&(Pt.__webglTexture=t.createTexture(),o.memory.textures++)}if(B.samples>0&&Sn(B)===!1){se.__webglMultisampledFramebuffer=t.createFramebuffer(),se.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,se.__webglMultisampledFramebuffer);for(let ke=0;ke<Ee.length;ke++){const pt=Ee[ke];se.__webglColorRenderbuffer[ke]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,se.__webglColorRenderbuffer[ke]);const Pt=s.convert(pt.format,pt.colorSpace),Pe=s.convert(pt.type),Oe=A(pt.internalFormat,Pt,Pe,pt.colorSpace,B.isXRRenderTarget===!0),Ze=ee(B);t.renderbufferStorageMultisample(t.RENDERBUFFER,Ze,Oe,B.width,B.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ke,t.RENDERBUFFER,se.__webglColorRenderbuffer[ke])}t.bindRenderbuffer(t.RENDERBUFFER,null),B.depthBuffer&&(se.__webglDepthRenderbuffer=t.createRenderbuffer(),Ne(se.__webglDepthRenderbuffer,B,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ve){n.bindTexture(t.TEXTURE_CUBE_MAP,xe.__webglTexture),ie(t.TEXTURE_CUBE_MAP,R);for(let ke=0;ke<6;ke++)if(R.mipmaps&&R.mipmaps.length>0)for(let pt=0;pt<R.mipmaps.length;pt++)be(se.__webglFramebuffer[ke][pt],B,R,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,pt);else be(se.__webglFramebuffer[ke],B,R,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,0);y(R)&&b(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ke){for(let ke=0,pt=Ee.length;ke<pt;ke++){const Pt=Ee[ke],Pe=i.get(Pt);let Oe=t.TEXTURE_2D;(B.isWebGL3DRenderTarget||B.isWebGLArrayRenderTarget)&&(Oe=B.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Oe,Pe.__webglTexture),ie(Oe,Pt),be(se.__webglFramebuffer,B,Pt,t.COLOR_ATTACHMENT0+ke,Oe,0),y(Pt)&&b(Oe)}n.unbindTexture()}else{let ke=t.TEXTURE_2D;if((B.isWebGL3DRenderTarget||B.isWebGLArrayRenderTarget)&&(ke=B.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ke,xe.__webglTexture),ie(ke,R),R.mipmaps&&R.mipmaps.length>0)for(let pt=0;pt<R.mipmaps.length;pt++)be(se.__webglFramebuffer[pt],B,R,t.COLOR_ATTACHMENT0,ke,pt);else be(se.__webglFramebuffer,B,R,t.COLOR_ATTACHMENT0,ke,0);y(R)&&b(ke),n.unbindTexture()}B.depthBuffer&&xt(B)}function Ft(B){const R=B.textures;for(let se=0,xe=R.length;se<xe;se++){const Ee=R[se];if(y(Ee)){const ve=T(B),Ke=i.get(Ee).__webglTexture;n.bindTexture(ve,Ke),b(ve),n.unbindTexture()}}}const nn=[],Dt=[];function an(B){if(B.samples>0){if(Sn(B)===!1){const R=B.textures,se=B.width,xe=B.height;let Ee=t.COLOR_BUFFER_BIT;const ve=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ke=i.get(B),ke=R.length>1;if(ke)for(let Pt=0;Pt<R.length;Pt++)n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer);const pt=B.texture.mipmaps;pt&&pt.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let Pt=0;Pt<R.length;Pt++){if(B.resolveDepthBuffer&&(B.depthBuffer&&(Ee|=t.DEPTH_BUFFER_BIT),B.stencilBuffer&&B.resolveStencilBuffer&&(Ee|=t.STENCIL_BUFFER_BIT)),ke){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[Pt]);const Pe=i.get(R[Pt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Pe,0)}t.blitFramebuffer(0,0,se,xe,0,0,se,xe,Ee,t.NEAREST),u===!0&&(nn.length=0,Dt.length=0,nn.push(t.COLOR_ATTACHMENT0+Pt),B.depthBuffer&&B.resolveDepthBuffer===!1&&(nn.push(ve),Dt.push(ve),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Dt)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,nn))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),ke)for(let Pt=0;Pt<R.length;Pt++){n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[Pt]);const Pe=i.get(R[Pt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Pt,t.TEXTURE_2D,Pe,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}else if(B.depthBuffer&&B.resolveDepthBuffer===!1&&u){const R=B.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[R])}}}function ee(B){return Math.min(r.maxSamples,B.samples)}function Sn(B){const R=i.get(B);return B.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&R.__useRenderToTexture!==!1}function At(B){const R=o.render.frame;h.get(B)!==R&&(h.set(B,R),B.update())}function Lt(B,R){const se=B.colorSpace,xe=B.format,Ee=B.type;return B.isCompressedTexture===!0||B.isVideoTexture===!0||se!==Ao&&se!==Ca&&(fn.getTransfer(se)===wn?(xe!==Fr||Ee!==fr)&&Gt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):_n("WebGLTextures: Unsupported texture color space:",se)),R}function it(B){return typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement?(d.width=B.naturalWidth||B.width,d.height=B.naturalHeight||B.height):typeof VideoFrame<"u"&&B instanceof VideoFrame?(d.width=B.displayWidth,d.height=B.displayHeight):(d.width=B.width,d.height=B.height),d}this.allocateTextureUnit=J,this.resetTextureUnits=G,this.setTexture2D=X,this.setTexture2DArray=K,this.setTexture3D=Q,this.setTextureCube=W,this.rebindTextures=pn,this.setupRenderTarget=ht,this.updateRenderTargetMipmap=Ft,this.updateMultisampleRenderTarget=an,this.setupDepthRenderbuffer=xt,this.setupFrameBufferTexture=be,this.useMultisampledRTT=Sn,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function gW(t,e){function n(i,r=Ca){let s;const o=fn.getTransfer(r);if(i===fr)return t.UNSIGNED_BYTE;if(i===Jy)return t.UNSIGNED_SHORT_4_4_4_4;if(i===Qy)return t.UNSIGNED_SHORT_5_5_5_1;if(i===cP)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===uP)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===oP)return t.BYTE;if(i===lP)return t.SHORT;if(i===xu)return t.UNSIGNED_SHORT;if(i===Zy)return t.INT;if(i===us)return t.UNSIGNED_INT;if(i===Qr)return t.FLOAT;if(i===Hs)return t.HALF_FLOAT;if(i===dP)return t.ALPHA;if(i===fP)return t.RGB;if(i===Fr)return t.RGBA;if(i===Gs)return t.DEPTH_COMPONENT;if(i===go)return t.DEPTH_STENCIL;if(i===hP)return t.RED;if(i===e_)return t.RED_INTEGER;if(i===$l)return t.RG;if(i===t_)return t.RG_INTEGER;if(i===n_)return t.RGBA_INTEGER;if(i===Wf||i===$f||i===Xf||i===qf)if(o===wn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Wf)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===$f)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Xf)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===qf)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Wf)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===$f)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Xf)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===qf)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===ev||i===tv||i===nv||i===iv)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===ev)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===tv)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===nv)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===iv)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===rv||i===sv||i===av||i===ov||i===lv||i===cv||i===uv)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===rv||i===sv)return o===wn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===av)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===ov)return s.COMPRESSED_R11_EAC;if(i===lv)return s.COMPRESSED_SIGNED_R11_EAC;if(i===cv)return s.COMPRESSED_RG11_EAC;if(i===uv)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===dv||i===fv||i===hv||i===pv||i===mv||i===gv||i===vv||i===yv||i===_v||i===xv||i===bv||i===Sv||i===wv||i===Ev)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===dv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===fv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===hv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===pv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===mv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===gv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===vv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===yv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===_v)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===xv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===bv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Sv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wv)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ev)return o===wn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Mv||i===Tv||i===Av)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Mv)return o===wn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Tv)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Av)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Cv||i===Pv||i===Rv||i===kv)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Cv)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Pv)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Rv)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===kv)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===bu?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const vW=`
|
|
4635
4636
|
void main() {
|
|
4636
4637
|
|
|
4637
4638
|
gl_Position = vec4( position, 1.0 );
|
|
@@ -4655,7 +4656,7 @@ void main() {
|
|
|
4655
4656
|
|
|
4656
4657
|
}
|
|
4657
4658
|
|
|
4658
|
-
}`;class _W{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const i=new EP(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new fs({vertexShader:vW,fragmentShader:yW,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ds(new jh(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class xW extends ec{constructor(e,n){super();const i=this;let r=null,s=1,o=null,c="local-floor",u=1,d=null,h=null,p=null,m=null,v=null,_=null;const w=typeof XRWebGLBinding<"u",y=new _W,b={},T=n.getContextAttributes();let A=null,M=null;const I=[],k=[],U=new bn;let S=null;const P=new Ur;P.viewport=new Vn;const V=new Ur;V.viewport=new Vn;const O=[P,V],G=new k6;let J=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let ye=I[ne];return ye===void 0&&(ye=new yg,I[ne]=ye),ye.getTargetRaySpace()},this.getControllerGrip=function(ne){let ye=I[ne];return ye===void 0&&(ye=new yg,I[ne]=ye),ye.getGripSpace()},this.getHand=function(ne){let ye=I[ne];return ye===void 0&&(ye=new yg,I[ne]=ye),ye.getHandSpace()};function X(ne){const ye=k.indexOf(ne.inputSource);if(ye===-1)return;const be=I[ye];be!==void 0&&(be.update(ne.inputSource,ne.frame,d||o),be.dispatchEvent({type:ne.type,data:ne.inputSource}))}function K(){r.removeEventListener("select",X),r.removeEventListener("selectstart",X),r.removeEventListener("selectend",X),r.removeEventListener("squeeze",X),r.removeEventListener("squeezestart",X),r.removeEventListener("squeezeend",X),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",Q);for(let ne=0;ne<I.length;ne++){const ye=k[ne];ye!==null&&(k[ne]=null,I[ne].disconnect(ye))}J=null,H=null,y.reset();for(const ne in b)delete b[ne];e.setRenderTarget(A),v=null,m=null,p=null,r=null,M=null,Se.stop(),i.isPresenting=!1,e.setPixelRatio(S),e.setSize(U.width,U.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){s=ne,i.isPresenting===!0&&Gt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){c=ne,i.isPresenting===!0&&Gt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||o},this.setReferenceSpace=function(ne){d=ne},this.getBaseLayer=function(){return m!==null?m:v},this.getBinding=function(){return p===null&&w&&(p=new XRWebGLBinding(r,n)),p},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(ne){if(r=ne,r!==null){if(A=e.getRenderTarget(),r.addEventListener("select",X),r.addEventListener("selectstart",X),r.addEventListener("selectend",X),r.addEventListener("squeeze",X),r.addEventListener("squeezestart",X),r.addEventListener("squeezeend",X),r.addEventListener("end",K),r.addEventListener("inputsourceschange",Q),T.xrCompatible!==!0&&await n.makeXRCompatible(),S=e.getPixelRatio(),e.getSize(U),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let be=null,Ne=null,et=null;T.depth&&(et=T.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,be=T.stencil?go:Gs,Ne=T.stencil?bu:us);const xt={colorFormat:n.RGBA8,depthFormat:et,scaleFactor:s};p=this.getBinding(),m=p.createProjectionLayer(xt),r.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),M=new rs(m.textureWidth,m.textureHeight,{format:Fr,type:fr,depthTexture:new Su(m.textureWidth,m.textureHeight,Ne,void 0,void 0,void 0,void 0,void 0,void 0,be),stencilBuffer:T.stencil,colorSpace:e.outputColorSpace,samples:T.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const be={antialias:T.antialias,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(r,n,be),r.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),M=new rs(v.framebufferWidth,v.framebufferHeight,{format:Fr,type:fr,colorSpace:e.outputColorSpace,stencilBuffer:T.stencil,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(u),d=null,o=await r.requestReferenceSpace(c),Se.setContext(r),Se.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function Q(ne){for(let ye=0;ye<ne.removed.length;ye++){const be=ne.removed[ye],Ne=k.indexOf(be);Ne>=0&&(k[Ne]=null,I[Ne].disconnect(be))}for(let ye=0;ye<ne.added.length;ye++){const be=ne.added[ye];let Ne=k.indexOf(be);if(Ne===-1){for(let xt=0;xt<I.length;xt++)if(xt>=k.length){k.push(be),Ne=xt;break}else if(k[xt]===null){k[xt]=be,Ne=xt;break}if(Ne===-1)break}const et=I[Ne];et&&et.connect(be)}}const W=new me,q=new me;function Z(ne,ye,be){W.setFromMatrixPosition(ye.matrixWorld),q.setFromMatrixPosition(be.matrixWorld);const Ne=W.distanceTo(q),et=ye.projectionMatrix.elements,xt=be.projectionMatrix.elements,pn=et[14]/(et[10]-1),ht=et[14]/(et[10]+1),Ft=(et[9]+1)/et[5],nn=(et[9]-1)/et[5],Dt=(et[8]-1)/et[0],an=(xt[8]+1)/xt[0],ee=pn*Dt,Sn=pn*an,At=Ne/(-Dt+an),Lt=At*-Dt;if(ye.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Lt),ne.translateZ(At),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),et[10]===-1)ne.projectionMatrix.copy(ye.projectionMatrix),ne.projectionMatrixInverse.copy(ye.projectionMatrixInverse);else{const it=pn+At,B=ht+At,R=ee-Lt,se=Sn+(Ne-Lt),xe=Ft*ht/B*it,we=nn*ht/B*it;ne.projectionMatrix.makePerspective(R,se,xe,we,it,B),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function z(ne,ye){ye===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ye.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(r===null)return;let ye=ne.near,be=ne.far;y.texture!==null&&(y.depthNear>0&&(ye=y.depthNear),y.depthFar>0&&(be=y.depthFar)),G.near=V.near=P.near=ye,G.far=V.far=P.far=be,(J!==G.near||H!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),J=G.near,H=G.far),G.layers.mask=ne.layers.mask|6,P.layers.mask=G.layers.mask&-5,V.layers.mask=G.layers.mask&-3;const Ne=ne.parent,et=G.cameras;z(G,Ne);for(let xt=0;xt<et.length;xt++)z(et[xt],Ne);et.length===2?Z(G,P,V):G.projectionMatrix.copy(P.projectionMatrix),ie(ne,G,Ne)};function ie(ne,ye,be){be===null?ne.matrix.copy(ye.matrixWorld):(ne.matrix.copy(be.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ye.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ye.projectionMatrix),ne.projectionMatrixInverse.copy(ye.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=Lv*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(m===null&&v===null))return u},this.setFoveation=function(ne){u=ne,m!==null&&(m.fixedFoveation=ne),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=ne)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(G)},this.getCameraTexture=function(ne){return b[ne]};let Ee=null;function ze(ne,ye){if(h=ye.getViewerPose(d||o),_=ye,h!==null){const be=h.views;v!==null&&(e.setRenderTargetFramebuffer(M,v.framebuffer),e.setRenderTarget(M));let Ne=!1;be.length!==G.cameras.length&&(G.cameras.length=0,Ne=!0);for(let ht=0;ht<be.length;ht++){const Ft=be[ht];let nn=null;if(v!==null)nn=v.getViewport(Ft);else{const an=p.getViewSubImage(m,Ft);nn=an.viewport,ht===0&&(e.setRenderTargetTextures(M,an.colorTexture,an.depthStencilTexture),e.setRenderTarget(M))}let Dt=O[ht];Dt===void 0&&(Dt=new Ur,Dt.layers.enable(ht),Dt.viewport=new Vn,O[ht]=Dt),Dt.matrix.fromArray(Ft.transform.matrix),Dt.matrix.decompose(Dt.position,Dt.quaternion,Dt.scale),Dt.projectionMatrix.fromArray(Ft.projectionMatrix),Dt.projectionMatrixInverse.copy(Dt.projectionMatrix).invert(),Dt.viewport.set(nn.x,nn.y,nn.width,nn.height),ht===0&&(G.matrix.copy(Dt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Ne===!0&&G.cameras.push(Dt)}const et=r.enabledFeatures;if(et&&et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){p=i.getBinding();const ht=p.getDepthInformation(be[0]);ht&&ht.isValid&&ht.texture&&y.init(ht,r.renderState)}if(et&&et.includes("camera-access")&&w){e.state.unbindTexture(),p=i.getBinding();for(let ht=0;ht<be.length;ht++){const Ft=be[ht].camera;if(Ft){let nn=b[Ft];nn||(nn=new EP,b[Ft]=nn);const Dt=p.getCameraImage(Ft);nn.sourceTexture=Dt}}}}for(let be=0;be<I.length;be++){const Ne=k[be],et=I[be];Ne!==null&&et!==void 0&&et.update(Ne,ye,d||o)}Ee&&Ee(ne,ye),ye.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ye}),_=null}const Se=new CP;Se.setAnimationLoop(ze),this.setAnimationLoop=function(ne){Ee=ne},this.dispose=function(){}}}const so=new Co,bW=new Kn;function SW(t,e){function n(y,b){y.matrixAutoUpdate===!0&&y.updateMatrix(),b.value.copy(y.matrix)}function i(y,b){b.color.getRGB(y.fogColor.value,MP(t)),b.isFog?(y.fogNear.value=b.near,y.fogFar.value=b.far):b.isFogExp2&&(y.fogDensity.value=b.density)}function r(y,b,T,A,M){b.isMeshBasicMaterial?s(y,b):b.isMeshLambertMaterial?(s(y,b),b.envMap&&(y.envMapIntensity.value=b.envMapIntensity)):b.isMeshToonMaterial?(s(y,b),p(y,b)):b.isMeshPhongMaterial?(s(y,b),h(y,b),b.envMap&&(y.envMapIntensity.value=b.envMapIntensity)):b.isMeshStandardMaterial?(s(y,b),m(y,b),b.isMeshPhysicalMaterial&&v(y,b,M)):b.isMeshMatcapMaterial?(s(y,b),_(y,b)):b.isMeshDepthMaterial?s(y,b):b.isMeshDistanceMaterial?(s(y,b),w(y,b)):b.isMeshNormalMaterial?s(y,b):b.isLineBasicMaterial?(o(y,b),b.isLineDashedMaterial&&c(y,b)):b.isPointsMaterial?u(y,b,T,A):b.isSpriteMaterial?d(y,b):b.isShadowMaterial?(y.color.value.copy(b.color),y.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function s(y,b){y.opacity.value=b.opacity,b.color&&y.diffuse.value.copy(b.color),b.emissive&&y.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(y.map.value=b.map,n(b.map,y.mapTransform)),b.alphaMap&&(y.alphaMap.value=b.alphaMap,n(b.alphaMap,y.alphaMapTransform)),b.bumpMap&&(y.bumpMap.value=b.bumpMap,n(b.bumpMap,y.bumpMapTransform),y.bumpScale.value=b.bumpScale,b.side===Gi&&(y.bumpScale.value*=-1)),b.normalMap&&(y.normalMap.value=b.normalMap,n(b.normalMap,y.normalMapTransform),y.normalScale.value.copy(b.normalScale),b.side===Gi&&y.normalScale.value.negate()),b.displacementMap&&(y.displacementMap.value=b.displacementMap,n(b.displacementMap,y.displacementMapTransform),y.displacementScale.value=b.displacementScale,y.displacementBias.value=b.displacementBias),b.emissiveMap&&(y.emissiveMap.value=b.emissiveMap,n(b.emissiveMap,y.emissiveMapTransform)),b.specularMap&&(y.specularMap.value=b.specularMap,n(b.specularMap,y.specularMapTransform)),b.alphaTest>0&&(y.alphaTest.value=b.alphaTest);const T=e.get(b),A=T.envMap,M=T.envMapRotation;A&&(y.envMap.value=A,so.copy(M),so.x*=-1,so.y*=-1,so.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(so.y*=-1,so.z*=-1),y.envMapRotation.value.setFromMatrix4(bW.makeRotationFromEuler(so)),y.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=b.reflectivity,y.ior.value=b.ior,y.refractionRatio.value=b.refractionRatio),b.lightMap&&(y.lightMap.value=b.lightMap,y.lightMapIntensity.value=b.lightMapIntensity,n(b.lightMap,y.lightMapTransform)),b.aoMap&&(y.aoMap.value=b.aoMap,y.aoMapIntensity.value=b.aoMapIntensity,n(b.aoMap,y.aoMapTransform))}function o(y,b){y.diffuse.value.copy(b.color),y.opacity.value=b.opacity,b.map&&(y.map.value=b.map,n(b.map,y.mapTransform))}function c(y,b){y.dashSize.value=b.dashSize,y.totalSize.value=b.dashSize+b.gapSize,y.scale.value=b.scale}function u(y,b,T,A){y.diffuse.value.copy(b.color),y.opacity.value=b.opacity,y.size.value=b.size*T,y.scale.value=A*.5,b.map&&(y.map.value=b.map,n(b.map,y.uvTransform)),b.alphaMap&&(y.alphaMap.value=b.alphaMap,n(b.alphaMap,y.alphaMapTransform)),b.alphaTest>0&&(y.alphaTest.value=b.alphaTest)}function d(y,b){y.diffuse.value.copy(b.color),y.opacity.value=b.opacity,y.rotation.value=b.rotation,b.map&&(y.map.value=b.map,n(b.map,y.mapTransform)),b.alphaMap&&(y.alphaMap.value=b.alphaMap,n(b.alphaMap,y.alphaMapTransform)),b.alphaTest>0&&(y.alphaTest.value=b.alphaTest)}function h(y,b){y.specular.value.copy(b.specular),y.shininess.value=Math.max(b.shininess,1e-4)}function p(y,b){b.gradientMap&&(y.gradientMap.value=b.gradientMap)}function m(y,b){y.metalness.value=b.metalness,b.metalnessMap&&(y.metalnessMap.value=b.metalnessMap,n(b.metalnessMap,y.metalnessMapTransform)),y.roughness.value=b.roughness,b.roughnessMap&&(y.roughnessMap.value=b.roughnessMap,n(b.roughnessMap,y.roughnessMapTransform)),b.envMap&&(y.envMapIntensity.value=b.envMapIntensity)}function v(y,b,T){y.ior.value=b.ior,b.sheen>0&&(y.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),y.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(y.sheenColorMap.value=b.sheenColorMap,n(b.sheenColorMap,y.sheenColorMapTransform)),b.sheenRoughnessMap&&(y.sheenRoughnessMap.value=b.sheenRoughnessMap,n(b.sheenRoughnessMap,y.sheenRoughnessMapTransform))),b.clearcoat>0&&(y.clearcoat.value=b.clearcoat,y.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(y.clearcoatMap.value=b.clearcoatMap,n(b.clearcoatMap,y.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,n(b.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(y.clearcoatNormalMap.value=b.clearcoatNormalMap,n(b.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===Gi&&y.clearcoatNormalScale.value.negate())),b.dispersion>0&&(y.dispersion.value=b.dispersion),b.iridescence>0&&(y.iridescence.value=b.iridescence,y.iridescenceIOR.value=b.iridescenceIOR,y.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(y.iridescenceMap.value=b.iridescenceMap,n(b.iridescenceMap,y.iridescenceMapTransform)),b.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=b.iridescenceThicknessMap,n(b.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),b.transmission>0&&(y.transmission.value=b.transmission,y.transmissionSamplerMap.value=T.texture,y.transmissionSamplerSize.value.set(T.width,T.height),b.transmissionMap&&(y.transmissionMap.value=b.transmissionMap,n(b.transmissionMap,y.transmissionMapTransform)),y.thickness.value=b.thickness,b.thicknessMap&&(y.thicknessMap.value=b.thicknessMap,n(b.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=b.attenuationDistance,y.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(y.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(y.anisotropyMap.value=b.anisotropyMap,n(b.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=b.specularIntensity,y.specularColor.value.copy(b.specularColor),b.specularColorMap&&(y.specularColorMap.value=b.specularColorMap,n(b.specularColorMap,y.specularColorMapTransform)),b.specularIntensityMap&&(y.specularIntensityMap.value=b.specularIntensityMap,n(b.specularIntensityMap,y.specularIntensityMapTransform))}function _(y,b){b.matcap&&(y.matcap.value=b.matcap)}function w(y,b){const T=e.get(b).light;y.referencePosition.value.setFromMatrixPosition(T.matrixWorld),y.nearDistance.value=T.shadow.camera.near,y.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function wW(t,e,n,i){let r={},s={},o=[];const c=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function u(T,A){const M=A.program;i.uniformBlockBinding(T,M)}function d(T,A){let M=r[T.id];M===void 0&&(_(T),M=h(T),r[T.id]=M,T.addEventListener("dispose",y));const I=A.program;i.updateUBOMapping(T,I);const k=e.render.frame;s[T.id]!==k&&(m(T),s[T.id]=k)}function h(T){const A=p();T.__bindingPointIndex=A;const M=t.createBuffer(),I=T.__size,k=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,M),t.bufferData(t.UNIFORM_BUFFER,I,k),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,A,M),M}function p(){for(let T=0;T<c;T++)if(o.indexOf(T)===-1)return o.push(T),T;return _n("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(T){const A=r[T.id],M=T.uniforms,I=T.__cache;t.bindBuffer(t.UNIFORM_BUFFER,A);for(let k=0,U=M.length;k<U;k++){const S=Array.isArray(M[k])?M[k]:[M[k]];for(let P=0,V=S.length;P<V;P++){const O=S[P];if(v(O,k,P,I)===!0){const G=O.__offset,J=Array.isArray(O.value)?O.value:[O.value];let H=0;for(let X=0;X<J.length;X++){const K=J[X],Q=w(K);typeof K=="number"||typeof K=="boolean"?(O.__data[0]=K,t.bufferSubData(t.UNIFORM_BUFFER,G+H,O.__data)):K.isMatrix3?(O.__data[0]=K.elements[0],O.__data[1]=K.elements[1],O.__data[2]=K.elements[2],O.__data[3]=0,O.__data[4]=K.elements[3],O.__data[5]=K.elements[4],O.__data[6]=K.elements[5],O.__data[7]=0,O.__data[8]=K.elements[6],O.__data[9]=K.elements[7],O.__data[10]=K.elements[8],O.__data[11]=0):(K.toArray(O.__data,H),H+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,G,O.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function v(T,A,M,I){const k=T.value,U=A+"_"+M;if(I[U]===void 0)return typeof k=="number"||typeof k=="boolean"?I[U]=k:I[U]=k.clone(),!0;{const S=I[U];if(typeof k=="number"||typeof k=="boolean"){if(S!==k)return I[U]=k,!0}else if(S.equals(k)===!1)return S.copy(k),!0}return!1}function _(T){const A=T.uniforms;let M=0;const I=16;for(let U=0,S=A.length;U<S;U++){const P=Array.isArray(A[U])?A[U]:[A[U]];for(let V=0,O=P.length;V<O;V++){const G=P[V],J=Array.isArray(G.value)?G.value:[G.value];for(let H=0,X=J.length;H<X;H++){const K=J[H],Q=w(K),W=M%I,q=W%Q.boundary,Z=W+q;M+=q,Z!==0&&I-Z<Q.storage&&(M+=I-Z),G.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=M,M+=Q.storage}}}const k=M%I;return k>0&&(M+=I-k),T.__size=M,T.__cache={},this}function w(T){const A={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(A.boundary=4,A.storage=4):T.isVector2?(A.boundary=8,A.storage=8):T.isVector3||T.isColor?(A.boundary=16,A.storage=12):T.isVector4?(A.boundary=16,A.storage=16):T.isMatrix3?(A.boundary=48,A.storage=48):T.isMatrix4?(A.boundary=64,A.storage=64):T.isTexture?Gt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Gt("WebGLRenderer: Unsupported uniform value type.",T),A}function y(T){const A=T.target;A.removeEventListener("dispose",y);const M=o.indexOf(A.__bindingPointIndex);o.splice(M,1),t.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function b(){for(const T in r)t.deleteBuffer(r[T]);o=[],r={},s={}}return{bind:u,update:d,dispose:b}}const EW=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Xr=null;function MW(){return Xr===null&&(Xr=new _6(EW,16,16,$l,Hs),Xr.name="DFG_LUT",Xr.minFilter=wi,Xr.magFilter=wi,Xr.wrapS=Is,Xr.wrapT=Is,Xr.generateMipmaps=!1,Xr.needsUpdate=!0),Xr}class TW{constructor(e={}){const{canvas:n=YH(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:d=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:m=!1,outputBufferType:v=fr}=e;this.isWebGLRenderer=!0;let _;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=i.getContextAttributes().alpha}else _=o;const w=v,y=new Set([n_,t_,e_]),b=new Set([fr,us,xu,bu,Jy,Qy]),T=new Uint32Array(4),A=new Int32Array(4);let M=null,I=null;const k=[],U=[];let S=null;this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=is,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const P=this;let V=!1;this._outputColorSpace=ur;let O=0,G=0,J=null,H=-1,X=null;const K=new Vn,Q=new Vn;let W=null;const q=new Tn(0);let Z=0,z=n.width,ie=n.height,Ee=1,ze=null,Se=null;const ne=new Vn(0,0,z,ie),ye=new Vn(0,0,z,ie);let be=!1;const Ne=new SP;let et=!1,xt=!1;const pn=new Kn,ht=new me,Ft=new Vn,nn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Dt=!1;function an(){return J===null?Ee:1}let ee=i;function Sn(N,oe){return n.getContext(N,oe)}try{const N={alpha:!0,depth:r,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:d,powerPreference:h,failIfMajorPerformanceCaveat:p};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Ky}`),n.addEventListener("webglcontextlost",st,!1),n.addEventListener("webglcontextrestored",Nt,!1),n.addEventListener("webglcontextcreationerror",mn,!1),ee===null){const oe="webgl2";if(ee=Sn(oe,N),ee===null)throw Sn(oe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw _n("WebGLRenderer: "+N.message),N}let At,Lt,it,B,R,se,xe,we,ve,Ke,ke,pt,Pt,Pe,Oe,Ze,rt,$e,Ht,re,Ve,Le,Xe;function Re(){At=new Tj(ee),At.init(),Ve=new gW(ee,At),Lt=new yj(ee,At,e,Ve),it=new pW(ee,At),Lt.reversedDepthBuffer&&m&&it.buffers.depth.setReversed(!0),B=new Pj(ee),R=new eW,se=new mW(ee,At,it,R,Lt,Ve,B),xe=new Mj(P),we=new N6(ee),Le=new gj(ee,we),ve=new Aj(ee,we,B,Le),Ke=new kj(ee,ve,we,Le,B),$e=new Rj(ee,Lt,se),Oe=new _j(R),ke=new Q9(P,xe,At,Lt,Le,Oe),pt=new SW(P,R),Pt=new nW,Pe=new lW(At),rt=new mj(P,xe,it,Ke,_,u),Ze=new hW(P,Ke,Lt),Xe=new wW(ee,B,Lt,it),Ht=new vj(ee,At,B),re=new Cj(ee,At,B),B.programs=ke.programs,P.capabilities=Lt,P.extensions=At,P.properties=R,P.renderLists=Pt,P.shadowMap=Ze,P.state=it,P.info=B}Re(),w!==fr&&(S=new Dj(w,n.width,n.height,r,s));const _e=new xW(P,ee);this.xr=_e,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const N=At.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=At.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return Ee},this.setPixelRatio=function(N){N!==void 0&&(Ee=N,this.setSize(z,ie,!1))},this.getSize=function(N){return N.set(z,ie)},this.setSize=function(N,oe,pe=!0){if(_e.isPresenting){Gt("WebGLRenderer: Can't change size while VR device is presenting.");return}z=N,ie=oe,n.width=Math.floor(N*Ee),n.height=Math.floor(oe*Ee),pe===!0&&(n.style.width=N+"px",n.style.height=oe+"px"),S!==null&&S.setSize(n.width,n.height),this.setViewport(0,0,N,oe)},this.getDrawingBufferSize=function(N){return N.set(z*Ee,ie*Ee).floor()},this.setDrawingBufferSize=function(N,oe,pe){z=N,ie=oe,Ee=pe,n.width=Math.floor(N*pe),n.height=Math.floor(oe*pe),this.setViewport(0,0,N,oe)},this.setEffects=function(N){if(w===fr){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(N){for(let oe=0;oe<N.length;oe++)if(N[oe].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}S.setEffects(N||[])},this.getCurrentViewport=function(N){return N.copy(K)},this.getViewport=function(N){return N.copy(ne)},this.setViewport=function(N,oe,pe,de){N.isVector4?ne.set(N.x,N.y,N.z,N.w):ne.set(N,oe,pe,de),it.viewport(K.copy(ne).multiplyScalar(Ee).round())},this.getScissor=function(N){return N.copy(ye)},this.setScissor=function(N,oe,pe,de){N.isVector4?ye.set(N.x,N.y,N.z,N.w):ye.set(N,oe,pe,de),it.scissor(Q.copy(ye).multiplyScalar(Ee).round())},this.getScissorTest=function(){return be},this.setScissorTest=function(N){it.setScissorTest(be=N)},this.setOpaqueSort=function(N){ze=N},this.setTransparentSort=function(N){Se=N},this.getClearColor=function(N){return N.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor(...arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha(...arguments)},this.clear=function(N=!0,oe=!0,pe=!0){let de=0;if(N){let ce=!1;if(J!==null){const je=J.texture.format;ce=y.has(je)}if(ce){const je=J.texture.type,qe=b.has(je),Ge=rt.getClearColor(),We=rt.getClearAlpha(),ct=Ge.r,He=Ge.g,Mt=Ge.b;qe?(T[0]=ct,T[1]=He,T[2]=Mt,T[3]=We,ee.clearBufferuiv(ee.COLOR,0,T)):(A[0]=ct,A[1]=He,A[2]=Mt,A[3]=We,ee.clearBufferiv(ee.COLOR,0,A))}else de|=ee.COLOR_BUFFER_BIT}oe&&(de|=ee.DEPTH_BUFFER_BIT),pe&&(de|=ee.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),de!==0&&ee.clear(de)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",st,!1),n.removeEventListener("webglcontextrestored",Nt,!1),n.removeEventListener("webglcontextcreationerror",mn,!1),rt.dispose(),Pt.dispose(),Pe.dispose(),R.dispose(),xe.dispose(),Ke.dispose(),Le.dispose(),Xe.dispose(),ke.dispose(),_e.dispose(),_e.removeEventListener("sessionstart",le),_e.removeEventListener("sessionend",he),Me.stop()};function st(N){N.preventDefault(),P1("WebGLRenderer: Context Lost."),V=!0}function Nt(){P1("WebGLRenderer: Context Restored."),V=!1;const N=B.autoReset,oe=Ze.enabled,pe=Ze.autoUpdate,de=Ze.needsUpdate,ce=Ze.type;Re(),B.autoReset=N,Ze.enabled=oe,Ze.autoUpdate=pe,Ze.needsUpdate=de,Ze.type=ce}function mn(N){_n("WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function Kt(N){const oe=N.target;oe.removeEventListener("dispose",Kt),ui(oe)}function ui(N){ri(N),R.remove(N)}function ri(N){const oe=R.get(N).programs;oe!==void 0&&(oe.forEach(function(pe){ke.releaseProgram(pe)}),N.isShaderMaterial&&ke.releaseShaderCache(N))}this.renderBufferDirect=function(N,oe,pe,de,ce,je){oe===null&&(oe=nn);const qe=ce.isMesh&&ce.matrixWorld.determinant()<0,Ge=un(N,oe,pe,de,ce);it.setMaterial(de,qe);let We=pe.index,ct=1;if(de.wireframe===!0){if(We=ve.getWireframeAttribute(pe),We===void 0)return;ct=2}const He=pe.drawRange,Mt=pe.attributes.position;let lt=He.start*ct,Zt=(He.start+He.count)*ct;je!==null&&(lt=Math.max(lt,je.start*ct),Zt=Math.min(Zt,(je.start+je.count)*ct)),We!==null?(lt=Math.max(lt,0),Zt=Math.min(Zt,We.count)):Mt!=null&&(lt=Math.max(lt,0),Zt=Math.min(Zt,Mt.count));const It=Zt-lt;if(It<0||It===1/0)return;Le.setup(ce,de,Ge,pe,We);let vn,tn=Ht;if(We!==null&&(vn=we.get(We),tn=re,tn.setIndex(vn)),ce.isMesh)de.wireframe===!0?(it.setLineWidth(de.wireframeLinewidth*an()),tn.setMode(ee.LINES)):tn.setMode(ee.TRIANGLES);else if(ce.isLine){let Un=de.linewidth;Un===void 0&&(Un=1),it.setLineWidth(Un*an()),ce.isLineSegments?tn.setMode(ee.LINES):ce.isLineLoop?tn.setMode(ee.LINE_LOOP):tn.setMode(ee.LINE_STRIP)}else ce.isPoints?tn.setMode(ee.POINTS):ce.isSprite&&tn.setMode(ee.TRIANGLES);if(ce.isBatchedMesh)if(ce._multiDrawInstances!==null)Mh("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),tn.renderMultiDrawInstances(ce._multiDrawStarts,ce._multiDrawCounts,ce._multiDrawCount,ce._multiDrawInstances);else if(At.get("WEBGL_multi_draw"))tn.renderMultiDraw(ce._multiDrawStarts,ce._multiDrawCounts,ce._multiDrawCount);else{const Un=ce._multiDrawStarts,_t=ce._multiDrawCounts,Mi=ce._multiDrawCount,rn=We?we.get(We).bytesPerElement:1,Ni=R.get(de).currentProgram.getUniforms();for(let Ii=0;Ii<Mi;Ii++)Ni.setValue(ee,"_gl_DrawID",Ii),tn.render(Un[Ii]/rn,_t[Ii])}else if(ce.isInstancedMesh)tn.renderInstances(lt,It,ce.count);else if(pe.isInstancedBufferGeometry){const Un=pe._maxInstanceCount!==void 0?pe._maxInstanceCount:1/0,_t=Math.min(pe.instanceCount,Un);tn.renderInstances(lt,It,_t)}else tn.render(lt,It)};function Xs(N,oe,pe){N.transparent===!0&&N.side===Ns&&N.forceSinglePass===!1?(N.side=Gi,N.needsUpdate=!0,Et(N,oe,pe),N.side=Ua,N.needsUpdate=!0,Et(N,oe,pe),N.side=Ns):Et(N,oe,pe)}this.compile=function(N,oe,pe=null){pe===null&&(pe=N),I=Pe.get(pe),I.init(oe),U.push(I),pe.traverseVisible(function(ce){ce.isLight&&ce.layers.test(oe.layers)&&(I.pushLight(ce),ce.castShadow&&I.pushShadow(ce))}),N!==pe&&N.traverseVisible(function(ce){ce.isLight&&ce.layers.test(oe.layers)&&(I.pushLight(ce),ce.castShadow&&I.pushShadow(ce))}),I.setupLights();const de=new Set;return N.traverse(function(ce){if(!(ce.isMesh||ce.isPoints||ce.isLine||ce.isSprite))return;const je=ce.material;if(je)if(Array.isArray(je))for(let qe=0;qe<je.length;qe++){const Ge=je[qe];Xs(Ge,pe,ce),de.add(Ge)}else Xs(je,pe,ce),de.add(je)}),I=U.pop(),de},this.compileAsync=function(N,oe,pe=null){const de=this.compile(N,oe,pe);return new Promise(ce=>{function je(){if(de.forEach(function(qe){R.get(qe).currentProgram.isReady()&&de.delete(qe)}),de.size===0){ce(N);return}setTimeout(je,10)}At.get("KHR_parallel_shader_compile")!==null?je():setTimeout(je,10)})};let Sr=null;function Y(N){Sr&&Sr(N)}function le(){Me.stop()}function he(){Me.start()}const Me=new CP;Me.setAnimationLoop(Y),typeof self<"u"&&Me.setContext(self),this.setAnimationLoop=function(N){Sr=N,_e.setAnimationLoop(N),N===null?Me.stop():Me.start()},_e.addEventListener("sessionstart",le),_e.addEventListener("sessionend",he),this.render=function(N,oe){if(oe!==void 0&&oe.isCamera!==!0){_n("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;const pe=_e.enabled===!0&&_e.isPresenting===!0,de=S!==null&&(J===null||pe)&&S.begin(P,J);if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),oe.parent===null&&oe.matrixWorldAutoUpdate===!0&&oe.updateMatrixWorld(),_e.enabled===!0&&_e.isPresenting===!0&&(S===null||S.isCompositing()===!1)&&(_e.cameraAutoUpdate===!0&&_e.updateCamera(oe),oe=_e.getCamera()),N.isScene===!0&&N.onBeforeRender(P,N,oe,J),I=Pe.get(N,U.length),I.init(oe),U.push(I),pn.multiplyMatrices(oe.projectionMatrix,oe.matrixWorldInverse),Ne.setFromProjectionMatrix(pn,es,oe.reversedDepth),xt=this.localClippingEnabled,et=Oe.init(this.clippingPlanes,xt),M=Pt.get(N,k.length),M.init(),k.push(M),_e.enabled===!0&&_e.isPresenting===!0){const qe=P.xr.getDepthSensingMesh();qe!==null&&Ie(qe,oe,-1/0,P.sortObjects)}Ie(N,oe,0,P.sortObjects),M.finish(),P.sortObjects===!0&&M.sort(ze,Se),Dt=_e.enabled===!1||_e.isPresenting===!1||_e.hasDepthSensing()===!1,Dt&&rt.addToRenderList(M,N),this.info.render.frame++,et===!0&&Oe.beginShadows();const ce=I.state.shadowsArray;if(Ze.render(ce,N,oe),et===!0&&Oe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(de&&S.hasRenderPass())===!1){const qe=M.opaque,Ge=M.transmissive;if(I.setupLights(),oe.isArrayCamera){const We=oe.cameras;if(Ge.length>0)for(let ct=0,He=We.length;ct<He;ct++){const Mt=We[ct];tt(qe,Ge,N,Mt)}Dt&&rt.render(N);for(let ct=0,He=We.length;ct<He;ct++){const Mt=We[ct];vt(M,N,Mt,Mt.viewport)}}else Ge.length>0&&tt(qe,Ge,N,oe),Dt&&rt.render(N),vt(M,N,oe)}J!==null&&G===0&&(se.updateMultisampleRenderTarget(J),se.updateRenderTargetMipmap(J)),de&&S.end(P),N.isScene===!0&&N.onAfterRender(P,N,oe),Le.resetDefaultState(),H=-1,X=null,U.pop(),U.length>0?(I=U[U.length-1],et===!0&&Oe.setGlobalState(P.clippingPlanes,I.state.camera)):I=null,k.pop(),k.length>0?M=k[k.length-1]:M=null};function Ie(N,oe,pe,de){if(N.visible===!1)return;if(N.layers.test(oe.layers)){if(N.isGroup)pe=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(oe);else if(N.isLight)I.pushLight(N),N.castShadow&&I.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||Ne.intersectsSprite(N)){de&&Ft.setFromMatrixPosition(N.matrixWorld).applyMatrix4(pn);const qe=Ke.update(N),Ge=N.material;Ge.visible&&M.push(N,qe,Ge,pe,Ft.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||Ne.intersectsObject(N))){const qe=Ke.update(N),Ge=N.material;if(de&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Ft.copy(N.boundingSphere.center)):(qe.boundingSphere===null&&qe.computeBoundingSphere(),Ft.copy(qe.boundingSphere.center)),Ft.applyMatrix4(N.matrixWorld).applyMatrix4(pn)),Array.isArray(Ge)){const We=qe.groups;for(let ct=0,He=We.length;ct<He;ct++){const Mt=We[ct],lt=Ge[Mt.materialIndex];lt&<.visible&&M.push(N,qe,lt,pe,Ft.z,Mt)}}else Ge.visible&&M.push(N,qe,Ge,pe,Ft.z,null)}}const je=N.children;for(let qe=0,Ge=je.length;qe<Ge;qe++)Ie(je[qe],oe,pe,de)}function vt(N,oe,pe,de){const{opaque:ce,transmissive:je,transparent:qe}=N;I.setupLightsView(pe),et===!0&&Oe.setGlobalState(P.clippingPlanes,pe),de&&it.viewport(K.copy(de)),ce.length>0&&yt(ce,oe,pe),je.length>0&&yt(je,oe,pe),qe.length>0&&yt(qe,oe,pe),it.buffers.depth.setTest(!0),it.buffers.depth.setMask(!0),it.buffers.color.setMask(!0),it.setPolygonOffset(!1)}function tt(N,oe,pe,de){if((pe.isScene===!0?pe.overrideMaterial:null)!==null)return;if(I.state.transmissionRenderTarget[de.id]===void 0){const lt=At.has("EXT_color_buffer_half_float")||At.has("EXT_color_buffer_float");I.state.transmissionRenderTarget[de.id]=new rs(1,1,{generateMipmaps:!0,type:lt?Hs:fr,minFilter:mo,samples:Math.max(4,Lt.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:fn.workingColorSpace})}const je=I.state.transmissionRenderTarget[de.id],qe=de.viewport||K;je.setSize(qe.z*P.transmissionResolutionScale,qe.w*P.transmissionResolutionScale);const Ge=P.getRenderTarget(),We=P.getActiveCubeFace(),ct=P.getActiveMipmapLevel();P.setRenderTarget(je),P.getClearColor(q),Z=P.getClearAlpha(),Z<1&&P.setClearColor(16777215,.5),P.clear(),Dt&&rt.render(pe);const He=P.toneMapping;P.toneMapping=is;const Mt=de.viewport;if(de.viewport!==void 0&&(de.viewport=void 0),I.setupLightsView(de),et===!0&&Oe.setGlobalState(P.clippingPlanes,de),yt(N,pe,de),se.updateMultisampleRenderTarget(je),se.updateRenderTargetMipmap(je),At.has("WEBGL_multisampled_render_to_texture")===!1){let lt=!1;for(let Zt=0,It=oe.length;Zt<It;Zt++){const vn=oe[Zt],{object:tn,geometry:Un,material:_t,group:Mi}=vn;if(_t.side===Ns&&tn.layers.test(de.layers)){const rn=_t.side;_t.side=Gi,_t.needsUpdate=!0,Qe(tn,pe,de,Un,_t,Mi),_t.side=rn,_t.needsUpdate=!0,lt=!0}}lt===!0&&(se.updateMultisampleRenderTarget(je),se.updateRenderTargetMipmap(je))}P.setRenderTarget(Ge,We,ct),P.setClearColor(q,Z),Mt!==void 0&&(de.viewport=Mt),P.toneMapping=He}function yt(N,oe,pe){const de=oe.isScene===!0?oe.overrideMaterial:null;for(let ce=0,je=N.length;ce<je;ce++){const qe=N[ce],{object:Ge,geometry:We,group:ct}=qe;let He=qe.material;He.allowOverride===!0&&de!==null&&(He=de),Ge.layers.test(pe.layers)&&Qe(Ge,oe,pe,We,He,ct)}}function Qe(N,oe,pe,de,ce,je){N.onBeforeRender(P,oe,pe,de,ce,je),N.modelViewMatrix.multiplyMatrices(pe.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),ce.onBeforeRender(P,oe,pe,de,N,je),ce.transparent===!0&&ce.side===Ns&&ce.forceSinglePass===!1?(ce.side=Gi,ce.needsUpdate=!0,P.renderBufferDirect(pe,oe,de,ce,N,je),ce.side=Ua,ce.needsUpdate=!0,P.renderBufferDirect(pe,oe,de,ce,N,je),ce.side=Ns):P.renderBufferDirect(pe,oe,de,ce,N,je),N.onAfterRender(P,oe,pe,de,ce,je)}function Et(N,oe,pe){oe.isScene!==!0&&(oe=nn);const de=R.get(N),ce=I.state.lights,je=I.state.shadowsArray,qe=ce.state.version,Ge=ke.getParameters(N,ce.state,je,oe,pe),We=ke.getProgramCacheKey(Ge);let ct=de.programs;de.environment=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?oe.environment:null,de.fog=oe.fog;const He=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap;de.envMap=xe.get(N.envMap||de.environment,He),de.envMapRotation=de.environment!==null&&N.envMap===null?oe.environmentRotation:N.envMapRotation,ct===void 0&&(N.addEventListener("dispose",Kt),ct=new Map,de.programs=ct);let Mt=ct.get(We);if(Mt!==void 0){if(de.currentProgram===Mt&&de.lightsStateVersion===qe)return bt(N,Ge),Mt}else Ge.uniforms=ke.getUniforms(N),N.onBeforeCompile(Ge,P),Mt=ke.acquireProgram(Ge,We),ct.set(We,Mt),de.uniforms=Ge.uniforms;const lt=de.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(lt.clippingPlanes=Oe.uniform),bt(N,Ge),de.needsLights=En(N),de.lightsStateVersion=qe,de.needsLights&&(lt.ambientLightColor.value=ce.state.ambient,lt.lightProbe.value=ce.state.probe,lt.directionalLights.value=ce.state.directional,lt.directionalLightShadows.value=ce.state.directionalShadow,lt.spotLights.value=ce.state.spot,lt.spotLightShadows.value=ce.state.spotShadow,lt.rectAreaLights.value=ce.state.rectArea,lt.ltc_1.value=ce.state.rectAreaLTC1,lt.ltc_2.value=ce.state.rectAreaLTC2,lt.pointLights.value=ce.state.point,lt.pointLightShadows.value=ce.state.pointShadow,lt.hemisphereLights.value=ce.state.hemi,lt.directionalShadowMatrix.value=ce.state.directionalShadowMatrix,lt.spotLightMatrix.value=ce.state.spotLightMatrix,lt.spotLightMap.value=ce.state.spotLightMap,lt.pointShadowMatrix.value=ce.state.pointShadowMatrix),de.currentProgram=Mt,de.uniformsList=null,Mt}function Tt(N){if(N.uniformsList===null){const oe=N.currentProgram.getUniforms();N.uniformsList=Yf.seqWithValue(oe.seq,N.uniforms)}return N.uniformsList}function bt(N,oe){const pe=R.get(N);pe.outputColorSpace=oe.outputColorSpace,pe.batching=oe.batching,pe.batchingColor=oe.batchingColor,pe.instancing=oe.instancing,pe.instancingColor=oe.instancingColor,pe.instancingMorph=oe.instancingMorph,pe.skinning=oe.skinning,pe.morphTargets=oe.morphTargets,pe.morphNormals=oe.morphNormals,pe.morphColors=oe.morphColors,pe.morphTargetsCount=oe.morphTargetsCount,pe.numClippingPlanes=oe.numClippingPlanes,pe.numIntersection=oe.numClipIntersection,pe.vertexAlphas=oe.vertexAlphas,pe.vertexTangents=oe.vertexTangents,pe.toneMapping=oe.toneMapping}function un(N,oe,pe,de,ce){oe.isScene!==!0&&(oe=nn),se.resetTextureUnits();const je=oe.fog,qe=de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial?oe.environment:null,Ge=J===null?P.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:Ao,We=de.isMeshStandardMaterial||de.isMeshLambertMaterial&&!de.envMap||de.isMeshPhongMaterial&&!de.envMap,ct=xe.get(de.envMap||qe,We),He=de.vertexColors===!0&&!!pe.attributes.color&&pe.attributes.color.itemSize===4,Mt=!!pe.attributes.tangent&&(!!de.normalMap||de.anisotropy>0),lt=!!pe.morphAttributes.position,Zt=!!pe.morphAttributes.normal,It=!!pe.morphAttributes.color;let vn=is;de.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(vn=P.toneMapping);const tn=pe.morphAttributes.position||pe.morphAttributes.normal||pe.morphAttributes.color,Un=tn!==void 0?tn.length:0,_t=R.get(de),Mi=I.state.lights;if(et===!0&&(xt===!0||N!==X)){const Hn=N===X&&de.id===H;Oe.setState(de,N,Hn)}let rn=!1;de.version===_t.__version?(_t.needsLights&&_t.lightsStateVersion!==Mi.state.version||_t.outputColorSpace!==Ge||ce.isBatchedMesh&&_t.batching===!1||!ce.isBatchedMesh&&_t.batching===!0||ce.isBatchedMesh&&_t.batchingColor===!0&&ce.colorTexture===null||ce.isBatchedMesh&&_t.batchingColor===!1&&ce.colorTexture!==null||ce.isInstancedMesh&&_t.instancing===!1||!ce.isInstancedMesh&&_t.instancing===!0||ce.isSkinnedMesh&&_t.skinning===!1||!ce.isSkinnedMesh&&_t.skinning===!0||ce.isInstancedMesh&&_t.instancingColor===!0&&ce.instanceColor===null||ce.isInstancedMesh&&_t.instancingColor===!1&&ce.instanceColor!==null||ce.isInstancedMesh&&_t.instancingMorph===!0&&ce.morphTexture===null||ce.isInstancedMesh&&_t.instancingMorph===!1&&ce.morphTexture!==null||_t.envMap!==ct||de.fog===!0&&_t.fog!==je||_t.numClippingPlanes!==void 0&&(_t.numClippingPlanes!==Oe.numPlanes||_t.numIntersection!==Oe.numIntersection)||_t.vertexAlphas!==He||_t.vertexTangents!==Mt||_t.morphTargets!==lt||_t.morphNormals!==Zt||_t.morphColors!==It||_t.toneMapping!==vn||_t.morphTargetsCount!==Un)&&(rn=!0):(rn=!0,_t.__version=de.version);let Ni=_t.currentProgram;rn===!0&&(Ni=Et(de,oe,ce));let Ii=!1,ji=!1,qs=!1;const xn=Ni.getUniforms(),Ot=_t.uniforms;if(it.useProgram(Ni.program)&&(Ii=!0,ji=!0,qs=!0),de.id!==H&&(H=de.id,ji=!0),Ii||X!==N){it.buffers.depth.getReversed()&&N.reversedDepth!==!0&&(N._reversedDepth=!0,N.updateProjectionMatrix()),xn.setValue(ee,"projectionMatrix",N.projectionMatrix),xn.setValue(ee,"viewMatrix",N.matrixWorldInverse);const tr=xn.map.cameraPosition;tr!==void 0&&tr.setValue(ee,ht.setFromMatrixPosition(N.matrixWorld)),Lt.logarithmicDepthBuffer&&xn.setValue(ee,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial)&&xn.setValue(ee,"isOrthographic",N.isOrthographicCamera===!0),X!==N&&(X=N,ji=!0,qs=!0)}if(_t.needsLights&&(Mi.state.directionalShadowMap.length>0&&xn.setValue(ee,"directionalShadowMap",Mi.state.directionalShadowMap,se),Mi.state.spotShadowMap.length>0&&xn.setValue(ee,"spotShadowMap",Mi.state.spotShadowMap,se),Mi.state.pointShadowMap.length>0&&xn.setValue(ee,"pointShadowMap",Mi.state.pointShadowMap,se)),ce.isSkinnedMesh){xn.setOptional(ee,ce,"bindMatrix"),xn.setOptional(ee,ce,"bindMatrixInverse");const Hn=ce.skeleton;Hn&&(Hn.boneTexture===null&&Hn.computeBoneTexture(),xn.setValue(ee,"boneTexture",Hn.boneTexture,se))}ce.isBatchedMesh&&(xn.setOptional(ee,ce,"batchingTexture"),xn.setValue(ee,"batchingTexture",ce._matricesTexture,se),xn.setOptional(ee,ce,"batchingIdTexture"),xn.setValue(ee,"batchingIdTexture",ce._indirectTexture,se),xn.setOptional(ee,ce,"batchingColorTexture"),ce._colorsTexture!==null&&xn.setValue(ee,"batchingColorTexture",ce._colorsTexture,se));const wr=pe.morphAttributes;if((wr.position!==void 0||wr.normal!==void 0||wr.color!==void 0)&&$e.update(ce,pe,Ni),(ji||_t.receiveShadow!==ce.receiveShadow)&&(_t.receiveShadow=ce.receiveShadow,xn.setValue(ee,"receiveShadow",ce.receiveShadow)),(de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial)&&de.envMap===null&&oe.environment!==null&&(Ot.envMapIntensity.value=oe.environmentIntensity),Ot.dfgLUT!==void 0&&(Ot.dfgLUT.value=MW()),ji&&(xn.setValue(ee,"toneMappingExposure",P.toneMappingExposure),_t.needsLights&&en(Ot,qs),je&&de.fog===!0&&pt.refreshFogUniforms(Ot,je),pt.refreshMaterialUniforms(Ot,de,Ee,ie,I.state.transmissionRenderTarget[N.id]),Yf.upload(ee,Tt(_t),Ot,se)),de.isShaderMaterial&&de.uniformsNeedUpdate===!0&&(Yf.upload(ee,Tt(_t),Ot,se),de.uniformsNeedUpdate=!1),de.isSpriteMaterial&&xn.setValue(ee,"center",ce.center),xn.setValue(ee,"modelViewMatrix",ce.modelViewMatrix),xn.setValue(ee,"normalMatrix",ce.normalMatrix),xn.setValue(ee,"modelMatrix",ce.matrixWorld),de.isShaderMaterial||de.isRawShaderMaterial){const Hn=de.uniformsGroups;for(let tr=0,vs=Hn.length;tr<vs;tr++){const ic=Hn[tr];Xe.update(ic,Ni),Xe.bind(ic,Ni)}}return Ni}function en(N,oe){N.ambientLightColor.needsUpdate=oe,N.lightProbe.needsUpdate=oe,N.directionalLights.needsUpdate=oe,N.directionalLightShadows.needsUpdate=oe,N.pointLights.needsUpdate=oe,N.pointLightShadows.needsUpdate=oe,N.spotLights.needsUpdate=oe,N.spotLightShadows.needsUpdate=oe,N.rectAreaLights.needsUpdate=oe,N.hemisphereLights.needsUpdate=oe}function En(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return J},this.setRenderTargetTextures=function(N,oe,pe){const de=R.get(N);de.__autoAllocateDepthBuffer=N.resolveDepthBuffer===!1,de.__autoAllocateDepthBuffer===!1&&(de.__useRenderToTexture=!1),R.get(N.texture).__webglTexture=oe,R.get(N.depthTexture).__webglTexture=de.__autoAllocateDepthBuffer?void 0:pe,de.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(N,oe){const pe=R.get(N);pe.__webglFramebuffer=oe,pe.__useDefaultFramebuffer=oe===void 0};const In=ee.createFramebuffer();this.setRenderTarget=function(N,oe=0,pe=0){J=N,O=oe,G=pe;let de=null,ce=!1,je=!1;if(N){const Ge=R.get(N);if(Ge.__useDefaultFramebuffer!==void 0){it.bindFramebuffer(ee.FRAMEBUFFER,Ge.__webglFramebuffer),K.copy(N.viewport),Q.copy(N.scissor),W=N.scissorTest,it.viewport(K),it.scissor(Q),it.setScissorTest(W),H=-1;return}else if(Ge.__webglFramebuffer===void 0)se.setupRenderTarget(N);else if(Ge.__hasExternalTextures)se.rebindTextures(N,R.get(N.texture).__webglTexture,R.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const He=N.depthTexture;if(Ge.__boundDepthTexture!==He){if(He!==null&&R.has(He)&&(N.width!==He.image.width||N.height!==He.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");se.setupDepthRenderbuffer(N)}}const We=N.texture;(We.isData3DTexture||We.isDataArrayTexture||We.isCompressedArrayTexture)&&(je=!0);const ct=R.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(ct[oe])?de=ct[oe][pe]:de=ct[oe],ce=!0):N.samples>0&&se.useMultisampledRTT(N)===!1?de=R.get(N).__webglMultisampledFramebuffer:Array.isArray(ct)?de=ct[pe]:de=ct,K.copy(N.viewport),Q.copy(N.scissor),W=N.scissorTest}else K.copy(ne).multiplyScalar(Ee).floor(),Q.copy(ye).multiplyScalar(Ee).floor(),W=be;if(pe!==0&&(de=In),it.bindFramebuffer(ee.FRAMEBUFFER,de)&&it.drawBuffers(N,de),it.viewport(K),it.scissor(Q),it.setScissorTest(W),ce){const Ge=R.get(N.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+oe,Ge.__webglTexture,pe)}else if(je){const Ge=oe;for(let We=0;We<N.textures.length;We++){const ct=R.get(N.textures[We]);ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0+We,ct.__webglTexture,pe,Ge)}}else if(N!==null&&pe!==0){const Ge=R.get(N.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Ge.__webglTexture,pe)}H=-1},this.readRenderTargetPixels=function(N,oe,pe,de,ce,je,qe,Ge=0){if(!(N&&N.isWebGLRenderTarget)){_n("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let We=R.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&qe!==void 0&&(We=We[qe]),We){it.bindFramebuffer(ee.FRAMEBUFFER,We);try{const ct=N.textures[Ge],He=ct.format,Mt=ct.type;if(N.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+Ge),!Lt.textureFormatReadable(He)){_n("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Lt.textureTypeReadable(Mt)){_n("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}oe>=0&&oe<=N.width-de&&pe>=0&&pe<=N.height-ce&&ee.readPixels(oe,pe,de,ce,Ve.convert(He),Ve.convert(Mt),je)}finally{const ct=J!==null?R.get(J).__webglFramebuffer:null;it.bindFramebuffer(ee.FRAMEBUFFER,ct)}}},this.readRenderTargetPixelsAsync=async function(N,oe,pe,de,ce,je,qe,Ge=0){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let We=R.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&qe!==void 0&&(We=We[qe]),We)if(oe>=0&&oe<=N.width-de&&pe>=0&&pe<=N.height-ce){it.bindFramebuffer(ee.FRAMEBUFFER,We);const ct=N.textures[Ge],He=ct.format,Mt=ct.type;if(N.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+Ge),!Lt.textureFormatReadable(He))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Lt.textureTypeReadable(Mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const lt=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,lt),ee.bufferData(ee.PIXEL_PACK_BUFFER,je.byteLength,ee.STREAM_READ),ee.readPixels(oe,pe,de,ce,Ve.convert(He),Ve.convert(Mt),0);const Zt=J!==null?R.get(J).__webglFramebuffer:null;it.bindFramebuffer(ee.FRAMEBUFFER,Zt);const It=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await KH(ee,It,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,lt),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,je),ee.deleteBuffer(lt),ee.deleteSync(It),je}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(N,oe=null,pe=0){const de=Math.pow(2,-pe),ce=Math.floor(N.image.width*de),je=Math.floor(N.image.height*de),qe=oe!==null?oe.x:0,Ge=oe!==null?oe.y:0;se.setTexture2D(N,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,pe,0,0,qe,Ge,ce,je),it.unbindTexture()};const Zn=ee.createFramebuffer(),gn=ee.createFramebuffer();this.copyTextureToTexture=function(N,oe,pe=null,de=null,ce=0,je=0){let qe,Ge,We,ct,He,Mt,lt,Zt,It;const vn=N.isCompressedTexture?N.mipmaps[je]:N.image;if(pe!==null)qe=pe.max.x-pe.min.x,Ge=pe.max.y-pe.min.y,We=pe.isBox3?pe.max.z-pe.min.z:1,ct=pe.min.x,He=pe.min.y,Mt=pe.isBox3?pe.min.z:0;else{const Ot=Math.pow(2,-ce);qe=Math.floor(vn.width*Ot),Ge=Math.floor(vn.height*Ot),N.isDataArrayTexture?We=vn.depth:N.isData3DTexture?We=Math.floor(vn.depth*Ot):We=1,ct=0,He=0,Mt=0}de!==null?(lt=de.x,Zt=de.y,It=de.z):(lt=0,Zt=0,It=0);const tn=Ve.convert(oe.format),Un=Ve.convert(oe.type);let _t;oe.isData3DTexture?(se.setTexture3D(oe,0),_t=ee.TEXTURE_3D):oe.isDataArrayTexture||oe.isCompressedArrayTexture?(se.setTexture2DArray(oe,0),_t=ee.TEXTURE_2D_ARRAY):(se.setTexture2D(oe,0),_t=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,oe.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,oe.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,oe.unpackAlignment);const Mi=ee.getParameter(ee.UNPACK_ROW_LENGTH),rn=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),Ni=ee.getParameter(ee.UNPACK_SKIP_PIXELS),Ii=ee.getParameter(ee.UNPACK_SKIP_ROWS),ji=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,vn.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,vn.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,ct),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,He),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Mt);const qs=N.isDataArrayTexture||N.isData3DTexture,xn=oe.isDataArrayTexture||oe.isData3DTexture;if(N.isDepthTexture){const Ot=R.get(N),wr=R.get(oe),Hn=R.get(Ot.__renderTarget),tr=R.get(wr.__renderTarget);it.bindFramebuffer(ee.READ_FRAMEBUFFER,Hn.__webglFramebuffer),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,tr.__webglFramebuffer);for(let vs=0;vs<We;vs++)qs&&(ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,R.get(N).__webglTexture,ce,Mt+vs),ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,R.get(oe).__webglTexture,je,It+vs)),ee.blitFramebuffer(ct,He,qe,Ge,lt,Zt,qe,Ge,ee.DEPTH_BUFFER_BIT,ee.NEAREST);it.bindFramebuffer(ee.READ_FRAMEBUFFER,null),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else if(ce!==0||N.isRenderTargetTexture||R.has(N)){const Ot=R.get(N),wr=R.get(oe);it.bindFramebuffer(ee.READ_FRAMEBUFFER,Zn),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,gn);for(let Hn=0;Hn<We;Hn++)qs?ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Ot.__webglTexture,ce,Mt+Hn):ee.framebufferTexture2D(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Ot.__webglTexture,ce),xn?ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,wr.__webglTexture,je,It+Hn):ee.framebufferTexture2D(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,wr.__webglTexture,je),ce!==0?ee.blitFramebuffer(ct,He,qe,Ge,lt,Zt,qe,Ge,ee.COLOR_BUFFER_BIT,ee.NEAREST):xn?ee.copyTexSubImage3D(_t,je,lt,Zt,It+Hn,ct,He,qe,Ge):ee.copyTexSubImage2D(_t,je,lt,Zt,ct,He,qe,Ge);it.bindFramebuffer(ee.READ_FRAMEBUFFER,null),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else xn?N.isDataTexture||N.isData3DTexture?ee.texSubImage3D(_t,je,lt,Zt,It,qe,Ge,We,tn,Un,vn.data):oe.isCompressedArrayTexture?ee.compressedTexSubImage3D(_t,je,lt,Zt,It,qe,Ge,We,tn,vn.data):ee.texSubImage3D(_t,je,lt,Zt,It,qe,Ge,We,tn,Un,vn):N.isDataTexture?ee.texSubImage2D(ee.TEXTURE_2D,je,lt,Zt,qe,Ge,tn,Un,vn.data):N.isCompressedTexture?ee.compressedTexSubImage2D(ee.TEXTURE_2D,je,lt,Zt,vn.width,vn.height,tn,vn.data):ee.texSubImage2D(ee.TEXTURE_2D,je,lt,Zt,qe,Ge,tn,Un,vn);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Mi),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,rn),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Ni),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Ii),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,ji),je===0&&oe.generateMipmaps&&ee.generateMipmap(_t),it.unbindTexture()},this.initRenderTarget=function(N){R.get(N).__webglFramebuffer===void 0&&se.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?se.setTextureCube(N,0):N.isData3DTexture?se.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?se.setTexture2DArray(N,0):se.setTexture2D(N,0),it.unbindTexture()},this.resetState=function(){O=0,G=0,J=null,it.reset(),Le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return es}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=fn._getDrawingBufferColorSpace(e),n.unpackColorSpace=fn._getUnpackColorSpace()}}const AW=`
|
|
4659
|
+
}`;class _W{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const i=new EP(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new fs({vertexShader:vW,fragmentShader:yW,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ds(new jh(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class xW extends ec{constructor(e,n){super();const i=this;let r=null,s=1,o=null,c="local-floor",u=1,d=null,h=null,p=null,m=null,v=null,_=null;const w=typeof XRWebGLBinding<"u",y=new _W,b={},T=n.getContextAttributes();let A=null,M=null;const I=[],k=[],U=new bn;let S=null;const P=new Ur;P.viewport=new Vn;const V=new Ur;V.viewport=new Vn;const O=[P,V],G=new k6;let J=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let ye=I[ne];return ye===void 0&&(ye=new yg,I[ne]=ye),ye.getTargetRaySpace()},this.getControllerGrip=function(ne){let ye=I[ne];return ye===void 0&&(ye=new yg,I[ne]=ye),ye.getGripSpace()},this.getHand=function(ne){let ye=I[ne];return ye===void 0&&(ye=new yg,I[ne]=ye),ye.getHandSpace()};function X(ne){const ye=k.indexOf(ne.inputSource);if(ye===-1)return;const be=I[ye];be!==void 0&&(be.update(ne.inputSource,ne.frame,d||o),be.dispatchEvent({type:ne.type,data:ne.inputSource}))}function K(){r.removeEventListener("select",X),r.removeEventListener("selectstart",X),r.removeEventListener("selectend",X),r.removeEventListener("squeeze",X),r.removeEventListener("squeezestart",X),r.removeEventListener("squeezeend",X),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",Q);for(let ne=0;ne<I.length;ne++){const ye=k[ne];ye!==null&&(k[ne]=null,I[ne].disconnect(ye))}J=null,H=null,y.reset();for(const ne in b)delete b[ne];e.setRenderTarget(A),v=null,m=null,p=null,r=null,M=null,Se.stop(),i.isPresenting=!1,e.setPixelRatio(S),e.setSize(U.width,U.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){s=ne,i.isPresenting===!0&&Gt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){c=ne,i.isPresenting===!0&&Gt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||o},this.setReferenceSpace=function(ne){d=ne},this.getBaseLayer=function(){return m!==null?m:v},this.getBinding=function(){return p===null&&w&&(p=new XRWebGLBinding(r,n)),p},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(ne){if(r=ne,r!==null){if(A=e.getRenderTarget(),r.addEventListener("select",X),r.addEventListener("selectstart",X),r.addEventListener("selectend",X),r.addEventListener("squeeze",X),r.addEventListener("squeezestart",X),r.addEventListener("squeezeend",X),r.addEventListener("end",K),r.addEventListener("inputsourceschange",Q),T.xrCompatible!==!0&&await n.makeXRCompatible(),S=e.getPixelRatio(),e.getSize(U),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let be=null,Ne=null,et=null;T.depth&&(et=T.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,be=T.stencil?go:Gs,Ne=T.stencil?bu:us);const xt={colorFormat:n.RGBA8,depthFormat:et,scaleFactor:s};p=this.getBinding(),m=p.createProjectionLayer(xt),r.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),M=new rs(m.textureWidth,m.textureHeight,{format:Fr,type:fr,depthTexture:new Su(m.textureWidth,m.textureHeight,Ne,void 0,void 0,void 0,void 0,void 0,void 0,be),stencilBuffer:T.stencil,colorSpace:e.outputColorSpace,samples:T.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const be={antialias:T.antialias,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(r,n,be),r.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),M=new rs(v.framebufferWidth,v.framebufferHeight,{format:Fr,type:fr,colorSpace:e.outputColorSpace,stencilBuffer:T.stencil,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(u),d=null,o=await r.requestReferenceSpace(c),Se.setContext(r),Se.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function Q(ne){for(let ye=0;ye<ne.removed.length;ye++){const be=ne.removed[ye],Ne=k.indexOf(be);Ne>=0&&(k[Ne]=null,I[Ne].disconnect(be))}for(let ye=0;ye<ne.added.length;ye++){const be=ne.added[ye];let Ne=k.indexOf(be);if(Ne===-1){for(let xt=0;xt<I.length;xt++)if(xt>=k.length){k.push(be),Ne=xt;break}else if(k[xt]===null){k[xt]=be,Ne=xt;break}if(Ne===-1)break}const et=I[Ne];et&&et.connect(be)}}const W=new me,q=new me;function Z(ne,ye,be){W.setFromMatrixPosition(ye.matrixWorld),q.setFromMatrixPosition(be.matrixWorld);const Ne=W.distanceTo(q),et=ye.projectionMatrix.elements,xt=be.projectionMatrix.elements,pn=et[14]/(et[10]-1),ht=et[14]/(et[10]+1),Ft=(et[9]+1)/et[5],nn=(et[9]-1)/et[5],Dt=(et[8]-1)/et[0],an=(xt[8]+1)/xt[0],ee=pn*Dt,Sn=pn*an,At=Ne/(-Dt+an),Lt=At*-Dt;if(ye.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Lt),ne.translateZ(At),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),et[10]===-1)ne.projectionMatrix.copy(ye.projectionMatrix),ne.projectionMatrixInverse.copy(ye.projectionMatrixInverse);else{const it=pn+At,B=ht+At,R=ee-Lt,se=Sn+(Ne-Lt),xe=Ft*ht/B*it,Ee=nn*ht/B*it;ne.projectionMatrix.makePerspective(R,se,xe,Ee,it,B),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function z(ne,ye){ye===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ye.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(r===null)return;let ye=ne.near,be=ne.far;y.texture!==null&&(y.depthNear>0&&(ye=y.depthNear),y.depthFar>0&&(be=y.depthFar)),G.near=V.near=P.near=ye,G.far=V.far=P.far=be,(J!==G.near||H!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),J=G.near,H=G.far),G.layers.mask=ne.layers.mask|6,P.layers.mask=G.layers.mask&-5,V.layers.mask=G.layers.mask&-3;const Ne=ne.parent,et=G.cameras;z(G,Ne);for(let xt=0;xt<et.length;xt++)z(et[xt],Ne);et.length===2?Z(G,P,V):G.projectionMatrix.copy(P.projectionMatrix),ie(ne,G,Ne)};function ie(ne,ye,be){be===null?ne.matrix.copy(ye.matrixWorld):(ne.matrix.copy(be.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ye.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ye.projectionMatrix),ne.projectionMatrixInverse.copy(ye.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=Lv*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(m===null&&v===null))return u},this.setFoveation=function(ne){u=ne,m!==null&&(m.fixedFoveation=ne),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=ne)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(G)},this.getCameraTexture=function(ne){return b[ne]};let we=null;function He(ne,ye){if(h=ye.getViewerPose(d||o),_=ye,h!==null){const be=h.views;v!==null&&(e.setRenderTargetFramebuffer(M,v.framebuffer),e.setRenderTarget(M));let Ne=!1;be.length!==G.cameras.length&&(G.cameras.length=0,Ne=!0);for(let ht=0;ht<be.length;ht++){const Ft=be[ht];let nn=null;if(v!==null)nn=v.getViewport(Ft);else{const an=p.getViewSubImage(m,Ft);nn=an.viewport,ht===0&&(e.setRenderTargetTextures(M,an.colorTexture,an.depthStencilTexture),e.setRenderTarget(M))}let Dt=O[ht];Dt===void 0&&(Dt=new Ur,Dt.layers.enable(ht),Dt.viewport=new Vn,O[ht]=Dt),Dt.matrix.fromArray(Ft.transform.matrix),Dt.matrix.decompose(Dt.position,Dt.quaternion,Dt.scale),Dt.projectionMatrix.fromArray(Ft.projectionMatrix),Dt.projectionMatrixInverse.copy(Dt.projectionMatrix).invert(),Dt.viewport.set(nn.x,nn.y,nn.width,nn.height),ht===0&&(G.matrix.copy(Dt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Ne===!0&&G.cameras.push(Dt)}const et=r.enabledFeatures;if(et&&et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){p=i.getBinding();const ht=p.getDepthInformation(be[0]);ht&&ht.isValid&&ht.texture&&y.init(ht,r.renderState)}if(et&&et.includes("camera-access")&&w){e.state.unbindTexture(),p=i.getBinding();for(let ht=0;ht<be.length;ht++){const Ft=be[ht].camera;if(Ft){let nn=b[Ft];nn||(nn=new EP,b[Ft]=nn);const Dt=p.getCameraImage(Ft);nn.sourceTexture=Dt}}}}for(let be=0;be<I.length;be++){const Ne=k[be],et=I[be];Ne!==null&&et!==void 0&&et.update(Ne,ye,d||o)}we&&we(ne,ye),ye.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ye}),_=null}const Se=new CP;Se.setAnimationLoop(He),this.setAnimationLoop=function(ne){we=ne},this.dispose=function(){}}}const so=new Co,bW=new Kn;function SW(t,e){function n(y,b){y.matrixAutoUpdate===!0&&y.updateMatrix(),b.value.copy(y.matrix)}function i(y,b){b.color.getRGB(y.fogColor.value,MP(t)),b.isFog?(y.fogNear.value=b.near,y.fogFar.value=b.far):b.isFogExp2&&(y.fogDensity.value=b.density)}function r(y,b,T,A,M){b.isMeshBasicMaterial?s(y,b):b.isMeshLambertMaterial?(s(y,b),b.envMap&&(y.envMapIntensity.value=b.envMapIntensity)):b.isMeshToonMaterial?(s(y,b),p(y,b)):b.isMeshPhongMaterial?(s(y,b),h(y,b),b.envMap&&(y.envMapIntensity.value=b.envMapIntensity)):b.isMeshStandardMaterial?(s(y,b),m(y,b),b.isMeshPhysicalMaterial&&v(y,b,M)):b.isMeshMatcapMaterial?(s(y,b),_(y,b)):b.isMeshDepthMaterial?s(y,b):b.isMeshDistanceMaterial?(s(y,b),w(y,b)):b.isMeshNormalMaterial?s(y,b):b.isLineBasicMaterial?(o(y,b),b.isLineDashedMaterial&&c(y,b)):b.isPointsMaterial?u(y,b,T,A):b.isSpriteMaterial?d(y,b):b.isShadowMaterial?(y.color.value.copy(b.color),y.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function s(y,b){y.opacity.value=b.opacity,b.color&&y.diffuse.value.copy(b.color),b.emissive&&y.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(y.map.value=b.map,n(b.map,y.mapTransform)),b.alphaMap&&(y.alphaMap.value=b.alphaMap,n(b.alphaMap,y.alphaMapTransform)),b.bumpMap&&(y.bumpMap.value=b.bumpMap,n(b.bumpMap,y.bumpMapTransform),y.bumpScale.value=b.bumpScale,b.side===Gi&&(y.bumpScale.value*=-1)),b.normalMap&&(y.normalMap.value=b.normalMap,n(b.normalMap,y.normalMapTransform),y.normalScale.value.copy(b.normalScale),b.side===Gi&&y.normalScale.value.negate()),b.displacementMap&&(y.displacementMap.value=b.displacementMap,n(b.displacementMap,y.displacementMapTransform),y.displacementScale.value=b.displacementScale,y.displacementBias.value=b.displacementBias),b.emissiveMap&&(y.emissiveMap.value=b.emissiveMap,n(b.emissiveMap,y.emissiveMapTransform)),b.specularMap&&(y.specularMap.value=b.specularMap,n(b.specularMap,y.specularMapTransform)),b.alphaTest>0&&(y.alphaTest.value=b.alphaTest);const T=e.get(b),A=T.envMap,M=T.envMapRotation;A&&(y.envMap.value=A,so.copy(M),so.x*=-1,so.y*=-1,so.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(so.y*=-1,so.z*=-1),y.envMapRotation.value.setFromMatrix4(bW.makeRotationFromEuler(so)),y.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=b.reflectivity,y.ior.value=b.ior,y.refractionRatio.value=b.refractionRatio),b.lightMap&&(y.lightMap.value=b.lightMap,y.lightMapIntensity.value=b.lightMapIntensity,n(b.lightMap,y.lightMapTransform)),b.aoMap&&(y.aoMap.value=b.aoMap,y.aoMapIntensity.value=b.aoMapIntensity,n(b.aoMap,y.aoMapTransform))}function o(y,b){y.diffuse.value.copy(b.color),y.opacity.value=b.opacity,b.map&&(y.map.value=b.map,n(b.map,y.mapTransform))}function c(y,b){y.dashSize.value=b.dashSize,y.totalSize.value=b.dashSize+b.gapSize,y.scale.value=b.scale}function u(y,b,T,A){y.diffuse.value.copy(b.color),y.opacity.value=b.opacity,y.size.value=b.size*T,y.scale.value=A*.5,b.map&&(y.map.value=b.map,n(b.map,y.uvTransform)),b.alphaMap&&(y.alphaMap.value=b.alphaMap,n(b.alphaMap,y.alphaMapTransform)),b.alphaTest>0&&(y.alphaTest.value=b.alphaTest)}function d(y,b){y.diffuse.value.copy(b.color),y.opacity.value=b.opacity,y.rotation.value=b.rotation,b.map&&(y.map.value=b.map,n(b.map,y.mapTransform)),b.alphaMap&&(y.alphaMap.value=b.alphaMap,n(b.alphaMap,y.alphaMapTransform)),b.alphaTest>0&&(y.alphaTest.value=b.alphaTest)}function h(y,b){y.specular.value.copy(b.specular),y.shininess.value=Math.max(b.shininess,1e-4)}function p(y,b){b.gradientMap&&(y.gradientMap.value=b.gradientMap)}function m(y,b){y.metalness.value=b.metalness,b.metalnessMap&&(y.metalnessMap.value=b.metalnessMap,n(b.metalnessMap,y.metalnessMapTransform)),y.roughness.value=b.roughness,b.roughnessMap&&(y.roughnessMap.value=b.roughnessMap,n(b.roughnessMap,y.roughnessMapTransform)),b.envMap&&(y.envMapIntensity.value=b.envMapIntensity)}function v(y,b,T){y.ior.value=b.ior,b.sheen>0&&(y.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),y.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(y.sheenColorMap.value=b.sheenColorMap,n(b.sheenColorMap,y.sheenColorMapTransform)),b.sheenRoughnessMap&&(y.sheenRoughnessMap.value=b.sheenRoughnessMap,n(b.sheenRoughnessMap,y.sheenRoughnessMapTransform))),b.clearcoat>0&&(y.clearcoat.value=b.clearcoat,y.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(y.clearcoatMap.value=b.clearcoatMap,n(b.clearcoatMap,y.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,n(b.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(y.clearcoatNormalMap.value=b.clearcoatNormalMap,n(b.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===Gi&&y.clearcoatNormalScale.value.negate())),b.dispersion>0&&(y.dispersion.value=b.dispersion),b.iridescence>0&&(y.iridescence.value=b.iridescence,y.iridescenceIOR.value=b.iridescenceIOR,y.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(y.iridescenceMap.value=b.iridescenceMap,n(b.iridescenceMap,y.iridescenceMapTransform)),b.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=b.iridescenceThicknessMap,n(b.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),b.transmission>0&&(y.transmission.value=b.transmission,y.transmissionSamplerMap.value=T.texture,y.transmissionSamplerSize.value.set(T.width,T.height),b.transmissionMap&&(y.transmissionMap.value=b.transmissionMap,n(b.transmissionMap,y.transmissionMapTransform)),y.thickness.value=b.thickness,b.thicknessMap&&(y.thicknessMap.value=b.thicknessMap,n(b.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=b.attenuationDistance,y.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(y.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(y.anisotropyMap.value=b.anisotropyMap,n(b.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=b.specularIntensity,y.specularColor.value.copy(b.specularColor),b.specularColorMap&&(y.specularColorMap.value=b.specularColorMap,n(b.specularColorMap,y.specularColorMapTransform)),b.specularIntensityMap&&(y.specularIntensityMap.value=b.specularIntensityMap,n(b.specularIntensityMap,y.specularIntensityMapTransform))}function _(y,b){b.matcap&&(y.matcap.value=b.matcap)}function w(y,b){const T=e.get(b).light;y.referencePosition.value.setFromMatrixPosition(T.matrixWorld),y.nearDistance.value=T.shadow.camera.near,y.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function wW(t,e,n,i){let r={},s={},o=[];const c=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function u(T,A){const M=A.program;i.uniformBlockBinding(T,M)}function d(T,A){let M=r[T.id];M===void 0&&(_(T),M=h(T),r[T.id]=M,T.addEventListener("dispose",y));const I=A.program;i.updateUBOMapping(T,I);const k=e.render.frame;s[T.id]!==k&&(m(T),s[T.id]=k)}function h(T){const A=p();T.__bindingPointIndex=A;const M=t.createBuffer(),I=T.__size,k=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,M),t.bufferData(t.UNIFORM_BUFFER,I,k),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,A,M),M}function p(){for(let T=0;T<c;T++)if(o.indexOf(T)===-1)return o.push(T),T;return _n("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(T){const A=r[T.id],M=T.uniforms,I=T.__cache;t.bindBuffer(t.UNIFORM_BUFFER,A);for(let k=0,U=M.length;k<U;k++){const S=Array.isArray(M[k])?M[k]:[M[k]];for(let P=0,V=S.length;P<V;P++){const O=S[P];if(v(O,k,P,I)===!0){const G=O.__offset,J=Array.isArray(O.value)?O.value:[O.value];let H=0;for(let X=0;X<J.length;X++){const K=J[X],Q=w(K);typeof K=="number"||typeof K=="boolean"?(O.__data[0]=K,t.bufferSubData(t.UNIFORM_BUFFER,G+H,O.__data)):K.isMatrix3?(O.__data[0]=K.elements[0],O.__data[1]=K.elements[1],O.__data[2]=K.elements[2],O.__data[3]=0,O.__data[4]=K.elements[3],O.__data[5]=K.elements[4],O.__data[6]=K.elements[5],O.__data[7]=0,O.__data[8]=K.elements[6],O.__data[9]=K.elements[7],O.__data[10]=K.elements[8],O.__data[11]=0):(K.toArray(O.__data,H),H+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,G,O.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function v(T,A,M,I){const k=T.value,U=A+"_"+M;if(I[U]===void 0)return typeof k=="number"||typeof k=="boolean"?I[U]=k:I[U]=k.clone(),!0;{const S=I[U];if(typeof k=="number"||typeof k=="boolean"){if(S!==k)return I[U]=k,!0}else if(S.equals(k)===!1)return S.copy(k),!0}return!1}function _(T){const A=T.uniforms;let M=0;const I=16;for(let U=0,S=A.length;U<S;U++){const P=Array.isArray(A[U])?A[U]:[A[U]];for(let V=0,O=P.length;V<O;V++){const G=P[V],J=Array.isArray(G.value)?G.value:[G.value];for(let H=0,X=J.length;H<X;H++){const K=J[H],Q=w(K),W=M%I,q=W%Q.boundary,Z=W+q;M+=q,Z!==0&&I-Z<Q.storage&&(M+=I-Z),G.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=M,M+=Q.storage}}}const k=M%I;return k>0&&(M+=I-k),T.__size=M,T.__cache={},this}function w(T){const A={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(A.boundary=4,A.storage=4):T.isVector2?(A.boundary=8,A.storage=8):T.isVector3||T.isColor?(A.boundary=16,A.storage=12):T.isVector4?(A.boundary=16,A.storage=16):T.isMatrix3?(A.boundary=48,A.storage=48):T.isMatrix4?(A.boundary=64,A.storage=64):T.isTexture?Gt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Gt("WebGLRenderer: Unsupported uniform value type.",T),A}function y(T){const A=T.target;A.removeEventListener("dispose",y);const M=o.indexOf(A.__bindingPointIndex);o.splice(M,1),t.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function b(){for(const T in r)t.deleteBuffer(r[T]);o=[],r={},s={}}return{bind:u,update:d,dispose:b}}const EW=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Xr=null;function MW(){return Xr===null&&(Xr=new _6(EW,16,16,$l,Hs),Xr.name="DFG_LUT",Xr.minFilter=wi,Xr.magFilter=wi,Xr.wrapS=Is,Xr.wrapT=Is,Xr.generateMipmaps=!1,Xr.needsUpdate=!0),Xr}class TW{constructor(e={}){const{canvas:n=YH(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:d=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:m=!1,outputBufferType:v=fr}=e;this.isWebGLRenderer=!0;let _;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=i.getContextAttributes().alpha}else _=o;const w=v,y=new Set([n_,t_,e_]),b=new Set([fr,us,xu,bu,Jy,Qy]),T=new Uint32Array(4),A=new Int32Array(4);let M=null,I=null;const k=[],U=[];let S=null;this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=is,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const P=this;let V=!1;this._outputColorSpace=ur;let O=0,G=0,J=null,H=-1,X=null;const K=new Vn,Q=new Vn;let W=null;const q=new Tn(0);let Z=0,z=n.width,ie=n.height,we=1,He=null,Se=null;const ne=new Vn(0,0,z,ie),ye=new Vn(0,0,z,ie);let be=!1;const Ne=new SP;let et=!1,xt=!1;const pn=new Kn,ht=new me,Ft=new Vn,nn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Dt=!1;function an(){return J===null?we:1}let ee=i;function Sn(N,oe){return n.getContext(N,oe)}try{const N={alpha:!0,depth:r,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:d,powerPreference:h,failIfMajorPerformanceCaveat:p};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Ky}`),n.addEventListener("webglcontextlost",st,!1),n.addEventListener("webglcontextrestored",Nt,!1),n.addEventListener("webglcontextcreationerror",mn,!1),ee===null){const oe="webgl2";if(ee=Sn(oe,N),ee===null)throw Sn(oe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw _n("WebGLRenderer: "+N.message),N}let At,Lt,it,B,R,se,xe,Ee,ve,Ke,ke,pt,Pt,Pe,Oe,Ze,rt,$e,Ht,re,ze,Le,Xe;function Re(){At=new Tj(ee),At.init(),ze=new gW(ee,At),Lt=new yj(ee,At,e,ze),it=new pW(ee,At),Lt.reversedDepthBuffer&&m&&it.buffers.depth.setReversed(!0),B=new Pj(ee),R=new eW,se=new mW(ee,At,it,R,Lt,ze,B),xe=new Mj(P),Ee=new N6(ee),Le=new gj(ee,Ee),ve=new Aj(ee,Ee,B,Le),Ke=new kj(ee,ve,Ee,Le,B),$e=new Rj(ee,Lt,se),Oe=new _j(R),ke=new Q9(P,xe,At,Lt,Le,Oe),pt=new SW(P,R),Pt=new nW,Pe=new lW(At),rt=new mj(P,xe,it,Ke,_,u),Ze=new hW(P,Ke,Lt),Xe=new wW(ee,B,Lt,it),Ht=new vj(ee,At,B),re=new Cj(ee,At,B),B.programs=ke.programs,P.capabilities=Lt,P.extensions=At,P.properties=R,P.renderLists=Pt,P.shadowMap=Ze,P.state=it,P.info=B}Re(),w!==fr&&(S=new Dj(w,n.width,n.height,r,s));const _e=new xW(P,ee);this.xr=_e,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const N=At.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=At.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return we},this.setPixelRatio=function(N){N!==void 0&&(we=N,this.setSize(z,ie,!1))},this.getSize=function(N){return N.set(z,ie)},this.setSize=function(N,oe,pe=!0){if(_e.isPresenting){Gt("WebGLRenderer: Can't change size while VR device is presenting.");return}z=N,ie=oe,n.width=Math.floor(N*we),n.height=Math.floor(oe*we),pe===!0&&(n.style.width=N+"px",n.style.height=oe+"px"),S!==null&&S.setSize(n.width,n.height),this.setViewport(0,0,N,oe)},this.getDrawingBufferSize=function(N){return N.set(z*we,ie*we).floor()},this.setDrawingBufferSize=function(N,oe,pe){z=N,ie=oe,we=pe,n.width=Math.floor(N*pe),n.height=Math.floor(oe*pe),this.setViewport(0,0,N,oe)},this.setEffects=function(N){if(w===fr){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(N){for(let oe=0;oe<N.length;oe++)if(N[oe].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}S.setEffects(N||[])},this.getCurrentViewport=function(N){return N.copy(K)},this.getViewport=function(N){return N.copy(ne)},this.setViewport=function(N,oe,pe,de){N.isVector4?ne.set(N.x,N.y,N.z,N.w):ne.set(N,oe,pe,de),it.viewport(K.copy(ne).multiplyScalar(we).round())},this.getScissor=function(N){return N.copy(ye)},this.setScissor=function(N,oe,pe,de){N.isVector4?ye.set(N.x,N.y,N.z,N.w):ye.set(N,oe,pe,de),it.scissor(Q.copy(ye).multiplyScalar(we).round())},this.getScissorTest=function(){return be},this.setScissorTest=function(N){it.setScissorTest(be=N)},this.setOpaqueSort=function(N){He=N},this.setTransparentSort=function(N){Se=N},this.getClearColor=function(N){return N.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor(...arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha(...arguments)},this.clear=function(N=!0,oe=!0,pe=!0){let de=0;if(N){let ce=!1;if(J!==null){const je=J.texture.format;ce=y.has(je)}if(ce){const je=J.texture.type,qe=b.has(je),Ge=rt.getClearColor(),We=rt.getClearAlpha(),ct=Ge.r,Ve=Ge.g,Mt=Ge.b;qe?(T[0]=ct,T[1]=Ve,T[2]=Mt,T[3]=We,ee.clearBufferuiv(ee.COLOR,0,T)):(A[0]=ct,A[1]=Ve,A[2]=Mt,A[3]=We,ee.clearBufferiv(ee.COLOR,0,A))}else de|=ee.COLOR_BUFFER_BIT}oe&&(de|=ee.DEPTH_BUFFER_BIT),pe&&(de|=ee.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),de!==0&&ee.clear(de)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",st,!1),n.removeEventListener("webglcontextrestored",Nt,!1),n.removeEventListener("webglcontextcreationerror",mn,!1),rt.dispose(),Pt.dispose(),Pe.dispose(),R.dispose(),xe.dispose(),Ke.dispose(),Le.dispose(),Xe.dispose(),ke.dispose(),_e.dispose(),_e.removeEventListener("sessionstart",le),_e.removeEventListener("sessionend",he),Me.stop()};function st(N){N.preventDefault(),P1("WebGLRenderer: Context Lost."),V=!0}function Nt(){P1("WebGLRenderer: Context Restored."),V=!1;const N=B.autoReset,oe=Ze.enabled,pe=Ze.autoUpdate,de=Ze.needsUpdate,ce=Ze.type;Re(),B.autoReset=N,Ze.enabled=oe,Ze.autoUpdate=pe,Ze.needsUpdate=de,Ze.type=ce}function mn(N){_n("WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function Kt(N){const oe=N.target;oe.removeEventListener("dispose",Kt),ui(oe)}function ui(N){ri(N),R.remove(N)}function ri(N){const oe=R.get(N).programs;oe!==void 0&&(oe.forEach(function(pe){ke.releaseProgram(pe)}),N.isShaderMaterial&&ke.releaseShaderCache(N))}this.renderBufferDirect=function(N,oe,pe,de,ce,je){oe===null&&(oe=nn);const qe=ce.isMesh&&ce.matrixWorld.determinant()<0,Ge=un(N,oe,pe,de,ce);it.setMaterial(de,qe);let We=pe.index,ct=1;if(de.wireframe===!0){if(We=ve.getWireframeAttribute(pe),We===void 0)return;ct=2}const Ve=pe.drawRange,Mt=pe.attributes.position;let lt=Ve.start*ct,Zt=(Ve.start+Ve.count)*ct;je!==null&&(lt=Math.max(lt,je.start*ct),Zt=Math.min(Zt,(je.start+je.count)*ct)),We!==null?(lt=Math.max(lt,0),Zt=Math.min(Zt,We.count)):Mt!=null&&(lt=Math.max(lt,0),Zt=Math.min(Zt,Mt.count));const It=Zt-lt;if(It<0||It===1/0)return;Le.setup(ce,de,Ge,pe,We);let vn,tn=Ht;if(We!==null&&(vn=Ee.get(We),tn=re,tn.setIndex(vn)),ce.isMesh)de.wireframe===!0?(it.setLineWidth(de.wireframeLinewidth*an()),tn.setMode(ee.LINES)):tn.setMode(ee.TRIANGLES);else if(ce.isLine){let Un=de.linewidth;Un===void 0&&(Un=1),it.setLineWidth(Un*an()),ce.isLineSegments?tn.setMode(ee.LINES):ce.isLineLoop?tn.setMode(ee.LINE_LOOP):tn.setMode(ee.LINE_STRIP)}else ce.isPoints?tn.setMode(ee.POINTS):ce.isSprite&&tn.setMode(ee.TRIANGLES);if(ce.isBatchedMesh)if(ce._multiDrawInstances!==null)Mh("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),tn.renderMultiDrawInstances(ce._multiDrawStarts,ce._multiDrawCounts,ce._multiDrawCount,ce._multiDrawInstances);else if(At.get("WEBGL_multi_draw"))tn.renderMultiDraw(ce._multiDrawStarts,ce._multiDrawCounts,ce._multiDrawCount);else{const Un=ce._multiDrawStarts,_t=ce._multiDrawCounts,Mi=ce._multiDrawCount,rn=We?Ee.get(We).bytesPerElement:1,Ni=R.get(de).currentProgram.getUniforms();for(let Ii=0;Ii<Mi;Ii++)Ni.setValue(ee,"_gl_DrawID",Ii),tn.render(Un[Ii]/rn,_t[Ii])}else if(ce.isInstancedMesh)tn.renderInstances(lt,It,ce.count);else if(pe.isInstancedBufferGeometry){const Un=pe._maxInstanceCount!==void 0?pe._maxInstanceCount:1/0,_t=Math.min(pe.instanceCount,Un);tn.renderInstances(lt,It,_t)}else tn.render(lt,It)};function Xs(N,oe,pe){N.transparent===!0&&N.side===Ns&&N.forceSinglePass===!1?(N.side=Gi,N.needsUpdate=!0,Et(N,oe,pe),N.side=Ua,N.needsUpdate=!0,Et(N,oe,pe),N.side=Ns):Et(N,oe,pe)}this.compile=function(N,oe,pe=null){pe===null&&(pe=N),I=Pe.get(pe),I.init(oe),U.push(I),pe.traverseVisible(function(ce){ce.isLight&&ce.layers.test(oe.layers)&&(I.pushLight(ce),ce.castShadow&&I.pushShadow(ce))}),N!==pe&&N.traverseVisible(function(ce){ce.isLight&&ce.layers.test(oe.layers)&&(I.pushLight(ce),ce.castShadow&&I.pushShadow(ce))}),I.setupLights();const de=new Set;return N.traverse(function(ce){if(!(ce.isMesh||ce.isPoints||ce.isLine||ce.isSprite))return;const je=ce.material;if(je)if(Array.isArray(je))for(let qe=0;qe<je.length;qe++){const Ge=je[qe];Xs(Ge,pe,ce),de.add(Ge)}else Xs(je,pe,ce),de.add(je)}),I=U.pop(),de},this.compileAsync=function(N,oe,pe=null){const de=this.compile(N,oe,pe);return new Promise(ce=>{function je(){if(de.forEach(function(qe){R.get(qe).currentProgram.isReady()&&de.delete(qe)}),de.size===0){ce(N);return}setTimeout(je,10)}At.get("KHR_parallel_shader_compile")!==null?je():setTimeout(je,10)})};let Sr=null;function Y(N){Sr&&Sr(N)}function le(){Me.stop()}function he(){Me.start()}const Me=new CP;Me.setAnimationLoop(Y),typeof self<"u"&&Me.setContext(self),this.setAnimationLoop=function(N){Sr=N,_e.setAnimationLoop(N),N===null?Me.stop():Me.start()},_e.addEventListener("sessionstart",le),_e.addEventListener("sessionend",he),this.render=function(N,oe){if(oe!==void 0&&oe.isCamera!==!0){_n("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;const pe=_e.enabled===!0&&_e.isPresenting===!0,de=S!==null&&(J===null||pe)&&S.begin(P,J);if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),oe.parent===null&&oe.matrixWorldAutoUpdate===!0&&oe.updateMatrixWorld(),_e.enabled===!0&&_e.isPresenting===!0&&(S===null||S.isCompositing()===!1)&&(_e.cameraAutoUpdate===!0&&_e.updateCamera(oe),oe=_e.getCamera()),N.isScene===!0&&N.onBeforeRender(P,N,oe,J),I=Pe.get(N,U.length),I.init(oe),U.push(I),pn.multiplyMatrices(oe.projectionMatrix,oe.matrixWorldInverse),Ne.setFromProjectionMatrix(pn,es,oe.reversedDepth),xt=this.localClippingEnabled,et=Oe.init(this.clippingPlanes,xt),M=Pt.get(N,k.length),M.init(),k.push(M),_e.enabled===!0&&_e.isPresenting===!0){const qe=P.xr.getDepthSensingMesh();qe!==null&&Ie(qe,oe,-1/0,P.sortObjects)}Ie(N,oe,0,P.sortObjects),M.finish(),P.sortObjects===!0&&M.sort(He,Se),Dt=_e.enabled===!1||_e.isPresenting===!1||_e.hasDepthSensing()===!1,Dt&&rt.addToRenderList(M,N),this.info.render.frame++,et===!0&&Oe.beginShadows();const ce=I.state.shadowsArray;if(Ze.render(ce,N,oe),et===!0&&Oe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(de&&S.hasRenderPass())===!1){const qe=M.opaque,Ge=M.transmissive;if(I.setupLights(),oe.isArrayCamera){const We=oe.cameras;if(Ge.length>0)for(let ct=0,Ve=We.length;ct<Ve;ct++){const Mt=We[ct];tt(qe,Ge,N,Mt)}Dt&&rt.render(N);for(let ct=0,Ve=We.length;ct<Ve;ct++){const Mt=We[ct];vt(M,N,Mt,Mt.viewport)}}else Ge.length>0&&tt(qe,Ge,N,oe),Dt&&rt.render(N),vt(M,N,oe)}J!==null&&G===0&&(se.updateMultisampleRenderTarget(J),se.updateRenderTargetMipmap(J)),de&&S.end(P),N.isScene===!0&&N.onAfterRender(P,N,oe),Le.resetDefaultState(),H=-1,X=null,U.pop(),U.length>0?(I=U[U.length-1],et===!0&&Oe.setGlobalState(P.clippingPlanes,I.state.camera)):I=null,k.pop(),k.length>0?M=k[k.length-1]:M=null};function Ie(N,oe,pe,de){if(N.visible===!1)return;if(N.layers.test(oe.layers)){if(N.isGroup)pe=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(oe);else if(N.isLight)I.pushLight(N),N.castShadow&&I.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||Ne.intersectsSprite(N)){de&&Ft.setFromMatrixPosition(N.matrixWorld).applyMatrix4(pn);const qe=Ke.update(N),Ge=N.material;Ge.visible&&M.push(N,qe,Ge,pe,Ft.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||Ne.intersectsObject(N))){const qe=Ke.update(N),Ge=N.material;if(de&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Ft.copy(N.boundingSphere.center)):(qe.boundingSphere===null&&qe.computeBoundingSphere(),Ft.copy(qe.boundingSphere.center)),Ft.applyMatrix4(N.matrixWorld).applyMatrix4(pn)),Array.isArray(Ge)){const We=qe.groups;for(let ct=0,Ve=We.length;ct<Ve;ct++){const Mt=We[ct],lt=Ge[Mt.materialIndex];lt&<.visible&&M.push(N,qe,lt,pe,Ft.z,Mt)}}else Ge.visible&&M.push(N,qe,Ge,pe,Ft.z,null)}}const je=N.children;for(let qe=0,Ge=je.length;qe<Ge;qe++)Ie(je[qe],oe,pe,de)}function vt(N,oe,pe,de){const{opaque:ce,transmissive:je,transparent:qe}=N;I.setupLightsView(pe),et===!0&&Oe.setGlobalState(P.clippingPlanes,pe),de&&it.viewport(K.copy(de)),ce.length>0&&yt(ce,oe,pe),je.length>0&&yt(je,oe,pe),qe.length>0&&yt(qe,oe,pe),it.buffers.depth.setTest(!0),it.buffers.depth.setMask(!0),it.buffers.color.setMask(!0),it.setPolygonOffset(!1)}function tt(N,oe,pe,de){if((pe.isScene===!0?pe.overrideMaterial:null)!==null)return;if(I.state.transmissionRenderTarget[de.id]===void 0){const lt=At.has("EXT_color_buffer_half_float")||At.has("EXT_color_buffer_float");I.state.transmissionRenderTarget[de.id]=new rs(1,1,{generateMipmaps:!0,type:lt?Hs:fr,minFilter:mo,samples:Math.max(4,Lt.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:fn.workingColorSpace})}const je=I.state.transmissionRenderTarget[de.id],qe=de.viewport||K;je.setSize(qe.z*P.transmissionResolutionScale,qe.w*P.transmissionResolutionScale);const Ge=P.getRenderTarget(),We=P.getActiveCubeFace(),ct=P.getActiveMipmapLevel();P.setRenderTarget(je),P.getClearColor(q),Z=P.getClearAlpha(),Z<1&&P.setClearColor(16777215,.5),P.clear(),Dt&&rt.render(pe);const Ve=P.toneMapping;P.toneMapping=is;const Mt=de.viewport;if(de.viewport!==void 0&&(de.viewport=void 0),I.setupLightsView(de),et===!0&&Oe.setGlobalState(P.clippingPlanes,de),yt(N,pe,de),se.updateMultisampleRenderTarget(je),se.updateRenderTargetMipmap(je),At.has("WEBGL_multisampled_render_to_texture")===!1){let lt=!1;for(let Zt=0,It=oe.length;Zt<It;Zt++){const vn=oe[Zt],{object:tn,geometry:Un,material:_t,group:Mi}=vn;if(_t.side===Ns&&tn.layers.test(de.layers)){const rn=_t.side;_t.side=Gi,_t.needsUpdate=!0,Qe(tn,pe,de,Un,_t,Mi),_t.side=rn,_t.needsUpdate=!0,lt=!0}}lt===!0&&(se.updateMultisampleRenderTarget(je),se.updateRenderTargetMipmap(je))}P.setRenderTarget(Ge,We,ct),P.setClearColor(q,Z),Mt!==void 0&&(de.viewport=Mt),P.toneMapping=Ve}function yt(N,oe,pe){const de=oe.isScene===!0?oe.overrideMaterial:null;for(let ce=0,je=N.length;ce<je;ce++){const qe=N[ce],{object:Ge,geometry:We,group:ct}=qe;let Ve=qe.material;Ve.allowOverride===!0&&de!==null&&(Ve=de),Ge.layers.test(pe.layers)&&Qe(Ge,oe,pe,We,Ve,ct)}}function Qe(N,oe,pe,de,ce,je){N.onBeforeRender(P,oe,pe,de,ce,je),N.modelViewMatrix.multiplyMatrices(pe.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),ce.onBeforeRender(P,oe,pe,de,N,je),ce.transparent===!0&&ce.side===Ns&&ce.forceSinglePass===!1?(ce.side=Gi,ce.needsUpdate=!0,P.renderBufferDirect(pe,oe,de,ce,N,je),ce.side=Ua,ce.needsUpdate=!0,P.renderBufferDirect(pe,oe,de,ce,N,je),ce.side=Ns):P.renderBufferDirect(pe,oe,de,ce,N,je),N.onAfterRender(P,oe,pe,de,ce,je)}function Et(N,oe,pe){oe.isScene!==!0&&(oe=nn);const de=R.get(N),ce=I.state.lights,je=I.state.shadowsArray,qe=ce.state.version,Ge=ke.getParameters(N,ce.state,je,oe,pe),We=ke.getProgramCacheKey(Ge);let ct=de.programs;de.environment=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?oe.environment:null,de.fog=oe.fog;const Ve=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap;de.envMap=xe.get(N.envMap||de.environment,Ve),de.envMapRotation=de.environment!==null&&N.envMap===null?oe.environmentRotation:N.envMapRotation,ct===void 0&&(N.addEventListener("dispose",Kt),ct=new Map,de.programs=ct);let Mt=ct.get(We);if(Mt!==void 0){if(de.currentProgram===Mt&&de.lightsStateVersion===qe)return bt(N,Ge),Mt}else Ge.uniforms=ke.getUniforms(N),N.onBeforeCompile(Ge,P),Mt=ke.acquireProgram(Ge,We),ct.set(We,Mt),de.uniforms=Ge.uniforms;const lt=de.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(lt.clippingPlanes=Oe.uniform),bt(N,Ge),de.needsLights=En(N),de.lightsStateVersion=qe,de.needsLights&&(lt.ambientLightColor.value=ce.state.ambient,lt.lightProbe.value=ce.state.probe,lt.directionalLights.value=ce.state.directional,lt.directionalLightShadows.value=ce.state.directionalShadow,lt.spotLights.value=ce.state.spot,lt.spotLightShadows.value=ce.state.spotShadow,lt.rectAreaLights.value=ce.state.rectArea,lt.ltc_1.value=ce.state.rectAreaLTC1,lt.ltc_2.value=ce.state.rectAreaLTC2,lt.pointLights.value=ce.state.point,lt.pointLightShadows.value=ce.state.pointShadow,lt.hemisphereLights.value=ce.state.hemi,lt.directionalShadowMatrix.value=ce.state.directionalShadowMatrix,lt.spotLightMatrix.value=ce.state.spotLightMatrix,lt.spotLightMap.value=ce.state.spotLightMap,lt.pointShadowMatrix.value=ce.state.pointShadowMatrix),de.currentProgram=Mt,de.uniformsList=null,Mt}function Tt(N){if(N.uniformsList===null){const oe=N.currentProgram.getUniforms();N.uniformsList=Yf.seqWithValue(oe.seq,N.uniforms)}return N.uniformsList}function bt(N,oe){const pe=R.get(N);pe.outputColorSpace=oe.outputColorSpace,pe.batching=oe.batching,pe.batchingColor=oe.batchingColor,pe.instancing=oe.instancing,pe.instancingColor=oe.instancingColor,pe.instancingMorph=oe.instancingMorph,pe.skinning=oe.skinning,pe.morphTargets=oe.morphTargets,pe.morphNormals=oe.morphNormals,pe.morphColors=oe.morphColors,pe.morphTargetsCount=oe.morphTargetsCount,pe.numClippingPlanes=oe.numClippingPlanes,pe.numIntersection=oe.numClipIntersection,pe.vertexAlphas=oe.vertexAlphas,pe.vertexTangents=oe.vertexTangents,pe.toneMapping=oe.toneMapping}function un(N,oe,pe,de,ce){oe.isScene!==!0&&(oe=nn),se.resetTextureUnits();const je=oe.fog,qe=de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial?oe.environment:null,Ge=J===null?P.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:Ao,We=de.isMeshStandardMaterial||de.isMeshLambertMaterial&&!de.envMap||de.isMeshPhongMaterial&&!de.envMap,ct=xe.get(de.envMap||qe,We),Ve=de.vertexColors===!0&&!!pe.attributes.color&&pe.attributes.color.itemSize===4,Mt=!!pe.attributes.tangent&&(!!de.normalMap||de.anisotropy>0),lt=!!pe.morphAttributes.position,Zt=!!pe.morphAttributes.normal,It=!!pe.morphAttributes.color;let vn=is;de.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(vn=P.toneMapping);const tn=pe.morphAttributes.position||pe.morphAttributes.normal||pe.morphAttributes.color,Un=tn!==void 0?tn.length:0,_t=R.get(de),Mi=I.state.lights;if(et===!0&&(xt===!0||N!==X)){const Hn=N===X&&de.id===H;Oe.setState(de,N,Hn)}let rn=!1;de.version===_t.__version?(_t.needsLights&&_t.lightsStateVersion!==Mi.state.version||_t.outputColorSpace!==Ge||ce.isBatchedMesh&&_t.batching===!1||!ce.isBatchedMesh&&_t.batching===!0||ce.isBatchedMesh&&_t.batchingColor===!0&&ce.colorTexture===null||ce.isBatchedMesh&&_t.batchingColor===!1&&ce.colorTexture!==null||ce.isInstancedMesh&&_t.instancing===!1||!ce.isInstancedMesh&&_t.instancing===!0||ce.isSkinnedMesh&&_t.skinning===!1||!ce.isSkinnedMesh&&_t.skinning===!0||ce.isInstancedMesh&&_t.instancingColor===!0&&ce.instanceColor===null||ce.isInstancedMesh&&_t.instancingColor===!1&&ce.instanceColor!==null||ce.isInstancedMesh&&_t.instancingMorph===!0&&ce.morphTexture===null||ce.isInstancedMesh&&_t.instancingMorph===!1&&ce.morphTexture!==null||_t.envMap!==ct||de.fog===!0&&_t.fog!==je||_t.numClippingPlanes!==void 0&&(_t.numClippingPlanes!==Oe.numPlanes||_t.numIntersection!==Oe.numIntersection)||_t.vertexAlphas!==Ve||_t.vertexTangents!==Mt||_t.morphTargets!==lt||_t.morphNormals!==Zt||_t.morphColors!==It||_t.toneMapping!==vn||_t.morphTargetsCount!==Un)&&(rn=!0):(rn=!0,_t.__version=de.version);let Ni=_t.currentProgram;rn===!0&&(Ni=Et(de,oe,ce));let Ii=!1,ji=!1,qs=!1;const xn=Ni.getUniforms(),Ot=_t.uniforms;if(it.useProgram(Ni.program)&&(Ii=!0,ji=!0,qs=!0),de.id!==H&&(H=de.id,ji=!0),Ii||X!==N){it.buffers.depth.getReversed()&&N.reversedDepth!==!0&&(N._reversedDepth=!0,N.updateProjectionMatrix()),xn.setValue(ee,"projectionMatrix",N.projectionMatrix),xn.setValue(ee,"viewMatrix",N.matrixWorldInverse);const tr=xn.map.cameraPosition;tr!==void 0&&tr.setValue(ee,ht.setFromMatrixPosition(N.matrixWorld)),Lt.logarithmicDepthBuffer&&xn.setValue(ee,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial)&&xn.setValue(ee,"isOrthographic",N.isOrthographicCamera===!0),X!==N&&(X=N,ji=!0,qs=!0)}if(_t.needsLights&&(Mi.state.directionalShadowMap.length>0&&xn.setValue(ee,"directionalShadowMap",Mi.state.directionalShadowMap,se),Mi.state.spotShadowMap.length>0&&xn.setValue(ee,"spotShadowMap",Mi.state.spotShadowMap,se),Mi.state.pointShadowMap.length>0&&xn.setValue(ee,"pointShadowMap",Mi.state.pointShadowMap,se)),ce.isSkinnedMesh){xn.setOptional(ee,ce,"bindMatrix"),xn.setOptional(ee,ce,"bindMatrixInverse");const Hn=ce.skeleton;Hn&&(Hn.boneTexture===null&&Hn.computeBoneTexture(),xn.setValue(ee,"boneTexture",Hn.boneTexture,se))}ce.isBatchedMesh&&(xn.setOptional(ee,ce,"batchingTexture"),xn.setValue(ee,"batchingTexture",ce._matricesTexture,se),xn.setOptional(ee,ce,"batchingIdTexture"),xn.setValue(ee,"batchingIdTexture",ce._indirectTexture,se),xn.setOptional(ee,ce,"batchingColorTexture"),ce._colorsTexture!==null&&xn.setValue(ee,"batchingColorTexture",ce._colorsTexture,se));const wr=pe.morphAttributes;if((wr.position!==void 0||wr.normal!==void 0||wr.color!==void 0)&&$e.update(ce,pe,Ni),(ji||_t.receiveShadow!==ce.receiveShadow)&&(_t.receiveShadow=ce.receiveShadow,xn.setValue(ee,"receiveShadow",ce.receiveShadow)),(de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial)&&de.envMap===null&&oe.environment!==null&&(Ot.envMapIntensity.value=oe.environmentIntensity),Ot.dfgLUT!==void 0&&(Ot.dfgLUT.value=MW()),ji&&(xn.setValue(ee,"toneMappingExposure",P.toneMappingExposure),_t.needsLights&&en(Ot,qs),je&&de.fog===!0&&pt.refreshFogUniforms(Ot,je),pt.refreshMaterialUniforms(Ot,de,we,ie,I.state.transmissionRenderTarget[N.id]),Yf.upload(ee,Tt(_t),Ot,se)),de.isShaderMaterial&&de.uniformsNeedUpdate===!0&&(Yf.upload(ee,Tt(_t),Ot,se),de.uniformsNeedUpdate=!1),de.isSpriteMaterial&&xn.setValue(ee,"center",ce.center),xn.setValue(ee,"modelViewMatrix",ce.modelViewMatrix),xn.setValue(ee,"normalMatrix",ce.normalMatrix),xn.setValue(ee,"modelMatrix",ce.matrixWorld),de.isShaderMaterial||de.isRawShaderMaterial){const Hn=de.uniformsGroups;for(let tr=0,vs=Hn.length;tr<vs;tr++){const ic=Hn[tr];Xe.update(ic,Ni),Xe.bind(ic,Ni)}}return Ni}function en(N,oe){N.ambientLightColor.needsUpdate=oe,N.lightProbe.needsUpdate=oe,N.directionalLights.needsUpdate=oe,N.directionalLightShadows.needsUpdate=oe,N.pointLights.needsUpdate=oe,N.pointLightShadows.needsUpdate=oe,N.spotLights.needsUpdate=oe,N.spotLightShadows.needsUpdate=oe,N.rectAreaLights.needsUpdate=oe,N.hemisphereLights.needsUpdate=oe}function En(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return J},this.setRenderTargetTextures=function(N,oe,pe){const de=R.get(N);de.__autoAllocateDepthBuffer=N.resolveDepthBuffer===!1,de.__autoAllocateDepthBuffer===!1&&(de.__useRenderToTexture=!1),R.get(N.texture).__webglTexture=oe,R.get(N.depthTexture).__webglTexture=de.__autoAllocateDepthBuffer?void 0:pe,de.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(N,oe){const pe=R.get(N);pe.__webglFramebuffer=oe,pe.__useDefaultFramebuffer=oe===void 0};const In=ee.createFramebuffer();this.setRenderTarget=function(N,oe=0,pe=0){J=N,O=oe,G=pe;let de=null,ce=!1,je=!1;if(N){const Ge=R.get(N);if(Ge.__useDefaultFramebuffer!==void 0){it.bindFramebuffer(ee.FRAMEBUFFER,Ge.__webglFramebuffer),K.copy(N.viewport),Q.copy(N.scissor),W=N.scissorTest,it.viewport(K),it.scissor(Q),it.setScissorTest(W),H=-1;return}else if(Ge.__webglFramebuffer===void 0)se.setupRenderTarget(N);else if(Ge.__hasExternalTextures)se.rebindTextures(N,R.get(N.texture).__webglTexture,R.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const Ve=N.depthTexture;if(Ge.__boundDepthTexture!==Ve){if(Ve!==null&&R.has(Ve)&&(N.width!==Ve.image.width||N.height!==Ve.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");se.setupDepthRenderbuffer(N)}}const We=N.texture;(We.isData3DTexture||We.isDataArrayTexture||We.isCompressedArrayTexture)&&(je=!0);const ct=R.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(ct[oe])?de=ct[oe][pe]:de=ct[oe],ce=!0):N.samples>0&&se.useMultisampledRTT(N)===!1?de=R.get(N).__webglMultisampledFramebuffer:Array.isArray(ct)?de=ct[pe]:de=ct,K.copy(N.viewport),Q.copy(N.scissor),W=N.scissorTest}else K.copy(ne).multiplyScalar(we).floor(),Q.copy(ye).multiplyScalar(we).floor(),W=be;if(pe!==0&&(de=In),it.bindFramebuffer(ee.FRAMEBUFFER,de)&&it.drawBuffers(N,de),it.viewport(K),it.scissor(Q),it.setScissorTest(W),ce){const Ge=R.get(N.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+oe,Ge.__webglTexture,pe)}else if(je){const Ge=oe;for(let We=0;We<N.textures.length;We++){const ct=R.get(N.textures[We]);ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0+We,ct.__webglTexture,pe,Ge)}}else if(N!==null&&pe!==0){const Ge=R.get(N.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Ge.__webglTexture,pe)}H=-1},this.readRenderTargetPixels=function(N,oe,pe,de,ce,je,qe,Ge=0){if(!(N&&N.isWebGLRenderTarget)){_n("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let We=R.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&qe!==void 0&&(We=We[qe]),We){it.bindFramebuffer(ee.FRAMEBUFFER,We);try{const ct=N.textures[Ge],Ve=ct.format,Mt=ct.type;if(N.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+Ge),!Lt.textureFormatReadable(Ve)){_n("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Lt.textureTypeReadable(Mt)){_n("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}oe>=0&&oe<=N.width-de&&pe>=0&&pe<=N.height-ce&&ee.readPixels(oe,pe,de,ce,ze.convert(Ve),ze.convert(Mt),je)}finally{const ct=J!==null?R.get(J).__webglFramebuffer:null;it.bindFramebuffer(ee.FRAMEBUFFER,ct)}}},this.readRenderTargetPixelsAsync=async function(N,oe,pe,de,ce,je,qe,Ge=0){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let We=R.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&qe!==void 0&&(We=We[qe]),We)if(oe>=0&&oe<=N.width-de&&pe>=0&&pe<=N.height-ce){it.bindFramebuffer(ee.FRAMEBUFFER,We);const ct=N.textures[Ge],Ve=ct.format,Mt=ct.type;if(N.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+Ge),!Lt.textureFormatReadable(Ve))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Lt.textureTypeReadable(Mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const lt=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,lt),ee.bufferData(ee.PIXEL_PACK_BUFFER,je.byteLength,ee.STREAM_READ),ee.readPixels(oe,pe,de,ce,ze.convert(Ve),ze.convert(Mt),0);const Zt=J!==null?R.get(J).__webglFramebuffer:null;it.bindFramebuffer(ee.FRAMEBUFFER,Zt);const It=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await KH(ee,It,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,lt),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,je),ee.deleteBuffer(lt),ee.deleteSync(It),je}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(N,oe=null,pe=0){const de=Math.pow(2,-pe),ce=Math.floor(N.image.width*de),je=Math.floor(N.image.height*de),qe=oe!==null?oe.x:0,Ge=oe!==null?oe.y:0;se.setTexture2D(N,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,pe,0,0,qe,Ge,ce,je),it.unbindTexture()};const Zn=ee.createFramebuffer(),gn=ee.createFramebuffer();this.copyTextureToTexture=function(N,oe,pe=null,de=null,ce=0,je=0){let qe,Ge,We,ct,Ve,Mt,lt,Zt,It;const vn=N.isCompressedTexture?N.mipmaps[je]:N.image;if(pe!==null)qe=pe.max.x-pe.min.x,Ge=pe.max.y-pe.min.y,We=pe.isBox3?pe.max.z-pe.min.z:1,ct=pe.min.x,Ve=pe.min.y,Mt=pe.isBox3?pe.min.z:0;else{const Ot=Math.pow(2,-ce);qe=Math.floor(vn.width*Ot),Ge=Math.floor(vn.height*Ot),N.isDataArrayTexture?We=vn.depth:N.isData3DTexture?We=Math.floor(vn.depth*Ot):We=1,ct=0,Ve=0,Mt=0}de!==null?(lt=de.x,Zt=de.y,It=de.z):(lt=0,Zt=0,It=0);const tn=ze.convert(oe.format),Un=ze.convert(oe.type);let _t;oe.isData3DTexture?(se.setTexture3D(oe,0),_t=ee.TEXTURE_3D):oe.isDataArrayTexture||oe.isCompressedArrayTexture?(se.setTexture2DArray(oe,0),_t=ee.TEXTURE_2D_ARRAY):(se.setTexture2D(oe,0),_t=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,oe.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,oe.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,oe.unpackAlignment);const Mi=ee.getParameter(ee.UNPACK_ROW_LENGTH),rn=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),Ni=ee.getParameter(ee.UNPACK_SKIP_PIXELS),Ii=ee.getParameter(ee.UNPACK_SKIP_ROWS),ji=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,vn.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,vn.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,ct),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Ve),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Mt);const qs=N.isDataArrayTexture||N.isData3DTexture,xn=oe.isDataArrayTexture||oe.isData3DTexture;if(N.isDepthTexture){const Ot=R.get(N),wr=R.get(oe),Hn=R.get(Ot.__renderTarget),tr=R.get(wr.__renderTarget);it.bindFramebuffer(ee.READ_FRAMEBUFFER,Hn.__webglFramebuffer),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,tr.__webglFramebuffer);for(let vs=0;vs<We;vs++)qs&&(ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,R.get(N).__webglTexture,ce,Mt+vs),ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,R.get(oe).__webglTexture,je,It+vs)),ee.blitFramebuffer(ct,Ve,qe,Ge,lt,Zt,qe,Ge,ee.DEPTH_BUFFER_BIT,ee.NEAREST);it.bindFramebuffer(ee.READ_FRAMEBUFFER,null),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else if(ce!==0||N.isRenderTargetTexture||R.has(N)){const Ot=R.get(N),wr=R.get(oe);it.bindFramebuffer(ee.READ_FRAMEBUFFER,Zn),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,gn);for(let Hn=0;Hn<We;Hn++)qs?ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Ot.__webglTexture,ce,Mt+Hn):ee.framebufferTexture2D(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,Ot.__webglTexture,ce),xn?ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,wr.__webglTexture,je,It+Hn):ee.framebufferTexture2D(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_2D,wr.__webglTexture,je),ce!==0?ee.blitFramebuffer(ct,Ve,qe,Ge,lt,Zt,qe,Ge,ee.COLOR_BUFFER_BIT,ee.NEAREST):xn?ee.copyTexSubImage3D(_t,je,lt,Zt,It+Hn,ct,Ve,qe,Ge):ee.copyTexSubImage2D(_t,je,lt,Zt,ct,Ve,qe,Ge);it.bindFramebuffer(ee.READ_FRAMEBUFFER,null),it.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else xn?N.isDataTexture||N.isData3DTexture?ee.texSubImage3D(_t,je,lt,Zt,It,qe,Ge,We,tn,Un,vn.data):oe.isCompressedArrayTexture?ee.compressedTexSubImage3D(_t,je,lt,Zt,It,qe,Ge,We,tn,vn.data):ee.texSubImage3D(_t,je,lt,Zt,It,qe,Ge,We,tn,Un,vn):N.isDataTexture?ee.texSubImage2D(ee.TEXTURE_2D,je,lt,Zt,qe,Ge,tn,Un,vn.data):N.isCompressedTexture?ee.compressedTexSubImage2D(ee.TEXTURE_2D,je,lt,Zt,vn.width,vn.height,tn,vn.data):ee.texSubImage2D(ee.TEXTURE_2D,je,lt,Zt,qe,Ge,tn,Un,vn);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Mi),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,rn),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Ni),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Ii),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,ji),je===0&&oe.generateMipmaps&&ee.generateMipmap(_t),it.unbindTexture()},this.initRenderTarget=function(N){R.get(N).__webglFramebuffer===void 0&&se.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?se.setTextureCube(N,0):N.isData3DTexture?se.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?se.setTexture2DArray(N,0):se.setTexture2D(N,0),it.unbindTexture()},this.resetState=function(){O=0,G=0,J=null,it.reset(),Le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return es}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=fn._getDrawingBufferColorSpace(e),n.unpackColorSpace=fn._getUnpackColorSpace()}}const AW=`
|
|
4659
4660
|
precision highp float;
|
|
4660
4661
|
attribute vec3 position;
|
|
4661
4662
|
void main(){
|
|
@@ -4858,7 +4859,7 @@ void main(){
|
|
|
4858
4859
|
// straight (non-premultiplied) alpha output
|
|
4859
4860
|
gl_FragColor=vec4(col,alpha);
|
|
4860
4861
|
}
|
|
4861
|
-
`;function gE(t){let e=t.trim().replace("#","");e.length===3&&(e=e.split("").map(i=>i+i).join(""));const n=parseInt(e,16)||16777215;return{r:(n>>16&255)/255,g:(n>>8&255)/255,b:(n&255)/255}}function PW({className:t,style:e,wispDensity:n=1,dpr:i,mouseSmoothTime:r=.06,mouseTiltStrength:s=.01,horizontalBeamOffset:o=0,verticalBeamOffset:c=-.5,flowSpeed:u=.35,verticalSizing:d=2,horizontalSizing:h=.5,fogIntensity:p=.45,fogScale:m=.3,wispSpeed:v=15,wispIntensity:_=5,flowStrength:w=.25,decay:y=1.1,falloffStart:b=1.2,fogFallSpeed:T=.6,color:A="#8a7aff"}){const M=L.useRef(null),I=L.useRef(null),k=L.useRef(!1),U=L.useRef(null),S=L.useRef(!0),P=L.useRef(!1),V=L.useRef(r);return L.useEffect(()=>{V.current=r},[r]),L.useEffect(()=>{const O=M.current;let G;try{G=new TW({antialias:!1,alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,powerPreference:"high-performance"})}catch(At){console.warn("LaserFlow: WebGL not supported or context creation failed.",At);return}let H=Math.min(i??(window.devicePixelRatio||1),2);G.setPixelRatio(H),G.outputColorSpace=Ao,G.setClearColor(0,0);const X=G.domElement;X.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block;",O.appendChild(X);const K=new f6,Q=new o_(-1,1,1,-1,0,1),W=new gs;W.setAttribute("position",new Vr(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));const q={iTime:{value:0},iResolution:{value:new me(1,1,1)},iMouse:{value:new Vn(0,0,0,0)},uWispDensity:{value:n},uTiltScale:{value:s},uFlowTime:{value:0},uFogTime:{value:0},uBeamXFrac:{value:o},uBeamYFrac:{value:c},uFlowSpeed:{value:u},uVLenFactor:{value:d},uHLenFactor:{value:h},uFogIntensity:{value:p},uFogScale:{value:m},uWSpeed:{value:v},uWIntensity:{value:_},uFlowStrength:{value:w},uDecay:{value:y},uFalloffStart:{value:b},uFogFallSpeed:{value:T},uColor:{value:new me(1,1,1)},uFade:{value:k.current?1:0}};I.current=q;const{r:Z,g:z,b:ie}=gE(A);q.uColor.value.set(Z,z,ie);const Ee=new TP({vertexShader:AW,fragmentShader:CW,uniforms:q,transparent:!0,depthTest:!1,depthWrite:!1,blending:_o}),ze=new ds(W,Ee);ze.frustumCulled=!1,K.add(ze);let Se=0,ne=0,ye=0;function be(){const At=O.clientWidth||1,Lt=O.clientHeight||1;Math.abs(At-Se)<1&&Math.abs(Lt-ne)<1&&Math.abs(H-ye)<.01||(Se=At,ne=Lt,ye=H,G.setPixelRatio(H),G.setSize(At,Lt,!1),q.iResolution.value.set(At*H,Lt*H,H),U.current=X.getBoundingClientRect())}let Ne=0;const et=new ResizeObserver(()=>{cancelAnimationFrame(Ne),Ne=requestAnimationFrame(be)});et.observe(O),be();const xt=new IntersectionObserver(At=>{S.current=At[0]?.isIntersecting??!0},{threshold:0});xt.observe(O),document.addEventListener("visibilitychange",()=>{P.current=document.hidden},{passive:!0});const pn=new bn(0,0),ht=new bn(0,0);function Ft(At){const Lt=U.current;Lt&&pn.set((At.clientX-Lt.left)*H,(Lt.height-(At.clientY-Lt.top))*H)}X.addEventListener("pointermove",Ft,{passive:!0}),X.addEventListener("pointerleave",()=>pn.set(0,0),{passive:!0});let nn=0,Dt=k.current?1:0;const an=new L6;let ee=0;function Sn(){if(ee=requestAnimationFrame(Sn),P.current||!S.current)return;const At=an.getElapsedTime(),Lt=Math.min(Math.max(At-nn,.001),.033);nn=At,q.iTime.value=At,q.uFlowTime.value+=Lt,q.uFogTime.value+=Lt,k.current||(Dt=Math.min(1,Dt+Lt/1),q.uFade.value=Dt,Dt>=1&&(k.current=!0));const it=Math.max(.001,V.current);ht.lerp(pn,1-Math.exp(-Lt/it)),q.iMouse.value.set(ht.x,ht.y,0,0),G.render(K,Q)}return Sn(),()=>{cancelAnimationFrame(ee),cancelAnimationFrame(Ne),et.disconnect(),xt.disconnect(),K.clear(),W.dispose(),Ee.dispose(),G.dispose(),G.forceContextLoss(),O.contains(X)&&O.removeChild(X)}},[i]),L.useEffect(()=>{const O=I.current;if(!O)return;O.uWispDensity.value=n,O.uTiltScale.value=s,O.uBeamXFrac.value=o,O.uBeamYFrac.value=c,O.uFlowSpeed.value=u,O.uVLenFactor.value=d,O.uHLenFactor.value=h,O.uFogIntensity.value=p,O.uFogScale.value=m,O.uWSpeed.value=v,O.uWIntensity.value=_,O.uFlowStrength.value=w,O.uDecay.value=y,O.uFalloffStart.value=b,O.uFogFallSpeed.value=T;const{r:G,g:J,b:H}=gE(A);O.uColor.value.set(G,J,H)},[n,s,o,c,u,d,h,p,m,v,_,w,y,b,T,A]),F.jsx("div",{ref:M,className:t,style:{position:"relative",overflow:"hidden",...e}})}function uu(t){let e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)}function Iv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function RW(t,e,n,i){return t[0]=e,t[1]=n,t[2]=i,t}function vE(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function yE(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function kW(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function LW(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function Vg(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function DW(t,e){let n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return Math.sqrt(n*n+i*i+r*r)}function NW(t,e){let n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return n*n+i*i+r*r}function _E(t){let e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i}function IW(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function UW(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function Uv(t,e){let n=e[0],i=e[1],r=e[2],s=n*n+i*i+r*r;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function NP(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xE(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[0],c=n[1],u=n[2];return t[0]=r*u-s*c,t[1]=s*o-i*u,t[2]=i*c-r*o,t}function FW(t,e,n,i){let r=e[0],s=e[1],o=e[2];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=o+i*(n[2]-o),t}function OW(t,e,n,i,r){const s=Math.exp(-i*r);let o=e[0],c=e[1],u=e[2];return t[0]=n[0]+(o-n[0])*s,t[1]=n[1]+(c-n[1])*s,t[2]=n[2]+(u-n[2])*s,t}function BW(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[3]*i+n[7]*r+n[11]*s+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*r+n[8]*s+n[12])/o,t[1]=(n[1]*i+n[5]*r+n[9]*s+n[13])/o,t[2]=(n[2]*i+n[6]*r+n[10]*s+n[14])/o,t}function zW(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[3]*i+n[7]*r+n[11]*s+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*r+n[8]*s)/o,t[1]=(n[1]*i+n[5]*r+n[9]*s)/o,t[2]=(n[2]*i+n[6]*r+n[10]*s)/o,t}function VW(t,e,n){let i=e[0],r=e[1],s=e[2];return t[0]=i*n[0]+r*n[3]+s*n[6],t[1]=i*n[1]+r*n[4]+s*n[7],t[2]=i*n[2]+r*n[5]+s*n[8],t}function HW(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[0],c=n[1],u=n[2],d=n[3],h=c*s-u*r,p=u*i-o*s,m=o*r-c*i,v=c*m-u*p,_=u*h-o*m,w=o*p-c*h,y=d*2;return h*=y,p*=y,m*=y,v*=2,_*=2,w*=2,t[0]=i+h+v,t[1]=r+p+_,t[2]=s+m+w,t}const GW=(function(){const t=[0,0,0],e=[0,0,0];return function(n,i){Iv(t,n),Iv(e,i),Uv(t,t),Uv(e,e);let r=NP(t,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function jW(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}class Or extends Array{constructor(e=0,n=e,i=e){return super(e,n,i),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,n=e,i=e){return e.length?this.copy(e):(RW(this,e,n,i),this)}copy(e){return Iv(this,e),this}add(e,n){return n?vE(this,e,n):vE(this,this,e),this}sub(e,n){return n?yE(this,e,n):yE(this,this,e),this}multiply(e){return e.length?kW(this,this,e):Vg(this,this,e),this}divide(e){return e.length?LW(this,this,e):Vg(this,this,1/e),this}inverse(e=this){return UW(this,e),this}len(){return uu(this)}distance(e){return e?DW(this,e):uu(this)}squaredLen(){return _E(this)}squaredDistance(e){return e?NW(this,e):_E(this)}negate(e=this){return IW(this,e),this}cross(e,n){return n?xE(this,e,n):xE(this,this,e),this}scale(e){return Vg(this,this,e),this}normalize(){return Uv(this,this),this}dot(e){return NP(this,e)}equals(e){return jW(this,e)}applyMatrix3(e){return VW(this,this,e),this}applyMatrix4(e){return BW(this,this,e),this}scaleRotateMatrix4(e){return zW(this,this,e),this}applyQuaternion(e){return HW(this,this,e),this}angle(e){return GW(this,e)}lerp(e,n){return FW(this,this,e,n),this}smoothLerp(e,n,i){return OW(this,this,e,n,i),this}clone(){return new Or(this[0],this[1],this[2])}fromArray(e,n=0){return this[0]=e[n],this[1]=e[n+1],this[2]=e[n+2],this}toArray(e=[],n=0){return e[n]=this[0],e[n+1]=this[1],e[n+2]=this[2],e}transformDirection(e){const n=this[0],i=this[1],r=this[2];return this[0]=e[0]*n+e[4]*i+e[8]*r,this[1]=e[1]*n+e[5]*i+e[9]*r,this[2]=e[2]*n+e[6]*i+e[10]*r,this.normalize()}}const bE=new Or;let WW=1,$W=1,SE=!1;class XW{constructor(e,n={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=n,this.id=WW++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let i in n)this.addAttribute(i,n[i])}addAttribute(e,n){if(this.attributes[e]=n,n.id=$W++,n.size=n.size||1,n.type=n.type||(n.data.constructor===Float32Array?this.gl.FLOAT:n.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),n.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,n.normalized=n.normalized||!1,n.stride=n.stride||0,n.offset=n.offset||0,n.count=n.count||(n.stride?n.data.byteLength/n.stride:n.data.length/n.size),n.divisor=n.instanced||0,n.needsUpdate=!1,n.usage=n.usage||this.gl.STATIC_DRAW,n.buffer||this.updateAttribute(n),n.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==n.count*n.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,n.count*n.divisor);this.instancedCount=n.count*n.divisor}else e==="index"?this.drawRange.count=n.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,n.count))}updateAttribute(e){const n=!e.buffer;n&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),n?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((n,{name:i,type:r})=>{if(!this.attributes[i]){console.warn(`active attribute ${i} not being supplied`);return}const s=this.attributes[i];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let o=1;r===35674&&(o=2),r===35675&&(o=3),r===35676&&(o=4);const c=s.size/o,u=o===1?0:o*o*4,d=o===1?0:o*4;for(let h=0;h<o;h++)this.gl.vertexAttribPointer(n+h,c,s.type,s.normalized,s.stride+u,s.offset+h*d),this.gl.enableVertexAttribArray(n+h),this.gl.renderer.vertexAttribDivisor(n+h,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:n=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:s})=>{const o=this.attributes[s];o.needsUpdate&&this.updateAttribute(o)});let i=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(i=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(n,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i,this.instancedCount):this.gl.renderer.drawArraysInstanced(n,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(n,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i):this.gl.drawArrays(n,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!SE)return console.warn("No position buffer data found to compute bounds"),SE=!0}computeBoundingBox(e){e||(e=this.getPosition());const n=e.data,i=e.size;this.bounds||(this.bounds={min:new Or,max:new Or,center:new Or,scale:new Or,radius:1/0});const r=this.bounds.min,s=this.bounds.max,o=this.bounds.center,c=this.bounds.scale;r.set(1/0),s.set(-1/0);for(let u=0,d=n.length;u<d;u+=i){const h=n[u],p=n[u+1],m=n[u+2];r.x=Math.min(h,r.x),r.y=Math.min(p,r.y),r.z=Math.min(m,r.z),s.x=Math.max(h,s.x),s.y=Math.max(p,s.y),s.z=Math.max(m,s.z)}c.sub(s,r),o.add(r,s).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const n=e.data,i=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let s=0,o=n.length;s<o;s+=i)bE.fromArray(n,s),r=Math.max(r,this.bounds.center.squaredDistance(bE));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let qW=1;const wE={};class YW{constructor(e,{vertex:n,fragment:i,uniforms:r={},transparent:s=!1,cullFace:o=e.BACK,frontFace:c=e.CCW,depthTest:u=!0,depthWrite:d=!0,depthFunc:h=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=qW++,n||console.warn("vertex shader not supplied"),i||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=o,this.frontFace=c,this.depthTest=u,this.depthWrite=d,this.depthFunc=h,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:n,fragment:i})}setShaders({vertex:e,fragment:n}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
|
|
4862
|
+
`;function gE(t){let e=t.trim().replace("#","");e.length===3&&(e=e.split("").map(i=>i+i).join(""));const n=parseInt(e,16)||16777215;return{r:(n>>16&255)/255,g:(n>>8&255)/255,b:(n&255)/255}}function PW({className:t,style:e,wispDensity:n=1,dpr:i,mouseSmoothTime:r=.06,mouseTiltStrength:s=.01,horizontalBeamOffset:o=0,verticalBeamOffset:c=-.5,flowSpeed:u=.35,verticalSizing:d=2,horizontalSizing:h=.5,fogIntensity:p=.45,fogScale:m=.3,wispSpeed:v=15,wispIntensity:_=5,flowStrength:w=.25,decay:y=1.1,falloffStart:b=1.2,fogFallSpeed:T=.6,color:A="#8a7aff"}){const M=L.useRef(null),I=L.useRef(null),k=L.useRef(!1),U=L.useRef(null),S=L.useRef(!0),P=L.useRef(!1),V=L.useRef(r);return L.useEffect(()=>{V.current=r},[r]),L.useEffect(()=>{const O=M.current;let G;try{G=new TW({antialias:!1,alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,powerPreference:"high-performance"})}catch(At){console.warn("LaserFlow: WebGL not supported or context creation failed.",At);return}let H=Math.min(i??(window.devicePixelRatio||1),2);G.setPixelRatio(H),G.outputColorSpace=Ao,G.setClearColor(0,0);const X=G.domElement;X.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block;",O.appendChild(X);const K=new f6,Q=new o_(-1,1,1,-1,0,1),W=new gs;W.setAttribute("position",new Vr(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));const q={iTime:{value:0},iResolution:{value:new me(1,1,1)},iMouse:{value:new Vn(0,0,0,0)},uWispDensity:{value:n},uTiltScale:{value:s},uFlowTime:{value:0},uFogTime:{value:0},uBeamXFrac:{value:o},uBeamYFrac:{value:c},uFlowSpeed:{value:u},uVLenFactor:{value:d},uHLenFactor:{value:h},uFogIntensity:{value:p},uFogScale:{value:m},uWSpeed:{value:v},uWIntensity:{value:_},uFlowStrength:{value:w},uDecay:{value:y},uFalloffStart:{value:b},uFogFallSpeed:{value:T},uColor:{value:new me(1,1,1)},uFade:{value:k.current?1:0}};I.current=q;const{r:Z,g:z,b:ie}=gE(A);q.uColor.value.set(Z,z,ie);const we=new TP({vertexShader:AW,fragmentShader:CW,uniforms:q,transparent:!0,depthTest:!1,depthWrite:!1,blending:_o}),He=new ds(W,we);He.frustumCulled=!1,K.add(He);let Se=0,ne=0,ye=0;function be(){const At=O.clientWidth||1,Lt=O.clientHeight||1;Math.abs(At-Se)<1&&Math.abs(Lt-ne)<1&&Math.abs(H-ye)<.01||(Se=At,ne=Lt,ye=H,G.setPixelRatio(H),G.setSize(At,Lt,!1),q.iResolution.value.set(At*H,Lt*H,H),U.current=X.getBoundingClientRect())}let Ne=0;const et=new ResizeObserver(()=>{cancelAnimationFrame(Ne),Ne=requestAnimationFrame(be)});et.observe(O),be();const xt=new IntersectionObserver(At=>{S.current=At[0]?.isIntersecting??!0},{threshold:0});xt.observe(O),document.addEventListener("visibilitychange",()=>{P.current=document.hidden},{passive:!0});const pn=new bn(0,0),ht=new bn(0,0);function Ft(At){const Lt=U.current;Lt&&pn.set((At.clientX-Lt.left)*H,(Lt.height-(At.clientY-Lt.top))*H)}X.addEventListener("pointermove",Ft,{passive:!0}),X.addEventListener("pointerleave",()=>pn.set(0,0),{passive:!0});let nn=0,Dt=k.current?1:0;const an=new L6;let ee=0;function Sn(){if(ee=requestAnimationFrame(Sn),P.current||!S.current)return;const At=an.getElapsedTime(),Lt=Math.min(Math.max(At-nn,.001),.033);nn=At,q.iTime.value=At,q.uFlowTime.value+=Lt,q.uFogTime.value+=Lt,k.current||(Dt=Math.min(1,Dt+Lt/1),q.uFade.value=Dt,Dt>=1&&(k.current=!0));const it=Math.max(.001,V.current);ht.lerp(pn,1-Math.exp(-Lt/it)),q.iMouse.value.set(ht.x,ht.y,0,0),G.render(K,Q)}return Sn(),()=>{cancelAnimationFrame(ee),cancelAnimationFrame(Ne),et.disconnect(),xt.disconnect(),K.clear(),W.dispose(),we.dispose(),G.dispose(),G.forceContextLoss(),O.contains(X)&&O.removeChild(X)}},[i]),L.useEffect(()=>{const O=I.current;if(!O)return;O.uWispDensity.value=n,O.uTiltScale.value=s,O.uBeamXFrac.value=o,O.uBeamYFrac.value=c,O.uFlowSpeed.value=u,O.uVLenFactor.value=d,O.uHLenFactor.value=h,O.uFogIntensity.value=p,O.uFogScale.value=m,O.uWSpeed.value=v,O.uWIntensity.value=_,O.uFlowStrength.value=w,O.uDecay.value=y,O.uFalloffStart.value=b,O.uFogFallSpeed.value=T;const{r:G,g:J,b:H}=gE(A);O.uColor.value.set(G,J,H)},[n,s,o,c,u,d,h,p,m,v,_,w,y,b,T,A]),F.jsx("div",{ref:M,className:t,style:{position:"relative",overflow:"hidden",...e}})}function uu(t){let e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)}function Iv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function RW(t,e,n,i){return t[0]=e,t[1]=n,t[2]=i,t}function vE(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function yE(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function kW(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function LW(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function Vg(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function DW(t,e){let n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return Math.sqrt(n*n+i*i+r*r)}function NW(t,e){let n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return n*n+i*i+r*r}function _E(t){let e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i}function IW(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function UW(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function Uv(t,e){let n=e[0],i=e[1],r=e[2],s=n*n+i*i+r*r;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function NP(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xE(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[0],c=n[1],u=n[2];return t[0]=r*u-s*c,t[1]=s*o-i*u,t[2]=i*c-r*o,t}function FW(t,e,n,i){let r=e[0],s=e[1],o=e[2];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=o+i*(n[2]-o),t}function OW(t,e,n,i,r){const s=Math.exp(-i*r);let o=e[0],c=e[1],u=e[2];return t[0]=n[0]+(o-n[0])*s,t[1]=n[1]+(c-n[1])*s,t[2]=n[2]+(u-n[2])*s,t}function BW(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[3]*i+n[7]*r+n[11]*s+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*r+n[8]*s+n[12])/o,t[1]=(n[1]*i+n[5]*r+n[9]*s+n[13])/o,t[2]=(n[2]*i+n[6]*r+n[10]*s+n[14])/o,t}function zW(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[3]*i+n[7]*r+n[11]*s+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*r+n[8]*s)/o,t[1]=(n[1]*i+n[5]*r+n[9]*s)/o,t[2]=(n[2]*i+n[6]*r+n[10]*s)/o,t}function VW(t,e,n){let i=e[0],r=e[1],s=e[2];return t[0]=i*n[0]+r*n[3]+s*n[6],t[1]=i*n[1]+r*n[4]+s*n[7],t[2]=i*n[2]+r*n[5]+s*n[8],t}function HW(t,e,n){let i=e[0],r=e[1],s=e[2],o=n[0],c=n[1],u=n[2],d=n[3],h=c*s-u*r,p=u*i-o*s,m=o*r-c*i,v=c*m-u*p,_=u*h-o*m,w=o*p-c*h,y=d*2;return h*=y,p*=y,m*=y,v*=2,_*=2,w*=2,t[0]=i+h+v,t[1]=r+p+_,t[2]=s+m+w,t}const GW=(function(){const t=[0,0,0],e=[0,0,0];return function(n,i){Iv(t,n),Iv(e,i),Uv(t,t),Uv(e,e);let r=NP(t,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function jW(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}class Or extends Array{constructor(e=0,n=e,i=e){return super(e,n,i),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,n=e,i=e){return e.length?this.copy(e):(RW(this,e,n,i),this)}copy(e){return Iv(this,e),this}add(e,n){return n?vE(this,e,n):vE(this,this,e),this}sub(e,n){return n?yE(this,e,n):yE(this,this,e),this}multiply(e){return e.length?kW(this,this,e):Vg(this,this,e),this}divide(e){return e.length?LW(this,this,e):Vg(this,this,1/e),this}inverse(e=this){return UW(this,e),this}len(){return uu(this)}distance(e){return e?DW(this,e):uu(this)}squaredLen(){return _E(this)}squaredDistance(e){return e?NW(this,e):_E(this)}negate(e=this){return IW(this,e),this}cross(e,n){return n?xE(this,e,n):xE(this,this,e),this}scale(e){return Vg(this,this,e),this}normalize(){return Uv(this,this),this}dot(e){return NP(this,e)}equals(e){return jW(this,e)}applyMatrix3(e){return VW(this,this,e),this}applyMatrix4(e){return BW(this,this,e),this}scaleRotateMatrix4(e){return zW(this,this,e),this}applyQuaternion(e){return HW(this,this,e),this}angle(e){return GW(this,e)}lerp(e,n){return FW(this,this,e,n),this}smoothLerp(e,n,i){return OW(this,this,e,n,i),this}clone(){return new Or(this[0],this[1],this[2])}fromArray(e,n=0){return this[0]=e[n],this[1]=e[n+1],this[2]=e[n+2],this}toArray(e=[],n=0){return e[n]=this[0],e[n+1]=this[1],e[n+2]=this[2],e}transformDirection(e){const n=this[0],i=this[1],r=this[2];return this[0]=e[0]*n+e[4]*i+e[8]*r,this[1]=e[1]*n+e[5]*i+e[9]*r,this[2]=e[2]*n+e[6]*i+e[10]*r,this.normalize()}}const bE=new Or;let WW=1,$W=1,SE=!1;class XW{constructor(e,n={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=n,this.id=WW++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let i in n)this.addAttribute(i,n[i])}addAttribute(e,n){if(this.attributes[e]=n,n.id=$W++,n.size=n.size||1,n.type=n.type||(n.data.constructor===Float32Array?this.gl.FLOAT:n.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),n.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,n.normalized=n.normalized||!1,n.stride=n.stride||0,n.offset=n.offset||0,n.count=n.count||(n.stride?n.data.byteLength/n.stride:n.data.length/n.size),n.divisor=n.instanced||0,n.needsUpdate=!1,n.usage=n.usage||this.gl.STATIC_DRAW,n.buffer||this.updateAttribute(n),n.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==n.count*n.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,n.count*n.divisor);this.instancedCount=n.count*n.divisor}else e==="index"?this.drawRange.count=n.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,n.count))}updateAttribute(e){const n=!e.buffer;n&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),n?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((n,{name:i,type:r})=>{if(!this.attributes[i]){console.warn(`active attribute ${i} not being supplied`);return}const s=this.attributes[i];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let o=1;r===35674&&(o=2),r===35675&&(o=3),r===35676&&(o=4);const c=s.size/o,u=o===1?0:o*o*4,d=o===1?0:o*4;for(let h=0;h<o;h++)this.gl.vertexAttribPointer(n+h,c,s.type,s.normalized,s.stride+u,s.offset+h*d),this.gl.enableVertexAttribArray(n+h),this.gl.renderer.vertexAttribDivisor(n+h,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:n=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:s})=>{const o=this.attributes[s];o.needsUpdate&&this.updateAttribute(o)});let i=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(i=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(n,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i,this.instancedCount):this.gl.renderer.drawArraysInstanced(n,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(n,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i):this.gl.drawArrays(n,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!SE)return console.warn("No position buffer data found to compute bounds"),SE=!0}computeBoundingBox(e){e||(e=this.getPosition());const n=e.data,i=e.size;this.bounds||(this.bounds={min:new Or,max:new Or,center:new Or,scale:new Or,radius:1/0});const r=this.bounds.min,s=this.bounds.max,o=this.bounds.center,c=this.bounds.scale;r.set(1/0),s.set(-1/0);for(let u=0,d=n.length;u<d;u+=i){const h=n[u],p=n[u+1],m=n[u+2];r.x=Math.min(h,r.x),r.y=Math.min(p,r.y),r.z=Math.min(m,r.z),s.x=Math.max(h,s.x),s.y=Math.max(p,s.y),s.z=Math.max(m,s.z)}c.sub(s,r),o.add(r,s).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const n=e.data,i=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let s=0,o=n.length;s<o;s+=i)bE.fromArray(n,s),r=Math.max(r,this.bounds.center.squaredDistance(bE));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let qW=1;const wE={};class YW{constructor(e,{vertex:n,fragment:i,uniforms:r={},transparent:s=!1,cullFace:o=e.BACK,frontFace:c=e.CCW,depthTest:u=!0,depthWrite:d=!0,depthFunc:h=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=qW++,n||console.warn("vertex shader not supplied"),i||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=o,this.frontFace=c,this.depthTest=u,this.depthWrite=d,this.depthFunc=h,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:n,fragment:i})}setShaders({vertex:e,fragment:n}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
|
|
4862
4863
|
Vertex Shader
|
|
4863
4864
|
${EE(e)}`)),n&&(this.gl.shaderSource(this.fragmentShader,n),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)}
|
|
4864
4865
|
Fragment Shader
|
|
@@ -4962,4 +4963,4 @@ void main() {
|
|
|
4962
4963
|
vec4 color;
|
|
4963
4964
|
mainImage(color, gl_FragCoord.xy);
|
|
4964
4965
|
gl_FragColor = color;
|
|
4965
|
-
}`;function n$({raysOrigin:t="top-center",raysColor:e="#ffffff",raysSpeed:n=1,lightSpread:i=1,rayLength:r=2,pulsating:s=!1,fadeDistance:o=1,saturation:c=1,followMouse:u=!0,mouseInfluence:d=.1,noiseAmount:h=0,distortion:p=0,className:m=""}){const v=L.useRef(null),_=L.useRef(null),w=L.useRef(null),y=L.useRef({x:.5,y:.5}),b=L.useRef({x:.5,y:.5}),T=L.useRef(null),A=L.useRef(null),M=L.useRef(null),[I,k]=L.useState(!1),U=L.useRef(null);return L.useEffect(()=>{if(v.current)return U.current=new IntersectionObserver(S=>{k(S[0].isIntersecting)},{threshold:.1}),U.current.observe(v.current),()=>{U.current&&(U.current.disconnect(),U.current=null)}},[]),L.useEffect(()=>!I||!v.current?void 0:(M.current&&(M.current(),M.current=null),(async()=>{if(!v.current||(await new Promise(Q=>setTimeout(Q,10)),!v.current))return;const P=new e7({dpr:Math.min(window.devicePixelRatio,2),alpha:!0});w.current=P;const V=P.gl;for(V.canvas.style.width="100%",V.canvas.style.height="100%";v.current.firstChild;)v.current.removeChild(v.current.firstChild);v.current.appendChild(V.canvas);const O={iTime:{value:0},iResolution:{value:[1,1]},rayPos:{value:[0,0]},rayDir:{value:[0,1]},raysColor:{value:LE(e)},raysSpeed:{value:n},lightSpread:{value:i},rayLength:{value:r},pulsating:{value:s?1:0},fadeDistance:{value:o},saturation:{value:c},mousePos:{value:[.5,.5]},mouseInfluence:{value:d},noiseAmount:{value:h},distortion:{value:p}};_.current=O;const G=new Q7(V),J=new YW(V,{vertex:e$,fragment:t$,uniforms:O}),H=new J7(V,{geometry:G,program:J});A.current=H;const X=()=>{if(!v.current||!P)return;P.dpr=Math.min(window.devicePixelRatio,2);const{clientWidth:Q,clientHeight:W}=v.current;P.setSize(Q,W);const q=P.dpr,Z=Q*q,z=W*q;O.iResolution.value=[Z,z];const{anchor:ie,dir:Ee}=DE(t,Z,z);O.rayPos.value=ie,O.rayDir.value=Ee},K=Q=>{if(!(!w.current||!_.current||!A.current)){O.iTime.value=Q*.001,u&&d>0&&(b.current.x=b.current.x*.92+y.current.x*(1-.92),b.current.y=b.current.y*.92+y.current.y*(1-.92),O.mousePos.value=[b.current.x,b.current.y]);try{P.render({scene:H}),T.current=requestAnimationFrame(K)}catch(W){console.warn("WebGL rendering error:",W)}}};window.addEventListener("resize",X),X(),T.current=requestAnimationFrame(K),M.current=()=>{if(T.current&&(cancelAnimationFrame(T.current),T.current=null),window.removeEventListener("resize",X),P)try{const Q=P.gl.getExtension("WEBGL_lose_context");Q&&Q.loseContext();const W=P.gl.canvas;W&&W.parentNode&&W.parentNode.removeChild(W)}catch(Q){console.warn("Error during WebGL cleanup:",Q)}w.current=null,_.current=null,A.current=null}})(),()=>{M.current&&(M.current(),M.current=null)}),[I,t,e,n,i,r,s,o,c,u,d,h,p]),L.useEffect(()=>{if(!_.current||!v.current||!w.current)return;const S=_.current,P=w.current;S.raysColor.value=LE(e),S.raysSpeed.value=n,S.lightSpread.value=i,S.rayLength.value=r,S.pulsating.value=s?1:0,S.fadeDistance.value=o,S.saturation.value=c,S.mouseInfluence.value=d,S.noiseAmount.value=h,S.distortion.value=p;const{clientWidth:V,clientHeight:O}=v.current,G=P.dpr,{anchor:J,dir:H}=DE(t,V*G,O*G);S.rayPos.value=J,S.rayDir.value=H},[e,n,i,t,r,s,o,c,d,h,p]),L.useEffect(()=>{if(!u)return;const S=P=>{if(!v.current)return;const V=v.current.getBoundingClientRect();y.current={x:(P.clientX-V.left)/V.width,y:(P.clientY-V.top)/V.height}};return window.addEventListener("mousemove",S),()=>window.removeEventListener("mousemove",S)},[u]),F.jsx("div",{ref:v,className:`w-full h-full pointer-events-none z-[3] overflow-hidden relative ${m}`.trim()})}function i$({className:t}){return F.jsx("svg",{viewBox:"0 0 384 512",className:t,fill:"currentColor",children:F.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function r$({className:t}){return F.jsx("svg",{viewBox:"0 0 16 16",className:t,fill:"currentColor",children:F.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function s$({className:t}){return F.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[F.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),F.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function a$({className:t}){return F.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:F.jsx("polyline",{points:"20 6 9 17 4 12"})})}const NE="https://github.com/mm7894215/TokenTracker",o$="https://github.com/mm7894215/TokenTracker/releases/latest";function l$(t="default",e="md",n){const i="inline-flex items-center justify-center rounded font-medium transition-colors duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",r={default:"bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200",ghost:"text-oai-gray-600 hover:text-oai-gray-900 hover:bg-oai-gray-100 active:bg-oai-gray-200 dark:text-oai-gray-400 dark:hover:text-white dark:hover:bg-oai-gray-800 dark:active:bg-oai-gray-700"},s={sm:"h-9 px-4 text-sm",md:"h-11 px-6 text-sm",lg:"h-12 px-8 text-base"};return Mn(i,r[t],s[e],n)}function c$({copy:t,signInUrl:e,signUpUrl:n,installCommand:i,installCopied:r,onCopyInstallCommand:s}){const o=Lz(),[c,u]=L.useState(!1);L.useEffect(()=>{const w=()=>u(window.scrollY>10);return window.addEventListener("scroll",w,{passive:!0}),()=>window.removeEventListener("scroll",w)},[]);const d=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),{signedIn:h,loading:p}=Do(),m=L.useMemo(()=>({codex:t("landing.v2.models.agent.codex"),claude_code:t("landing.v2.models.agent.claude_code"),cursor:t("landing.v2.models.agent.cursor"),gemini:t("landing.v2.models.agent.gemini"),opencode:t("landing.v2.models.agent.opencode"),openclaw:t("landing.v2.models.agent.openclaw")}),[t]),v=L.useMemo(()=>[{id:"codex",icon:"/brand-logos/codex.svg"},{id:"claude_code",icon:"/brand-logos/claude-code.svg"},{id:"cursor",icon:"/brand-logos/cursor.svg"},{id:"gemini",icon:"/brand-logos/gemini.svg"},{id:"opencode",icon:"/brand-logos/opencode.svg"},{id:"openclaw",icon:"/brand-logos/openclaw.svg"}],[]),_=o?{duration:0}:void 0;return F.jsxs("div",{className:"relative min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark",children:[F.jsx("div",{className:"absolute inset-0 z-0 pointer-events-none",style:{height:"100vh"},children:F.jsx(n$,{raysOrigin:"top-center",raysColor:"#b8b3ff",raysSpeed:1,lightSpread:.5,rayLength:3,pulsating:!1,fadeDistance:1,saturation:1,followMouse:!0,mouseInfluence:.1,noiseAmount:0,distortion:0})}),F.jsx("header",{className:Mn("sticky top-0 z-50 transition-all duration-300",c?"bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-900":"bg-transparent border-b border-transparent"),children:F.jsxs("div",{className:"mx-auto flex h-14 max-w-7xl items-center justify-between px-4 sm:px-6",children:[F.jsxs("div",{className:"flex items-center gap-5",children:[F.jsxs(Us,{to:n||"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[F.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),F.jsx("span",{className:"text-sm font-semibold tracking-wide text-white uppercase",children:"Token Tracker"})]}),F.jsx("div",{className:"hidden sm:block",children:F.jsx(hH,{})})]}),d&&F.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:gap-3",children:[F.jsxs(Us,{to:fH(),className:Mn(l$(h||p?"default":"ghost","sm"),"no-underline px-5 rounded-full group",h||p?"shadow-sm ring-1 ring-white/10":"ring-1 ring-oai-gray-700"),children:[t("landing.v2.cta.primary"),F.jsx("span",{className:"ml-2 inline-block transition-transform duration-200 group-hover:translate-x-0.5",children:"→"})]}),F.jsx(H0,{})]})]})}),F.jsxs("main",{children:[F.jsx("section",{className:"relative py-16 sm:py-24 lg:py-32 overflow-hidden",children:F.jsxs("div",{className:"relative z-10 mx-auto max-w-7xl px-4 sm:px-6 flex flex-col items-center text-center gap-20 lg:gap-36",children:[F.jsxs(Il.div,{initial:o?!1:{opacity:0,y:20},animate:{opacity:1,y:0},transition:_||{duration:.5},className:"w-full max-w-3xl relative z-20",children:[F.jsxs("h1",{className:"text-balance text-5xl font-semibold tracking-tight text-white sm:text-6xl lg:text-[4rem] lg:leading-[1.05]",children:[t("landing.v2.hero.title_line1"),F.jsx("br",{}),F.jsx("span",{className:"bg-gradient-to-b from-white via-oai-gray-200 to-oai-gray-500 bg-clip-text text-transparent font-bold tracking-tight",style:{WebkitTextStroke:"1px rgba(255, 255, 255, 0.15)"},children:t("landing.v2.hero.title_line2")})]}),F.jsx("p",{className:"mt-6 text-lg leading-relaxed text-oai-gray-400",children:t("landing.v2.hero.subtagline")}),F.jsxs("div",{className:"mt-8 w-full max-w-lg mx-auto",children:[F.jsxs(Il.div,{whileHover:{scale:1.01,y:-1},transition:{type:"spring",stiffness:400,damping:25},className:"group relative inline-block w-full overflow-hidden rounded-2xl",style:{padding:"1.5px 0"},children:[F.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 bottom-[-11px] right-[-250%] rounded-full animate-star-movement-bottom z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),F.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 top-[-10px] left-[-250%] rounded-full animate-star-movement-top z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),F.jsxs("div",{className:"relative z-[1] flex items-center justify-between w-full bg-[#0a0a0a] border border-oai-gray-800 rounded-2xl p-1.5 pl-5 shadow-2xl shadow-black/50",children:[F.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[F.jsx("span",{className:"text-oai-gray-600 font-mono select-none","aria-hidden":"true",children:"›"}),F.jsx("code",{className:"font-mono text-sm text-oai-gray-200 overflow-x-auto whitespace-nowrap py-2 [scrollbar-width:none]",children:i?i.split(" ").map((w,y)=>F.jsxs("span",{className:w==="npx"||w==="tokentracker-cli"?"text-white font-medium":w==="--yes"?"text-oai-gray-500":"text-oai-brand-400",children:[w," "]},y)):null})]}),F.jsx("button",{type:"button",onClick:s,"aria-label":t(r?"landing.install.action.copied":"landing.install.action.copy"),className:"shrink-0 flex h-9 w-9 items-center justify-center text-oai-gray-200 bg-oai-gray-900 border border-oai-gray-700 rounded-lg hover:bg-oai-gray-800 hover:text-white active:scale-95 transition-all duration-200 shadow-sm",children:r?F.jsx(a$,{className:"h-4 w-4 text-green-400","aria-hidden":!0}):F.jsx(s$,{className:"h-4 w-4 opacity-70","aria-hidden":!0})})]})]}),F.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-x-6 gap-y-4",children:[F.jsxs("a",{href:o$,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[F.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-full bg-oai-gray-800 group-hover:bg-oai-gray-700 transition-colors",children:F.jsx(i$,{className:"h-4 w-4 text-oai-gray-400 group-hover:text-white"})}),t("landing.v2.install.mac_cta")]}),F.jsxs("a",{href:NE,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[F.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-full bg-oai-gray-800 group-hover:bg-oai-gray-700 transition-colors",children:F.jsx(r$,{className:"h-4 w-4 text-oai-gray-400 group-hover:text-white"})}),t("landing.cta.secondary")]})]}),F.jsx("span",{className:"sr-only","aria-live":"polite",children:r?t("landing.install.action.copied"):""})]})]}),F.jsx("div",{className:"relative group w-full",children:F.jsxs(Il.div,{initial:o?!1:{opacity:0,y:24},animate:{opacity:1,y:0},transition:_||{duration:.6,delay:.1},className:"relative w-full",children:[F.jsx("div",{style:{position:"absolute",top:"-256px",left:0,right:0,height:"510px",zIndex:3,pointerEvents:"none"},children:F.jsx(PW,{color:"#8a7aff",wispDensity:2,flowSpeed:.28,verticalSizing:2.2,horizontalSizing:1.22,fogIntensity:4,fogScale:.1,wispSpeed:18,wispIntensity:10,flowStrength:.12,decay:1.1,falloffStart:1.1,fogFallSpeed:.5,horizontalBeamOffset:.22,verticalBeamOffset:0,style:{width:"100%",height:"100%"}})}),F.jsx("div",{className:"relative rounded-xl p-[1px] shadow-2xl bg-gradient-to-b from-[rgba(138,122,255,0.6)] via-[rgba(138,122,255,0.15)] to-[rgba(138,122,255,0.05)]",style:{position:"relative",zIndex:10,boxShadow:"0 20px 60px -10px rgba(138,122,255,0.15), 0 4px 20px rgba(0,0,0,0.4)"},children:F.jsxs("div",{className:"relative rounded-[11px] overflow-hidden bg-oai-gray-950",children:[F.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"180px",background:"linear-gradient(to bottom, rgba(138,122,255,0.35) 0%, rgba(138,122,255,0.12) 40%, transparent 100%)",mixBlendMode:"screen",zIndex:20,pointerEvents:"none"}}),F.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"1px",background:"linear-gradient(90deg, transparent 0%, rgba(138,122,255,0.9) 30%, rgba(180,168,255,1) 50%, rgba(138,122,255,0.9) 70%, transparent 100%)",zIndex:25,pointerEvents:"none"}}),F.jsx("img",{src:"/dashboard-dark.png",alt:t("landing.screenshot.alt"),className:"block h-auto w-full object-cover",style:{position:"relative",zIndex:10},loading:"eager",decoding:"async"})]})})]})})]})}),F.jsx("section",{className:"border-y border-oai-gray-900 bg-oai-gray-950/50 py-12 lg:py-16",children:F.jsx("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:F.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-8",children:[F.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-400 shrink-0",children:t("landing.v2.models.title")}),F.jsx("div",{className:"flex flex-wrap items-center gap-x-8 gap-y-6 opacity-60 hover:opacity-100 transition-opacity duration-500 grayscale hover:grayscale-0",children:v.map(w=>F.jsxs("div",{className:"flex items-center gap-2.5 transition-transform hover:-translate-y-0.5 duration-300",children:[F.jsx("img",{src:w.icon,alt:"",width:20,height:20,className:`h-5 w-5 object-contain ${w.id==="cursor"?"dark:invert":""}`,loading:"lazy"}),F.jsx("span",{className:"text-sm font-medium text-oai-gray-300",children:m[w.id]})]},w.id))})]})})}),F.jsx("section",{className:"py-20 lg:py-32",children:F.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6 grid grid-cols-1 md:grid-cols-2 gap-16 lg:gap-24 items-start",children:[F.jsxs("div",{className:"max-w-md",children:[F.jsx("p",{className:"text-xs font-bold tracking-widest uppercase text-oai-brand-500 mb-4",children:t("landing.v2.compare.kicker")}),F.jsx("h2",{className:"text-3xl font-semibold tracking-tight text-white sm:text-4xl text-balance",children:t("landing.v2.compare.title")}),F.jsx("p",{className:"mt-6 text-lg leading-relaxed text-oai-gray-400",children:t("landing.v2.compare.subtitle")}),F.jsx("p",{className:"mt-6 text-base leading-relaxed text-oai-gray-500",children:t("landing.v2.distill.body")})]}),F.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-10",children:[F.jsxs("div",{className:"space-y-4",children:[F.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-white border-b border-oai-gray-800 pb-3",children:t("landing.v2.compare.with.title")}),F.jsxs("ul",{className:"space-y-3 text-sm text-oai-gray-400",children:[F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"text-oai-brand-500 shrink-0",children:"✦"}),F.jsx("span",{children:t("landing.v2.compare.with.p1")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"text-oai-brand-500 shrink-0",children:"✦"}),F.jsx("span",{children:t("landing.v2.compare.with.p2")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"text-oai-brand-500 shrink-0",children:"✦"}),F.jsx("span",{children:t("landing.v2.compare.with.p3")})]})]})]}),F.jsxs("div",{className:"space-y-4",children:[F.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-500 border-b border-oai-gray-800/50 pb-3",children:t("landing.v2.compare.without.title")}),F.jsxs("ul",{className:"space-y-3 text-sm text-oai-gray-500",children:[F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"opacity-50 shrink-0",children:"✕"}),F.jsx("span",{children:t("landing.v2.compare.without.p1")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"opacity-50 shrink-0",children:"✕"}),F.jsx("span",{children:t("landing.v2.compare.without.p2")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"opacity-50 shrink-0",children:"✕"}),F.jsx("span",{children:t("landing.v2.compare.without.p3")})]})]})]})]})]})})]}),F.jsx("footer",{className:"border-t border-oai-gray-900 bg-oai-gray-950 py-12",children:F.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col items-center justify-between gap-6 px-4 sm:px-6 text-sm text-oai-gray-400 sm:flex-row",children:[F.jsx("p",{children:t("landing.v2.footer.line")}),F.jsxs("div",{className:"flex items-center gap-6",children:[F.jsx("a",{href:NE,className:"font-medium text-oai-gray-400 hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:t("landing.v2.nav.github")}),d&&F.jsxs(Us,{to:e,className:"font-medium text-oai-brand-500 hover:text-oai-brand-400 transition-colors",children:[t("landing.cta.primary")," →"]})]})]})})]})}function u$({prefersReducedMotion:t,screenshotMode:e}){return!(e||t)}function d$(){return L.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function f$(t=0,e=!0){const[n,i]=L.useState(()=>!e);return L.useEffect(()=>{if(!e){i(!0);return}let r=null,s=null;const o=()=>i(!0);return typeof window<"u"&&"requestIdleCallback"in window?(s=window.requestIdleCallback(o,{timeout:t||200}),()=>{typeof window.cancelIdleCallback=="function"&&s!=null&&window.cancelIdleCallback(s)}):(r=window.setTimeout(o,t),()=>{r!=null&&window.clearTimeout(r)})},[t,e]),n}function h$({signInUrl:t,signUpUrl:e}){const n=Ct("landing.handle.special"),i=Ct("landing.handle.default");Ct("landing.nav.login"),Ct("landing.nav.signup");const[r,s]=L.useState(i),o=d$(),c=L.useMemo(()=>typeof window>"u"?!1:$C(window.location.search),[]),u=u$({prefersReducedMotion:o,screenshotMode:c});f$(250,u);const d="tokentracker.dashboard.from_landing.v1";L.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(d,"1")}catch{}},[d]),L.useMemo(()=>Ct("landing.handle.placeholder",{handle:n}),[n]),L.useMemo(()=>{const _=Ct(r===n?"landing.rank.singularity":"landing.rank.unranked");return Ct("landing.rank.expectation",{rank:_})},[r,n]);const h=Ct("landing.install.command"),[p,m]=L.useState(!1),v=async()=>{await uH(h)&&(m(!0),window.setTimeout(()=>m(!1),2e3))};return F.jsx(c$,{copy:Ct,reduceMotion:o,signInUrl:t,signUpUrl:e,installCommand:h,installCopied:p,onCopyInstallCommand:v})}function p$(t){const e=new URLSearchParams(t).get("next");return typeof e!="string"||e.length===0||!e.startsWith("/")||e.startsWith("//")?"/dashboard":e}const IE={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function UE(t){const e=String(t||"").trim();return IE[e]?IE[e]:e.replace(/-/g," ")}function m$(){const t=Au(),[e,n]=WL(),{enabled:i,loading:r,signedIn:s,refreshUser:o,signInWithPassword:c,signUp:u,signInWithOAuth:d,getPublicAuthConfig:h}=Do(),p=L.useMemo(()=>p$(e.toString()),[e]),[m,v]=L.useState("signin"),[_,w]=L.useState(""),[y,b]=L.useState(""),[T,A]=L.useState(""),[M,I]=L.useState(!1),[k,U]=L.useState(null),[S,P]=L.useState(null),[V,O]=L.useState(!0),[G,J]=L.useState([]),[H,X]=L.useState([]),[K,Q]=L.useState(8);L.useEffect(()=>{const Se=e.get("insforge_status"),ne=e.get("insforge_type"),ye=e.get("insforge_error");Se==="success"&&ne==="verify_email"?P(Ct("login.verify_email_success")):Se==="error"&&ne==="verify_email"&&ye&&P(Ct("shared.error.prefix",{error:ye}))},[e]),L.useEffect(()=>{if(!i){O(!1);return}let Se=!0;return(async()=>{const{data:ne,error:ye}=await h();Se&&(ye||!ne?(J(["google","github"]),X([])):(J(Array.isArray(ne.oAuthProviders)?ne.oAuthProviders:[]),X(Array.isArray(ne.customOAuthProviders)?ne.customOAuthProviders:[]),typeof ne.passwordMinLength=="number"&&ne.passwordMinLength>0&&Q(ne.passwordMinLength)),O(!1))})(),()=>{Se=!1}},[i,h]),L.useEffect(()=>{if(!(!i||r)&&s){if(W){window.location.href="/auth/native-callback";return}t(p,{replace:!0})}},[i,r,s,t,p,W]),L.useEffect(()=>{i&&o()},[i,o]);const W=L.useMemo(()=>e.get("native")==="1",[e]),q=L.useMemo(()=>e.get("provider")||null,[e]),Z=L.useMemo(()=>typeof window>"u"||W?"":`${window.location.origin}/`,[W]),z=L.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),ie=L.useCallback(async Se=>{Se.preventDefault(),U(null),I(!0);try{if(m==="signup"){const{data:ye,error:be}=await u({email:_.trim(),password:y,name:T.trim()||void 0,redirectTo:z});if(be){U(be.message||String(be));return}if(ye?.requireEmailVerification){P(Ct("login.verify_email_pending")),v("signin");return}t(p,{replace:!0});return}const{error:ne}=await c({email:_.trim(),password:y});if(ne){U(ne.message||String(ne));return}t(p,{replace:!0})}finally{I(!1)}},[m,_,y,T,u,c,t,p,z]),Ee=L.useCallback(async Se=>{U(null),I(!0);try{const{error:ne}=await d(Se,Z);ne&&U(ne.message||String(ne))}finally{I(!1)}},[d,Z]);L.useEffect(()=>{if(W&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[W]),L.useEffect(()=>{if(!i||r||s||V||!W||!q)return;[...G,...H].includes(q)&&Ee(q)},[i,r,s,V,W,q,G,H,Ee]);const ze=L.useCallback(()=>{n(Se=>{const ne=new URLSearchParams(Se);return ne.delete("insforge_status"),ne.delete("insforge_type"),ne.delete("insforge_error"),ne},{replace:!0}),P(null)},[n]);return i?F.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[F.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:F.jsx(Us,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:Ct("login.back_home")})}),F.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:F.jsxs("div",{className:"w-full max-w-md space-y-8",children:[F.jsxs("div",{className:"text-center",children:[F.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:Ct("login.title")}),F.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:Ct("login.subtitle")})]}),S?F.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[F.jsx("span",{children:S}),F.jsx("button",{type:"button",onClick:ze,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:Ct("login.dismiss")})]}):null,k?F.jsx("p",{className:"text-sm text-red-400",role:"alert",children:Ct("shared.error.prefix",{error:k})}):null,F.jsx("div",{className:"space-y-3",children:V?F.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):F.jsxs(F.Fragment,{children:[G.map(Se=>F.jsx("button",{type:"button",disabled:M,onClick:()=>Ee(Se),className:Mn("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:Ct("login.oauth.continue",{provider:UE(Se)})},Se)),H.map(Se=>F.jsx("button",{type:"button",disabled:M,onClick:()=>Ee(Se),className:Mn("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:Ct("login.oauth.continue",{provider:UE(Se)})},Se))]})}),F.jsxs("div",{className:"relative",children:[F.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:F.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),F.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:F.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:Ct("login.divider")})})]}),F.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[F.jsx("button",{type:"button",className:Mn("flex-1 py-2 text-sm font-medium rounded-md transition-colors",m==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{v("signin"),U(null)},children:Ct("login.tab.sign_in")}),F.jsx("button",{type:"button",className:Mn("flex-1 py-2 text-sm font-medium rounded-md transition-colors",m==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{v("signup"),U(null)},children:Ct("login.tab.sign_up")})]}),F.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[m==="signup"?F.jsxs("div",{children:[F.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:Ct("login.field.name")}),F.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:T,onChange:Se=>A(Se.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:Ct("login.field.name_placeholder")})]}):null,F.jsxs("div",{children:[F.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:Ct("login.field.email")}),F.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:_,onChange:Se=>w(Se.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),F.jsxs("div",{children:[F.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:Ct("login.field.password")}),F.jsx("input",{id:"login-password",type:"password",autoComplete:m==="signup"?"new-password":"current-password",required:!0,minLength:m==="signup"?K:void 0,value:y,onChange:Se=>b(Se.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),m==="signup"?F.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:Ct("login.password_hint",{min:String(K)})}):null]}),F.jsx("button",{type:"submit",disabled:M||r,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:Ct(m==="signup"?"login.submit.sign_up":"login.submit.sign_in")})]})]})})]}):F.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[F.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:F.jsx(Us,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:Ct("login.back_home")})}),F.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:F.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:Ct("login.cloud_only")})})]})}const g$=typeof window<"u"?window.location.search:"",FE=new URLSearchParams(g$),Mf=FE.get("insforge_code")||FE.get("code")||null;function v$(){const{loading:t,signedIn:e}=Do(),n=Au(),[i,r]=L.useState("processing"),[s,o]=L.useState(null),c=L.useRef(!1);return L.useEffect(()=>{!Mf||c.current||(c.current=!0,(async()=>{try{const d=await(await fetch("/api/auth-bridge/verifier")).json();o(!!d?.native)}catch{o(!1)}})())},[]),L.useEffect(()=>{if(s!==!0||!Mf)return;r("redirecting");const u=setTimeout(()=>{window.location.href=`tokentracker://auth/callback?insforge_code=${encodeURIComponent(Mf)}`},200);return()=>clearTimeout(u)},[s]),L.useEffect(()=>{if(s!==!1||t)return;if(e){n("/dashboard",{replace:!0});return}const u=setTimeout(()=>{e||r("failed")},5e3);return()=>clearTimeout(u)},[s,t,e,n]),L.useEffect(()=>{if(!Mf&&s===null){const u=setTimeout(()=>r("failed"),3e3);return()=>clearTimeout(u)}},[s]),i==="processing"&&s!==!0&&(s===null||s===!1&&t)?F.jsx("div",{className:"min-h-screen bg-oai-gray-950"}):F.jsx("div",{className:"min-h-screen bg-oai-gray-950 text-white font-oai antialiased dark flex items-center justify-center",children:F.jsxs("div",{className:"text-center space-y-4 max-w-sm px-4",children:[i==="processing"&&F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"w-8 h-8 border-2 border-oai-gray-600 border-t-white rounded-full animate-spin mx-auto"}),F.jsx("p",{className:"text-oai-gray-400 text-sm",children:"Processing…"})]}),i==="redirecting"&&F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"w-12 h-12 mx-auto rounded-full bg-green-500/15 flex items-center justify-center",children:F.jsx("svg",{className:"w-6 h-6 text-green-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:F.jsx("path",{d:"M20 6 9 17l-5-5"})})}),F.jsx("p",{className:"text-white text-sm font-medium",children:"Signed in successfully"}),F.jsx("p",{className:"text-oai-gray-500 text-xs",children:"Returning to TokenTracker…"})]}),i==="failed"&&F.jsxs("div",{className:"space-y-3",children:[F.jsx("p",{className:"text-oai-gray-300 text-sm",children:"Sign-in incomplete. Please try again."}),F.jsx("button",{type:"button",onClick:()=>window.close(),className:"px-4 py-2 rounded-lg bg-oai-gray-800 text-sm text-white hover:bg-oai-gray-700 transition-colors",children:"Close this page"})]})]})})}function y$(){const t=L.useContext(OT);if(t===null)throw new Error("useTheme must be used within a ThemeProvider");return t}const Fv="tt.sidebarCollapsed";function _$(){return[{id:"general",label:Ct("nav.group.general"),items:[{id:"usage",to:"/dashboard",icon:zz,label:Ct("nav.usage")},{id:"limits",to:"/limits",icon:Hz,label:Ct("nav.limits")},{id:"leaderboard",to:"/leaderboard",icon:rV,label:Ct("nav.leaderboard")}]},{id:"tools",label:Ct("nav.group.tools"),items:[{id:"widgets",to:"/widgets",icon:$z,label:Ct("nav.widgets")},{id:"ip-check",to:"/ip-check",icon:jz,label:"Claude IP Check"}]},{id:"account",label:Ct("nav.group.account"),items:[{id:"settings",to:"/settings",icon:tV,label:Ct("nav.settings")}]}]}function x$(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Fv)==="1"}catch{return!1}}function b$(){const[t,e]=L.useState(x$),n=L.useCallback(()=>{e(i=>{const r=!i;try{typeof window<"u"&&window.localStorage.setItem(Fv,r?"1":"0")}catch{}return r})},[]);return L.useEffect(()=>{if(typeof window>"u")return;const i=r=>{r.key===Fv&&e(r.newValue==="1")};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[]),{collapsed:t,toggle:n}}function S$(t,e){const n=t.replace(/\/+$/,"")||"/";return e==="/dashboard"?n==="/dashboard"||n==="/":e==="/leaderboard"?n==="/leaderboard"||n.startsWith("/leaderboard/"):n===e}function w$({label:t,collapsed:e,first:n}){return e?n?null:F.jsx("div",{className:"mx-2 my-2 h-px bg-oai-gray-200/70 dark:bg-oai-gray-800/70","aria-hidden":!0}):F.jsx("div",{className:Mn("px-3 pb-1 text-[10px] uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-500",n?"pt-2":"pt-4"),children:t})}function E$({item:t,collapsed:e,active:n,onClick:i}){const r=t.icon;return F.jsxs(Us,{to:t.to,onClick:i,title:e?t.label:void 0,"aria-current":n?"page":void 0,className:Mn("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] no-underline transition-colors",e&&"justify-center px-0 py-2",n?"bg-oai-gray-200/70 text-oai-black font-medium dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/50 hover:text-oai-black dark:hover:bg-oai-gray-800/60 dark:hover:text-white"),children:[F.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:F.jsx(r,{className:"h-[15px] w-[15px]","aria-hidden":!0})}),!e&&F.jsx("span",{className:"truncate",children:t.label})]})}function M$({as:t="button",title:e,onClick:n,href:i,children:r,className:s,...o}){const c=Mn("flex h-10 w-10 items-center justify-center rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",s);return t==="a"?F.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",title:e,"aria-label":e,className:c,...o,children:r}):F.jsx("button",{type:"button",title:e,"aria-label":e,onClick:n,className:c,...o,children:r})}function T$({repo:t="mm7894215/TokenTracker",glassChrome:e=!1}){const[n,i]=L.useState(null);return L.useEffect(()=>{if(typeof window>"u")return;const r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;ZC({prefersReducedMotion:r,screenshotCapture:!1})&&fetch(`https://api.github.com/repos/${t}`).then(s=>s.json()).then(s=>{s&&typeof s.stargazers_count=="number"&&i(s.stargazers_count)}).catch(()=>{})},[t]),F.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer","aria-label":n!==null?`Star on GitHub (${n})`:"Star on GitHub",className:Mn("inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:[F.jsx("svg",{height:"12",viewBox:"0 0 16 16",width:"12",className:"shrink-0 fill-current",children:F.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),F.jsx("span",{children:"Star"}),n!==null&&F.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-500 tabular-nums",children:n})]})}const A$=[{value:"light",label:"Light",Icon:PC},{value:"dark",label:"Dark",Icon:CC},{value:"system",label:"System",Icon:Jz}];function C$({theme:t,resolvedTheme:e,onSetTheme:n,glassChrome:i=!1}){const[r,s]=L.useState(!1),o=L.useRef(null),c=e==="dark"?CC:PC;return L.useEffect(()=>{if(!r)return;const u=h=>{o.current&&!o.current.contains(h.target)&&s(!1)},d=h=>{h.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d)}},[r]),F.jsxs("div",{ref:o,className:"relative",children:[F.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":r,"aria-haspopup":"menu",title:"Theme",onClick:()=>s(u=>!u),className:Mn("inline-flex h-7 w-7 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",i?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:F.jsx(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),r&&F.jsx("div",{role:"menu",className:"absolute bottom-full left-0 mb-2 z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg",children:A$.map(({value:u,label:d,Icon:h})=>{const p=t===u;return F.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{n(u),s(!1)},className:Mn("flex w-full items-center gap-2.5 px-3 py-1.5 text-[13px] transition-colors",p?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"),children:[F.jsx(h,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),F.jsx("span",{children:d})]},u)})})]})}function OP({collapsed:t,onToggleCollapsed:e,onItemClick:n,showCloseButton:i=!1,onClose:r,glassChrome:s=!1}){const c=vr()?.pathname||"/",{theme:u,resolvedTheme:d,setTheme:h}=y$(),p=L.useMemo(()=>_$(),[]);return F.jsxs(F.Fragment,{children:[F.jsx("div",{className:Mn("px-2 pt-2 pb-2",t&&"flex justify-center"),children:i?F.jsxs("div",{className:"flex items-center gap-2",children:[F.jsx("div",{className:"flex-1 min-w-0",children:F.jsx(H0,{variant:"sidebar",collapsed:t,onAfterAction:n})}),F.jsx("button",{type:"button",onClick:r,"aria-label":Ct("nav.close_menu"),title:Ct("nav.close_menu"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-500 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-gray-900 dark:hover:text-oai-gray-200 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:F.jsx(RC,{className:"h-4 w-4",strokeWidth:1.75,"aria-hidden":!0})})]}):F.jsx(H0,{variant:"sidebar",collapsed:t,onAfterAction:n})}),F.jsx("nav",{"aria-label":Ct("nav.nav_label"),className:"flex-1 px-2 pb-2 flex flex-col overflow-y-auto",children:p.map((m,v)=>F.jsxs("div",{className:"flex flex-col",children:[F.jsx(w$,{label:m.label,collapsed:t,first:v===0}),F.jsx("div",{className:"flex flex-col gap-0.5",children:m.items.map(_=>F.jsx(E$,{item:_,collapsed:t,active:S$(c,_.to),onClick:n},_.id))})]},m.id))}),F.jsxs("div",{className:Mn("flex items-center px-2 py-3",t?"flex-col justify-center gap-2":"justify-between gap-2"),children:[F.jsx(C$,{theme:u,resolvedTheme:d,onSetTheme:h,glassChrome:s}),F.jsx("div",{className:"flex items-center gap-1.5",children:!t&&F.jsx(T$,{glassChrome:s})})]})]})}function P$({collapsed:t,onToggleCollapsed:e}){const n=L.useMemo(()=>typeof window>"u"?!1:Aa()||UT(),[]);return F.jsx("aside",{"aria-label":Ct("nav.aside_label"),className:Mn("hidden lg:flex flex-col shrink-0 h-full min-h-0 transition-[width] duration-200",t?"w-[72px]":"w-[220px]"),children:F.jsx(OP,{collapsed:t,onToggleCollapsed:e,glassChrome:n})})}function R$({open:t,onClose:e}){return L.useEffect(()=>{if(!t)return;const n=i=>{i.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,e]),L.useEffect(()=>{if(!t)return;const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}},[t]),t?F.jsxs("div",{className:"lg:hidden fixed inset-0 z-[80] flex",children:[F.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:e,"aria-hidden":!0}),F.jsx("aside",{"aria-label":Ct("nav.aside_label"),className:"relative w-[260px] max-w-[80vw] flex flex-col bg-oai-white dark:bg-oai-gray-900 border-r border-oai-gray-200 dark:border-oai-gray-800 shadow-2xl",children:F.jsx(OP,{collapsed:!1,showCloseButton:!0,onClose:e,onItemClick:e})})]}):null}function k$({onOpenDrawer:t}){return F.jsxs("div",{className:"lg:hidden flex items-center justify-between gap-2 px-3 h-14 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[F.jsx(M$,{title:Ct("nav.menu"),onClick:t,children:F.jsx(Kz,{className:"h-5 w-5","aria-hidden":!0})}),F.jsxs(Us,{to:"/landing",className:"flex items-center gap-2 no-underline hover:opacity-80 transition-opacity","aria-label":"Token Tracker",children:[F.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),F.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:"Token Tracker"})]}),F.jsx("div",{className:"w-10 shrink-0","aria-hidden":!0})]})}function L$({children:t}){const{collapsed:e,toggle:n}=b$(),[i,r]=L.useState(!1),s=L.useCallback(()=>r(!0),[]),o=L.useCallback(()=>r(!1),[]),c=L.useMemo(()=>typeof window>"u"?!1:Aa()||UT(),[]);return F.jsxs("div",{className:Mn("fixed inset-0 flex flex-col text-oai-black dark:text-oai-white font-sans overflow-hidden",c?"bg-transparent":"bg-oai-gray-100 dark:bg-oai-gray-950"),children:[c&&F.jsx("div",{className:"h-7 shrink-0",style:{WebkitAppRegion:"drag"},"aria-hidden":!0}),F.jsxs("div",{className:"flex-1 min-h-0 flex",children:[F.jsx(P$,{collapsed:e,onToggleCollapsed:n}),F.jsx(R$,{open:i,onClose:o}),F.jsx("div",{className:"flex-1 min-w-0 min-h-0 p-2 lg:pl-0 lg:pr-3 lg:pb-3 flex flex-col",children:F.jsxs("div",{className:Mn("flex-1 min-h-0 flex flex-col bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",c?"tt-native-main-card":"rounded-2xl",!c&&"shadow-sm"),children:[F.jsx(k$,{onOpenDrawer:s}),F.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:t})]})})]})]})}const D$=hs.lazy(()=>No(()=>import("./DashboardPage-DiUhik_k.js"),__vite__mapDeps([0,1,2,3])).then(t=>({default:t.DashboardPage}))),N$=hs.lazy(()=>No(()=>import("./LeaderboardPage-ZpuPopCf.js"),__vite__mapDeps([4,5])).then(t=>({default:t.LeaderboardPage}))),I$=hs.lazy(()=>No(()=>import("./LeaderboardProfilePage-C62TdxVy.js"),__vite__mapDeps([6,5])).then(t=>({default:t.LeaderboardProfilePage}))),U$=hs.lazy(()=>No(()=>import("./LimitsPage-CQEaB_b2.js"),__vite__mapDeps([7,1,8,2,3])).then(t=>({default:t.LimitsPage}))),F$=hs.lazy(()=>No(()=>import("./SettingsPage-8RdfHCcA.js"),__vite__mapDeps([9,8,2,10])).then(t=>({default:t.SettingsPage}))),O$=hs.lazy(()=>No(()=>import("./WidgetsPage-DiKFOpFH.js"),__vite__mapDeps([11,3,10])).then(t=>({default:t.WidgetsPage}))),B$=hs.lazy(()=>No(()=>import("./IpCheckPage-UPn-zQGB.js"),[]));function z$(){const t=vr(),e=Do();lH();const n=xr(),i=L.useMemo(()=>typeof window>"u"?!1:$C(window.location.search),[]),r=t?.pathname||"/",s=new URL(window.location.href),o=s.pathname.replace(/\/+$/,"")||"/",u=o.match(/^\/share\/([^/?#]+)$/i)?.[1]||null,d=s.searchParams.get("token")||null,h=u||d,p=o==="/share"||o==="/share.html"||o.startsWith("/share/"),m=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),v=r.replace(/\/+$/,"")||"/",_=v.match(/^\/leaderboard\/u\/([^/]+)$/i),w=_?_[1]:null,y=v==="/leaderboard"||!!w,b=!!(e.enabled&&e.signedIn),T=m||b,A=!1,M=iH(),I=L.useMemo(()=>!e.enabled||!b?null:{getAccessToken:()=>e.getAccessToken(),name:e.displayName||"",userId:e.user?.id||null},[e,b]);let k=m||n||i?"dashboard":"landing";v==="/landing"&&(k="landing"),v==="/dashboard"&&(k="dashboard"),y&&(k="dashboard");const U=v==="/limits";U&&(k="dashboard");const S=v==="/settings";S&&(k="dashboard");const P=v==="/widgets";P&&(k="dashboard");const V=v==="/ip-check";V&&(k="dashboard");const O=w?I$:v==="/leaderboard"?N$:U?U$:S?F$:P?O$:V?B$:D$,J=!p&&(v==="/dashboard"||v==="/"||v==="/leaderboard"||U||S||P||V),H=F.jsx("div",{className:"min-h-screen bg-oai-white dark:bg-[#050505]"});let X=null;if(v==="/auth/callback"||v==="/auth/native-callback")X=F.jsx(v$,{});else if(v==="/login")X=F.jsx(m$,{});else if(k==="landing")X=F.jsx(h$,{signInUrl:"/login",signUpUrl:"/login"});else{const K=F.jsx(L.Suspense,{fallback:H,children:F.jsx(O,{baseUrl:M,auth:I,signedIn:T,sessionSoftExpired:A,signOut:()=>e.enabled?e.signOut():Promise.resolve(),publicMode:p,publicToken:h,userId:w,signInUrl:"/login",signUpUrl:"/login"})});X=J?F.jsx(L$,{children:K}):K}return F.jsx(TF,{children:F.jsx(LF,{children:F.jsxs(DF,{children:[X,F.jsx(tH,{}),F.jsx(TU,{}),F.jsx(FU,{})]})})})}const V$=OL([{path:"*",element:F.jsx(z$,{})}]);T2.createRoot(document.getElementById("root")).render(F.jsx(hs.StrictMode,{children:F.jsx(fU,{children:F.jsx(JL,{router:V$})})}));export{jU as $,pT as A,Ct as B,y$ as C,F as D,gy as E,YU as F,LT as G,Ov as H,uF as I,mh as J,WS as K,HS as L,jy as M,EX as N,my as O,Ml as P,py as Q,BE as R,ZL as S,wT as T,pF as U,$S as V,Kl as W,AT as X,GS as Y,ET as Z,OU as _,pi as a,GU as a0,BU as a1,f0 as a2,TT as a3,bX as a4,HU as a5,SX as a6,MT as a7,wX as a8,Us as a9,vr as aA,Au as aB,kX as aC,RI as aD,Y$ as aE,LX as aF,dX as aG,q$ as aH,fX as aI,hH as aJ,H0 as aK,tV as aL,_X as aM,vy as aN,UT as aO,MX as aP,PX as aQ,TX as aR,AX as aS,CX as aT,PC as aU,CC as aV,Jz as aW,BS as aX,uX as aY,PI as aZ,Aa as a_,Lz as aa,Il as ab,rF as ac,hs as ad,RC as ae,sX as af,rX as ag,zT as ah,Do as ai,E5 as aj,No as ak,DX as al,cX as am,$C as an,Ta as ao,hX as ap,Z$ as aq,J$ as ar,aX as as,HI as at,Q$ as au,eX as av,pX as aw,iX as ax,uH as ay,Mn as az,VT as b,Ia as c,dw as d,br as e,An as f,mT as g,xr as h,PO as i,K$ as j,UI as k,xX as l,Gl as m,WI as n,$I as o,gX as p,nX as q,L as r,lX as s,vX as t,yy as u,yX as v,tX as w,kn as x,oX as y,mX as z};
|
|
4966
|
+
}`;function n$({raysOrigin:t="top-center",raysColor:e="#ffffff",raysSpeed:n=1,lightSpread:i=1,rayLength:r=2,pulsating:s=!1,fadeDistance:o=1,saturation:c=1,followMouse:u=!0,mouseInfluence:d=.1,noiseAmount:h=0,distortion:p=0,className:m=""}){const v=L.useRef(null),_=L.useRef(null),w=L.useRef(null),y=L.useRef({x:.5,y:.5}),b=L.useRef({x:.5,y:.5}),T=L.useRef(null),A=L.useRef(null),M=L.useRef(null),[I,k]=L.useState(!1),U=L.useRef(null);return L.useEffect(()=>{if(v.current)return U.current=new IntersectionObserver(S=>{k(S[0].isIntersecting)},{threshold:.1}),U.current.observe(v.current),()=>{U.current&&(U.current.disconnect(),U.current=null)}},[]),L.useEffect(()=>!I||!v.current?void 0:(M.current&&(M.current(),M.current=null),(async()=>{if(!v.current||(await new Promise(Q=>setTimeout(Q,10)),!v.current))return;const P=new e7({dpr:Math.min(window.devicePixelRatio,2),alpha:!0});w.current=P;const V=P.gl;for(V.canvas.style.width="100%",V.canvas.style.height="100%";v.current.firstChild;)v.current.removeChild(v.current.firstChild);v.current.appendChild(V.canvas);const O={iTime:{value:0},iResolution:{value:[1,1]},rayPos:{value:[0,0]},rayDir:{value:[0,1]},raysColor:{value:LE(e)},raysSpeed:{value:n},lightSpread:{value:i},rayLength:{value:r},pulsating:{value:s?1:0},fadeDistance:{value:o},saturation:{value:c},mousePos:{value:[.5,.5]},mouseInfluence:{value:d},noiseAmount:{value:h},distortion:{value:p}};_.current=O;const G=new Q7(V),J=new YW(V,{vertex:e$,fragment:t$,uniforms:O}),H=new J7(V,{geometry:G,program:J});A.current=H;const X=()=>{if(!v.current||!P)return;P.dpr=Math.min(window.devicePixelRatio,2);const{clientWidth:Q,clientHeight:W}=v.current;P.setSize(Q,W);const q=P.dpr,Z=Q*q,z=W*q;O.iResolution.value=[Z,z];const{anchor:ie,dir:we}=DE(t,Z,z);O.rayPos.value=ie,O.rayDir.value=we},K=Q=>{if(!(!w.current||!_.current||!A.current)){O.iTime.value=Q*.001,u&&d>0&&(b.current.x=b.current.x*.92+y.current.x*(1-.92),b.current.y=b.current.y*.92+y.current.y*(1-.92),O.mousePos.value=[b.current.x,b.current.y]);try{P.render({scene:H}),T.current=requestAnimationFrame(K)}catch(W){console.warn("WebGL rendering error:",W)}}};window.addEventListener("resize",X),X(),T.current=requestAnimationFrame(K),M.current=()=>{if(T.current&&(cancelAnimationFrame(T.current),T.current=null),window.removeEventListener("resize",X),P)try{const Q=P.gl.getExtension("WEBGL_lose_context");Q&&Q.loseContext();const W=P.gl.canvas;W&&W.parentNode&&W.parentNode.removeChild(W)}catch(Q){console.warn("Error during WebGL cleanup:",Q)}w.current=null,_.current=null,A.current=null}})(),()=>{M.current&&(M.current(),M.current=null)}),[I,t,e,n,i,r,s,o,c,u,d,h,p]),L.useEffect(()=>{if(!_.current||!v.current||!w.current)return;const S=_.current,P=w.current;S.raysColor.value=LE(e),S.raysSpeed.value=n,S.lightSpread.value=i,S.rayLength.value=r,S.pulsating.value=s?1:0,S.fadeDistance.value=o,S.saturation.value=c,S.mouseInfluence.value=d,S.noiseAmount.value=h,S.distortion.value=p;const{clientWidth:V,clientHeight:O}=v.current,G=P.dpr,{anchor:J,dir:H}=DE(t,V*G,O*G);S.rayPos.value=J,S.rayDir.value=H},[e,n,i,t,r,s,o,c,d,h,p]),L.useEffect(()=>{if(!u)return;const S=P=>{if(!v.current)return;const V=v.current.getBoundingClientRect();y.current={x:(P.clientX-V.left)/V.width,y:(P.clientY-V.top)/V.height}};return window.addEventListener("mousemove",S),()=>window.removeEventListener("mousemove",S)},[u]),F.jsx("div",{ref:v,className:`w-full h-full pointer-events-none z-[3] overflow-hidden relative ${m}`.trim()})}function i$({className:t}){return F.jsx("svg",{viewBox:"0 0 384 512",className:t,fill:"currentColor",children:F.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function r$({className:t}){return F.jsx("svg",{viewBox:"0 0 16 16",className:t,fill:"currentColor",children:F.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function s$({className:t}){return F.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[F.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),F.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function a$({className:t}){return F.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:F.jsx("polyline",{points:"20 6 9 17 4 12"})})}const NE="https://github.com/mm7894215/TokenTracker",o$="https://github.com/mm7894215/TokenTracker/releases/latest";function l$(t="default",e="md",n){const i="inline-flex items-center justify-center rounded font-medium transition-colors duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",r={default:"bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200",ghost:"text-oai-gray-600 hover:text-oai-gray-900 hover:bg-oai-gray-100 active:bg-oai-gray-200 dark:text-oai-gray-400 dark:hover:text-white dark:hover:bg-oai-gray-800 dark:active:bg-oai-gray-700"},s={sm:"h-9 px-4 text-sm",md:"h-11 px-6 text-sm",lg:"h-12 px-8 text-base"};return Mn(i,r[t],s[e],n)}function c$({copy:t,signInUrl:e,signUpUrl:n,installCommand:i,installCopied:r,onCopyInstallCommand:s}){const o=Lz(),[c,u]=L.useState(!1);L.useEffect(()=>{const w=()=>u(window.scrollY>10);return window.addEventListener("scroll",w,{passive:!0}),()=>window.removeEventListener("scroll",w)},[]);const d=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),{signedIn:h,loading:p}=Do(),m=L.useMemo(()=>({codex:t("landing.v2.models.agent.codex"),claude_code:t("landing.v2.models.agent.claude_code"),cursor:t("landing.v2.models.agent.cursor"),gemini:t("landing.v2.models.agent.gemini"),opencode:t("landing.v2.models.agent.opencode"),openclaw:t("landing.v2.models.agent.openclaw")}),[t]),v=L.useMemo(()=>[{id:"codex",icon:"/brand-logos/codex.svg"},{id:"claude_code",icon:"/brand-logos/claude-code.svg"},{id:"cursor",icon:"/brand-logos/cursor.svg"},{id:"gemini",icon:"/brand-logos/gemini.svg"},{id:"opencode",icon:"/brand-logos/opencode.svg"},{id:"openclaw",icon:"/brand-logos/openclaw.svg"}],[]),_=o?{duration:0}:void 0;return F.jsxs("div",{className:"relative min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark",children:[F.jsx("div",{className:"absolute inset-0 z-0 pointer-events-none",style:{height:"100vh"},children:F.jsx(n$,{raysOrigin:"top-center",raysColor:"#b8b3ff",raysSpeed:1,lightSpread:.5,rayLength:3,pulsating:!1,fadeDistance:1,saturation:1,followMouse:!0,mouseInfluence:.1,noiseAmount:0,distortion:0})}),F.jsx("header",{className:Mn("sticky top-0 z-50 transition-all duration-300",c?"bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-900":"bg-transparent border-b border-transparent"),children:F.jsxs("div",{className:"mx-auto flex h-14 max-w-7xl items-center justify-between px-4 sm:px-6",children:[F.jsxs("div",{className:"flex items-center gap-5",children:[F.jsxs(Us,{to:n||"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[F.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),F.jsx("span",{className:"text-sm font-semibold tracking-wide text-white uppercase",children:"Token Tracker"})]}),F.jsx("div",{className:"hidden sm:block",children:F.jsx(hH,{})})]}),d&&F.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:gap-3",children:[F.jsxs(Us,{to:fH(),className:Mn(l$(h||p?"default":"ghost","sm"),"no-underline px-5 rounded-full group",h||p?"shadow-sm ring-1 ring-white/10":"ring-1 ring-oai-gray-700"),children:[t("landing.v2.cta.primary"),F.jsx("span",{className:"ml-2 inline-block transition-transform duration-200 group-hover:translate-x-0.5",children:"→"})]}),F.jsx(H0,{})]})]})}),F.jsxs("main",{children:[F.jsx("section",{className:"relative py-16 sm:py-24 lg:py-32 overflow-hidden",children:F.jsxs("div",{className:"relative z-10 mx-auto max-w-7xl px-4 sm:px-6 flex flex-col items-center text-center gap-20 lg:gap-36",children:[F.jsxs(Il.div,{initial:o?!1:{opacity:0,y:20},animate:{opacity:1,y:0},transition:_||{duration:.5},className:"w-full max-w-3xl relative z-20",children:[F.jsxs("h1",{className:"text-balance text-5xl font-semibold tracking-tight text-white sm:text-6xl lg:text-[4rem] lg:leading-[1.05]",children:[t("landing.v2.hero.title_line1"),F.jsx("br",{}),F.jsx("span",{className:"bg-gradient-to-b from-white via-oai-gray-200 to-oai-gray-500 bg-clip-text text-transparent font-bold tracking-tight",style:{WebkitTextStroke:"1px rgba(255, 255, 255, 0.15)"},children:t("landing.v2.hero.title_line2")})]}),F.jsx("p",{className:"mt-6 text-lg leading-relaxed text-oai-gray-400",children:t("landing.v2.hero.subtagline")}),F.jsxs("div",{className:"mt-8 w-full max-w-lg mx-auto",children:[F.jsxs(Il.div,{whileHover:{scale:1.01,y:-1},transition:{type:"spring",stiffness:400,damping:25},className:"group relative inline-block w-full overflow-hidden rounded-2xl",style:{padding:"1.5px 0"},children:[F.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 bottom-[-11px] right-[-250%] rounded-full animate-star-movement-bottom z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),F.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 top-[-10px] left-[-250%] rounded-full animate-star-movement-top z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),F.jsxs("div",{className:"relative z-[1] flex items-center justify-between w-full bg-[#0a0a0a] border border-oai-gray-800 rounded-2xl p-1.5 pl-5 shadow-2xl shadow-black/50",children:[F.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[F.jsx("span",{className:"text-oai-gray-600 font-mono select-none","aria-hidden":"true",children:"›"}),F.jsx("code",{className:"font-mono text-sm text-oai-gray-200 overflow-x-auto whitespace-nowrap py-2 [scrollbar-width:none]",children:i?i.split(" ").map((w,y)=>F.jsxs("span",{className:w==="npx"||w==="tokentracker-cli"?"text-white font-medium":w==="--yes"?"text-oai-gray-500":"text-oai-brand-400",children:[w," "]},y)):null})]}),F.jsx("button",{type:"button",onClick:s,"aria-label":t(r?"landing.install.action.copied":"landing.install.action.copy"),className:"shrink-0 flex h-9 w-9 items-center justify-center text-oai-gray-200 bg-oai-gray-900 border border-oai-gray-700 rounded-lg hover:bg-oai-gray-800 hover:text-white active:scale-95 transition-all duration-200 shadow-sm",children:r?F.jsx(a$,{className:"h-4 w-4 text-green-400","aria-hidden":!0}):F.jsx(s$,{className:"h-4 w-4 opacity-70","aria-hidden":!0})})]})]}),F.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-x-6 gap-y-4",children:[F.jsxs("a",{href:o$,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[F.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-full bg-oai-gray-800 group-hover:bg-oai-gray-700 transition-colors",children:F.jsx(i$,{className:"h-4 w-4 text-oai-gray-400 group-hover:text-white"})}),t("landing.v2.install.mac_cta")]}),F.jsxs("a",{href:NE,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[F.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-full bg-oai-gray-800 group-hover:bg-oai-gray-700 transition-colors",children:F.jsx(r$,{className:"h-4 w-4 text-oai-gray-400 group-hover:text-white"})}),t("landing.cta.secondary")]})]}),F.jsx("span",{className:"sr-only","aria-live":"polite",children:r?t("landing.install.action.copied"):""})]})]}),F.jsx("div",{className:"relative group w-full",children:F.jsxs(Il.div,{initial:o?!1:{opacity:0,y:24},animate:{opacity:1,y:0},transition:_||{duration:.6,delay:.1},className:"relative w-full",children:[F.jsx("div",{style:{position:"absolute",top:"-256px",left:0,right:0,height:"510px",zIndex:3,pointerEvents:"none"},children:F.jsx(PW,{color:"#8a7aff",wispDensity:2,flowSpeed:.28,verticalSizing:2.2,horizontalSizing:1.22,fogIntensity:4,fogScale:.1,wispSpeed:18,wispIntensity:10,flowStrength:.12,decay:1.1,falloffStart:1.1,fogFallSpeed:.5,horizontalBeamOffset:.22,verticalBeamOffset:0,style:{width:"100%",height:"100%"}})}),F.jsx("div",{className:"relative rounded-xl p-[1px] shadow-2xl bg-gradient-to-b from-[rgba(138,122,255,0.6)] via-[rgba(138,122,255,0.15)] to-[rgba(138,122,255,0.05)]",style:{position:"relative",zIndex:10,boxShadow:"0 20px 60px -10px rgba(138,122,255,0.15), 0 4px 20px rgba(0,0,0,0.4)"},children:F.jsxs("div",{className:"relative rounded-[11px] overflow-hidden bg-oai-gray-950",children:[F.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"180px",background:"linear-gradient(to bottom, rgba(138,122,255,0.35) 0%, rgba(138,122,255,0.12) 40%, transparent 100%)",mixBlendMode:"screen",zIndex:20,pointerEvents:"none"}}),F.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"1px",background:"linear-gradient(90deg, transparent 0%, rgba(138,122,255,0.9) 30%, rgba(180,168,255,1) 50%, rgba(138,122,255,0.9) 70%, transparent 100%)",zIndex:25,pointerEvents:"none"}}),F.jsx("img",{src:"/dashboard-dark.png",alt:t("landing.screenshot.alt"),className:"block h-auto w-full object-cover",style:{position:"relative",zIndex:10},loading:"eager",decoding:"async"})]})})]})})]})}),F.jsx("section",{className:"border-y border-oai-gray-900 bg-oai-gray-950/50 py-12 lg:py-16",children:F.jsx("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:F.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-8",children:[F.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-400 shrink-0",children:t("landing.v2.models.title")}),F.jsx("div",{className:"flex flex-wrap items-center gap-x-8 gap-y-6 opacity-60 hover:opacity-100 transition-opacity duration-500 grayscale hover:grayscale-0",children:v.map(w=>F.jsxs("div",{className:"flex items-center gap-2.5 transition-transform hover:-translate-y-0.5 duration-300",children:[F.jsx("img",{src:w.icon,alt:"",width:20,height:20,className:`h-5 w-5 object-contain ${w.id==="cursor"?"dark:invert":""}`,loading:"lazy"}),F.jsx("span",{className:"text-sm font-medium text-oai-gray-300",children:m[w.id]})]},w.id))})]})})}),F.jsx("section",{className:"py-20 lg:py-32",children:F.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6 grid grid-cols-1 md:grid-cols-2 gap-16 lg:gap-24 items-start",children:[F.jsxs("div",{className:"max-w-md",children:[F.jsx("p",{className:"text-xs font-bold tracking-widest uppercase text-oai-brand-500 mb-4",children:t("landing.v2.compare.kicker")}),F.jsx("h2",{className:"text-3xl font-semibold tracking-tight text-white sm:text-4xl text-balance",children:t("landing.v2.compare.title")}),F.jsx("p",{className:"mt-6 text-lg leading-relaxed text-oai-gray-400",children:t("landing.v2.compare.subtitle")}),F.jsx("p",{className:"mt-6 text-base leading-relaxed text-oai-gray-500",children:t("landing.v2.distill.body")})]}),F.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-10",children:[F.jsxs("div",{className:"space-y-4",children:[F.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-white border-b border-oai-gray-800 pb-3",children:t("landing.v2.compare.with.title")}),F.jsxs("ul",{className:"space-y-3 text-sm text-oai-gray-400",children:[F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"text-oai-brand-500 shrink-0",children:"✦"}),F.jsx("span",{children:t("landing.v2.compare.with.p1")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"text-oai-brand-500 shrink-0",children:"✦"}),F.jsx("span",{children:t("landing.v2.compare.with.p2")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"text-oai-brand-500 shrink-0",children:"✦"}),F.jsx("span",{children:t("landing.v2.compare.with.p3")})]})]})]}),F.jsxs("div",{className:"space-y-4",children:[F.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-500 border-b border-oai-gray-800/50 pb-3",children:t("landing.v2.compare.without.title")}),F.jsxs("ul",{className:"space-y-3 text-sm text-oai-gray-500",children:[F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"opacity-50 shrink-0",children:"✕"}),F.jsx("span",{children:t("landing.v2.compare.without.p1")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"opacity-50 shrink-0",children:"✕"}),F.jsx("span",{children:t("landing.v2.compare.without.p2")})]}),F.jsxs("li",{className:"flex gap-2",children:[F.jsx("span",{className:"opacity-50 shrink-0",children:"✕"}),F.jsx("span",{children:t("landing.v2.compare.without.p3")})]})]})]})]})]})})]}),F.jsx("footer",{className:"border-t border-oai-gray-900 bg-oai-gray-950 py-12",children:F.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col items-center justify-between gap-6 px-4 sm:px-6 text-sm text-oai-gray-400 sm:flex-row",children:[F.jsx("p",{children:t("landing.v2.footer.line")}),F.jsxs("div",{className:"flex items-center gap-6",children:[F.jsx("a",{href:NE,className:"font-medium text-oai-gray-400 hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:t("landing.v2.nav.github")}),d&&F.jsxs(Us,{to:e,className:"font-medium text-oai-brand-500 hover:text-oai-brand-400 transition-colors",children:[t("landing.cta.primary")," →"]})]})]})})]})}function u$({prefersReducedMotion:t,screenshotMode:e}){return!(e||t)}function d$(){return L.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function f$(t=0,e=!0){const[n,i]=L.useState(()=>!e);return L.useEffect(()=>{if(!e){i(!0);return}let r=null,s=null;const o=()=>i(!0);return typeof window<"u"&&"requestIdleCallback"in window?(s=window.requestIdleCallback(o,{timeout:t||200}),()=>{typeof window.cancelIdleCallback=="function"&&s!=null&&window.cancelIdleCallback(s)}):(r=window.setTimeout(o,t),()=>{r!=null&&window.clearTimeout(r)})},[t,e]),n}function h$({signInUrl:t,signUpUrl:e}){const n=Ct("landing.handle.special"),i=Ct("landing.handle.default");Ct("landing.nav.login"),Ct("landing.nav.signup");const[r,s]=L.useState(i),o=d$(),c=L.useMemo(()=>typeof window>"u"?!1:$C(window.location.search),[]),u=u$({prefersReducedMotion:o,screenshotMode:c});f$(250,u);const d="tokentracker.dashboard.from_landing.v1";L.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(d,"1")}catch{}},[d]),L.useMemo(()=>Ct("landing.handle.placeholder",{handle:n}),[n]),L.useMemo(()=>{const _=Ct(r===n?"landing.rank.singularity":"landing.rank.unranked");return Ct("landing.rank.expectation",{rank:_})},[r,n]);const h=Ct("landing.install.command"),[p,m]=L.useState(!1),v=async()=>{await uH(h)&&(m(!0),window.setTimeout(()=>m(!1),2e3))};return F.jsx(c$,{copy:Ct,reduceMotion:o,signInUrl:t,signUpUrl:e,installCommand:h,installCopied:p,onCopyInstallCommand:v})}function p$(t){const e=new URLSearchParams(t).get("next");return typeof e!="string"||e.length===0||!e.startsWith("/")||e.startsWith("//")?"/dashboard":e}const IE={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function UE(t){const e=String(t||"").trim();return IE[e]?IE[e]:e.replace(/-/g," ")}function m$(){const t=Au(),[e,n]=WL(),{enabled:i,loading:r,signedIn:s,refreshUser:o,signInWithPassword:c,signUp:u,signInWithOAuth:d,getPublicAuthConfig:h}=Do(),p=L.useMemo(()=>p$(e.toString()),[e]),[m,v]=L.useState("signin"),[_,w]=L.useState(""),[y,b]=L.useState(""),[T,A]=L.useState(""),[M,I]=L.useState(!1),[k,U]=L.useState(null),[S,P]=L.useState(null),[V,O]=L.useState(!0),[G,J]=L.useState([]),[H,X]=L.useState([]),[K,Q]=L.useState(8);L.useEffect(()=>{const Se=e.get("insforge_status"),ne=e.get("insforge_type"),ye=e.get("insforge_error");Se==="success"&&ne==="verify_email"?P(Ct("login.verify_email_success")):Se==="error"&&ne==="verify_email"&&ye&&P(Ct("shared.error.prefix",{error:ye}))},[e]),L.useEffect(()=>{if(!i){O(!1);return}let Se=!0;return(async()=>{const{data:ne,error:ye}=await h();Se&&(ye||!ne?(J(["google","github"]),X([])):(J(Array.isArray(ne.oAuthProviders)?ne.oAuthProviders:[]),X(Array.isArray(ne.customOAuthProviders)?ne.customOAuthProviders:[]),typeof ne.passwordMinLength=="number"&&ne.passwordMinLength>0&&Q(ne.passwordMinLength)),O(!1))})(),()=>{Se=!1}},[i,h]),L.useEffect(()=>{if(!(!i||r)&&s){if(W){window.location.href="/auth/native-callback";return}t(p,{replace:!0})}},[i,r,s,t,p,W]),L.useEffect(()=>{i&&o()},[i,o]);const W=L.useMemo(()=>e.get("native")==="1",[e]),q=L.useMemo(()=>e.get("provider")||null,[e]),Z=L.useMemo(()=>typeof window>"u"||W?"":`${window.location.origin}/`,[W]),z=L.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),ie=L.useCallback(async Se=>{Se.preventDefault(),U(null),I(!0);try{if(m==="signup"){const{data:ye,error:be}=await u({email:_.trim(),password:y,name:T.trim()||void 0,redirectTo:z});if(be){U(be.message||String(be));return}if(ye?.requireEmailVerification){P(Ct("login.verify_email_pending")),v("signin");return}t(p,{replace:!0});return}const{error:ne}=await c({email:_.trim(),password:y});if(ne){U(ne.message||String(ne));return}t(p,{replace:!0})}finally{I(!1)}},[m,_,y,T,u,c,t,p,z]),we=L.useCallback(async Se=>{U(null),I(!0);try{const{error:ne}=await d(Se,Z);ne&&U(ne.message||String(ne))}finally{I(!1)}},[d,Z]);L.useEffect(()=>{if(W&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[W]),L.useEffect(()=>{if(!i||r||s||V||!W||!q)return;[...G,...H].includes(q)&&we(q)},[i,r,s,V,W,q,G,H,we]);const He=L.useCallback(()=>{n(Se=>{const ne=new URLSearchParams(Se);return ne.delete("insforge_status"),ne.delete("insforge_type"),ne.delete("insforge_error"),ne},{replace:!0}),P(null)},[n]);return i?F.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[F.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:F.jsx(Us,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:Ct("login.back_home")})}),F.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:F.jsxs("div",{className:"w-full max-w-md space-y-8",children:[F.jsxs("div",{className:"text-center",children:[F.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:Ct("login.title")}),F.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:Ct("login.subtitle")})]}),S?F.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[F.jsx("span",{children:S}),F.jsx("button",{type:"button",onClick:He,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:Ct("login.dismiss")})]}):null,k?F.jsx("p",{className:"text-sm text-red-400",role:"alert",children:Ct("shared.error.prefix",{error:k})}):null,F.jsx("div",{className:"space-y-3",children:V?F.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):F.jsxs(F.Fragment,{children:[G.map(Se=>F.jsx("button",{type:"button",disabled:M,onClick:()=>we(Se),className:Mn("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:Ct("login.oauth.continue",{provider:UE(Se)})},Se)),H.map(Se=>F.jsx("button",{type:"button",disabled:M,onClick:()=>we(Se),className:Mn("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:Ct("login.oauth.continue",{provider:UE(Se)})},Se))]})}),F.jsxs("div",{className:"relative",children:[F.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:F.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),F.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:F.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:Ct("login.divider")})})]}),F.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[F.jsx("button",{type:"button",className:Mn("flex-1 py-2 text-sm font-medium rounded-md transition-colors",m==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{v("signin"),U(null)},children:Ct("login.tab.sign_in")}),F.jsx("button",{type:"button",className:Mn("flex-1 py-2 text-sm font-medium rounded-md transition-colors",m==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{v("signup"),U(null)},children:Ct("login.tab.sign_up")})]}),F.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[m==="signup"?F.jsxs("div",{children:[F.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:Ct("login.field.name")}),F.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:T,onChange:Se=>A(Se.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:Ct("login.field.name_placeholder")})]}):null,F.jsxs("div",{children:[F.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:Ct("login.field.email")}),F.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:_,onChange:Se=>w(Se.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),F.jsxs("div",{children:[F.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:Ct("login.field.password")}),F.jsx("input",{id:"login-password",type:"password",autoComplete:m==="signup"?"new-password":"current-password",required:!0,minLength:m==="signup"?K:void 0,value:y,onChange:Se=>b(Se.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),m==="signup"?F.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:Ct("login.password_hint",{min:String(K)})}):null]}),F.jsx("button",{type:"submit",disabled:M||r,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:Ct(m==="signup"?"login.submit.sign_up":"login.submit.sign_in")})]})]})})]}):F.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[F.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:F.jsx(Us,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:Ct("login.back_home")})}),F.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:F.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:Ct("login.cloud_only")})})]})}const g$=typeof window<"u"?window.location.search:"",FE=new URLSearchParams(g$),Mf=FE.get("insforge_code")||FE.get("code")||null;function v$(){const{loading:t,signedIn:e}=Do(),n=Au(),[i,r]=L.useState("processing"),[s,o]=L.useState(null),c=L.useRef(!1);return L.useEffect(()=>{!Mf||c.current||(c.current=!0,(async()=>{try{const d=await(await fetch("/api/auth-bridge/verifier")).json();o(!!d?.native)}catch{o(!1)}})())},[]),L.useEffect(()=>{if(s!==!0||!Mf)return;r("redirecting");const u=setTimeout(()=>{window.location.href=`tokentracker://auth/callback?insforge_code=${encodeURIComponent(Mf)}`},200);return()=>clearTimeout(u)},[s]),L.useEffect(()=>{if(s!==!1||t)return;if(e){n("/dashboard",{replace:!0});return}const u=setTimeout(()=>{e||r("failed")},5e3);return()=>clearTimeout(u)},[s,t,e,n]),L.useEffect(()=>{if(!Mf&&s===null){const u=setTimeout(()=>r("failed"),3e3);return()=>clearTimeout(u)}},[s]),i==="processing"&&s!==!0&&(s===null||s===!1&&t)?F.jsx("div",{className:"min-h-screen bg-oai-gray-950"}):F.jsx("div",{className:"min-h-screen bg-oai-gray-950 text-white font-oai antialiased dark flex items-center justify-center",children:F.jsxs("div",{className:"text-center space-y-4 max-w-sm px-4",children:[i==="processing"&&F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"w-8 h-8 border-2 border-oai-gray-600 border-t-white rounded-full animate-spin mx-auto"}),F.jsx("p",{className:"text-oai-gray-400 text-sm",children:"Processing…"})]}),i==="redirecting"&&F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"w-12 h-12 mx-auto rounded-full bg-green-500/15 flex items-center justify-center",children:F.jsx("svg",{className:"w-6 h-6 text-green-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:F.jsx("path",{d:"M20 6 9 17l-5-5"})})}),F.jsx("p",{className:"text-white text-sm font-medium",children:"Signed in successfully"}),F.jsx("p",{className:"text-oai-gray-500 text-xs",children:"Returning to TokenTracker…"})]}),i==="failed"&&F.jsxs("div",{className:"space-y-3",children:[F.jsx("p",{className:"text-oai-gray-300 text-sm",children:"Sign-in incomplete. Please try again."}),F.jsx("button",{type:"button",onClick:()=>window.close(),className:"px-4 py-2 rounded-lg bg-oai-gray-800 text-sm text-white hover:bg-oai-gray-700 transition-colors",children:"Close this page"})]})]})})}function y$(){const t=L.useContext(OT);if(t===null)throw new Error("useTheme must be used within a ThemeProvider");return t}const Fv="tt.sidebarCollapsed";function _$(){return[{id:"general",label:Ct("nav.group.general"),items:[{id:"usage",to:"/dashboard",icon:zz,label:Ct("nav.usage")},{id:"limits",to:"/limits",icon:Hz,label:Ct("nav.limits")},{id:"leaderboard",to:"/leaderboard",icon:rV,label:Ct("nav.leaderboard")}]},{id:"tools",label:Ct("nav.group.tools"),items:[{id:"widgets",to:"/widgets",icon:$z,label:Ct("nav.widgets")},{id:"ip-check",to:"/ip-check",icon:jz,label:"Claude IP Check"}]},{id:"account",label:Ct("nav.group.account"),items:[{id:"settings",to:"/settings",icon:tV,label:Ct("nav.settings")}]}]}function x$(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Fv)==="1"}catch{return!1}}function b$(){const[t,e]=L.useState(x$),n=L.useCallback(()=>{e(i=>{const r=!i;try{typeof window<"u"&&window.localStorage.setItem(Fv,r?"1":"0")}catch{}return r})},[]);return L.useEffect(()=>{if(typeof window>"u")return;const i=r=>{r.key===Fv&&e(r.newValue==="1")};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[]),{collapsed:t,toggle:n}}function S$(t,e){const n=t.replace(/\/+$/,"")||"/";return e==="/dashboard"?n==="/dashboard"||n==="/":e==="/leaderboard"?n==="/leaderboard"||n.startsWith("/leaderboard/"):n===e}function w$({label:t,collapsed:e,first:n}){return e?n?null:F.jsx("div",{className:"mx-2 my-2 h-px bg-oai-gray-200/70 dark:bg-oai-gray-800/70","aria-hidden":!0}):F.jsx("div",{className:Mn("px-3 pb-1 text-[10px] uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-500",n?"pt-2":"pt-4"),children:t})}function E$({item:t,collapsed:e,active:n,onClick:i}){const r=t.icon;return F.jsxs(Us,{to:t.to,onClick:i,title:e?t.label:void 0,"aria-current":n?"page":void 0,className:Mn("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] no-underline transition-colors",e&&"justify-center px-0 py-2",n?"bg-oai-gray-200/70 text-oai-black font-medium dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/50 hover:text-oai-black dark:hover:bg-oai-gray-800/60 dark:hover:text-white"),children:[F.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:F.jsx(r,{className:"h-[15px] w-[15px]","aria-hidden":!0})}),!e&&F.jsx("span",{className:"truncate",children:t.label})]})}function M$({as:t="button",title:e,onClick:n,href:i,children:r,className:s,...o}){const c=Mn("flex h-10 w-10 items-center justify-center rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",s);return t==="a"?F.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",title:e,"aria-label":e,className:c,...o,children:r}):F.jsx("button",{type:"button",title:e,"aria-label":e,onClick:n,className:c,...o,children:r})}function T$({repo:t="mm7894215/TokenTracker",glassChrome:e=!1}){const[n,i]=L.useState(null);return L.useEffect(()=>{if(typeof window>"u")return;const r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;ZC({prefersReducedMotion:r,screenshotCapture:!1})&&fetch(`https://api.github.com/repos/${t}`).then(s=>s.json()).then(s=>{s&&typeof s.stargazers_count=="number"&&i(s.stargazers_count)}).catch(()=>{})},[t]),F.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer","aria-label":n!==null?`Star on GitHub (${n})`:"Star on GitHub",className:Mn("inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:[F.jsx("svg",{height:"12",viewBox:"0 0 16 16",width:"12",className:"shrink-0 fill-current",children:F.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),F.jsx("span",{children:"Star"}),n!==null&&F.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-500 tabular-nums",children:n})]})}const A$=[{value:"light",label:"Light",Icon:PC},{value:"dark",label:"Dark",Icon:CC},{value:"system",label:"System",Icon:Jz}];function C$({theme:t,resolvedTheme:e,onSetTheme:n,glassChrome:i=!1}){const[r,s]=L.useState(!1),o=L.useRef(null),c=e==="dark"?CC:PC;return L.useEffect(()=>{if(!r)return;const u=h=>{o.current&&!o.current.contains(h.target)&&s(!1)},d=h=>{h.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d)}},[r]),F.jsxs("div",{ref:o,className:"relative",children:[F.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":r,"aria-haspopup":"menu",title:"Theme",onClick:()=>s(u=>!u),className:Mn("inline-flex h-7 w-7 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",i?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:F.jsx(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),r&&F.jsx("div",{role:"menu",className:"absolute bottom-full left-0 mb-2 z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg",children:A$.map(({value:u,label:d,Icon:h})=>{const p=t===u;return F.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{n(u),s(!1)},className:Mn("flex w-full items-center gap-2.5 px-3 py-1.5 text-[13px] transition-colors",p?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"),children:[F.jsx(h,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),F.jsx("span",{children:d})]},u)})})]})}function OP({collapsed:t,onToggleCollapsed:e,onItemClick:n,showCloseButton:i=!1,onClose:r,glassChrome:s=!1}){const c=vr()?.pathname||"/",{theme:u,resolvedTheme:d,setTheme:h}=y$(),p=L.useMemo(()=>_$(),[]);return F.jsxs(F.Fragment,{children:[F.jsx("div",{className:Mn("px-2 pt-2 pb-2",t&&"flex justify-center"),children:i?F.jsxs("div",{className:"flex items-center gap-2",children:[F.jsx("div",{className:"flex-1 min-w-0",children:F.jsx(H0,{variant:"sidebar",collapsed:t,onAfterAction:n})}),F.jsx("button",{type:"button",onClick:r,"aria-label":Ct("nav.close_menu"),title:Ct("nav.close_menu"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-500 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-gray-900 dark:hover:text-oai-gray-200 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:F.jsx(RC,{className:"h-4 w-4",strokeWidth:1.75,"aria-hidden":!0})})]}):F.jsx(H0,{variant:"sidebar",collapsed:t,onAfterAction:n})}),F.jsx("nav",{"aria-label":Ct("nav.nav_label"),className:"flex-1 px-2 pb-2 flex flex-col overflow-y-auto",children:p.map((m,v)=>F.jsxs("div",{className:"flex flex-col",children:[F.jsx(w$,{label:m.label,collapsed:t,first:v===0}),F.jsx("div",{className:"flex flex-col gap-0.5",children:m.items.map(_=>F.jsx(E$,{item:_,collapsed:t,active:S$(c,_.to),onClick:n},_.id))})]},m.id))}),F.jsxs("div",{className:Mn("flex items-center px-2 py-3",t?"flex-col justify-center gap-2":"justify-between gap-2"),children:[F.jsx(C$,{theme:u,resolvedTheme:d,onSetTheme:h,glassChrome:s}),F.jsx("div",{className:"flex items-center gap-1.5",children:!t&&F.jsx(T$,{glassChrome:s})})]})]})}function P$({collapsed:t,onToggleCollapsed:e}){const n=L.useMemo(()=>typeof window>"u"?!1:Aa()||UT(),[]);return F.jsx("aside",{"aria-label":Ct("nav.aside_label"),className:Mn("hidden lg:flex flex-col shrink-0 h-full min-h-0 transition-[width] duration-200",t?"w-[72px]":"w-[220px]"),children:F.jsx(OP,{collapsed:t,onToggleCollapsed:e,glassChrome:n})})}function R$({open:t,onClose:e}){return L.useEffect(()=>{if(!t)return;const n=i=>{i.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,e]),L.useEffect(()=>{if(!t)return;const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}},[t]),t?F.jsxs("div",{className:"lg:hidden fixed inset-0 z-[80] flex",children:[F.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:e,"aria-hidden":!0}),F.jsx("aside",{"aria-label":Ct("nav.aside_label"),className:"relative w-[260px] max-w-[80vw] flex flex-col bg-oai-white dark:bg-oai-gray-900 border-r border-oai-gray-200 dark:border-oai-gray-800 shadow-2xl",children:F.jsx(OP,{collapsed:!1,showCloseButton:!0,onClose:e,onItemClick:e})})]}):null}function k$({onOpenDrawer:t}){return F.jsxs("div",{className:"lg:hidden flex items-center justify-between gap-2 px-3 h-14 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[F.jsx(M$,{title:Ct("nav.menu"),onClick:t,children:F.jsx(Kz,{className:"h-5 w-5","aria-hidden":!0})}),F.jsxs(Us,{to:"/landing",className:"flex items-center gap-2 no-underline hover:opacity-80 transition-opacity","aria-label":"Token Tracker",children:[F.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),F.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:"Token Tracker"})]}),F.jsx("div",{className:"w-10 shrink-0","aria-hidden":!0})]})}function L$({children:t}){const{collapsed:e,toggle:n}=b$(),[i,r]=L.useState(!1),s=L.useCallback(()=>r(!0),[]),o=L.useCallback(()=>r(!1),[]),c=L.useMemo(()=>typeof window>"u"?!1:Aa()||UT(),[]);return F.jsxs("div",{className:Mn("fixed inset-0 flex flex-col text-oai-black dark:text-oai-white font-sans overflow-hidden",c?"bg-transparent":"bg-oai-gray-100 dark:bg-oai-gray-950"),children:[c&&F.jsx("div",{className:"h-7 shrink-0",style:{WebkitAppRegion:"drag"},"aria-hidden":!0}),F.jsxs("div",{className:"flex-1 min-h-0 flex",children:[F.jsx(P$,{collapsed:e,onToggleCollapsed:n}),F.jsx(R$,{open:i,onClose:o}),F.jsx("div",{className:"flex-1 min-w-0 min-h-0 p-2 lg:pl-0 lg:pr-3 lg:pb-3 flex flex-col",children:F.jsxs("div",{className:Mn("flex-1 min-h-0 flex flex-col bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",c?"tt-native-main-card":"rounded-2xl",!c&&"shadow-sm"),children:[F.jsx(k$,{onOpenDrawer:s}),F.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:t})]})})]})]})}const D$=hs.lazy(()=>No(()=>import("./DashboardPage-B32RhUB1.js"),__vite__mapDeps([0,1,2,3])).then(t=>({default:t.DashboardPage}))),N$=hs.lazy(()=>No(()=>import("./LeaderboardPage-CVKBhGzY.js"),__vite__mapDeps([4,5])).then(t=>({default:t.LeaderboardPage}))),I$=hs.lazy(()=>No(()=>import("./LeaderboardProfilePage-CbpzxvLA.js"),__vite__mapDeps([6,5])).then(t=>({default:t.LeaderboardProfilePage}))),U$=hs.lazy(()=>No(()=>import("./LimitsPage-BwQ4isbM.js"),__vite__mapDeps([7,1,8,2,3])).then(t=>({default:t.LimitsPage}))),F$=hs.lazy(()=>No(()=>import("./SettingsPage-Y3Znzs1i.js"),__vite__mapDeps([9,8,2,10])).then(t=>({default:t.SettingsPage}))),O$=hs.lazy(()=>No(()=>import("./WidgetsPage-tNojCBaj.js"),__vite__mapDeps([11,3,10])).then(t=>({default:t.WidgetsPage}))),B$=hs.lazy(()=>No(()=>import("./IpCheckPage-CrbKufId.js"),[]));function z$(){const t=vr(),e=Do();lH();const n=xr(),i=L.useMemo(()=>typeof window>"u"?!1:$C(window.location.search),[]),r=t?.pathname||"/",s=new URL(window.location.href),o=s.pathname.replace(/\/+$/,"")||"/",u=o.match(/^\/share\/([^/?#]+)$/i)?.[1]||null,d=s.searchParams.get("token")||null,h=u||d,p=o==="/share"||o==="/share.html"||o.startsWith("/share/"),m=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),v=r.replace(/\/+$/,"")||"/",_=v.match(/^\/leaderboard\/u\/([^/]+)$/i),w=_?_[1]:null,y=v==="/leaderboard"||!!w,b=!!(e.enabled&&e.signedIn),T=m||b,A=!1,M=iH(),I=L.useMemo(()=>!e.enabled||!b?null:{getAccessToken:()=>e.getAccessToken(),name:e.displayName||"",userId:e.user?.id||null},[e,b]);let k=m||n||i?"dashboard":"landing";v==="/landing"&&(k="landing"),v==="/dashboard"&&(k="dashboard"),y&&(k="dashboard");const U=v==="/limits";U&&(k="dashboard");const S=v==="/settings";S&&(k="dashboard");const P=v==="/widgets";P&&(k="dashboard");const V=v==="/ip-check";V&&(k="dashboard");const O=w?I$:v==="/leaderboard"?N$:U?U$:S?F$:P?O$:V?B$:D$,J=!p&&(v==="/dashboard"||v==="/"||v==="/leaderboard"||U||S||P||V),H=F.jsx("div",{className:"min-h-screen bg-oai-white dark:bg-[#050505]"});let X=null;if(v==="/auth/callback"||v==="/auth/native-callback")X=F.jsx(v$,{});else if(v==="/login")X=F.jsx(m$,{});else if(k==="landing")X=F.jsx(h$,{signInUrl:"/login",signUpUrl:"/login"});else{const K=F.jsx(L.Suspense,{fallback:H,children:F.jsx(O,{baseUrl:M,auth:I,signedIn:T,sessionSoftExpired:A,signOut:()=>e.enabled?e.signOut():Promise.resolve(),publicMode:p,publicToken:h,userId:w,signInUrl:"/login",signUpUrl:"/login"})});X=J?F.jsx(L$,{children:K}):K}return F.jsx(TF,{children:F.jsx(LF,{children:F.jsxs(DF,{children:[X,F.jsx(tH,{}),F.jsx(TU,{}),F.jsx(FU,{})]})})})}const V$=OL([{path:"*",element:F.jsx(z$,{})}]);T2.createRoot(document.getElementById("root")).render(F.jsx(hs.StrictMode,{children:F.jsx(fU,{children:F.jsx(JL,{router:V$})})}));export{jU as $,pT as A,Ct as B,y$ as C,F as D,gy as E,YU as F,LT as G,Ov as H,uF as I,mh as J,WS as K,HS as L,jy as M,EX as N,my as O,Ml as P,py as Q,BE as R,ZL as S,wT as T,pF as U,$S as V,Kl as W,AT as X,GS as Y,ET as Z,OU as _,pi as a,GU as a0,BU as a1,f0 as a2,TT as a3,bX as a4,HU as a5,SX as a6,MT as a7,wX as a8,Us as a9,vr as aA,Au as aB,kX as aC,RI as aD,Y$ as aE,LX as aF,dX as aG,q$ as aH,fX as aI,hH as aJ,H0 as aK,tV as aL,_X as aM,vy as aN,UT as aO,MX as aP,PX as aQ,TX as aR,AX as aS,CX as aT,PC as aU,CC as aV,Jz as aW,BS as aX,uX as aY,PI as aZ,Aa as a_,Lz as aa,Il as ab,rF as ac,hs as ad,RC as ae,sX as af,rX as ag,zT as ah,Do as ai,E5 as aj,No as ak,DX as al,cX as am,$C as an,Ta as ao,hX as ap,Z$ as aq,J$ as ar,aX as as,HI as at,Q$ as au,eX as av,pX as aw,iX as ax,uH as ay,Mn as az,VT as b,Ia as c,dw as d,br as e,An as f,mT as g,xr as h,PO as i,K$ as j,UI as k,xX as l,Gl as m,WI as n,$I as o,gX as p,nX as q,L as r,lX as s,vX as t,yy as u,yX as v,tX as w,kn as x,oX as y,mX as z};
|